… | |
… | |
69 | len += 4; |
69 | len += 4; |
70 | psiconv_debug(config,lev+2,off+len,"File is a Clipart file"); |
70 | psiconv_debug(config,lev+2,off+len,"File is a Clipart file"); |
71 | goto DONE; |
71 | goto DONE; |
72 | } |
72 | } |
73 | if ((*result)->uid1 != PSICONV_ID_PSION5) { |
73 | if ((*result)->uid1 != PSICONV_ID_PSION5) { |
74 | psiconv_warn(config,lev+2,off+len, |
74 | psiconv_error(config,lev+2,off+len, |
75 | "UID1 has unknown value. This is probably " |
75 | "UID1 has unknown value. This is probably " |
76 | "not a (parsable) Psion 5 file"); |
76 | "not a (parsable) Psion 5 file"); |
77 | res = -PSICONV_E_PARSE; |
77 | res = -PSICONV_E_PARSE; |
78 | goto ERROR2; |
78 | goto ERROR2; |
79 | } |
79 | } |
… | |
… | |
123 | goto ERROR2; |
123 | goto ERROR2; |
124 | if (temp == psiconv_checkuid((*result)->uid1,(*result)->uid2, |
124 | if (temp == psiconv_checkuid((*result)->uid1,(*result)->uid2, |
125 | (*result)->uid3)) |
125 | (*result)->uid3)) |
126 | psiconv_debug(config,lev+2,off+len,"Checksum %08x is correct",temp); |
126 | psiconv_debug(config,lev+2,off+len,"Checksum %08x is correct",temp); |
127 | else { |
127 | else { |
128 | psiconv_warn(config,lev+2,off+len,"Checksum failed, file corrupted!"); |
128 | psiconv_error(config,lev+2,off+len,"Checksum failed, file corrupted!"); |
129 | psiconv_debug(config,lev+2,off+len,"Expected checksum %08x, found %08x", |
129 | psiconv_debug(config,lev+2,off+len,"Expected checksum %08x, found %08x", |
130 | psiconv_checkuid((*result)->uid1,(*result)->uid2, |
130 | psiconv_checkuid((*result)->uid1,(*result)->uid2, |
131 | (*result)->uid3),temp); |
131 | (*result)->uid3),temp); |
132 | res = -PSICONV_E_PARSE; |
132 | res = -PSICONV_E_PARSE; |
133 | goto ERROR2; |
133 | goto ERROR2; |
… | |
… | |
144 | return res; |
144 | return res; |
145 | |
145 | |
146 | ERROR2: |
146 | ERROR2: |
147 | free(*result); |
147 | free(*result); |
148 | ERROR1: |
148 | ERROR1: |
149 | psiconv_warn(config,lev+1,off,"Reading of Header Section failed"); |
149 | psiconv_error(config,lev+1,off,"Reading of Header Section failed"); |
150 | if (length) |
150 | if (length) |
151 | *length = 0; |
151 | *length = 0; |
152 | if (res == 0) |
152 | if (res == 0) |
153 | return -PSICONV_E_NOMEM; |
153 | return -PSICONV_E_NOMEM; |
154 | else |
154 | else |
… | |
… | |
211 | ERROR3: |
211 | ERROR3: |
212 | free(entry); |
212 | free(entry); |
213 | ERROR2: |
213 | ERROR2: |
214 | psiconv_list_free(*result); |
214 | psiconv_list_free(*result); |
215 | ERROR1: |
215 | ERROR1: |
216 | psiconv_warn(config,lev+1,off,"Reading of Section Table Section failed"); |
216 | psiconv_error(config,lev+1,off,"Reading of Section Table Section failed"); |
217 | if (length) |
217 | if (length) |
218 | *length = 0; |
218 | *length = 0; |
219 | if (res == 0) |
219 | if (res == 0) |
220 | return -PSICONV_E_NOMEM; |
220 | return -PSICONV_E_NOMEM; |
221 | else |
221 | else |
… | |
… | |
256 | |
256 | |
257 | return res; |
257 | return res; |
258 | ERROR2: |
258 | ERROR2: |
259 | free(*result); |
259 | free(*result); |
260 | ERROR1: |
260 | ERROR1: |
261 | psiconv_warn(config,lev+1,off,"Reading of Application ID Section failed"); |
261 | psiconv_error(config,lev+1,off,"Reading of Application ID Section failed"); |
262 | if (length) |
262 | if (length) |
263 | *length = 0; |
263 | *length = 0; |
264 | if (res == 0) |
264 | if (res == 0) |
265 | return -PSICONV_E_NOMEM; |
265 | return -PSICONV_E_NOMEM; |
266 | else |
266 | else |
… | |
… | |
275 | int res = 0; |
275 | int res = 0; |
276 | int len=0; |
276 | int len=0; |
277 | |
277 | |
278 | psiconv_u32 text_len; |
278 | psiconv_u32 text_len; |
279 | psiconv_paragraph para; |
279 | psiconv_paragraph para; |
|
|
280 | psiconv_u8 temp; |
280 | |
281 | |
281 | int nr; |
282 | int nr; |
282 | int i,j,start,leng,temp; |
283 | int i,j,start,leng; |
283 | char *str_copy; |
284 | char *str_copy; |
284 | |
285 | |
285 | psiconv_progress(config,lev+1,off,"Going to parse the text section"); |
286 | psiconv_progress(config,lev+1,off,"Going to parse the text section"); |
286 | psiconv_progress(config,lev+2,off,"Reading the text length"); |
287 | psiconv_progress(config,lev+2,off,"Reading the text length"); |
287 | |
288 | |
… | |
… | |
302 | for (i = 0; i < text_len; i++) { |
303 | for (i = 0; i < text_len; i++) { |
303 | temp = psiconv_read_u8(config,buf,lev+2,off+len+i,&res); |
304 | temp = psiconv_read_u8(config,buf,lev+2,off+len+i,&res); |
304 | if (res) |
305 | if (res) |
305 | goto ERROR3; |
306 | goto ERROR3; |
306 | if (temp == 0x06) { |
307 | if (temp == 0x06) { |
307 | if (!(para->text = malloc(i - start + 1))) |
308 | if (!(para->text = malloc((sizeof((*(para->text))) * (i - start + 1))))) |
308 | goto ERROR3; |
309 | goto ERROR3; |
309 | for (j = 0; j < i - start; j++) { |
310 | for (j = 0; j < i - start; j++) { |
310 | temp = psiconv_read_u8(config,buf,lev+1,off + len + start + j,&res); |
311 | temp = psiconv_read_u8(config,buf,lev+1,off + len + start + j,&res); |
311 | if (res) |
312 | if (res) |
312 | goto ERROR4; |
313 | goto ERROR4; |
313 | para->text[j] = temp; |
314 | para->text[j] = psiconv_unicode_from_char(config,temp); |
314 | } |
315 | } |
315 | para->text[j] = 0; |
316 | para->text[j] = 0; |
316 | |
317 | |
317 | if ((res = psiconv_list_add(*result,para))) |
318 | if ((res = psiconv_list_add(*result,para))) |
318 | goto ERROR4; |
319 | goto ERROR4; |
319 | |
320 | |
320 | if (!(str_copy = psiconv_make_printable(para->text))) |
321 | if (!(str_copy = psiconv_make_printable(config,para->text))) |
321 | goto ERROR3; |
322 | goto ERROR3; |
322 | psiconv_debug(config,lev+2,off+i+len,"Line %d: %d characters",nr, |
323 | psiconv_debug(config,lev+2,off+i+len,"Line %d: %d characters",nr, |
323 | strlen(str_copy) +1); |
324 | strlen(str_copy) +1); |
324 | psiconv_debug(config,lev+2,off+i+len,"Line %d: `%s'",nr,str_copy); |
325 | psiconv_debug(config,lev+2,off+i+len,"Line %d: `%s'",nr,str_copy); |
325 | free(str_copy); |
326 | free(str_copy); |
… | |
… | |
336 | goto ERROR3; |
337 | goto ERROR3; |
337 | for (j = 0; j < text_len - start; j++) { |
338 | for (j = 0; j < text_len - start; j++) { |
338 | temp = psiconv_read_u8(config,buf,lev+2,off + start + j + len, &res); |
339 | temp = psiconv_read_u8(config,buf,lev+2,off + start + j + len, &res); |
339 | if (res) |
340 | if (res) |
340 | goto ERROR4; |
341 | goto ERROR4; |
341 | para->text[j] = temp; |
342 | para->text[j] = psiconv_unicode_from_char(config,temp); |
342 | } |
343 | } |
343 | para->text[text_len - start] = 0; |
344 | para->text[text_len - start] = 0; |
344 | if ((res = psiconv_list_add(*result,para))) |
345 | if ((res = psiconv_list_add(*result,para))) |
345 | goto ERROR4; |
346 | goto ERROR4; |
346 | if (!(str_copy = psiconv_make_printable(para->text))) |
347 | if (!(str_copy = psiconv_make_printable(config,para->text))) |
347 | goto ERROR3; |
348 | goto ERROR3; |
348 | psiconv_debug(config,lev+2,off+start+len,"Last line: %d characters",nr, |
349 | psiconv_debug(config,lev+2,off+start+len,"Last line: %d characters",nr, |
349 | strlen(str_copy)+1); |
350 | strlen(str_copy)+1); |
350 | psiconv_debug(config,lev+2,off+start+len,"Last line: `%s'",str_copy); |
351 | psiconv_debug(config,lev+2,off+start+len,"Last line: `%s'",str_copy); |
351 | free(str_copy); |
352 | free(str_copy); |
… | |
… | |
354 | free(para); |
355 | free(para); |
355 | |
356 | |
356 | /* Initialize the remaining parts of each paragraph */ |
357 | /* Initialize the remaining parts of each paragraph */ |
357 | for (i = 0; i < psiconv_list_length(*result); i ++) { |
358 | for (i = 0; i < psiconv_list_length(*result); i ++) { |
358 | if (!(para = psiconv_list_get(*result,i))) { |
359 | if (!(para = psiconv_list_get(*result,i))) { |
359 | psiconv_warn(config,lev+2,off+len,"Massive memory corruption"); |
360 | psiconv_error(config,lev+2,off+len,"Massive memory corruption"); |
360 | goto ERROR2_0; |
361 | goto ERROR2_0; |
361 | } |
362 | } |
362 | if (!(para->in_lines = psiconv_list_new(sizeof( |
363 | if (!(para->in_lines = psiconv_list_new(sizeof( |
363 | struct psiconv_in_line_layout_s)))) |
364 | struct psiconv_in_line_layout_s)))) |
364 | goto ERROR2_0; |
365 | goto ERROR2_0; |
… | |
… | |
390 | ERROR2_1: |
391 | ERROR2_1: |
391 | psiconv_list_free(para->in_lines); |
392 | psiconv_list_free(para->in_lines); |
392 | ERROR2_0: |
393 | ERROR2_0: |
393 | for (j = 0; j < i; j++) { |
394 | for (j = 0; j < i; j++) { |
394 | if (!(para = psiconv_list_get(*result,j))) { |
395 | if (!(para = psiconv_list_get(*result,j))) { |
395 | psiconv_warn(config,lev+1,off,"Massive memory corruption..."); |
396 | psiconv_error(config,lev+1,off,"Massive memory corruption..."); |
396 | break; |
397 | break; |
397 | } |
398 | } |
398 | psiconv_list_free(para->in_lines); |
399 | psiconv_list_free(para->in_lines); |
399 | psiconv_list_free(para->replacements); |
400 | psiconv_list_free(para->replacements); |
400 | psiconv_free_character_layout(para->base_character); |
401 | psiconv_free_character_layout(para->base_character); |
… | |
… | |
407 | ERROR3: |
408 | ERROR3: |
408 | free(para); |
409 | free(para); |
409 | ERROR2: |
410 | ERROR2: |
410 | for (i = 0; i < psiconv_list_length(*result);i++) { |
411 | for (i = 0; i < psiconv_list_length(*result);i++) { |
411 | if (!(para = psiconv_list_get(*result,i))) { |
412 | if (!(para = psiconv_list_get(*result,i))) { |
412 | psiconv_warn(config,lev+1,off,"Massive memory corruption..."); |
413 | psiconv_error(config,lev+1,off,"Massive memory corruption..."); |
413 | break; |
414 | break; |
414 | } |
415 | } |
415 | free(para->text); |
416 | free(para->text); |
416 | } |
417 | } |
417 | psiconv_list_free(*result); |
418 | psiconv_list_free(*result); |
418 | ERROR1: |
419 | ERROR1: |
419 | psiconv_warn(config,lev+1,off,"Reading of Text Section failed"); |
420 | psiconv_error(config,lev+1,off,"Reading of Text Section failed"); |
420 | if (length) |
421 | if (length) |
421 | *length = 0; |
422 | *length = 0; |
422 | if (!res) |
423 | if (!res) |
423 | return -PSICONV_E_NOMEM; |
424 | return -PSICONV_E_NOMEM; |
424 | else |
425 | else |
… | |
… | |
588 | |
589 | |
589 | psiconv_progress(config,lev+4,off+len,"Going to read the paragraph length"); |
590 | psiconv_progress(config,lev+4,off+len,"Going to read the paragraph length"); |
590 | temp = psiconv_read_u32(config,buf,lev+4,off+len,&res); |
591 | temp = psiconv_read_u32(config,buf,lev+4,off+len,&res); |
591 | if (res) |
592 | if (res) |
592 | goto ERROR4; |
593 | goto ERROR4; |
593 | if (temp != strlen(para->text)+1) { |
594 | if (temp != psiconv_unicode_strlen(para->text)+1) { |
594 | psiconv_warn(config,lev+4,off+len, |
595 | psiconv_warn(config,lev+4,off+len, |
595 | "Disagreement of the length of paragraph in layout section"); |
596 | "Disagreement of the length of paragraph in layout section"); |
596 | psiconv_debug(config,lev+4,off+len, |
597 | psiconv_debug(config,lev+4,off+len, |
597 | "Paragraph length: layout section says %d, counted %d", |
598 | "Paragraph length: layout section says %d, counted %d", |
598 | temp,strlen(para->text)+1); |
599 | temp,psiconv_unicode_strlen(para->text)+1); |
599 | } else |
600 | } else |
600 | psiconv_debug(config,lev+4,off+len,"Paragraph length: %d",temp); |
601 | psiconv_debug(config,lev+4,off+len,"Paragraph length: %d",temp); |
601 | len += 4; |
602 | len += 4; |
602 | |
603 | |
603 | psiconv_progress(config,lev+4,off+len,"Going to read the paragraph type"); |
604 | psiconv_progress(config,lev+4,off+len,"Going to read the paragraph type"); |
… | |
… | |
606 | goto ERROR4; |
607 | goto ERROR4; |
607 | if (temp != 0x00) { |
608 | if (temp != 0x00) { |
608 | psiconv_debug(config,lev+4,off+len,"Type: %02x",temp); |
609 | psiconv_debug(config,lev+4,off+len,"Type: %02x",temp); |
609 | for (j = 0; j < psiconv_list_length(anon_styles); j++) { |
610 | for (j = 0; j < psiconv_list_length(anon_styles); j++) { |
610 | if (!(anon_ptr = psiconv_list_get(anon_styles,j))) { |
611 | if (!(anon_ptr = psiconv_list_get(anon_styles,j))) { |
611 | psiconv_warn(config,lev+4,off+len,"Massive memory curruption"); |
612 | psiconv_error(config,lev+4,off+len,"Massive memory curruption"); |
612 | goto ERROR4; |
613 | goto ERROR4; |
613 | } |
614 | } |
614 | if (temp == anon_ptr->nr) |
615 | if (temp == anon_ptr->nr) |
615 | break; |
616 | break; |
616 | } |
617 | } |
617 | if (j == psiconv_list_length(anon_styles)) { |
618 | if (j == psiconv_list_length(anon_styles)) { |
618 | psiconv_warn(config,lev+4,off+len,"Layout section paragraph type unknown"); |
619 | psiconv_warn(config,lev+4,off+len,"Layout section paragraph type unknown"); |
619 | psiconv_debug(config,lev+4,off+len,"Unknown type - using base styles instead"); |
620 | psiconv_debug(config,lev+4,off+len,"Unknown type - using base styles instead"); |
620 | para->base_style = 0; |
621 | para->base_style = 0; |
621 | if (!(temp_style = psiconv_get_style(styles,0))) { |
622 | if (!(temp_style = psiconv_get_style(styles,0))) { |
622 | psiconv_warn(config,lev+4,off,"Base style unknown"); |
623 | psiconv_error(config,lev+4,off,"Base style unknown"); |
623 | goto ERROR4; |
624 | goto ERROR4; |
624 | } |
625 | } |
625 | if (!(temp_para = psiconv_clone_paragraph_layout |
626 | if (!(temp_para = psiconv_clone_paragraph_layout |
626 | (temp_style->paragraph))) |
627 | (temp_style->paragraph))) |
627 | goto ERROR4; |
628 | goto ERROR4; |
… | |
… | |
665 | temp = 0x00; |
666 | temp = 0x00; |
666 | |
667 | |
667 | if (!(temp_style = psiconv_get_style (styles,temp))) { |
668 | if (!(temp_style = psiconv_get_style (styles,temp))) { |
668 | psiconv_warn(config,lev+4,off,"Unknown Style referenced"); |
669 | psiconv_warn(config,lev+4,off,"Unknown Style referenced"); |
669 | if (!(temp_style = psiconv_get_style(styles,0))) { |
670 | if (!(temp_style = psiconv_get_style(styles,0))) { |
670 | psiconv_warn(config,lev+4,off,"Base style unknown"); |
671 | psiconv_error(config,lev+4,off,"Base style unknown"); |
671 | goto ERROR4; |
672 | goto ERROR4; |
672 | } |
673 | } |
673 | } |
674 | } |
674 | |
675 | |
675 | if (!(temp_para = psiconv_clone_paragraph_layout(temp_style->paragraph))) |
676 | if (!(temp_para = psiconv_clone_paragraph_layout(temp_style->paragraph))) |
… | |
… | |
712 | psiconv_progress(config,lev+3,off+len, |
713 | psiconv_progress(config,lev+3,off+len, |
713 | "Going to read the text layout inline elements"); |
714 | "Going to read the text layout inline elements"); |
714 | total = 0; |
715 | total = 0; |
715 | for (i = 0; i < psiconv_list_length(result); i++) { |
716 | for (i = 0; i < psiconv_list_length(result); i++) { |
716 | if (!(para = psiconv_list_get(result,i))) { |
717 | if (!(para = psiconv_list_get(result,i))) { |
717 | psiconv_warn(config,lev+3,off+len,"Massive memory corruption"); |
718 | psiconv_error(config,lev+3,off+len,"Massive memory corruption"); |
718 | goto ERROR4; |
719 | goto ERROR4; |
719 | } |
720 | } |
720 | line_length = -1; |
721 | line_length = -1; |
721 | for (j = 0; j < inline_count[i]; j++) { |
722 | for (j = 0; j < inline_count[i]; j++) { |
722 | psiconv_progress(config,lev+3,off+len,"Element %d: Paragraph %d, element %d", |
723 | psiconv_progress(config,lev+3,off+len,"Element %d: Paragraph %d, element %d", |
… | |
… | |
795 | in_line.object_height); |
796 | in_line.object_height); |
796 | len += leng; |
797 | len += leng; |
797 | } else if (temp != 0x00) { |
798 | } else if (temp != 0x00) { |
798 | psiconv_warn(config,lev+4,off+len,"Layout section unknown inline type"); |
799 | psiconv_warn(config,lev+4,off+len,"Layout section unknown inline type"); |
799 | } |
800 | } |
800 | if (line_length + in_line.length > strlen(para->text)) { |
801 | if (line_length + in_line.length > psiconv_unicode_strlen(para->text)) { |
801 | psiconv_warn(config,lev+4,off+len, |
802 | psiconv_warn(config,lev+4,off+len, |
802 | "Layout section inlines: line length mismatch"); |
803 | "Layout section inlines: line length mismatch"); |
803 | res = -1; |
804 | res = -1; |
804 | in_line.length = strlen(para->text) - line_length; |
805 | in_line.length = psiconv_unicode_strlen(para->text) - line_length; |
805 | } |
806 | } |
806 | line_length += in_line.length; |
807 | line_length += in_line.length; |
807 | if ((res = psiconv_list_add(para->in_lines,&in_line))) |
808 | if ((res = psiconv_list_add(para->in_lines,&in_line))) |
808 | goto ERROR5; |
809 | goto ERROR5; |
809 | } |
810 | } |
… | |
… | |
817 | |
818 | |
818 | free(inline_count); |
819 | free(inline_count); |
819 | |
820 | |
820 | for (i = 0 ; i < psiconv_list_length(anon_styles); i ++) { |
821 | for (i = 0 ; i < psiconv_list_length(anon_styles); i ++) { |
821 | if (!(anon_ptr = psiconv_list_get(anon_styles,i))) { |
822 | if (!(anon_ptr = psiconv_list_get(anon_styles,i))) { |
822 | psiconv_warn(config,lev+4,off+len,"Massive memory corruption"); |
823 | psiconv_error(config,lev+4,off+len,"Massive memory corruption"); |
823 | goto ERROR2; |
824 | goto ERROR2; |
824 | } |
825 | } |
825 | psiconv_free_character_layout(anon_ptr->character); |
826 | psiconv_free_character_layout(anon_ptr->character); |
826 | psiconv_free_paragraph_layout(anon_ptr->paragraph); |
827 | psiconv_free_paragraph_layout(anon_ptr->paragraph); |
827 | } |
828 | } |
… | |
… | |
859 | ERROR4: |
860 | ERROR4: |
860 | free(inline_count); |
861 | free(inline_count); |
861 | ERROR3: |
862 | ERROR3: |
862 | for (i = 0; i < psiconv_list_length(anon_styles); i++) { |
863 | for (i = 0; i < psiconv_list_length(anon_styles); i++) { |
863 | if (!(anon_ptr = psiconv_list_get(anon_styles,i))) { |
864 | if (!(anon_ptr = psiconv_list_get(anon_styles,i))) { |
864 | psiconv_warn(config,lev+1,off,"Massive memory corruption"); |
865 | psiconv_error(config,lev+1,off,"Massive memory corruption"); |
865 | break; |
866 | break; |
866 | } |
867 | } |
867 | psiconv_free_paragraph_layout(anon_ptr->paragraph); |
868 | psiconv_free_paragraph_layout(anon_ptr->paragraph); |
868 | psiconv_free_character_layout(anon_ptr->character); |
869 | psiconv_free_character_layout(anon_ptr->character); |
869 | } |
870 | } |
870 | |
871 | |
871 | ERROR2: |
872 | ERROR2: |
872 | psiconv_list_free(anon_styles); |
873 | psiconv_list_free(anon_styles); |
873 | ERROR1: |
874 | ERROR1: |
874 | psiconv_warn(config,lev+1,off,"Reading of Layout Section failed"); |
875 | psiconv_error(config,lev+1,off,"Reading of Layout Section failed"); |
875 | if (length) |
876 | if (length) |
876 | *length = 0; |
877 | *length = 0; |
877 | if (!res) |
878 | if (!res) |
878 | return -PSICONV_E_NOMEM; |
879 | return -PSICONV_E_NOMEM; |
879 | else |
880 | else |
… | |
… | |
910 | goto ERROR3; |
911 | goto ERROR3; |
911 | if (!(styles_section->normal->paragraph = |
912 | if (!(styles_section->normal->paragraph = |
912 | psiconv_clone_paragraph_layout(base_para))) |
913 | psiconv_clone_paragraph_layout(base_para))) |
913 | goto ERROR4; |
914 | goto ERROR4; |
914 | styles_section->normal->hotkey = 0; |
915 | styles_section->normal->hotkey = 0; |
915 | if (!(styles_section->normal->name = strdup(""))) |
916 | if (( res = psiconv_unicode_from_chars(config,(psiconv_u8 *) "", |
|
|
917 | &styles_section->normal->name))) |
916 | goto ERROR5; |
918 | goto ERROR5; |
917 | if (!(styles_section->styles = psiconv_list_new(sizeof( |
919 | if (!(styles_section->styles = psiconv_list_new(sizeof( |
918 | struct psiconv_word_style_s)))) |
920 | struct psiconv_word_style_s)))) |
919 | goto ERROR6; |
921 | goto ERROR6; |
920 | |
922 | |
… | |
… | |
933 | ERROR3: |
935 | ERROR3: |
934 | free(styles_section->normal); |
936 | free(styles_section->normal); |
935 | ERROR2: |
937 | ERROR2: |
936 | free(styles_section); |
938 | free(styles_section); |
937 | ERROR1: |
939 | ERROR1: |
938 | psiconv_warn(config,lev+1,off,"Reading of Styleless Layout Section failed"); |
940 | psiconv_error(config,lev+1,off,"Reading of Styleless Layout Section failed"); |
939 | if (length) |
941 | if (length) |
940 | *length = 0; |
942 | *length = 0; |
941 | if (!res) |
943 | if (!res) |
942 | return -PSICONV_E_NOMEM; |
944 | return -PSICONV_E_NOMEM; |
943 | else |
945 | else |
… | |
… | |
1081 | ERROR3: |
1083 | ERROR3: |
1082 | psiconv_free_object_display_section((*result)->display); |
1084 | psiconv_free_object_display_section((*result)->display); |
1083 | ERROR2: |
1085 | ERROR2: |
1084 | psiconv_free_section_table_section(table); |
1086 | psiconv_free_section_table_section(table); |
1085 | ERROR1: |
1087 | ERROR1: |
1086 | psiconv_warn(config,lev+1,off,"Reading Embedded Object failed"); |
1088 | psiconv_error(config,lev+1,off,"Reading Embedded Object failed"); |
1087 | |
1089 | |
1088 | if (length) |
1090 | if (length) |
1089 | *length = 0; |
1091 | *length = 0; |
1090 | |
1092 | |
1091 | if (res == 0) |
1093 | if (res == 0) |
… | |
… | |
1130 | off = entry->offset; |
1132 | off = entry->offset; |
1131 | break; |
1133 | break; |
1132 | } |
1134 | } |
1133 | } |
1135 | } |
1134 | if (i == psiconv_list_length(table)) { |
1136 | if (i == psiconv_list_length(table)) { |
1135 | psiconv_warn(config,lev+2,off,"No Application ID Section found"); |
1137 | psiconv_error(config,lev+2,off,"No Application ID Section found"); |
1136 | res = PSICONV_E_PARSE; |
1138 | res = PSICONV_E_PARSE; |
1137 | goto ERROR2; |
1139 | goto ERROR2; |
1138 | } |
1140 | } |
1139 | |
1141 | |
1140 | psiconv_progress(config,lev+2,off,"Going to read the Application ID Section"); |
1142 | psiconv_progress(config,lev+2,off,"Going to read the Application ID Section"); |
… | |
… | |
1232 | return res; |
1234 | return res; |
1233 | |
1235 | |
1234 | ERROR2: |
1236 | ERROR2: |
1235 | free(*result); |
1237 | free(*result); |
1236 | ERROR1: |
1238 | ERROR1: |
1237 | psiconv_warn(config,lev+1,off+len,"Reading of Object Display Section failed"); |
1239 | psiconv_error(config,lev+1,off+len,"Reading of Object Display Section failed"); |
1238 | if (length) |
1240 | if (length) |
1239 | *length=0; |
1241 | *length=0; |
1240 | if (!res) |
1242 | if (!res) |
1241 | return -PSICONV_E_NOMEM; |
1243 | return -PSICONV_E_NOMEM; |
1242 | else |
1244 | else |
… | |
… | |
1287 | ERROR3: |
1289 | ERROR3: |
1288 | free((*result)->icon_name); |
1290 | free((*result)->icon_name); |
1289 | ERROR2: |
1291 | ERROR2: |
1290 | free(*result); |
1292 | free(*result); |
1291 | ERROR1: |
1293 | ERROR1: |
1292 | psiconv_warn(config,lev+1,off+len,"Reading of Object Icon Section failed"); |
1294 | psiconv_error(config,lev+1,off+len,"Reading of Object Icon Section failed"); |
1293 | if (length) |
1295 | if (length) |
1294 | *length=0; |
1296 | *length=0; |
1295 | if (!res) |
1297 | if (!res) |
1296 | return -PSICONV_E_NOMEM; |
1298 | return -PSICONV_E_NOMEM; |
1297 | else |
1299 | else |