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

Legend:
Removed from v.18  
changed lines
  Added in v.43

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