[Libreoffice-commits] core.git: basic/source comphelper/source helpcompiler/inc helpcompiler/source hwpfilter/source include/rtl lingucomponent/source rsc/source sal/rtl soltools/mkdepend tools/source

Stephan Bergmann sbergman at redhat.com
Wed Mar 22 09:01:23 UTC 2017


 basic/source/comp/symtbl.cxx                             |    2 
 comphelper/source/misc/string.cxx                        |    2 
 helpcompiler/inc/HelpCompiler.hxx                        |    3 
 helpcompiler/source/HelpCompiler.cxx                     |    2 
 hwpfilter/source/hbox.cxx                                |    5 
 hwpfilter/source/hwpeq.cxx                               |   20 ++-
 include/rtl/character.hxx                                |   76 +++++++++++++++
 lingucomponent/source/languageguessing/simpleguesser.cxx |    3 
 rsc/source/tools/rscchar.cxx                             |    2 
 sal/rtl/math.cxx                                         |    8 +
 soltools/mkdepend/collectdircontent.cxx                  |   12 +-
 tools/source/inet/inetmime.cxx                           |   12 +-
 tools/source/inet/inetmsg.cxx                            |   12 +-
 tools/source/ref/globname.cxx                            |    8 -
 14 files changed, 136 insertions(+), 31 deletions(-)

New commits:
commit 7778d9f51bd1f4d086cafe95995406c3157afb89
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Mar 21 22:50:15 2017 +0100

    Prevent calls to rtl/character.hxx functions with (signed) char arguments
    
    ...that would implicitly be sign extended (for plain char only if it is signed),
    so non-ASCII char values would trigger the isUnicodeCodePoint assert.
    
    Change-Id: Iaf8024ad509e64525558e882fe3fd078cfb4ea91
    Reviewed-on: https://gerrit.libreoffice.org/35523
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx
index be8ac764768f..a2bf316b60d0 100644
--- a/basic/source/comp/symtbl.cxx
+++ b/basic/source/comp/symtbl.cxx
@@ -321,7 +321,7 @@ void SbiSymDef::SetType( SbxDataType t )
         sal_Unicode cu = aName[0];
         if( cu < 256 )
         {
-            char ch = (char)cu;
+            unsigned char ch = (unsigned char)cu;
             if( ch == '_' )
             {
                 ch = 'Z';
diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx
index db035eb22967..828728f113e7 100644
--- a/comphelper/source/misc/string.cxx
+++ b/comphelper/source/misc/string.cxx
@@ -375,7 +375,7 @@ bool isdigitAsciiString(const OUString &rString)
 {
     return std::all_of(
         rString.getStr(), rString.getStr() + rString.getLength(),
-        rtl::isAsciiDigit);
+        [](sal_Unicode c){ return rtl::isAsciiDigit(c); });
 }
 
 namespace
diff --git a/helpcompiler/inc/HelpCompiler.hxx b/helpcompiler/inc/HelpCompiler.hxx
index 0e4975424d9d..b888ce7512c6 100644
--- a/helpcompiler/inc/HelpCompiler.hxx
+++ b/helpcompiler/inc/HelpCompiler.hxx
@@ -238,7 +238,8 @@ private:
 
 inline char tocharlower(char c)
 {
-    return static_cast<char>(rtl::toAsciiLowerCase(c));
+    return static_cast<char>(
+        rtl::toAsciiLowerCase(static_cast<unsigned char>(c)));
 }
 
 #endif
diff --git a/helpcompiler/source/HelpCompiler.cxx b/helpcompiler/source/HelpCompiler.cxx
index e456f5acd5b5..50a215db7527 100644
--- a/helpcompiler/source/HelpCompiler.cxx
+++ b/helpcompiler/source/HelpCompiler.cxx
@@ -460,7 +460,7 @@ bool HelpCompiler::compile()
     std::string appl = module.substr(1);
     for (char & i : appl)
     {
-        i=rtl::toAsciiUpperCase(i);
+        i=rtl::toAsciiUpperCase(static_cast<unsigned char>(i));
     }
     xmlNodePtr docResolved = clone(xmlDocGetRootElement(docResolvedOrg), appl);
     myparser aparser(documentId, fileName, title);
diff --git a/hwpfilter/source/hbox.cxx b/hwpfilter/source/hbox.cxx
index fcf1026179e1..3701f9298720 100644
--- a/hwpfilter/source/hbox.cxx
+++ b/hwpfilter/source/hbox.cxx
@@ -581,7 +581,8 @@ static void getOutlineNumStr(int style, int level, int num, hchar * hstr)
             ptr = buf;
             while (*ptr)
             {
-                *ptr = sal::static_int_cast<char>(rtl::toAsciiUpperCase(*ptr));
+                *ptr = sal::static_int_cast<char>(
+                    rtl::toAsciiUpperCase(static_cast<unsigned char>(*ptr)));
                 ptr++;
             }
         }
@@ -683,7 +684,7 @@ hchar_string Outline::GetUnicode() const
                                 char *ptr = dest;
                                 while( *ptr )
                                 {
-                                    *ptr = sal::static_int_cast<char>(rtl::toAsciiUpperCase(*ptr));
+                                    *ptr = sal::static_int_cast<char>(rtl::toAsciiUpperCase(static_cast<unsigned char>(*ptr)));
                                     ptr++;
                                 }
                             }
diff --git a/hwpfilter/source/hwpeq.cxx b/hwpfilter/source/hwpeq.cxx
index e7afd609524c..170a68c81ed1 100644
--- a/hwpfilter/source/hwpeq.cxx
+++ b/hwpfilter/source/hwpeq.cxx
@@ -418,15 +418,16 @@ void make_keyword( char *keyword, const char *token)
     memcpy(keyword, token, len);
     keyword[len] = 0;
 
-    if( (token[0] & 0x80) || rtl::isAsciiLowerCase(token[0]) || strlen(token) < 2 )
+    if( (token[0] & 0x80) || rtl::isAsciiLowerCase(static_cast<unsigned char>(token[0])) || strlen(token) < 2 )
         return;
 
-    bool capital = rtl::isAsciiUpperCase(keyword[1]);
+    bool capital = rtl::isAsciiUpperCase(
+        static_cast<unsigned char>(keyword[1]));
     for( ptr = keyword + 2; *ptr && result; ptr++ )
     {
         if( (*ptr & 0x80) ||
-            (!capital && rtl::isAsciiUpperCase(*ptr)) ||
-            (capital && rtl::isAsciiLowerCase(*ptr)) )
+            (!capital && rtl::isAsciiUpperCase(static_cast<unsigned char>(*ptr))) ||
+            (capital && rtl::isAsciiLowerCase(static_cast<unsigned char>(*ptr))) )
         {
             result = false;
         }
@@ -437,8 +438,9 @@ void make_keyword( char *keyword, const char *token)
         ptr = keyword;
         while( *ptr )
         {
-            if( rtl::isAsciiUpperCase(*ptr) )
-                *ptr = sal::static_int_cast<char>(rtl::toAsciiLowerCase(*ptr));
+            if( rtl::isAsciiUpperCase(static_cast<unsigned char>(*ptr)) )
+                *ptr = sal::static_int_cast<char>(
+                    rtl::toAsciiLowerCase(static_cast<unsigned char>(*ptr)));
             ptr++;
         }
     }
@@ -689,8 +691,10 @@ static char eq2ltxconv(MzString& sstr, istream *strm, const char *sentinel)
         key[0] = '\\';
         strcpy(key + 1, eq->key);
       }
-      if( (eq->flag & EQ_CASE) && rtl::isAsciiUpperCase(token[0]) )
-        key[1] = sal::static_int_cast<char>(rtl::toAsciiUpperCase(key[1]));
+      if( (eq->flag & EQ_CASE)
+          && rtl::isAsciiUpperCase(static_cast<unsigned char>(token[0])) )
+        key[1] = sal::static_int_cast<char>(
+            rtl::toAsciiUpperCase(static_cast<unsigned char>(key[1])));
       token = key;
     }
 
diff --git a/include/rtl/character.hxx b/include/rtl/character.hxx
index 4546c9f2d5e0..4ccc632afb4a 100644
--- a/include/rtl/character.hxx
+++ b/include/rtl/character.hxx
@@ -57,6 +57,13 @@ inline bool isAscii(sal_uInt32 code)
     return code <= 0x7F;
 }
 
+#if defined LIBO_INTERNAL_ONLY
+bool isAscii(char) = delete;
+bool isAscii(signed char) = delete;
+template<typename T> inline bool isAscii(T code)
+{ return isAscii(sal_uInt32(code)); }
+#endif
+
 /** Check for ASCII lower case character.
 
     @param code  A Unicode code point.
@@ -72,6 +79,13 @@ inline bool isAsciiLowerCase(sal_uInt32 code)
     return code >= 'a' && code <= 'z';
 }
 
+#if defined LIBO_INTERNAL_ONLY
+bool isAsciiLowerCase(char) = delete;
+bool isAsciiLowerCase(signed char) = delete;
+template<typename T> inline bool isAsciiLowerCase(T code)
+{ return isAsciiLowerCase(sal_uInt32(code)); }
+#endif
+
 /** Check for ASCII upper case character.
 
     @param code  A Unicode code point.
@@ -87,6 +101,13 @@ inline bool isAsciiUpperCase(sal_uInt32 code)
     return code >= 'A' && code <= 'Z';
 }
 
+#if defined LIBO_INTERNAL_ONLY
+bool isAsciiUpperCase(char) = delete;
+bool isAsciiUpperCase(signed char) = delete;
+template<typename T> inline bool isAsciiUpperCase(T code)
+{ return isAsciiUpperCase(sal_uInt32(code)); }
+#endif
+
 /** Check for ASCII alphabetic character.
 
     @param code  A Unicode code point.
@@ -102,6 +123,13 @@ inline bool isAsciiAlpha(sal_uInt32 code)
     return isAsciiLowerCase(code) || isAsciiUpperCase(code);
 }
 
+#if defined LIBO_INTERNAL_ONLY
+bool isAsciiAlpha(char) = delete;
+bool isAsciiAlpha(signed char) = delete;
+template<typename T> inline bool isAsciiAlpha(T code)
+{ return isAsciiAlpha(sal_uInt32(code)); }
+#endif
+
 /** Check for ASCII digit character.
 
     @param code  A Unicode code point.
@@ -117,6 +145,13 @@ inline bool isAsciiDigit(sal_uInt32 code)
     return code >= '0' && code <= '9';
 }
 
+#if defined LIBO_INTERNAL_ONLY
+bool isAsciiDigit(char) = delete;
+bool isAsciiDigit(signed char) = delete;
+template<typename T> inline bool isAsciiDigit(T code)
+{ return isAsciiDigit(sal_uInt32(code)); }
+#endif
+
 /** Check for ASCII alphanumeric character.
 
     @param code  A Unicode code point.
@@ -132,6 +167,13 @@ inline bool isAsciiAlphanumeric(sal_uInt32 code)
     return isAsciiDigit(code) || isAsciiAlpha(code);
 }
 
+#if defined LIBO_INTERNAL_ONLY
+bool isAsciiAlphanumeric(char) = delete;
+bool isAsciiAlphanumeric(signed char) = delete;
+template<typename T> inline bool isAsciiAlphanumeric(T code)
+{ return isAsciiAlphanumeric(sal_uInt32(code)); }
+#endif
+
 /** Check for ASCII canonic hexadecimal digit character.
 
     @param code  A Unicode code point.
@@ -147,6 +189,13 @@ inline bool isAsciiCanonicHexDigit(sal_uInt32 code)
     return isAsciiDigit(code) || (code >= 'A' && code <= 'F');
 }
 
+#if defined LIBO_INTERNAL_ONLY
+bool isAsciiCanonicHexDigit(char) = delete;
+bool isAsciiCanonicHexDigit(signed char) = delete;
+template<typename T> inline bool isAsciiCanonicHexDigit(T code)
+{ return isAsciiCanonicHexDigit(sal_uInt32(code)); }
+#endif
+
 /** Check for ASCII hexadecimal digit character.
 
     @param code  A Unicode code point.
@@ -162,6 +211,13 @@ inline bool isAsciiHexDigit(sal_uInt32 code)
     return isAsciiCanonicHexDigit(code) || (code >= 'a' && code <= 'f');
 }
 
+#if defined LIBO_INTERNAL_ONLY
+bool isAsciiHexDigit(char) = delete;
+bool isAsciiHexDigit(signed char) = delete;
+template<typename T> inline bool isAsciiHexDigit(T code)
+{ return isAsciiHexDigit(sal_uInt32(code)); }
+#endif
+
 /** Check for ASCII octal digit character.
 
     @param code  A Unicode code point.
@@ -176,6 +232,12 @@ inline bool isAsciiOctalDigit(sal_uInt32 code)
     return code >= '0' && code <= '7';
 }
 
+#if defined LIBO_INTERNAL_ONLY
+bool isAsciiOctalDigit(char) = delete;
+bool isAsciiOctalDigit(signed char) = delete;
+template<typename T> inline bool isAsciiOctalDigit(T code)
+{ return isAsciiOctalDigit(sal_uInt32(code)); }
+#endif
 
 /** Convert a character, if ASCII, to upper case.
 
@@ -191,6 +253,13 @@ inline sal_uInt32 toAsciiUpperCase(sal_uInt32 code)
     return isAsciiLowerCase(code) ? code - 32 : code;
 }
 
+#if defined LIBO_INTERNAL_ONLY
+sal_uInt32 toAsciiUpperCase(char) = delete;
+sal_uInt32 toAsciiUpperCase(signed char) = delete;
+template<typename T> inline sal_uInt32 toAsciiUpperCase(T code)
+{ return toAsciiUpperCase(sal_uInt32(code)); }
+#endif
+
 /** Convert a character, if ASCII, to lower case.
 
     @param code  A Unicode code point.
@@ -205,6 +274,13 @@ inline sal_uInt32 toAsciiLowerCase(sal_uInt32 code)
     return isAsciiUpperCase(code) ? code + 32 : code;
 }
 
+#if defined LIBO_INTERNAL_ONLY
+sal_uInt32 toAsciiLowerCase(char) = delete;
+sal_uInt32 toAsciiLowerCase(signed char) = delete;
+template<typename T> inline sal_uInt32 toAsciiLowerCase(T code)
+{ return toAsciiLowerCase(sal_uInt32(code)); }
+#endif
+
 /** Compare two characters ignoring ASCII case.
 
     @param code1  A Unicode code point.
diff --git a/lingucomponent/source/languageguessing/simpleguesser.cxx b/lingucomponent/source/languageguessing/simpleguesser.cxx
index 9fef4a402dbb..d5227edbdc01 100644
--- a/lingucomponent/source/languageguessing/simpleguesser.cxx
+++ b/lingucomponent/source/languageguessing/simpleguesser.cxx
@@ -61,7 +61,8 @@ static int startsAsciiCaseInsensitive(const std::string &s1, const std::string &
                 min = s2.length();
 
             for(i = 0; i < min && s2[i] && s1[i] && !ret; i++){
-                    ret =   rtl::toAsciiUpperCase(s1[i]) -  rtl::toAsciiUpperCase(s2[i]);
+                    ret = rtl::toAsciiUpperCase(static_cast<unsigned char>(s1[i]))
+                        -  rtl::toAsciiUpperCase(static_cast<unsigned char>(s2[i]));
                     if(s1[i] == '.' || s2[i] == '.') {ret = 0;}    //. is a neutral character
             }
         return ret;
diff --git a/rsc/source/tools/rscchar.cxx b/rsc/source/tools/rscchar.cxx
index a41310af27ac..463622671766 100644
--- a/rsc/source/tools/rscchar.cxx
+++ b/rsc/source/tools/rscchar.cxx
@@ -110,7 +110,7 @@ char * RscChar::MakeUTF8( char * pStr, sal_uInt16 nTextEncoding )
                         {
                             if( isdigit( *pStr ) )
                                 nChar = nChar * 16 + (sal_uInt8)*pStr - (sal_uInt8)'0';
-                            else if( rtl::isAsciiUpperCase( *pStr ) )
+                            else if( rtl::isAsciiUpperCase( static_cast<unsigned char>(*pStr) ) )
                                 nChar = nChar * 16 + (sal_uInt8)*pStr - (sal_uInt8)'A' +10;
                             else
                                 nChar = nChar * 16 + (sal_uInt8)*pStr - (sal_uInt8)'a' +10;
diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 72558a946131..5dc94e0e0c1f 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -918,8 +918,12 @@ double SAL_CALL rtl_math_stringToDouble(sal_Char const * pBegin,
                                         sal_Char const ** pParsedEnd)
     SAL_THROW_EXTERN_C()
 {
-    return stringToDouble(pBegin, pEnd, cDecSeparator, cGroupSeparator, pStatus,
-                          pParsedEnd);
+    return stringToDouble(
+        reinterpret_cast<unsigned char const *>(pBegin),
+        reinterpret_cast<unsigned char const *>(pEnd),
+        static_cast<unsigned char>(cDecSeparator),
+        static_cast<unsigned char>(cGroupSeparator), pStatus,
+        reinterpret_cast<unsigned char const **>(pParsedEnd));
 }
 
 double SAL_CALL rtl_math_uStringToDouble(sal_Unicode const * pBegin,
diff --git a/soltools/mkdepend/collectdircontent.cxx b/soltools/mkdepend/collectdircontent.cxx
index c001ee05042c..3aa4981055fb 100644
--- a/soltools/mkdepend/collectdircontent.cxx
+++ b/soltools/mkdepend/collectdircontent.cxx
@@ -30,7 +30,11 @@ void IncludesCollection::add_to_collection(const string& dirPath) {
     }
     do {
         string winFileName(FindFileData.cFileName);
-        transform(winFileName.begin(), winFileName.end(), winFileName.begin(), rtl::toAsciiLowerCase);
+        transform(
+            winFileName.begin(), winFileName.end(), winFileName.begin(),
+            [](char c) {
+                return rtl::toAsciiLowerCase(static_cast<unsigned char>(c));
+            });
         dirContent.insert(winFileName);
     } while (FindNextFile(hFind, &FindFileData));
 #else
@@ -52,7 +56,11 @@ void IncludesCollection::add_to_collection(const string& dirPath) {
 
 bool IncludesCollection::exists(string filePath) {
 #if defined(_WIN32)
-    transform(filePath.begin(), filePath.end(), filePath.begin(), rtl::toAsciiLowerCase);
+    transform(
+        filePath.begin(), filePath.end(), filePath.begin(),
+        [](char c) {
+            return rtl::toAsciiLowerCase(static_cast<unsigned char>(c));
+        });
 #endif // defined( WNT )
     PathFilePair dirFile = split_path(filePath);
     string dirPath = dirFile.first;
diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx
index ad15355f19de..27f120a360df 100644
--- a/tools/source/inet/inetmime.cxx
+++ b/tools/source/inet/inetmime.cxx
@@ -892,7 +892,9 @@ bool equalIgnoreCase(const sal_Char * pBegin1,
 
     while (*pString2 != 0)
         if (pBegin1 == pEnd1
-            || rtl::toAsciiUpperCase(*pBegin1++) != rtl::toAsciiUpperCase(*pString2++))
+            || (rtl::toAsciiUpperCase(static_cast<unsigned char>(*pBegin1++))
+                != rtl::toAsciiUpperCase(
+                    static_cast<unsigned char>(*pString2++))))
             return false;
     return pBegin1 == pEnd1;
 }
@@ -1154,7 +1156,9 @@ bool INetMIME::equalIgnoreCase(const sal_Unicode * pBegin1,
 
     while (*pString2 != 0)
         if (pBegin1 == pEnd1
-            || rtl::toAsciiUpperCase(*pBegin1++) != rtl::toAsciiUpperCase(*pString2++))
+            || (rtl::toAsciiUpperCase(*pBegin1++)
+                != rtl::toAsciiUpperCase(
+                    static_cast<unsigned char>(*pString2++))))
             return false;
     return pBegin1 == pEnd1;
 }
@@ -1317,7 +1321,9 @@ OUString INetMIME::decodeHeaderFieldBody(const OString& rBody)
 
                             default:
                                 if (pLanguageBegin != nullptr
-                                    && (!rtl::isAsciiAlpha(cChar) || ++nAlphaCount > 8))
+                                    && (!rtl::isAsciiAlpha(
+                                            static_cast<unsigned char>(cChar))
+                                        || ++nAlphaCount > 8))
                                     pLanguageBegin = nullptr;
                                 break;
                         }
diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx
index 5dec8ff21142..704c44fad587 100644
--- a/tools/source/inet/inetmsg.cxx
+++ b/tools/source/inet/inetmsg.cxx
@@ -57,7 +57,9 @@ static const sal_Char *months[12] =
 static sal_uInt16 ParseNumber(const OString& rStr, sal_Int32& nIndex)
 {
     sal_Int32 n = nIndex;
-    while ((n < rStr.getLength()) && rtl::isAsciiDigit(rStr[n])) n++;
+    while ((n < rStr.getLength())
+           && rtl::isAsciiDigit(static_cast<unsigned char>(rStr[n])))
+        n++;
 
     OString aNum(rStr.copy(nIndex, (n - nIndex)));
     nIndex = n;
@@ -68,7 +70,9 @@ static sal_uInt16 ParseNumber(const OString& rStr, sal_Int32& nIndex)
 static sal_uInt16 ParseMonth(const OString& rStr, sal_Int32& nIndex)
 {
     sal_Int32 n = nIndex;
-    while ((n < rStr.getLength()) && rtl::isAsciiAlpha(rStr[n])) n++;
+    while ((n < rStr.getLength())
+           && rtl::isAsciiAlpha(static_cast<unsigned char>(rStr[n])))
+        n++;
 
     OString aMonth(rStr.copy(nIndex, 3));
     nIndex = n;
@@ -99,7 +103,7 @@ bool INetMIMEMessage::ParseDateField (
 
         while (
             (nIndex < aDateField.getLength()) &&
-            (rtl::isAsciiAlpha (aDateField[nIndex]) ||
+            (rtl::isAsciiAlpha (static_cast<unsigned char>(aDateField[nIndex])) ||
              (aDateField[nIndex] == ',')     ))
             nIndex++;
 
@@ -107,7 +111,7 @@ bool INetMIMEMessage::ParseDateField (
                (aDateField[nIndex] == ' '))
             nIndex++;
 
-        if (rtl::isAsciiAlpha (aDateField[nIndex]))
+        if (rtl::isAsciiAlpha (static_cast<unsigned char>(aDateField[nIndex])))
         {
             // Format: ctime().
             if ((aDateField.getLength() - nIndex) < 20) return false;
diff --git a/tools/source/ref/globname.cxx b/tools/source/ref/globname.cxx
index 67bbf7e153be..d6395b79a33a 100644
--- a/tools/source/ref/globname.cxx
+++ b/tools/source/ref/globname.cxx
@@ -188,7 +188,7 @@ bool SvGlobalName::MakeId( const OUString & rIdStr )
                 if( isdigit( *pStr ) )
                     nFirst = nFirst * 16 + (*pStr - '0');
                 else
-                    nFirst = nFirst * 16 + (rtl::toAsciiUpperCase( *pStr ) - 'A' + 10 );
+                    nFirst = nFirst * 16 + (rtl::toAsciiUpperCase( static_cast<unsigned char>(*pStr) ) - 'A' + 10 );
             else
                 return false;
             pStr++;
@@ -202,7 +202,7 @@ bool SvGlobalName::MakeId( const OUString & rIdStr )
                 if( isdigit( *pStr ) )
                     nSec = nSec * 16 + (*pStr - '0');
                 else
-                    nSec = nSec * 16 + (sal_uInt16)(rtl::toAsciiUpperCase( *pStr ) - 'A' + 10 );
+                    nSec = nSec * 16 + (sal_uInt16)(rtl::toAsciiUpperCase( static_cast<unsigned char>(*pStr) ) - 'A' + 10 );
             else
                 return false;
             pStr++;
@@ -216,7 +216,7 @@ bool SvGlobalName::MakeId( const OUString & rIdStr )
                 if( isdigit( *pStr ) )
                     nThird = nThird * 16 + (*pStr - '0');
                 else
-                    nThird = nThird * 16 + (sal_uInt16)(rtl::toAsciiUpperCase( *pStr ) - 'A' + 10 );
+                    nThird = nThird * 16 + (sal_uInt16)(rtl::toAsciiUpperCase( static_cast<unsigned char>(*pStr) ) - 'A' + 10 );
             else
                 return false;
             pStr++;
@@ -231,7 +231,7 @@ bool SvGlobalName::MakeId( const OUString & rIdStr )
                 if( isdigit( *pStr ) )
                     szRemain[i/2] = szRemain[i/2] * 16 + (*pStr - '0');
                 else
-                    szRemain[i/2] = szRemain[i/2] * 16 + (sal_Int8)(rtl::toAsciiUpperCase( *pStr ) - 'A' + 10 );
+                    szRemain[i/2] = szRemain[i/2] * 16 + (sal_Int8)(rtl::toAsciiUpperCase( static_cast<unsigned char>(*pStr) ) - 'A' + 10 );
             else
                 return false;
             pStr++;


More information about the Libreoffice-commits mailing list