/[public]/psiconv/trunk/lib/psiconv/parse_common.c
ViewVC logotype

Diff of /psiconv/trunk/lib/psiconv/parse_common.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2 Revision 41
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"
43 (*result) = malloc(sizeof(**result)); 44 (*result) = malloc(sizeof(**result));
44 45
45 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");
46 (*result)->uid1 = psiconv_read_u32(buf,lev+2,off+len); 47 (*result)->uid1 = psiconv_read_u32(buf,lev+2,off+len);
47 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 goto DONE;
57 }
48 if ((*result)->uid1 != PSICONV_ID_PSION5) { 58 if ((*result)->uid1 != PSICONV_ID_PSION5) {
49 psiconv_warn(lev+2,off+len,"UID1 has unknown value. This is probably " 59 psiconv_warn(lev+2,off+len,"UID1 has unknown value. This is probably "
50 "not a (parsable) Psion 5 file"); 60 "not a (parsable) Psion 5 file");
51 res = -1; 61 res = -1;
52 } 62 }
65 (*result)->file = psiconv_word_file; 75 (*result)->file = psiconv_word_file;
66 psiconv_debug(lev+2,off+len,"File is a Word file"); 76 psiconv_debug(lev+2,off+len,"File is a Word file");
67 } else if ((*result)->uid3 == PSICONV_ID_TEXTED) { 77 } else if ((*result)->uid3 == PSICONV_ID_TEXTED) {
68 (*result)->file = psiconv_texted_file; 78 (*result)->file = psiconv_texted_file;
69 psiconv_debug(lev+2,off+len,"File is a TextEd file"); 79 psiconv_debug(lev+2,off+len,"File is a TextEd file");
80 } else if ((*result)->uid3 == PSICONV_ID_SKETCH) {
81 (*result)->file = psiconv_sketch_file;
82 psiconv_debug(lev+2,off+len,"File is a Sketch file");
70 } 83 }
84 } else if ((*result)->uid2 == PSICONV_ID_MBM_FILE) {
85 (*result)->file = psiconv_mbm_file;
86 if ((*result)->uid3 != 0x00)
87 psiconv_warn(lev+2,off+len,"UID3 set in MBM file?!?");
88 psiconv_debug(lev+2,off+len,"File is a MBM file");
71 } 89 }
72 } 90 }
73 if ((*result)->file == psiconv_unknown_file) { 91 if ((*result)->file == psiconv_unknown_file) {
74 psiconv_warn(lev+2,off+len,"Unknown file type"); 92 psiconv_warn(lev+2,off+len,"Unknown file type");
75 (*result)->file = psiconv_unknown_file; 93 (*result)->file = psiconv_unknown_file;
76 } 94 }
86 psiconv_checkuid((*result)->uid1,(*result)->uid2, 104 psiconv_checkuid((*result)->uid1,(*result)->uid2,
87 (*result)->uid3),temp); 105 (*result)->uid3),temp);
88 res = -1; 106 res = -1;
89 } 107 }
90 len += 4; 108 len += 4;
91
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 109
110DONE:
98 if (length) 111 if (length)
99 *length = len; 112 *length = len;
100 113
101 psiconv_progress(lev+1,off+len-1, 114 psiconv_progress(lev+1,off+len-1,
102 "End of Header Section (total length: %08x)",len); 115 "End of Header Section (total length: %08x)",len);
144 157
145 if (length) 158 if (length)
146 *length = len; 159 *length = len;
147 160
148 psiconv_progress(lev+1,off+len-1,"End of section table section " 161 psiconv_progress(lev+1,off+len-1,"End of section table section "
149 "(total length: %08x", len); 162 "(total length: %08x)", len);
150 163
151 return res; 164 return res;
152} 165}
153 166
154int psiconv_parse_application_id_section(const psiconv_buffer buf, int lev, 167int psiconv_parse_application_id_section(const psiconv_buffer buf, int lev,

Legend:
Removed from v.2  
changed lines
  Added in v.41

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26