diff --git a/headers/private/textencoding/CharacterSetRoster.h b/headers/private/textencoding/CharacterSetRoster.h index bfe100b89b..51742042f5 100644 --- a/headers/private/textencoding/CharacterSetRoster.h +++ b/headers/private/textencoding/CharacterSetRoster.h @@ -74,14 +74,14 @@ public: * This function executes in linear time. * @return the character set with the given print name, or NULL if none exists **/ - static const BCharacterSet * FindCharacterSetByPrintName(char * name); + static const BCharacterSet * FindCharacterSetByPrintName(const char * name); /** * @brief return the character set with the given name, or NULL if none exists * This function will match aliases as well. * This function executes in linear time. * @return the character set with the given name, or NULL if none exists **/ - static const BCharacterSet * FindCharacterSetByName(char * name); + static const BCharacterSet * FindCharacterSetByName(const char * name); private: uint32 index; //! the state variable for iteration }; diff --git a/src/kits/textencoding/CharacterSetRoster.cpp b/src/kits/textencoding/CharacterSetRoster.cpp index 346c2dbc31..60169ab7d8 100644 --- a/src/kits/textencoding/CharacterSetRoster.cpp +++ b/src/kits/textencoding/CharacterSetRoster.cpp @@ -1,3 +1,4 @@ +#include #include #include #include "character_sets.h" @@ -79,9 +80,9 @@ BCharacterSetRoster::GetCharacterSetByMIBenum(uint32 MIBenum) } const BCharacterSet * -BCharacterSetRoster::FindCharacterSetByPrintName(char * name) +BCharacterSetRoster::FindCharacterSetByPrintName(const char * name) { - for (int id = 0 ; (id < character_sets_by_id_count) ; id++) { + for (uint id = 0 ; (id < character_sets_by_id_count) ; id++) { if (strcmp(character_sets_by_id[id]->GetPrintName(),name) == 0) { return character_sets_by_id[id]; } @@ -90,22 +91,22 @@ BCharacterSetRoster::FindCharacterSetByPrintName(char * name) } const BCharacterSet * -BCharacterSetRoster::FindCharacterSetByName(char * name) +BCharacterSetRoster::FindCharacterSetByName(const char * name) { // first search standard names and mime names - for (int id = 0 ; (id < character_sets_by_id_count) ; id++) { - if (strcmp(character_sets_by_id[id]->GetName(),name) == 0) { + for (uint id = 0 ; (id < character_sets_by_id_count) ; id++) { + if (strcasecmp(character_sets_by_id[id]->GetName(),name) == 0) { return character_sets_by_id[id]; } const char * mime = character_sets_by_id[id]->GetMIMEName(); - if ((mime != NULL) && (strcmp(mime,name) == 0)) { + if ((mime != NULL) && (strcasecmp(mime,name) == 0)) { return character_sets_by_id[id]; } } // only after searching all the above names do we look at aliases - for (int id = 0 ; (id < character_sets_by_id_count) ; id++) { + for (uint id = 0 ; (id < character_sets_by_id_count) ; id++) { for (int alias = 0 ; (alias < character_sets_by_id[id]->CountAliases()) ; alias++) { - if (strcmp(character_sets_by_id[id]->AliasAt(alias),name) == 0) { + if (strcasecmp(character_sets_by_id[id]->AliasAt(alias),name) == 0) { return character_sets_by_id[id]; } }