PageRenderTime 48ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/graphics/inkscape/patches/patch-src_extension_internal_pdfinput_pdf-parser_cpp

https://bitbucket.org/bonetruck/openbsd-ports-tree
#! | 631 lines | 592 code | 39 blank | 0 comment | 0 complexity | e3faf78c1849b33e8a9510b9741089e7 MD5 | raw file
Possible License(s): LGPL-2.0, BSD-3-Clause-No-Nuclear-License-2014, BSD-3-Clause
  1. $OpenBSD: patch-src_extension_internal_pdfinput_pdf-parser_cpp,v 1.4 2012/07/13 15:10:47 kili Exp $
  2. Fix build with poppler-0.20. From arch linux.
  3. --- src/extension/internal/pdfinput/pdf-parser.cpp.orig Fri Jul 8 20:25:09 2011
  4. +++ src/extension/internal/pdfinput/pdf-parser.cpp Thu Jul 12 18:55:07 2012
  5. @@ -367,14 +367,14 @@ void PdfParser::parse(Object *obj, GBool topLevel) {
  6. for (i = 0; i < obj->arrayGetLength(); ++i) {
  7. obj->arrayGet(i, &obj2);
  8. if (!obj2.isStream()) {
  9. - error(-1, const_cast<char*>("Weird page contents"));
  10. + error(errInternal, -1, const_cast<char*>("Weird page contents"));
  11. obj2.free();
  12. return;
  13. }
  14. obj2.free();
  15. }
  16. } else if (!obj->isStream()) {
  17. - error(-1, const_cast<char*>("Weird page contents"));
  18. + error(errInternal, -1, const_cast<char*>("Weird page contents"));
  19. return;
  20. }
  21. parser = new Parser(xref, new Lexer(xref, obj), gFalse);
  22. @@ -419,7 +419,7 @@ void PdfParser::go(GBool topLevel) {
  23. // too many arguments - something is wrong
  24. } else {
  25. - error(getPos(), const_cast<char*>("Too many args in content stream"));
  26. + error(errInternal, getPos(), const_cast<char*>("Too many args in content stream"));
  27. if (printCommands) {
  28. printf("throwing away arg: ");
  29. obj.print(stdout);
  30. @@ -436,7 +436,7 @@ void PdfParser::go(GBool topLevel) {
  31. // args at end with no command
  32. if (numArgs > 0) {
  33. - error(getPos(), const_cast<char*>("Leftover args in content stream"));
  34. + error(errInternal, getPos(), const_cast<char*>("Leftover args in content stream"));
  35. if (printCommands) {
  36. printf("%d leftovers:", numArgs);
  37. for (i = 0; i < numArgs; ++i) {
  38. @@ -502,7 +502,7 @@ void PdfParser::execOp(Object *cmd, Object args[], int
  39. name = cmd->getCmd();
  40. if (!(op = findOp(name))) {
  41. if (ignoreUndef == 0)
  42. - error(getPos(), const_cast<char*>("Unknown operator '%s'"), name);
  43. + error(errInternal, getPos(), const_cast<char*>("Unknown operator '%s'"), name);
  44. return;
  45. }
  46. @@ -510,26 +510,26 @@ void PdfParser::execOp(Object *cmd, Object args[], int
  47. argPtr = args;
  48. if (op->numArgs >= 0) {
  49. if (numArgs < op->numArgs) {
  50. - error(getPos(), const_cast<char*>("Too few (%d) args to '%s' operator"), numArgs, name);
  51. + error(errInternal, getPos(), const_cast<char*>("Too few (%d) args to '%s' operator"), numArgs, name);
  52. return;
  53. }
  54. if (numArgs > op->numArgs) {
  55. #if 0
  56. - error(getPos(), "Too many (%d) args to '%s' operator", numArgs, name);
  57. + error(errInternal, getPos(), "Too many (%d) args to '%s' operator", numArgs, name);
  58. #endif
  59. argPtr += numArgs - op->numArgs;
  60. numArgs = op->numArgs;
  61. }
  62. } else {
  63. if (numArgs > -op->numArgs) {
  64. - error(getPos(), const_cast<char*>("Too many (%d) args to '%s' operator"),
  65. + error(errInternal, getPos(), const_cast<char*>("Too many (%d) args to '%s' operator"),
  66. numArgs, name);
  67. return;
  68. }
  69. }
  70. for (i = 0; i < numArgs; ++i) {
  71. if (!checkArg(&argPtr[i], op->tchk[i])) {
  72. - error(getPos(), const_cast<char*>("Arg #%d to '%s' operator is wrong type (%s)"),
  73. + error(errInternal, getPos(), const_cast<char*>("Arg #%d to '%s' operator is wrong type (%s)"),
  74. i, name, argPtr[i].getTypeName());
  75. return;
  76. }
  77. @@ -690,7 +690,7 @@ void PdfParser::opSetExtGState(Object args[], int numA
  78. return;
  79. }
  80. if (!obj1.isDict()) {
  81. - error(getPos(), const_cast<char*>("ExtGState '%s' is wrong type"), args[0].getName());
  82. + error(errInternal, getPos(), const_cast<char*>("ExtGState '%s' is wrong type"), args[0].getName());
  83. obj1.free();
  84. return;
  85. }
  86. @@ -705,7 +705,7 @@ void PdfParser::opSetExtGState(Object args[], int numA
  87. if (state->parseBlendMode(&obj2, &mode)) {
  88. state->setBlendMode(mode);
  89. } else {
  90. - error(getPos(), const_cast<char*>("Invalid blend mode in ExtGState"));
  91. + error(errInternal, getPos(), const_cast<char*>("Invalid blend mode in ExtGState"));
  92. }
  93. }
  94. obj2.free();
  95. @@ -764,7 +764,7 @@ void PdfParser::opSetExtGState(Object args[], int numA
  96. state->setTransfer(funcs);
  97. }
  98. } else if (!obj2.isNull()) {
  99. - error(getPos(), const_cast<char*>("Invalid transfer function in ExtGState"));
  100. + error(errInternal, getPos(), const_cast<char*>("Invalid transfer function in ExtGState"));
  101. }
  102. obj2.free();
  103. @@ -784,7 +784,7 @@ void PdfParser::opSetExtGState(Object args[], int numA
  104. funcs[0] = Function::parse(&obj3);
  105. if (funcs[0]->getInputSize() != 1 ||
  106. funcs[0]->getOutputSize() != 1) {
  107. - error(getPos(),
  108. + error(errInternal, getPos(),
  109. const_cast<char*>("Invalid transfer function in soft mask in ExtGState"));
  110. delete funcs[0];
  111. funcs[0] = NULL;
  112. @@ -809,11 +809,7 @@ void PdfParser::opSetExtGState(Object args[], int numA
  113. blendingColorSpace = NULL;
  114. isolated = knockout = gFalse;
  115. if (!obj4.dictLookup(const_cast<char*>("CS"), &obj5)->isNull()) {
  116. -#ifdef POPPLER_NEW_COLOR_SPACE_API
  117. blendingColorSpace = GfxColorSpace::parse(&obj5, NULL);
  118. -#else
  119. - blendingColorSpace = GfxColorSpace::parse(&obj5);
  120. -#endif
  121. }
  122. obj5.free();
  123. if (obj4.dictLookup(const_cast<char*>("I"), &obj5)->isBool()) {
  124. @@ -840,15 +836,15 @@ void PdfParser::opSetExtGState(Object args[], int numA
  125. delete funcs[0];
  126. }
  127. } else {
  128. - error(getPos(), const_cast<char*>("Invalid soft mask in ExtGState - missing group"));
  129. + error(errInternal, getPos(), const_cast<char*>("Invalid soft mask in ExtGState - missing group"));
  130. }
  131. obj4.free();
  132. } else {
  133. - error(getPos(), const_cast<char*>("Invalid soft mask in ExtGState - missing group"));
  134. + error(errInternal, getPos(), const_cast<char*>("Invalid soft mask in ExtGState - missing group"));
  135. }
  136. obj3.free();
  137. } else if (!obj2.isNull()) {
  138. - error(getPos(), const_cast<char*>("Invalid soft mask in ExtGState"));
  139. + error(errInternal, getPos(), const_cast<char*>("Invalid soft mask in ExtGState"));
  140. }
  141. }
  142. obj2.free();
  143. @@ -876,7 +872,7 @@ void PdfParser::doSoftMask(Object *str, GBool alpha,
  144. // check form type
  145. dict->lookup(const_cast<char*>("FormType"), &obj1);
  146. if (!(obj1.isNull() || (obj1.isInt() && obj1.getInt() == 1))) {
  147. - error(getPos(), const_cast<char*>("Unknown form type"));
  148. + error(errInternal, getPos(), const_cast<char*>("Unknown form type"));
  149. }
  150. obj1.free();
  151. @@ -884,7 +880,7 @@ void PdfParser::doSoftMask(Object *str, GBool alpha,
  152. dict->lookup(const_cast<char*>("BBox"), &obj1);
  153. if (!obj1.isArray()) {
  154. obj1.free();
  155. - error(getPos(), const_cast<char*>("Bad form bounding box"));
  156. + error(errInternal, getPos(), const_cast<char*>("Bad form bounding box"));
  157. return;
  158. }
  159. for (i = 0; i < 4; ++i) {
  160. @@ -1012,19 +1008,11 @@ void PdfParser::opSetFillColorSpace(Object args[], int
  161. state->setFillPattern(NULL);
  162. res->lookupColorSpace(args[0].getName(), &obj);
  163. -#ifdef POPPLER_NEW_COLOR_SPACE_API
  164. if (obj.isNull()) {
  165. colorSpace = GfxColorSpace::parse(&args[0], NULL);
  166. } else {
  167. colorSpace = GfxColorSpace::parse(&obj, NULL);
  168. }
  169. -#else
  170. - if (obj.isNull()) {
  171. - colorSpace = GfxColorSpace::parse(&args[0]);
  172. - } else {
  173. - colorSpace = GfxColorSpace::parse(&obj);
  174. - }
  175. -#endif
  176. obj.free();
  177. if (colorSpace) {
  178. state->setFillColorSpace(colorSpace);
  179. @@ -1032,7 +1020,7 @@ void PdfParser::opSetFillColorSpace(Object args[], int
  180. state->setFillColor(&color);
  181. builder->updateStyle(state);
  182. } else {
  183. - error(getPos(), const_cast<char*>("Bad color space (fill)"));
  184. + error(errInternal, getPos(), const_cast<char*>("Bad color space (fill)"));
  185. }
  186. }
  187. @@ -1043,19 +1031,11 @@ void PdfParser::opSetStrokeColorSpace(Object args[], i
  188. state->setStrokePattern(NULL);
  189. res->lookupColorSpace(args[0].getName(), &obj);
  190. -#ifdef POPPLER_NEW_COLOR_SPACE_API
  191. if (obj.isNull()) {
  192. colorSpace = GfxColorSpace::parse(&args[0], NULL);
  193. } else {
  194. colorSpace = GfxColorSpace::parse(&obj, NULL);
  195. }
  196. -#else
  197. - if (obj.isNull()) {
  198. - colorSpace = GfxColorSpace::parse(&args[0]);
  199. - } else {
  200. - colorSpace = GfxColorSpace::parse(&obj);
  201. - }
  202. -#endif
  203. obj.free();
  204. if (colorSpace) {
  205. state->setStrokeColorSpace(colorSpace);
  206. @@ -1063,7 +1043,7 @@ void PdfParser::opSetStrokeColorSpace(Object args[], i
  207. state->setStrokeColor(&color);
  208. builder->updateStyle(state);
  209. } else {
  210. - error(getPos(), const_cast<char*>("Bad color space (stroke)"));
  211. + error(errInternal, getPos(), const_cast<char*>("Bad color space (stroke)"));
  212. }
  213. }
  214. @@ -1072,7 +1052,7 @@ void PdfParser::opSetFillColor(Object args[], int numA
  215. int i;
  216. if (numArgs != state->getFillColorSpace()->getNComps()) {
  217. - error(getPos(), const_cast<char*>("Incorrect number of arguments in 'sc' command"));
  218. + error(errInternal, getPos(), const_cast<char*>("Incorrect number of arguments in 'sc' command"));
  219. return;
  220. }
  221. state->setFillPattern(NULL);
  222. @@ -1088,7 +1068,7 @@ void PdfParser::opSetStrokeColor(Object args[], int nu
  223. int i;
  224. if (numArgs != state->getStrokeColorSpace()->getNComps()) {
  225. - error(getPos(), const_cast<char*>("Incorrect number of arguments in 'SC' command"));
  226. + error(errInternal, getPos(), const_cast<char*>("Incorrect number of arguments in 'SC' command"));
  227. return;
  228. }
  229. state->setStrokePattern(NULL);
  230. @@ -1109,7 +1089,7 @@ void PdfParser::opSetFillColorN(Object args[], int num
  231. if (!((GfxPatternColorSpace *)state->getFillColorSpace())->getUnder() ||
  232. numArgs - 1 != ((GfxPatternColorSpace *)state->getFillColorSpace())
  233. ->getUnder()->getNComps()) {
  234. - error(getPos(), const_cast<char*>("Incorrect number of arguments in 'scn' command"));
  235. + error(errInternal, getPos(), const_cast<char*>("Incorrect number of arguments in 'scn' command"));
  236. return;
  237. }
  238. for (i = 0; i < numArgs - 1 && i < gfxColorMaxComps; ++i) {
  239. @@ -1120,23 +1100,15 @@ void PdfParser::opSetFillColorN(Object args[], int num
  240. state->setFillColor(&color);
  241. builder->updateStyle(state);
  242. }
  243. -#ifdef POPPLER_NEW_COLOR_SPACE_API
  244. if (args[numArgs-1].isName() &&
  245. (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL))) {
  246. state->setFillPattern(pattern);
  247. builder->updateStyle(state);
  248. }
  249. -#else
  250. - if (args[numArgs-1].isName() &&
  251. - (pattern = res->lookupPattern(args[numArgs-1].getName()))) {
  252. - state->setFillPattern(pattern);
  253. - builder->updateStyle(state);
  254. - }
  255. -#endif
  256. } else {
  257. if (numArgs != state->getFillColorSpace()->getNComps()) {
  258. - error(getPos(), const_cast<char*>("Incorrect number of arguments in 'scn' command"));
  259. + error(errInternal, getPos(), const_cast<char*>("Incorrect number of arguments in 'scn' command"));
  260. return;
  261. }
  262. state->setFillPattern(NULL);
  263. @@ -1161,7 +1133,7 @@ void PdfParser::opSetStrokeColorN(Object args[], int n
  264. ->getUnder() ||
  265. numArgs - 1 != ((GfxPatternColorSpace *)state->getStrokeColorSpace())
  266. ->getUnder()->getNComps()) {
  267. - error(getPos(), const_cast<char*>("Incorrect number of arguments in 'SCN' command"));
  268. + error(errInternal, getPos(), const_cast<char*>("Incorrect number of arguments in 'SCN' command"));
  269. return;
  270. }
  271. for (i = 0; i < numArgs - 1 && i < gfxColorMaxComps; ++i) {
  272. @@ -1172,23 +1144,15 @@ void PdfParser::opSetStrokeColorN(Object args[], int n
  273. state->setStrokeColor(&color);
  274. builder->updateStyle(state);
  275. }
  276. -#ifdef POPPLER_NEW_COLOR_SPACE_API
  277. if (args[numArgs-1].isName() &&
  278. (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL))) {
  279. state->setStrokePattern(pattern);
  280. builder->updateStyle(state);
  281. }
  282. -#else
  283. - if (args[numArgs-1].isName() &&
  284. - (pattern = res->lookupPattern(args[numArgs-1].getName()))) {
  285. - state->setStrokePattern(pattern);
  286. - builder->updateStyle(state);
  287. - }
  288. -#endif
  289. } else {
  290. if (numArgs != state->getStrokeColorSpace()->getNComps()) {
  291. - error(getPos(), const_cast<char*>("Incorrect number of arguments in 'SCN' command"));
  292. + error(errInternal, getPos(), const_cast<char*>("Incorrect number of arguments in 'SCN' command"));
  293. return;
  294. }
  295. state->setStrokePattern(NULL);
  296. @@ -1212,7 +1176,7 @@ void PdfParser::opMoveTo(Object args[], int numArgs) {
  297. void PdfParser::opLineTo(Object args[], int numArgs) {
  298. if (!state->isCurPt()) {
  299. - error(getPos(), const_cast<char*>("No current point in lineto"));
  300. + error(errInternal, getPos(), const_cast<char*>("No current point in lineto"));
  301. return;
  302. }
  303. state->lineTo(args[0].getNum(), args[1].getNum());
  304. @@ -1222,7 +1186,7 @@ void PdfParser::opCurveTo(Object args[], int numArgs)
  305. double x1, y1, x2, y2, x3, y3;
  306. if (!state->isCurPt()) {
  307. - error(getPos(), const_cast<char*>("No current point in curveto"));
  308. + error(errInternal, getPos(), const_cast<char*>("No current point in curveto"));
  309. return;
  310. }
  311. x1 = args[0].getNum();
  312. @@ -1238,7 +1202,7 @@ void PdfParser::opCurveTo1(Object args[], int numArgs)
  313. double x1, y1, x2, y2, x3, y3;
  314. if (!state->isCurPt()) {
  315. - error(getPos(), const_cast<char*>("No current point in curveto1"));
  316. + error(errInternal, getPos(), const_cast<char*>("No current point in curveto1"));
  317. return;
  318. }
  319. x1 = state->getCurX();
  320. @@ -1254,7 +1218,7 @@ void PdfParser::opCurveTo2(Object args[], int numArgs)
  321. double x1, y1, x2, y2, x3, y3;
  322. if (!state->isCurPt()) {
  323. - error(getPos(), const_cast<char*>("No current point in curveto2"));
  324. + error(errInternal, getPos(), const_cast<char*>("No current point in curveto2"));
  325. return;
  326. }
  327. x1 = args[0].getNum();
  328. @@ -1282,7 +1246,7 @@ void PdfParser::opRectangle(Object args[], int numArgs
  329. void PdfParser::opClosePath(Object args[], int numArgs) {
  330. if (!state->isCurPt()) {
  331. - error(getPos(), const_cast<char*>("No current point in closepath"));
  332. + error(errInternal, getPos(), const_cast<char*>("No current point in closepath"));
  333. return;
  334. }
  335. state->closePath();
  336. @@ -1298,7 +1262,7 @@ void PdfParser::opEndPath(Object args[], int numArgs)
  337. void PdfParser::opStroke(Object args[], int numArgs) {
  338. if (!state->isCurPt()) {
  339. - //error(getPos(), const_cast<char*>("No path in stroke"));
  340. + //error(errInternal, getPos(), const_cast<char*>("No path in stroke"));
  341. return;
  342. }
  343. if (state->isPath()) {
  344. @@ -1314,7 +1278,7 @@ void PdfParser::opStroke(Object args[], int numArgs) {
  345. void PdfParser::opCloseStroke(Object * /*args[]*/, int /*numArgs*/) {
  346. if (!state->isCurPt()) {
  347. - //error(getPos(), const_cast<char*>("No path in closepath/stroke"));
  348. + //error(errInternal, getPos(), const_cast<char*>("No path in closepath/stroke"));
  349. return;
  350. }
  351. state->closePath();
  352. @@ -1331,7 +1295,7 @@ void PdfParser::opCloseStroke(Object * /*args[]*/, int
  353. void PdfParser::opFill(Object args[], int numArgs) {
  354. if (!state->isCurPt()) {
  355. - //error(getPos(), const_cast<char*>("No path in fill"));
  356. + //error(errInternal, getPos(), const_cast<char*>("No path in fill"));
  357. return;
  358. }
  359. if (state->isPath()) {
  360. @@ -1347,7 +1311,7 @@ void PdfParser::opFill(Object args[], int numArgs) {
  361. void PdfParser::opEOFill(Object args[], int numArgs) {
  362. if (!state->isCurPt()) {
  363. - //error(getPos(), const_cast<char*>("No path in eofill"));
  364. + //error(errInternal, getPos(), const_cast<char*>("No path in eofill"));
  365. return;
  366. }
  367. if (state->isPath()) {
  368. @@ -1363,7 +1327,7 @@ void PdfParser::opEOFill(Object args[], int numArgs) {
  369. void PdfParser::opFillStroke(Object args[], int numArgs) {
  370. if (!state->isCurPt()) {
  371. - //error(getPos(), const_cast<char*>("No path in fill/stroke"));
  372. + //error(errInternal, getPos(), const_cast<char*>("No path in fill/stroke"));
  373. return;
  374. }
  375. if (state->isPath()) {
  376. @@ -1376,7 +1340,7 @@ void PdfParser::opFillStroke(Object args[], int numArg
  377. void PdfParser::opCloseFillStroke(Object args[], int numArgs) {
  378. if (!state->isCurPt()) {
  379. - //error(getPos(), const_cast<char*>("No path in closepath/fill/stroke"));
  380. + //error(errInternal, getPos(), const_cast<char*>("No path in closepath/fill/stroke"));
  381. return;
  382. }
  383. if (state->isPath()) {
  384. @@ -1388,7 +1352,7 @@ void PdfParser::opCloseFillStroke(Object args[], int n
  385. void PdfParser::opEOFillStroke(Object args[], int numArgs) {
  386. if (!state->isCurPt()) {
  387. - //error(getPos(), const_cast<char*>("No path in eofill/stroke"));
  388. + //error(errInternal, getPos(), const_cast<char*>("No path in eofill/stroke"));
  389. return;
  390. }
  391. if (state->isPath()) {
  392. @@ -1399,7 +1363,7 @@ void PdfParser::opEOFillStroke(Object args[], int numA
  393. void PdfParser::opCloseEOFillStroke(Object args[], int numArgs) {
  394. if (!state->isCurPt()) {
  395. - //error(getPos(), const_cast<char*>("No path in closepath/eofill/stroke"));
  396. + //error(errInternal, getPos(), const_cast<char*>("No path in closepath/eofill/stroke"));
  397. return;
  398. }
  399. if (state->isPath()) {
  400. @@ -1440,7 +1404,7 @@ void PdfParser::doPatternFillFallback(GBool eoFill) {
  401. doShadingPatternFillFallback((GfxShadingPattern *)pattern, gFalse, eoFill);
  402. break;
  403. default:
  404. - error(getPos(), const_cast<char*>("Unimplemented pattern type (%d) in fill"),
  405. + error(errInternal, getPos(), const_cast<char*>("Unimplemented pattern type (%d) in fill"),
  406. pattern->getType());
  407. break;
  408. }
  409. @@ -1459,7 +1423,7 @@ void PdfParser::doPatternStrokeFallback() {
  410. doShadingPatternFillFallback((GfxShadingPattern *)pattern, gTrue, gFalse);
  411. break;
  412. default:
  413. - error(getPos(), const_cast<char*>("Unimplemented pattern type (%d) in stroke"),
  414. + error(errInternal, getPos(), const_cast<char*>("Unimplemented pattern type (%d) in stroke"),
  415. pattern->getType());
  416. break;
  417. }
  418. @@ -1579,15 +1543,9 @@ void PdfParser::opShFill(Object args[], int numArgs) {
  419. double *matrix = NULL;
  420. GBool savedState = gFalse;
  421. -#ifdef POPPLER_NEW_COLOR_SPACE_API
  422. if (!(shading = res->lookupShading(args[0].getName(), NULL))) {
  423. return;
  424. }
  425. -#else
  426. - if (!(shading = res->lookupShading(args[0].getName()))) {
  427. - return;
  428. - }
  429. -#endif
  430. // save current graphics state
  431. if (shading->getType() != 2 && shading->getType() != 3) {
  432. @@ -2156,7 +2114,7 @@ void PdfParser::opTextNextLine(Object args[], int numA
  433. void PdfParser::opShowText(Object args[], int numArgs) {
  434. if (!state->getFont()) {
  435. - error(getPos(), const_cast<char*>("No font in show"));
  436. + error(errInternal, getPos(), const_cast<char*>("No font in show"));
  437. return;
  438. }
  439. if (fontChanged) {
  440. @@ -2170,7 +2128,7 @@ void PdfParser::opMoveShowText(Object args[], int numA
  441. double tx, ty;
  442. if (!state->getFont()) {
  443. - error(getPos(), const_cast<char*>("No font in move/show"));
  444. + error(errInternal, getPos(), const_cast<char*>("No font in move/show"));
  445. return;
  446. }
  447. if (fontChanged) {
  448. @@ -2188,7 +2146,7 @@ void PdfParser::opMoveSetShowText(Object args[], int n
  449. double tx, ty;
  450. if (!state->getFont()) {
  451. - error(getPos(), const_cast<char*>("No font in move/set/show"));
  452. + error(errInternal, getPos(), const_cast<char*>("No font in move/set/show"));
  453. return;
  454. }
  455. if (fontChanged) {
  456. @@ -2211,7 +2169,7 @@ void PdfParser::opShowSpaceText(Object args[], int num
  457. int i;
  458. if (!state->getFont()) {
  459. - error(getPos(), const_cast<char*>("No font in show/space"));
  460. + error(errInternal, getPos(), const_cast<char*>("No font in show/space"));
  461. return;
  462. }
  463. if (fontChanged) {
  464. @@ -2236,7 +2194,7 @@ void PdfParser::opShowSpaceText(Object args[], int num
  465. } else if (obj.isString()) {
  466. doShowText(obj.getString());
  467. } else {
  468. - error(getPos(), const_cast<char*>("Element of show/space array must be number or string"));
  469. + error(errInternal, getPos(), const_cast<char*>("Element of show/space array must be number or string"));
  470. }
  471. obj.free();
  472. }
  473. @@ -2334,7 +2292,7 @@ void PdfParser::doShowText(GooString *s) {
  474. if (charProc.isStream()) {
  475. //parse(&charProc, gFalse); // TODO: parse into SVG font
  476. } else {
  477. - error(getPos(), const_cast<char*>("Missing or bad Type3 CharProc entry"));
  478. + error(errInternal, getPos(), const_cast<char*>("Missing or bad Type3 CharProc entry"));
  479. }
  480. //out->endType3Char(state);
  481. if (resDict) {
  482. @@ -2410,7 +2368,7 @@ void PdfParser::opXObject(Object args[], int numArgs)
  483. return;
  484. }
  485. if (!obj1.isStream()) {
  486. - error(getPos(), const_cast<char*>("XObject '%s' is wrong type"), name);
  487. + error(errInternal, getPos(), const_cast<char*>("XObject '%s' is wrong type"), name);
  488. obj1.free();
  489. return;
  490. }
  491. @@ -2426,9 +2384,9 @@ void PdfParser::opXObject(Object args[], int numArgs)
  492. /* out->psXObject(obj1.getStream(),
  493. obj3.isStream() ? obj3.getStream() : (Stream *)NULL);*/
  494. } else if (obj2.isName()) {
  495. - error(getPos(), const_cast<char*>("Unknown XObject subtype '%s'"), obj2.getName());
  496. + error(errInternal, getPos(), const_cast<char*>("Unknown XObject subtype '%s'"), obj2.getName());
  497. } else {
  498. - error(getPos(), const_cast<char*>("XObject subtype is missing or wrong type"));
  499. + error(errInternal, getPos(), const_cast<char*>("XObject subtype is missing or wrong type"));
  500. }
  501. obj2.free();
  502. obj1.free();
  503. @@ -2559,11 +2517,7 @@ void PdfParser::doImage(Object *ref, Stream *str, GBoo
  504. }
  505. }
  506. if (!obj1.isNull()) {
  507. -#ifdef POPPLER_NEW_COLOR_SPACE_API
  508. colorSpace = GfxColorSpace::parse(&obj1, NULL);
  509. -#else
  510. - colorSpace = GfxColorSpace::parse(&obj1);
  511. -#endif
  512. } else if (csMode == streamCSDeviceGray) {
  513. colorSpace = new GfxDeviceGrayColorSpace();
  514. } else if (csMode == streamCSDeviceRGB) {
  515. @@ -2648,11 +2602,7 @@ void PdfParser::doImage(Object *ref, Stream *str, GBoo
  516. obj2.free();
  517. }
  518. }
  519. -#ifdef POPPLER_NEW_COLOR_SPACE_API
  520. maskColorSpace = GfxColorSpace::parse(&obj1, NULL);
  521. -#else
  522. - maskColorSpace = GfxColorSpace::parse(&obj1);
  523. -#endif
  524. obj1.free();
  525. if (!maskColorSpace || maskColorSpace->getMode() != csDeviceGray) {
  526. goto err1;
  527. @@ -2758,7 +2708,7 @@ void PdfParser::doImage(Object *ref, Stream *str, GBoo
  528. err2:
  529. obj1.free();
  530. err1:
  531. - error(getPos(), const_cast<char*>("Bad image parameters"));
  532. + error(errInternal, getPos(), const_cast<char*>("Bad image parameters"));
  533. }
  534. void PdfParser::doForm(Object *str) {
  535. @@ -2783,7 +2733,7 @@ void PdfParser::doForm(Object *str) {
  536. // check form type
  537. dict->lookup(const_cast<char*>("FormType"), &obj1);
  538. if (!(obj1.isNull() || (obj1.isInt() && obj1.getInt() == 1))) {
  539. - error(getPos(), const_cast<char*>("Unknown form type"));
  540. + error(errInternal, getPos(), const_cast<char*>("Unknown form type"));
  541. }
  542. obj1.free();
  543. @@ -2791,7 +2741,7 @@ void PdfParser::doForm(Object *str) {
  544. dict->lookup(const_cast<char*>("BBox"), &bboxObj);
  545. if (!bboxObj.isArray()) {
  546. bboxObj.free();
  547. - error(getPos(), const_cast<char*>("Bad form bounding box"));
  548. + error(errInternal, getPos(), const_cast<char*>("Bad form bounding box"));
  549. return;
  550. }
  551. for (i = 0; i < 4; ++i) {
  552. @@ -2827,11 +2777,7 @@ void PdfParser::doForm(Object *str) {
  553. if (obj1.dictLookup(const_cast<char*>("S"), &obj2)->isName(const_cast<char*>("Transparency"))) {
  554. transpGroup = gTrue;
  555. if (!obj1.dictLookup(const_cast<char*>("CS"), &obj3)->isNull()) {
  556. -#ifdef POPPLER_NEW_COLOR_SPACE_API
  557. blendingColorSpace = GfxColorSpace::parse(&obj3, NULL);
  558. -#else
  559. - blendingColorSpace = GfxColorSpace::parse(&obj3);
  560. -#endif
  561. }
  562. obj3.free();
  563. if (obj1.dictLookup(const_cast<char*>("I"), &obj3)->isBool()) {
  564. @@ -2990,7 +2936,7 @@ Stream *PdfParser::buildImageStream() {
  565. parser->getObj(&obj);
  566. while (!obj.isCmd(const_cast<char*>("ID")) && !obj.isEOF()) {
  567. if (!obj.isName()) {
  568. - error(getPos(), const_cast<char*>("Inline image dictionary key must be a name object"));
  569. + error(errInternal, getPos(), const_cast<char*>("Inline image dictionary key must be a name object"));
  570. obj.free();
  571. } else {
  572. key = copyString(obj.getName());
  573. @@ -3005,7 +2951,7 @@ Stream *PdfParser::buildImageStream() {
  574. parser->getObj(&obj);
  575. }
  576. if (obj.isEOF()) {
  577. - error(getPos(), const_cast<char*>("End of file in inline image"));
  578. + error(errInternal, getPos(), const_cast<char*>("End of file in inline image"));
  579. obj.free();
  580. dict.free();
  581. return NULL;
  582. @@ -3020,11 +2966,11 @@ Stream *PdfParser::buildImageStream() {
  583. }
  584. void PdfParser::opImageData(Object args[], int numArgs) {
  585. - error(getPos(), const_cast<char*>("Internal: got 'ID' operator"));
  586. + error(errInternal, getPos(), const_cast<char*>("Internal: got 'ID' operator"));
  587. }
  588. void PdfParser::opEndImage(Object args[], int numArgs) {
  589. - error(getPos(), const_cast<char*>("Internal: got 'EI' operator"));
  590. + error(errInternal, getPos(), const_cast<char*>("Internal: got 'EI' operator"));
  591. }
  592. //------------------------------------------------------------------------