[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Cvs-cvs] Changes to ccvs/lib/strncasecmp.c
From: |
Derek Robert Price |
Subject: |
[Cvs-cvs] Changes to ccvs/lib/strncasecmp.c |
Date: |
Thu, 20 Oct 2005 17:06:07 -0400 |
Index: ccvs/lib/strncasecmp.c
diff -u ccvs/lib/strncasecmp.c:1.3 ccvs/lib/strncasecmp.c:1.4
--- ccvs/lib/strncasecmp.c:1.3 Mon Sep 19 21:26:14 2005
+++ ccvs/lib/strncasecmp.c Thu Oct 20 21:06:01 2005
@@ -1,5 +1,5 @@
/* strncasecmp.c -- case insensitive string comparator
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,6 +23,7 @@
#include "strcase.h"
#include <ctype.h>
+#include <limits.h>
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
@@ -54,5 +55,11 @@
}
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);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Cvs-cvs] Changes to ccvs/lib/strncasecmp.c,
Derek Robert Price <=