Ticket #35479: patch-src-extension-internal-pdfinput-pdf-parser.cpp.diff
File patch-src-extension-internal-pdfinput-pdf-parser.cpp.diff, 19.6 KB (added by su-v, 12 years ago) |
---|
-
src/extension/internal/pdfinput/pdf-parser.cpp
old new 367 367 for (i = 0; i < obj->arrayGetLength(); ++i) { 368 368 obj->arrayGet(i, &obj2); 369 369 if (!obj2.isStream()) { 370 #ifdef POPPLER_NEW_ERRORAPI 371 error(errInternal, -1, "Weird page contents"); 372 #else 370 373 error(-1, const_cast<char*>("Weird page contents")); 374 #endif 371 375 obj2.free(); 372 376 return; 373 377 } 374 378 obj2.free(); 375 379 } 376 380 } else if (!obj->isStream()) { 377 error(-1, const_cast<char*>("Weird page contents")); 378 return; 381 #ifdef POPPLER_NEW_ERRORAPI 382 error(errInternal, -1, "Weird page contents"); 383 #else 384 error(-1, const_cast<char*>("Weird page contents")); 385 #endif 386 return; 379 387 } 380 388 parser = new Parser(xref, new Lexer(xref, obj), gFalse); 381 389 go(topLevel); … … 419 427 420 428 // too many arguments - something is wrong 421 429 } else { 430 #ifdef POPPLER_NEW_ERRORAPI 431 error(errSyntaxError, getPos(), "Too many args in content stream"); 432 #else 422 433 error(getPos(), const_cast<char*>("Too many args in content stream")); 434 #endif 423 435 if (printCommands) { 424 436 printf("throwing away arg: "); 425 437 obj.print(stdout); … … 436 448 437 449 // args at end with no command 438 450 if (numArgs > 0) { 451 #ifdef POPPLER_NEW_ERRORAPI 452 error(errSyntaxError, getPos(), "Leftover args in content stream"); 453 #else 439 454 error(getPos(), const_cast<char*>("Leftover args in content stream")); 455 #endif 440 456 if (printCommands) { 441 457 printf("%d leftovers:", numArgs); 442 458 for (i = 0; i < numArgs; ++i) { … … 502 518 name = cmd->getCmd(); 503 519 if (!(op = findOp(name))) { 504 520 if (ignoreUndef == 0) 521 #ifdef POPPLER_NEW_ERRORAPI 522 error(errSyntaxError, getPos(), "Unknown operator '{0:s}'", name); 523 #else 505 524 error(getPos(), const_cast<char*>("Unknown operator '%s'"), name); 525 #endif 506 526 return; 507 527 } 508 528 … … 510 530 argPtr = args; 511 531 if (op->numArgs >= 0) { 512 532 if (numArgs < op->numArgs) { 533 #ifdef POPPLER_NEW_ERRORAPI 534 error(errSyntaxError, getPos(), "Too few ({0:d}) args to '{1:d}' operator", numArgs, name); 535 #else 513 536 error(getPos(), const_cast<char*>("Too few (%d) args to '%s' operator"), numArgs, name); 537 #endif 514 538 return; 515 539 } 516 540 if (numArgs > op->numArgs) { 517 541 #if 0 542 #ifdef POPPLER_NEW_ERRORAPI 543 error(errSyntaxError, getPos(), "Too many ({0:d}) args to '{1:s}' operator", numArgs, name); 544 #else 518 545 error(getPos(), "Too many (%d) args to '%s' operator", numArgs, name); 519 546 #endif 547 #endif 520 548 argPtr += numArgs - op->numArgs; 521 549 numArgs = op->numArgs; 522 550 } 523 551 } else { 524 552 if (numArgs > -op->numArgs) { 553 #ifdef POPPLER_NEW_ERRORAPI 554 error(errSyntaxError, getPos(), "Too many ({0:d}) args to '{1:s}' operator", 555 #else 525 556 error(getPos(), const_cast<char*>("Too many (%d) args to '%s' operator"), 557 #endif 526 558 numArgs, name); 527 559 return; 528 560 } 529 561 } 530 562 for (i = 0; i < numArgs; ++i) { 531 563 if (!checkArg(&argPtr[i], op->tchk[i])) { 564 #ifdef POPPLER_NEW_ERRORAPI 565 error(errSyntaxError, getPos(), "Arg #{0:d} to '{1:s}' operator is wrong type ({2:s})", 566 #else 532 567 error(getPos(), const_cast<char*>("Arg #%d to '%s' operator is wrong type (%s)"), 568 #endif 533 569 i, name, argPtr[i].getTypeName()); 534 570 return; 535 571 } … … 690 726 return; 691 727 } 692 728 if (!obj1.isDict()) { 729 #ifdef POPPLER_NEW_ERRORAPI 730 error(errSyntaxError, getPos(), "ExtGState '{0:s}' is wrong type"), args[0].getName(); 731 #else 693 732 error(getPos(), const_cast<char*>("ExtGState '%s' is wrong type"), args[0].getName()); 733 #endif 694 734 obj1.free(); 695 735 return; 696 736 } … … 705 745 if (state->parseBlendMode(&obj2, &mode)) { 706 746 state->setBlendMode(mode); 707 747 } else { 748 #ifdef POPPLER_NEW_ERRORAPI 749 error(errSyntaxError, getPos(), "Invalid blend mode in ExtGState"); 750 #else 708 751 error(getPos(), const_cast<char*>("Invalid blend mode in ExtGState")); 752 #endif 709 753 } 710 754 } 711 755 obj2.free(); … … 764 808 state->setTransfer(funcs); 765 809 } 766 810 } else if (!obj2.isNull()) { 811 #ifdef POPPLER_NEW_ERRORAPI 812 error(errSyntaxError, getPos(), "Invalid transfer function in ExtGState"); 813 #else 767 814 error(getPos(), const_cast<char*>("Invalid transfer function in ExtGState")); 815 #endif 768 816 } 769 817 obj2.free(); 770 818 … … 784 832 funcs[0] = Function::parse(&obj3); 785 833 if (funcs[0]->getInputSize() != 1 || 786 834 funcs[0]->getOutputSize() != 1) { 787 error(getPos(), 788 const_cast<char*>("Invalid transfer function in soft mask in ExtGState")); 835 #ifdef POPPLER_NEW_ERRORAPI 836 error(errSyntaxError, getPos(), "Invalid transfer function in soft mask in ExtGState"); 837 #else 838 error(getPos(), const_cast<char*>("Invalid transfer function in soft mask in ExtGState")); 839 #endif 789 840 delete funcs[0]; 790 841 funcs[0] = NULL; 791 842 } … … 809 860 blendingColorSpace = NULL; 810 861 isolated = knockout = gFalse; 811 862 if (!obj4.dictLookup(const_cast<char*>("CS"), &obj5)->isNull()) { 812 #if def POPPLER_NEW_COLOR_SPACE_API863 #if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) 813 864 blendingColorSpace = GfxColorSpace::parse(&obj5, NULL); 814 865 #else 815 866 blendingColorSpace = GfxColorSpace::parse(&obj5); … … 840 891 delete funcs[0]; 841 892 } 842 893 } else { 894 #ifdef POPPLER_NEW_ERRORAPI 895 error(errSyntaxError, getPos(), "Invalid soft mask in ExtGState - missing group"); 896 #else 843 897 error(getPos(), const_cast<char*>("Invalid soft mask in ExtGState - missing group")); 898 #endif 844 899 } 845 900 obj4.free(); 846 901 } else { 902 #ifdef POPPLER_NEW_ERRORAPI 903 error(errSyntaxError, getPos(), "Invalid soft mask in ExtGState - missing group"); 904 #else 847 905 error(getPos(), const_cast<char*>("Invalid soft mask in ExtGState - missing group")); 906 #endif 848 907 } 849 908 obj3.free(); 850 909 } else if (!obj2.isNull()) { 910 #ifdef POPPLER_NEW_ERRORAPI 911 error(errSyntaxError, getPos(), "Invalid soft mask in ExtGState"); 912 #else 851 913 error(getPos(), const_cast<char*>("Invalid soft mask in ExtGState")); 914 #endif 852 915 } 853 916 } 854 917 obj2.free(); … … 876 939 // check form type 877 940 dict->lookup(const_cast<char*>("FormType"), &obj1); 878 941 if (!(obj1.isNull() || (obj1.isInt() && obj1.getInt() == 1))) { 942 #ifdef POPPLER_NEW_ERRORAPI 943 error(errSyntaxError, getPos(), "Unknown form type"); 944 #else 879 945 error(getPos(), const_cast<char*>("Unknown form type")); 946 #endif 880 947 } 881 948 obj1.free(); 882 949 … … 884 951 dict->lookup(const_cast<char*>("BBox"), &obj1); 885 952 if (!obj1.isArray()) { 886 953 obj1.free(); 954 #ifdef POPPLER_NEW_ERRORAPI 955 error(errSyntaxError, getPos(), "Bad form bounding box"); 956 #else 887 957 error(getPos(), const_cast<char*>("Bad form bounding box")); 958 #endif 888 959 return; 889 960 } 890 961 for (i = 0; i < 4; ++i) { … … 1012 1083 1013 1084 state->setFillPattern(NULL); 1014 1085 res->lookupColorSpace(args[0].getName(), &obj); 1015 #if def POPPLER_NEW_COLOR_SPACE_API1086 #if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) 1016 1087 if (obj.isNull()) { 1017 1088 colorSpace = GfxColorSpace::parse(&args[0], NULL); 1018 1089 } else { … … 1032 1103 state->setFillColor(&color); 1033 1104 builder->updateStyle(state); 1034 1105 } else { 1106 #ifdef POPPLER_NEW_ERRORAPI 1107 error(errSyntaxError, getPos(), "Bad color space (fill)"); 1108 #else 1035 1109 error(getPos(), const_cast<char*>("Bad color space (fill)")); 1110 #endif 1036 1111 } 1037 1112 } 1038 1113 … … 1043 1118 1044 1119 state->setStrokePattern(NULL); 1045 1120 res->lookupColorSpace(args[0].getName(), &obj); 1046 #if def POPPLER_NEW_COLOR_SPACE_API1121 #if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) 1047 1122 if (obj.isNull()) { 1048 1123 colorSpace = GfxColorSpace::parse(&args[0], NULL); 1049 1124 } else { … … 1063 1138 state->setStrokeColor(&color); 1064 1139 builder->updateStyle(state); 1065 1140 } else { 1141 #ifdef POPPLER_NEW_ERRORAPI 1142 error(errSyntaxError, getPos(), "Bad color space (stroke)"); 1143 #else 1066 1144 error(getPos(), const_cast<char*>("Bad color space (stroke)")); 1145 #endif 1067 1146 } 1068 1147 } 1069 1148 … … 1072 1151 int i; 1073 1152 1074 1153 if (numArgs != state->getFillColorSpace()->getNComps()) { 1154 #ifdef POPPLER_NEW_ERRORAPI 1155 error(errSyntaxError, getPos(), "Incorrect number of arguments in 'sc' command"); 1156 #else 1075 1157 error(getPos(), const_cast<char*>("Incorrect number of arguments in 'sc' command")); 1158 #endif 1076 1159 return; 1077 1160 } 1078 1161 state->setFillPattern(NULL); … … 1088 1171 int i; 1089 1172 1090 1173 if (numArgs != state->getStrokeColorSpace()->getNComps()) { 1174 #ifdef POPPLER_NEW_ERRORAPI 1175 error(errSyntaxError, getPos(), "Incorrect number of arguments in 'SC' command"); 1176 #else 1091 1177 error(getPos(), const_cast<char*>("Incorrect number of arguments in 'SC' command")); 1178 #endif 1092 1179 return; 1093 1180 } 1094 1181 state->setStrokePattern(NULL); … … 1109 1196 if (!((GfxPatternColorSpace *)state->getFillColorSpace())->getUnder() || 1110 1197 numArgs - 1 != ((GfxPatternColorSpace *)state->getFillColorSpace()) 1111 1198 ->getUnder()->getNComps()) { 1199 #ifdef POPPLER_NEW_ERRORAPI 1200 error(errSyntaxError, getPos(), "Incorrect number of arguments in 'scn' command"); 1201 #else 1112 1202 error(getPos(), const_cast<char*>("Incorrect number of arguments in 'scn' command")); 1203 #endif 1113 1204 return; 1114 1205 } 1115 1206 for (i = 0; i < numArgs - 1 && i < gfxColorMaxComps; ++i) { … … 1120 1211 state->setFillColor(&color); 1121 1212 builder->updateStyle(state); 1122 1213 } 1123 #if def POPPLER_NEW_COLOR_SPACE_API1214 #if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) 1124 1215 if (args[numArgs-1].isName() && 1125 1216 (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL))) { 1126 1217 state->setFillPattern(pattern); … … 1136 1227 1137 1228 } else { 1138 1229 if (numArgs != state->getFillColorSpace()->getNComps()) { 1230 #ifdef POPPLER_NEW_ERRORAPI 1231 error(errSyntaxError, getPos(), "Incorrect number of arguments in 'scn' command"); 1232 #else 1139 1233 error(getPos(), const_cast<char*>("Incorrect number of arguments in 'scn' command")); 1234 #endif 1140 1235 return; 1141 1236 } 1142 1237 state->setFillPattern(NULL); … … 1161 1256 ->getUnder() || 1162 1257 numArgs - 1 != ((GfxPatternColorSpace *)state->getStrokeColorSpace()) 1163 1258 ->getUnder()->getNComps()) { 1259 #ifdef POPPLER_NEW_ERRORAPI 1260 error(errSyntaxError, getPos(), "Incorrect number of arguments in 'SCN' command"); 1261 #else 1164 1262 error(getPos(), const_cast<char*>("Incorrect number of arguments in 'SCN' command")); 1263 #endif 1165 1264 return; 1166 1265 } 1167 1266 for (i = 0; i < numArgs - 1 && i < gfxColorMaxComps; ++i) { … … 1172 1271 state->setStrokeColor(&color); 1173 1272 builder->updateStyle(state); 1174 1273 } 1175 #if def POPPLER_NEW_COLOR_SPACE_API1274 #if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) 1176 1275 if (args[numArgs-1].isName() && 1177 1276 (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL))) { 1178 1277 state->setStrokePattern(pattern); … … 1188 1287 1189 1288 } else { 1190 1289 if (numArgs != state->getStrokeColorSpace()->getNComps()) { 1290 #ifdef POPPLER_NEW_ERRORAPI 1291 error(errSyntaxError, getPos(), "Incorrect number of arguments in 'SCN' command"); 1292 #else 1191 1293 error(getPos(), const_cast<char*>("Incorrect number of arguments in 'SCN' command")); 1294 #endif 1192 1295 return; 1193 1296 } 1194 1297 state->setStrokePattern(NULL); … … 1212 1315 1213 1316 void PdfParser::opLineTo(Object args[], int numArgs) { 1214 1317 if (!state->isCurPt()) { 1318 #ifdef POPPLER_NEW_ERRORAPI 1319 error(errSyntaxError, getPos(), "No current point in lineto"); 1320 #else 1215 1321 error(getPos(), const_cast<char*>("No current point in lineto")); 1322 #endif 1216 1323 return; 1217 1324 } 1218 1325 state->lineTo(args[0].getNum(), args[1].getNum()); … … 1222 1329 double x1, y1, x2, y2, x3, y3; 1223 1330 1224 1331 if (!state->isCurPt()) { 1332 #ifdef POPPLER_NEW_ERRORAPI 1333 error(errSyntaxError, getPos(), "No current point in curveto"); 1334 #else 1225 1335 error(getPos(), const_cast<char*>("No current point in curveto")); 1336 #endif 1226 1337 return; 1227 1338 } 1228 1339 x1 = args[0].getNum(); … … 1238 1349 double x1, y1, x2, y2, x3, y3; 1239 1350 1240 1351 if (!state->isCurPt()) { 1352 #ifdef POPPLER_NEW_ERRORAPI 1353 error(errSyntaxError, getPos(), "No current point in curveto1"); 1354 #else 1241 1355 error(getPos(), const_cast<char*>("No current point in curveto1")); 1356 #endif 1242 1357 return; 1243 1358 } 1244 1359 x1 = state->getCurX(); … … 1254 1369 double x1, y1, x2, y2, x3, y3; 1255 1370 1256 1371 if (!state->isCurPt()) { 1372 #ifdef POPPLER_NEW_ERRORAPI 1373 error(errSyntaxError, getPos(), "No current point in curveto2"); 1374 #else 1257 1375 error(getPos(), const_cast<char*>("No current point in curveto2")); 1376 #endif 1258 1377 return; 1259 1378 } 1260 1379 x1 = args[0].getNum(); … … 1282 1401 1283 1402 void PdfParser::opClosePath(Object args[], int numArgs) { 1284 1403 if (!state->isCurPt()) { 1404 #ifdef POPPLER_NEW_ERRORAPI 1405 error(errSyntaxError, getPos(), "No current point in closepath"); 1406 #else 1285 1407 error(getPos(), const_cast<char*>("No current point in closepath")); 1408 #endif 1286 1409 return; 1287 1410 } 1288 1411 state->closePath(); … … 1440 1563 doShadingPatternFillFallback((GfxShadingPattern *)pattern, gFalse, eoFill); 1441 1564 break; 1442 1565 default: 1566 #ifdef POPPLER_NEW_ERRORAPI 1567 error(errUnimplemented, getPos(), "Unimplemented pattern type (%d) in fill", 1568 #else 1443 1569 error(getPos(), const_cast<char*>("Unimplemented pattern type (%d) in fill"), 1570 #endif 1444 1571 pattern->getType()); 1445 1572 break; 1446 1573 } … … 1459 1586 doShadingPatternFillFallback((GfxShadingPattern *)pattern, gTrue, gFalse); 1460 1587 break; 1461 1588 default: 1589 #ifdef POPPLER_NEW_ERRORAPI 1590 error(errUnimplemented, getPos(), "Unimplemented pattern type ({0:d}) in stroke", 1591 #else 1462 1592 error(getPos(), const_cast<char*>("Unimplemented pattern type (%d) in stroke"), 1593 #endif 1463 1594 pattern->getType()); 1464 1595 break; 1465 1596 } … … 1579 1710 double *matrix = NULL; 1580 1711 GBool savedState = gFalse; 1581 1712 1582 #if def POPPLER_NEW_COLOR_SPACE_API1713 #if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) 1583 1714 if (!(shading = res->lookupShading(args[0].getName(), NULL))) { 1584 1715 return; 1585 1716 } … … 2156 2287 2157 2288 void PdfParser::opShowText(Object args[], int numArgs) { 2158 2289 if (!state->getFont()) { 2290 #ifdef POPPLER_NEW_ERRORAPI 2291 error(errSyntaxError, getPos(), "No font in show"); 2292 #else 2159 2293 error(getPos(), const_cast<char*>("No font in show")); 2294 #endif 2160 2295 return; 2161 2296 } 2162 2297 if (fontChanged) { … … 2170 2305 double tx, ty; 2171 2306 2172 2307 if (!state->getFont()) { 2308 #ifdef POPPLER_NEW_ERRORAPI 2309 error(errSyntaxError, getPos(), "No font in move/show"); 2310 #else 2173 2311 error(getPos(), const_cast<char*>("No font in move/show")); 2312 #endif 2174 2313 return; 2175 2314 } 2176 2315 if (fontChanged) { … … 2188 2327 double tx, ty; 2189 2328 2190 2329 if (!state->getFont()) { 2330 #ifdef POPPLER_NEW_ERRORAPI 2331 error(errSyntaxError, getPos(), "No font in move/set/show"); 2332 #else 2191 2333 error(getPos(), const_cast<char*>("No font in move/set/show")); 2334 #endif 2192 2335 return; 2193 2336 } 2194 2337 if (fontChanged) { … … 2211 2354 int i; 2212 2355 2213 2356 if (!state->getFont()) { 2357 #ifdef POPPLER_NEW_ERRORAPI 2358 error(errSyntaxError, getPos(), "No font in show/space"); 2359 #else 2214 2360 error(getPos(), const_cast<char*>("No font in show/space")); 2361 #endif 2215 2362 return; 2216 2363 } 2217 2364 if (fontChanged) { … … 2236 2383 } else if (obj.isString()) { 2237 2384 doShowText(obj.getString()); 2238 2385 } else { 2386 #ifdef POPPLER_NEW_ERRORAPI 2387 error(errSyntaxError, getPos(), "Element of show/space array must be number or string"); 2388 #else 2239 2389 error(getPos(), const_cast<char*>("Element of show/space array must be number or string")); 2390 #endif 2240 2391 } 2241 2392 obj.free(); 2242 2393 } … … 2334 2485 if (charProc.isStream()) { 2335 2486 //parse(&charProc, gFalse); // TODO: parse into SVG font 2336 2487 } else { 2488 #ifdef POPPLER_NEW_ERRORAPI 2489 error(errSyntaxError, getPos(), "Missing or bad Type3 CharProc entry"); 2490 #else 2337 2491 error(getPos(), const_cast<char*>("Missing or bad Type3 CharProc entry")); 2492 #endif 2338 2493 } 2339 2494 //out->endType3Char(state); 2340 2495 if (resDict) { … … 2410 2565 return; 2411 2566 } 2412 2567 if (!obj1.isStream()) { 2568 #ifdef POPPLER_NEW_ERRORAPI 2569 error(errSyntaxError, getPos(), "XObject '{0:s}' is wrong type", name); 2570 #else 2413 2571 error(getPos(), const_cast<char*>("XObject '%s' is wrong type"), name); 2572 #endif 2414 2573 obj1.free(); 2415 2574 return; 2416 2575 } … … 2426 2585 /* out->psXObject(obj1.getStream(), 2427 2586 obj3.isStream() ? obj3.getStream() : (Stream *)NULL);*/ 2428 2587 } else if (obj2.isName()) { 2588 #ifdef POPPLER_NEW_ERRORAPI 2589 error(errSyntaxError, getPos(), "Unknown XObject subtype '{0:s}'", obj2.getName()); 2590 #else 2429 2591 error(getPos(), const_cast<char*>("Unknown XObject subtype '%s'"), obj2.getName()); 2592 #endif 2430 2593 } else { 2594 #ifdef POPPLER_NEW_ERRORAPI 2595 error(errSyntaxError, getPos(), "XObject subtype is missing or wrong type"); 2596 #else 2431 2597 error(getPos(), const_cast<char*>("XObject subtype is missing or wrong type")); 2598 #endif 2432 2599 } 2433 2600 obj2.free(); 2434 2601 obj1.free(); … … 2559 2726 } 2560 2727 } 2561 2728 if (!obj1.isNull()) { 2562 #if def POPPLER_NEW_COLOR_SPACE_API2729 #if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) 2563 2730 colorSpace = GfxColorSpace::parse(&obj1, NULL); 2564 2731 #else 2565 2732 colorSpace = GfxColorSpace::parse(&obj1); … … 2648 2815 obj2.free(); 2649 2816 } 2650 2817 } 2651 #if def POPPLER_NEW_COLOR_SPACE_API2818 #if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) 2652 2819 maskColorSpace = GfxColorSpace::parse(&obj1, NULL); 2653 2820 #else 2654 2821 maskColorSpace = GfxColorSpace::parse(&obj1); … … 2758 2925 err2: 2759 2926 obj1.free(); 2760 2927 err1: 2928 #ifdef POPPLER_NEW_ERRORAPI 2929 error(errSyntaxError, getPos(), "Bad image parameters"); 2930 #else 2761 2931 error(getPos(), const_cast<char*>("Bad image parameters")); 2932 #endif 2762 2933 } 2763 2934 2764 2935 void PdfParser::doForm(Object *str) { … … 2783 2954 // check form type 2784 2955 dict->lookup(const_cast<char*>("FormType"), &obj1); 2785 2956 if (!(obj1.isNull() || (obj1.isInt() && obj1.getInt() == 1))) { 2957 #ifdef POPPLER_NEW_ERRORAPI 2958 error(errSyntaxError, getPos(), "Unknown form type"); 2959 #else 2786 2960 error(getPos(), const_cast<char*>("Unknown form type")); 2961 #endif 2787 2962 } 2788 2963 obj1.free(); 2789 2964 … … 2791 2966 dict->lookup(const_cast<char*>("BBox"), &bboxObj); 2792 2967 if (!bboxObj.isArray()) { 2793 2968 bboxObj.free(); 2969 #ifdef POPPLER_NEW_ERRORAPI 2970 error(errSyntaxError, getPos(), "Bad form bounding box"); 2971 #else 2794 2972 error(getPos(), const_cast<char*>("Bad form bounding box")); 2973 #endif 2795 2974 return; 2796 2975 } 2797 2976 for (i = 0; i < 4; ++i) { … … 2827 3006 if (obj1.dictLookup(const_cast<char*>("S"), &obj2)->isName(const_cast<char*>("Transparency"))) { 2828 3007 transpGroup = gTrue; 2829 3008 if (!obj1.dictLookup(const_cast<char*>("CS"), &obj3)->isNull()) { 2830 #if def POPPLER_NEW_COLOR_SPACE_API3009 #if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) 2831 3010 blendingColorSpace = GfxColorSpace::parse(&obj3, NULL); 2832 3011 #else 2833 3012 blendingColorSpace = GfxColorSpace::parse(&obj3); … … 2990 3169 parser->getObj(&obj); 2991 3170 while (!obj.isCmd(const_cast<char*>("ID")) && !obj.isEOF()) { 2992 3171 if (!obj.isName()) { 3172 #ifdef POPPLER_NEW_ERRORAPI 3173 error(errSyntaxError, getPos(), "Inline image dictionary key must be a name object"); 3174 #else 2993 3175 error(getPos(), const_cast<char*>("Inline image dictionary key must be a name object")); 3176 #endif 2994 3177 obj.free(); 2995 3178 } else { 2996 3179 key = copyString(obj.getName()); … … 3005 3188 parser->getObj(&obj); 3006 3189 } 3007 3190 if (obj.isEOF()) { 3191 #ifdef POPPLER_NEW_ERRORAPI 3192 error(errSyntaxError, getPos(), "End of file in inline image"); 3193 #else 3008 3194 error(getPos(), const_cast<char*>("End of file in inline image")); 3195 #endif 3009 3196 obj.free(); 3010 3197 dict.free(); 3011 3198 return NULL; … … 3020 3207 } 3021 3208 3022 3209 void PdfParser::opImageData(Object args[], int numArgs) { 3210 #ifdef POPPLER_NEW_ERRORAPI 3211 error(errSyntaxError, getPos(), "Internal: got 'ID' operator"); 3212 #else 3023 3213 error(getPos(), const_cast<char*>("Internal: got 'ID' operator")); 3214 #endif 3024 3215 } 3025 3216 3026 3217 void PdfParser::opEndImage(Object args[], int numArgs) { 3218 #ifdef POPPLER_NEW_ERRORAPI 3219 error(errSyntaxError, getPos(), "Internal: got 'EI' operator"); 3220 #else 3027 3221 error(getPos(), const_cast<char*>("Internal: got 'EI' operator")); 3222 #endif 3028 3223 } 3029 3224 3030 3225 //------------------------------------------------------------------------