From ee34c25c8a989b5a7c0ad59d71bb39f8efff045c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 19 Jul 2011 13:19:29 -0700 Subject: First part of fix for bug 8310 - toupper_ascii() is broken on big-endian systems Remove int toupper_ascii(int c); int tolower_ascii(int c); int isupper_ascii(int c); int islower_ascii(int c); and replace with their _m equivalents, as they are identical. --- lib/util/charset/charset.h | 4 ---- lib/util/charset/util_unistr_w.c | 38 -------------------------------------- lib/util/util_str_common.c | 2 +- 3 files changed, 1 insertion(+), 43 deletions(-) (limited to 'lib/util') diff --git a/lib/util/charset/charset.h b/lib/util/charset/charset.h index b36c461003..08bb4533d2 100644 --- a/lib/util/charset/charset.h +++ b/lib/util/charset/charset.h @@ -257,10 +257,6 @@ int strcmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b); int strcasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b); int strncasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len); int strcmp_wa(const smb_ucs2_t *a, const char *b); -int toupper_ascii(int c); -int tolower_ascii(int c); -int isupper_ascii(int c); -int islower_ascii(int c); /* * Define stub for charset module which implements 8-bit encoding with gaps. diff --git a/lib/util/charset/util_unistr_w.c b/lib/util/charset/util_unistr_w.c index 3fbed7f67c..fc6d3747bd 100644 --- a/lib/util/charset/util_unistr_w.c +++ b/lib/util/charset/util_unistr_w.c @@ -252,41 +252,3 @@ int strcmp_wa(const smb_ucs2_t *a, const char *b) } return (*(COPY_UCS2_CHAR(&cp,a)) - UCS2_CHAR(*b)); } - -/************************************************************* - ascii only toupper - saves the need for smbd to be in C locale. -*************************************************************/ - -int toupper_ascii(int c) -{ - smb_ucs2_t uc = toupper_m(UCS2_CHAR(c)); - return UCS2_TO_CHAR(uc); -} - -/************************************************************* - ascii only tolower - saves the need for smbd to be in C locale. -*************************************************************/ - -int tolower_ascii(int c) -{ - smb_ucs2_t uc = tolower_m(UCS2_CHAR(c)); - return UCS2_TO_CHAR(uc); -} - -/************************************************************* - ascii only isupper - saves the need for smbd to be in C locale. -*************************************************************/ - -int isupper_ascii(int c) -{ - return isupper_m(UCS2_CHAR(c)); -} - -/************************************************************* - ascii only islower - saves the need for smbd to be in C locale. -*************************************************************/ - -int islower_ascii(int c) -{ - return islower_m(UCS2_CHAR(c)); -} diff --git a/lib/util/util_str_common.c b/lib/util/util_str_common.c index fe78d65020..20682f9935 100644 --- a/lib/util/util_str_common.c +++ b/lib/util/util_str_common.c @@ -43,7 +43,7 @@ _PUBLIC_ int strwicmp(const char *psz1, const char *psz2) psz1++; while (isspace((int)*psz2)) psz2++; - if (toupper_ascii((unsigned char)*psz1) != toupper_ascii((unsigned char)*psz2) + if (toupper_m((unsigned char)*psz1) != toupper_m((unsigned char)*psz2) || *psz1 == '\0' || *psz2 == '\0') break; -- cgit