cvs-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Cvs-cvs] Changes to ccvs/lib/strcasecmp.c


From: Derek Robert Price
Subject: [Cvs-cvs] Changes to ccvs/lib/strcasecmp.c
Date: Thu, 20 Oct 2005 17:06:04 -0400

Index: ccvs/lib/strcasecmp.c
diff -u ccvs/lib/strcasecmp.c:1.3 ccvs/lib/strcasecmp.c:1.4
--- ccvs/lib/strcasecmp.c:1.3   Sun Sep  4 05:58:56 2005
+++ ccvs/lib/strcasecmp.c       Thu Oct 20 21:06:01 2005
@@ -25,6 +25,7 @@
 #include "strcase.h"
 
 #include <ctype.h>
+#include <limits.h>
 
 #if HAVE_MBRTOWC
 # include "mbuiter.h"
@@ -93,6 +94,12 @@
        }
       while (c1 == c2);
 
-      return c1 - c2;
+      if (UCHAR_MAX <= INT_MAX)
+       return c1 - c2;
+      else
+       /* On machines where 'char' and 'int' are types of the same size, the
+          difference of two 'unsigned char' values - including the sign bit -
+          doesn't fit in an 'int'.  */
+       return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
     }
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]