From 71ef8794b453c4c6e74a63ec38bb037371f6fc58 Mon Sep 17 00:00:00 2001 From: ashmew2 Date: Tue, 3 Oct 2017 21:56:34 +0000 Subject: [PATCH] Ignore case while comparing encoding names git-svn-id: svn://kolibrios.org@7045 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/libraries/iconv/iconv.c | 27 +++++++----------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/programs/develop/libraries/iconv/iconv.c b/programs/develop/libraries/iconv/iconv.c index f1100db694..9a855cc06d 100644 --- a/programs/develop/libraries/iconv/iconv.c +++ b/programs/develop/libraries/iconv/iconv.c @@ -1,4 +1,4 @@ -//#include +#include //#include typedef unsigned int size_t; #define NULL ((void*)0) @@ -30,15 +30,6 @@ typedef int iconv_t; #define ISO8859_5 4 #define UTF_8 5 - -int strcmp (const char* a, const char* b) -{ - return (*a && *b && (*a == *b)) ? ((*(a+1) || *(b+1)) ? (strcmp(a+1, b+1)) : (0)) : ((*a > *b) ? (1) : (-1)); -} - - - - #include "cp866.h" #include "cp1251.h" #include "cp1252.h" @@ -46,7 +37,6 @@ int strcmp (const char* a, const char* b) #include "iso8859_5.h" #include "utf8.h" - int encoding(char *what) { /* Ignore //TRANSLIT or //IGNORE for now. */ @@ -58,14 +48,13 @@ int encoding(char *what) { } } - if (!strcmp(what,"CP866")) return CP866; - if (!strcmp(what,"CP1251")) return CP1251; - if (!strcmp(what,"windows-1252")) return CP1252; - if (!strcmp(what,"Windows-1252")) return CP1252; - if (!strcmp(what,"CP1252")) return CP1252; - if (!strcmp(what,"KOI8-RU")) return KOI8_RU; - if (!strcmp(what,"ISO8859-5")) return ISO8859_5; - if (!strcmp(what,"UTF-8")) return UTF_8; + if (!strcasecmp(what,"CP866")) return CP866; + if (!strcasecmp(what,"CP1251")) return CP1251; + if (!strcasecmp(what,"windows-1252")) return CP1252; + if (!strcasecmp(what,"CP1252")) return CP1252; + if (!strcasecmp(what,"KOI8-RU")) return KOI8_RU; + if (!strcasecmp(what,"ISO8859-5")) return ISO8859_5; + if (!strcasecmp(what,"UTF-8")) return UTF_8; return -1; }