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

Caolán McNamara caolanm at redhat.com
Fri Jul 28 10:43:22 UTC 2017


 cui/source/dialogs/cuicharmap.cxx |   12 +++++-------
 cui/source/inc/cuicharmap.hxx     |    2 +-
 2 files changed, 6 insertions(+), 8 deletions(-)

New commits:
commit f59284e3369f249b33dbd2adb4ed44d72840d78f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jul 28 11:39:48 2017 +0100

    pass char code directly rather than as-text
    
    and then turning it back into the code again
    
    Change-Id: Iae9cddb18a6bdad4b1ba8c2af81f3d29a7f26725

diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx
index a7f8ae6eacf3..e37a6163aea5 100644
--- a/cui/source/dialogs/cuicharmap.cxx
+++ b/cui/source/dialogs/cuicharmap.cxx
@@ -666,14 +666,12 @@ IMPL_LINK_NOARG(SvxCharacterMap, FontSelectHdl, ListBox&, void)
     m_pSubsetLB->Enable(bNeedSubset);
 }
 
-void SvxCharacterMap::setCharName(char decimal[])
+void SvxCharacterMap::setCharName(sal_UCS4 nDecimalValue)
 {
-    int nDecimalValue = std::stoi(decimal);
-    char buffer[100];
-
     /* get the character name */
     UErrorCode errorCode = U_ZERO_ERROR;
-    u_charName((UChar32)nDecimalValue, U_UNICODE_CHAR_NAME, buffer, sizeof(buffer), &errorCode);
+    char buffer[100];
+    u_charName(nDecimalValue, U_UNICODE_CHAR_NAME, buffer, sizeof(buffer), &errorCode);
     m_pCharName->SetText(OUString::createFromAscii(buffer));
 }
 
@@ -790,7 +788,7 @@ IMPL_LINK(SvxCharacterMap, CharClickHdl, SvxCharView*, rView, void)
 
     m_pHexCodeText->SetText( aHexText );
     m_pDecimalCodeText->SetText( aDecimalText );
-    setCharName(aDecBuf);
+    setCharName(cChar);
 
     rView->Invalidate();
     m_pOKBtn->Enable();
@@ -879,7 +877,7 @@ IMPL_LINK_NOARG(SvxCharacterMap, CharHighlightHdl, SvxShowCharSet*, void)
         char aDecBuf[32];
         snprintf( aDecBuf, sizeof(aDecBuf), "%u", static_cast<unsigned>(cChar) );
         aDecimalText = OUString::createFromAscii(aDecBuf);
-        setCharName(aDecBuf);
+        setCharName(cChar);
     }
 
     // Update the hex and decimal codes only if necessary
diff --git a/cui/source/inc/cuicharmap.hxx b/cui/source/inc/cuicharmap.hxx
index 2681bb610ac4..9f4f2e9a0fb2 100644
--- a/cui/source/inc/cuicharmap.hxx
+++ b/cui/source/inc/cuicharmap.hxx
@@ -144,7 +144,7 @@ public:
     void            updateFavCharControl();
     void            setFavButtonState(const OUString& sTitle, const OUString& rFont);
 
-    void            setCharName(char decimal[]);
+    void            setCharName(sal_UCS4 nDecimalValue);
 };
 
 #endif


More information about the Libreoffice-commits mailing list