| @@ -1,457 +1,24 @@ | | | @@ -1,457 +1,24 @@ |
1 | $NetBSD: patch-texk_web2c_luatexdir_lua_lepdflib.cc,v 1.4 2018/04/29 20:57:26 ryoon Exp $ | | 1 | $NetBSD: patch-texk_web2c_luatexdir_lua_lepdflib.cc,v 1.5 2018/05/13 12:46:27 markd Exp $ |
2 | | | 2 | |
3 | Add support for newer poppler's from ArchLinux | | 3 | Build with poppler 0.64 |
4 | | | 4 | |
5 | --- texk/web2c/luatexdir/lua/lepdflib.cc.orig 2017-03-11 01:04:06.000000000 +0000 | | 5 | --- texk/web2c/luatexdir/lua/lepdflib.cc.orig 2018-02-14 14:44:38.000000000 +0000 |
6 | +++ texk/web2c/luatexdir/lua/lepdflib.cc | | 6 | +++ texk/web2c/luatexdir/lua/lepdflib.cc |
7 | @@ -521,7 +521,7 @@ static int m_##in##_##function(lua_State | | 7 | @@ -669,7 +669,7 @@ static int m_##in##_##function(lua_State |
| | | 8 | #define m_poppler_get_GOOSTRING(in, function) \ |
| | | 9 | static int m_##in##_##function(lua_State * L) \ |
| | | 10 | { \ |
| | | 11 | - GooString *gs; \ |
| | | 12 | + const GooString *gs; \ |
| | | 13 | udstruct *uin; \ |
8 | uin = (udstruct *) luaL_checkudata(L, 1, M_##in); \ | | 14 | uin = (udstruct *) luaL_checkudata(L, 1, M_##in); \ |
9 | if (uin->pd != NULL && uin->pd->pc != uin->pc) \ | | 15 | if (uin->pd != NULL && uin->pd->pc != uin->pc) \ |
10 | pdfdoc_changed_error(L); \ | | 16 | @@ -1807,7 +1807,7 @@ static int m_Object_getNum(lua_State * L |
11 | - gs = ((in *) uin->d)->function(); \ | | | |
12 | + gs = const_cast<GooString*>(((in *) uin->d)->function()); \ | | | |
13 | if (gs != NULL) \ | | | |
14 | lua_pushlstring(L, gs->getCString(), gs->getLength()); \ | | | |
15 | else \ | | | |
16 | @@ -538,7 +538,7 @@ static int m_##in##_##function(lua_State | | | |
17 | pdfdoc_changed_error(L); \ | | | |
18 | uout = new_Object_userdata(L); \ | | | |
19 | uout->d = new Object(); \ | | | |
20 | - ((in *) uin->d)->function((Object *) uout->d); \ | | | |
21 | + *((Object *)uout->d) = ((in *) uin->d)->function(); \ | | | |
22 | uout->atype = ALLOC_LEPDF; \ | | | |
23 | uout->pc = uin->pc; \ | | | |
24 | uout->pd = uin->pd; \ | | | |
25 | @@ -668,13 +668,11 @@ static const struct luaL_Reg Annots_m[] | | | |
26 | | | 17 | |
27 | static int m_Array_incRef(lua_State * L) | | 18 | static int m_Object_getString(lua_State * L) |
28 | { | | 19 | { |
29 | - int i; | | 20 | - GooString *gs; |
| | | 21 | + const GooString *gs; |
30 | udstruct *uin; | | 22 | udstruct *uin; |
31 | uin = (udstruct *) luaL_checkudata(L, 1, M_Array); | | | |
32 | if (uin->pd != NULL && uin->pd->pc != uin->pc) | | | |
33 | pdfdoc_changed_error(L); | | | |
34 | - i = ((Array *) uin->d)->incRef(); | | | |
35 | - lua_pushinteger(L, i); | | | |
36 | + lua_pushinteger(L, 1); | | | |
37 | return 1; | | | |
38 | } | | | |
39 | | | | |
40 | @@ -685,8 +683,7 @@ static int m_Array_decRef(lua_State * L) | | | |
41 | uin = (udstruct *) luaL_checkudata(L, 1, M_Array); | | | |
42 | if (uin->pd != NULL && uin->pd->pc != uin->pc) | | | |
43 | pdfdoc_changed_error(L); | | | |
44 | - i = ((Array *) uin->d)->decRef(); | | | |
45 | - lua_pushinteger(L, i); | | | |
46 | + lua_pushinteger(L, 1); | | | |
47 | return 1; | | | |
48 | } | | | |
49 | | | | |
50 | @@ -702,7 +699,7 @@ static int m_Array_add(lua_State * L) | | | |
51 | if ((uin->pd != NULL && uin->pd->pc != uin->pc) | | | |
52 | || (uobj->pd != NULL && uobj->pd->pc != uobj->pc)) | | | |
53 | pdfdoc_changed_error(L); | | | |
54 | - ((Array *) uin->d)->add(((Object *) uobj->d)); | | | |
55 | + ((Array *) uin->d)->add(std::move(*((Object *) uobj->d))); | | | |
56 | return 0; | | | |
57 | } | | | |
58 | | | | |
59 | @@ -718,7 +715,7 @@ static int m_Array_get(lua_State * L) | | | |
60 | if (i > 0 && i <= len) { | | | |
61 | uout = new_Object_userdata(L); | | | |
62 | uout->d = new Object(); | | | |
63 | - ((Array *) uin->d)->get(i - 1, (Object *) uout->d); | | | |
64 | + *((Object *) uout->d) = ((Array *) uin->d)->get(i - 1); | | | |
65 | uout->atype = ALLOC_LEPDF; | | | |
66 | uout->pc = uin->pc; | | | |
67 | uout->pd = uin->pd; | | | |
68 | @@ -739,7 +736,7 @@ static int m_Array_getNF(lua_State * L) | | | |
69 | if (i > 0 && i <= len) { | | | |
70 | uout = new_Object_userdata(L); | | | |
71 | uout->d = new Object(); | | | |
72 | - ((Array *) uin->d)->getNF(i - 1, (Object *) uout->d); | | | |
73 | + *((Object *) uout->d) = ((Array *) uin->d)->getNF(i - 1); | | | |
74 | uout->atype = ALLOC_LEPDF; | | | |
75 | uout->pc = uin->pc; | | | |
76 | uout->pd = uin->pd; | | | |
77 | @@ -953,25 +950,21 @@ static const struct luaL_Reg Catalog_m[] | | | |
78 | | | | |
79 | static int m_Dict_incRef(lua_State * L) | | | |
80 | { | | | |
81 | - int i; | | | |
82 | udstruct *uin; | | | |
83 | uin = (udstruct *) luaL_checkudata(L, 1, M_Dict); | | | |
84 | if (uin->pd != NULL && uin->pd->pc != uin->pc) | | | |
85 | pdfdoc_changed_error(L); | | | |
86 | - i = ((Dict *) uin->d)->incRef(); | | | |
87 | - lua_pushinteger(L, i); | | | |
88 | + lua_pushinteger(L, 1); | | | |
89 | return 1; | | | |
90 | } | | | |
91 | | | | |
92 | static int m_Dict_decRef(lua_State * L) | | | |
93 | { | | | |
94 | - int i; | | | |
95 | udstruct *uin; | | | |
96 | uin = (udstruct *) luaL_checkudata(L, 1, M_Dict); | | | |
97 | if (uin->pd != NULL && uin->pd->pc != uin->pc) | | | |
98 | pdfdoc_changed_error(L); | | | |
99 | - i = ((Dict *) uin->d)->decRef(); | | | |
100 | - lua_pushinteger(L, i); | | | |
101 | + lua_pushinteger(L, 1); | | | |
102 | return 1; | | | |
103 | } | | | |
104 | | | | |
105 | @@ -986,7 +979,7 @@ static int m_Dict_add(lua_State * L) | | | |
106 | pdfdoc_changed_error(L); | | | |
107 | s = copyString(luaL_checkstring(L, 2)); | | | |
108 | uobj = (udstruct *) luaL_checkudata(L, 3, M_Object); | | | |
109 | - ((Dict *) uin->d)->add(s, ((Object *) uobj->d)); | | | |
110 | + ((Dict *) uin->d)->add(s, std::move(*((Object *) uobj->d))); | | | |
111 | return 0; | | | |
112 | } | | | |
113 | | | | |
114 | @@ -999,7 +992,7 @@ static int m_Dict_set(lua_State * L) | | | |
115 | pdfdoc_changed_error(L); | | | |
116 | s = luaL_checkstring(L, 2); | | | |
117 | uobj = (udstruct *) luaL_checkudata(L, 3, M_Object); | | | |
118 | - ((Dict *) uin->d)->set(s, ((Object *) uobj->d)); | | | |
119 | + ((Dict *) uin->d)->set(s, std::move(*((Object *) uobj->d))); | | | |
120 | return 0; | | | |
121 | } | | | |
122 | | | | |
123 | @@ -1027,7 +1020,7 @@ static int m_Dict_lookup(lua_State * L) | | | |
124 | s = luaL_checkstring(L, 2); | | | |
125 | uout = new_Object_userdata(L); | | | |
126 | uout->d = new Object(); | | | |
127 | - ((Dict *) uin->d)->lookup(s, (Object *) uout->d); | | | |
128 | + *((Object *) uout->d) = ((Dict *) uin->d)->lookup(s); | | | |
129 | uout->atype = ALLOC_LEPDF; | | | |
130 | uout->pc = uin->pc; | | | |
131 | uout->pd = uin->pd; | | | |
132 | @@ -1044,7 +1037,7 @@ static int m_Dict_lookupNF(lua_State * L | | | |
133 | s = luaL_checkstring(L, 2); | | | |
134 | uout = new_Object_userdata(L); | | | |
135 | uout->d = new Object(); | | | |
136 | - ((Dict *) uin->d)->lookupNF(s, (Object *) uout->d); | | | |
137 | + *((Object *) uout->d) = ((Dict *) uin->d)->lookupNF(s); | | | |
138 | uout->atype = ALLOC_LEPDF; | | | |
139 | uout->pc = uin->pc; | | | |
140 | uout->pd = uin->pd; | | | |
141 | @@ -1096,7 +1089,7 @@ static int m_Dict_getVal(lua_State * L) | | | |
142 | if (i > 0 && i <= len) { | | | |
143 | uout = new_Object_userdata(L); | | | |
144 | uout->d = new Object(); | | | |
145 | - ((Dict *) uin->d)->getVal(i - 1, (Object *) uout->d); | | | |
146 | + *((Object *) uout->d) = ((Dict *) uin->d)->getVal(i - 1); | | | |
147 | uout->atype = ALLOC_LEPDF; | | | |
148 | uout->pc = uin->pc; | | | |
149 | uout->pd = uin->pd; | | | |
150 | @@ -1117,7 +1110,7 @@ static int m_Dict_getValNF(lua_State * L | | | |
151 | if (i > 0 && i <= len) { | | | |
152 | uout = new_Object_userdata(L); | | | |
153 | uout->d = new Object(); | | | |
154 | - ((Dict *) uin->d)->getValNF(i - 1, (Object *) uout->d); | | | |
155 | + *((Object *) uout->d) = ((Dict *) uin->d)->getValNF(i - 1); | | | |
156 | uout->atype = ALLOC_LEPDF; | | | |
157 | uout->pc = uin->pc; | | | |
158 | uout->pd = uin->pd; | | | |
159 | @@ -1381,9 +1374,9 @@ static int m_Object_initBool(lua_State * | | | |
160 | pdfdoc_changed_error(L); | | | |
161 | luaL_checktype(L, 2, LUA_TBOOLEAN); | | | |
162 | if (lua_toboolean(L, 2) != 0) | | | |
163 | - ((Object *) uin->d)->initBool(gTrue); | | | |
164 | + *((Object *) uin->d) = Object(gTrue); | | | |
165 | else | | | |
166 | - ((Object *) uin->d)->initBool(gFalse); | | | |
167 | + *((Object *) uin->d) = Object(gFalse); | | | |
168 | return 0; | | | |
169 | } | | | |
170 | | | | |
171 | @@ -1395,7 +1388,7 @@ static int m_Object_initInt(lua_State * | | | |
172 | if (uin->pd != NULL && uin->pd->pc != uin->pc) | | | |
173 | pdfdoc_changed_error(L); | | | |
174 | i = luaL_checkint(L, 2); | | | |
175 | - ((Object *) uin->d)->initInt(i); | | | |
176 | + *((Object *) uin->d) = Object(i); | | | |
177 | return 0; | | | |
178 | } | | | |
179 | | | | |
180 | @@ -1407,7 +1400,7 @@ static int m_Object_initReal(lua_State * | | | |
181 | if (uin->pd != NULL && uin->pd->pc != uin->pc) | | | |
182 | pdfdoc_changed_error(L); | | | |
183 | d = luaL_checknumber(L, 2); | | | |
184 | - ((Object *) uin->d)->initReal(d); | | | |
185 | + *((Object *) uin->d) = Object(d); | | | |
186 | return 0; | | | |
187 | } | | | |
188 | | | | |
189 | @@ -1422,7 +1415,7 @@ static int m_Object_initString(lua_State | | | |
190 | pdfdoc_changed_error(L); | | | |
191 | s = luaL_checklstring(L, 2, &len); | | | |
192 | gs = new GooString(s, len); | | | |
193 | - ((Object *) uin->d)->initString(gs); | | | |
194 | + *((Object *) uin->d) = Object(gs); | | | |
195 | return 0; | | | |
196 | } | | | |
197 | | | | |
198 | @@ -1434,7 +1427,7 @@ static int m_Object_initName(lua_State * | | | |
199 | if (uin->pd != NULL && uin->pd->pc != uin->pc) | | | |
200 | pdfdoc_changed_error(L); | | | |
201 | s = luaL_checkstring(L, 2); | | | |
202 | - ((Object *) uin->d)->initName(s); | | | |
203 | + *((Object *) uin->d) = Object(objName, s); | | | |
204 | return 0; | | | |
205 | } | | | |
206 | | | | |
207 | @@ -1444,13 +1437,14 @@ static int m_Object_initNull(lua_State * | | | |
208 | uin = (udstruct *) luaL_checkudata(L, 1, M_Object); | | 23 | uin = (udstruct *) luaL_checkudata(L, 1, M_Object); |
209 | if (uin->pd != NULL && uin->pd->pc != uin->pc) | | 24 | if (uin->pd != NULL && uin->pd->pc != uin->pc) |
210 | pdfdoc_changed_error(L); | | | |
211 | - ((Object *) uin->d)->initNull(); | | | |
212 | + *((Object *) uin->d) = Object(objNull); | | | |
213 | return 0; | | | |
214 | } | | | |
215 | | | | |
216 | static int m_Object_initArray(lua_State * L) | | | |
217 | { | | | |
218 | udstruct *uin, *uxref; | | | |
219 | + Array *a; | | | |
220 | uin = (udstruct *) luaL_checkudata(L, 1, M_Object); | | | |
221 | uxref = (udstruct *) luaL_checkudata(L, 2, M_XRef); | | | |
222 | if (uin->pd != NULL && uxref->pd != NULL && uin->pd != uxref->pd) | | | |
223 | @@ -1458,7 +1452,8 @@ static int m_Object_initArray(lua_State | | | |
224 | if ((uin->pd != NULL && uin->pd->pc != uin->pc) | | | |
225 | || (uxref->pd != NULL && uxref->pd->pc != uxref->pc)) | | | |
226 | pdfdoc_changed_error(L); | | | |
227 | - ((Object *) uin->d)->initArray((XRef *) uxref->d); | | | |
228 | + a = new Array((XRef *) uxref->d); | | | |
229 | + *((Object *) uin->d) = Object(a); | | | |
230 | return 0; | | | |
231 | } | | | |
232 | | | | |
233 | @@ -1469,6 +1464,7 @@ static int m_Object_initArray(lua_State | | | |
234 | static int m_Object_initDict(lua_State * L) | | | |
235 | { | | | |
236 | udstruct *uin, *uxref; | | | |
237 | + Dict *d; | | | |
238 | uin = (udstruct *) luaL_checkudata(L, 1, M_Object); | | | |
239 | uxref = (udstruct *) luaL_checkudata(L, 2, M_XRef); | | | |
240 | if (uin->pd != NULL && uxref->pd != NULL && uin->pd != uxref->pd) | | | |
241 | @@ -1476,7 +1472,8 @@ static int m_Object_initDict(lua_State * | | | |
242 | if ((uin->pd != NULL && uin->pd->pc != uin->pc) | | | |
243 | || (uxref->pd != NULL && uxref->pd->pc != uxref->pc)) | | | |
244 | pdfdoc_changed_error(L); | | | |
245 | - ((Object *) uin->d)->initDict((XRef *) uxref->d); | | | |
246 | + d = new Dict((XRef *) uxref->d); | | | |
247 | + *((Object *) uin->d) = Object(d); | | | |
248 | return 0; | | | |
249 | } | | | |
250 | | | | |
251 | @@ -1490,7 +1487,7 @@ static int m_Object_initStream(lua_State | | | |
252 | if ((uin->pd != NULL && uin->pd->pc != uin->pc) | | | |
253 | || (ustream->pd != NULL && ustream->pd->pc != ustream->pc)) | | | |
254 | pdfdoc_changed_error(L); | | | |
255 | - ((Object *) uin->d)->initStream((Stream *) ustream->d); | | | |
256 | + *((Object *) uin->d) = Object((Stream *) ustream->d); | | | |
257 | return 0; | | | |
258 | } | | | |
259 | | | | |
260 | @@ -1503,7 +1500,7 @@ static int m_Object_initRef(lua_State * | | | |
261 | pdfdoc_changed_error(L); | | | |
262 | num = luaL_checkint(L, 2); | | | |
263 | gen = luaL_checkint(L, 3); | | | |
264 | - ((Object *) uin->d)->initRef(num, gen); | | | |
265 | + *((Object *) uin->d) = Object(num, gen); | | | |
266 | return 0; | | | |
267 | } | | | |
268 | | | | |
269 | @@ -1515,7 +1512,7 @@ static int m_Object_initCmd(lua_State * | | | |
270 | if (uin->pd != NULL && uin->pd->pc != uin->pc) | | | |
271 | pdfdoc_changed_error(L); | | | |
272 | s = luaL_checkstring(L, 2); | | | |
273 | - ((Object *) uin->d)->initCmd(CHARP_CAST s); | | | |
274 | + *((Object *) uin->d) = Object(objCmd, CHARP_CAST s); | | | |
275 | return 0; | | | |
276 | } | | | |
277 | | | | |
278 | @@ -1525,7 +1522,7 @@ static int m_Object_initError(lua_State | | | |
279 | uin = (udstruct *) luaL_checkudata(L, 1, M_Object); | | | |
280 | if (uin->pd != NULL && uin->pd->pc != uin->pc) | | | |
281 | pdfdoc_changed_error(L); | | | |
282 | - ((Object *) uin->d)->initError(); | | | |
283 | + *((Object *) uin->d) = Object(objError); | | | |
284 | return 0; | | | |
285 | } | | | |
286 | | | | |
287 | @@ -1535,7 +1532,7 @@ static int m_Object_initEOF(lua_State * | | | |
288 | uin = (udstruct *) luaL_checkudata(L, 1, M_Object); | | | |
289 | if (uin->pd != NULL && uin->pd->pc != uin->pc) | | | |
290 | pdfdoc_changed_error(L); | | | |
291 | - ((Object *) uin->d)->initEOF(); | | | |
292 | + *((Object *) uin->d) = Object(objEOF); | | | |
293 | return 0; | | | |
294 | } | | | |
295 | | | | |
296 | @@ -1551,7 +1548,7 @@ static int m_Object_fetch(lua_State * L) | | | |
297 | pdfdoc_changed_error(L); | | | |
298 | uout = new_Object_userdata(L); | | | |
299 | uout->d = new Object(); | | | |
300 | - ((Object *) uin->d)->fetch((XRef *) uxref->d, (Object *) uout->d); | | | |
301 | + *((Object *) uout->d) = ((Object *) uin->d)->fetch((XRef *) uxref->d); | | | |
302 | uout->atype = ALLOC_LEPDF; | | | |
303 | uout->pc = uin->pc; | | | |
304 | uout->pd = uin->pd; | | | |
305 | @@ -1659,7 +1656,7 @@ static int m_Object_getString(lua_State | | | |
306 | if (uin->pd != NULL && uin->pd->pc != uin->pc) | | | |
307 | pdfdoc_changed_error(L); | | | |
308 | if (((Object *) uin->d)->isString()) { | | | |
309 | - gs = ((Object *) uin->d)->getString(); | | | |
310 | + gs = const_cast<GooString*>(((Object *) uin->d)->getString()); | | | |
311 | lua_pushlstring(L, gs->getCString(), gs->getLength()); | | | |
312 | } else | | | |
313 | lua_pushnil(L); | | | |
314 | @@ -1816,7 +1813,7 @@ static int m_Object_arrayAdd(lua_State * | | | |
315 | pdfdoc_changed_error(L); | | | |
316 | if (!((Object *) uin->d)->isArray()) | | | |
317 | luaL_error(L, "Object is not an Array"); | | | |
318 | - ((Object *) uin->d)->arrayAdd((Object *) uobj->d); | | | |
319 | + ((Object *) uin->d)->arrayAdd(std::move(*((Object *) uobj->d))); | | | |
320 | return 0; | | | |
321 | } | | | |
322 | | | | |
323 | @@ -1833,7 +1830,7 @@ static int m_Object_arrayGet(lua_State * | | | |
324 | if (i > 0 && i <= len) { | | | |
325 | uout = new_Object_userdata(L); | | | |
326 | uout->d = new Object(); | | | |
327 | - ((Object *) uin->d)->arrayGet(i - 1, (Object *) uout->d); | | | |
328 | + *((Object *) uout->d) = ((Object *) uin->d)->arrayGet(i - 1); | | | |
329 | uout->atype = ALLOC_LEPDF; | | | |
330 | uout->pc = uin->pc; | | | |
331 | uout->pd = uin->pd; | | | |
332 | @@ -1857,7 +1854,7 @@ static int m_Object_arrayGetNF(lua_State | | | |
333 | if (i > 0 && i <= len) { | | | |
334 | uout = new_Object_userdata(L); | | | |
335 | uout->d = new Object(); | | | |
336 | - ((Object *) uin->d)->arrayGetNF(i - 1, (Object *) uout->d); | | | |
337 | + *((Object *) uout->d) = ((Object *) uin->d)->arrayGetNF(i - 1); | | | |
338 | uout->atype = ALLOC_LEPDF; | | | |
339 | uout->pc = uin->pc; | | | |
340 | uout->pd = uin->pd; | | | |
341 | @@ -1897,7 +1894,7 @@ static int m_Object_dictAdd(lua_State * | | | |
342 | pdfdoc_changed_error(L); | | | |
343 | if (!((Object *) uin->d)->isDict()) | | | |
344 | luaL_error(L, "Object is not a Dict"); | | | |
345 | - ((Object *) uin->d)->dictAdd(copyString(s), (Object *) uobj->d); | | | |
346 | + ((Object *) uin->d)->dictAdd(copyString(s), std::move(*((Object *) uobj->d))); | | | |
347 | return 0; | | | |
348 | } | | | |
349 | | | | |
350 | @@ -1915,7 +1912,7 @@ static int m_Object_dictSet(lua_State * | | | |
351 | pdfdoc_changed_error(L); | | | |
352 | if (!((Object *) uin->d)->isDict()) | | | |
353 | luaL_error(L, "Object is not a Dict"); | | | |
354 | - ((Object *) uin->d)->dictSet(s, (Object *) uobj->d); | | | |
355 | + ((Object *) uin->d)->dictSet(s, std::move(*((Object *) uobj->d))); | | | |
356 | return 0; | | | |
357 | } | | | |
358 | | | | |
359 | @@ -1930,7 +1927,7 @@ static int m_Object_dictLookup(lua_State | | | |
360 | if (((Object *) uin->d)->isDict()) { | | | |
361 | uout = new_Object_userdata(L); | | | |
362 | uout->d = new Object(); | | | |
363 | - ((Object *) uin->d)->dictLookup(s, (Object *) uout->d); | | | |
364 | + *((Object *) uout->d) = ((Object *) uin->d)->dictLookup(s); | | | |
365 | uout->atype = ALLOC_LEPDF; | | | |
366 | uout->pc = uin->pc; | | | |
367 | uout->pd = uin->pd; | | | |
368 | @@ -1950,7 +1947,7 @@ static int m_Object_dictLookupNF(lua_Sta | | | |
369 | if (((Object *) uin->d)->isDict()) { | | | |
370 | uout = new_Object_userdata(L); | | | |
371 | uout->d = new Object(); | | | |
372 | - ((Object *) uin->d)->dictLookupNF(s, (Object *) uout->d); | | | |
373 | + *((Object *) uout->d) = ((Object *) uin->d)->dictLookupNF(s); | | | |
374 | uout->atype = ALLOC_LEPDF; | | | |
375 | uout->pc = uin->pc; | | | |
376 | uout->pd = uin->pd; | | | |
377 | @@ -1991,7 +1988,7 @@ static int m_Object_dictGetVal(lua_State | | | |
378 | if (i > 0 && i <= len) { | | | |
379 | uout = new_Object_userdata(L); | | | |
380 | uout->d = new Object(); | | | |
381 | - ((Object *) uin->d)->dictGetVal(i - 1, (Object *) uout->d); | | | |
382 | + *((Object *) uout->d) = ((Object *) uin->d)->dictGetVal(i - 1); | | | |
383 | uout->atype = ALLOC_LEPDF; | | | |
384 | uout->pc = uin->pc; | | | |
385 | uout->pd = uin->pd; | | | |
386 | @@ -2015,7 +2012,7 @@ static int m_Object_dictGetValNF(lua_Sta | | | |
387 | if (i > 0 && i <= len) { | | | |
388 | uout = new_Object_userdata(L); | | | |
389 | uout->d = new Object(); | | | |
390 | - ((Object *) uin->d)->dictGetValNF(i - 1, (Object *) uout->d); | | | |
391 | + *((Object *) uout->d) = ((Object *) uin->d)->dictGetValNF(i - 1); | | | |
392 | uout->atype = ALLOC_LEPDF; | | | |
393 | uout->pc = uin->pc; | | | |
394 | uout->pd = uin->pd; | | | |
395 | @@ -2243,7 +2240,7 @@ m_poppler_get_poppler(Page, Stream, getM | | | |
396 | m_poppler_get_poppler(Page, Dict, getPieceInfo); | | | |
397 | m_poppler_get_poppler(Page, Dict, getSeparationInfo); | | | |
398 | m_poppler_get_poppler(Page, Dict, getResourceDict); | | | |
399 | -m_poppler_get_OBJECT(Page, getAnnots); | | | |
400 | +m_poppler_get_OBJECT(Page, getAnnotsObject); | | | |
401 | | | | |
402 | m_poppler_get_OBJECT(Page, getContents); | | | |
403 | | | | |
404 | @@ -2270,7 +2267,7 @@ static const struct luaL_Reg Page_m[] = | | | |
405 | {"getPieceInfo", m_Page_getPieceInfo}, | | | |
406 | {"getSeparationInfo", m_Page_getSeparationInfo}, | | | |
407 | {"getResourceDict", m_Page_getResourceDict}, | | | |
408 | - {"getAnnots", m_Page_getAnnots}, | | | |
409 | + {"getAnnots", m_Page_getAnnotsObject}, | | | |
410 | {"getContents", m_Page_getContents}, | | | |
411 | {"__tostring", m_Page__tostring}, | | | |
412 | {NULL, NULL} // sentinel | | | |
413 | @@ -2520,7 +2517,7 @@ static int m_PDFDoc_getDocInfo(lua_State | | | |
414 | if (((PdfDocument *) uin->d)->doc->getXRef()->isOk()) { | | | |
415 | uout = new_Object_userdata(L); | | | |
416 | uout->d = new Object(); | | | |
417 | - ((PdfDocument *) uin->d)->doc->getDocInfo((Object *) uout->d); | | | |
418 | + *((Object *) uout->d) = ((PdfDocument *) uin->d)->doc->getDocInfo(); | | | |
419 | uout->atype = ALLOC_LEPDF; | | | |
420 | uout->pc = uin->pc; | | | |
421 | uout->pd = uin->pd; | | | |
422 | @@ -2538,7 +2535,7 @@ static int m_PDFDoc_getDocInfoNF(lua_Sta | | | |
423 | if (((PdfDocument *) uin->d)->doc->getXRef()->isOk()) { | | | |
424 | uout = new_Object_userdata(L); | | | |
425 | uout->d = new Object(); | | | |
426 | - ((PdfDocument *) uin->d)->doc->getDocInfoNF((Object *) uout->d); | | | |
427 | + *((Object *) uout->d) = ((PdfDocument *) uin->d)->doc->getDocInfoNF(); | | | |
428 | uout->atype = ALLOC_LEPDF; | | | |
429 | uout->pc = uin->pc; | | | |
430 | uout->pd = uin->pd; | | | |
431 | @@ -2841,7 +2838,7 @@ static int m_Attribute_getValue(lua_Stat | | | |
432 | uout = new_Object_userdata(L); | | | |
433 | uout->d = new Object(); | | | |
434 | origin = (Object *) (((Attribute *) uin->d)->getValue()); | | | |
435 | - origin->copy ( ((Object *)uout->d) ); | | | |
436 | + *((Object *) uout->d) = origin->copy(); | | | |
437 | uout->atype = ALLOC_LEPDF; | | | |
438 | uout->pc = uin->pc; | | | |
439 | uout->pd = uin->pd; | | | |
440 | @@ -3320,7 +3317,7 @@ static int m_StructTreeRoot_findParentEl | | | |
441 | parent = root->findParentElement(i-1); | | | |
442 | if (parent != NULL) { | | | |
443 | uout = new_StructElement_userdata(L); | | | |
444 | - uout->d = new StructElement( *parent ); | | | |
445 | + uout->d = (StructElement *) parent; | | | |
446 | uout->atype = ALLOC_LEPDF; | | | |
447 | uout->pc = uin->pc; | | | |
448 | uout->pd = uin->pd; | | | |
449 | @@ -3370,7 +3367,7 @@ static int m_XRef_fetch(lua_State * L) | | | |
450 | gen = luaL_checkint(L, 3); | | | |
451 | uout = new_Object_userdata(L); | | | |
452 | uout->d = new Object(); | | | |
453 | - ((XRef *) uin->d)->fetch(num, gen, (Object *) uout->d); | | | |
454 | + *((Object *) uout->d) = ((XRef *) uin->d)->fetch(num, gen); | | | |
455 | uout->atype = ALLOC_LEPDF; | | | |
456 | uout->pc = uin->pc; | | | |
457 | uout->pd = uin->pd; | | | |