[haiku-commits] haiku: hrev52616 - src/system/libroot/posix/locale

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 2 Dec 2018 16:28:47 -0500 (EST)

hrev52616 adds 1 changeset to branch 'master'
old head: bc6fcc8aae6d6ce890a0e66fc06c7a1d689bdbac
new head: 9f4b382338406973304c65bbb2e88334589b0075
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=9f4b38233840+%5Ebc6fcc8aae6d

----------------------------------------------------------------------------

9f4b38233840: wctype: have towlower and towupper check char ranges with no 
locale backend.
  
  Change-Id: Ie63977bcf54ce9b0a2fa542ba5327c8e8b050e2e
  Reviewed-on: https://review.haiku-os.org/740
  Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>

                                   [ Jérôme Duval <jerome.duval@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev52616
Commit:      9f4b382338406973304c65bbb2e88334589b0075
URL:         https://git.haiku-os.org/haiku/commit/?id=9f4b38233840
Author:      Jérôme Duval <jerome.duval@xxxxxxxxx>
Date:        Thu Nov 29 17:25:44 2018 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Sun Dec  2 21:28:43 2018 UTC

----------------------------------------------------------------------------

1 file changed, 8 insertions(+), 2 deletions(-)
src/system/libroot/posix/locale/wctype.cpp | 10 ++++++++--

----------------------------------------------------------------------------

diff --git a/src/system/libroot/posix/locale/wctype.cpp 
b/src/system/libroot/posix/locale/wctype.cpp
index d2d225647c..8534aaa28f 100644
--- a/src/system/libroot/posix/locale/wctype.cpp
+++ b/src/system/libroot/posix/locale/wctype.cpp
@@ -123,8 +123,11 @@ iswxdigit(wint_t wc)
 wint_t
 towlower(wint_t wc)
 {
-       if (gLocaleBackend == NULL)
+       if (gLocaleBackend == NULL) {
+               if (wc < 0 || wc > 127)
+                       return wc;
                return tolower(wc);
+       }
 
        wint_t result = wc;
        gLocaleBackend->ToWCTrans(wc, _ISlower, result);
@@ -136,8 +139,11 @@ towlower(wint_t wc)
 wint_t
 towupper(wint_t wc)
 {
-       if (gLocaleBackend == NULL)
+       if (gLocaleBackend == NULL) {
+               if (wc < 0 || wc > 127)
+                       return wc;
                return toupper(wc);
+       }
 
        wint_t result = wc;
        gLocaleBackend->ToWCTrans(wc, _ISupper, result);


Other related posts:

  • » [haiku-commits] haiku: hrev52616 - src/system/libroot/posix/locale - waddlesplash