diff options
author | Daniel Stenberg <daniel@haxx.se> | 2016-09-30 18:54:02 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2016-10-31 08:46:35 +0100 |
commit | 811a693b803a8715e15ba56fb161d9e6b3b6b016 (patch) | |
tree | 47f61478d7d860eadba5396d88a444e906f6cfb9 /src | |
parent | 502acba2af821391b85a2cd4ac7b91ad8e9d4180 (diff) |
strcasecompare: all case insensitive string compares ignore locale now
We had some confusions on when each function was used. We should not act
differently on different locales anyway.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.inc | 4 | ||||
-rw-r--r-- | src/tool_cb_hdr.c | 4 | ||||
-rw-r--r-- | src/tool_formparse.c | 2 | ||||
-rw-r--r-- | src/tool_getparam.c | 6 | ||||
-rw-r--r-- | src/tool_helpers.c | 2 | ||||
-rw-r--r-- | src/tool_libinfo.c | 4 | ||||
-rw-r--r-- | src/tool_metalink.c | 16 | ||||
-rw-r--r-- | src/tool_operate.c | 2 | ||||
-rw-r--r-- | src/tool_operhlp.c | 2 | ||||
-rw-r--r-- | src/tool_paramhlp.c | 22 |
10 files changed, 32 insertions, 32 deletions
diff --git a/src/Makefile.inc b/src/Makefile.inc index 1aa153c8c..368c18b7e 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -11,14 +11,14 @@ # the official API, but we re-use the code here to avoid duplication. CURLX_CFILES = \ ../lib/strtoofft.c \ - ../lib/rawstr.c \ + ../lib/strcase.c \ ../lib/nonblock.c \ ../lib/warnless.c CURLX_HFILES = \ ../lib/curl_setup.h \ ../lib/strtoofft.h \ - ../lib/rawstr.h \ + ../lib/strcase.h \ ../lib/nonblock.h \ ../lib/warnless.h diff --git a/src/tool_cb_hdr.c b/src/tool_cb_hdr.c index f7d835562..fc1419e7f 100644 --- a/src/tool_cb_hdr.c +++ b/src/tool_cb_hdr.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -21,7 +21,7 @@ ***************************************************************************/ #include "tool_setup.h" -#include "rawstr.h" +#include "strcase.h" #define ENABLE_CURLX_PRINTF /* use our own printf() functions */ diff --git a/src/tool_formparse.c b/src/tool_formparse.c index de30c5264..88352fb11 100644 --- a/src/tool_formparse.c +++ b/src/tool_formparse.c @@ -21,7 +21,7 @@ ***************************************************************************/ #include "tool_setup.h" -#include "rawstr.h" +#include "strcase.h" #define ENABLE_CURLX_PRINTF /* use our own printf() functions */ diff --git a/src/tool_getparam.c b/src/tool_getparam.c index 34983b94d..a546888c5 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -21,7 +21,7 @@ ***************************************************************************/ #include "tool_setup.h" -#include "rawstr.h" +#include "strcase.h" #define ENABLE_CURLX_PRINTF /* use our own printf() functions */ @@ -419,7 +419,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ if(curlx_strncasecompare(aliases[j].lname, word, fnam)) { longopt = TRUE; numhits++; - if(curlx_raw_equal(aliases[j].lname, word)) { + if(curlx_strcasecompare(aliases[j].lname, word)) { parse = aliases[j].letter; hit = j; numhits = 1; /* a single unique hit */ @@ -1343,7 +1343,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ break; case 'f': /* crypto engine */ GetStr(&config->engine, nextarg); - if(config->engine && curlx_raw_equal(config->engine, "list")) + if(config->engine && curlx_strcasecompare(config->engine, "list")) return PARAM_ENGINES_REQUESTED; break; case 'g': /* CA info PEM file */ diff --git a/src/tool_helpers.c b/src/tool_helpers.c index bfba3dcc1..b89497b33 100644 --- a/src/tool_helpers.c +++ b/src/tool_helpers.c @@ -21,7 +21,7 @@ ***************************************************************************/ #include "tool_setup.h" -#include "rawstr.h" +#include "strcase.h" #define ENABLE_CURLX_PRINTF /* use our own printf() functions */ diff --git a/src/tool_libinfo.c b/src/tool_libinfo.c index 5db85480e..190b93aa1 100644 --- a/src/tool_libinfo.c +++ b/src/tool_libinfo.c @@ -21,7 +21,7 @@ ***************************************************************************/ #include "tool_setup.h" -#include "rawstr.h" +#include "strcase.h" #define ENABLE_CURLX_PRINTF /* use our own printf() functions */ @@ -89,7 +89,7 @@ CURLcode get_libcurl_info(void) if(curlinfo->protocols) { for(proto = curlinfo->protocols; *proto; proto++) { for(p = possibly_built_in; p->proto_name; p++) { - if(curlx_raw_equal(*proto, p->proto_name)) { + if(curlx_strcasecompare(*proto, p->proto_name)) { built_in_protos |= p->proto_pattern; break; } diff --git a/src/tool_metalink.c b/src/tool_metalink.c index 9a6465e67..77f3ba513 100644 --- a/src/tool_metalink.c +++ b/src/tool_metalink.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -92,7 +92,7 @@ struct win32_crypto_hash { # error "Can't compile METALINK support without a crypto library." #endif -#include "rawstr.h" +#include "strcase.h" #define ENABLE_CURLX_PRINTF /* use our own printf() functions */ @@ -747,7 +747,7 @@ static metalinkfile *new_metalinkfile(metalink_file_t *fileinfo) ++digest_alias) { metalink_checksum_t **p; for(p = fileinfo->checksums; *p; ++p) { - if(Curl_raw_equal(digest_alias->alias_name, (*p)->type) && + if(strcasecompare(digest_alias->alias_name, (*p)->type) && check_hex_digest((*p)->hash, digest_alias->digest_def)) { f->checksum = new_metalink_checksum_from_hex_digest(digest_alias->digest_def, @@ -777,10 +777,10 @@ static metalinkfile *new_metalinkfile(metalink_file_t *fileinfo) metainfo file URL may be appeared in fileinfo->metaurls. */ if((*p)->type == NULL || - Curl_raw_equal((*p)->type, "http") || - Curl_raw_equal((*p)->type, "https") || - Curl_raw_equal((*p)->type, "ftp") || - Curl_raw_equal((*p)->type, "ftps")) { + strcasecompare((*p)->type, "http") || + strcasecompare((*p)->type, "https") || + strcasecompare((*p)->type, "ftp") || + strcasecompare((*p)->type, "ftps")) { res = new_metalink_resource((*p)->url); tail->next = res; tail = res; @@ -906,7 +906,7 @@ static int check_content_type(const char *content_type, const char *media_type) if(!*ptr) { return 0; } - return Curl_raw_nequal(ptr, media_type, media_type_len) && + return strncasecompare(ptr, media_type, media_type_len) && (*(ptr+media_type_len) == '\0' || *(ptr+media_type_len) == ' ' || *(ptr+media_type_len) == '\t' || *(ptr+media_type_len) == ';'); } diff --git a/src/tool_operate.c b/src/tool_operate.c index c8bc80a6a..3307dfc3c 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -43,7 +43,7 @@ # include <fabdef.h> #endif -#include "rawstr.h" +#include "strcase.h" #define ENABLE_CURLX_PRINTF /* use our own printf() functions */ diff --git a/src/tool_operhlp.c b/src/tool_operhlp.c index 1c0d302ab..21b5ffe77 100644 --- a/src/tool_operhlp.c +++ b/src/tool_operhlp.c @@ -21,7 +21,7 @@ ***************************************************************************/ #include "tool_setup.h" -#include "rawstr.h" +#include "strcase.h" #define ENABLE_CURLX_PRINTF /* use our own printf() functions */ diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c index 820d872bc..c443d779d 100644 --- a/src/tool_paramhlp.c +++ b/src/tool_paramhlp.c @@ -21,7 +21,7 @@ ***************************************************************************/ #include "tool_setup.h" -#include "rawstr.h" +#include "strcase.h" #define ENABLE_CURLX_PRINTF /* use our own printf() functions */ @@ -312,7 +312,7 @@ long proto2num(struct OperationConfig *config, long *val, const char *str) } for(pp=protos; pp->name; pp++) { - if(curlx_raw_equal(token, pp->name)) { + if(curlx_strcasecompare(token, pp->name)) { switch (action) { case deny: *val &= ~(pp->bit); @@ -355,7 +355,7 @@ int check_protocol(const char *str) if(!str) return PARAM_REQUIRES_PARAMETER; for(pp = curlinfo->protocols; *pp; pp++) { - if(curlx_raw_equal(*pp, str)) + if(curlx_strcasecompare(*pp, str)) return PARAM_OK; } return PARAM_LIBCURL_UNSUPPORTED_PROTOCOL; @@ -466,11 +466,11 @@ ParameterError add2list(struct curl_slist **list, const char *ptr) int ftpfilemethod(struct OperationConfig *config, const char *str) { - if(curlx_raw_equal("singlecwd", str)) + if(curlx_strcasecompare("singlecwd", str)) return CURLFTPMETHOD_SINGLECWD; - if(curlx_raw_equal("nocwd", str)) + if(curlx_strcasecompare("nocwd", str)) return CURLFTPMETHOD_NOCWD; - if(curlx_raw_equal("multicwd", str)) + if(curlx_strcasecompare("multicwd", str)) return CURLFTPMETHOD_MULTICWD; warnf(config->global, "unrecognized ftp file method '%s', using default\n", @@ -481,9 +481,9 @@ int ftpfilemethod(struct OperationConfig *config, const char *str) int ftpcccmethod(struct OperationConfig *config, const char *str) { - if(curlx_raw_equal("passive", str)) + if(curlx_strcasecompare("passive", str)) return CURLFTPSSL_CCC_PASSIVE; - if(curlx_raw_equal("active", str)) + if(curlx_strcasecompare("active", str)) return CURLFTPSSL_CCC_ACTIVE; warnf(config->global, "unrecognized ftp CCC method '%s', using default\n", @@ -494,11 +494,11 @@ int ftpcccmethod(struct OperationConfig *config, const char *str) long delegation(struct OperationConfig *config, char *str) { - if(curlx_raw_equal("none", str)) + if(curlx_strcasecompare("none", str)) return CURLGSSAPI_DELEGATION_NONE; - if(curlx_raw_equal("policy", str)) + if(curlx_strcasecompare("policy", str)) return CURLGSSAPI_DELEGATION_POLICY_FLAG; - if(curlx_raw_equal("always", str)) + if(curlx_strcasecompare("always", str)) return CURLGSSAPI_DELEGATION_FLAG; warnf(config->global, "unrecognized delegation method '%s', using none\n", |