Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-06-09 15:33:57 +0400
committerCorinna Vinschen <corinna@vinschen.de>2009-06-09 15:33:57 +0400
commit5c1939c8c42304ae9dd6a438cd676dbd9b59210c (patch)
treed2581eebde9eaccb60397ff164fe0c953d57b82a
parent962082b91a94ece6fe07db3a26aa102368ebdc56 (diff)
* libc/ctype/tolower.c (tolower): Cast conversion result from
mbtowc/wctomb to unsigned char to avoid negative return values. * libc/ctype/toupper.c (toupper): Ditto.
-rw-r--r--newlib/ChangeLog6
-rw-r--r--newlib/libc/ctype/tolower.c2
-rw-r--r--newlib/libc/ctype/toupper.c2
3 files changed, 8 insertions, 2 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index f7a962ca9..d501fe600 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,9 @@
+2009-06-09 Corinna Vinschen <corinna@vinschen.de>
+
+ * libc/ctype/tolower.c (tolower): Cast conversion result from
+ mbtowc/wctomb to unsigned char to avoid negative return values.
+ * libc/ctype/toupper.c (toupper): Ditto.
+
2009-06-03 IWAMURO Motonori <deenheart@gmail.com>
* libc/string/wcwidth.c: Optimize for speed.
diff --git a/newlib/libc/ctype/tolower.c b/newlib/libc/ctype/tolower.c
index 66ba7233c..8a3843ef2 100644
--- a/newlib/libc/ctype/tolower.c
+++ b/newlib/libc/ctype/tolower.c
@@ -67,7 +67,7 @@ _DEFUN(tolower,(c),int c)
wchar_t wc;
if (mbtowc (&wc, s, 1) >= 0
&& wctomb (s, (wchar_t) towlower ((wint_t) wc)) == 1)
- c = s[0];
+ c = (unsigned char) s[0];
}
return c;
#else
diff --git a/newlib/libc/ctype/toupper.c b/newlib/libc/ctype/toupper.c
index 1b298d508..2527a69d3 100644
--- a/newlib/libc/ctype/toupper.c
+++ b/newlib/libc/ctype/toupper.c
@@ -66,7 +66,7 @@ _DEFUN(toupper,(c),int c)
wchar_t wc;
if (mbtowc (&wc, s, 1) >= 0
&& wctomb (s, (wchar_t) towupper ((wint_t) wc)) == 1)
- c = s[0];
+ c = (unsigned char) s[0];
}
return c;
#else