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

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

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

Revision 43 Revision 95
1/* 1/*
2 parse_driver.c - Part of psiconv, a PSION 5 file formats converter 2 parse_driver.c - Part of psiconv, a PSION 5 file formats converter
3 Copyright (c) 1999 Frodo Looijaard <frodol@dds.nl> 3 Copyright (c) 1999, 2000 Frodo Looijaard <frodol@dds.nl>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
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"
22
21#include <stdlib.h> 23#include <stdlib.h>
22 24
23#include "parse.h" 25#include "parse.h"
24#include "parse_routines.h" 26#include "parse_routines.h"
25#include "data.h"
26 27
27psiconv_file_type_t psiconv_file_type(psiconv_buffer buf,int *length, 28psiconv_file_type_t psiconv_file_type(psiconv_buffer buf,int *length,
28 psiconv_header_section *result) 29 psiconv_header_section *result)
29{ 30{
30 psiconv_header_section header; 31 psiconv_header_section header;
31 psiconv_file_type_t res; 32 psiconv_file_type_t res;
32 int leng; 33 int leng;
33 34
34 psiconv_parse_header_section(buf,0,0,&leng,&header); 35 if ((psiconv_parse_header_section(buf,0,0,&leng,&header)))
36 return psiconv_unknown_file;
35 res = header->file; 37 res = header->file;
36 if (result) 38 if (result)
37 *result = header; 39 *result = header;
38 else 40 else
39 psiconv_free_header_section(header); 41 psiconv_free_header_section(header);
47 int res=0; 49 int res=0;
48 int lev=0; 50 int lev=0;
49 int off=0; 51 int off=0;
50 int leng; 52 int leng;
51 53
52 (*result) = malloc(sizeof(**result)); 54 if (!((*result) = malloc(sizeof(**result))))
55 goto ERROR1;
53 56
54 (*result)->type = psiconv_file_type(buf,&leng,NULL); 57 (*result)->type = psiconv_file_type(buf,&leng,NULL);
55 if ((*result)->type == psiconv_unknown_file) { 58 if ((*result)->type == psiconv_unknown_file) {
56 psiconv_warn(lev+1,off,"Unknown file type: can't parse!"); 59 psiconv_warn(lev+1,off,"Unknown file type: can't parse!");
57 (*result)->file = NULL; 60 (*result)->file = NULL;
58 res = -1;
59 } else if ((*result)->type == psiconv_word_file) 61 } else if ((*result)->type == psiconv_word_file)
60 res = psiconv_parse_word_file(buf,lev+2,leng, 62 res = psiconv_parse_word_file(buf,lev+2,leng,
61 (psiconv_word_f *)(&((*result)->file))); 63 (psiconv_word_f *)(&((*result)->file)));
62 else if ((*result)->type == psiconv_texted_file) 64 else if ((*result)->type == psiconv_texted_file)
63 res = psiconv_parse_texted_file(buf,lev+2,leng, 65 res = psiconv_parse_texted_file(buf,lev+2,leng,
69 res = psiconv_parse_sketch_file(buf,lev+2,leng, 71 res = psiconv_parse_sketch_file(buf,lev+2,leng,
70 (psiconv_sketch_f *)(&((*result)->file))); 72 (psiconv_sketch_f *)(&((*result)->file)));
71 else if ((*result)->type == psiconv_clipart_file) 73 else if ((*result)->type == psiconv_clipart_file)
72 res = psiconv_parse_clipart_file(buf,lev+2,leng, 74 res = psiconv_parse_clipart_file(buf,lev+2,leng,
73 (psiconv_clipart_f *)(&((*result)->file))); 75 (psiconv_clipart_f *)(&((*result)->file)));
76 else if ((*result)->type == psiconv_sheet_file)
77 res = psiconv_parse_sheet_file(buf,lev+2,leng,
78 (psiconv_sheet_f *)(&((*result)->file)));
74 else { 79 else {
75 psiconv_warn(lev+1,off,"Can't parse this file yet!"); 80 psiconv_warn(lev+1,off,"Can't parse this file yet!");
76 (*result)->file = NULL; 81 (*result)->file = NULL;
77 } 82 }
78 res = -1; 83 if (res)
84 goto ERROR2;
85 return 0;
79 86
87ERROR2:
88 free(*result);
89ERROR1:
90 psiconv_warn(lev+1,off,"Reading of Psion File failed");
91 if (res == 0)
92 return -PSICONV_E_NOMEM;
93 else
80 return res; 94 return res;
81} 95}
82 96
83int psiconv_parse_clipart_file(const psiconv_buffer buf,int lev, 97int psiconv_parse_clipart_file(const psiconv_buffer buf,int lev,
84 psiconv_u32 off, psiconv_clipart_f *result) 98 psiconv_u32 off, psiconv_clipart_f *result)
85{ 99{
88 psiconv_jumptable_section table; 102 psiconv_jumptable_section table;
89 psiconv_clipart_section clipart; 103 psiconv_clipart_section clipart;
90 psiconv_u32 *entry; 104 psiconv_u32 *entry;
91 105
92 psiconv_progress(lev+1,off,"Going to read a clipart file"); 106 psiconv_progress(lev+1,off,"Going to read a clipart file");
93 (*result) = malloc(sizeof(**result)); 107 if (!((*result) = malloc(sizeof(**result))))
108 goto ERROR1;
94 109
95 psiconv_progress(lev+2,off,"Going to read the MBM jumptable"); 110 psiconv_progress(lev+2,off,"Going to read the MBM jumptable");
96 res |= psiconv_parse_jumptable_section(buf,lev+2,off, NULL,&table); 111 if ((res = psiconv_parse_jumptable_section(buf,lev+2,off, NULL,&table)))
112 goto ERROR2;
97 113
98 psiconv_progress(lev+2,off,"Going to read the clipart sections"); 114 psiconv_progress(lev+2,off,"Going to read the clipart sections");
99 (*result)->sections = psiconv_list_new(sizeof(*clipart)); 115 if (!((*result)->sections = psiconv_list_new(sizeof(*clipart))))
116 goto ERROR3;
100 for (i = 0; i < psiconv_list_length(table); i ++) { 117 for (i = 0; i < psiconv_list_length(table); i ++) {
101 entry = psiconv_list_get(table,i); 118 if (!(entry = psiconv_list_get(table,i)))
119 goto ERROR4;
102 psiconv_progress(lev+3,off,"Going to read clipart section %i",i); 120 psiconv_progress(lev+3,off,"Going to read clipart section %i",i);
103 psiconv_parse_clipart_section(buf,lev+3,*entry,NULL,&clipart); 121 if ((res = psiconv_parse_clipart_section(buf,lev+3,*entry,NULL,&clipart)))
122 goto ERROR4;
104 psiconv_list_add((*result)->sections,clipart); 123 if ((res = psiconv_list_add((*result)->sections,clipart)))
124 goto ERROR5;
105 } 125 }
106 126
107 psiconv_free_jumptable_section(table); 127 psiconv_free_jumptable_section(table);
108 psiconv_progress(lev+1,off,"End of clipart file"); 128 psiconv_progress(lev+1,off,"End of clipart file");
109 return res; 129 return res;
130ERROR5:
131 psiconv_free_clipart_section(clipart);
132ERROR4:
133 for (i = 0; i < psiconv_list_length((*result)->sections); i++) {
134 if (!(clipart = psiconv_list_get((*result)->sections,i))) {
135 psiconv_warn(lev+1,off,"Massive memory corruption");
136 goto ERROR3;
137 }
138 psiconv_free_clipart_section(clipart);
139 }
140 psiconv_list_free((*result)->sections);
141ERROR3:
142 psiconv_free_jumptable_section(table);
143ERROR2:
144 free(*result);
145ERROR1:
146 psiconv_warn(lev+1,off,"Reading of Clipart File failed");
147 if (res == 0)
148 return -PSICONV_E_NOMEM;
149 else
150 return res;
110} 151}
111 152
112int psiconv_parse_mbm_file(const psiconv_buffer buf,int lev, psiconv_u32 off, 153int psiconv_parse_mbm_file(const psiconv_buffer buf,int lev, psiconv_u32 off,
113 psiconv_mbm_f *result) 154 psiconv_mbm_f *result)
114{ 155{
118 psiconv_paint_data_section paint; 159 psiconv_paint_data_section paint;
119 psiconv_u32 *entry; 160 psiconv_u32 *entry;
120 psiconv_u32 sto; 161 psiconv_u32 sto;
121 162
122 psiconv_progress(lev+1,off,"Going to read a mbm file"); 163 psiconv_progress(lev+1,off,"Going to read a mbm file");
123 *result = malloc(sizeof(**result)); 164 if (!(*result = malloc(sizeof(**result))))
165 goto ERROR1;
124 166
125 psiconv_progress(lev+2,off,"Going to read the offset of the MBM jumptable"); 167 psiconv_progress(lev+2,off,"Going to read the offset of the MBM jumptable");
126 sto = psiconv_read_u32(buf,lev+2,off); 168 sto = psiconv_read_u32(buf,lev+2,off,&res);
169 if (res)
170 goto ERROR2;
127 psiconv_debug(lev+2,off,"Offset: %08x",sto); 171 psiconv_debug(lev+2,off,"Offset: %08x",sto);
128 172
129 psiconv_progress(lev+2,off,"Going to read the MBM jumptable"); 173 psiconv_progress(lev+2,off,"Going to read the MBM jumptable");
130 res |= psiconv_parse_jumptable_section(buf,lev+2,sto, NULL,&table); 174 if ((res = psiconv_parse_jumptable_section(buf,lev+2,sto, NULL,&table)))
175 goto ERROR2;
131 176
132 psiconv_progress(lev+2,off,"Going to read the picture sections"); 177 psiconv_progress(lev+2,off,"Going to read the picture sections");
133 (*result)->sections = psiconv_list_new(sizeof(*paint)); 178 if (!((*result)->sections = psiconv_list_new(sizeof(*paint))))
179 goto ERROR3;
134 for (i = 0; i < psiconv_list_length(table); i ++) { 180 for (i = 0; i < psiconv_list_length(table); i ++) {
135 entry = psiconv_list_get(table,i); 181 if (!(entry = psiconv_list_get(table,i)))
182 goto ERROR4;
136 psiconv_progress(lev+3,off,"Going to read picture section %i",i); 183 psiconv_progress(lev+3,off,"Going to read picture section %i",i);
137 psiconv_parse_paint_data_section(buf,lev+3,*entry,NULL,&paint); 184 if ((res = psiconv_parse_paint_data_section(buf,lev+3,*entry,NULL,
185 0,&paint)))
186 goto ERROR4;
138 psiconv_list_add((*result)->sections,paint); 187 if ((res = psiconv_list_add((*result)->sections,paint)))
188 goto ERROR5;
139 } 189 }
140 190
141 psiconv_free_jumptable_section(table); 191 psiconv_free_jumptable_section(table);
142 psiconv_progress(lev+1,off,"End of mbm file"); 192 psiconv_progress(lev+1,off,"End of mbm file");
193 return 0;
194ERROR5:
195 psiconv_free_paint_data_section(paint);
196ERROR4:
197 for (i = 0; i < psiconv_list_length((*result)->sections); i++) {
198 if (!(paint = psiconv_list_get((*result)->sections,i))) {
199 psiconv_warn(lev+1,off,"Massive memory corruption");
200 goto ERROR3;
201 }
202 psiconv_free_paint_data_section(paint);
203 }
204 psiconv_list_free((*result)->sections);
205ERROR3:
206 psiconv_free_jumptable_section(table);
207ERROR2:
208 free(*result);
209ERROR1:
210 psiconv_warn(lev+1,off,"Reading of MBM File failed");
211 if (res == 0)
212 return -PSICONV_E_NOMEM;
213 else
143 return res; 214 return res;
144} 215}
145 216
146int psiconv_parse_sketch_file(const psiconv_buffer buf,int lev, 217int psiconv_parse_sketch_file(const psiconv_buffer buf,int lev,
147 psiconv_u32 off, 218 psiconv_u32 off,
148 psiconv_sketch_f *result) 219 psiconv_sketch_f *result)
156 int i; 227 int i;
157 int res=0; 228 int res=0;
158 char *temp_str; 229 char *temp_str;
159 230
160 psiconv_progress(lev+1,off,"Going to read a sketch file"); 231 psiconv_progress(lev+1,off,"Going to read a sketch file");
161 *result = malloc(sizeof(**result)); 232 if (!(*result = malloc(sizeof(**result))))
233 goto ERROR1;
162 234
163 psiconv_progress(lev+2,off, 235 psiconv_progress(lev+2,off,
164 "Going to read the offset of the section table section"); 236 "Going to read the offset of the section table section");
165 sto = psiconv_read_u32(buf,lev+2,off); 237 sto = psiconv_read_u32(buf,lev+2,off,&res);
238 if (res)
239 goto ERROR2;
166 psiconv_debug(lev+2,off,"Offset: %08x",sto); 240 psiconv_debug(lev+2,off,"Offset: %08x",sto);
167 241
168 psiconv_progress(lev+2,sto, "Going to read the section table section"); 242 psiconv_progress(lev+2,sto, "Going to read the section table section");
169 res |= psiconv_parse_section_table_section(buf,lev+2,sto, NULL,&table); 243 if ((res = psiconv_parse_section_table_section(buf,lev+2,sto, NULL,&table)))
244 goto ERROR2;
170 245
171 for (i = 0; i < psiconv_list_length(table); i ++) { 246 for (i = 0; i < psiconv_list_length(table); i ++) {
172 psiconv_progress(lev+2,sto, "Going to read entry %d",i); 247 psiconv_progress(lev+2,sto, "Going to read entry %d",i);
173 entry = psiconv_list_get(table,i); 248 if (!(entry = psiconv_list_get(table,i)))
249 goto ERROR3;
174 if (entry->id == PSICONV_ID_APPL_ID_SECTION) { 250 if (entry->id == PSICONV_ID_APPL_ID_SECTION) {
175 applid_sec = entry->offset; 251 applid_sec = entry->offset;
176 psiconv_debug(lev+3,sto, 252 psiconv_debug(lev+3,sto,
177 "Found the Application ID section at %08x",applid_sec); 253 "Found the Application ID section at %08x",applid_sec);
178 } else if (entry->id == PSICONV_ID_SKETCH_SECTION) { 254 } else if (entry->id == PSICONV_ID_SKETCH_SECTION) {
179 sketch_sec = entry->offset; 255 sketch_sec = entry->offset;
180 psiconv_debug(lev+3,sto, 256 psiconv_debug(lev+3,sto,
181 "Found the Sketch section at %08x",sketch_sec); 257 "Found the Sketch section at %08x",sketch_sec);
182 } else { 258 } else {
183 psiconv_warn(lev+3,sto, 259 psiconv_warn(lev+3,sto,
184 "Found unknown section in the Section Table"); 260 "Found unknown section in the Section Table (ignoring)");
185 psiconv_debug(lev+3,sto, 261 psiconv_debug(lev+3,sto,
186 "Section ID %08x, offset %08x",entry->id,entry->offset); 262 "Section ID %08x, offset %08x",entry->id,entry->offset);
187 res = -1;
188 } 263 }
189 } 264 }
190 265
191 psiconv_progress(lev+2,sto, "Looking for the Application ID section"); 266 psiconv_progress(lev+2,sto, "Looking for the Application ID section");
192 if (! applid_sec) { 267 if (! applid_sec) {
193 psiconv_warn(lev+2,sto, 268 psiconv_warn(lev+2,sto,
194 "Application ID section not found in the section table"); 269 "Application ID section not found in the section table");
195 res = -1; 270 res = -PSICONV_E_PARSE;
271 goto ERROR3;
196 } else { 272 } else {
197 psiconv_debug(lev+2,sto, 273 psiconv_debug(lev+2,sto,
198 "Application ID section at offset %08x",applid_sec); 274 "Application ID section at offset %08x",applid_sec);
199 res |= psiconv_parse_application_id_section(buf,lev+2,applid_sec,NULL, 275 if ((res = psiconv_parse_application_id_section(buf,lev+2,applid_sec,NULL,
200 &appl_id); 276 &appl_id)))
277 goto ERROR3;
201 } 278 }
202 if ((appl_id->id != PSICONV_ID_SKETCH) || 279 if ((appl_id->id != PSICONV_ID_SKETCH) ||
203 strcmp(appl_id->name,"Paint.app")) { 280 strcmp(appl_id->name,"Paint.app")) {
204 psiconv_warn(lev+2,applid_sec, 281 psiconv_warn(lev+2,applid_sec,
205 "Application ID section contains unexpected data"); 282 "Application ID section contains unexpected data");
206 psiconv_debug(lev+2,applid_sec,"ID: %08x expected, %08x found", 283 psiconv_debug(lev+2,applid_sec,"ID: %08x expected, %08x found",
207 PSICONV_ID_SKETCH,appl_id->id); 284 PSICONV_ID_SKETCH,appl_id->id);
208 temp_str = psiconv_make_printable(appl_id->name); 285 if (!(temp_str = psiconv_make_printable(appl_id->name)))
286 goto ERROR4;
209 psiconv_debug(lev+2,applid_sec,"Name: `%s' expected, `%s' found", 287 psiconv_debug(lev+2,applid_sec,"Name: `%s' expected, `%s' found",
210 "Paint.app",temp_str); 288 "Paint.app",temp_str);
211 free(temp_str); 289 free(temp_str);
290 res = -PSICONV_E_PARSE;
291 goto ERROR4;
212 } 292 }
213 293
214 psiconv_progress(lev+2,sto, "Looking for the Sketch section"); 294 psiconv_progress(lev+2,sto, "Looking for the Sketch section");
215 if (! sketch_sec) { 295 if (! sketch_sec) {
216 psiconv_warn(lev+2,sto, 296 psiconv_warn(lev+2,sto,
217 "Sketch section not found in the section table"); 297 "Sketch section not found in the section table");
218 res = -1;
219 } else { 298 } else {
220 psiconv_debug(lev+2,sto, 299 psiconv_debug(lev+2,sto,
221 "Sketch section at offset %08x",applid_sec); 300 "Sketch section at offset %08x",applid_sec);
222 res |= psiconv_parse_sketch_section(buf,lev+2,sketch_sec,NULL,0, 301 if ((res = psiconv_parse_sketch_section(buf,lev+2,sketch_sec,NULL,0,
223 &(*result)->sketch_sec); 302 &(*result)->sketch_sec)))
303 goto ERROR4;
224 } 304 }
225 305
226 psiconv_free_application_id_section(appl_id); 306 psiconv_free_application_id_section(appl_id);
227 psiconv_free_section_table_section(table); 307 psiconv_free_section_table_section(table);
228 308
229 psiconv_progress(lev+1,off,"End of word file"); 309 psiconv_progress(lev+1,off,"End of word file");
230 return res; 310 return res;
311
312ERROR4:
313 psiconv_free_application_id_section(appl_id);
314ERROR3:
315 free(table);
316ERROR2:
317 free(*result);
318ERROR1:
319 psiconv_warn(lev+1,off,"Reading of Scketch File failed");
320 if (res == 0)
321 return -PSICONV_E_NOMEM;
322 else
323 return res;
231} 324}
232
233 325
234 326
235int psiconv_parse_texted_file(const psiconv_buffer buf,int lev, 327int psiconv_parse_texted_file(const psiconv_buffer buf,int lev,
236 psiconv_u32 off, 328 psiconv_u32 off,
237 psiconv_texted_f *result) 329 psiconv_texted_f *result)
248 psiconv_u32 sto; 340 psiconv_u32 sto;
249 psiconv_section_table_entry entry; 341 psiconv_section_table_entry entry;
250 int i; 342 int i;
251 343
252 psiconv_progress(lev+1,off,"Going to read a texted file"); 344 psiconv_progress(lev+1,off,"Going to read a texted file");
253 *result = malloc(sizeof(**result)); 345 if (!(*result = malloc(sizeof(**result))))
346 goto ERROR1;
254 347
255 psiconv_progress(lev+2,off, 348 psiconv_progress(lev+2,off,
256 "Going to read the offset of the section table section"); 349 "Going to read the offset of the section table section");
257 sto = psiconv_read_u32(buf,lev+2,off); 350 sto = psiconv_read_u32(buf,lev+2,off,&res);
351 if (res)
352 goto ERROR2;
258 psiconv_debug(lev+2,off,"Offset: %08x",sto); 353 psiconv_debug(lev+2,off,"Offset: %08x",sto);
259 354
260 psiconv_progress(lev+2,sto, "Going to read the section table section"); 355 psiconv_progress(lev+2,sto, "Going to read the section table section");
261 res |= psiconv_parse_section_table_section(buf,lev+2,sto, NULL,&table); 356 if ((res = psiconv_parse_section_table_section(buf,lev+2,sto, NULL,&table)))
357 goto ERROR2;
262 358
263 for (i = 0; i < psiconv_list_length(table); i ++) { 359 for (i = 0; i < psiconv_list_length(table); i ++) {
264 psiconv_progress(lev+2,sto, "Going to read entry %d",i); 360 psiconv_progress(lev+2,sto, "Going to read entry %d",i);
265 entry = psiconv_list_get(table,i); 361 if (!(entry = psiconv_list_get(table,i)))
362 goto ERROR3;
266 if (entry->id == PSICONV_ID_APPL_ID_SECTION) { 363 if (entry->id == PSICONV_ID_APPL_ID_SECTION) {
267 applid_sec = entry->offset; 364 applid_sec = entry->offset;
268 psiconv_debug(lev+3,sto, 365 psiconv_debug(lev+3,sto,
269 "Found the Application ID section at %08x",applid_sec); 366 "Found the Application ID section at %08x",applid_sec);
270 } else if (entry->id == PSICONV_ID_PAGE_LAYOUT_SECTION) { 367 } else if (entry->id == PSICONV_ID_PAGE_LAYOUT_SECTION) {
275 texted_sec = entry->offset; 372 texted_sec = entry->offset;
276 psiconv_debug(lev+3,sto, 373 psiconv_debug(lev+3,sto,
277 "Found the TextEd section at %08x",texted_sec); 374 "Found the TextEd section at %08x",texted_sec);
278 } else { 375 } else {
279 psiconv_warn(lev+3,sto, 376 psiconv_warn(lev+3,sto,
280 "Found unknown section in the Section Table"); 377 "Found unknown section in the Section Table (ignoring)");
281 psiconv_debug(lev+3,sto, 378 psiconv_debug(lev+3,sto,
282 "Section ID %08x, offset %08x",entry->id,entry->offset); 379 "Section ID %08x, offset %08x",entry->id,entry->offset);
283 res = -1;
284 } 380 }
285 } 381 }
286 382
287 psiconv_progress(lev+2,sto, "Looking for the Application ID section"); 383 psiconv_progress(lev+2,sto, "Looking for the Application ID section");
288 if (! applid_sec) { 384 if (! applid_sec) {
289 psiconv_warn(lev+2,sto, 385 psiconv_warn(lev+2,sto,
290 "Application ID section not found in the section table"); 386 "Application ID section not found in the section table");
291 res = -1; 387 res = -PSICONV_E_PARSE;
388 goto ERROR3;
292 } else { 389 } else {
293 psiconv_debug(lev+2,sto, 390 psiconv_debug(lev+2,sto,
294 "Application ID section at offset %08x",applid_sec); 391 "Application ID section at offset %08x",applid_sec);
295 res |= psiconv_parse_application_id_section(buf,lev+2,applid_sec,NULL, 392 if ((res = psiconv_parse_application_id_section(buf,lev+2,applid_sec,NULL,
296 &appl_id); 393 &appl_id)))
394 goto ERROR3;
297 } 395 }
298 if ((appl_id->id != PSICONV_ID_TEXTED) || 396 if ((appl_id->id != PSICONV_ID_TEXTED) ||
299 strcmp(appl_id->name,"TextEd.app")) { 397 strcmp(appl_id->name,"TextEd.app")) {
300 psiconv_warn(lev+2,applid_sec, 398 psiconv_warn(lev+2,applid_sec,
301 "Application ID section contains unexpected data"); 399 "Application ID section contains unexpected data");
302 psiconv_debug(lev+2,applid_sec,"ID: %08x expected, %08x found", 400 psiconv_debug(lev+2,applid_sec,"ID: %08x expected, %08x found",
303 PSICONV_ID_TEXTED,appl_id->id); 401 PSICONV_ID_TEXTED,appl_id->id);
304 temp_str = psiconv_make_printable(appl_id->name); 402 if (!(temp_str = psiconv_make_printable(appl_id->name)))
403 goto ERROR4;
305 psiconv_debug(lev+2,applid_sec,"Name: `%s' expected, `%s' found", 404 psiconv_debug(lev+2,applid_sec,"Name: `%s' expected, `%s' found",
306 "TextEd.app",temp_str); 405 "TextEd.app",temp_str);
307 free(temp_str); 406 free(temp_str);
407 res = -PSICONV_E_PARSE;
408 goto ERROR4;
308 } 409 }
309 410
310 psiconv_progress(lev+2,sto, 411 psiconv_progress(lev+2,sto,
311 "Looking for the Page layout section"); 412 "Looking for the Page layout section");
312 if (! page_sec) { 413 if (! page_sec) {
313 psiconv_warn(lev+2,sto, 414 psiconv_warn(lev+2,sto,
314 "Page layout section not found in the section table"); 415 "Page layout section not found in the section table");
315 (*result)->page_sec = NULL; 416 res = -PSICONV_E_PARSE;
316 res = -1; 417 goto ERROR4;
317 } else { 418 } else {
318 psiconv_debug(lev+2,sto, 419 psiconv_debug(lev+2,sto,
319 "Page layout section at offset %08x",page_sec); 420 "Page layout section at offset %08x",page_sec);
320 res |= psiconv_parse_page_layout_section(buf,lev+2,page_sec,NULL, 421 if ((res = psiconv_parse_page_layout_section(buf,lev+2,page_sec,NULL,
321 &(*result)->page_sec); 422 &(*result)->page_sec)))
423 goto ERROR4;
322 } 424 }
323 425
324 base_char = psiconv_basic_character_layout(); 426 if (!(base_char = psiconv_basic_character_layout()))
427 goto ERROR5;
325 base_para = psiconv_basic_paragraph_layout(); 428 if (!(base_para = psiconv_basic_paragraph_layout()))
429 goto ERROR6;
326 430
327 psiconv_progress(lev+2,sto, 431 psiconv_progress(lev+2,sto,
328 "Looking for the TextEd section"); 432 "Looking for the TextEd section");
329 if (! texted_sec) { 433 if (! texted_sec) {
330 psiconv_warn(lev+2,sto, 434 psiconv_warn(lev+2,sto,
331 "TextEd section not found in the section table"); 435 "TextEd section not found in the section table");
332 (*result)->texted_sec = NULL; 436 res = -PSICONV_E_PARSE;
333 res = -1; 437 goto ERROR7;
334 } else { 438 } else {
335 psiconv_debug(lev+2,sto, "TextEd section at offset %08x",texted_sec); 439 psiconv_debug(lev+2,sto, "TextEd section at offset %08x",texted_sec);
336 res |= psiconv_parse_texted_section(buf,lev+2,texted_sec,NULL, 440 if ((res = psiconv_parse_texted_section(buf,lev+2,texted_sec,NULL,
337 &(*result)->texted_sec, 441 &(*result)->texted_sec,
338 base_char,base_para); 442 base_char,base_para)))
443 goto ERROR7;
339 } 444 }
340 psiconv_free_character_layout(base_char); 445 psiconv_free_character_layout(base_char);
341 psiconv_free_paragraph_layout(base_para); 446 psiconv_free_paragraph_layout(base_para);
342 447
343 psiconv_free_application_id_section(appl_id); 448 psiconv_free_application_id_section(appl_id);
344 psiconv_free_section_table_section(table); 449 psiconv_free_section_table_section(table);
345 450
346 psiconv_progress(lev+1,off,"End of word file"); 451 psiconv_progress(lev+1,off,"End of TextEd file");
452 return 0;
453
454ERROR7:
455 psiconv_free_paragraph_layout(base_para);
456ERROR6:
457 psiconv_free_character_layout(base_char);
458ERROR5:
459 psiconv_free_page_layout_section((*result)->page_sec);
460ERROR4:
461 psiconv_free_application_id_section(appl_id);
462ERROR3:
463 psiconv_free_section_table_section(table);
464ERROR2:
465 free(*result);
466ERROR1:
467 psiconv_warn(lev+1,off,"Reading of TextEd File failed");
468 if (res == 0)
469 return -PSICONV_E_NOMEM;
470 else
347 return res; 471 return res;
348} 472}
349 473
350int psiconv_parse_word_file(const psiconv_buffer buf,int lev, psiconv_u32 off, 474int psiconv_parse_word_file(const psiconv_buffer buf,int lev, psiconv_u32 off,
351 psiconv_word_f *result) 475 psiconv_word_f *result)
352{ 476{
364 psiconv_section_table_entry entry; 488 psiconv_section_table_entry entry;
365 psiconv_u32 sto; 489 psiconv_u32 sto;
366 int i; 490 int i;
367 491
368 psiconv_progress(lev+1,off,"Going to read a word file"); 492 psiconv_progress(lev+1,off,"Going to read a word file");
369 *result = malloc(sizeof(**result)); 493 if (!(*result = malloc(sizeof(**result))))
494 goto ERROR1;
370 495
371 psiconv_progress(lev+2,off, 496 psiconv_progress(lev+2,off,
372 "Going to read the offset of the section table section"); 497 "Going to read the offset of the section table section");
373 sto = psiconv_read_u32(buf,lev+2,off); 498 sto = psiconv_read_u32(buf,lev+2,off,&res);
499 if (res)
500 goto ERROR2;
374 psiconv_debug(lev+2,off,"Offset: %08x",sto); 501 psiconv_debug(lev+2,off,"Offset: %08x",sto);
375 502
376 psiconv_progress(lev+2,sto, 503 psiconv_progress(lev+2,sto,
377 "Going to read the section table section"); 504 "Going to read the section table section");
378 res |= psiconv_parse_section_table_section(buf,lev+2,sto, NULL,&table); 505 if ((res = psiconv_parse_section_table_section(buf,lev+2,sto, NULL,&table)))
506 goto ERROR2;
379 507
380 for (i = 0; i < psiconv_list_length(table); i ++) { 508 for (i = 0; i < psiconv_list_length(table); i ++) {
381 psiconv_progress(lev+2,sto, "Going to read entry %d",i); 509 psiconv_progress(lev+2,sto, "Going to read entry %d",i);
382 entry = psiconv_list_get(table,i); 510 if (!(entry = psiconv_list_get(table,i)))
511 goto ERROR3;
383 if (entry->id == PSICONV_ID_APPL_ID_SECTION) { 512 if (entry->id == PSICONV_ID_APPL_ID_SECTION) {
384 applid_sec = entry->offset; 513 applid_sec = entry->offset;
385 psiconv_debug(lev+3,sto, 514 psiconv_debug(lev+3,sto,
386 "Found the Application ID section at %08x",applid_sec); 515 "Found the Application ID section at %08x",applid_sec);
387 } else if (entry->id == PSICONV_ID_PAGE_LAYOUT_SECTION) { 516 } else if (entry->id == PSICONV_ID_PAGE_LAYOUT_SECTION) {
395 pwd_sec = entry->offset; 524 pwd_sec = entry->offset;
396 psiconv_debug(lev+3,sto, 525 psiconv_debug(lev+3,sto,
397 "Found the Password section at %08x",pwd_sec); 526 "Found the Password section at %08x",pwd_sec);
398 psiconv_warn(lev+3,sto, 527 psiconv_warn(lev+3,sto,
399 "Password section found - can't read encrypted data"); 528 "Password section found - can't read encrypted data");
400 res = -1; 529 res = -PSICONV_E_PARSE;
530 goto ERROR3;
401 } else if (entry->id == PSICONV_ID_WORD_STATUS_SECTION) { 531 } else if (entry->id == PSICONV_ID_WORD_STATUS_SECTION) {
402 status_sec = entry->offset; 532 status_sec = entry->offset;
403 psiconv_debug(lev+3,sto, 533 psiconv_debug(lev+3,sto,
404 "Found the Word Status section at %08x",status_sec); 534 "Found the Word Status section at %08x",status_sec);
405 } else if (entry->id == PSICONV_ID_WORD_STYLES_SECTION) { 535 } else if (entry->id == PSICONV_ID_WORD_STYLES_SECTION) {
410 layout_sec = entry->offset; 540 layout_sec = entry->offset;
411 psiconv_debug(lev+3,sto, 541 psiconv_debug(lev+3,sto,
412 "Found the Layout section at %08x",layout_sec); 542 "Found the Layout section at %08x",layout_sec);
413 } else { 543 } else {
414 psiconv_warn(lev+3,sto, 544 psiconv_warn(lev+3,sto,
415 "Found unknown section in the Section Table"); 545 "Found unknown section in the Section Table (ignoring)");
416 psiconv_debug(lev+3,sto, 546 psiconv_debug(lev+3,sto,
417 "Section ID %08x, offset %08x",entry->id,entry->offset); 547 "Section ID %08x, offset %08x",entry->id,entry->offset);
418 res = -1;
419 } 548 }
420 } 549 }
421 550
422 551
423 psiconv_progress(lev+2,sto, 552 psiconv_progress(lev+2,sto,
424 "Looking for the Status section"); 553 "Looking for the Status section");
425 if (!status_sec) { 554 if (!status_sec) {
426 psiconv_warn(lev+2,sto, "Status section not found in the section table"); 555 psiconv_warn(lev+2,sto, "Status section not found in the section table");
427 res = -1; 556 res = -PSICONV_E_PARSE;
557 goto ERROR3;
428 } else { 558 } else {
429 psiconv_debug(lev+2,sto, "Status section at offset %08x",status_sec); 559 psiconv_debug(lev+2,sto, "Status section at offset %08x",status_sec);
430 res |= psiconv_parse_word_status_section(buf,lev+2,status_sec,NULL, 560 if ((res = psiconv_parse_word_status_section(buf,lev+2,status_sec,NULL,
431 &((*result)->status_sec)); 561 &((*result)->status_sec))))
562 goto ERROR3;
432 } 563 }
433 564
434 psiconv_progress(lev+2,sto, "Looking for the Application ID section"); 565 psiconv_progress(lev+2,sto, "Looking for the Application ID section");
435 if (! applid_sec) { 566 if (! applid_sec) {
436 psiconv_warn(lev+2,sto, 567 psiconv_warn(lev+2,sto,
437 "Application ID section not found in the section table"); 568 "Application ID section not found in the section table");
438 res = -1; 569 res = -PSICONV_E_PARSE;
570 goto ERROR4;
439 } else { 571 } else {
440 psiconv_debug(lev+2,sto, 572 psiconv_debug(lev+2,sto,
441 "Application ID section at offset %08x",applid_sec); 573 "Application ID section at offset %08x",applid_sec);
442 res |= psiconv_parse_application_id_section(buf,lev+2,applid_sec,NULL, 574 if ((res = psiconv_parse_application_id_section(buf,lev+2,applid_sec,NULL,
443 &appl_id); 575 &appl_id)))
576 goto ERROR4;
444 } 577 }
445 if ((appl_id->id != PSICONV_ID_WORD) || 578 if ((appl_id->id != PSICONV_ID_WORD) ||
446 strcmp(appl_id->name,"Word.app")) { 579 strcmp(appl_id->name,"Word.app")) {
447 psiconv_warn(lev+2,applid_sec, 580 psiconv_warn(lev+2,applid_sec,
448 "Application ID section contains unexpected data"); 581 "Application ID section contains unexpected data");
449 psiconv_debug(lev+2,applid_sec,"ID: %08x expected, %08x found", 582 psiconv_debug(lev+2,applid_sec,"ID: %08x expected, %08x found",
450 PSICONV_ID_WORD,appl_id->id); 583 PSICONV_ID_WORD,appl_id->id);
451 temp_str = psiconv_make_printable(appl_id->name); 584 if (!(temp_str = psiconv_make_printable(appl_id->name)))
585 goto ERROR5;
452 psiconv_debug(lev+2,applid_sec,"Name: `%s' expected, `%s' found", 586 psiconv_debug(lev+2,applid_sec,"Name: `%s' expected, `%s' found",
453 "Word.app",temp_str); 587 "Word.app",temp_str);
454 free(temp_str); 588 free(temp_str);
589 res = -PSICONV_E_PARSE;
590 goto ERROR5;
455 } 591 }
456 592
457 psiconv_progress(lev+2,sto, 593 psiconv_progress(lev+2,sto,
458 "Looking for the Page layout section"); 594 "Looking for the Page layout section");
459 if (! page_sec) { 595 if (! page_sec) {
460 psiconv_warn(lev+2,sto, 596 psiconv_warn(lev+2,sto,
461 "Page layout section not found in the section table"); 597 "Page layout section not found in the section table");
462 (*result)->page_sec = NULL; 598 res = -PSICONV_E_PARSE;
463 res = -1; 599 goto ERROR5;
464 } else { 600 } else {
465 psiconv_debug(lev+2,sto, 601 psiconv_debug(lev+2,sto,
466 "Page layout section at offset %08x",page_sec); 602 "Page layout section at offset %08x",page_sec);
467 res |= psiconv_parse_page_layout_section(buf,lev+2,page_sec,NULL, 603 if ((res = psiconv_parse_page_layout_section(buf,lev+2,page_sec,NULL,
468 &(*result)->page_sec); 604 &(*result)->page_sec)))
605 goto ERROR5;
469 } 606 }
470 607
471 psiconv_progress(lev+2,sto, 608 psiconv_progress(lev+2,sto,
472 "Looking for the Word Style section"); 609 "Looking for the Word Style section");
473 if (!styles_sec) { 610 if (!styles_sec) {
474 psiconv_warn(lev+2,sto, 611 psiconv_warn(lev+2,sto,
475 "Word styles section not found in the section table"); 612 "Word styles section not found in the section table");
476 (*result)->styles_sec = NULL; 613 res = -PSICONV_E_PARSE;
477 res = -1; 614 goto ERROR6;
478 } else { 615 } else {
479 psiconv_debug(lev+2,sto, 616 psiconv_debug(lev+2,sto,
480 "Word styles section at offset %08x",styles_sec); 617 "Word styles section at offset %08x",styles_sec);
481 res |= psiconv_parse_word_styles_section(buf,lev+2,styles_sec,NULL, 618 if ((res = psiconv_parse_word_styles_section(buf,lev+2,styles_sec,NULL,
482 &(*result)->styles_sec); 619 &(*result)->styles_sec)))
620 goto ERROR6;
483 } 621 }
484 622
485 psiconv_progress(lev+2,sto, 623 psiconv_progress(lev+2,sto,
486 "Looking for the Text section"); 624 "Looking for the Text section");
487 if (!text_sec) { 625 if (!text_sec) {
488 psiconv_warn(lev+2,sto, "Text section not found in the section table"); 626 psiconv_warn(lev+2,sto, "Text section not found in the section table");
489 (*result)->paragraphs = NULL; 627 res = -PSICONV_E_PARSE;
490 res = -1; 628 goto ERROR7;
491 } else { 629 } else {
492 psiconv_debug(lev+2,sto, 630 psiconv_debug(lev+2,sto,
493 "Text section at offset %08x",text_sec); 631 "Text section at offset %08x",text_sec);
494 res |= psiconv_parse_text_section(buf,lev+2,text_sec,NULL, 632 if ((res = psiconv_parse_text_section(buf,lev+2,text_sec,NULL,
495 &(*result)->paragraphs); 633 &(*result)->paragraphs)))
634 goto ERROR7;
496 } 635 }
497 636
498 if (((*result)->paragraphs) && ((*result)->styles_sec)) { 637 psiconv_progress(lev+2,sto, "Looking for the Layout section");
499 psiconv_progress(lev+2,sto,
500 "Looking for the Layout section");
501 if (!layout_sec) { 638 if (!layout_sec) {
639 psiconv_debug(lev+2,sto, "No layout section today");
640 } else {
502 psiconv_debug(lev+2,sto, 641 psiconv_debug(lev+2,sto,
503 "Layout section not found in the section table");
504 res = -1;
505 } else {
506 psiconv_debug(lev+2,sto,
507 "Layout section at offset %08x",layout_sec); 642 "Layout section at offset %08x",layout_sec);
508 res |= psiconv_parse_styled_layout_section(buf,lev+2,layout_sec,NULL, 643 if ((res = psiconv_parse_styled_layout_section(buf,lev+2,layout_sec,NULL,
509 (*result)->paragraphs, 644 (*result)->paragraphs,
510 (*result)->styles_sec); 645 (*result)->styles_sec)))
646 goto ERROR8;
511 } 647 }
512 } else
513 psiconv_debug(lev+2,sto,
514 "Skipping search for Layout section, as either the "
515 "text or the word styles section was not found");
516 648
517 psiconv_free_application_id_section(appl_id); 649 psiconv_free_application_id_section(appl_id);
518 psiconv_free_section_table_section(table); 650 psiconv_free_section_table_section(table);
519 651
520 psiconv_progress(lev+1,off,"End of word file"); 652 psiconv_progress(lev+1,off,"End of word file");
653 return 0;
654
655
656ERROR8:
657 psiconv_free_text_and_layout((*result)->paragraphs);
658ERROR7:
659 psiconv_free_word_styles_section((*result)->styles_sec);
660ERROR6:
661 psiconv_free_page_layout_section((*result)->page_sec);
662ERROR5:
663 psiconv_free_application_id_section(appl_id);
664ERROR4:
665 psiconv_free_word_status_section((*result)->status_sec);
666ERROR3:
667 psiconv_free_section_table_section(table);
668ERROR2:
669 free(*result);
670ERROR1:
671 psiconv_warn(lev+1,off,"Reading of Word File failed");
672 if (res == 0)
673 return -PSICONV_E_NOMEM;
674 else
521 return res; 675 return res;
522} 676}
677
678int psiconv_parse_sheet_file(const psiconv_buffer buf,int lev, psiconv_u32 off,
679 psiconv_sheet_f *result)
680{
681 int res=0;
682 psiconv_section_table_section table;
683 psiconv_application_id_section appl_id;
684 char *temp_str;
685 psiconv_u32 pwd_sec = 0;
686 psiconv_u32 status_sec = 0;
687 psiconv_u32 page_sec = 0;
688 psiconv_u32 applid_sec = 0;
689 psiconv_u32 workbook_sec = 0;
690 psiconv_section_table_entry entry;
691 psiconv_u32 sto;
692 int i;
693
694 psiconv_progress(lev+1,off,"Going to read a sheet file");
695 if (!(*result = malloc(sizeof(**result))))
696 goto ERROR1;
697
698 psiconv_progress(lev+2,off,
699 "Going to read the offset of the section table section");
700 sto = psiconv_read_u32(buf,lev+2,off,&res);
701 if (res)
702 goto ERROR2;
703 psiconv_debug(lev+2,off,"Offset: %08x",sto);
704
705 psiconv_progress(lev+2,sto,
706 "Going to read the section table section");
707 if ((res = psiconv_parse_section_table_section(buf,lev+2,sto, NULL,&table)))
708 goto ERROR2;
709
710 for (i = 0; i < psiconv_list_length(table); i ++) {
711 psiconv_progress(lev+2,sto, "Going to read entry %d",i);
712 if (!(entry = psiconv_list_get(table,i)))
713 goto ERROR3;
714 if (entry->id == PSICONV_ID_APPL_ID_SECTION) {
715 applid_sec = entry->offset;
716 psiconv_debug(lev+3,sto,
717 "Found the Application ID section at %08x",applid_sec);
718 } else if (entry->id == PSICONV_ID_PAGE_LAYOUT_SECTION) {
719 page_sec = entry->offset;
720 psiconv_debug(lev+3,sto,
721 "Found the Page Layout section at %08x",page_sec);
722 } else if (entry->id == PSICONV_ID_PASSWORD_SECTION) {
723 pwd_sec = entry->offset;
724 psiconv_debug(lev+3,sto,
725 "Found the Password section at %08x",pwd_sec);
726 psiconv_warn(lev+3,sto,
727 "Password section found - can't read encrypted data");
728 res = -PSICONV_E_PARSE;
729 goto ERROR3;
730 } else if (entry->id == PSICONV_ID_SHEET_WORKBOOK_SECTION) {
731 workbook_sec = entry->offset;
732 psiconv_debug(lev+3,sto,
733 "Found the Sheet Workbook section at %08x",workbook_sec);
734 } else if (entry->id == PSICONV_ID_SHEET_STATUS_SECTION) {
735 status_sec = entry->offset;
736 psiconv_debug(lev+3,sto,
737 "Found the Sheet Status section at %08x",status_sec);
738 } else {
739 psiconv_warn(lev+3,sto,
740 "Found unknown section in the Section Table (ignoring)");
741 psiconv_debug(lev+3,sto,
742 "Section ID %08x, offset %08x",entry->id,entry->offset);
743 }
744 }
745
746
747 psiconv_progress(lev+2,sto,
748 "Looking for the Status section");
749 if (!status_sec) {
750 psiconv_warn(lev+2,sto, "Status section not found in the section table");
751 res = -PSICONV_E_PARSE;
752 goto ERROR3;
753 } else {
754 psiconv_debug(lev+2,sto, "Status section at offset %08x",status_sec);
755 if ((res = psiconv_parse_sheet_status_section(buf,lev+2,status_sec,NULL,
756 &((*result)->status_sec))))
757 goto ERROR3;
758 }
759
760 psiconv_progress(lev+2,sto, "Looking for the Application ID section");
761 if (! applid_sec) {
762 psiconv_warn(lev+2,sto,
763 "Application ID section not found in the section table");
764 res = -PSICONV_E_PARSE;
765 goto ERROR4;
766 } else {
767 psiconv_debug(lev+2,sto,
768 "Application ID section at offset %08x",applid_sec);
769 if ((res = psiconv_parse_application_id_section(buf,lev+2,applid_sec,NULL,
770 &appl_id)))
771 goto ERROR4;
772 }
773 if ((appl_id->id != PSICONV_ID_SHEET) ||
774 strcmp(appl_id->name,"Sheet.app")) {
775 psiconv_warn(lev+2,applid_sec,
776 "Application ID section contains unexpected data");
777 psiconv_debug(lev+2,applid_sec,"ID: %08x expected, %08x found",
778 PSICONV_ID_SHEET,appl_id->id);
779 if (!(temp_str = psiconv_make_printable(appl_id->name)))
780 goto ERROR5;
781 psiconv_debug(lev+2,applid_sec,"Name: `%s' expected, `%s' found",
782 "Sheet.app",temp_str);
783 free(temp_str);
784 res = -PSICONV_E_PARSE;
785 goto ERROR5;
786 }
787
788 psiconv_progress(lev+2,sto,
789 "Looking for the Page layout section");
790 if (! page_sec) {
791 psiconv_warn(lev+2,sto,
792 "Page layout section not found in the section table");
793 res = -PSICONV_E_PARSE;
794 goto ERROR5;
795 } else {
796 psiconv_debug(lev+2,sto,
797 "Page layout section at offset %08x",page_sec);
798 if ((res = psiconv_parse_page_layout_section(buf,lev+2,page_sec,NULL,
799 &(*result)->page_sec)))
800 goto ERROR5;
801 }
802
803 psiconv_progress(lev+2,sto,
804 "Looking for the Sheet Workbook section");
805 if (! workbook_sec) {
806 psiconv_warn(lev+2,sto,
807 "Sheet workbook section not found in the section table");
808 res = -PSICONV_E_PARSE;
809 goto ERROR6;
810 } else {
811 psiconv_debug(lev+2,sto,
812 "Sheet workbook section at offset %08x",page_sec);
813 if ((res = psiconv_parse_sheet_workbook_section(buf,lev+2,workbook_sec,NULL,
814 &(*result)->workbook_sec)))
815 goto ERROR6;
816 }
817
818 psiconv_free_application_id_section(appl_id);
819 psiconv_free_section_table_section(table);
820
821 psiconv_progress(lev+1,off,"End of Sheet file");
822 return 0;
823
824ERROR6:
825 psiconv_free_page_layout_section((*result)->page_sec);
826ERROR5:
827 psiconv_free_application_id_section(appl_id);
828ERROR4:
829 psiconv_free_sheet_status_section((*result)->status_sec);
830ERROR3:
831 psiconv_free_section_table_section(table);
832ERROR2:
833 free(*result);
834ERROR1:
835 psiconv_warn(lev+1,off,"Reading of Sheet File failed");
836 if (res == 0)
837 return -PSICONV_E_NOMEM;
838 else
839 return res;
840}

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

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