--- psiconv/trunk/lib/psiconv/parse_driver.c 2004/01/04 22:20:43 183 +++ psiconv/trunk/lib/psiconv/parse_driver.c 2004/01/06 20:15:01 184 @@ -25,11 +25,16 @@ #include "parse.h" #include "parse_routines.h" +#include "unicode.h" #ifdef DMALLOC #include #endif +static psiconv_ucs2 unicode_paint[10] = { 'P','a','i','n','t','.','a','p','p',0 }; +static psiconv_ucs2 unicode_texted[11] ={ 'T','e','x','t','E','d','.','a','p','p',0 }; +static psiconv_ucs2 unicode_word[9] = { 'W','o','r','d','.','a','p','p',0 }; +static psiconv_ucs2 unicode_sheet[10] = { 'S','h','e','e','t','.','a','p','p',0 }; psiconv_file_type_t psiconv_file_type(const psiconv_config config, psiconv_buffer buf,int *length, @@ -95,7 +100,7 @@ ERROR2: free(*result); ERROR1: - psiconv_warn(config,lev+1,off,"Reading of Psion File failed"); + psiconv_error(config,lev+1,off,"Reading of Psion File failed"); if (res == 0) return -PSICONV_E_NOMEM; else @@ -141,7 +146,7 @@ ERROR4: for (i = 0; i < psiconv_list_length((*result)->sections); i++) { if (!(clipart = psiconv_list_get((*result)->sections,i))) { - psiconv_warn(config,lev+1,off,"Massive memory corruption"); + psiconv_error(config,lev+1,off,"Massive memory corruption"); goto ERROR3; } psiconv_free_clipart_section(clipart); @@ -152,7 +157,7 @@ ERROR2: free(*result); ERROR1: - psiconv_warn(config,lev+1,off,"Reading of Clipart File failed"); + psiconv_error(config,lev+1,off,"Reading of Clipart File failed"); if (res == 0) return -PSICONV_E_NOMEM; else @@ -206,7 +211,7 @@ ERROR4: for (i = 0; i < psiconv_list_length((*result)->sections); i++) { if (!(paint = psiconv_list_get((*result)->sections,i))) { - psiconv_warn(config,lev+1,off,"Massive memory corruption"); + psiconv_error(config,lev+1,off,"Massive memory corruption"); goto ERROR3; } psiconv_free_paint_data_section(paint); @@ -217,7 +222,7 @@ ERROR2: free(*result); ERROR1: - psiconv_warn(config,lev+1,off,"Reading of MBM File failed"); + psiconv_error(config,lev+1,off,"Reading of MBM File failed"); if (res == 0) return -PSICONV_E_NOMEM; else @@ -276,7 +281,7 @@ psiconv_progress(config,lev+2,sto, "Looking for the Application ID section"); if (! applid_sec) { - psiconv_warn(config,lev+2,sto, + psiconv_error(config,lev+2,sto, "Application ID section not found in the section table"); res = -PSICONV_E_PARSE; goto ERROR3; @@ -288,12 +293,12 @@ goto ERROR3; } if ((appl_id->id != PSICONV_ID_SKETCH) || - strcmp(appl_id->name,"Paint.app")) { + psiconv_unicode_strcmp(appl_id->name,unicode_paint)) { psiconv_warn(config,lev+2,applid_sec, "Application ID section contains unexpected data"); psiconv_debug(config,lev+2,applid_sec,"ID: %08x expected, %08x found", PSICONV_ID_SKETCH,appl_id->id); - if (!(temp_str = psiconv_make_printable(appl_id->name))) + if (!(temp_str = psiconv_make_printable(config,appl_id->name))) goto ERROR4; psiconv_debug(config,lev+2,applid_sec,"Name: `%s' expected, `%s' found", "Paint.app",temp_str); @@ -327,7 +332,7 @@ ERROR2: free(*result); ERROR1: - psiconv_warn(config,lev+1,off,"Reading of Sketch File failed"); + psiconv_error(config,lev+1,off,"Reading of Sketch File failed"); if (res == 0) return -PSICONV_E_NOMEM; else @@ -394,7 +399,7 @@ psiconv_progress(config,lev+2,sto, "Looking for the Application ID section"); if (! applid_sec) { - psiconv_warn(config,lev+2,sto, + psiconv_error(config,lev+2,sto, "Application ID section not found in the section table"); res = -PSICONV_E_PARSE; goto ERROR3; @@ -405,13 +410,14 @@ &appl_id))) goto ERROR3; } + if ((appl_id->id != PSICONV_ID_TEXTED) || - strcmp(appl_id->name,"TextEd.app")) { + psiconv_unicode_strcmp(appl_id->name,unicode_texted)) { psiconv_warn(config,lev+2,applid_sec, "Application ID section contains unexpected data"); psiconv_debug(config,lev+2,applid_sec,"ID: %08x expected, %08x found", PSICONV_ID_TEXTED,appl_id->id); - if (!(temp_str = psiconv_make_printable(appl_id->name))) + if (!(temp_str = psiconv_make_printable(config,appl_id->name))) goto ERROR4; psiconv_debug(config,lev+2,applid_sec,"Name: `%s' expected, `%s' found", "TextEd.app",temp_str); @@ -423,7 +429,7 @@ psiconv_progress(config,lev+2,sto, "Looking for the Page layout section"); if (! page_sec) { - psiconv_warn(config,lev+2,sto, + psiconv_error(config,lev+2,sto, "Page layout section not found in the section table"); res = -PSICONV_E_PARSE; goto ERROR4; @@ -443,7 +449,7 @@ psiconv_progress(config,lev+2,sto, "Looking for the TextEd section"); if (! texted_sec) { - psiconv_warn(config,lev+2,sto, + psiconv_error(config,lev+2,sto, "TextEd section not found in the section table"); res = -PSICONV_E_PARSE; goto ERROR7; @@ -476,7 +482,7 @@ ERROR2: free(*result); ERROR1: - psiconv_warn(config,lev+1,off,"Reading of TextEd File failed"); + psiconv_error(config,lev+1,off,"Reading of TextEd File failed"); if (res == 0) return -PSICONV_E_NOMEM; else @@ -537,7 +543,7 @@ pwd_sec = entry->offset; psiconv_debug(config,lev+3,sto, "Found the Password section at %08x",pwd_sec); - psiconv_warn(config,lev+3,sto, + psiconv_error(config,lev+3,sto, "Password section found - can't read encrypted data"); res = -PSICONV_E_PARSE; goto ERROR3; @@ -565,7 +571,7 @@ psiconv_progress(config,lev+2,sto, "Looking for the Status section"); if (!status_sec) { - psiconv_warn(config,lev+2,sto, "Status section not found in the section table"); + psiconv_error(config,lev+2,sto, "Status section not found in the section table"); res = -PSICONV_E_PARSE; goto ERROR3; } else { @@ -577,7 +583,7 @@ psiconv_progress(config,lev+2,sto, "Looking for the Application ID section"); if (! applid_sec) { - psiconv_warn(config,lev+2,sto, + psiconv_error(config,lev+2,sto, "Application ID section not found in the section table"); res = -PSICONV_E_PARSE; goto ERROR4; @@ -589,12 +595,12 @@ goto ERROR4; } if ((appl_id->id != PSICONV_ID_WORD) || - strcmp(appl_id->name,"Word.app")) { + psiconv_unicode_strcmp(appl_id->name,unicode_word)) { psiconv_warn(config,lev+2,applid_sec, "Application ID section contains unexpected data"); psiconv_debug(config,lev+2,applid_sec,"ID: %08x expected, %08x found", PSICONV_ID_WORD,appl_id->id); - if (!(temp_str = psiconv_make_printable(appl_id->name))) + if (!(temp_str = psiconv_make_printable(config,appl_id->name))) goto ERROR5; psiconv_debug(config,lev+2,applid_sec,"Name: `%s' expected, `%s' found", "Word.app",temp_str); @@ -606,7 +612,7 @@ psiconv_progress(config,lev+2,sto, "Looking for the Page layout section"); if (! page_sec) { - psiconv_warn(config,lev+2,sto, + psiconv_error(config,lev+2,sto, "Page layout section not found in the section table"); res = -PSICONV_E_PARSE; goto ERROR5; @@ -621,7 +627,7 @@ psiconv_progress(config,lev+2,sto, "Looking for the Word Style section"); if (!styles_sec) { - psiconv_warn(config,lev+2,sto, + psiconv_error(config,lev+2,sto, "Word styles section not found in the section table"); res = -PSICONV_E_PARSE; goto ERROR6; @@ -636,7 +642,7 @@ psiconv_progress(config,lev+2,sto, "Looking for the Text section"); if (!text_sec) { - psiconv_warn(config,lev+2,sto, "Text section not found in the section table"); + psiconv_error(config,lev+2,sto, "Text section not found in the section table"); res = -PSICONV_E_PARSE; goto ERROR7; } else { @@ -681,7 +687,7 @@ ERROR2: free(*result); ERROR1: - psiconv_warn(config,lev+1,off,"Reading of Word File failed"); + psiconv_error(config,lev+1,off,"Reading of Word File failed"); if (res == 0) return -PSICONV_E_NOMEM; else @@ -737,7 +743,7 @@ pwd_sec = entry->offset; psiconv_debug(config,lev+3,sto, "Found the Password section at %08x",pwd_sec); - psiconv_warn(config,lev+3,sto, + psiconv_error(config,lev+3,sto, "Password section found - can't read encrypted data"); res = -PSICONV_E_PARSE; goto ERROR3; @@ -761,7 +767,7 @@ psiconv_progress(config,lev+2,sto, "Looking for the Status section"); if (!status_sec) { - psiconv_warn(config,lev+2,sto, "Status section not found in the section table"); + psiconv_error(config,lev+2,sto, "Status section not found in the section table"); res = -PSICONV_E_PARSE; goto ERROR3; } else { @@ -773,7 +779,7 @@ psiconv_progress(config,lev+2,sto, "Looking for the Application ID section"); if (! applid_sec) { - psiconv_warn(config,lev+2,sto, + psiconv_error(config,lev+2,sto, "Application ID section not found in the section table"); res = -PSICONV_E_PARSE; goto ERROR4; @@ -785,12 +791,12 @@ goto ERROR4; } if ((appl_id->id != PSICONV_ID_SHEET) || - strcmp(appl_id->name,"Sheet.app")) { + psiconv_unicode_strcmp(appl_id->name,unicode_sheet)) { psiconv_warn(config,lev+2,applid_sec, "Application ID section contains unexpected data"); psiconv_debug(config,lev+2,applid_sec,"ID: %08x expected, %08x found", PSICONV_ID_SHEET,appl_id->id); - if (!(temp_str = psiconv_make_printable(appl_id->name))) + if (!(temp_str = psiconv_make_printable(config,appl_id->name))) goto ERROR5; psiconv_debug(config,lev+2,applid_sec,"Name: `%s' expected, `%s' found", "Sheet.app",temp_str); @@ -802,7 +808,7 @@ psiconv_progress(config,lev+2,sto, "Looking for the Page layout section"); if (! page_sec) { - psiconv_warn(config,lev+2,sto, + psiconv_error(config,lev+2,sto, "Page layout section not found in the section table"); res = -PSICONV_E_PARSE; goto ERROR5; @@ -817,7 +823,7 @@ psiconv_progress(config,lev+2,sto, "Looking for the Sheet Workbook section"); if (! workbook_sec) { - psiconv_warn(config,lev+2,sto, + psiconv_error(config,lev+2,sto, "Sheet workbook section not found in the section table"); res = -PSICONV_E_PARSE; goto ERROR6; @@ -846,7 +852,7 @@ ERROR2: free(*result); ERROR1: - psiconv_warn(config,lev+1,off,"Reading of Sheet File failed"); + psiconv_error(config,lev+1,off,"Reading of Sheet File failed"); if (res == 0) return -PSICONV_E_NOMEM; else