svn commit: samba r11598 - in branches/SAMBA_4_0/source/lib: .

tridge at samba.org tridge at samba.org
Wed Nov 9 08:45:00 GMT 2005


Author: tridge
Date: 2005-11-09 08:45:00 +0000 (Wed, 09 Nov 2005)
New Revision: 11598

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=11598

Log:

fixed strhaslower() and strhasupper() to not falsely recognise
caseless characters as lower/upper

Modified:
   branches/SAMBA_4_0/source/lib/util_str.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/util_str.c
===================================================================
--- branches/SAMBA_4_0/source/lib/util_str.c	2005-11-09 08:23:33 UTC (rev 11597)
+++ branches/SAMBA_4_0/source/lib/util_str.c	2005-11-09 08:45:00 UTC (rev 11598)
@@ -663,6 +663,9 @@
 	return ret;
 }
 
+/*
+  return True if any (multi-byte) character is lower case
+*/
 BOOL strhaslower(const char *string)
 {
 	while (*string) {
@@ -673,9 +676,9 @@
 		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 @@
 	return False;
 } 
 
+/*
+  return True if any (multi-byte) character is upper case
+*/
 BOOL strhasupper(const char *string)
 {
 	while (*string) {
@@ -693,9 +699,9 @@
 		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 */
 		}
 	}



More information about the samba-cvs mailing list