… | |
… | |
16 | along with this program; if not, write to the Free Software |
16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
17 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
18 | */ |
18 | */ |
19 | |
19 | |
20 | #include "config.h" |
20 | #include "config.h" |
|
|
21 | #include "compat.h" |
21 | #include <stdlib.h> |
22 | #include <stdlib.h> |
22 | #include <string.h> |
23 | #include <string.h> |
23 | |
24 | |
24 | #include "data.h" |
25 | #include "data.h" |
25 | #include "parse_routines.h" |
26 | #include "parse_routines.h" |
… | |
… | |
65 | (*result)->file = psiconv_word_file; |
66 | (*result)->file = psiconv_word_file; |
66 | psiconv_debug(lev+2,off+len,"File is a Word file"); |
67 | psiconv_debug(lev+2,off+len,"File is a Word file"); |
67 | } else if ((*result)->uid3 == PSICONV_ID_TEXTED) { |
68 | } else if ((*result)->uid3 == PSICONV_ID_TEXTED) { |
68 | (*result)->file = psiconv_texted_file; |
69 | (*result)->file = psiconv_texted_file; |
69 | psiconv_debug(lev+2,off+len,"File is a TextEd file"); |
70 | psiconv_debug(lev+2,off+len,"File is a TextEd file"); |
|
|
71 | } else if ((*result)->uid3 == PSICONV_ID_SKETCH) { |
|
|
72 | (*result)->file = psiconv_sketch_file; |
|
|
73 | psiconv_debug(lev+2,off+len,"File is a Sketch file"); |
70 | } |
74 | } |
|
|
75 | } else if ((*result)->uid2 == PSICONV_ID_MBM_FILE) { |
|
|
76 | (*result)->file = psiconv_mbm_file; |
|
|
77 | if ((*result)->uid3 != 0x00) |
|
|
78 | psiconv_warn(lev+2,off+len,"UID3 set in MBM file?!?"); |
|
|
79 | psiconv_debug(lev+2,off+len,"File is a MBM file"); |
71 | } |
80 | } |
72 | } |
81 | } |
73 | if ((*result)->file == psiconv_unknown_file) { |
82 | if ((*result)->file == psiconv_unknown_file) { |
74 | psiconv_warn(lev+2,off+len,"Unknown file type"); |
83 | psiconv_warn(lev+2,off+len,"Unknown file type"); |
75 | (*result)->file = psiconv_unknown_file; |
84 | (*result)->file = psiconv_unknown_file; |
76 | } |
85 | } |
… | |
… | |
87 | (*result)->uid3),temp); |
96 | (*result)->uid3),temp); |
88 | res = -1; |
97 | res = -1; |
89 | } |
98 | } |
90 | len += 4; |
99 | len += 4; |
91 | |
100 | |
92 | psiconv_progress(lev+2,off+len,"Going to read Section Table Section offset"); |
|
|
93 | (*result)->section_table_offset = psiconv_read_u32(buf,lev+2,off+len); |
|
|
94 | psiconv_debug(lev+2,off+len,"Section Table Section starts at offset %08x", |
|
|
95 | (*result)->section_table_offset) ; |
|
|
96 | len += 4; |
|
|
97 | |
|
|
98 | if (length) |
101 | if (length) |
99 | *length = len; |
102 | *length = len; |
100 | |
103 | |
101 | psiconv_progress(lev+1,off+len-1, |
104 | psiconv_progress(lev+1,off+len-1, |
102 | "End of Header Section (total length: %08x)",len); |
105 | "End of Header Section (total length: %08x)",len); |
… | |
… | |
144 | |
147 | |
145 | if (length) |
148 | if (length) |
146 | *length = len; |
149 | *length = len; |
147 | |
150 | |
148 | psiconv_progress(lev+1,off+len-1,"End of section table section " |
151 | psiconv_progress(lev+1,off+len-1,"End of section table section " |
149 | "(total length: %08x", len); |
152 | "(total length: %08x)", len); |
150 | |
153 | |
151 | return res; |
154 | return res; |
152 | } |
155 | } |
153 | |
156 | |
154 | int psiconv_parse_application_id_section(const psiconv_buffer buf, int lev, |
157 | int psiconv_parse_application_id_section(const psiconv_buffer buf, int lev, |