--- psiconv/trunk/lib/psiconv/parse_driver.c 2004/02/26 17:12:48 236 +++ psiconv/trunk/lib/psiconv/parse_driver.c 2004/02/26 21:33:52 237 @@ -31,10 +31,21 @@ #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 }; +/* Compare whether application id names match. + Sought must be lower case; the comparison is case insensitive */ +static psiconv_bool_t applid_matches(psiconv_string_t found, + const char *sought) +{ + int i; + if (psiconv_unicode_strlen(found) != strlen(sought)) + return psiconv_bool_false; + for (i = 0; i < strlen(sought); i++) + if ((found[i] != sought[i]) && + ((sought[i] < 'a') || (sought[i] > 'z') || + (found[i] != sought[i] + 'A' - 'a'))) + return psiconv_bool_false; + return psiconv_bool_true; +} psiconv_file_type_t psiconv_file_type(const psiconv_config config, psiconv_buffer buf,int *length, @@ -295,7 +306,7 @@ goto ERROR3; } if ((appl_id->id != PSICONV_ID_SKETCH) || - psiconv_unicode_strcmp(appl_id->name,unicode_paint)) { + !applid_matches(appl_id->name,"paint.app")) { 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", @@ -414,7 +425,7 @@ } if ((appl_id->id != PSICONV_ID_TEXTED) || - psiconv_unicode_strcmp(appl_id->name,unicode_texted)) { + !applid_matches(appl_id->name,"texted.app")) { 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", @@ -597,7 +608,7 @@ goto ERROR4; } if ((appl_id->id != PSICONV_ID_WORD) || - psiconv_unicode_strcmp(appl_id->name,unicode_word)) { + !applid_matches(appl_id->name,"word.app")) { 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", @@ -793,7 +804,7 @@ goto ERROR4; } if ((appl_id->id != PSICONV_ID_SHEET) || - psiconv_unicode_strcmp(appl_id->name,unicode_sheet)) { + !applid_matches(appl_id->name,"sheet.app")) { 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",