summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--sysdeps/i386/i486/bits/string.h46
2 files changed, 29 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index 10a8016fe8..fd4dce425a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2000-11-02  Ulrich Drepper  <drepper@redhat.com>
 
+	* sysdeps/i386/i486/bits/string.h (strcmp): Cast arguments to
+	__strcmp_cc, __strcmp_cg, and __strcmp_gc to unsigned char *.
+	(__strcmp_cc, __strcmp_cg, __strcmp_gc): Remove casts of values here.
+	Reported by Denis Zaitsev <zzz@cd-club.ru>.
+
 	* iconvdata/utf-16.c (PREPARE_LOOP): Correct typo preventing BOM from
 	being written.
 
diff --git a/sysdeps/i386/i486/bits/string.h b/sysdeps/i386/i486/bits/string.h
index c880f94eed..16e31bdd03 100644
--- a/sysdeps/i386/i486/bits/string.h
+++ b/sysdeps/i386/i486/bits/string.h
@@ -1056,59 +1056,61 @@ __strncat_g (char *__dest, __const char __src[], size_t __n)
 		  : (__builtin_constant_p (s1) && sizeof ((s1)[0]) == 1	      \
 		     && sizeof ((s2)[0]) == 1 && strlen (s1) < 4	      \
 		     ? (__builtin_constant_p (s2) && sizeof ((s2)[0]) == 1    \
-			? __strcmp_cc (s1, s2, strlen (s1))		      \
-			: __strcmp_cg (s1, s2, strlen (s1)))		      \
+			? __strcmp_cc ((unsigned char *) (s1),		      \
+				       (unsigned char *) (s2), strlen (s1))   \
+			: __strcmp_cg ((unsigned char *) (s1),		      \
+				       (unsigned char *) (s2), strlen (s1)))  \
 		     : (__builtin_constant_p (s2) && sizeof ((s1)[0]) == 1    \
 			&& sizeof ((s2)[0]) == 1 && strlen (s2) < 4	      \
 			? (__builtin_constant_p (s1)			      \
-			   ? __strcmp_cc (s1, s2, strlen (s2))		      \
-			   : __strcmp_gc (s1, s2, strlen (s2)))		      \
+			   ? __strcmp_cc ((unsigned char *) (s1),	      \
+					  (unsigned char *) (s2),	      \
+					  strlen (s2))			      \
+			   : __strcmp_gc ((unsigned char *) (s1),	      \
+					  (unsigned char *) (s2),	      \
+					  strlen (s2)))			      \
 			: __strcmp_gg (s1, s2)))))
 
 #define __strcmp_cc(s1, s2, l) \
-  (__extension__ ({ register int __result = ((unsigned char) (s1)[0]	      \
-					     - (unsigned char) (s2)[0]);      \
+  (__extension__ ({ register int __result = (s1)[0] - (s2)[0];		      \
 		    if (l > 0 && __result == 0)				      \
 		      {							      \
-			__result = ((unsigned char) (s1)[1]		      \
-				    - (unsigned char) (s2)[1]);		      \
+			__result = (s1)[1] - (s2)[1];			      \
 			if (l > 1 && __result == 0)			      \
 			  {						      \
-			    __result = ((unsigned char) (s1)[2]		      \
-					- (unsigned char) (s2)[2]);	      \
+			    __result = (s1)[2] - (s2)[2];		      \
 			    if (l > 2 && __result == 0)			      \
-			      __result = ((unsigned char) (s1)[3]	      \
-					  - (unsigned char) (s2)[3]);	      \
+			      __result = (s1)[3] - (s2)[3];		      \
 			  }						      \
 		      }							      \
 		    __result; }))
 
 #define __strcmp_cg(s1, s2, l1) \
-  (__extension__ ({ __const unsigned char *__s2 = (unsigned char *) (s2);     \
-		    register int __result = (unsigned char) (s1)[0] - __s2[0];\
+  (__extension__ ({ __const unsigned char *__s2 = (s2);			      \
+		    register int __result = (s1)[0] - __s2[0];		      \
 		    if (l1 > 0 && __result == 0)			      \
 		      {							      \
-			__result = (unsigned char) (s1)[1] - __s2[1];	      \
+			__result = (s1)[1] - __s2[1];			      \
 			if (l1 > 1 && __result == 0)			      \
 			  {						      \
-			    __result = (unsigned char) (s1)[2] - __s2[2];     \
+			    __result = (s1)[2] - __s2[2];		      \
 			    if (l1 > 2 && __result == 0)		      \
-			      __result = (unsigned char) (s1)[3] - __s2[3];   \
+			      __result = (s1)[3] - __s2[3];		      \
 			  }						      \
 		      }							      \
 		    __result; }))
 
 #define __strcmp_gc(s1, s2, l2) \
-  (__extension__ ({ __const unsigned char *__s1 = (unsigned char *) (s1);     \
-		    register int __result = __s1[0] - (unsigned char) (s2)[0];\
+  (__extension__ ({ __const unsigned char *__s1 = (s1);			      \
+		    register int __result = __s1[0] - (s2)[0];		      \
 		    if (l2 > 0 && __result == 0)			      \
 		      {							      \
-			__result = __s1[1] - (unsigned char) (s2)[1];	      \
+			__result = __s1[1] - (s2)[1];			      \
 			if (l2 > 1 && __result == 0)			      \
 			  {						      \
-			    __result = __s1[2] - (unsigned char) (s2)[2];     \
+			    __result = __s1[2] - (s2)[2];		      \
 			    if (l2 > 2 && __result == 0)		      \
-			      __result = __s1[3] - (unsigned char) (s2)[3];   \
+			      __result = __s1[3] - (s2)[3];		      \
 			  }						      \
 		      }							      \
 		    __result; }))