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

Noel Grandin noel at peralex.com
Tue Mar 18 04:53:01 PDT 2014


 i18npool/source/localedata/localedata.cxx |   19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

New commits:
commit 6181013d9989bb5c96e88ea1bc8d581b99c28421
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Mar 18 11:35:08 2014 +0200

    convert sal_Char* to OUString
    
    I can see no reason to store sBulletName as an sal_Char* instead
    of converting backwards and forwards from OUString
    
    Change-Id: Ib16b9f04c5738aa2346c9b5b4f28461fc8b60c4f
    Reviewed-on: https://gerrit.libreoffice.org/8641
    Tested-by: Michael Stahl <mstahl at redhat.com>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx
index a45bab1..7af865c 100644
--- a/i18npool/source/localedata/localedata.cxx
+++ b/i18npool/source/localedata/localedata.cxx
@@ -1354,7 +1354,7 @@ struct OutlineNumberingLevel_Impl
     sal_Int16       nNumType; //com::sun::star::style::NumberingType
     OUString        sSuffix;
     sal_Unicode     cBulletChar;
-    const sal_Char* sBulletFontName;
+    OUString        sBulletFontName;
     sal_Int16       nParentNumbering;
     sal_Int32       nLeftMargin;
     sal_Int32       nSymbolTextDistance;
@@ -1383,17 +1383,6 @@ public:
     virtual sal_Bool SAL_CALL hasElements(  ) throw(RuntimeException, std::exception);
 };
 
-static sal_Char* U2C( const OUString& str )
-{
-    sal_Char* s = new sal_Char[ str.getLength()+1 ];
-    int i;
-    for( i = 0; i < str.getLength(); i++)
-        s[i] = sal::static_int_cast<sal_Char>( str[i] );
-    s[i]='\0';
-    return s;
-}
-
-
 Sequence< Reference<container::XIndexAccess> > SAL_CALL
 LocaleDataImpl::getOutlineNumberingLevels( const lang::Locale& rLocale ) throw(RuntimeException)
 {
@@ -1432,7 +1421,7 @@ LocaleDataImpl::getOutlineNumberingLevels( const lang::Locale& rLocale ) throw(R
                         case 1: level[j].nNumType            = sal::static_int_cast<sal_Int16>(tmp.toInt32()); break;
                         case 2: level[j].sSuffix             = tmp;             break;
                         case 3: level[j].cBulletChar         = sal::static_int_cast<sal_Unicode>(tmp.toUInt32(16)); break; // base 16
-                        case 4: level[j].sBulletFontName     = U2C( tmp );      break;
+                        case 4: level[j].sBulletFontName     = tmp;             break;
                         case 5: level[j].nParentNumbering    = sal::static_int_cast<sal_Int16>(tmp.toInt32()); break;
                         case 6: level[j].nLeftMargin         = tmp.toInt32();   break;
                         case 7: level[j].nSymbolTextDistance = tmp.toInt32();   break;
@@ -1449,7 +1438,7 @@ LocaleDataImpl::getOutlineNumberingLevels( const lang::Locale& rLocale ) throw(R
             level[j].nNumType            = 0;
             level[j].sSuffix             = aEmptyStr;
             level[j].cBulletChar         = 0;
-            level[j].sBulletFontName     = 0;
+            level[j].sBulletFontName     = aEmptyStr;
             level[j].nParentNumbering    = 0;
             level[j].nLeftMargin         = 0;
             level[j].nSymbolTextDistance = 0;
@@ -1585,7 +1574,7 @@ Any OutlineNumbering::getByIndex( sal_Int32 nIndex )
     pValues[3].Name = "BulletChar";
     pValues[3].Value <<= OUString(&pTemp->cBulletChar, 1);
     pValues[4].Name = "BulletFontName";
-    pValues[4].Value <<= OUString::createFromAscii(pTemp->sBulletFontName);
+    pValues[4].Value <<= pTemp->sBulletFontName;
     pValues[5].Name = "ParentNumbering";
     pValues[5].Value <<= OUString::number(pTemp->nParentNumbering);
     pValues[6].Name = "LeftMargin";


More information about the Libreoffice-commits mailing list