/[public]/psiconv/trunk/lib/psiconv/generate_driver.c
ViewVC logotype

Diff of /psiconv/trunk/lib/psiconv/generate_driver.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 232 Revision 233
42 42
43 if (!value) { 43 if (!value) {
44 psiconv_error(config,0,0,"Can't parse to an empty buffer!"); 44 psiconv_error(config,0,0,"Can't parse to an empty buffer!");
45 return -PSICONV_E_OTHER; 45 return -PSICONV_E_OTHER;
46 } 46 }
47 if (!(*buf = psiconv_buffer_new())) 47 if (!(*buf = psiconv_buffer_new())) {
48 psiconv_error(config,lev+1,0,"Out of memory error");
48 return -PSICONV_E_NOMEM; 49 return -PSICONV_E_NOMEM;
50 }
49 51
50 if (value->type == psiconv_word_file) { 52 if (value->type == psiconv_word_file) {
51 if ((res = psiconv_write_header_section(config,*buf,lev+1,PSICONV_ID_PSION5, 53 if ((res = psiconv_write_header_section(config,*buf,lev+1,PSICONV_ID_PSION5,
52 PSICONV_ID_DATA_FILE, 54 PSICONV_ID_DATA_FILE,
53 PSICONV_ID_WORD))) 55 PSICONV_ID_WORD)))
86 } else { 88 } else {
87 psiconv_error(config,0,0,"Unknown or unsupported file type"); 89 psiconv_error(config,0,0,"Unknown or unsupported file type");
88 res = -PSICONV_E_GENERATE; 90 res = -PSICONV_E_GENERATE;
89 goto ERROR; 91 goto ERROR;
90 } 92 }
91 if ((res = psiconv_buffer_resolve(*buf))) 93 if ((res = psiconv_buffer_resolve(*buf))) {
94 psiconv_error(config,lev+1,0,"Internal error resolving buffer references");
92 goto ERROR; 95 goto ERROR;
96 }
93 return -PSICONV_E_OK; 97 return -PSICONV_E_OK;
94 98
95ERROR: 99ERROR:
96 psiconv_buffer_free(*buf); 100 psiconv_buffer_free(*buf);
97 return res; 101 return res;
114 res = -PSICONV_E_GENERATE; 118 res = -PSICONV_E_GENERATE;
115 goto ERROR1; 119 goto ERROR1;
116 } 120 }
117 121
118 if (!(section_table = psiconv_list_new(sizeof(*entry)))) { 122 if (!(section_table = psiconv_list_new(sizeof(*entry)))) {
123 psiconv_error(config,lev+1,0,"Out of memory error");
119 res = -PSICONV_E_NOMEM; 124 res = -PSICONV_E_NOMEM;
120 goto ERROR1; 125 goto ERROR1;
121 } 126 }
122 127
123 if (!(entry = malloc(sizeof(*entry)))) { 128 if (!(entry = malloc(sizeof(*entry)))) {
129 psiconv_error(config,lev+1,0,"Out of memory error");
124 res = -PSICONV_E_NOMEM; 130 res = -PSICONV_E_NOMEM;
125 goto ERROR2; 131 goto ERROR2;
126 } 132 }
127 133
128 if (!(base_char = psiconv_basic_character_layout())) { 134 if (!(base_char = psiconv_basic_character_layout())) {
135 psiconv_error(config,lev+1,0,"Out of memory error");
129 res = -PSICONV_E_NOMEM; 136 res = -PSICONV_E_NOMEM;
130 goto ERROR3; 137 goto ERROR3;
131 } 138 }
132 if (!(base_para = psiconv_basic_paragraph_layout())) { 139 if (!(base_para = psiconv_basic_paragraph_layout())) {
140 psiconv_error(config,lev+1,0,"Out of memory error");
133 res = -PSICONV_E_NOMEM; 141 res = -PSICONV_E_NOMEM;
134 goto ERROR4; 142 goto ERROR4;
135 } 143 }
136 144
137 section_table_id = psiconv_buffer_unique_id(); 145 section_table_id = psiconv_buffer_unique_id();
138 if ((res = psiconv_write_offset(config,buf,lev+1,section_table_id))) 146 if ((res = psiconv_write_offset(config,buf,lev+1,section_table_id))) {
147 psiconv_error(config,lev+1,0,"Out of memory error");
139 goto ERROR5; 148 goto ERROR5;
149 }
140 150
141 entry->id = PSICONV_ID_APPL_ID_SECTION; 151 entry->id = PSICONV_ID_APPL_ID_SECTION;
142 entry->offset = psiconv_buffer_unique_id(); 152 entry->offset = psiconv_buffer_unique_id();
143 if ((res = psiconv_list_add(section_table,entry))) 153 if ((res = psiconv_list_add(section_table,entry))) {
154 psiconv_error(config,lev+1,0,"Out of memory error");
144 goto ERROR5; 155 goto ERROR5;
156 }
145 if ((res = psiconv_buffer_add_target(buf,entry->offset))) 157 if ((res = psiconv_buffer_add_target(buf,entry->offset))) {
158 psiconv_error(config,lev+1,0,"Out of memory error");
146 goto ERROR5; 159 goto ERROR5;
160 }
147 if ((res=psiconv_write_application_id_section(config,buf,lev+1, 161 if ((res=psiconv_write_application_id_section(config,buf,lev+1,
148 PSICONV_ID_TEXTED,unicode_texted))) 162 PSICONV_ID_TEXTED,unicode_texted)))
149 goto ERROR5; 163 goto ERROR5;
150 164
151 entry->id = PSICONV_ID_PAGE_LAYOUT_SECTION; 165 entry->id = PSICONV_ID_PAGE_LAYOUT_SECTION;
152 entry->offset = psiconv_buffer_unique_id(); 166 entry->offset = psiconv_buffer_unique_id();
153 if ((res = psiconv_list_add(section_table,entry))) 167 if ((res = psiconv_list_add(section_table,entry))) {
168 psiconv_error(config,lev+1,0,"Out of memory error");
154 goto ERROR5; 169 goto ERROR5;
170 }
155 if ((res = psiconv_buffer_add_target(buf,entry->offset))) 171 if ((res = psiconv_buffer_add_target(buf,entry->offset))) {
172 psiconv_error(config,lev+1,0,"Out of memory error");
156 goto ERROR5; 173 goto ERROR5;
174 }
157 if ((res = psiconv_write_page_layout_section(config,buf,lev+1,value->page_sec))) 175 if ((res = psiconv_write_page_layout_section(config,buf,lev+1,value->page_sec)))
158 goto ERROR5; 176 goto ERROR5;
159 177
160 entry->id = PSICONV_ID_TEXTED; 178 entry->id = PSICONV_ID_TEXTED;
161 entry->offset = psiconv_buffer_unique_id(); 179 entry->offset = psiconv_buffer_unique_id();
162 if ((res = psiconv_list_add(section_table,entry))) 180 if ((res = psiconv_list_add(section_table,entry))) {
181 psiconv_error(config,lev+1,0,"Out of memory error");
163 goto ERROR5; 182 goto ERROR5;
183 }
164 if ((res = psiconv_buffer_add_target(buf,entry->offset))) 184 if ((res = psiconv_buffer_add_target(buf,entry->offset))) {
185 psiconv_error(config,lev+1,0,"Out of memory error");
165 goto ERROR5; 186 goto ERROR5;
187 }
166 if ((res = psiconv_write_texted_section(config,buf,lev+1,value->texted_sec, 188 if ((res = psiconv_write_texted_section(config,buf,lev+1,value->texted_sec,
167 base_char,base_para,&buf_texted))) 189 base_char,base_para,&buf_texted)))
168 goto ERROR5; 190 goto ERROR5;
169 191
170 if ((res = psiconv_buffer_concat(buf,buf_texted))) 192 if ((res = psiconv_buffer_concat(buf,buf_texted))) {
193 psiconv_error(config,lev+1,0,"Out of memory error");
171 goto ERROR6; 194 goto ERROR6;
195 }
172 196
173
174 if ((res = psiconv_buffer_add_target(buf,section_table_id))) 197 if ((res = psiconv_buffer_add_target(buf,section_table_id))) {
198 psiconv_error(config,lev+1,0,"Out of memory error");
175 goto ERROR6; 199 goto ERROR6;
200 }
176 201
177 res = psiconv_write_section_table_section(config,buf,lev+1,section_table); 202 res = psiconv_write_section_table_section(config,buf,lev+1,section_table);
178 203
179ERROR6: 204ERROR6:
180 psiconv_buffer_free(buf_texted); 205 psiconv_buffer_free(buf_texted);
208 res = -PSICONV_E_GENERATE; 233 res = -PSICONV_E_GENERATE;
209 goto ERROR1; 234 goto ERROR1;
210 } 235 }
211 236
212 if (!(section_table = psiconv_list_new(sizeof(*entry)))) { 237 if (!(section_table = psiconv_list_new(sizeof(*entry)))) {
238 psiconv_error(config,lev+1,0,"Out of memory error");
213 res = -PSICONV_E_NOMEM; 239 res = -PSICONV_E_NOMEM;
214 goto ERROR1; 240 goto ERROR1;
215 } 241 }
216 242
217 if (!(entry = malloc(sizeof(*entry)))) { 243 if (!(entry = malloc(sizeof(*entry)))) {
244 psiconv_error(config,lev+1,0,"Out of memory error");
218 res = -PSICONV_E_NOMEM; 245 res = -PSICONV_E_NOMEM;
219 goto ERROR2; 246 goto ERROR2;
220 } 247 }
221 248
222 section_table_id = psiconv_buffer_unique_id(); 249 section_table_id = psiconv_buffer_unique_id();
223 if ((res = psiconv_write_offset(config,buf,lev+1,section_table_id))) 250 if ((res = psiconv_write_offset(config,buf,lev+1,section_table_id)))
224 goto ERROR3; 251 goto ERROR3;
225 252
226 entry->id = PSICONV_ID_APPL_ID_SECTION; 253 entry->id = PSICONV_ID_APPL_ID_SECTION;
227 entry->offset = psiconv_buffer_unique_id(); 254 entry->offset = psiconv_buffer_unique_id();
228 if ((res = psiconv_list_add(section_table,entry))) 255 if ((res = psiconv_list_add(section_table,entry))) {
256 psiconv_error(config,lev+1,0,"Out of memory error");
229 goto ERROR3; 257 goto ERROR3;
258 }
230 if ((res = psiconv_buffer_add_target(buf,entry->offset))) 259 if ((res = psiconv_buffer_add_target(buf,entry->offset))) {
260 psiconv_error(config,lev+1,0,"Out of memory error");
231 goto ERROR3; 261 goto ERROR3;
262 }
232 if ((res=psiconv_write_application_id_section(config,buf,lev+1, 263 if ((res=psiconv_write_application_id_section(config,buf,lev+1,
233 PSICONV_ID_WORD,unicode_word))) 264 PSICONV_ID_WORD,unicode_word)))
234 goto ERROR3; 265 goto ERROR3;
235 266
236 entry->id = PSICONV_ID_WORD_STATUS_SECTION; 267 entry->id = PSICONV_ID_WORD_STATUS_SECTION;
237 entry->offset = psiconv_buffer_unique_id(); 268 entry->offset = psiconv_buffer_unique_id();
238 if ((res = psiconv_list_add(section_table,entry))) 269 if ((res = psiconv_list_add(section_table,entry))) {
270 psiconv_error(config,lev+1,0,"Out of memory error");
239 goto ERROR3; 271 goto ERROR3;
272 }
240 if ((res = psiconv_buffer_add_target(buf,entry->offset))) 273 if ((res = psiconv_buffer_add_target(buf,entry->offset))) {
274 psiconv_error(config,lev+1,0,"Out of memory error");
241 goto ERROR3; 275 goto ERROR3;
276 }
242 if ((res = psiconv_write_word_status_section(config,buf,lev+1,value->status_sec))) 277 if ((res = psiconv_write_word_status_section(config,buf,lev+1,value->status_sec)))
243 goto ERROR3; 278 goto ERROR3;
244 279
245 entry->id = PSICONV_ID_PAGE_LAYOUT_SECTION; 280 entry->id = PSICONV_ID_PAGE_LAYOUT_SECTION;
246 entry->offset = psiconv_buffer_unique_id(); 281 entry->offset = psiconv_buffer_unique_id();
247 if ((res = psiconv_list_add(section_table,entry))) 282 if ((res = psiconv_list_add(section_table,entry))) {
283 psiconv_error(config,lev+1,0,"Out of memory error");
248 goto ERROR3; 284 goto ERROR3;
285 }
249 if ((res = psiconv_buffer_add_target(buf,entry->offset))) 286 if ((res = psiconv_buffer_add_target(buf,entry->offset))) {
287 psiconv_error(config,lev+1,0,"Out of memory error");
250 goto ERROR3; 288 goto ERROR3;
289 }
251 if ((res = psiconv_write_page_layout_section(config,buf,lev+1,value->page_sec))) 290 if ((res = psiconv_write_page_layout_section(config,buf,lev+1,value->page_sec)))
252 goto ERROR3; 291 goto ERROR3;
253 292
254 entry->id = PSICONV_ID_WORD_STYLES_SECTION; 293 entry->id = PSICONV_ID_WORD_STYLES_SECTION;
255 entry->offset = psiconv_buffer_unique_id(); 294 entry->offset = psiconv_buffer_unique_id();
256 if ((res = psiconv_list_add(section_table,entry))) 295 if ((res = psiconv_list_add(section_table,entry))) {
296 psiconv_error(config,lev+1,0,"Out of memory error");
257 goto ERROR3; 297 goto ERROR3;
298 }
258 if ((res = psiconv_buffer_add_target(buf,entry->offset))) 299 if ((res = psiconv_buffer_add_target(buf,entry->offset))) {
300 psiconv_error(config,lev+1,0,"Out of memory error");
259 goto ERROR3; 301 goto ERROR3;
302 }
260 if ((res = psiconv_write_word_styles_section(config,buf,lev+1,value->styles_sec))) 303 if ((res = psiconv_write_word_styles_section(config,buf,lev+1,value->styles_sec)))
261 goto ERROR3; 304 goto ERROR3;
262 305
263 entry->id = PSICONV_ID_TEXT_SECTION; 306 entry->id = PSICONV_ID_TEXT_SECTION;
264 entry->offset = psiconv_buffer_unique_id(); 307 entry->offset = psiconv_buffer_unique_id();
265 if ((res = psiconv_list_add(section_table,entry))) 308 if ((res = psiconv_list_add(section_table,entry))) {
309 psiconv_error(config,lev+1,0,"Out of memory error");
266 goto ERROR3; 310 goto ERROR3;
311 }
267 if ((res = psiconv_buffer_add_target(buf,entry->offset))) 312 if ((res = psiconv_buffer_add_target(buf,entry->offset))) {
313 psiconv_error(config,lev+1,0,"Out of memory error");
268 goto ERROR3; 314 goto ERROR3;
315 }
269 if ((res = psiconv_write_text_section(config,buf,lev+1,value->paragraphs))) 316 if ((res = psiconv_write_text_section(config,buf,lev+1,value->paragraphs)))
270 goto ERROR3; 317 goto ERROR3;
271 318
272 entry->id = PSICONV_ID_LAYOUT_SECTION; 319 entry->id = PSICONV_ID_LAYOUT_SECTION;
273 entry->offset = psiconv_buffer_unique_id(); 320 entry->offset = psiconv_buffer_unique_id();
274 if ((res = psiconv_list_add(section_table,entry))) 321 if ((res = psiconv_list_add(section_table,entry))) {
322 psiconv_error(config,lev+1,0,"Out of memory error");
275 goto ERROR3; 323 goto ERROR3;
324 }
276 if ((res = psiconv_buffer_add_target(buf,entry->offset))) 325 if ((res = psiconv_buffer_add_target(buf,entry->offset))) {
326 psiconv_error(config,lev+1,0,"Out of memory error");
277 goto ERROR3; 327 goto ERROR3;
328 }
278 if ((res = psiconv_write_styled_layout_section(config,buf,lev+1,value->paragraphs, 329 if ((res = psiconv_write_styled_layout_section(config,buf,lev+1,value->paragraphs,
279 value->styles_sec))) 330 value->styles_sec)))
280 goto ERROR3; 331 goto ERROR3;
281 332
282 if ((res = psiconv_buffer_add_target(buf,section_table_id))) 333 if ((res = psiconv_buffer_add_target(buf,section_table_id))) {
334 psiconv_error(config,lev+1,0,"Out of memory error");
283 goto ERROR3; 335 goto ERROR3;
336 }
284 337
285 res = psiconv_write_section_table_section(config,buf,lev+1,section_table); 338 res = psiconv_write_section_table_section(config,buf,lev+1,section_table);
286 339
287ERROR3: 340ERROR3:
288 free(entry); 341 free(entry);
310 res = -PSICONV_E_GENERATE; 363 res = -PSICONV_E_GENERATE;
311 goto ERROR1; 364 goto ERROR1;
312 } 365 }
313 366
314 if (!(section_table = psiconv_list_new(sizeof(*entry)))) { 367 if (!(section_table = psiconv_list_new(sizeof(*entry)))) {
368 psiconv_error(config,lev+1,0,"Out of memory error");
315 res = -PSICONV_E_NOMEM; 369 res = -PSICONV_E_NOMEM;
316 goto ERROR1; 370 goto ERROR1;
317 } 371 }
318 372
319 if (!(entry = malloc(sizeof(*entry)))) { 373 if (!(entry = malloc(sizeof(*entry)))) {
374 psiconv_error(config,lev+1,0,"Out of memory error");
320 res = -PSICONV_E_NOMEM; 375 res = -PSICONV_E_NOMEM;
321 goto ERROR2; 376 goto ERROR2;
322 } 377 }
323 378
324 section_table_id = psiconv_buffer_unique_id(); 379 section_table_id = psiconv_buffer_unique_id();
325 if ((res = psiconv_write_offset(config,buf,lev+1,section_table_id))) 380 if ((res = psiconv_write_offset(config,buf,lev+1,section_table_id)))
326 goto ERROR3; 381 goto ERROR3;
327 382
328 entry->id = PSICONV_ID_APPL_ID_SECTION; 383 entry->id = PSICONV_ID_APPL_ID_SECTION;
329 entry->offset = psiconv_buffer_unique_id(); 384 entry->offset = psiconv_buffer_unique_id();
330 if ((res = psiconv_list_add(section_table,entry))) 385 if ((res = psiconv_list_add(section_table,entry))) {
386 psiconv_error(config,lev+1,0,"Out of memory error");
331 goto ERROR3; 387 goto ERROR3;
388 }
332 if ((res = psiconv_buffer_add_target(buf,entry->offset))) 389 if ((res = psiconv_buffer_add_target(buf,entry->offset))) {
390 psiconv_error(config,lev+1,0,"Out of memory error");
333 goto ERROR3; 391 goto ERROR3;
392 }
334 if ((res=psiconv_write_application_id_section(config,buf,lev+1, 393 if ((res=psiconv_write_application_id_section(config,buf,lev+1,
335 PSICONV_ID_SKETCH,unicode_paint))) 394 PSICONV_ID_SKETCH,unicode_paint)))
336 goto ERROR3; 395 goto ERROR3;
337 396
338 entry->id = PSICONV_ID_SKETCH_SECTION; 397 entry->id = PSICONV_ID_SKETCH_SECTION;
339 entry->offset = psiconv_buffer_unique_id(); 398 entry->offset = psiconv_buffer_unique_id();
340 if ((res = psiconv_list_add(section_table,entry))) 399 if ((res = psiconv_list_add(section_table,entry))) {
400 psiconv_error(config,lev+1,0,"Out of memory error");
341 goto ERROR3; 401 goto ERROR3;
402 }
342 if ((res = psiconv_buffer_add_target(buf,entry->offset))) 403 if ((res = psiconv_buffer_add_target(buf,entry->offset))) {
404 psiconv_error(config,lev+1,0,"Out of memory error");
343 goto ERROR3; 405 goto ERROR3;
406 }
344 if ((res = psiconv_write_sketch_section(config,buf,lev+1,value->sketch_sec))) 407 if ((res = psiconv_write_sketch_section(config,buf,lev+1,value->sketch_sec)))
345 goto ERROR3; 408 goto ERROR3;
346 409
347 if ((res = psiconv_buffer_add_target(buf,section_table_id))) 410 if ((res = psiconv_buffer_add_target(buf,section_table_id))) {
411 psiconv_error(config,lev+1,0,"Out of memory error");
348 goto ERROR3; 412 goto ERROR3;
413 }
349 res = psiconv_write_section_table_section(config,buf,lev+1,section_table); 414 res = psiconv_write_section_table_section(config,buf,lev+1,section_table);
350 415
351ERROR3: 416ERROR3:
352 free(entry); 417 free(entry);
353ERROR2: 418ERROR2:
374 res = -PSICONV_E_GENERATE; 439 res = -PSICONV_E_GENERATE;
375 goto ERROR1; 440 goto ERROR1;
376 } 441 }
377 442
378 if (!(jumptable = psiconv_list_new(sizeof(*entry)))) { 443 if (!(jumptable = psiconv_list_new(sizeof(*entry)))) {
444 psiconv_error(config,lev+1,0,"Out of memory error");
379 res = -PSICONV_E_NOMEM; 445 res = -PSICONV_E_NOMEM;
380 goto ERROR1; 446 goto ERROR1;
381 } 447 }
382 448
383 table_id = psiconv_buffer_unique_id(); 449 table_id = psiconv_buffer_unique_id();
384 if ((res = psiconv_buffer_add_reference(buf,table_id))) 450 if ((res = psiconv_buffer_add_reference(buf,table_id))) {
451 psiconv_error(config,lev+1,0,"Out of memory error");
385 goto ERROR2; 452 goto ERROR2;
453 }
386 454
387 for (i = 0; i < psiconv_list_length(value->sections); i++) { 455 for (i = 0; i < psiconv_list_length(value->sections); i++) {
388 if (!(section = psiconv_list_get(value->sections,i))) { 456 if (!(section = psiconv_list_get(value->sections,i))) {
389 psiconv_error(config,lev,0,"Massive memory corruption"); 457 psiconv_error(config,lev,0,"Data structure corruption");
390 res = -PSICONV_E_NOMEM; 458 res = -PSICONV_E_NOMEM;
391 goto ERROR2; 459 goto ERROR2;
392 } 460 }
393 id = psiconv_buffer_unique_id(); 461 id = psiconv_buffer_unique_id();
394 psiconv_list_add(jumptable,&id); 462 if ((res = psiconv_list_add(jumptable,&id))) {
395 if ((res = psiconv_buffer_add_target(buf,id))) 463 psiconv_error(config,lev+1,0,"Out of memory error");
396 goto ERROR2; 464 goto ERROR2;
465 }
466 if ((res = psiconv_buffer_add_target(buf,id))) {
467 psiconv_error(config,lev+1,0,"Out of memory error");
468 goto ERROR2;
469 }
397 if ((res = psiconv_write_paint_data_section(config,buf,lev+1,section,0))) 470 if ((res = psiconv_write_paint_data_section(config,buf,lev+1,section,0)))
398 goto ERROR2; 471 goto ERROR2;
399 } 472 }
400 473
401 if ((res = psiconv_buffer_add_target(buf,table_id))) 474 if ((res = psiconv_buffer_add_target(buf,table_id))) {
475 psiconv_error(config,lev+1,0,"Out of memory error");
402 goto ERROR2; 476 goto ERROR2;
477 }
403 if ((res = psiconv_write_jumptable_section(config,buf,lev+1,jumptable))) 478 if ((res = psiconv_write_jumptable_section(config,buf,lev+1,jumptable)))
404 goto ERROR2; 479 goto ERROR2;
405 480
406 481
407ERROR2: 482ERROR2:
430 res = -PSICONV_E_GENERATE; 505 res = -PSICONV_E_GENERATE;
431 goto ERROR1; 506 goto ERROR1;
432 } 507 }
433 508
434 if (!(jumptable = psiconv_list_new(sizeof(*entry)))) { 509 if (!(jumptable = psiconv_list_new(sizeof(*entry)))) {
510 psiconv_error(config,lev+1,0,"Out of memory error");
435 res = -PSICONV_E_NOMEM; 511 res = -PSICONV_E_NOMEM;
436 goto ERROR1; 512 goto ERROR1;
437 } 513 }
438 514
439 if (!(sec_buf = psiconv_buffer_new())) { 515 if (!(sec_buf = psiconv_buffer_new())) {
516 psiconv_error(config,lev+1,0,"Out of memory error");
440 res = -PSICONV_E_NOMEM; 517 res = -PSICONV_E_NOMEM;
441 goto ERROR2; 518 goto ERROR2;
442 } 519 }
443 520
444 if ((res = psiconv_write_u32(config,buf,lev+1,PSICONV_ID_CLIPART))) 521 if ((res = psiconv_write_u32(config,buf,lev+1,PSICONV_ID_CLIPART)))
445 goto ERROR3; 522 goto ERROR3;
446 523
447 for (i = 0; i < psiconv_list_length(value->sections); i++) { 524 for (i = 0; i < psiconv_list_length(value->sections); i++) {
448 if (!(section = psiconv_list_get(value->sections,i))) { 525 if (!(section = psiconv_list_get(value->sections,i))) {
449 psiconv_error(config,lev,0,"Massive memory corruption"); 526 psiconv_error(config,lev,0,"Data structure corruption");
450 res = -PSICONV_E_NOMEM; 527 res = -PSICONV_E_NOMEM;
451 goto ERROR3; 528 goto ERROR3;
452 } 529 }
453 id = psiconv_buffer_unique_id(); 530 id = psiconv_buffer_unique_id();
454 psiconv_list_add(jumptable,&id); 531 if ((res = psiconv_list_add(jumptable,&id))) {
455 if ((res = psiconv_buffer_add_target(sec_buf,id))) 532 psiconv_error(config,lev+1,0,"Out of memory error");
456 goto ERROR3; 533 goto ERROR3;
534 }
535 if ((res = psiconv_buffer_add_target(sec_buf,id))) {
536 psiconv_error(config,lev+1,0,"Out of memory error");
537 goto ERROR3;
538 }
457 if ((res = psiconv_write_clipart_section(config,sec_buf, lev+1,section))) 539 if ((res = psiconv_write_clipart_section(config,sec_buf, lev+1,section)))
458 goto ERROR3; 540 goto ERROR3;
459 } 541 }
460 542
461 if ((res = psiconv_write_jumptable_section(config,buf,lev+1,jumptable))) 543 if ((res = psiconv_write_jumptable_section(config,buf,lev+1,jumptable)))
462 goto ERROR3; 544 goto ERROR3;
463 545
464 if ((res = psiconv_buffer_concat(buf,sec_buf))) 546 if ((res = psiconv_buffer_concat(buf,sec_buf))) {
547 psiconv_error(config,lev+1,0,"Out of memory error");
465 goto ERROR3; 548 goto ERROR3;
549 }
466 550
467 551
468ERROR3: 552ERROR3:
469 psiconv_buffer_free(sec_buf); 553 psiconv_buffer_free(sec_buf);
470ERROR2: 554ERROR2:

Legend:
Removed from v.232  
changed lines
  Added in v.233

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26