From 5c1939c8c42304ae9dd6a438cd676dbd9b59210c Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 9 Jun 2009 11:33:57 +0000 Subject: * 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. --- newlib/libc/ctype/tolower.c | 2 +- newlib/libc/ctype/toupper.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'newlib/libc') 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 -- cgit v1.2.3