Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2919

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/19/2919/1

Replace String with OUString in RecodeString

Change-Id: I987f738d1cd7d640a253f3cd31864290b6d763bf
---
M unotools/inc/unotools/fontdefs.hxx
M unotools/source/misc/fontcvt.cxx
M vcl/source/gdi/outdev3.cxx
3 files changed, 17 insertions(+), 9 deletions(-)



diff --git a/unotools/inc/unotools/fontdefs.hxx b/unotools/inc/unotools/fontdefs.hxx
index f923464..60c37d4 100644
--- a/unotools/inc/unotools/fontdefs.hxx
+++ b/unotools/inc/unotools/fontdefs.hxx
@@ -22,6 +22,8 @@
 #include <unotools/unotoolsdllapi.h>
 #include <sal/types.h>
 #include <tools/string.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
 
 namespace utl {
   class FontSubstConfiguration;
@@ -54,7 +56,7 @@
     const char*         mpSubsFontName;
     sal_Unicode         (*mpCvtFunc)( sal_Unicode );
     sal_Unicode         RecodeChar( sal_Unicode c ) const;
-    void                RecodeString( String& rStra, xub_StrLen nIndex, xub_StrLen nLen ) const;
+    void                RecodeString( OUString& rStra, sal_Int32 nIndex, sal_Int32 nLen ) const;
     static const ConvertChar* GetRecodeData( const String& rOrgFontName, const String& 
rMapFontName );
 };
 
diff --git a/unotools/source/misc/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx
index fe870ed..99e07ee 100644
--- a/unotools/source/misc/fontcvt.cxx
+++ b/unotools/source/misc/fontcvt.cxx
@@ -1372,15 +1372,17 @@
 
 // recode the string assuming the character codes are symbol codes
 // from an traditional symbol font (i.e. U+F020..U+F0FF)
-void ConvertChar::RecodeString( String& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const
+void ConvertChar::RecodeString( OUString& rStr, sal_Int32 nIndex, sal_Int32 nLen ) const
 {
-    sal_uLong nLastIndex = (sal_uLong)nIndex + nLen;
-    if( nLastIndex > rStr.Len() )
-        nLastIndex = rStr.Len();
+    sal_Int32 nLastIndex = nIndex + nLen;
+    OUStringBuffer    aTmpStr(rStr);
+
+    if( nLastIndex > aTmpStr.getLength() )
+        nLastIndex = aTmpStr.getLength();
 
     for(; nIndex < nLastIndex; ++nIndex )
     {
-        sal_Unicode cOrig = rStr.GetChar( nIndex );
+        sal_Unicode cOrig = rStr[ nIndex ];
         // only recode symbols and their U+00xx aliases
         if( ((cOrig < 0x0020) || (cOrig > 0x00FF))
         &&  ((cOrig < 0xF020) || (cOrig > 0xF0FF)) )
@@ -1389,8 +1391,9 @@
         // recode a symbol
         sal_Unicode cNew = RecodeChar( cOrig );
         if( cOrig != cNew )
-            rStr.SetChar( nIndex, cNew );
+            aTmpStr[ nIndex ] = cNew;
     }
+    rStr = aTmpStr.makeStringAndClear();
 }
 
 //=======================================================================
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index df1016c..565fcae 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -5836,8 +5836,11 @@
 
     // convert from logical units to physical units
     // recode string if needed
-    if( mpFontEntry->mpConversion )
-        mpFontEntry->mpConversion->RecodeString( aStr, 0, aStr.Len() );
+    if( mpFontEntry->mpConversion ) {
+        OUString aTmpStr(aStr); // only needed until aStr is OUString as well
+        mpFontEntry->mpConversion->RecodeString( aTmpStr, 0, aTmpStr.getLength() );
+        aStr = String(aTmpStr);
+    }
 
     long nPixelWidth = nLogicalWidth;
     if( nLogicalWidth && mbMap )

-- 
To view, visit https://gerrit.libreoffice.org/2919
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I987f738d1cd7d640a253f3cd31864290b6d763bf
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Christina Roßmanith <ChrRossmanith@web.de>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.