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