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  
    367367    for (i = 0; i < obj->arrayGetLength(); ++i) {
    368368      obj->arrayGet(i, &obj2);
    369369      if (!obj2.isStream()) {
     370#ifdef POPPLER_NEW_ERRORAPI
     371        error(errInternal, -1, "Weird page contents");
     372#else
    370373        error(-1, const_cast<char*>("Weird page contents"));
     374#endif
    371375        obj2.free();
    372376        return;
    373377      }
    374378      obj2.free();
    375379    }
    376380  } 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;
    379387  }
    380388  parser = new Parser(xref, new Lexer(xref, obj), gFalse);
    381389  go(topLevel);
     
    419427
    420428    // too many arguments - something is wrong
    421429    } else {
     430#ifdef POPPLER_NEW_ERRORAPI
     431      error(errSyntaxError, getPos(), "Too many args in content stream");
     432#else
    422433      error(getPos(), const_cast<char*>("Too many args in content stream"));
     434#endif
    423435      if (printCommands) {
    424436        printf("throwing away arg: ");
    425437        obj.print(stdout);
     
    436448
    437449  // args at end with no command
    438450  if (numArgs > 0) {
     451#ifdef POPPLER_NEW_ERRORAPI
     452    error(errSyntaxError, getPos(), "Leftover args in content stream");
     453#else
    439454    error(getPos(), const_cast<char*>("Leftover args in content stream"));
     455#endif
    440456    if (printCommands) {
    441457      printf("%d leftovers:", numArgs);
    442458      for (i = 0; i < numArgs; ++i) {
     
    502518  name = cmd->getCmd();
    503519  if (!(op = findOp(name))) {
    504520    if (ignoreUndef == 0)
     521#ifdef POPPLER_NEW_ERRORAPI
     522      error(errSyntaxError, getPos(), "Unknown operator '{0:s}'", name);
     523#else
    505524      error(getPos(), const_cast<char*>("Unknown operator '%s'"), name);
     525#endif
    506526    return;
    507527  }
    508528
     
    510530  argPtr = args;
    511531  if (op->numArgs >= 0) {
    512532    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
    513536      error(getPos(), const_cast<char*>("Too few (%d) args to '%s' operator"), numArgs, name);
     537#endif
    514538      return;
    515539    }
    516540    if (numArgs > op->numArgs) {
    517541#if 0
     542#ifdef POPPLER_NEW_ERRORAPI
     543      error(errSyntaxError, getPos(), "Too many ({0:d}) args to '{1:s}' operator", numArgs, name);
     544#else
    518545      error(getPos(), "Too many (%d) args to '%s' operator", numArgs, name);
    519546#endif
     547#endif
    520548      argPtr += numArgs - op->numArgs;
    521549      numArgs = op->numArgs;
    522550    }
    523551  } else {
    524552    if (numArgs > -op->numArgs) {
     553#ifdef POPPLER_NEW_ERRORAPI
     554      error(errSyntaxError, getPos(), "Too many ({0:d}) args to '{1:s}' operator",
     555#else
    525556      error(getPos(), const_cast<char*>("Too many (%d) args to '%s' operator"),
     557#endif
    526558            numArgs, name);
    527559      return;
    528560    }
    529561  }
    530562  for (i = 0; i < numArgs; ++i) {
    531563    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
    532567      error(getPos(), const_cast<char*>("Arg #%d to '%s' operator is wrong type (%s)"),
     568#endif
    533569            i, name, argPtr[i].getTypeName());
    534570      return;
    535571    }
     
    690726    return;
    691727  }
    692728  if (!obj1.isDict()) {
     729#ifdef POPPLER_NEW_ERRORAPI
     730    error(errSyntaxError, getPos(), "ExtGState '{0:s}' is wrong type"), args[0].getName();
     731#else
    693732    error(getPos(), const_cast<char*>("ExtGState '%s' is wrong type"), args[0].getName());
     733#endif
    694734    obj1.free();
    695735    return;
    696736  }
     
    705745    if (state->parseBlendMode(&obj2, &mode)) {
    706746      state->setBlendMode(mode);
    707747    } else {
     748#ifdef POPPLER_NEW_ERRORAPI
     749      error(errSyntaxError, getPos(), "Invalid blend mode in ExtGState");
     750#else
    708751      error(getPos(), const_cast<char*>("Invalid blend mode in ExtGState"));
     752#endif
    709753    }
    710754  }
    711755  obj2.free();
     
    764808      state->setTransfer(funcs);
    765809    }
    766810  } else if (!obj2.isNull()) {
     811#ifdef POPPLER_NEW_ERRORAPI
     812    error(errSyntaxError, getPos(), "Invalid transfer function in ExtGState");
     813#else
    767814    error(getPos(), const_cast<char*>("Invalid transfer function in ExtGState"));
     815#endif
    768816  }
    769817  obj2.free();
    770818
     
    784832        funcs[0] = Function::parse(&obj3);
    785833        if (funcs[0]->getInputSize() != 1 ||
    786834            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
    789840          delete funcs[0];
    790841          funcs[0] = NULL;
    791842        }
     
    809860          blendingColorSpace = NULL;
    810861          isolated = knockout = gFalse;
    811862          if (!obj4.dictLookup(const_cast<char*>("CS"), &obj5)->isNull()) {
    812 #ifdef POPPLER_NEW_COLOR_SPACE_API
     863#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
    813864            blendingColorSpace = GfxColorSpace::parse(&obj5, NULL);
    814865#else
    815866            blendingColorSpace = GfxColorSpace::parse(&obj5);
     
    840891            delete funcs[0];
    841892          }
    842893        } else {
     894#ifdef POPPLER_NEW_ERRORAPI
     895          error(errSyntaxError, getPos(), "Invalid soft mask in ExtGState - missing group");
     896#else
    843897          error(getPos(), const_cast<char*>("Invalid soft mask in ExtGState - missing group"));
     898#endif
    844899        }
    845900        obj4.free();
    846901      } else {
     902#ifdef POPPLER_NEW_ERRORAPI
     903        error(errSyntaxError, getPos(), "Invalid soft mask in ExtGState - missing group");
     904#else
    847905        error(getPos(), const_cast<char*>("Invalid soft mask in ExtGState - missing group"));
     906#endif
    848907      }
    849908      obj3.free();
    850909    } else if (!obj2.isNull()) {
     910#ifdef POPPLER_NEW_ERRORAPI
     911      error(errSyntaxError, getPos(), "Invalid soft mask in ExtGState");
     912#else
    851913      error(getPos(), const_cast<char*>("Invalid soft mask in ExtGState"));
     914#endif
    852915    }
    853916  }
    854917  obj2.free();
     
    876939  // check form type
    877940  dict->lookup(const_cast<char*>("FormType"), &obj1);
    878941  if (!(obj1.isNull() || (obj1.isInt() && obj1.getInt() == 1))) {
     942#ifdef POPPLER_NEW_ERRORAPI
     943    error(errSyntaxError, getPos(), "Unknown form type");
     944#else
    879945    error(getPos(), const_cast<char*>("Unknown form type"));
     946#endif
    880947  }
    881948  obj1.free();
    882949
     
    884951  dict->lookup(const_cast<char*>("BBox"), &obj1);
    885952  if (!obj1.isArray()) {
    886953    obj1.free();
     954#ifdef POPPLER_NEW_ERRORAPI
     955    error(errSyntaxError, getPos(), "Bad form bounding box");
     956#else
    887957    error(getPos(), const_cast<char*>("Bad form bounding box"));
     958#endif
    888959    return;
    889960  }
    890961  for (i = 0; i < 4; ++i) {
     
    10121083
    10131084  state->setFillPattern(NULL);
    10141085  res->lookupColorSpace(args[0].getName(), &obj);
    1015 #ifdef POPPLER_NEW_COLOR_SPACE_API
     1086#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
    10161087  if (obj.isNull()) {
    10171088    colorSpace = GfxColorSpace::parse(&args[0], NULL);
    10181089  } else {
     
    10321103    state->setFillColor(&color);
    10331104    builder->updateStyle(state);
    10341105  } else {
     1106#ifdef POPPLER_NEW_ERRORAPI
     1107    error(errSyntaxError, getPos(), "Bad color space (fill)");
     1108#else
    10351109    error(getPos(), const_cast<char*>("Bad color space (fill)"));
     1110#endif
    10361111  }
    10371112}
    10381113
     
    10431118
    10441119  state->setStrokePattern(NULL);
    10451120  res->lookupColorSpace(args[0].getName(), &obj);
    1046 #ifdef POPPLER_NEW_COLOR_SPACE_API
     1121#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
    10471122  if (obj.isNull()) {
    10481123    colorSpace = GfxColorSpace::parse(&args[0], NULL);
    10491124  } else {
     
    10631138    state->setStrokeColor(&color);
    10641139    builder->updateStyle(state);
    10651140  } else {
     1141#ifdef POPPLER_NEW_ERRORAPI
     1142    error(errSyntaxError, getPos(), "Bad color space (stroke)");
     1143#else
    10661144    error(getPos(), const_cast<char*>("Bad color space (stroke)"));
     1145#endif
    10671146  }
    10681147}
    10691148
     
    10721151  int i;
    10731152
    10741153  if (numArgs != state->getFillColorSpace()->getNComps()) {
     1154#ifdef POPPLER_NEW_ERRORAPI
     1155    error(errSyntaxError, getPos(), "Incorrect number of arguments in 'sc' command");
     1156#else
    10751157    error(getPos(), const_cast<char*>("Incorrect number of arguments in 'sc' command"));
     1158#endif
    10761159    return;
    10771160  }
    10781161  state->setFillPattern(NULL);
     
    10881171  int i;
    10891172
    10901173  if (numArgs != state->getStrokeColorSpace()->getNComps()) {
     1174#ifdef POPPLER_NEW_ERRORAPI
     1175    error(errSyntaxError, getPos(), "Incorrect number of arguments in 'SC' command");
     1176#else
    10911177    error(getPos(), const_cast<char*>("Incorrect number of arguments in 'SC' command"));
     1178#endif
    10921179    return;
    10931180  }
    10941181  state->setStrokePattern(NULL);
     
    11091196      if (!((GfxPatternColorSpace *)state->getFillColorSpace())->getUnder() ||
    11101197          numArgs - 1 != ((GfxPatternColorSpace *)state->getFillColorSpace())
    11111198                             ->getUnder()->getNComps()) {
     1199#ifdef POPPLER_NEW_ERRORAPI
     1200        error(errSyntaxError, getPos(), "Incorrect number of arguments in 'scn' command");
     1201#else
    11121202        error(getPos(), const_cast<char*>("Incorrect number of arguments in 'scn' command"));
     1203#endif
    11131204        return;
    11141205      }
    11151206      for (i = 0; i < numArgs - 1 && i < gfxColorMaxComps; ++i) {
     
    11201211      state->setFillColor(&color);
    11211212      builder->updateStyle(state);
    11221213    }
    1123 #ifdef POPPLER_NEW_COLOR_SPACE_API
     1214#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
    11241215    if (args[numArgs-1].isName() &&
    11251216        (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL))) {
    11261217      state->setFillPattern(pattern);
     
    11361227
    11371228  } else {
    11381229    if (numArgs != state->getFillColorSpace()->getNComps()) {
     1230#ifdef POPPLER_NEW_ERRORAPI
     1231      error(errSyntaxError, getPos(), "Incorrect number of arguments in 'scn' command");
     1232#else
    11391233      error(getPos(), const_cast<char*>("Incorrect number of arguments in 'scn' command"));
     1234#endif
    11401235      return;
    11411236    }
    11421237    state->setFillPattern(NULL);
     
    11611256               ->getUnder() ||
    11621257          numArgs - 1 != ((GfxPatternColorSpace *)state->getStrokeColorSpace())
    11631258                             ->getUnder()->getNComps()) {
     1259#ifdef POPPLER_NEW_ERRORAPI
     1260        error(errSyntaxError, getPos(), "Incorrect number of arguments in 'SCN' command");
     1261#else
    11641262        error(getPos(), const_cast<char*>("Incorrect number of arguments in 'SCN' command"));
     1263#endif
    11651264        return;
    11661265      }
    11671266      for (i = 0; i < numArgs - 1 && i < gfxColorMaxComps; ++i) {
     
    11721271      state->setStrokeColor(&color);
    11731272      builder->updateStyle(state);
    11741273    }
    1175 #ifdef POPPLER_NEW_COLOR_SPACE_API
     1274#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
    11761275    if (args[numArgs-1].isName() &&
    11771276        (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL))) {
    11781277      state->setStrokePattern(pattern);
     
    11881287
    11891288  } else {
    11901289    if (numArgs != state->getStrokeColorSpace()->getNComps()) {
     1290#ifdef POPPLER_NEW_ERRORAPI
     1291      error(errSyntaxError, getPos(), "Incorrect number of arguments in 'SCN' command");
     1292#else
    11911293      error(getPos(), const_cast<char*>("Incorrect number of arguments in 'SCN' command"));
     1294#endif
    11921295      return;
    11931296    }
    11941297    state->setStrokePattern(NULL);
     
    12121315
    12131316void PdfParser::opLineTo(Object args[], int numArgs) {
    12141317  if (!state->isCurPt()) {
     1318#ifdef POPPLER_NEW_ERRORAPI
     1319    error(errSyntaxError, getPos(), "No current point in lineto");
     1320#else
    12151321    error(getPos(), const_cast<char*>("No current point in lineto"));
     1322#endif
    12161323    return;
    12171324  }
    12181325  state->lineTo(args[0].getNum(), args[1].getNum());
     
    12221329  double x1, y1, x2, y2, x3, y3;
    12231330
    12241331  if (!state->isCurPt()) {
     1332#ifdef POPPLER_NEW_ERRORAPI
     1333    error(errSyntaxError, getPos(), "No current point in curveto");
     1334#else
    12251335    error(getPos(), const_cast<char*>("No current point in curveto"));
     1336#endif
    12261337    return;
    12271338  }
    12281339  x1 = args[0].getNum();
     
    12381349  double x1, y1, x2, y2, x3, y3;
    12391350
    12401351  if (!state->isCurPt()) {
     1352#ifdef POPPLER_NEW_ERRORAPI
     1353    error(errSyntaxError, getPos(), "No current point in curveto1");
     1354#else
    12411355    error(getPos(), const_cast<char*>("No current point in curveto1"));
     1356#endif
    12421357    return;
    12431358  }
    12441359  x1 = state->getCurX();
     
    12541369  double x1, y1, x2, y2, x3, y3;
    12551370
    12561371  if (!state->isCurPt()) {
     1372#ifdef POPPLER_NEW_ERRORAPI
     1373    error(errSyntaxError, getPos(), "No current point in curveto2");
     1374#else
    12571375    error(getPos(), const_cast<char*>("No current point in curveto2"));
     1376#endif
    12581377    return;
    12591378  }
    12601379  x1 = args[0].getNum();
     
    12821401
    12831402void PdfParser::opClosePath(Object args[], int numArgs) {
    12841403  if (!state->isCurPt()) {
     1404#ifdef POPPLER_NEW_ERRORAPI
     1405    error(errSyntaxError, getPos(), "No current point in closepath");
     1406#else
    12851407    error(getPos(), const_cast<char*>("No current point in closepath"));
     1408#endif
    12861409    return;
    12871410  }
    12881411  state->closePath();
     
    14401563    doShadingPatternFillFallback((GfxShadingPattern *)pattern, gFalse, eoFill);
    14411564    break;
    14421565  default:
     1566#ifdef POPPLER_NEW_ERRORAPI
     1567    error(errUnimplemented, getPos(), "Unimplemented pattern type (%d) in fill",
     1568#else
    14431569    error(getPos(), const_cast<char*>("Unimplemented pattern type (%d) in fill"),
     1570#endif
    14441571          pattern->getType());
    14451572    break;
    14461573  }
     
    14591586    doShadingPatternFillFallback((GfxShadingPattern *)pattern, gTrue, gFalse);
    14601587    break;
    14611588  default:
     1589#ifdef POPPLER_NEW_ERRORAPI
     1590    error(errUnimplemented, getPos(), "Unimplemented pattern type ({0:d}) in stroke",
     1591#else
    14621592    error(getPos(), const_cast<char*>("Unimplemented pattern type (%d) in stroke"),
     1593#endif
    14631594          pattern->getType());
    14641595    break;
    14651596  }
     
    15791710  double *matrix = NULL;
    15801711  GBool savedState = gFalse;
    15811712
    1582 #ifdef POPPLER_NEW_COLOR_SPACE_API
     1713#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
    15831714  if (!(shading = res->lookupShading(args[0].getName(), NULL))) {
    15841715    return;
    15851716  }
     
    21562287
    21572288void PdfParser::opShowText(Object args[], int numArgs) {
    21582289  if (!state->getFont()) {
     2290#ifdef POPPLER_NEW_ERRORAPI
     2291    error(errSyntaxError, getPos(), "No font in show");
     2292#else
    21592293    error(getPos(), const_cast<char*>("No font in show"));
     2294#endif
    21602295    return;
    21612296  }
    21622297  if (fontChanged) {
     
    21702305  double tx, ty;
    21712306
    21722307  if (!state->getFont()) {
     2308#ifdef POPPLER_NEW_ERRORAPI
     2309    error(errSyntaxError, getPos(), "No font in move/show");
     2310#else
    21732311    error(getPos(), const_cast<char*>("No font in move/show"));
     2312#endif
    21742313    return;
    21752314  }
    21762315  if (fontChanged) {
     
    21882327  double tx, ty;
    21892328
    21902329  if (!state->getFont()) {
     2330#ifdef POPPLER_NEW_ERRORAPI
     2331    error(errSyntaxError, getPos(), "No font in move/set/show");
     2332#else
    21912333    error(getPos(), const_cast<char*>("No font in move/set/show"));
     2334#endif
    21922335    return;
    21932336  }
    21942337  if (fontChanged) {
     
    22112354  int i;
    22122355
    22132356  if (!state->getFont()) {
     2357#ifdef POPPLER_NEW_ERRORAPI
     2358    error(errSyntaxError, getPos(), "No font in show/space");
     2359#else
    22142360    error(getPos(), const_cast<char*>("No font in show/space"));
     2361#endif
    22152362    return;
    22162363  }
    22172364  if (fontChanged) {
     
    22362383    } else if (obj.isString()) {
    22372384      doShowText(obj.getString());
    22382385    } else {
     2386#ifdef POPPLER_NEW_ERRORAPI
     2387      error(errSyntaxError, getPos(), "Element of show/space array must be number or string");
     2388#else
    22392389      error(getPos(), const_cast<char*>("Element of show/space array must be number or string"));
     2390#endif
    22402391    }
    22412392    obj.free();
    22422393  }
     
    23342485        if (charProc.isStream()) {
    23352486          //parse(&charProc, gFalse); // TODO: parse into SVG font
    23362487        } else {
     2488#ifdef POPPLER_NEW_ERRORAPI
     2489          error(errSyntaxError, getPos(), "Missing or bad Type3 CharProc entry");
     2490#else
    23372491          error(getPos(), const_cast<char*>("Missing or bad Type3 CharProc entry"));
     2492#endif
    23382493        }
    23392494        //out->endType3Char(state);
    23402495        if (resDict) {
     
    24102565    return;
    24112566  }
    24122567  if (!obj1.isStream()) {
     2568#ifdef POPPLER_NEW_ERRORAPI
     2569    error(errSyntaxError, getPos(), "XObject '{0:s}' is wrong type", name);
     2570#else
    24132571    error(getPos(), const_cast<char*>("XObject '%s' is wrong type"), name);
     2572#endif
    24142573    obj1.free();
    24152574    return;
    24162575  }
     
    24262585/*    out->psXObject(obj1.getStream(),
    24272586                   obj3.isStream() ? obj3.getStream() : (Stream *)NULL);*/
    24282587  } else if (obj2.isName()) {
     2588#ifdef POPPLER_NEW_ERRORAPI
     2589    error(errSyntaxError, getPos(), "Unknown XObject subtype '{0:s}'", obj2.getName());
     2590#else
    24292591    error(getPos(), const_cast<char*>("Unknown XObject subtype '%s'"), obj2.getName());
     2592#endif
    24302593  } else {
     2594#ifdef POPPLER_NEW_ERRORAPI
     2595    error(errSyntaxError, getPos(), "XObject subtype is missing or wrong type");
     2596#else
    24312597    error(getPos(), const_cast<char*>("XObject subtype is missing or wrong type"));
     2598#endif
    24322599  }
    24332600  obj2.free();
    24342601  obj1.free();
     
    25592726      }
    25602727    }
    25612728    if (!obj1.isNull()) {
    2562 #ifdef POPPLER_NEW_COLOR_SPACE_API
     2729#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
    25632730      colorSpace = GfxColorSpace::parse(&obj1, NULL);
    25642731#else
    25652732      colorSpace = GfxColorSpace::parse(&obj1);
     
    26482815          obj2.free();
    26492816        }
    26502817      }
    2651 #ifdef POPPLER_NEW_COLOR_SPACE_API
     2818#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
    26522819      maskColorSpace = GfxColorSpace::parse(&obj1, NULL);
    26532820#else
    26542821      maskColorSpace = GfxColorSpace::parse(&obj1);
     
    27582925 err2:
    27592926  obj1.free();
    27602927 err1:
     2928#ifdef POPPLER_NEW_ERRORAPI
     2929  error(errSyntaxError, getPos(), "Bad image parameters");
     2930#else
    27612931  error(getPos(), const_cast<char*>("Bad image parameters"));
     2932#endif
    27622933}
    27632934
    27642935void PdfParser::doForm(Object *str) {
     
    27832954  // check form type
    27842955  dict->lookup(const_cast<char*>("FormType"), &obj1);
    27852956  if (!(obj1.isNull() || (obj1.isInt() && obj1.getInt() == 1))) {
     2957#ifdef POPPLER_NEW_ERRORAPI
     2958    error(errSyntaxError, getPos(), "Unknown form type");
     2959#else
    27862960    error(getPos(), const_cast<char*>("Unknown form type"));
     2961#endif
    27872962  }
    27882963  obj1.free();
    27892964
     
    27912966  dict->lookup(const_cast<char*>("BBox"), &bboxObj);
    27922967  if (!bboxObj.isArray()) {
    27932968    bboxObj.free();
     2969#ifdef POPPLER_NEW_ERRORAPI
     2970    error(errSyntaxError, getPos(), "Bad form bounding box");
     2971#else
    27942972    error(getPos(), const_cast<char*>("Bad form bounding box"));
     2973#endif
    27952974    return;
    27962975  }
    27972976  for (i = 0; i < 4; ++i) {
     
    28273006    if (obj1.dictLookup(const_cast<char*>("S"), &obj2)->isName(const_cast<char*>("Transparency"))) {
    28283007      transpGroup = gTrue;
    28293008      if (!obj1.dictLookup(const_cast<char*>("CS"), &obj3)->isNull()) {
    2830 #ifdef POPPLER_NEW_COLOR_SPACE_API
     3009#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
    28313010        blendingColorSpace = GfxColorSpace::parse(&obj3, NULL);
    28323011#else
    28333012        blendingColorSpace = GfxColorSpace::parse(&obj3);
     
    29903169  parser->getObj(&obj);
    29913170  while (!obj.isCmd(const_cast<char*>("ID")) && !obj.isEOF()) {
    29923171    if (!obj.isName()) {
     3172#ifdef POPPLER_NEW_ERRORAPI
     3173      error(errSyntaxError, getPos(), "Inline image dictionary key must be a name object");
     3174#else
    29933175      error(getPos(), const_cast<char*>("Inline image dictionary key must be a name object"));
     3176#endif
    29943177      obj.free();
    29953178    } else {
    29963179      key = copyString(obj.getName());
     
    30053188    parser->getObj(&obj);
    30063189  }
    30073190  if (obj.isEOF()) {
     3191#ifdef POPPLER_NEW_ERRORAPI
     3192    error(errSyntaxError, getPos(), "End of file in inline image");
     3193#else
    30083194    error(getPos(), const_cast<char*>("End of file in inline image"));
     3195#endif
    30093196    obj.free();
    30103197    dict.free();
    30113198    return NULL;
     
    30203207}
    30213208
    30223209void PdfParser::opImageData(Object args[], int numArgs) {
     3210#ifdef POPPLER_NEW_ERRORAPI
     3211  error(errSyntaxError, getPos(), "Internal: got 'ID' operator");
     3212#else
    30233213  error(getPos(), const_cast<char*>("Internal: got 'ID' operator"));
     3214#endif
    30243215}
    30253216
    30263217void PdfParser::opEndImage(Object args[], int numArgs) {
     3218#ifdef POPPLER_NEW_ERRORAPI
     3219  error(errSyntaxError, getPos(), "Internal: got 'EI' operator");
     3220#else
    30273221  error(getPos(), const_cast<char*>("Internal: got 'EI' operator"));
     3222#endif
    30283223}
    30293224
    30303225//------------------------------------------------------------------------