The Samba-Bugzilla – Attachment 5795 Details for
Bug 7519
Avoid setlocale calls in library functions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed samba4 patch
samba4.patch (text/plain), 2.27 KB, created by
Milan Crha
on 2010-06-16 09:25:10 UTC
(
hide
)
Description:
proposed samba4 patch
Filename:
MIME Type:
Creator:
Milan Crha
Created:
2010-06-16 09:25:10 UTC
Size:
2.27 KB
patch
obsolete
>diff --git a/lib/util/charset/charcnv.c b/lib/util/charset/charcnv.c >index e9f6ab0..4e46cfc 100644 >--- a/lib/util/charset/charcnv.c >+++ b/lib/util/charset/charcnv.c >@@ -135,21 +135,6 @@ static smb_iconv_t get_conv_handle(struct smb_iconv_convenience *ic, > charset_t from, charset_t to) > { > const char *n1, *n2; >- static bool initialised; >- >- if (initialised == false) { >- initialised = true; >- >-#ifdef LC_ALL >- /* we set back the locale to C to get ASCII-compatible >- toupper/lower functions. For now we do not need >- any other POSIX localisations anyway. When we >- should really need localized string functions one >- day we need to write our own ascii_tolower etc. >- */ >- setlocale(LC_ALL, "C"); >-#endif >- } > > if (ic->conv_handles[from][to]) { > return ic->conv_handles[from][to]; >diff --git a/lib/util/charset/codepoints.c b/lib/util/charset/codepoints.c >index 8be2051..fe7ea36 100644 >--- a/lib/util/charset/codepoints.c >+++ b/lib/util/charset/codepoints.c >@@ -69,7 +69,9 @@ void load_case_tables(void) > _PUBLIC_ codepoint_t toupper_m(codepoint_t val) > { > if (val < 128) { >- return toupper(val); >+ if (val >= 'a' && val <= 'z') >+ val -= 32; >+ return val; > } > if (upcase_table == NULL) { > load_case_tables(); >@@ -89,7 +91,9 @@ _PUBLIC_ codepoint_t toupper_m(codepoint_t val) > _PUBLIC_ codepoint_t tolower_m(codepoint_t val) > { > if (val < 128) { >- return tolower(val); >+ if (val >= 'A' && val <= 'Z') >+ val += 32; >+ return val; > } > if (lowcase_table == NULL) { > load_case_tables(); >diff --git a/lib/util/charset/util_unistr.c b/lib/util/charset/util_unistr.c >index 520ce05..5e5edb7 100644 >--- a/lib/util/charset/util_unistr.c >+++ b/lib/util/charset/util_unistr.c >@@ -542,7 +542,8 @@ _PUBLIC_ void strlower_m(char *s) > supported multi-byte character sets are ascii-compatible > (ie. they match for the first 128 chars) */ > while (*s && !(((uint8_t)*s) & 0x80)) { >- *s = tolower((uint8_t)*s); >+ if (*s >= 'A' && *s <= 'Z') >+ *s = (*s) + 32; > s++; > } > >@@ -581,7 +582,8 @@ _PUBLIC_ void strupper_m(char *s) > supported multi-byte character sets are ascii-compatible > (ie. they match for the first 128 chars) */ > while (*s && !(((uint8_t)*s) & 0x80)) { >- *s = toupper((uint8_t)*s); >+ if (*s >= 'a' && *s <= 'z') >+ *s = (*s) - 32; > s++; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 7519
:
5795
|
5806
|
5808