[Libreoffice-commits] core.git: sc/source

Eike Rathke erack at redhat.com
Fri Oct 16 09:16:21 PDT 2015


 sc/source/core/tool/address.cxx |   17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

New commits:
commit 9f5ab26bdada54898cac79e3c524664926de66b5
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Oct 16 18:11:17 2015 +0200

    use rtl::toAsciiUpperCase() instead of home baked lcl_toupper()
    
    Change-Id: I73dcf0d9f7741409c4dbf1c75f2d7f43649889bb

diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index d301e65..2c39f1b 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -834,15 +834,6 @@ static sal_uInt16 lcl_ScRange_Parse_XL_R1C1( ScRange& r,
     return 0;
 }
 
-static inline sal_Unicode lcl_toupper( const sal_Unicode c )
-{
-    // Do not use libc toupper() because that is localized and *might* yield
-    // unexpected results (apparently not encountered yet?), for example
-    // Turkish lower case ASCII 'i' might result in upper case 'İ', which is
-    // U+0130 but 0xDD in ISO-8859-9 and 0xA9 in ISO-8859-3 encodings.
-    return ('a' <= c && c <= 'z') ? c - ('a'-'A') : c;
-}
-
 static inline const sal_Unicode* lcl_a1_get_col( const sal_Unicode* p,
                                                  ScAddress* pAddr,
                                                  sal_uInt16* nFlags )
@@ -855,9 +846,9 @@ static inline const sal_Unicode* lcl_a1_get_col( const sal_Unicode* p,
     if( !rtl::isAsciiAlpha( *p ) )
         return NULL;
 
-    nCol = sal::static_int_cast<SCCOL>( lcl_toupper( *p++ ) - 'A' );
+    nCol = sal::static_int_cast<SCCOL>( rtl::toAsciiUpperCase( *p++ ) - 'A' );
     while (nCol <= MAXCOL && rtl::isAsciiAlpha(*p))
-        nCol = sal::static_int_cast<SCCOL>( ((nCol + 1) * 26) + lcl_toupper( *p++ ) - 'A' );
+        nCol = sal::static_int_cast<SCCOL>( ((nCol + 1) * 26) + rtl::toAsciiUpperCase( *p++ ) - 'A' );
     if( nCol > MAXCOL || rtl::isAsciiAlpha( *p ) )
         return NULL;
 
@@ -1154,9 +1145,9 @@ static sal_uInt16 lcl_ScAddress_Parse_OOo( const sal_Unicode* p, ScDocument* pDo
 
         if (rtl::isAsciiAlpha( *p ))
         {
-            nCol = sal::static_int_cast<SCCOL>( lcl_toupper( *p++ ) - 'A' );
+            nCol = sal::static_int_cast<SCCOL>( rtl::toAsciiUpperCase( *p++ ) - 'A' );
             while (nCol < MAXCOL && rtl::isAsciiAlpha(*p))
-                nCol = sal::static_int_cast<SCCOL>( ((nCol + 1) * 26) + lcl_toupper( *p++ ) - 'A' );
+                nCol = sal::static_int_cast<SCCOL>( ((nCol + 1) * 26) + rtl::toAsciiUpperCase( *p++ ) - 'A' );
         }
         else
             nBits = 0;


More information about the Libreoffice-commits mailing list