/[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 170 Revision 208
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, 2000 Frodo Looijaard <frodol@dds.nl> 3 Copyright (c) 1999-2004 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.
23#include <stdlib.h> 23#include <stdlib.h>
24#include <string.h> 24#include <string.h>
25 25
26#include "parse.h" 26#include "parse.h"
27#include "parse_routines.h" 27#include "parse_routines.h"
28#include "unicode.h"
28 29
29#ifdef DMALLOC 30#ifdef DMALLOC
30#include <dmalloc.h> 31#include <dmalloc.h>
31#endif 32#endif
32 33
34static psiconv_ucs2 unicode_paint[10] = { 'P','a','i','n','t','.','a','p','p',0 };
35static psiconv_ucs2 unicode_texted[11] ={ 'T','e','x','t','E','d','.','a','p','p',0 };
36static psiconv_ucs2 unicode_word[9] = { 'W','o','r','d','.','a','p','p',0 };
37static psiconv_ucs2 unicode_sheet[10] = { 'S','h','e','e','t','.','a','p','p',0 };
33 38
34psiconv_file_type_t psiconv_file_type(const psiconv_config config, 39psiconv_file_type_t psiconv_file_type(const psiconv_config config,
35 psiconv_buffer buf,int *length, 40 psiconv_buffer buf,int *length,
36 psiconv_header_section *result) 41 psiconv_header_section *result)
37{ 42{
93 return 0; 98 return 0;
94 99
95ERROR2: 100ERROR2:
96 free(*result); 101 free(*result);
97ERROR1: 102ERROR1:
98 psiconv_warn(config,lev+1,off,"Reading of Psion File failed"); 103 psiconv_error(config,lev+1,off,"Reading of Psion File failed");
99 if (res == 0) 104 if (res == 0)
100 return -PSICONV_E_NOMEM; 105 return -PSICONV_E_NOMEM;
101 else 106 else
102 return res; 107 return res;
103} 108}
129 psiconv_progress(config,lev+3,off,"Going to read clipart section %i",i); 134 psiconv_progress(config,lev+3,off,"Going to read clipart section %i",i);
130 if ((res = psiconv_parse_clipart_section(config,buf,lev+3,*entry,NULL,&clipart))) 135 if ((res = psiconv_parse_clipart_section(config,buf,lev+3,*entry,NULL,&clipart)))
131 goto ERROR4; 136 goto ERROR4;
132 if ((res = psiconv_list_add((*result)->sections,clipart))) 137 if ((res = psiconv_list_add((*result)->sections,clipart)))
133 goto ERROR5; 138 goto ERROR5;
139 free(clipart);
134 } 140 }
135 141
136 psiconv_free_jumptable_section(table); 142 psiconv_free_jumptable_section(table);
137 psiconv_progress(config,lev+1,off,"End of clipart file"); 143 psiconv_progress(config,lev+1,off,"End of clipart file");
138 return res; 144 return res;
139ERROR5: 145ERROR5:
140 psiconv_free_clipart_section(clipart); 146 psiconv_free_clipart_section(clipart);
141ERROR4: 147ERROR4:
142 for (i = 0; i < psiconv_list_length((*result)->sections); i++) { 148 for (i = 0; i < psiconv_list_length((*result)->sections); i++) {
143 if (!(clipart = psiconv_list_get((*result)->sections,i))) { 149 if (!(clipart = psiconv_list_get((*result)->sections,i))) {
144 psiconv_warn(config,lev+1,off,"Massive memory corruption"); 150 psiconv_error(config,lev+1,off,"Massive memory corruption");
145 goto ERROR3; 151 goto ERROR3;
146 } 152 }
147 psiconv_free_clipart_section(clipart); 153 psiconv_free_clipart_section(clipart);
148 } 154 }
149 psiconv_list_free((*result)->sections); 155 psiconv_list_free((*result)->sections);
150ERROR3: 156ERROR3:
151 psiconv_free_jumptable_section(table); 157 psiconv_free_jumptable_section(table);
152ERROR2: 158ERROR2:
153 free(*result); 159 free(*result);
154ERROR1: 160ERROR1:
155 psiconv_warn(config,lev+1,off,"Reading of Clipart File failed"); 161 psiconv_error(config,lev+1,off,"Reading of Clipart File failed");
156 if (res == 0) 162 if (res == 0)
157 return -PSICONV_E_NOMEM; 163 return -PSICONV_E_NOMEM;
158 else 164 else
159 return res; 165 return res;
160} 166}
194 if ((res = psiconv_parse_paint_data_section(config,buf,lev+3,*entry,NULL, 200 if ((res = psiconv_parse_paint_data_section(config,buf,lev+3,*entry,NULL,
195 0,&paint))) 201 0,&paint)))
196 goto ERROR4; 202 goto ERROR4;
197 if ((res = psiconv_list_add((*result)->sections,paint))) 203 if ((res = psiconv_list_add((*result)->sections,paint)))
198 goto ERROR5; 204 goto ERROR5;
205 free(paint);
199 } 206 }
200 207
201 psiconv_free_jumptable_section(table); 208 psiconv_free_jumptable_section(table);
202 psiconv_progress(config,lev+1,off,"End of mbm file"); 209 psiconv_progress(config,lev+1,off,"End of mbm file");
203 return 0; 210 return 0;
204ERROR5: 211ERROR5:
205 psiconv_free_paint_data_section(paint); 212 psiconv_free_paint_data_section(paint);
206ERROR4: 213ERROR4:
207 for (i = 0; i < psiconv_list_length((*result)->sections); i++) { 214 for (i = 0; i < psiconv_list_length((*result)->sections); i++) {
208 if (!(paint = psiconv_list_get((*result)->sections,i))) { 215 if (!(paint = psiconv_list_get((*result)->sections,i))) {
209 psiconv_warn(config,lev+1,off,"Massive memory corruption"); 216 psiconv_error(config,lev+1,off,"Massive memory corruption");
210 goto ERROR3; 217 goto ERROR3;
211 } 218 }
212 psiconv_free_paint_data_section(paint); 219 psiconv_free_paint_data_section(paint);
213 } 220 }
214 psiconv_list_free((*result)->sections); 221 psiconv_list_free((*result)->sections);
215ERROR3: 222ERROR3:
216 psiconv_free_jumptable_section(table); 223 psiconv_free_jumptable_section(table);
217ERROR2: 224ERROR2:
218 free(*result); 225 free(*result);
219ERROR1: 226ERROR1:
220 psiconv_warn(config,lev+1,off,"Reading of MBM File failed"); 227 psiconv_error(config,lev+1,off,"Reading of MBM File failed");
221 if (res == 0) 228 if (res == 0)
222 return -PSICONV_E_NOMEM; 229 return -PSICONV_E_NOMEM;
223 else 230 else
224 return res; 231 return res;
225} 232}
274 } 281 }
275 } 282 }
276 283
277 psiconv_progress(config,lev+2,sto, "Looking for the Application ID section"); 284 psiconv_progress(config,lev+2,sto, "Looking for the Application ID section");
278 if (! applid_sec) { 285 if (! applid_sec) {
279 psiconv_warn(config,lev+2,sto, 286 psiconv_error(config,lev+2,sto,
280 "Application ID section not found in the section table"); 287 "Application ID section not found in the section table");
281 res = -PSICONV_E_PARSE; 288 res = -PSICONV_E_PARSE;
282 goto ERROR3; 289 goto ERROR3;
283 } else { 290 } else {
284 psiconv_debug(config,lev+2,sto, 291 psiconv_debug(config,lev+2,sto,
286 if ((res = psiconv_parse_application_id_section(config,buf,lev+2,applid_sec,NULL, 293 if ((res = psiconv_parse_application_id_section(config,buf,lev+2,applid_sec,NULL,
287 &appl_id))) 294 &appl_id)))
288 goto ERROR3; 295 goto ERROR3;
289 } 296 }
290 if ((appl_id->id != PSICONV_ID_SKETCH) || 297 if ((appl_id->id != PSICONV_ID_SKETCH) ||
291 strcmp(appl_id->name,"Paint.app")) { 298 psiconv_unicode_strcmp(appl_id->name,unicode_paint)) {
292 psiconv_warn(config,lev+2,applid_sec, 299 psiconv_warn(config,lev+2,applid_sec,
293 "Application ID section contains unexpected data"); 300 "Application ID section contains unexpected data");
294 psiconv_debug(config,lev+2,applid_sec,"ID: %08x expected, %08x found", 301 psiconv_debug(config,lev+2,applid_sec,"ID: %08x expected, %08x found",
295 PSICONV_ID_SKETCH,appl_id->id); 302 PSICONV_ID_SKETCH,appl_id->id);
296 if (!(temp_str = psiconv_make_printable(appl_id->name))) 303 if (!(temp_str = psiconv_make_printable(config,appl_id->name)))
297 goto ERROR4; 304 goto ERROR4;
298 psiconv_debug(config,lev+2,applid_sec,"Name: `%s' expected, `%s' found", 305 psiconv_debug(config,lev+2,applid_sec,"Name: `%s' expected, `%s' found",
299 "Paint.app",temp_str); 306 "Paint.app",temp_str);
300 free(temp_str); 307 free(temp_str);
301 res = -PSICONV_E_PARSE; 308 res = -PSICONV_E_PARSE;
325ERROR3: 332ERROR3:
326 free(table); 333 free(table);
327ERROR2: 334ERROR2:
328 free(*result); 335 free(*result);
329ERROR1: 336ERROR1:
330 psiconv_warn(config,lev+1,off,"Reading of Sketch File failed"); 337 psiconv_error(config,lev+1,off,"Reading of Sketch File failed");
331 if (res == 0) 338 if (res == 0)
332 return -PSICONV_E_NOMEM; 339 return -PSICONV_E_NOMEM;
333 else 340 else
334 return res; 341 return res;
335} 342}
392 } 399 }
393 } 400 }
394 401
395 psiconv_progress(config,lev+2,sto, "Looking for the Application ID section"); 402 psiconv_progress(config,lev+2,sto, "Looking for the Application ID section");
396 if (! applid_sec) { 403 if (! applid_sec) {
397 psiconv_warn(config,lev+2,sto, 404 psiconv_error(config,lev+2,sto,
398 "Application ID section not found in the section table"); 405 "Application ID section not found in the section table");
399 res = -PSICONV_E_PARSE; 406 res = -PSICONV_E_PARSE;
400 goto ERROR3; 407 goto ERROR3;
401 } else { 408 } else {
402 psiconv_debug(config,lev+2,sto, 409 psiconv_debug(config,lev+2,sto,
403 "Application ID section at offset %08x",applid_sec); 410 "Application ID section at offset %08x",applid_sec);
404 if ((res = psiconv_parse_application_id_section(config,buf,lev+2,applid_sec,NULL, 411 if ((res = psiconv_parse_application_id_section(config,buf,lev+2,applid_sec,NULL,
405 &appl_id))) 412 &appl_id)))
406 goto ERROR3; 413 goto ERROR3;
407 } 414 }
415
408 if ((appl_id->id != PSICONV_ID_TEXTED) || 416 if ((appl_id->id != PSICONV_ID_TEXTED) ||
409 strcmp(appl_id->name,"TextEd.app")) { 417 psiconv_unicode_strcmp(appl_id->name,unicode_texted)) {
410 psiconv_warn(config,lev+2,applid_sec, 418 psiconv_warn(config,lev+2,applid_sec,
411 "Application ID section contains unexpected data"); 419 "Application ID section contains unexpected data");
412 psiconv_debug(config,lev+2,applid_sec,"ID: %08x expected, %08x found", 420 psiconv_debug(config,lev+2,applid_sec,"ID: %08x expected, %08x found",
413 PSICONV_ID_TEXTED,appl_id->id); 421 PSICONV_ID_TEXTED,appl_id->id);
414 if (!(temp_str = psiconv_make_printable(appl_id->name))) 422 if (!(temp_str = psiconv_make_printable(config,appl_id->name)))
415 goto ERROR4; 423 goto ERROR4;
416 psiconv_debug(config,lev+2,applid_sec,"Name: `%s' expected, `%s' found", 424 psiconv_debug(config,lev+2,applid_sec,"Name: `%s' expected, `%s' found",
417 "TextEd.app",temp_str); 425 "TextEd.app",temp_str);
418 free(temp_str); 426 free(temp_str);
419 res = -PSICONV_E_PARSE; 427 res = -PSICONV_E_PARSE;
421 } 429 }
422 430
423 psiconv_progress(config,lev+2,sto, 431 psiconv_progress(config,lev+2,sto,
424 "Looking for the Page layout section"); 432 "Looking for the Page layout section");
425 if (! page_sec) { 433 if (! page_sec) {
426 psiconv_warn(config,lev+2,sto, 434 psiconv_error(config,lev+2,sto,
427 "Page layout section not found in the section table"); 435 "Page layout section not found in the section table");
428 res = -PSICONV_E_PARSE; 436 res = -PSICONV_E_PARSE;
429 goto ERROR4; 437 goto ERROR4;
430 } else { 438 } else {
431 psiconv_debug(config,lev+2,sto, 439 psiconv_debug(config,lev+2,sto,
441 goto ERROR6; 449 goto ERROR6;
442 450
443 psiconv_progress(config,lev+2,sto, 451 psiconv_progress(config,lev+2,sto,
444 "Looking for the TextEd section"); 452 "Looking for the TextEd section");
445 if (! texted_sec) { 453 if (! texted_sec) {
446 psiconv_warn(config,lev+2,sto, 454 psiconv_error(config,lev+2,sto,
447 "TextEd section not found in the section table"); 455 "TextEd section not found in the section table");
448 res = -PSICONV_E_PARSE; 456 res = -PSICONV_E_PARSE;
449 goto ERROR7; 457 goto ERROR7;
450 } else { 458 } else {
451 psiconv_debug(config,lev+2,sto, "TextEd section at offset %08x",texted_sec); 459 psiconv_debug(config,lev+2,sto, "TextEd section at offset %08x",texted_sec);
474ERROR3: 482ERROR3:
475 psiconv_free_section_table_section(table); 483 psiconv_free_section_table_section(table);
476ERROR2: 484ERROR2:
477 free(*result); 485 free(*result);
478ERROR1: 486ERROR1:
479 psiconv_warn(config,lev+1,off,"Reading of TextEd File failed"); 487 psiconv_error(config,lev+1,off,"Reading of TextEd File failed");
480 if (res == 0) 488 if (res == 0)
481 return -PSICONV_E_NOMEM; 489 return -PSICONV_E_NOMEM;
482 else 490 else
483 return res; 491 return res;
484} 492}
535 psiconv_debug(config,lev+3,sto, "Found the Text section at %08x",text_sec); 543 psiconv_debug(config,lev+3,sto, "Found the Text section at %08x",text_sec);
536 } else if (entry->id == PSICONV_ID_PASSWORD_SECTION) { 544 } else if (entry->id == PSICONV_ID_PASSWORD_SECTION) {
537 pwd_sec = entry->offset; 545 pwd_sec = entry->offset;
538 psiconv_debug(config,lev+3,sto, 546 psiconv_debug(config,lev+3,sto,
539 "Found the Password section at %08x",pwd_sec); 547 "Found the Password section at %08x",pwd_sec);
540 psiconv_warn(config,lev+3,sto, 548 psiconv_error(config,lev+3,sto,
541 "Password section found - can't read encrypted data"); 549 "Password section found - can't read encrypted data");
542 res = -PSICONV_E_PARSE; 550 res = -PSICONV_E_PARSE;
543 goto ERROR3; 551 goto ERROR3;
544 } else if (entry->id == PSICONV_ID_WORD_STATUS_SECTION) { 552 } else if (entry->id == PSICONV_ID_WORD_STATUS_SECTION) {
545 status_sec = entry->offset; 553 status_sec = entry->offset;
563 571
564 572
565 psiconv_progress(config,lev+2,sto, 573 psiconv_progress(config,lev+2,sto,
566 "Looking for the Status section"); 574 "Looking for the Status section");
567 if (!status_sec) { 575 if (!status_sec) {
568 psiconv_warn(config,lev+2,sto, "Status section not found in the section table"); 576 psiconv_error(config,lev+2,sto, "Status section not found in the section table");
569 res = -PSICONV_E_PARSE; 577 res = -PSICONV_E_PARSE;
570 goto ERROR3; 578 goto ERROR3;
571 } else { 579 } else {
572 psiconv_debug(config,lev+2,sto, "Status section at offset %08x",status_sec); 580 psiconv_debug(config,lev+2,sto, "Status section at offset %08x",status_sec);
573 if ((res = psiconv_parse_word_status_section(config,buf,lev+2,status_sec,NULL, 581 if ((res = psiconv_parse_word_status_section(config,buf,lev+2,status_sec,NULL,
575 goto ERROR3; 583 goto ERROR3;
576 } 584 }
577 585
578 psiconv_progress(config,lev+2,sto, "Looking for the Application ID section"); 586 psiconv_progress(config,lev+2,sto, "Looking for the Application ID section");
579 if (! applid_sec) { 587 if (! applid_sec) {
580 psiconv_warn(config,lev+2,sto, 588 psiconv_error(config,lev+2,sto,
581 "Application ID section not found in the section table"); 589 "Application ID section not found in the section table");
582 res = -PSICONV_E_PARSE; 590 res = -PSICONV_E_PARSE;
583 goto ERROR4; 591 goto ERROR4;
584 } else { 592 } else {
585 psiconv_debug(config,lev+2,sto, 593 psiconv_debug(config,lev+2,sto,
587 if ((res = psiconv_parse_application_id_section(config,buf,lev+2,applid_sec,NULL, 595 if ((res = psiconv_parse_application_id_section(config,buf,lev+2,applid_sec,NULL,
588 &appl_id))) 596 &appl_id)))
589 goto ERROR4; 597 goto ERROR4;
590 } 598 }
591 if ((appl_id->id != PSICONV_ID_WORD) || 599 if ((appl_id->id != PSICONV_ID_WORD) ||
592 strcmp(appl_id->name,"Word.app")) { 600 psiconv_unicode_strcmp(appl_id->name,unicode_word)) {
593 psiconv_warn(config,lev+2,applid_sec, 601 psiconv_warn(config,lev+2,applid_sec,
594 "Application ID section contains unexpected data"); 602 "Application ID section contains unexpected data");
595 psiconv_debug(config,lev+2,applid_sec,"ID: %08x expected, %08x found", 603 psiconv_debug(config,lev+2,applid_sec,"ID: %08x expected, %08x found",
596 PSICONV_ID_WORD,appl_id->id); 604 PSICONV_ID_WORD,appl_id->id);
597 if (!(temp_str = psiconv_make_printable(appl_id->name))) 605 if (!(temp_str = psiconv_make_printable(config,appl_id->name)))
598 goto ERROR5; 606 goto ERROR5;
599 psiconv_debug(config,lev+2,applid_sec,"Name: `%s' expected, `%s' found", 607 psiconv_debug(config,lev+2,applid_sec,"Name: `%s' expected, `%s' found",
600 "Word.app",temp_str); 608 "Word.app",temp_str);
601 free(temp_str); 609 free(temp_str);
602 res = -PSICONV_E_PARSE; 610 res = -PSICONV_E_PARSE;
604 } 612 }
605 613
606 psiconv_progress(config,lev+2,sto, 614 psiconv_progress(config,lev+2,sto,
607 "Looking for the Page layout section"); 615 "Looking for the Page layout section");
608 if (! page_sec) { 616 if (! page_sec) {
609 psiconv_warn(config,lev+2,sto, 617 psiconv_error(config,lev+2,sto,
610 "Page layout section not found in the section table"); 618 "Page layout section not found in the section table");
611 res = -PSICONV_E_PARSE; 619 res = -PSICONV_E_PARSE;
612 goto ERROR5; 620 goto ERROR5;
613 } else { 621 } else {
614 psiconv_debug(config,lev+2,sto, 622 psiconv_debug(config,lev+2,sto,
619 } 627 }
620 628
621 psiconv_progress(config,lev+2,sto, 629 psiconv_progress(config,lev+2,sto,
622 "Looking for the Word Style section"); 630 "Looking for the Word Style section");
623 if (!styles_sec) { 631 if (!styles_sec) {
624 psiconv_warn(config,lev+2,sto, 632 psiconv_error(config,lev+2,sto,
625 "Word styles section not found in the section table"); 633 "Word styles section not found in the section table");
626 res = -PSICONV_E_PARSE; 634 res = -PSICONV_E_PARSE;
627 goto ERROR6; 635 goto ERROR6;
628 } else { 636 } else {
629 psiconv_debug(config,lev+2,sto, 637 psiconv_debug(config,lev+2,sto,
634 } 642 }
635 643
636 psiconv_progress(config,lev+2,sto, 644 psiconv_progress(config,lev+2,sto,
637 "Looking for the Text section"); 645 "Looking for the Text section");
638 if (!text_sec) { 646 if (!text_sec) {
639 psiconv_warn(config,lev+2,sto, "Text section not found in the section table"); 647 psiconv_error(config,lev+2,sto, "Text section not found in the section table");
640 res = -PSICONV_E_PARSE; 648 res = -PSICONV_E_PARSE;
641 goto ERROR7; 649 goto ERROR7;
642 } else { 650 } else {
643 psiconv_debug(config,lev+2,sto, 651 psiconv_debug(config,lev+2,sto,
644 "Text section at offset %08x",text_sec); 652 "Text section at offset %08x",text_sec);
679ERROR3: 687ERROR3:
680 psiconv_free_section_table_section(table); 688 psiconv_free_section_table_section(table);
681ERROR2: 689ERROR2:
682 free(*result); 690 free(*result);
683ERROR1: 691ERROR1:
684 psiconv_warn(config,lev+1,off,"Reading of Word File failed"); 692 psiconv_error(config,lev+1,off,"Reading of Word File failed");
685 if (res == 0) 693 if (res == 0)
686 return -PSICONV_E_NOMEM; 694 return -PSICONV_E_NOMEM;
687 else 695 else
688 return res; 696 return res;
689} 697}
735 "Found the Page Layout section at %08x",page_sec); 743 "Found the Page Layout section at %08x",page_sec);
736 } else if (entry->id == PSICONV_ID_PASSWORD_SECTION) { 744 } else if (entry->id == PSICONV_ID_PASSWORD_SECTION) {
737 pwd_sec = entry->offset; 745 pwd_sec = entry->offset;
738 psiconv_debug(config,lev+3,sto, 746 psiconv_debug(config,lev+3,sto,
739 "Found the Password section at %08x",pwd_sec); 747 "Found the Password section at %08x",pwd_sec);
740 psiconv_warn(config,lev+3,sto, 748 psiconv_error(config,lev+3,sto,
741 "Password section found - can't read encrypted data"); 749 "Password section found - can't read encrypted data");
742 res = -PSICONV_E_PARSE; 750 res = -PSICONV_E_PARSE;
743 goto ERROR3; 751 goto ERROR3;
744 } else if (entry->id == PSICONV_ID_SHEET_WORKBOOK_SECTION) { 752 } else if (entry->id == PSICONV_ID_SHEET_WORKBOOK_SECTION) {
745 workbook_sec = entry->offset; 753 workbook_sec = entry->offset;
759 767
760 768
761 psiconv_progress(config,lev+2,sto, 769 psiconv_progress(config,lev+2,sto,
762 "Looking for the Status section"); 770 "Looking for the Status section");
763 if (!status_sec) { 771 if (!status_sec) {
764 psiconv_warn(config,lev+2,sto, "Status section not found in the section table"); 772 psiconv_error(config,lev+2,sto, "Status section not found in the section table");
765 res = -PSICONV_E_PARSE; 773 res = -PSICONV_E_PARSE;
766 goto ERROR3; 774 goto ERROR3;
767 } else { 775 } else {
768 psiconv_debug(config,lev+2,sto, "Status section at offset %08x",status_sec); 776 psiconv_debug(config,lev+2,sto, "Status section at offset %08x",status_sec);
769 if ((res = psiconv_parse_sheet_status_section(config,buf,lev+2,status_sec,NULL, 777 if ((res = psiconv_parse_sheet_status_section(config,buf,lev+2,status_sec,NULL,
771 goto ERROR3; 779 goto ERROR3;
772 } 780 }
773 781
774 psiconv_progress(config,lev+2,sto, "Looking for the Application ID section"); 782 psiconv_progress(config,lev+2,sto, "Looking for the Application ID section");
775 if (! applid_sec) { 783 if (! applid_sec) {
776 psiconv_warn(config,lev+2,sto, 784 psiconv_error(config,lev+2,sto,
777 "Application ID section not found in the section table"); 785 "Application ID section not found in the section table");
778 res = -PSICONV_E_PARSE; 786 res = -PSICONV_E_PARSE;
779 goto ERROR4; 787 goto ERROR4;
780 } else { 788 } else {
781 psiconv_debug(config,lev+2,sto, 789 psiconv_debug(config,lev+2,sto,
783 if ((res = psiconv_parse_application_id_section(config,buf,lev+2,applid_sec,NULL, 791 if ((res = psiconv_parse_application_id_section(config,buf,lev+2,applid_sec,NULL,
784 &appl_id))) 792 &appl_id)))
785 goto ERROR4; 793 goto ERROR4;
786 } 794 }
787 if ((appl_id->id != PSICONV_ID_SHEET) || 795 if ((appl_id->id != PSICONV_ID_SHEET) ||
788 strcmp(appl_id->name,"Sheet.app")) { 796 psiconv_unicode_strcmp(appl_id->name,unicode_sheet)) {
789 psiconv_warn(config,lev+2,applid_sec, 797 psiconv_warn(config,lev+2,applid_sec,
790 "Application ID section contains unexpected data"); 798 "Application ID section contains unexpected data");
791 psiconv_debug(config,lev+2,applid_sec,"ID: %08x expected, %08x found", 799 psiconv_debug(config,lev+2,applid_sec,"ID: %08x expected, %08x found",
792 PSICONV_ID_SHEET,appl_id->id); 800 PSICONV_ID_SHEET,appl_id->id);
793 if (!(temp_str = psiconv_make_printable(appl_id->name))) 801 if (!(temp_str = psiconv_make_printable(config,appl_id->name)))
794 goto ERROR5; 802 goto ERROR5;
795 psiconv_debug(config,lev+2,applid_sec,"Name: `%s' expected, `%s' found", 803 psiconv_debug(config,lev+2,applid_sec,"Name: `%s' expected, `%s' found",
796 "Sheet.app",temp_str); 804 "Sheet.app",temp_str);
797 free(temp_str); 805 free(temp_str);
798 res = -PSICONV_E_PARSE; 806 res = -PSICONV_E_PARSE;
800 } 808 }
801 809
802 psiconv_progress(config,lev+2,sto, 810 psiconv_progress(config,lev+2,sto,
803 "Looking for the Page layout section"); 811 "Looking for the Page layout section");
804 if (! page_sec) { 812 if (! page_sec) {
805 psiconv_warn(config,lev+2,sto, 813 psiconv_error(config,lev+2,sto,
806 "Page layout section not found in the section table"); 814 "Page layout section not found in the section table");
807 res = -PSICONV_E_PARSE; 815 res = -PSICONV_E_PARSE;
808 goto ERROR5; 816 goto ERROR5;
809 } else { 817 } else {
810 psiconv_debug(config,lev+2,sto, 818 psiconv_debug(config,lev+2,sto,
815 } 823 }
816 824
817 psiconv_progress(config,lev+2,sto, 825 psiconv_progress(config,lev+2,sto,
818 "Looking for the Sheet Workbook section"); 826 "Looking for the Sheet Workbook section");
819 if (! workbook_sec) { 827 if (! workbook_sec) {
820 psiconv_warn(config,lev+2,sto, 828 psiconv_error(config,lev+2,sto,
821 "Sheet workbook section not found in the section table"); 829 "Sheet workbook section not found in the section table");
822 res = -PSICONV_E_PARSE; 830 res = -PSICONV_E_PARSE;
823 goto ERROR6; 831 goto ERROR6;
824 } else { 832 } else {
825 psiconv_debug(config,lev+2,sto, 833 psiconv_debug(config,lev+2,sto,
844ERROR3: 852ERROR3:
845 psiconv_free_section_table_section(table); 853 psiconv_free_section_table_section(table);
846ERROR2: 854ERROR2:
847 free(*result); 855 free(*result);
848ERROR1: 856ERROR1:
849 psiconv_warn(config,lev+1,off,"Reading of Sheet File failed"); 857 psiconv_error(config,lev+1,off,"Reading of Sheet File failed");
850 if (res == 0) 858 if (res == 0)
851 return -PSICONV_E_NOMEM; 859 return -PSICONV_E_NOMEM;
852 else 860 else
853 return res; 861 return res;
854} 862}

Legend:
Removed from v.170  
changed lines
  Added in v.208

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