… | |
… | |
44 | (*result) = malloc(sizeof(**result)); |
44 | (*result) = malloc(sizeof(**result)); |
45 | |
45 | |
46 | psiconv_progress(lev+2,off+len,"Going to read UID1 to UID3"); |
46 | psiconv_progress(lev+2,off+len,"Going to read UID1 to UID3"); |
47 | (*result)->uid1 = psiconv_read_u32(buf,lev+2,off+len); |
47 | (*result)->uid1 = psiconv_read_u32(buf,lev+2,off+len); |
48 | psiconv_debug(lev+2,off+len,"UID1: %08x",(*result)->uid1); |
48 | psiconv_debug(lev+2,off+len,"UID1: %08x",(*result)->uid1); |
|
|
49 | if ((*result)->uid1 == PSICONV_ID_CLIPART) { |
|
|
50 | /* That's all folks... */ |
|
|
51 | (*result)->file = psiconv_clipart_file; |
|
|
52 | (*result)->uid2 = 0; |
|
|
53 | (*result)->uid3 = 0; |
|
|
54 | (*result)->checksum = 0; |
|
|
55 | len += 4; |
|
|
56 | psiconv_debug(lev+2,off+len,"File is a Clipart file"); |
|
|
57 | goto DONE; |
|
|
58 | } |
49 | if ((*result)->uid1 != PSICONV_ID_PSION5) { |
59 | if ((*result)->uid1 != PSICONV_ID_PSION5) { |
50 | psiconv_warn(lev+2,off+len,"UID1 has unknown value. This is probably " |
60 | psiconv_warn(lev+2,off+len,"UID1 has unknown value. This is probably " |
51 | "not a (parsable) Psion 5 file"); |
61 | "not a (parsable) Psion 5 file"); |
52 | res = -1; |
62 | res = -1; |
53 | } |
63 | } |
… | |
… | |
95 | psiconv_checkuid((*result)->uid1,(*result)->uid2, |
105 | psiconv_checkuid((*result)->uid1,(*result)->uid2, |
96 | (*result)->uid3),temp); |
106 | (*result)->uid3),temp); |
97 | res = -1; |
107 | res = -1; |
98 | } |
108 | } |
99 | len += 4; |
109 | len += 4; |
100 | |
110 | |
|
|
111 | DONE: |
101 | if (length) |
112 | if (length) |
102 | *length = len; |
113 | *length = len; |
103 | |
114 | |
104 | psiconv_progress(lev+1,off+len-1, |
115 | psiconv_progress(lev+1,off+len-1, |
105 | "End of Header Section (total length: %08x)",len); |
116 | "End of Header Section (total length: %08x)",len); |
… | |
… | |
147 | |
158 | |
148 | if (length) |
159 | if (length) |
149 | *length = len; |
160 | *length = len; |
150 | |
161 | |
151 | psiconv_progress(lev+1,off+len-1,"End of section table section " |
162 | psiconv_progress(lev+1,off+len-1,"End of section table section " |
152 | "(total length: %08x", len); |
163 | "(total length: %08x)", len); |
153 | |
164 | |
154 | return res; |
165 | return res; |
155 | } |
166 | } |
156 | |
167 | |
157 | int psiconv_parse_application_id_section(const psiconv_buffer buf, int lev, |
168 | int psiconv_parse_application_id_section(const psiconv_buffer buf, int lev, |
… | |
… | |
441 | } else { |
452 | } else { |
442 | psiconv_debug(lev+4,off+len,"Type: %02x (not based on a paragraph type)" |
453 | psiconv_debug(lev+4,off+len,"Type: %02x (not based on a paragraph type)" |
443 | ,temp); |
454 | ,temp); |
444 | len += 0x01; |
455 | len += 0x01; |
445 | if (parse_styles) { |
456 | if (parse_styles) { |
446 | psiconv_progress(lev+4,off+len+psiconv_read_u32(buf,lev+4,off+len), |
457 | psiconv_progress(lev+4,off+len+psiconv_read_u32(buf,lev+4,off+len)+4, |
447 | "Going to read the paragraph element base style"); |
458 | "Going to read the paragraph element base style"); |
448 | temp = psiconv_read_u8(buf,lev+4, |
459 | temp = psiconv_read_u8(buf,lev+4, |
449 | off+len+psiconv_read_u32(buf,lev+4,off+len)); |
460 | off+len+psiconv_read_u32(buf,lev+4,off+len)+4); |
450 | psiconv_debug(lev+4,off+len+psiconv_read_u32(buf,lev+4,off+len), |
461 | psiconv_debug(lev+4,off+len+psiconv_read_u32(buf,lev+4,off+len)+4, |
451 | "Style: %02x",temp); |
462 | "Style: %02x",temp); |
452 | } else |
463 | } else |
453 | temp = 0x00; |
464 | temp = 0x00; |
454 | psiconv_free_paragraph_layout(para->base_paragraph); |
465 | psiconv_free_paragraph_layout(para->base_paragraph); |
455 | psiconv_free_character_layout(para->base_character); |
466 | psiconv_free_character_layout(para->base_character); |