/[packages]/cauldron/texlive/current/SOURCES/0001-try-to-adapt-to-poppler-0.58.patch
ViewVC logotype

Contents of /cauldron/texlive/current/SOURCES/0001-try-to-adapt-to-poppler-0.58.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1191402 - (show annotations) (download)
Sun Jan 7 22:50:22 2018 UTC (2 years, 2 months ago) by mokraemer
File size: 44458 byte(s)
new texLive 2017
1 From 50a6171b4d01c296b7d634fdef0679da5c258d7c Mon Sep 17 00:00:00 2001
2 From: David Tardon <dtardon@redhat.com>
3 Date: Thu, 7 Sep 2017 17:02:51 +0200
4 Subject: [PATCH] try to adapt to poppler 0.58
5
6 ---
7 texk/web2c/luatexdir/image/pdftoepdf.w | 53 ++++-----
8 texk/web2c/luatexdir/lua/lepdflib.cc | 114 ++++++++------------
9 texk/web2c/luatexdir/lua/lpdfscannerlib.cc | 2 +-
10 texk/web2c/pdftexdir/pdftoepdf.cc | 168 ++++++++++++-----------------
11 texk/web2c/pdftexdir/pdftosrc.cc | 31 ++----
12 7 files changed, 162 insertions(+), 259 deletions(-)
13
14 diff --git a/source/texk/web2c/luatexdir/image/pdftoepdf.w b/source/texk/web2c/luatexdir/image/pdftoepdf.w
15 index d86504f..885ca47 100644
16 --- a/source/texk/web2c/luatexdir/image/pdftoepdf.w
17 +++ b/source/texk/web2c/luatexdir/image/pdftoepdf.w
18 @@ -224,7 +224,7 @@ PdfDocument *refMemStreamPdfDocument(char *docstream, unsigned long long streams
19 free(checksum);
20 }
21 if (pdf_doc->doc == NULL) {
22 - docmemstream = new MemStream( docstream,0,streamsize, obj.initNull() );
23 + docmemstream = new MemStream( docstream,0,streamsize, Object(objNull));
24 doc = new PDFDoc(docmemstream); /* takes ownership of docmemstream */
25 pdf_doc->pc++;
26 if (!doc->isOk() || !doc->okToPrint()) {
27 @@ -408,9 +408,8 @@ static void copyArray(PDF pdf, PdfDocument * pdf_doc, Array * array)
28 Object obj1;
29 pdf_begin_array(pdf);
30 for (i = 0, l = array->getLength(); i < l; ++i) {
31 - array->getNF(i, &obj1);
32 + obj1 = array->getNF(i);
33 copyObject(pdf, pdf_doc, &obj1);
34 - obj1.free();
35 }
36 pdf_end_array(pdf);
37 }
38 @@ -422,9 +421,8 @@ static void copyDict(PDF pdf, PdfDocument * pdf_doc, Dict * dict)
39 pdf_begin_dict(pdf);
40 for (i = 0, l = dict->getLength(); i < l; ++i) {
41 copyName(pdf, dict->getKey(i));
42 - dict->getValNF(i, &obj1);
43 + obj1 = dict->getValNF(i);
44 copyObject(pdf, pdf_doc, &obj1);
45 - obj1.free();
46 }
47 pdf_end_dict(pdf);
48 }
49 @@ -510,13 +508,12 @@ static void writeRefs(PDF pdf, PdfDocument * pdf_doc)
50 PDFDoc *doc = pdf_doc->doc;
51 xref = doc->getXRef();
52 for (r = pdf_doc->inObjList; r != NULL;) {
53 - xref->fetch(r->ref.num, r->ref.gen, &obj1);
54 + obj1 = xref->fetch(r->ref.num, r->ref.gen);
55 if (obj1.isStream())
56 pdf_begin_obj(pdf, r->num, OBJSTM_NEVER);
57 else
58 pdf_begin_obj(pdf, r->num, 2);
59 copyObject(pdf, pdf_doc, &obj1);
60 - obj1.free();
61 pdf_end_obj(pdf);
62 n = r->next;
63 delete r;
64 @@ -736,7 +733,7 @@ void write_epdf(PDF pdf, image_dict * idict, int suppress_optional_info)
65 catalog = doc->getCatalog();
66 page = catalog->getPage(img_pagenum(idict));
67 pageref = catalog->getPageRef(img_pagenum(idict));
68 - doc->getXRef()->fetch(pageref->num, pageref->gen, &pageobj);
69 + pageobj = doc->getXRef()->fetch(pageref->num, pageref->gen);
70 pageDict = pageobj.getDict();
71 /* write the Page header */
72 pdf_begin_obj(pdf, img_objnum(idict), OBJSTM_NEVER);
73 @@ -753,12 +750,11 @@ void write_epdf(PDF pdf, image_dict * idict, int suppress_optional_info)
74 pdf_dict_add_int(pdf, "PTEX.PageNumber", (int) img_pagenum(idict));
75 }
76 if ((suppress_optional_info & 8) == 0) {
77 - doc->getDocInfoNF(&obj1);
78 + obj1 = doc->getDocInfoNF();
79 if (obj1.isRef()) {
80 /* the info dict must be indirect (PDF Ref p. 61) */
81 pdf_dict_add_ref(pdf, "PTEX.InfoDict", addInObj(pdf, pdf_doc, obj1.getRef()));
82 }
83 - obj1.free();
84 }
85 if (img_is_bbox(idict)) {
86 bbox[0] = sp2bp(img_bbox(idict)[0]);
87 @@ -784,19 +780,17 @@ void write_epdf(PDF pdf, image_dict * idict, int suppress_optional_info)
88 Now all relevant parts of the Page dictionary are copied. Metadata validity
89 check is needed(as a stream it must be indirect).
90 */
91 - pageDict->lookupNF("Metadata", &obj1);
92 + obj1 = pageDict->lookupNF("Metadata");
93 if (!obj1.isNull() && !obj1.isRef())
94 formatted_warning("pdf inclusion","/Metadata must be indirect object");
95 - obj1.free();
96 /* copy selected items in Page dictionary */
97 for (i = 0; pagedictkeys[i] != NULL; i++) {
98 - pageDict->lookupNF(pagedictkeys[i], &obj1);
99 + obj1 = pageDict->lookupNF(pagedictkeys[i]);
100 if (!obj1.isNull()) {
101 pdf_add_name(pdf, pagedictkeys[i]);
102 /* preserves indirection */
103 copyObject(pdf, pdf_doc, &obj1);
104 }
105 - obj1.free();
106 }
107 /*
108 If there are no Resources in the Page dict of the embedded page,
109 @@ -804,32 +798,28 @@ void write_epdf(PDF pdf, image_dict * idict, int suppress_optional_info)
110 PDF file, climbing up the tree until the Resources are found.
111 (This fixes a problem with Scribus 1.3.3.14.)
112 */
113 - pageDict->lookupNF("Resources", &obj1);
114 + obj1 = pageDict->lookupNF("Resources");
115 if (obj1.isNull()) {
116 op1 = &pagesobj1;
117 op2 = &pagesobj2;
118 - pageDict->lookup("Parent", op1);
119 + *op1 = pageDict->lookup("Parent");
120 while (op1->isDict()) {
121 - obj1.free();
122 - op1->dictLookupNF("Resources", &obj1);
123 + obj1 = op1->dictLookupNF("Resources");
124 if (!obj1.isNull()) {
125 pdf_add_name(pdf, "Resources");
126 copyObject(pdf, pdf_doc, &obj1);
127 break;
128 }
129 - op1->dictLookup("Parent", op2);
130 + *op2 = op1->dictLookup("Parent");
131 optmp = op1;
132 op1 = op2;
133 op2 = optmp;
134 - op2->free();
135 };
136 if (!op1->isDict())
137 formatted_warning("pdf inclusion","Page /Resources missing");
138 - op1->free();
139 }
140 - obj1.free();
141 /* Write the Page contents. */
142 - page->getContents(&contents);
143 + contents = page->getContents();
144 if (contents.isStream()) {
145 /*
146 Variant A: get stream and recompress under control of \pdfcompresslevel
147 @@ -840,27 +830,23 @@ void write_epdf(PDF pdf, image_dict * idict, int suppress_optional_info)
148
149 Variant B: copy stream without recompressing
150 */
151 - contents.streamGetDict()->lookup("F", &obj1);
152 + obj1 = contents.streamGetDict()->lookup("F");
153 if (!obj1.isNull()) {
154 normal_error("pdf inclusion","unsupported external stream");
155 }
156 - obj1.free();
157 - contents.streamGetDict()->lookup("Length", &obj1);
158 + obj1 = contents.streamGetDict()->lookup("Length");
159 pdf_add_name(pdf, "Length");
160 copyObject(pdf, pdf_doc, &obj1);
161 - obj1.free();
162 - contents.streamGetDict()->lookup("Filter", &obj1);
163 + obj1 = contents.streamGetDict()->lookup("Filter");
164 if (!obj1.isNull()) {
165 pdf_add_name(pdf, "Filter");
166 copyObject(pdf, pdf_doc, &obj1);
167 - obj1.free();
168 - contents.streamGetDict()->lookup("DecodeParms", &obj1);
169 + obj1 = contents.streamGetDict()->lookup("DecodeParms");
170 if (!obj1.isNull()) {
171 pdf_add_name(pdf, "DecodeParms");
172 copyObject(pdf, pdf_doc, &obj1);
173 }
174 }
175 - obj1.free();
176 pdf_end_dict(pdf);
177 pdf_begin_stream(pdf);
178 copyStreamStream(pdf, contents.getStream()->getUndecodedStream());
179 @@ -871,8 +857,7 @@ void write_epdf(PDF pdf, image_dict * idict, int suppress_optional_info)
180 pdf_end_dict(pdf);
181 pdf_begin_stream(pdf);
182 for (i = 0, l = contents.arrayGetLength(); i < l; ++i) {
183 - copyStreamStream(pdf, (contents.arrayGet(i, &obj1))->getStream());
184 - obj1.free();
185 + copyStreamStream(pdf, (obj1 = contents.arrayGet(i)).getStream());
186 if (i < (l - 1)) {
187 /*
188 Put a space between streams to be on the safe side (streams
189 @@ -893,8 +878,6 @@ void write_epdf(PDF pdf, image_dict * idict, int suppress_optional_info)
190 }
191 /* write out all indirect objects */
192 writeRefs(pdf, pdf_doc);
193 - contents.free();
194 - pageobj.free();
195 /*
196 unrefPdfDocument() must come after contents.free() and pageobj.free()!
197 TH: The next line makes repeated pdf inclusion unacceptably slow
198 diff --git a/source/texk/web2c/luatexdir/lua/lepdflib.cc b/source/texk/web2c/luatexdir/lua/lepdflib.cc
199 index 00e2786..8d7005b 100644
200 --- a/source/texk/web2c/luatexdir/lua/lepdflib.cc
201 +++ b/source/texk/web2c/luatexdir/lua/lepdflib.cc
202 @@ -538,7 +538,7 @@ static int m_##in##_##function(lua_State * L) \
203 pdfdoc_changed_error(L); \
204 uout = new_Object_userdata(L); \
205 uout->d = new Object(); \
206 - ((in *) uin->d)->function((Object *) uout->d); \
207 + *((Object *) uout->d) = ((in *) uin->d)->function(); \
208 uout->atype = ALLOC_LEPDF; \
209 uout->pc = uin->pc; \
210 uout->pd = uin->pd; \
211 @@ -668,25 +668,13 @@ static const struct luaL_Reg Annots_m[] = {
212
213 static int m_Array_incRef(lua_State * L)
214 {
215 - int i;
216 - udstruct *uin;
217 - uin = (udstruct *) luaL_checkudata(L, 1, M_Array);
218 - if (uin->pd != NULL && uin->pd->pc != uin->pc)
219 - pdfdoc_changed_error(L);
220 - i = ((Array *) uin->d)->incRef();
221 - lua_pushinteger(L, i);
222 + lua_pushinteger(L, 1);
223 return 1;
224 }
225
226 static int m_Array_decRef(lua_State * L)
227 {
228 - int i;
229 - udstruct *uin;
230 - uin = (udstruct *) luaL_checkudata(L, 1, M_Array);
231 - if (uin->pd != NULL && uin->pd->pc != uin->pc)
232 - pdfdoc_changed_error(L);
233 - i = ((Array *) uin->d)->decRef();
234 - lua_pushinteger(L, i);
235 + lua_pushinteger(L, 1);
236 return 1;
237 }
238
239 @@ -702,7 +690,7 @@ static int m_Array_add(lua_State * L)
240 if ((uin->pd != NULL && uin->pd->pc != uin->pc)
241 || (uobj->pd != NULL && uobj->pd->pc != uobj->pc))
242 pdfdoc_changed_error(L);
243 - ((Array *) uin->d)->add(((Object *) uobj->d));
244 + ((Array *) uin->d)->add(std::move(*((Object *) uobj->d)));
245 return 0;
246 }
247
248 @@ -718,7 +706,7 @@ static int m_Array_get(lua_State * L)
249 if (i > 0 && i <= len) {
250 uout = new_Object_userdata(L);
251 uout->d = new Object();
252 - ((Array *) uin->d)->get(i - 1, (Object *) uout->d);
253 + *((Object *) uout->d) = ((Array *) uin->d)->get(i - 1);
254 uout->atype = ALLOC_LEPDF;
255 uout->pc = uin->pc;
256 uout->pd = uin->pd;
257 @@ -739,7 +727,7 @@ static int m_Array_getNF(lua_State * L)
258 if (i > 0 && i <= len) {
259 uout = new_Object_userdata(L);
260 uout->d = new Object();
261 - ((Array *) uin->d)->getNF(i - 1, (Object *) uout->d);
262 + *((Object *) uout->d) = ((Array *) uin->d)->getNF(i - 1);
263 uout->atype = ALLOC_LEPDF;
264 uout->pc = uin->pc;
265 uout->pd = uin->pd;
266 @@ -953,25 +941,13 @@ static const struct luaL_Reg Catalog_m[] = {
267
268 static int m_Dict_incRef(lua_State * L)
269 {
270 - int i;
271 - udstruct *uin;
272 - uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
273 - if (uin->pd != NULL && uin->pd->pc != uin->pc)
274 - pdfdoc_changed_error(L);
275 - i = ((Dict *) uin->d)->incRef();
276 - lua_pushinteger(L, i);
277 + lua_pushinteger(L, 1);
278 return 1;
279 }
280
281 static int m_Dict_decRef(lua_State * L)
282 {
283 - int i;
284 - udstruct *uin;
285 - uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
286 - if (uin->pd != NULL && uin->pd->pc != uin->pc)
287 - pdfdoc_changed_error(L);
288 - i = ((Dict *) uin->d)->decRef();
289 - lua_pushinteger(L, i);
290 + lua_pushinteger(L, 1);
291 return 1;
292 }
293
294 @@ -986,7 +962,7 @@ static int m_Dict_add(lua_State * L)
295 pdfdoc_changed_error(L);
296 s = copyString(luaL_checkstring(L, 2));
297 uobj = (udstruct *) luaL_checkudata(L, 3, M_Object);
298 - ((Dict *) uin->d)->add(s, ((Object *) uobj->d));
299 + ((Dict *) uin->d)->add(s, std::move(*((Object *) uobj->d)));
300 return 0;
301 }
302
303 @@ -999,7 +975,7 @@ static int m_Dict_set(lua_State * L)
304 pdfdoc_changed_error(L);
305 s = luaL_checkstring(L, 2);
306 uobj = (udstruct *) luaL_checkudata(L, 3, M_Object);
307 - ((Dict *) uin->d)->set(s, ((Object *) uobj->d));
308 + ((Dict *) uin->d)->set(s, std::move(*((Object *) uobj->d)));
309 return 0;
310 }
311
312 @@ -1027,7 +1003,7 @@ static int m_Dict_lookup(lua_State * L)
313 s = luaL_checkstring(L, 2);
314 uout = new_Object_userdata(L);
315 uout->d = new Object();
316 - ((Dict *) uin->d)->lookup(s, (Object *) uout->d);
317 + *((Object *) uout->d) = ((Dict *) uin->d)->lookup(s);
318 uout->atype = ALLOC_LEPDF;
319 uout->pc = uin->pc;
320 uout->pd = uin->pd;
321 @@ -1044,7 +1020,7 @@ static int m_Dict_lookupNF(lua_State * L)
322 s = luaL_checkstring(L, 2);
323 uout = new_Object_userdata(L);
324 uout->d = new Object();
325 - ((Dict *) uin->d)->lookupNF(s, (Object *) uout->d);
326 + *((Object *) uout->d) = ((Dict *) uin->d)->lookupNF(s);
327 uout->atype = ALLOC_LEPDF;
328 uout->pc = uin->pc;
329 uout->pd = uin->pd;
330 @@ -1096,7 +1072,7 @@ static int m_Dict_getVal(lua_State * L)
331 if (i > 0 && i <= len) {
332 uout = new_Object_userdata(L);
333 uout->d = new Object();
334 - ((Dict *) uin->d)->getVal(i - 1, (Object *) uout->d);
335 + *((Object *) uout->d) = ((Dict *) uin->d)->getVal(i - 1);
336 uout->atype = ALLOC_LEPDF;
337 uout->pc = uin->pc;
338 uout->pd = uin->pd;
339 @@ -1117,7 +1093,7 @@ static int m_Dict_getValNF(lua_State * L)
340 if (i > 0 && i <= len) {
341 uout = new_Object_userdata(L);
342 uout->d = new Object();
343 - ((Dict *) uin->d)->getValNF(i - 1, (Object *) uout->d);
344 + *((Object *) uout->d) = ((Dict *) uin->d)->getValNF(i - 1);
345 uout->atype = ALLOC_LEPDF;
346 uout->pc = uin->pc;
347 uout->pd = uin->pd;
348 @@ -1381,9 +1357,9 @@ static int m_Object_initBool(lua_State * L)
349 pdfdoc_changed_error(L);
350 luaL_checktype(L, 2, LUA_TBOOLEAN);
351 if (lua_toboolean(L, 2) != 0)
352 - ((Object *) uin->d)->initBool(gTrue);
353 + *((Object *) uin->d) = Object(gTrue);
354 else
355 - ((Object *) uin->d)->initBool(gFalse);
356 + *((Object *) uin->d) = Object(gFalse);
357 return 0;
358 }
359
360 @@ -1395,7 +1371,7 @@ static int m_Object_initInt(lua_State * L)
361 if (uin->pd != NULL && uin->pd->pc != uin->pc)
362 pdfdoc_changed_error(L);
363 i = luaL_checkint(L, 2);
364 - ((Object *) uin->d)->initInt(i);
365 + *((Object *) uin->d) = Object(i);
366 return 0;
367 }
368
369 @@ -1407,7 +1383,7 @@ static int m_Object_initReal(lua_State * L)
370 if (uin->pd != NULL && uin->pd->pc != uin->pc)
371 pdfdoc_changed_error(L);
372 d = luaL_checknumber(L, 2);
373 - ((Object *) uin->d)->initReal(d);
374 + *((Object *) uin->d) = Object(d);
375 return 0;
376 }
377
378 @@ -1422,7 +1398,7 @@ static int m_Object_initString(lua_State * L)
379 pdfdoc_changed_error(L);
380 s = luaL_checklstring(L, 2, &len);
381 gs = new GooString(s, len);
382 - ((Object *) uin->d)->initString(gs);
383 + *((Object *) uin->d) = Object(gs);
384 return 0;
385 }
386
387 @@ -1434,7 +1410,7 @@ static int m_Object_initName(lua_State * L)
388 if (uin->pd != NULL && uin->pd->pc != uin->pc)
389 pdfdoc_changed_error(L);
390 s = luaL_checkstring(L, 2);
391 - ((Object *) uin->d)->initName(s);
392 + *((Object *) uin->d) = Object(objName, s);
393 return 0;
394 }
395
396 @@ -1444,7 +1420,7 @@ static int m_Object_initNull(lua_State * L)
397 uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
398 if (uin->pd != NULL && uin->pd->pc != uin->pc)
399 pdfdoc_changed_error(L);
400 - ((Object *) uin->d)->initNull();
401 + *((Object *) uin->d) = Object();
402 return 0;
403 }
404
405 @@ -1458,7 +1434,7 @@ static int m_Object_initArray(lua_State * L)
406 if ((uin->pd != NULL && uin->pd->pc != uin->pc)
407 || (uxref->pd != NULL && uxref->pd->pc != uxref->pc))
408 pdfdoc_changed_error(L);
409 - ((Object *) uin->d)->initArray((XRef *) uxref->d);
410 + *((Object *) uin->d) = Object(new Array((XRef *) uxref->d));
411 return 0;
412 }
413
414 @@ -1476,7 +1452,7 @@ static int m_Object_initDict(lua_State * L)
415 if ((uin->pd != NULL && uin->pd->pc != uin->pc)
416 || (uxref->pd != NULL && uxref->pd->pc != uxref->pc))
417 pdfdoc_changed_error(L);
418 - ((Object *) uin->d)->initDict((XRef *) uxref->d);
419 + *((Object *) uin->d) = Object(new Dict((XRef *) uxref->d));
420 return 0;
421 }
422
423 @@ -1490,7 +1466,7 @@ static int m_Object_initStream(lua_State * L)
424 if ((uin->pd != NULL && uin->pd->pc != uin->pc)
425 || (ustream->pd != NULL && ustream->pd->pc != ustream->pc))
426 pdfdoc_changed_error(L);
427 - ((Object *) uin->d)->initStream((Stream *) ustream->d);
428 + *((Object *) uin->d) = Object((Stream *) ustream->d);
429 return 0;
430 }
431
432 @@ -1503,7 +1479,7 @@ static int m_Object_initRef(lua_State * L)
433 pdfdoc_changed_error(L);
434 num = luaL_checkint(L, 2);
435 gen = luaL_checkint(L, 3);
436 - ((Object *) uin->d)->initRef(num, gen);
437 + *((Object *) uin->d) = Object(num, gen);
438 return 0;
439 }
440
441 @@ -1515,7 +1491,7 @@ static int m_Object_initCmd(lua_State * L)
442 if (uin->pd != NULL && uin->pd->pc != uin->pc)
443 pdfdoc_changed_error(L);
444 s = luaL_checkstring(L, 2);
445 - ((Object *) uin->d)->initCmd(CHARP_CAST s);
446 + *((Object *) uin->d) = Object(objCmd, CHARP_CAST s);
447 return 0;
448 }
449
450 @@ -1525,7 +1501,7 @@ static int m_Object_initError(lua_State * L)
451 uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
452 if (uin->pd != NULL && uin->pd->pc != uin->pc)
453 pdfdoc_changed_error(L);
454 - ((Object *) uin->d)->initError();
455 + *((Object *) uin->d) = Object(objError);
456 return 0;
457 }
458
459 @@ -1535,7 +1511,7 @@ static int m_Object_initEOF(lua_State * L)
460 uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
461 if (uin->pd != NULL && uin->pd->pc != uin->pc)
462 pdfdoc_changed_error(L);
463 - ((Object *) uin->d)->initEOF();
464 + *((Object *) uin->d) = Object(objEOF);
465 return 0;
466 }
467
468 @@ -1551,7 +1527,7 @@ static int m_Object_fetch(lua_State * L)
469 pdfdoc_changed_error(L);
470 uout = new_Object_userdata(L);
471 uout->d = new Object();
472 - ((Object *) uin->d)->fetch((XRef *) uxref->d, (Object *) uout->d);
473 + *((Object *) uout->d) = ((Object *) uin->d)->fetch((XRef *) uxref->d);
474 uout->atype = ALLOC_LEPDF;
475 uout->pc = uin->pc;
476 uout->pd = uin->pd;
477 @@ -1816,7 +1792,7 @@ static int m_Object_arrayAdd(lua_State * L)
478 pdfdoc_changed_error(L);
479 if (!((Object *) uin->d)->isArray())
480 luaL_error(L, "Object is not an Array");
481 - ((Object *) uin->d)->arrayAdd((Object *) uobj->d);
482 + ((Object *) uin->d)->arrayAdd(std::move(*((Object *) uobj->d)));
483 return 0;
484 }
485
486 @@ -1833,7 +1809,7 @@ static int m_Object_arrayGet(lua_State * L)
487 if (i > 0 && i <= len) {
488 uout = new_Object_userdata(L);
489 uout->d = new Object();
490 - ((Object *) uin->d)->arrayGet(i - 1, (Object *) uout->d);
491 + *((Object *) uout->d) = ((Object *) uin->d)->arrayGet(i - 1);
492 uout->atype = ALLOC_LEPDF;
493 uout->pc = uin->pc;
494 uout->pd = uin->pd;
495 @@ -1857,7 +1833,7 @@ static int m_Object_arrayGetNF(lua_State * L)
496 if (i > 0 && i <= len) {
497 uout = new_Object_userdata(L);
498 uout->d = new Object();
499 - ((Object *) uin->d)->arrayGetNF(i - 1, (Object *) uout->d);
500 + *((Object *) uout->d) = ((Object *) uin->d)->arrayGetNF(i - 1);
501 uout->atype = ALLOC_LEPDF;
502 uout->pc = uin->pc;
503 uout->pd = uin->pd;
504 @@ -1897,7 +1873,7 @@ static int m_Object_dictAdd(lua_State * L)
505 pdfdoc_changed_error(L);
506 if (!((Object *) uin->d)->isDict())
507 luaL_error(L, "Object is not a Dict");
508 - ((Object *) uin->d)->dictAdd(copyString(s), (Object *) uobj->d);
509 + ((Object *) uin->d)->dictAdd(copyString(s), std::move(*((Object *) uobj->d)));
510 return 0;
511 }
512
513 @@ -1915,7 +1891,7 @@ static int m_Object_dictSet(lua_State * L)
514 pdfdoc_changed_error(L);
515 if (!((Object *) uin->d)->isDict())
516 luaL_error(L, "Object is not a Dict");
517 - ((Object *) uin->d)->dictSet(s, (Object *) uobj->d);
518 + ((Object *) uin->d)->dictSet(s, std::move(*((Object *) uobj->d)));
519 return 0;
520 }
521
522 @@ -1930,7 +1906,7 @@ static int m_Object_dictLookup(lua_State * L)
523 if (((Object *) uin->d)->isDict()) {
524 uout = new_Object_userdata(L);
525 uout->d = new Object();
526 - ((Object *) uin->d)->dictLookup(s, (Object *) uout->d);
527 + *((Object *) uout->d) = ((Object *) uin->d)->dictLookup(s);
528 uout->atype = ALLOC_LEPDF;
529 uout->pc = uin->pc;
530 uout->pd = uin->pd;
531 @@ -1950,7 +1926,7 @@ static int m_Object_dictLookupNF(lua_State * L)
532 if (((Object *) uin->d)->isDict()) {
533 uout = new_Object_userdata(L);
534 uout->d = new Object();
535 - ((Object *) uin->d)->dictLookupNF(s, (Object *) uout->d);
536 + *((Object *) uout->d) = ((Object *) uin->d)->dictLookupNF(s);
537 uout->atype = ALLOC_LEPDF;
538 uout->pc = uin->pc;
539 uout->pd = uin->pd;
540 @@ -1991,7 +1967,7 @@ static int m_Object_dictGetVal(lua_State * L)
541 if (i > 0 && i <= len) {
542 uout = new_Object_userdata(L);
543 uout->d = new Object();
544 - ((Object *) uin->d)->dictGetVal(i - 1, (Object *) uout->d);
545 + *((Object *) uout->d) = ((Object *) uin->d)->dictGetVal(i - 1);
546 uout->atype = ALLOC_LEPDF;
547 uout->pc = uin->pc;
548 uout->pd = uin->pd;
549 @@ -2015,7 +1991,7 @@ static int m_Object_dictGetValNF(lua_State * L)
550 if (i > 0 && i <= len) {
551 uout = new_Object_userdata(L);
552 uout->d = new Object();
553 - ((Object *) uin->d)->dictGetValNF(i - 1, (Object *) uout->d);
554 + *((Object *) uout->d) = ((Object *) uin->d)->dictGetValNF(i - 1);
555 uout->atype = ALLOC_LEPDF;
556 uout->pc = uin->pc;
557 uout->pd = uin->pd;
558 @@ -2243,7 +2219,7 @@ m_poppler_get_poppler(Page, Stream, getMetadata);
559 m_poppler_get_poppler(Page, Dict, getPieceInfo);
560 m_poppler_get_poppler(Page, Dict, getSeparationInfo);
561 m_poppler_get_poppler(Page, Dict, getResourceDict);
562 -m_poppler_get_OBJECT(Page, getAnnots);
563 +m_poppler_get_OBJECT(Page, getAnnotsObject);
564
565 m_poppler_get_OBJECT(Page, getContents);
566
567 @@ -2270,7 +2246,7 @@ static const struct luaL_Reg Page_m[] = {
568 {"getPieceInfo", m_Page_getPieceInfo},
569 {"getSeparationInfo", m_Page_getSeparationInfo},
570 {"getResourceDict", m_Page_getResourceDict},
571 - {"getAnnots", m_Page_getAnnots},
572 + {"getAnnots", m_Page_getAnnotsObject},
573 {"getContents", m_Page_getContents},
574 {"__tostring", m_Page__tostring},
575 {NULL, NULL} // sentinel
576 @@ -2520,7 +2496,7 @@ static int m_PDFDoc_getDocInfo(lua_State * L)
577 if (((PdfDocument *) uin->d)->doc->getXRef()->isOk()) {
578 uout = new_Object_userdata(L);
579 uout->d = new Object();
580 - ((PdfDocument *) uin->d)->doc->getDocInfo((Object *) uout->d);
581 + *((Object *) uout->d) = ((PdfDocument *) uin->d)->doc->getDocInfo();
582 uout->atype = ALLOC_LEPDF;
583 uout->pc = uin->pc;
584 uout->pd = uin->pd;
585 @@ -2538,7 +2514,7 @@ static int m_PDFDoc_getDocInfoNF(lua_State * L)
586 if (((PdfDocument *) uin->d)->doc->getXRef()->isOk()) {
587 uout = new_Object_userdata(L);
588 uout->d = new Object();
589 - ((PdfDocument *) uin->d)->doc->getDocInfoNF((Object *) uout->d);
590 + *((Object *) uout->d) = ((PdfDocument *) uin->d)->doc->getDocInfoNF();
591 uout->atype = ALLOC_LEPDF;
592 uout->pc = uin->pc;
593 uout->pd = uin->pd;
594 @@ -2841,7 +2817,7 @@ static int m_Attribute_getValue(lua_State * L)
595 uout = new_Object_userdata(L);
596 uout->d = new Object();
597 origin = (Object *) (((Attribute *) uin->d)->getValue());
598 - origin->copy ( ((Object *)uout->d) );
599 + *((Object *)uout->d) = origin->copy();
600 uout->atype = ALLOC_LEPDF;
601 uout->pc = uin->pc;
602 uout->pd = uin->pd;
603 @@ -3320,7 +3296,7 @@ static int m_StructTreeRoot_findParentElement(lua_State * L)
604 parent = root->findParentElement(i-1);
605 if (parent != NULL) {
606 uout = new_StructElement_userdata(L);
607 - uout->d = new StructElement( *parent );
608 + uout->d = (StructElement *) parent;
609 uout->atype = ALLOC_LEPDF;
610 uout->pc = uin->pc;
611 uout->pd = uin->pd;
612 @@ -3370,7 +3346,7 @@ static int m_XRef_fetch(lua_State * L)
613 gen = luaL_checkint(L, 3);
614 uout = new_Object_userdata(L);
615 uout->d = new Object();
616 - ((XRef *) uin->d)->fetch(num, gen, (Object *) uout->d);
617 + *((Object *) uout->d) = ((XRef *) uin->d)->fetch(num, gen);
618 uout->atype = ALLOC_LEPDF;
619 uout->pc = uin->pc;
620 uout->pd = uin->pd;
621 diff --git a/source/texk/web2c/luatexdir/lua/lpdfscannerlib.cc b/source/texk/web2c/luatexdir/lua/lpdfscannerlib.cc
622 index cc311da..f36c556 100644
623 --- a/source/texk/web2c/luatexdir/lua/lpdfscannerlib.cc
624 +++ b/source/texk/web2c/luatexdir/lua/lpdfscannerlib.cc
625 @@ -634,7 +634,7 @@ static int scanner_scan(lua_State * L)
626 int i;
627 for (i=0;i<count;i++) {
628 Object *val = new Object();
629 - arrayref->get(i, val);
630 + *val = arrayref->get(i);
631 if (val->isStream()) {
632 ObjectList *rover = self->_streams;
633 ObjectList *item = (ObjectList *)priv_xmalloc (sizeof(ObjectList));
634 diff --git a/source/texk/web2c/pdftexdir/pdftoepdf.cc b/source/texk/web2c/pdftexdir/pdftoepdf.cc
635 index 253024f..5b3d7b4 100644
636 --- a/source/texk/web2c/pdftexdir/pdftoepdf.cc
637 +++ b/source/texk/web2c/pdftexdir/pdftoepdf.cc
638 @@ -83,31 +83,6 @@ extern integer getpdfsuppressptexinfo(void);
639 #define MASK_SUPPRESS_PTEX_PAGENUMBER 0x04
640 #define MASK_SUPPRESS_PTEX_INFODICT 0x08
641
642 -// PdfObject encapsulates the xpdf Object type,
643 -// and properly frees its resources on destruction.
644 -// Use obj-> to access members of the Object,
645 -// and &obj to get a pointer to the object.
646 -// It is no longer necessary to call Object::free explicitely.
647 -
648 -class PdfObject {
649 - public:
650 - PdfObject() { // nothing
651 - } ~PdfObject() {
652 - iObject.free();
653 - }
654 - Object *operator->() {
655 - return &iObject;
656 - }
657 - Object *operator&() {
658 - return &iObject;
659 - }
660 - private: // no copying or assigning
661 - PdfObject(const PdfObject &);
662 - void operator=(const PdfObject &);
663 - public:
664 - Object iObject;
665 -};
666 -
667 // When copying the Resources of the selected page, all objects are copied
668 // recusively top-down. Indirect objects however are not fetched during
669 // copying, but get a new object number from pdfTeX and then will be
670 @@ -214,12 +189,12 @@ static void delete_document(PdfDocument * pdf_doc)
671 // Replacement for
672 // Object *initDict(Dict *dict1){ initObj(objDict); dict = dict1; return this; }
673
674 -static void initDictFromDict(PdfObject & obj, Dict * dict)
675 +static void initDictFromDict(Object & obj, Dict * dict)
676 {
677 - obj->initDict(xref);
678 + obj = Object(new Dict(xref));
679 for (int i = 0, l = dict->getLength(); i < l; i++) {
680 Object obj1;
681 - obj->dictAdd(copyString(dict->getKey(i)), dict->getValNF(i, &obj1));
682 + obj.dictAdd(copyString(dict->getKey(i)), dict->getValNF(i));
683 }
684 }
685
686 @@ -319,10 +294,10 @@ static void copyName(char *s)
687
688 static void copyDictEntry(Object * obj, int i)
689 {
690 - PdfObject obj1;
691 + Object obj1;
692 copyName(obj->dictGetKey(i));
693 pdf_puts(" ");
694 - obj->dictGetValNF(i, &obj1);
695 + obj1 = obj->dictGetValNF(i);
696 copyObject(&obj1);
697 pdf_puts("\n");
698 }
699 @@ -375,17 +350,17 @@ static void copyStream(Stream * str)
700 static void copyProcSet(Object * obj)
701 {
702 int i, l;
703 - PdfObject procset;
704 + Object procset;
705 if (!obj->isArray())
706 pdftex_fail("PDF inclusion: invalid ProcSet array type <%s>",
707 obj->getTypeName());
708 pdf_puts("/ProcSet [ ");
709 for (i = 0, l = obj->arrayGetLength(); i < l; ++i) {
710 - obj->arrayGetNF(i, &procset);
711 - if (!procset->isName())
712 + procset = obj->arrayGetNF(i);
713 + if (!procset.isName())
714 pdftex_fail("PDF inclusion: invalid ProcSet entry type <%s>",
715 - procset->getTypeName());
716 - copyName(procset->getName());
717 + procset.getTypeName());
718 + copyName(procset.getName());
719 pdf_puts(" ");
720 }
721 pdf_puts("]\n");
722 @@ -395,7 +370,7 @@ static void copyProcSet(Object * obj)
723
724 static void copyFont(char *tag, Object * fontRef)
725 {
726 - PdfObject fontdict, subtype, basefont, fontdescRef, fontdesc, charset,
727 + Object fontdict, subtype, basefont, fontdescRef, fontdesc, charset,
728 fontfile, ffsubtype, stemV;
729 GfxFont *gfont;
730 fd_entry *fd;
731 @@ -388,33 +388,32 @@
732 }
733 // Only handle included Type1 (and Type1C) fonts; anything else will be copied.
734 // Type1C fonts are replaced by Type1 fonts, if REPLACE_TYPE1C is true.
735 - if (!fixedinclusioncopyfont && fontRef->fetch(xref, &fontdict)->isDict()
736 - && fontdict->dictLookup("Subtype", &subtype)->isName()
737 - && !strcmp(subtype->getName(), "Type1")
738 - && fontdict->dictLookup("BaseFont", &basefont)->isName()
739 - && fontdict->dictLookupNF("FontDescriptor", &fontdescRef)->isRef()
740 - && fontdescRef->fetch(xref, &fontdesc)->isDict()
741 - && (fontdesc->dictLookup("FontFile", &fontfile)->isStream()
742 + if (!fixedinclusioncopyfont && (fontdict = fontRef->fetch(xref)).isDict()
743 + && (subtype = fontdict.dictLookup("Subtype")).isName()
744 + && !strcmp(subtype.getName(), "Type1")
745 + && (basefont = fontdict.dictLookup("BaseFont")).isName()
746 + && (fontdescRef = fontdict.dictLookupNF("FontDescriptor")).isRef()
747 + && (fontdesc = fontdescRef.fetch(xref)).isDict()
748 + && (fontfile = fontdesc.dictLookup("FontFile")).isStream()
749 || (REPLACE_TYPE1C
750 - && fontdesc->dictLookup("FontFile3", &fontfile)->isStream()
751 - && fontfile->streamGetDict()->lookup("Subtype",
752 - &ffsubtype)->isName()
753 - && !strcmp(ffsubtype->getName(), "Type1C")))
754 - && (fontmap = lookup_fontmap(basefont->getName())) != NULL) {
755 + && (fontfile = fontdesc.dictLookup("FontFile3")).isStream()
756 + && (ffsubtype = fontfile.streamGetDict()->lookup("Subtype")).isName()
757 + && !strcmp(ffsubtype.getName(), "Type1C")))
758 + && (fontmap = lookup_fontmap(basefont.getName())) != NULL) {
759 // round /StemV value, since the PDF input is a float
760 // (see Font Descriptors in PDF reference), but we only store an
761 // integer, since we don't want to change the struct.
762 - fontdesc->dictLookup("StemV", &stemV);
763 - fd = epdf_create_fontdescriptor(fontmap, zround(stemV->getNum()));
764 - if (fontdesc->dictLookup("CharSet", &charset) &&
765 - charset->isString() && is_subsetable(fontmap))
766 - epdf_mark_glyphs(fd, charset->getString()->getCString());
767 + stemV = fontdesc.dictLookup("StemV");
768 + fd = epdf_create_fontdescriptor(fontmap, zround(stemV.getNum()));
769 + if (!(charset = fontdesc.dictLookup("CharSet")).isNull() &&
770 + charset.isString() && is_subsetable(fontmap))
771 + epdf_mark_glyphs(fd, charset.getString()->getCString());
772 else
773 embed_whole_font(fd);
774 - addFontDesc(fontdescRef->getRef(), fd);
775 + addFontDesc(fontdescRef.getRef(), fd);
776 copyName(tag);
777 gfont = GfxFont::makeFont(xref, tag, fontRef->getRef(),
778 - fontdict->getDict());
779 + fontdict.getDict());
780 pdf_printf(" %d 0 R ", addFont(fontRef->getRef(), fd,
781 addEncoding(gfont)));
782 } else {
783 @@ -448,24 +422,24 @@ static void copyFont(char *tag, Object * fontRef)
784
785 static void copyFontResources(Object * obj)
786 {
787 - PdfObject fontRef;
788 + Object fontRef;
789 int i, l;
790 if (!obj->isDict())
791 pdftex_fail("PDF inclusion: invalid font resources dict type <%s>",
792 obj->getTypeName());
793 pdf_puts("/Font << ");
794 for (i = 0, l = obj->dictGetLength(); i < l; ++i) {
795 - obj->dictGetValNF(i, &fontRef);
796 - if (fontRef->isRef())
797 + fontRef = obj->dictGetValNF(i);
798 + if (fontRef.isRef())
799 copyFont(obj->dictGetKey(i), &fontRef);
800 - else if (fontRef->isDict()) { // some programs generate pdf with embedded font object
801 + else if (fontRef.isDict()) { // some programs generate pdf with embedded font object
802 copyName(obj->dictGetKey(i));
803 pdf_puts(" ");
804 copyObject(&fontRef);
805 }
806 else
807 pdftex_fail("PDF inclusion: invalid font in reference type <%s>",
808 - fontRef->getTypeName());
809 + fontRef.getTypeName());
810 }
811 pdf_puts(">>\n");
812 }
813 @@ -554,7 +528,7 @@ static char *convertNumToPDF(double n)
814
815 static void copyObject(Object * obj)
816 {
817 - PdfObject obj1;
818 + Object obj1;
819 int i, l, c;
820 Ref ref;
821 char *p;
822 @@ -598,8 +572,8 @@ static void copyObject(Object * obj)
823 } else if (obj->isArray()) {
824 pdf_puts("[");
825 for (i = 0, l = obj->arrayGetLength(); i < l; ++i) {
826 - obj->arrayGetNF(i, &obj1);
827 - if (!obj1->isName())
828 + obj1 = obj->arrayGetNF(i);
829 + if (!obj1.isName())
830 pdf_puts(" ");
831 copyObject(&obj1);
832 }
833 @@ -637,7 +611,7 @@ static void writeRefs()
834 if (!r->written) {
835 Object obj1;
836 r->written = 1;
837 - xref->fetch(r->ref.num, r->ref.gen, &obj1);
838 + obj1 = xref->fetch(r->ref.num, r->ref.gen);
839 if (r->type == objFont) {
840 assert(!obj1.isStream());
841 pdfbeginobj(r->num, 2); // \pdfobjcompresslevel = 2 is for this
842 @@ -653,7 +627,6 @@ static void writeRefs()
843 pdf_puts("\n");
844 pdfendobj();
845 }
846 - obj1.free();
847 }
848 }
849 }
850 @@ -836,8 +809,8 @@ void write_epdf(void)
851 Page *page;
852 Ref *pageRef;
853 Dict *pageDict;
854 - PdfObject contents, obj1, obj2, pageObj, dictObj;
855 - PdfObject groupDict;
856 + Object contents, obj1, obj2, pageObj, dictObj;
857 + Object groupDict;
858 bool writeSepGroup = false;
859 Object info;
860 char *key;
861 @@ -864,8 +837,8 @@ void write_epdf(void)
862 encodingList = 0;
863 page = pdf_doc->doc->getCatalog()->getPage(epdf_selected_page);
864 pageRef = pdf_doc->doc->getCatalog()->getPageRef(epdf_selected_page);
865 - xref->fetch(pageRef->num, pageRef->gen, &pageObj);
866 - pageDict = pageObj->getDict();
867 + pageObj = xref->fetch(pageRef->num, pageRef->gen);
868 + pageDict = pageObj.getDict();
869 rotate = page->getRotate();
870 PDFRectangle *pagebox;
871 // write the Page header
872 @@ -883,7 +856,7 @@ void write_epdf(void)
873 pdf_printf("/%s.PageNumber %i\n", pdfkeyprefix, (int) epdf_selected_page);
874 }
875 if ((suppress_ptex_info & MASK_SUPPRESS_PTEX_INFODICT) == 0) {
876 - pdf_doc->doc->getDocInfoNF(&info);
877 + info = pdf_doc->doc->getDocInfoNF();
878 if (info.isRef()) {
879 // the info dict must be indirect (PDF Ref p. 61)
880 pdf_printf("/%s.InfoDict ", pdfkeyprefix);
881 @@ -939,14 +912,14 @@ void write_epdf(void)
882 pdf_puts(stripzeros(s));
883
884 // Metadata validity check (as a stream it must be indirect)
885 - pageDict->lookupNF("Metadata", &dictObj);
886 - if (!dictObj->isNull() && !dictObj->isRef())
887 + dictObj = pageDict->lookupNF("Metadata");
888 + if (!dictObj.isNull() && !dictObj.isRef())
889 pdftex_warn("PDF inclusion: /Metadata must be indirect object");
890
891 // copy selected items in Page dictionary except Resources & Group
892 for (i = 0; pageDictKeys[i] != NULL; i++) {
893 - pageDict->lookupNF(pageDictKeys[i], &dictObj);
894 - if (!dictObj->isNull()) {
895 + dictObj = pageDict->lookupNF(pageDictKeys[i]);
896 + if (!dictObj.isNull()) {
897 pdf_newline();
898 pdf_printf("/%s ", pageDictKeys[i]);
899 copyObject(&dictObj); // preserves indirection
900 @@ -954,8 +927,8 @@ void write_epdf(void)
901 }
902
903 // handle page group
904 - pageDict->lookupNF("Group", &dictObj);
905 - if (!dictObj->isNull()) {
906 + dictObj = pageDict->lookupNF("Group");
907 + if (!dictObj.isNull()) {
908 if (pdfpagegroupval == 0) {
909 // another pdf with page group was included earlier on the
910 // same page; copy the Group entry as is. See manual for
911 @@ -969,8 +942,8 @@ void write_epdf(void)
912 copyObject(&dictObj);
913 } else {
914 // write Group dict as a separate object, since the Page dict also refers to it
915 - pageDict->lookup("Group", &dictObj);
916 - if (!dictObj->isDict())
917 + dictObj = pageDict->lookup("Group");
918 + if (!dictObj.isDict())
919 pdftex_fail("PDF inclusion: /Group dict missing");
920 writeSepGroup = true;
921 initDictFromDict(groupDict, page->getGroup());
922 @@ -987,14 +960,14 @@ void write_epdf(void)
923 ("PDF inclusion: /Resources missing. 'This practice is not recommended' (PDF Ref)");
924 } else {
925 initDictFromDict(obj1, page->getResourceDict());
926 - if (!obj1->isDict())
927 + if (!obj1.isDict())
928 pdftex_fail("PDF inclusion: invalid resources dict type <%s>",
929 - obj1->getTypeName());
930 + obj1.getTypeName());
931 pdf_newline();
932 pdf_puts("/Resources <<\n");
933 - for (i = 0, l = obj1->dictGetLength(); i < l; ++i) {
934 - obj1->dictGetVal(i, &obj2);
935 - key = obj1->dictGetKey(i);
936 + for (i = 0, l = obj1.dictGetLength(); i < l; ++i) {
937 + obj2 = obj1.dictGetVal(i);
938 + key = obj1.dictGetKey(i);
939 if (strcmp("Font", key) == 0)
940 copyFontResources(&obj2);
941 else if (strcmp("ProcSet", key) == 0)
942 @@ -1006,8 +979,8 @@ void write_epdf(void)
943 }
944
945 // write the page contents
946 - page->getContents(&contents);
947 - if (contents->isStream()) {
948 + contents = page->getContents();
949 + if (contents.isStream()) {
950
951 // Variant A: get stream and recompress under control
952 // of \pdfcompresslevel
953 @@ -1018,36 +991,35 @@ void write_epdf(void)
954
955 // Variant B: copy stream without recompressing
956 //
957 - contents->streamGetDict()->lookup("F", &obj1);
958 - if (!obj1->isNull()) {
959 + obj1 = contents.streamGetDict()->lookup("F");
960 + if (!obj1.isNull()) {
961 pdftex_fail("PDF inclusion: Unsupported external stream");
962 }
963 - contents->streamGetDict()->lookup("Length", &obj1);
964 - assert(!obj1->isNull());
965 + obj1 = contents.streamGetDict()->lookup("Length");
966 + assert(!obj1.isNull());
967 pdf_puts("/Length ");
968 copyObject(&obj1);
969 pdf_puts("\n");
970 - contents->streamGetDict()->lookup("Filter", &obj1);
971 - if (!obj1->isNull()) {
972 + obj1 = contents.streamGetDict()->lookup("Filter");
973 + if (!obj1.isNull()) {
974 pdf_puts("/Filter ");
975 copyObject(&obj1);
976 pdf_puts("\n");
977 - contents->streamGetDict()->lookup("DecodeParms", &obj1);
978 - if (!obj1->isNull()) {
979 + obj1 = contents.streamGetDict()->lookup("DecodeParms");
980 + if (!obj1.isNull()) {
981 pdf_puts("/DecodeParms ");
982 copyObject(&obj1);
983 pdf_puts("\n");
984 }
985 }
986 pdf_puts(">>\nstream\n");
987 - copyStream(contents->getStream()->getUndecodedStream());
988 + copyStream(contents.getStream()->getUndecodedStream());
989 pdfendstream();
990 - } else if (contents->isArray()) {
991 + } else if (contents.isArray()) {
992 pdfbeginstream();
993 - for (i = 0, l = contents->arrayGetLength(); i < l; ++i) {
994 + for (i = 0, l = contents.arrayGetLength(); i < l; ++i) {
995 Object contentsobj;
996 - copyStream((contents->arrayGet(i, &contentsobj))->getStream());
997 - contentsobj.free();
998 + copyStream((contentsobj = contents.arrayGet(i)).getStream());
999 if (i < l - 1)
1000 pdf_newline(); // add a newline after each stream except the last
1001 }
1002 diff --git a/source/texk/web2c/pdftexdir/pdftosrc.cc b/source/texk/web2c/pdftexdir/pdftosrc.cc
1003 index 42b9e06..010b1d0 100644
1004 --- a/source/texk/web2c/pdftexdir/pdftosrc.cc
1005 +++ b/source/texk/web2c/pdftexdir/pdftosrc.cc
1006 @@ -86,22 +86,19 @@ int main(int argc, char *argv[])
1007 objgen = atoi(argv[3]);
1008 }
1009 xref = doc->getXRef();
1010 - catalogDict.initNull();
1011 - xref->getCatalog(&catalogDict);
1012 + catalogDict = xref->getCatalog();
1013 if (!catalogDict.isDict("Catalog")) {
1014 fprintf(stderr, "No Catalog found\n");
1015 exit(1);
1016 }
1017 - srcStream.initNull();
1018 if (objnum == 0) {
1019 - catalogDict.dictLookup("SourceObject", &srcStream);
1020 + srcStream = catalogDict.dictLookup("SourceObject");
1021 static char const_SourceFile[] = "SourceFile";
1022 if (!srcStream.isStream(const_SourceFile)) {
1023 fprintf(stderr, "No SourceObject found\n");
1024 exit(1);
1025 }
1026 - srcName.initNull();
1027 - srcStream.getStream()->getDict()->lookup("SourceName", &srcName);
1028 + srcName = srcStream.getStream()->getDict()->lookup("SourceName");
1029 if (!srcName.isString()) {
1030 fprintf(stderr, "No SourceName found\n");
1031 exit(1);
1032 @@ -110,7 +107,7 @@ int main(int argc, char *argv[])
1033 // We cannot free srcName, as objname shares its string.
1034 // srcName.free();
1035 } else if (objnum > 0) {
1036 - xref->fetch(objnum, objgen, &srcStream);
1037 + srcStream = xref->fetch(objnum, objgen);
1038 if (!srcStream.isStream()) {
1039 fprintf(stderr, "Not a Stream object\n");
1040 exit(1);
1041 @@ -159,29 +156,23 @@ int main(int argc, char *argv[])
1042 int localOffset = 0;
1043 Guint firstOffset;
1044
1045 - assert(xref->fetch(e->offset, 0, &objStr)->isStream());
1046 - nObjects = objStr.streamGetDict()->lookup("N", &obj1)->getInt();
1047 - obj1.free();
1048 - first = objStr.streamGetDict()->lookup("First", &obj1)->getInt();
1049 - obj1.free();
1050 + assert((objStr = xref->fetch(e->offset, 0)).isStream());
1051 + nObjects = (obj1 = objStr.streamGetDict()->lookup("N")).getInt();
1052 + first = (obj1 = objStr.streamGetDict()->lookup("First")).getInt();
1053 firstOffset = objStr.getStream()->getBaseStream()->getStart() + first;
1054
1055 // parse the header: object numbers and offsets
1056 objStr.streamReset();
1057 - obj1.initNull();
1058 - str = new EmbedStream(objStr.getStream(), &obj1, gTrue, first);
1059 + str = new EmbedStream(objStr.getStream(), Object(), gTrue, first);
1060 parser = new Parser(xref, new Lexer(xref, str), gFalse);
1061 for (n = 0; n < nObjects; ++n) {
1062 - parser->getObj(&obj1);
1063 - parser->getObj(&obj2);
1064 + obj1 = parser->getObj();
1065 + obj2 = parser->getObj();
1066 if (n == e->gen)
1067 localOffset = obj2.getInt();
1068 - obj1.free();
1069 - obj2.free();
1070 }
1071 while (str->getChar() != EOF) ;
1072 delete parser;
1073 - objStr.free();
1074
1075 fprintf(outfile, "%.10lu 00000 n\n",
1076 (long unsigned)(firstOffset + localOffset));
1077 @@ -192,7 +183,6 @@ int main(int argc, char *argv[])
1078 s->reset();
1079 while ((c = s->getChar()) != EOF)
1080 fputc(c, outfile);
1081 - srcStream.free();
1082 }
1083 if (objnum == 0)
1084 fprintf(stderr, "Source file extracted to %s\n", outname);
1085 @@ -201,7 +191,6 @@ int main(int argc, char *argv[])
1086 else
1087 fprintf(stderr, "Cross-reference table extracted to %s\n", outname);
1088 fclose(outfile);
1089 - catalogDict.free();
1090 delete doc;
1091 delete globalParams;
1092 }
1093 --
1094 2.13.5
1095

  ViewVC Help
Powered by ViewVC 1.1.26