/[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 94 Revision 142
22 22
23#include <stdlib.h> 23#include <stdlib.h>
24 24
25#include "parse.h" 25#include "parse.h"
26#include "parse_routines.h" 26#include "parse_routines.h"
27
28#ifdef DMALLOC
29#include <dmalloc.h>
30#endif
31
27 32
28psiconv_file_type_t psiconv_file_type(psiconv_buffer buf,int *length, 33psiconv_file_type_t psiconv_file_type(psiconv_buffer buf,int *length,
29 psiconv_header_section *result) 34 psiconv_header_section *result)
30{ 35{
31 psiconv_header_section header; 36 psiconv_header_section header;
684 char *temp_str; 689 char *temp_str;
685 psiconv_u32 pwd_sec = 0; 690 psiconv_u32 pwd_sec = 0;
686 psiconv_u32 status_sec = 0; 691 psiconv_u32 status_sec = 0;
687 psiconv_u32 page_sec = 0; 692 psiconv_u32 page_sec = 0;
688 psiconv_u32 applid_sec = 0; 693 psiconv_u32 applid_sec = 0;
694 psiconv_u32 workbook_sec = 0;
689 psiconv_section_table_entry entry; 695 psiconv_section_table_entry entry;
690 psiconv_u32 sto; 696 psiconv_u32 sto;
691 int i; 697 int i;
692 698
693 psiconv_progress(lev+1,off,"Going to read a sheet file"); 699 psiconv_progress(lev+1,off,"Going to read a sheet file");
724 "Found the Password section at %08x",pwd_sec); 730 "Found the Password section at %08x",pwd_sec);
725 psiconv_warn(lev+3,sto, 731 psiconv_warn(lev+3,sto,
726 "Password section found - can't read encrypted data"); 732 "Password section found - can't read encrypted data");
727 res = -PSICONV_E_PARSE; 733 res = -PSICONV_E_PARSE;
728 goto ERROR3; 734 goto ERROR3;
735 } else if (entry->id == PSICONV_ID_SHEET_WORKBOOK_SECTION) {
736 workbook_sec = entry->offset;
737 psiconv_debug(lev+3,sto,
738 "Found the Sheet Workbook section at %08x",workbook_sec);
729 } else if (entry->id == PSICONV_ID_SHEET_STATUS_SECTION) { 739 } else if (entry->id == PSICONV_ID_SHEET_STATUS_SECTION) {
730 status_sec = entry->offset; 740 status_sec = entry->offset;
731 psiconv_debug(lev+3,sto, 741 psiconv_debug(lev+3,sto,
732 "Found the Sheet Status section at %08x",status_sec); 742 "Found the Sheet Status section at %08x",status_sec);
733 } else { 743 } else {
772 psiconv_debug(lev+2,applid_sec,"ID: %08x expected, %08x found", 782 psiconv_debug(lev+2,applid_sec,"ID: %08x expected, %08x found",
773 PSICONV_ID_SHEET,appl_id->id); 783 PSICONV_ID_SHEET,appl_id->id);
774 if (!(temp_str = psiconv_make_printable(appl_id->name))) 784 if (!(temp_str = psiconv_make_printable(appl_id->name)))
775 goto ERROR5; 785 goto ERROR5;
776 psiconv_debug(lev+2,applid_sec,"Name: `%s' expected, `%s' found", 786 psiconv_debug(lev+2,applid_sec,"Name: `%s' expected, `%s' found",
777 "Word.app",temp_str); 787 "Sheet.app",temp_str);
778 free(temp_str); 788 free(temp_str);
779 res = -PSICONV_E_PARSE; 789 res = -PSICONV_E_PARSE;
780 goto ERROR5; 790 goto ERROR5;
781 } 791 }
782 792
793 if ((res = psiconv_parse_page_layout_section(buf,lev+2,page_sec,NULL, 803 if ((res = psiconv_parse_page_layout_section(buf,lev+2,page_sec,NULL,
794 &(*result)->page_sec))) 804 &(*result)->page_sec)))
795 goto ERROR5; 805 goto ERROR5;
796 } 806 }
797 807
808 psiconv_progress(lev+2,sto,
809 "Looking for the Sheet Workbook section");
810 if (! workbook_sec) {
811 psiconv_warn(lev+2,sto,
812 "Sheet workbook section not found in the section table");
813 res = -PSICONV_E_PARSE;
814 goto ERROR6;
815 } else {
816 psiconv_debug(lev+2,sto,
817 "Sheet workbook section at offset %08x",page_sec);
818 if ((res = psiconv_parse_sheet_workbook_section(buf,lev+2,workbook_sec,NULL,
819 &(*result)->workbook_sec)))
820 goto ERROR6;
821 }
822
798 psiconv_free_application_id_section(appl_id); 823 psiconv_free_application_id_section(appl_id);
799 psiconv_free_section_table_section(table); 824 psiconv_free_section_table_section(table);
800 825
801 psiconv_progress(lev+1,off,"End of Sheet file"); 826 psiconv_progress(lev+1,off,"End of Sheet file");
802 return 0; 827 return 0;
803 828
804 829ERROR6:
830 psiconv_free_page_layout_section((*result)->page_sec);
805ERROR5: 831ERROR5:
806 psiconv_free_application_id_section(appl_id); 832 psiconv_free_application_id_section(appl_id);
807ERROR4: 833ERROR4:
808 psiconv_free_sheet_status_section((*result)->status_sec); 834 psiconv_free_sheet_status_section((*result)->status_sec);
809ERROR3: 835ERROR3:

Legend:
Removed from v.94  
changed lines
  Added in v.142

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