summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-11-09 08:45:00 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:45:56 -0500
commit177a098731d040f83cef1153b6031fb5a4977e8b (patch)
treef65f608a758df151b964c643e4e913fa510618d2 /source4
parent56415ccacb8bc40ef8aab9cf440d5a30badd4eba (diff)
downloadsamba-177a098731d040f83cef1153b6031fb5a4977e8b.tar.gz
samba-177a098731d040f83cef1153b6031fb5a4977e8b.tar.bz2
samba-177a098731d040f83cef1153b6031fb5a4977e8b.zip
r11598: fixed strhaslower() and strhasupper() to not falsely recognise
caseless characters as lower/upper (This used to be commit 74fb317f2acf7a5963f37c0cd9e21a34d7da2f4f)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/util_str.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source4/lib/util_str.c b/source4/lib/util_str.c
index 1ccdf49dc4..e1fa19aa0b 100644
--- a/source4/lib/util_str.c
+++ b/source4/lib/util_str.c
@@ -663,6 +663,9 @@ char *strrchr_m(const char *s, char c)
return ret;
}
+/*
+ return True if any (multi-byte) character is lower case
+*/
BOOL strhaslower(const char *string)
{
while (*string) {
@@ -673,9 +676,9 @@ BOOL strhaslower(const char *string)
s = next_codepoint(string, &c_size);
string += c_size;
- t = tolower_w(s);
+ t = toupper_w(s);
- if (s == t) { /* the source was alreay lower case */
+ if (s != t) {
return True; /* that means it has lower case chars */
}
}
@@ -683,6 +686,9 @@ BOOL strhaslower(const char *string)
return False;
}
+/*
+ return True if any (multi-byte) character is upper case
+*/
BOOL strhasupper(const char *string)
{
while (*string) {
@@ -693,9 +699,9 @@ BOOL strhasupper(const char *string)
s = next_codepoint(string, &c_size);
string += c_size;
- t = toupper_w(s);
+ t = tolower_w(s);
- if (s == t) { /* the source was alreay upper case */
+ if (s != t) {
return True; /* that means it has upper case chars */
}
}