[Libreoffice-commits] core.git: include/tools tools/source

Stephan Bergmann sbergman at redhat.com
Tue Feb 21 14:16:19 UTC 2017


 include/tools/inetmime.hxx     |    9 ---------
 tools/source/fsys/urlobj.cxx   |   18 ++++++++++++++++--
 tools/source/inet/inetmime.cxx |   12 ------------
 3 files changed, 16 insertions(+), 23 deletions(-)

New commits:
commit 5c99f2c8524625491ba1b4d736bdd457d258eea3
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 21 15:15:30 2017 +0100

    Move INetMIME::getHexDigit(int to its only place of use
    
    Change-Id: I8d02a51a0da5aad4cd95e15fe6bb329b43e32067

diff --git a/include/tools/inetmime.hxx b/include/tools/inetmime.hxx
index 69d5836..106e561 100644
--- a/include/tools/inetmime.hxx
+++ b/include/tools/inetmime.hxx
@@ -109,15 +109,6 @@ public:
      */
     static inline int getHexWeight(sal_uInt32 nChar);
 
-    /** Get a hexadecimal digit encoded as US-ASCII.
-
-        @param nWeight  Must be in the range 0--15, inclusive.
-
-        @return  The canonic (i.e., upper case) hexadecimal digit
-        corresponding to nWeight (US-ASCII '0'--'9' or 'A'--'F').
-     */
-    static sal_uInt32 getHexDigit(int nWeight);
-
     /** Check two US-ASCII strings for equality, ignoring case.
 
         @param pBegin1  Points to the start of the first string, must not be
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index 455ece0..45af339 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -36,6 +36,7 @@
 #include <sal/types.h>
 
 #include <algorithm>
+#include <cassert>
 #include <limits>
 #include <memory>
 
@@ -406,13 +407,26 @@ inline INetURLObject::SchemeInfo const & INetURLObject::getSchemeInfo() const
     return getSchemeInfo(m_eScheme);
 }
 
+namespace {
+
+sal_Unicode getHexDigit(sal_uInt32 nWeight)
+{
+    assert(nWeight < 16);
+    static const sal_Unicode aDigits[16]
+        = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C',
+            'D', 'E', 'F' };
+    return aDigits[nWeight];
+}
+
+}
+
 // static
 inline void INetURLObject::appendEscape(OUStringBuffer & rTheText,
                                         sal_uInt32 nOctet)
 {
     rTheText.append( '%' );
-    rTheText.append( (sal_Unicode)INetMIME::getHexDigit(int(nOctet >> 4)) );
-    rTheText.append( (sal_Unicode)INetMIME::getHexDigit(int(nOctet & 15)) );
+    rTheText.append( getHexDigit(nOctet >> 4) );
+    rTheText.append( getHexDigit(nOctet & 15) );
 }
 
 namespace {
diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx
index 8fc5a45..ad15355 100644
--- a/tools/source/inet/inetmime.cxx
+++ b/tools/source/inet/inetmime.cxx
@@ -1145,18 +1145,6 @@ bool INetMIME::isIMAPAtomChar(sal_uInt32 nChar)
 }
 
 // static
-sal_uInt32 INetMIME::getHexDigit(int nWeight)
-{
-    DBG_ASSERT(nWeight >= 0 && nWeight < 16,
-               "INetMIME::getHexDigit(): Bad weight");
-
-    static const sal_Char aDigits[16]
-        = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C',
-            'D', 'E', 'F' };
-    return aDigits[nWeight];
-}
-
-// static
 bool INetMIME::equalIgnoreCase(const sal_Unicode * pBegin1,
                                const sal_Unicode * pEnd1,
                                const sal_Char * pString2)


More information about the Libreoffice-commits mailing list