]>
Commit | Line | Data |
---|---|---|
4ba74276 AM |
1 | diff -up inkscape-0.48.2/configure.ac.poppler_020 inkscape-0.48.2/configure.ac |
2 | --- inkscape-0.48.2/configure.ac.poppler_020 2011-07-08 14:23:16.270623076 -0500 | |
3 | +++ inkscape-0.48.2/configure.ac 2012-06-23 12:01:38.918678539 -0500 | |
4 | @@ -623,6 +623,12 @@ if test "x$popplernew" = "xyes"; then | |
5 | AC_DEFINE(POPPLER_NEW_GFXFONT, 1, [Use GfxFont from Poppler >= 0.8.3]) | |
6 | fi | |
7 | ||
8 | +PKG_CHECK_MODULES(POPPLER_NEWERRORAPI, poppler >= 0.20.0, popplernewerror=yes, popplernewerror=no) | |
9 | +if test "x$popplernewerror" = "xyes"; then | |
10 | + AC_DEFINE(POPPLER_NEW_ERRORAPI, 1, [Use new error API from Poppler >= 0.20.0]) | |
11 | +fi | |
12 | + | |
13 | + | |
14 | ink_svd_CPPFLAGS=$CPPFLAGS | |
15 | ink_svd_LIBS=$LIBS | |
16 | CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS" | |
17 | diff -up inkscape-0.48.2/src/extension/internal/pdfinput/pdf-parser.cpp.poppler_020 inkscape-0.48.2/src/extension/internal/pdfinput/pdf-parser.cpp | |
18 | --- inkscape-0.48.2/src/extension/internal/pdfinput/pdf-parser.cpp.poppler_020 2011-07-08 13:25:09.468790000 -0500 | |
19 | +++ inkscape-0.48.2/src/extension/internal/pdfinput/pdf-parser.cpp 2012-06-23 12:08:49.285298266 -0500 | |
20 | @@ -367,15 +367,23 @@ void PdfParser::parse(Object *obj, GBool | |
21 | for (i = 0; i < obj->arrayGetLength(); ++i) { | |
22 | obj->arrayGet(i, &obj2); | |
23 | if (!obj2.isStream()) { | |
24 | +#ifdef POPPLER_NEW_ERRORAPI | |
25 | + error(errInternal, -1, "Weird page contents"); | |
26 | +#else | |
27 | error(-1, const_cast<char*>("Weird page contents")); | |
28 | +#endif | |
29 | obj2.free(); | |
30 | return; | |
31 | } | |
32 | obj2.free(); | |
33 | } | |
34 | } else if (!obj->isStream()) { | |
35 | - error(-1, const_cast<char*>("Weird page contents")); | |
36 | - return; | |
37 | +#ifdef POPPLER_NEW_ERRORAPI | |
38 | + error(errInternal, -1, "Weird page contents"); | |
39 | +#else | |
40 | + error(-1, const_cast<char*>("Weird page contents")); | |
41 | +#endif | |
42 | + return; | |
43 | } | |
44 | parser = new Parser(xref, new Lexer(xref, obj), gFalse); | |
45 | go(topLevel); | |
46 | @@ -419,7 +427,11 @@ void PdfParser::go(GBool topLevel) { | |
47 | ||
48 | // too many arguments - something is wrong | |
49 | } else { | |
50 | +#ifdef POPPLER_NEW_ERRORAPI | |
51 | + error(errSyntaxError, getPos(), "Too many args in content stream"); | |
52 | +#else | |
53 | error(getPos(), const_cast<char*>("Too many args in content stream")); | |
54 | +#endif | |
55 | if (printCommands) { | |
56 | printf("throwing away arg: "); | |
57 | obj.print(stdout); | |
58 | @@ -436,7 +448,11 @@ void PdfParser::go(GBool topLevel) { | |
59 | ||
60 | // args at end with no command | |
61 | if (numArgs > 0) { | |
62 | +#ifdef POPPLER_NEW_ERRORAPI | |
63 | + error(errSyntaxError, getPos(), "Leftover args in content stream"); | |
64 | +#else | |
65 | error(getPos(), const_cast<char*>("Leftover args in content stream")); | |
66 | +#endif | |
67 | if (printCommands) { | |
68 | printf("%d leftovers:", numArgs); | |
69 | for (i = 0; i < numArgs; ++i) { | |
70 | @@ -502,7 +518,11 @@ void PdfParser::execOp(Object *cmd, Obje | |
71 | name = cmd->getCmd(); | |
72 | if (!(op = findOp(name))) { | |
73 | if (ignoreUndef == 0) | |
74 | +#ifdef POPPLER_NEW_ERRORAPI | |
75 | + error(errSyntaxError, getPos(), "Unknown operator '{0:s}'", name); | |
76 | +#else | |
77 | error(getPos(), const_cast<char*>("Unknown operator '%s'"), name); | |
78 | +#endif | |
79 | return; | |
80 | } | |
81 | ||
82 | @@ -510,26 +530,42 @@ void PdfParser::execOp(Object *cmd, Obje | |
83 | argPtr = args; | |
84 | if (op->numArgs >= 0) { | |
85 | if (numArgs < op->numArgs) { | |
86 | +#ifdef POPPLER_NEW_ERRORAPI | |
87 | + error(errSyntaxError, getPos(), "Too few ({0:d}) args to '{1:d}' operator", numArgs, name); | |
88 | +#else | |
89 | error(getPos(), const_cast<char*>("Too few (%d) args to '%s' operator"), numArgs, name); | |
90 | +#endif | |
91 | return; | |
92 | } | |
93 | if (numArgs > op->numArgs) { | |
94 | #if 0 | |
95 | +#ifdef POPPLER_NEW_ERRORAPI | |
96 | + error(errSyntaxError, getPos(), "Too many ({0:d}) args to '{1:s}' operator", numArgs, name); | |
97 | +#else | |
98 | error(getPos(), "Too many (%d) args to '%s' operator", numArgs, name); | |
99 | #endif | |
100 | +#endif | |
101 | argPtr += numArgs - op->numArgs; | |
102 | numArgs = op->numArgs; | |
103 | } | |
104 | } else { | |
105 | if (numArgs > -op->numArgs) { | |
106 | +#ifdef POPPLER_NEW_ERRORAPI | |
107 | + error(errSyntaxError, getPos(), "Too many ({0:d}) args to '{1:s}' operator", | |
108 | +#else | |
109 | error(getPos(), const_cast<char*>("Too many (%d) args to '%s' operator"), | |
110 | +#endif | |
111 | numArgs, name); | |
112 | return; | |
113 | } | |
114 | } | |
115 | for (i = 0; i < numArgs; ++i) { | |
116 | if (!checkArg(&argPtr[i], op->tchk[i])) { | |
117 | +#ifdef POPPLER_NEW_ERRORAPI | |
118 | + error(errSyntaxError, getPos(), "Arg #{0:d} to '{1:s}' operator is wrong type ({2:s})", | |
119 | +#else | |
120 | error(getPos(), const_cast<char*>("Arg #%d to '%s' operator is wrong type (%s)"), | |
121 | +#endif | |
122 | i, name, argPtr[i].getTypeName()); | |
123 | return; | |
124 | } | |
125 | @@ -690,7 +726,11 @@ void PdfParser::opSetExtGState(Object ar | |
126 | return; | |
127 | } | |
128 | if (!obj1.isDict()) { | |
129 | +#ifdef POPPLER_NEW_ERRORAPI | |
130 | + error(errSyntaxError, getPos(), "ExtGState '{0:s}' is wrong type"), args[0].getName(); | |
131 | +#else | |
132 | error(getPos(), const_cast<char*>("ExtGState '%s' is wrong type"), args[0].getName()); | |
133 | +#endif | |
134 | obj1.free(); | |
135 | return; | |
136 | } | |
137 | @@ -705,7 +745,11 @@ void PdfParser::opSetExtGState(Object ar | |
138 | if (state->parseBlendMode(&obj2, &mode)) { | |
139 | state->setBlendMode(mode); | |
140 | } else { | |
141 | +#ifdef POPPLER_NEW_ERRORAPI | |
142 | + error(errSyntaxError, getPos(), "Invalid blend mode in ExtGState"); | |
143 | +#else | |
144 | error(getPos(), const_cast<char*>("Invalid blend mode in ExtGState")); | |
145 | +#endif | |
146 | } | |
147 | } | |
148 | obj2.free(); | |
149 | @@ -764,7 +808,11 @@ void PdfParser::opSetExtGState(Object ar | |
150 | state->setTransfer(funcs); | |
151 | } | |
152 | } else if (!obj2.isNull()) { | |
153 | +#ifdef POPPLER_NEW_ERRORAPI | |
154 | + error(errSyntaxError, getPos(), "Invalid transfer function in ExtGState"); | |
155 | +#else | |
156 | error(getPos(), const_cast<char*>("Invalid transfer function in ExtGState")); | |
157 | +#endif | |
158 | } | |
159 | obj2.free(); | |
160 | ||
161 | @@ -784,8 +832,11 @@ void PdfParser::opSetExtGState(Object ar | |
162 | funcs[0] = Function::parse(&obj3); | |
163 | if (funcs[0]->getInputSize() != 1 || | |
164 | funcs[0]->getOutputSize() != 1) { | |
165 | - error(getPos(), | |
166 | - const_cast<char*>("Invalid transfer function in soft mask in ExtGState")); | |
167 | +#ifdef POPPLER_NEW_ERRORAPI | |
168 | + error(errSyntaxError, getPos(), "Invalid transfer function in soft mask in ExtGState"); | |
169 | +#else | |
170 | + error(getPos(), const_cast<char*>("Invalid transfer function in soft mask in ExtGState")); | |
171 | +#endif | |
172 | delete funcs[0]; | |
173 | funcs[0] = NULL; | |
174 | } | |
175 | @@ -809,7 +860,7 @@ void PdfParser::opSetExtGState(Object ar | |
176 | blendingColorSpace = NULL; | |
177 | isolated = knockout = gFalse; | |
178 | if (!obj4.dictLookup(const_cast<char*>("CS"), &obj5)->isNull()) { | |
179 | -#ifdef POPPLER_NEW_COLOR_SPACE_API | |
180 | +#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) | |
181 | blendingColorSpace = GfxColorSpace::parse(&obj5, NULL); | |
182 | #else | |
183 | blendingColorSpace = GfxColorSpace::parse(&obj5); | |
184 | @@ -840,15 +891,27 @@ void PdfParser::opSetExtGState(Object ar | |
185 | delete funcs[0]; | |
186 | } | |
187 | } else { | |
188 | +#ifdef POPPLER_NEW_ERRORAPI | |
189 | + error(errSyntaxError, getPos(), "Invalid soft mask in ExtGState - missing group"); | |
190 | +#else | |
191 | error(getPos(), const_cast<char*>("Invalid soft mask in ExtGState - missing group")); | |
192 | +#endif | |
193 | } | |
194 | obj4.free(); | |
195 | } else { | |
196 | +#ifdef POPPLER_NEW_ERRORAPI | |
197 | + error(errSyntaxError, getPos(), "Invalid soft mask in ExtGState - missing group"); | |
198 | +#else | |
199 | error(getPos(), const_cast<char*>("Invalid soft mask in ExtGState - missing group")); | |
200 | +#endif | |
201 | } | |
202 | obj3.free(); | |
203 | } else if (!obj2.isNull()) { | |
204 | +#ifdef POPPLER_NEW_ERRORAPI | |
205 | + error(errSyntaxError, getPos(), "Invalid soft mask in ExtGState"); | |
206 | +#else | |
207 | error(getPos(), const_cast<char*>("Invalid soft mask in ExtGState")); | |
208 | +#endif | |
209 | } | |
210 | } | |
211 | obj2.free(); | |
212 | @@ -876,7 +939,11 @@ void PdfParser::doSoftMask(Object *str, | |
213 | // check form type | |
214 | dict->lookup(const_cast<char*>("FormType"), &obj1); | |
215 | if (!(obj1.isNull() || (obj1.isInt() && obj1.getInt() == 1))) { | |
216 | +#ifdef POPPLER_NEW_ERRORAPI | |
217 | + error(errSyntaxError, getPos(), "Unknown form type"); | |
218 | +#else | |
219 | error(getPos(), const_cast<char*>("Unknown form type")); | |
220 | +#endif | |
221 | } | |
222 | obj1.free(); | |
223 | ||
224 | @@ -884,7 +951,11 @@ void PdfParser::doSoftMask(Object *str, | |
225 | dict->lookup(const_cast<char*>("BBox"), &obj1); | |
226 | if (!obj1.isArray()) { | |
227 | obj1.free(); | |
228 | +#ifdef POPPLER_NEW_ERRORAPI | |
229 | + error(errSyntaxError, getPos(), "Bad form bounding box"); | |
230 | +#else | |
231 | error(getPos(), const_cast<char*>("Bad form bounding box")); | |
232 | +#endif | |
233 | return; | |
234 | } | |
235 | for (i = 0; i < 4; ++i) { | |
236 | @@ -1012,7 +1083,7 @@ void PdfParser::opSetFillColorSpace(Obje | |
237 | ||
238 | state->setFillPattern(NULL); | |
239 | res->lookupColorSpace(args[0].getName(), &obj); | |
240 | -#ifdef POPPLER_NEW_COLOR_SPACE_API | |
241 | +#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) | |
242 | if (obj.isNull()) { | |
243 | colorSpace = GfxColorSpace::parse(&args[0], NULL); | |
244 | } else { | |
245 | @@ -1032,7 +1103,11 @@ void PdfParser::opSetFillColorSpace(Obje | |
246 | state->setFillColor(&color); | |
247 | builder->updateStyle(state); | |
248 | } else { | |
249 | +#ifdef POPPLER_NEW_ERRORAPI | |
250 | + error(errSyntaxError, getPos(), "Bad color space (fill)"); | |
251 | +#else | |
252 | error(getPos(), const_cast<char*>("Bad color space (fill)")); | |
253 | +#endif | |
254 | } | |
255 | } | |
256 | ||
257 | @@ -1043,7 +1118,7 @@ void PdfParser::opSetStrokeColorSpace(Ob | |
258 | ||
259 | state->setStrokePattern(NULL); | |
260 | res->lookupColorSpace(args[0].getName(), &obj); | |
261 | -#ifdef POPPLER_NEW_COLOR_SPACE_API | |
262 | +#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) | |
263 | if (obj.isNull()) { | |
264 | colorSpace = GfxColorSpace::parse(&args[0], NULL); | |
265 | } else { | |
266 | @@ -1063,7 +1138,11 @@ void PdfParser::opSetStrokeColorSpace(Ob | |
267 | state->setStrokeColor(&color); | |
268 | builder->updateStyle(state); | |
269 | } else { | |
270 | +#ifdef POPPLER_NEW_ERRORAPI | |
271 | + error(errSyntaxError, getPos(), "Bad color space (stroke)"); | |
272 | +#else | |
273 | error(getPos(), const_cast<char*>("Bad color space (stroke)")); | |
274 | +#endif | |
275 | } | |
276 | } | |
277 | ||
278 | @@ -1072,7 +1151,11 @@ void PdfParser::opSetFillColor(Object ar | |
279 | int i; | |
280 | ||
281 | if (numArgs != state->getFillColorSpace()->getNComps()) { | |
282 | +#ifdef POPPLER_NEW_ERRORAPI | |
283 | + error(errSyntaxError, getPos(), "Incorrect number of arguments in 'sc' command"); | |
284 | +#else | |
285 | error(getPos(), const_cast<char*>("Incorrect number of arguments in 'sc' command")); | |
286 | +#endif | |
287 | return; | |
288 | } | |
289 | state->setFillPattern(NULL); | |
290 | @@ -1088,7 +1171,11 @@ void PdfParser::opSetStrokeColor(Object | |
291 | int i; | |
292 | ||
293 | if (numArgs != state->getStrokeColorSpace()->getNComps()) { | |
294 | +#ifdef POPPLER_NEW_ERRORAPI | |
295 | + error(errSyntaxError, getPos(), "Incorrect number of arguments in 'SC' command"); | |
296 | +#else | |
297 | error(getPos(), const_cast<char*>("Incorrect number of arguments in 'SC' command")); | |
298 | +#endif | |
299 | return; | |
300 | } | |
301 | state->setStrokePattern(NULL); | |
302 | @@ -1109,7 +1196,11 @@ void PdfParser::opSetFillColorN(Object a | |
303 | if (!((GfxPatternColorSpace *)state->getFillColorSpace())->getUnder() || | |
304 | numArgs - 1 != ((GfxPatternColorSpace *)state->getFillColorSpace()) | |
305 | ->getUnder()->getNComps()) { | |
306 | +#ifdef POPPLER_NEW_ERRORAPI | |
307 | + error(errSyntaxError, getPos(), "Incorrect number of arguments in 'scn' command"); | |
308 | +#else | |
309 | error(getPos(), const_cast<char*>("Incorrect number of arguments in 'scn' command")); | |
310 | +#endif | |
311 | return; | |
312 | } | |
313 | for (i = 0; i < numArgs - 1 && i < gfxColorMaxComps; ++i) { | |
314 | @@ -1120,7 +1211,7 @@ void PdfParser::opSetFillColorN(Object a | |
315 | state->setFillColor(&color); | |
316 | builder->updateStyle(state); | |
317 | } | |
318 | -#ifdef POPPLER_NEW_COLOR_SPACE_API | |
319 | +#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) | |
320 | if (args[numArgs-1].isName() && | |
321 | (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL))) { | |
322 | state->setFillPattern(pattern); | |
323 | @@ -1136,7 +1227,11 @@ void PdfParser::opSetFillColorN(Object a | |
324 | ||
325 | } else { | |
326 | if (numArgs != state->getFillColorSpace()->getNComps()) { | |
327 | +#ifdef POPPLER_NEW_ERRORAPI | |
328 | + error(errSyntaxError, getPos(), "Incorrect number of arguments in 'scn' command"); | |
329 | +#else | |
330 | error(getPos(), const_cast<char*>("Incorrect number of arguments in 'scn' command")); | |
331 | +#endif | |
332 | return; | |
333 | } | |
334 | state->setFillPattern(NULL); | |
335 | @@ -1161,7 +1256,11 @@ void PdfParser::opSetStrokeColorN(Object | |
336 | ->getUnder() || | |
337 | numArgs - 1 != ((GfxPatternColorSpace *)state->getStrokeColorSpace()) | |
338 | ->getUnder()->getNComps()) { | |
339 | +#ifdef POPPLER_NEW_ERRORAPI | |
340 | + error(errSyntaxError, getPos(), "Incorrect number of arguments in 'SCN' command"); | |
341 | +#else | |
342 | error(getPos(), const_cast<char*>("Incorrect number of arguments in 'SCN' command")); | |
343 | +#endif | |
344 | return; | |
345 | } | |
346 | for (i = 0; i < numArgs - 1 && i < gfxColorMaxComps; ++i) { | |
347 | @@ -1172,7 +1271,7 @@ void PdfParser::opSetStrokeColorN(Object | |
348 | state->setStrokeColor(&color); | |
349 | builder->updateStyle(state); | |
350 | } | |
351 | -#ifdef POPPLER_NEW_COLOR_SPACE_API | |
352 | +#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) | |
353 | if (args[numArgs-1].isName() && | |
354 | (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL))) { | |
355 | state->setStrokePattern(pattern); | |
356 | @@ -1188,7 +1287,11 @@ void PdfParser::opSetStrokeColorN(Object | |
357 | ||
358 | } else { | |
359 | if (numArgs != state->getStrokeColorSpace()->getNComps()) { | |
360 | +#ifdef POPPLER_NEW_ERRORAPI | |
361 | + error(errSyntaxError, getPos(), "Incorrect number of arguments in 'SCN' command"); | |
362 | +#else | |
363 | error(getPos(), const_cast<char*>("Incorrect number of arguments in 'SCN' command")); | |
364 | +#endif | |
365 | return; | |
366 | } | |
367 | state->setStrokePattern(NULL); | |
368 | @@ -1212,7 +1315,11 @@ void PdfParser::opMoveTo(Object args[], | |
369 | ||
370 | void PdfParser::opLineTo(Object args[], int numArgs) { | |
371 | if (!state->isCurPt()) { | |
372 | +#ifdef POPPLER_NEW_ERRORAPI | |
373 | + error(errSyntaxError, getPos(), "No current point in lineto"); | |
374 | +#else | |
375 | error(getPos(), const_cast<char*>("No current point in lineto")); | |
376 | +#endif | |
377 | return; | |
378 | } | |
379 | state->lineTo(args[0].getNum(), args[1].getNum()); | |
380 | @@ -1222,7 +1329,11 @@ void PdfParser::opCurveTo(Object args[], | |
381 | double x1, y1, x2, y2, x3, y3; | |
382 | ||
383 | if (!state->isCurPt()) { | |
384 | +#ifdef POPPLER_NEW_ERRORAPI | |
385 | + error(errSyntaxError, getPos(), "No current point in curveto"); | |
386 | +#else | |
387 | error(getPos(), const_cast<char*>("No current point in curveto")); | |
388 | +#endif | |
389 | return; | |
390 | } | |
391 | x1 = args[0].getNum(); | |
392 | @@ -1238,7 +1349,11 @@ void PdfParser::opCurveTo1(Object args[] | |
393 | double x1, y1, x2, y2, x3, y3; | |
394 | ||
395 | if (!state->isCurPt()) { | |
396 | +#ifdef POPPLER_NEW_ERRORAPI | |
397 | + error(errSyntaxError, getPos(), "No current point in curveto1"); | |
398 | +#else | |
399 | error(getPos(), const_cast<char*>("No current point in curveto1")); | |
400 | +#endif | |
401 | return; | |
402 | } | |
403 | x1 = state->getCurX(); | |
404 | @@ -1254,7 +1369,11 @@ void PdfParser::opCurveTo2(Object args[] | |
405 | double x1, y1, x2, y2, x3, y3; | |
406 | ||
407 | if (!state->isCurPt()) { | |
408 | +#ifdef POPPLER_NEW_ERRORAPI | |
409 | + error(errSyntaxError, getPos(), "No current point in curveto2"); | |
410 | +#else | |
411 | error(getPos(), const_cast<char*>("No current point in curveto2")); | |
412 | +#endif | |
413 | return; | |
414 | } | |
415 | x1 = args[0].getNum(); | |
416 | @@ -1282,7 +1401,11 @@ void PdfParser::opRectangle(Object args[ | |
417 | ||
418 | void PdfParser::opClosePath(Object args[], int numArgs) { | |
419 | if (!state->isCurPt()) { | |
420 | +#ifdef POPPLER_NEW_ERRORAPI | |
421 | + error(errSyntaxError, getPos(), "No current point in closepath"); | |
422 | +#else | |
423 | error(getPos(), const_cast<char*>("No current point in closepath")); | |
424 | +#endif | |
425 | return; | |
426 | } | |
427 | state->closePath(); | |
428 | @@ -1440,7 +1563,11 @@ void PdfParser::doPatternFillFallback(GB | |
429 | doShadingPatternFillFallback((GfxShadingPattern *)pattern, gFalse, eoFill); | |
430 | break; | |
431 | default: | |
432 | +#ifdef POPPLER_NEW_ERRORAPI | |
433 | + error(errUnimplemented, getPos(), "Unimplemented pattern type (%d) in fill", | |
434 | +#else | |
435 | error(getPos(), const_cast<char*>("Unimplemented pattern type (%d) in fill"), | |
436 | +#endif | |
437 | pattern->getType()); | |
438 | break; | |
439 | } | |
440 | @@ -1459,7 +1586,11 @@ void PdfParser::doPatternStrokeFallback( | |
441 | doShadingPatternFillFallback((GfxShadingPattern *)pattern, gTrue, gFalse); | |
442 | break; | |
443 | default: | |
444 | +#ifdef POPPLER_NEW_ERRORAPI | |
445 | + error(errUnimplemented, getPos(), "Unimplemented pattern type ({0:d}) in stroke", | |
446 | +#else | |
447 | error(getPos(), const_cast<char*>("Unimplemented pattern type (%d) in stroke"), | |
448 | +#endif | |
449 | pattern->getType()); | |
450 | break; | |
451 | } | |
452 | @@ -1579,7 +1710,7 @@ void PdfParser::opShFill(Object args[], | |
453 | double *matrix = NULL; | |
454 | GBool savedState = gFalse; | |
455 | ||
456 | -#ifdef POPPLER_NEW_COLOR_SPACE_API | |
457 | +#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) | |
458 | if (!(shading = res->lookupShading(args[0].getName(), NULL))) { | |
459 | return; | |
460 | } | |
461 | @@ -2156,7 +2287,11 @@ void PdfParser::opTextNextLine(Object ar | |
462 | ||
463 | void PdfParser::opShowText(Object args[], int numArgs) { | |
464 | if (!state->getFont()) { | |
465 | +#ifdef POPPLER_NEW_ERRORAPI | |
466 | + error(errSyntaxError, getPos(), "No font in show"); | |
467 | +#else | |
468 | error(getPos(), const_cast<char*>("No font in show")); | |
469 | +#endif | |
470 | return; | |
471 | } | |
472 | if (fontChanged) { | |
473 | @@ -2170,7 +2305,11 @@ void PdfParser::opMoveShowText(Object ar | |
474 | double tx, ty; | |
475 | ||
476 | if (!state->getFont()) { | |
477 | +#ifdef POPPLER_NEW_ERRORAPI | |
478 | + error(errSyntaxError, getPos(), "No font in move/show"); | |
479 | +#else | |
480 | error(getPos(), const_cast<char*>("No font in move/show")); | |
481 | +#endif | |
482 | return; | |
483 | } | |
484 | if (fontChanged) { | |
485 | @@ -2188,7 +2327,11 @@ void PdfParser::opMoveSetShowText(Object | |
486 | double tx, ty; | |
487 | ||
488 | if (!state->getFont()) { | |
489 | +#ifdef POPPLER_NEW_ERRORAPI | |
490 | + error(errSyntaxError, getPos(), "No font in move/set/show"); | |
491 | +#else | |
492 | error(getPos(), const_cast<char*>("No font in move/set/show")); | |
493 | +#endif | |
494 | return; | |
495 | } | |
496 | if (fontChanged) { | |
497 | @@ -2211,7 +2354,11 @@ void PdfParser::opShowSpaceText(Object a | |
498 | int i; | |
499 | ||
500 | if (!state->getFont()) { | |
501 | +#ifdef POPPLER_NEW_ERRORAPI | |
502 | + error(errSyntaxError, getPos(), "No font in show/space"); | |
503 | +#else | |
504 | error(getPos(), const_cast<char*>("No font in show/space")); | |
505 | +#endif | |
506 | return; | |
507 | } | |
508 | if (fontChanged) { | |
509 | @@ -2236,7 +2383,11 @@ void PdfParser::opShowSpaceText(Object a | |
510 | } else if (obj.isString()) { | |
511 | doShowText(obj.getString()); | |
512 | } else { | |
513 | +#ifdef POPPLER_NEW_ERRORAPI | |
514 | + error(errSyntaxError, getPos(), "Element of show/space array must be number or string"); | |
515 | +#else | |
516 | error(getPos(), const_cast<char*>("Element of show/space array must be number or string")); | |
517 | +#endif | |
518 | } | |
519 | obj.free(); | |
520 | } | |
521 | @@ -2334,7 +2485,11 @@ void PdfParser::doShowText(GooString *s) | |
522 | if (charProc.isStream()) { | |
523 | //parse(&charProc, gFalse); // TODO: parse into SVG font | |
524 | } else { | |
525 | +#ifdef POPPLER_NEW_ERRORAPI | |
526 | + error(errSyntaxError, getPos(), "Missing or bad Type3 CharProc entry"); | |
527 | +#else | |
528 | error(getPos(), const_cast<char*>("Missing or bad Type3 CharProc entry")); | |
529 | +#endif | |
530 | } | |
531 | //out->endType3Char(state); | |
532 | if (resDict) { | |
533 | @@ -2410,7 +2565,11 @@ void PdfParser::opXObject(Object args[], | |
534 | return; | |
535 | } | |
536 | if (!obj1.isStream()) { | |
537 | +#ifdef POPPLER_NEW_ERRORAPI | |
538 | + error(errSyntaxError, getPos(), "XObject '{0:s}' is wrong type", name); | |
539 | +#else | |
540 | error(getPos(), const_cast<char*>("XObject '%s' is wrong type"), name); | |
541 | +#endif | |
542 | obj1.free(); | |
543 | return; | |
544 | } | |
545 | @@ -2426,9 +2585,17 @@ void PdfParser::opXObject(Object args[], | |
546 | /* out->psXObject(obj1.getStream(), | |
547 | obj3.isStream() ? obj3.getStream() : (Stream *)NULL);*/ | |
548 | } else if (obj2.isName()) { | |
549 | +#ifdef POPPLER_NEW_ERRORAPI | |
550 | + error(errSyntaxError, getPos(), "Unknown XObject subtype '{0:s}'", obj2.getName()); | |
551 | +#else | |
552 | error(getPos(), const_cast<char*>("Unknown XObject subtype '%s'"), obj2.getName()); | |
553 | +#endif | |
554 | } else { | |
555 | +#ifdef POPPLER_NEW_ERRORAPI | |
556 | + error(errSyntaxError, getPos(), "XObject subtype is missing or wrong type"); | |
557 | +#else | |
558 | error(getPos(), const_cast<char*>("XObject subtype is missing or wrong type")); | |
559 | +#endif | |
560 | } | |
561 | obj2.free(); | |
562 | obj1.free(); | |
563 | @@ -2559,7 +2726,7 @@ void PdfParser::doImage(Object *ref, Str | |
564 | } | |
565 | } | |
566 | if (!obj1.isNull()) { | |
567 | -#ifdef POPPLER_NEW_COLOR_SPACE_API | |
568 | +#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) | |
569 | colorSpace = GfxColorSpace::parse(&obj1, NULL); | |
570 | #else | |
571 | colorSpace = GfxColorSpace::parse(&obj1); | |
572 | @@ -2648,7 +2815,7 @@ void PdfParser::doImage(Object *ref, Str | |
573 | obj2.free(); | |
574 | } | |
575 | } | |
576 | -#ifdef POPPLER_NEW_COLOR_SPACE_API | |
577 | +#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) | |
578 | maskColorSpace = GfxColorSpace::parse(&obj1, NULL); | |
579 | #else | |
580 | maskColorSpace = GfxColorSpace::parse(&obj1); | |
581 | @@ -2758,7 +2925,11 @@ void PdfParser::doImage(Object *ref, Str | |
582 | err2: | |
583 | obj1.free(); | |
584 | err1: | |
585 | +#ifdef POPPLER_NEW_ERRORAPI | |
586 | + error(errSyntaxError, getPos(), "Bad image parameters"); | |
587 | +#else | |
588 | error(getPos(), const_cast<char*>("Bad image parameters")); | |
589 | +#endif | |
590 | } | |
591 | ||
592 | void PdfParser::doForm(Object *str) { | |
593 | @@ -2783,7 +2954,11 @@ void PdfParser::doForm(Object *str) { | |
594 | // check form type | |
595 | dict->lookup(const_cast<char*>("FormType"), &obj1); | |
596 | if (!(obj1.isNull() || (obj1.isInt() && obj1.getInt() == 1))) { | |
597 | +#ifdef POPPLER_NEW_ERRORAPI | |
598 | + error(errSyntaxError, getPos(), "Unknown form type"); | |
599 | +#else | |
600 | error(getPos(), const_cast<char*>("Unknown form type")); | |
601 | +#endif | |
602 | } | |
603 | obj1.free(); | |
604 | ||
605 | @@ -2791,7 +2966,11 @@ void PdfParser::doForm(Object *str) { | |
606 | dict->lookup(const_cast<char*>("BBox"), &bboxObj); | |
607 | if (!bboxObj.isArray()) { | |
608 | bboxObj.free(); | |
609 | +#ifdef POPPLER_NEW_ERRORAPI | |
610 | + error(errSyntaxError, getPos(), "Bad form bounding box"); | |
611 | +#else | |
612 | error(getPos(), const_cast<char*>("Bad form bounding box")); | |
613 | +#endif | |
614 | return; | |
615 | } | |
616 | for (i = 0; i < 4; ++i) { | |
617 | @@ -2827,7 +3006,7 @@ void PdfParser::doForm(Object *str) { | |
618 | if (obj1.dictLookup(const_cast<char*>("S"), &obj2)->isName(const_cast<char*>("Transparency"))) { | |
619 | transpGroup = gTrue; | |
620 | if (!obj1.dictLookup(const_cast<char*>("CS"), &obj3)->isNull()) { | |
621 | -#ifdef POPPLER_NEW_COLOR_SPACE_API | |
622 | +#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) | |
623 | blendingColorSpace = GfxColorSpace::parse(&obj3, NULL); | |
624 | #else | |
625 | blendingColorSpace = GfxColorSpace::parse(&obj3); | |
626 | @@ -2990,7 +3169,11 @@ Stream *PdfParser::buildImageStream() { | |
627 | parser->getObj(&obj); | |
628 | while (!obj.isCmd(const_cast<char*>("ID")) && !obj.isEOF()) { | |
629 | if (!obj.isName()) { | |
630 | +#ifdef POPPLER_NEW_ERRORAPI | |
631 | + error(errSyntaxError, getPos(), "Inline image dictionary key must be a name object"); | |
632 | +#else | |
633 | error(getPos(), const_cast<char*>("Inline image dictionary key must be a name object")); | |
634 | +#endif | |
635 | obj.free(); | |
636 | } else { | |
637 | key = copyString(obj.getName()); | |
638 | @@ -3005,7 +3188,11 @@ Stream *PdfParser::buildImageStream() { | |
639 | parser->getObj(&obj); | |
640 | } | |
641 | if (obj.isEOF()) { | |
642 | +#ifdef POPPLER_NEW_ERRORAPI | |
643 | + error(errSyntaxError, getPos(), "End of file in inline image"); | |
644 | +#else | |
645 | error(getPos(), const_cast<char*>("End of file in inline image")); | |
646 | +#endif | |
647 | obj.free(); | |
648 | dict.free(); | |
649 | return NULL; | |
650 | @@ -3020,11 +3207,19 @@ Stream *PdfParser::buildImageStream() { | |
651 | } | |
652 | ||
653 | void PdfParser::opImageData(Object args[], int numArgs) { | |
654 | +#ifdef POPPLER_NEW_ERRORAPI | |
655 | + error(errInternal, getPos(), "Internal: got 'ID' operator"); | |
656 | +#else | |
657 | error(getPos(), const_cast<char*>("Internal: got 'ID' operator")); | |
658 | +#endif | |
659 | } | |
660 | ||
661 | void PdfParser::opEndImage(Object args[], int numArgs) { | |
662 | +#ifdef POPPLER_NEW_ERRORAPI | |
663 | + error(errInternal, getPos(), "Internal: got 'EI' operator"); | |
664 | +#else | |
665 | error(getPos(), const_cast<char*>("Internal: got 'EI' operator")); | |
666 | +#endif | |
667 | } | |
668 | ||
669 | //------------------------------------------------------------------------ | |
670 | diff -up inkscape-0.48.2/src/extension/internal/pdfinput/svg-builder.cpp.poppler_020 inkscape-0.48.2/src/extension/internal/pdfinput/svg-builder.cpp | |
671 | --- inkscape-0.48.2/src/extension/internal/pdfinput/svg-builder.cpp.poppler_020 2012-06-23 12:01:38.912678613 -0500 | |
672 | +++ inkscape-0.48.2/src/extension/internal/pdfinput/svg-builder.cpp 2012-06-23 12:01:38.920678513 -0500 | |
673 | @@ -961,9 +961,7 @@ void SvgBuilder::updateFont(GfxState *st | |
674 | _font_style = sp_repr_css_attr_new(); | |
675 | GfxFont *font = state->getFont(); | |
676 | // Store original name | |
677 | - if (font->getOrigName()) { | |
678 | - _font_specification = font->getOrigName()->getCString(); | |
679 | - } else if (font->getName()) { | |
680 | + if (font->getName()) { | |
681 | _font_specification = font->getName()->getCString(); | |
682 | } else { | |
683 | _font_specification = (char*) "Arial"; |