… | |
… | |
312 | psiconv_error(config,lev+2,off+len+i,"Malformed text section"); |
312 | psiconv_error(config,lev+2,off+len+i,"Malformed text section"); |
313 | res = PSICONV_E_PARSE; |
313 | res = PSICONV_E_PARSE; |
314 | goto ERROR4; |
314 | goto ERROR4; |
315 | } |
315 | } |
316 | if ((temp == 0x06) || (i + leng == text_len)) { |
316 | if ((temp == 0x06) || (i + leng == text_len)) { |
317 | if (!(para->text = malloc(sizeof(*(para->text)) * |
317 | if (!(para->text = psiconv_unicode_from_list(line))) |
318 | (psiconv_list_length(line) + 1)))) |
|
|
319 | goto ERROR4; |
318 | goto ERROR4; |
320 | for (j = 0; j < psiconv_list_length(line); j++) { |
|
|
321 | if (!(nextcharptr = psiconv_list_get(line,j))) { |
|
|
322 | psiconv_error(config,lev+2,off+i+len,"Internal data corruption"); |
|
|
323 | goto ERROR5; |
|
|
324 | } |
|
|
325 | para->text[j] = *nextcharptr; |
|
|
326 | } |
|
|
327 | para->text[j] = 0; |
|
|
328 | |
319 | |
329 | if (!(str_copy = psiconv_make_printable(config,para->text))) |
320 | if (!(str_copy = psiconv_make_printable(config,para->text))) |
330 | goto ERROR5; |
321 | goto ERROR5; |
331 | psiconv_debug(config,lev+2,off+i+len,"Line %d: %d characters",nr, |
322 | psiconv_debug(config,lev+2,off+i+len,"Line %d: %d characters",nr, |
332 | strlen(str_copy) +1); |
323 | strlen(str_copy) +1); |
… | |
… | |
578 | goto ERROR4; |
569 | goto ERROR4; |
579 | if (temp != 0x00) { |
570 | if (temp != 0x00) { |
580 | psiconv_debug(config,lev+4,off+len,"Type: %02x",temp); |
571 | psiconv_debug(config,lev+4,off+len,"Type: %02x",temp); |
581 | for (j = 0; j < psiconv_list_length(anon_styles); j++) { |
572 | for (j = 0; j < psiconv_list_length(anon_styles); j++) { |
582 | if (!(anon_ptr = psiconv_list_get(anon_styles,j))) { |
573 | if (!(anon_ptr = psiconv_list_get(anon_styles,j))) { |
583 | psiconv_error(config,lev+4,off+len,"Massive memory curruption"); |
574 | psiconv_error(config,lev+4,off+len,"Data structure corruption"); |
584 | goto ERROR4; |
575 | goto ERROR4; |
585 | } |
576 | } |
586 | if (temp == anon_ptr->nr) |
577 | if (temp == anon_ptr->nr) |
587 | break; |
578 | break; |
588 | } |
579 | } |
… | |
… | |
684 | psiconv_progress(config,lev+3,off+len, |
675 | psiconv_progress(config,lev+3,off+len, |
685 | "Going to read the text layout inline elements"); |
676 | "Going to read the text layout inline elements"); |
686 | total = 0; |
677 | total = 0; |
687 | for (i = 0; i < psiconv_list_length(result); i++) { |
678 | for (i = 0; i < psiconv_list_length(result); i++) { |
688 | if (!(para = psiconv_list_get(result,i))) { |
679 | if (!(para = psiconv_list_get(result,i))) { |
689 | psiconv_error(config,lev+3,off+len,"Massive memory corruption"); |
680 | psiconv_error(config,lev+3,off+len,"Data structure corruption"); |
690 | goto ERROR4; |
681 | goto ERROR4; |
691 | } |
682 | } |
692 | line_length = -1; |
683 | line_length = -1; |
693 | for (j = 0; j < inline_count[i]; j++) { |
684 | for (j = 0; j < inline_count[i]; j++) { |
694 | psiconv_progress(config,lev+3,off+len,"Element %d: Paragraph %d, element %d", |
685 | psiconv_progress(config,lev+3,off+len,"Element %d: Paragraph %d, element %d", |
… | |
… | |
789 | |
780 | |
790 | free(inline_count); |
781 | free(inline_count); |
791 | |
782 | |
792 | for (i = 0 ; i < psiconv_list_length(anon_styles); i ++) { |
783 | for (i = 0 ; i < psiconv_list_length(anon_styles); i ++) { |
793 | if (!(anon_ptr = psiconv_list_get(anon_styles,i))) { |
784 | if (!(anon_ptr = psiconv_list_get(anon_styles,i))) { |
794 | psiconv_error(config,lev+4,off+len,"Massive memory corruption"); |
785 | psiconv_error(config,lev+4,off+len,"Data structure corruption"); |
795 | goto ERROR2; |
786 | goto ERROR2; |
796 | } |
787 | } |
797 | psiconv_free_character_layout(anon_ptr->character); |
788 | psiconv_free_character_layout(anon_ptr->character); |
798 | psiconv_free_paragraph_layout(anon_ptr->paragraph); |
789 | psiconv_free_paragraph_layout(anon_ptr->paragraph); |
799 | } |
790 | } |
… | |
… | |
831 | ERROR4: |
822 | ERROR4: |
832 | free(inline_count); |
823 | free(inline_count); |
833 | ERROR3: |
824 | ERROR3: |
834 | for (i = 0; i < psiconv_list_length(anon_styles); i++) { |
825 | for (i = 0; i < psiconv_list_length(anon_styles); i++) { |
835 | if (!(anon_ptr = psiconv_list_get(anon_styles,i))) { |
826 | if (!(anon_ptr = psiconv_list_get(anon_styles,i))) { |
836 | psiconv_error(config,lev+1,off,"Massive memory corruption"); |
827 | psiconv_error(config,lev+1,off,"Data structure corruption"); |
837 | break; |
828 | break; |
838 | } |
829 | } |
839 | psiconv_free_paragraph_layout(anon_ptr->paragraph); |
830 | psiconv_free_paragraph_layout(anon_ptr->paragraph); |
840 | psiconv_free_character_layout(anon_ptr->character); |
831 | psiconv_free_character_layout(anon_ptr->character); |
841 | } |
832 | } |