From: Roger Sayle Date: Tue, 20 Dec 2005 18:48:47 +0000 (+0000) Subject: decNumber.c (decStrEq): Cast string contents to unsigned char instead of int before... X-Git-Tag: releases/gcc-4.2.0~5210 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d0e51567d78584ab77abbc5d6ea9f24077df477;p=thirdparty%2Fgcc.git decNumber.c (decStrEq): Cast string contents to unsigned char instead of int before calling tolower. * decNumber.c (decStrEq): Cast string contents to unsigned char instead of int before calling tolower. From-SVN: r108862 --- diff --git a/libdecnumber/ChangeLog b/libdecnumber/ChangeLog index f7368a44c347..706beaaa0a5c 100644 --- a/libdecnumber/ChangeLog +++ b/libdecnumber/ChangeLog @@ -1,3 +1,8 @@ +2005-12-20 Roger Sayle + + * decNumber.c (decStrEq): Cast string contents to unsigned char + instead of int before calling tolower. + 2005-12-20 Roger Sayle * decNumber.c (decStrEq): Cast operands to int before calling diff --git a/libdecnumber/decNumber.c b/libdecnumber/decNumber.c index 0625e9f2541b..bc11ace87872 100644 --- a/libdecnumber/decNumber.c +++ b/libdecnumber/decNumber.c @@ -5438,14 +5438,16 @@ decStrEq (const char *str1, const char *str2) { for (;; str1++, str2++) { - if (*str1 == *str2) + unsigned char u1 = (unsigned char) *str1; + unsigned char u2 = (unsigned char) *str2; + if (u1 == u2) { - if (*str1 == '\0') + if (u1 == '\0') break; } else { - if (tolower ((int) *str1) != tolower ((int) *str2)) + if (tolower (u1) != tolower (u2)) return 0; } } /* stepping */