… | |
… | |
22 | #include <stdlib.h> |
22 | #include <stdlib.h> |
23 | #include <string.h> |
23 | #include <string.h> |
24 | |
24 | |
25 | #include "parse_routines.h" |
25 | #include "parse_routines.h" |
26 | #include "error.h" |
26 | #include "error.h" |
|
|
27 | |
|
|
28 | #ifdef DMALLOC |
|
|
29 | #include <dmalloc.h> |
|
|
30 | #endif |
|
|
31 | |
27 | |
32 | |
28 | static int psiconv_parse_layout_section(const psiconv_buffer buf, |
33 | static int psiconv_parse_layout_section(const psiconv_buffer buf, |
29 | int lev,psiconv_u32 off, |
34 | int lev,psiconv_u32 off, |
30 | int *length, |
35 | int *length, |
31 | psiconv_text_and_layout result, |
36 | psiconv_text_and_layout result, |
… | |
… | |
87 | (*result)->file = psiconv_texted_file; |
92 | (*result)->file = psiconv_texted_file; |
88 | psiconv_debug(lev+2,off+len,"File is a TextEd file"); |
93 | psiconv_debug(lev+2,off+len,"File is a TextEd file"); |
89 | } else if ((*result)->uid3 == PSICONV_ID_SKETCH) { |
94 | } else if ((*result)->uid3 == PSICONV_ID_SKETCH) { |
90 | (*result)->file = psiconv_sketch_file; |
95 | (*result)->file = psiconv_sketch_file; |
91 | psiconv_debug(lev+2,off+len,"File is a Sketch file"); |
96 | psiconv_debug(lev+2,off+len,"File is a Sketch file"); |
|
|
97 | } else if ((*result)->uid3 == PSICONV_ID_SHEET) { |
|
|
98 | (*result)->file = psiconv_sheet_file; |
|
|
99 | psiconv_debug(lev+2,off+len,"File is a Sheet file"); |
92 | } |
100 | } |
93 | } else if ((*result)->uid2 == PSICONV_ID_MBM_FILE) { |
101 | } else if ((*result)->uid2 == PSICONV_ID_MBM_FILE) { |
94 | (*result)->file = psiconv_mbm_file; |
102 | (*result)->file = psiconv_mbm_file; |
95 | if ((*result)->uid3 != 0x00) |
103 | if ((*result)->uid3 != 0x00) |
96 | psiconv_warn(lev+2,off+len,"UID3 set in MBM file?!?"); |
104 | psiconv_warn(lev+2,off+len,"UID3 set in MBM file?!?"); |
97 | psiconv_debug(lev+2,off+len,"File is a MBM file"); |
105 | psiconv_debug(lev+2,off+len,"File is a MBM file"); |
… | |
… | |
706 | psiconv_warn(lev+3,off+len, |
714 | psiconv_warn(lev+3,off+len, |
707 | "Layout section inlines: not enough element"); |
715 | "Layout section inlines: not enough element"); |
708 | psiconv_debug(lev+3,off+len,"Can't read element!"); |
716 | psiconv_debug(lev+3,off+len,"Can't read element!"); |
709 | } else { |
717 | } else { |
710 | total ++; |
718 | total ++; |
|
|
719 | in_line.object = NULL; |
711 | if (!(in_line.layout = psiconv_clone_character_layout |
720 | if (!(in_line.layout = psiconv_clone_character_layout |
712 | (para->base_character))) |
721 | (para->base_character))) |
713 | goto ERROR4; |
722 | goto ERROR4; |
714 | psiconv_progress(lev+4,off+len,"Going to read the element type"); |
723 | psiconv_progress(lev+4,off+len,"Going to read the element type"); |
715 | temp = psiconv_read_u8(buf,lev+4,len+off,&res); |
724 | temp = psiconv_read_u8(buf,lev+4,len+off,&res); |
… | |
… | |
822 | { |
831 | { |
823 | return psiconv_parse_layout_section(buf,lev,off,length,result,styles,1); |
832 | return psiconv_parse_layout_section(buf,lev,off,length,result,styles,1); |
824 | } |
833 | } |
825 | |
834 | |
826 | int psiconv_parse_styleless_layout_section(const psiconv_buffer buf, |
835 | int psiconv_parse_styleless_layout_section(const psiconv_buffer buf, |
827 | int lev,psiconv_u32 off, |
836 | int lev,psiconv_u32 off, |
828 | int *length, |
837 | int *length, |
829 | psiconv_text_and_layout result, |
838 | psiconv_text_and_layout result, |
830 | psiconv_character_layout base_char, |
839 | const psiconv_character_layout base_char, |
831 | psiconv_paragraph_layout base_para) |
840 | const psiconv_paragraph_layout base_para) |
832 | { |
841 | { |
833 | int res = 0; |
842 | int res = 0; |
834 | psiconv_word_styles_section styles_section; |
843 | psiconv_word_styles_section styles_section; |
835 | |
844 | |
836 | if (!(styles_section = malloc(sizeof(*styles_section)))) |
845 | if (!(styles_section = malloc(sizeof(*styles_section)))) |