[Libreoffice-commits] core.git: unotools/source vcl/aqua vcl/generic vcl/source

Chr. Rossmanith ChrRossmanith at gmx.de
Tue Mar 12 16:12:36 PDT 2013


 unotools/source/misc/fontdefs.cxx               |    8 +++-----
 vcl/aqua/source/gdi/atsui/salatsuifontutils.cxx |    2 +-
 vcl/generic/fontmanager/fontsubst.cxx           |    6 +++---
 vcl/generic/glyphs/glyphcache.cxx               |    6 +++---
 vcl/source/gdi/outdev3.cxx                      |   24 ++++++++++++------------
 5 files changed, 22 insertions(+), 24 deletions(-)

New commits:
commit f92a5927052f1e96ed864dd6bc6326531db4fd1f
Author: Chr. Rossmanith <ChrRossmanith at gmx.de>
Date:   Tue Mar 12 10:05:38 2013 +0100

    Polishing 7d1f4cdec307bb1e761bb5dd3d8231bba5833e10
    
    Change-Id: I73334fca8429dc0ad4250ce638027fa52245dec4
    Reviewed-on: https://gerrit.libreoffice.org/2676
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx
index fb24325..ad8ab62 100644
--- a/unotools/source/misc/fontdefs.cxx
+++ b/unotools/source/misc/fontdefs.cxx
@@ -447,7 +447,7 @@ void GetEnglishSearchFontName( OUString& rName )
 OUString GetNextFontToken( const OUString& rTokenStr, sal_Int32& rIndex )
 {
     // check for valid start index
-    int nStringLen = rTokenStr.getLength();
+    sal_Int32 nStringLen = rTokenStr.getLength();
     if( rIndex >= nStringLen )
     {
         rIndex = -1;
@@ -504,13 +504,11 @@ static bool ImplIsFontToken( const OUString& rName, const String& rToken )
 
 static void ImplAppendFontToken( OUString& rName, const String& rNewToken )
 {
-    if ( rName.getLength() )
+    if ( !rName.isEmpty() )
     {
         rName += ";" ;
-        rName += rNewToken ;
     }
-    else
-        rName = rNewToken;
+    rName += rNewToken;
 }
 
 void AddTokenFontName( OUString& rName, const OUString& rNewToken )
diff --git a/vcl/aqua/source/gdi/atsui/salatsuifontutils.cxx b/vcl/aqua/source/gdi/atsui/salatsuifontutils.cxx
index 2ac160d..502c33b 100644
--- a/vcl/aqua/source/gdi/atsui/salatsuifontutils.cxx
+++ b/vcl/aqua/source/gdi/atsui/salatsuifontutils.cxx
@@ -305,7 +305,7 @@ static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDF
             aUtf16Name = OUString( &aNameBuffer[0], nNameLength, eEncoding );
 
         // ignore empty strings
-        if( aUtf16Name.getLength() <= 0 )
+        if( aUtf16Name.isEmpty() )
             continue;
 
         // handle the name depending on its namecode
diff --git a/vcl/generic/fontmanager/fontsubst.cxx b/vcl/generic/fontmanager/fontsubst.cxx
index fac314c..a339ca9 100644
--- a/vcl/generic/fontmanager/fontsubst.cxx
+++ b/vcl/generic/fontmanager/fontsubst.cxx
@@ -184,10 +184,10 @@ bool FcPreMatchSubstititution::FindFontSubstitute( FontSelectPattern &rFontSelDa
         return true;
     }
 
-    rtl::OUString aDummy;
+    OUString aDummy;
     const FontSelectPattern aOut = GetFcSubstitute( rFontSelData, aDummy );
 
-    if( !aOut.maSearchName.getLength() )
+    if( aOut.maSearchName.isEmpty() )
         return false;
 
     const bool bHaveSubstitute = !uselessmatch( rFontSelData, aOut );
@@ -238,7 +238,7 @@ bool FcGlyphFallbackSubstititution::FindFontSubstitute( FontSelectPattern& rFont
     // FC doing it would be preferable because it knows the invariables
     // e.g. FC knows the FC rule that all Arial gets replaced by LiberationSans
     // whereas we would have to check for every size or attribute
-    if( !aOut.maSearchName.getLength() )
+    if( aOut.maSearchName.isEmpty() )
         return false;
 
     const bool bHaveSubstitute = !uselessmatch( rFontSelData, aOut );
diff --git a/vcl/generic/glyphs/glyphcache.cxx b/vcl/generic/glyphs/glyphcache.cxx
index 1d1322c..bc9fb09 100644
--- a/vcl/generic/glyphs/glyphcache.cxx
+++ b/vcl/generic/glyphs/glyphcache.cxx
@@ -87,7 +87,7 @@ size_t GlyphCache::IFSD_Hash::operator()( const FontSelectPattern& rFontSelData
     sal_IntPtr nFontId = reinterpret_cast<sal_IntPtr>( rFontSelData.mpFontData );
 #ifdef ENABLE_GRAPHITE
     if (rFontSelData.maTargetName.indexOf(grutils::GrFeatureParser::FEAT_PREFIX)
-        != STRING_NOTFOUND)
+        != -1)
     {
         rtl::OString aFeatName = rtl::OUStringToOString( rFontSelData.maTargetName, RTL_TEXTENCODING_UTF8 );
         nFontId ^= aFeatName.hashCode();
@@ -139,9 +139,9 @@ bool GlyphCache::IFSD_Equal::operator()( const FontSelectPattern& rA, const Font
         return false;
    // check for features
    if ((rA.maTargetName.indexOf(grutils::GrFeatureParser::FEAT_PREFIX)
-        != STRING_NOTFOUND ||
+        != -1 ||
         rB.maTargetName.indexOf(grutils::GrFeatureParser::FEAT_PREFIX)
-        != STRING_NOTFOUND) && rA.maTargetName != rB.maTargetName)
+        != -1) && rA.maTargetName != rB.maTargetName)
         return false;
 #endif
 
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index db1db91..aeb20c4 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -1396,7 +1396,7 @@ ImplDevFontListData* ImplDevFontList::GetGlyphFallbackFont( FontSelectPattern& r
             cChar = rMissingCodes.iterateCodePoints( &nStrIndex );
             bCached = rFontSelData.mpFontEntry->GetFallbackForUnicode( cChar, rFontSelData.GetWeight(), &rFontSelData.maSearchName );
             // ignore entries which don't have a fallback
-            if( !bCached || (rFontSelData.maSearchName.getLength() != 0) )
+            if( !bCached || !rFontSelData.maSearchName.isEmpty() )
                 break;
         }
 
@@ -1443,7 +1443,7 @@ ImplDevFontListData* ImplDevFontList::GetGlyphFallbackFont( FontSelectPattern& r
                          break;
                      cChar = aOldMissingCodes.iterateCodePoints( &nStrIndex );
                 }
-                if( rFontSelData.maSearchName.getLength() != 0 )
+                if( !rFontSelData.maSearchName.isEmpty() )
                 {
                     // remove cache entries that were still not resolved
                     for( nStrIndex = 0; nStrIndex < rMissingCodes.getLength(); )
@@ -1456,7 +1456,7 @@ ImplDevFontListData* ImplDevFontList::GetGlyphFallbackFont( FontSelectPattern& r
         }
 
         // find the matching device font
-        if( rFontSelData.maSearchName.getLength() != 0 )
+        if( !rFontSelData.maSearchName.isEmpty() )
             pFallbackData = FindFontFamily( rFontSelData.maSearchName );
     }
 
@@ -1536,11 +1536,11 @@ ImplDevFontListData* ImplDevFontList::ImplFindByAliasName(const rtl::OUString& r
     while( it != maDevFontList.end() )
     {
         ImplDevFontListData* pData = (*it).second;
-        if( !pData->maMapNames.getLength() )
+        if( pData->maMapNames.isEmpty() )
             continue;
 
         // if one alias name matches we found a matching font
-        rtl::OUString aTempName;
+        OUString aTempName;
         sal_Int32 nIndex = 0;
         do
         {
@@ -1576,7 +1576,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByTokenNames(const rtl::OUString&
     for( sal_Int32 nTokenPos = 0; nTokenPos != -1; )
     {
         OUString aSearchName = GetNextFontToken( rTokenStr, nTokenPos );
-        if( !aSearchName.getLength() )
+        if( aSearchName.isEmpty() )
             continue;
         GetEnglishSearchFontName( aSearchName );
         pFoundData = ImplFindBySearchName( aSearchName );
@@ -2510,10 +2510,10 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( FontSelectPattern& rFSD,
 #ifdef ENABLE_GRAPHITE
         // Until features are properly supported, they are appended to the
         // font name, so we need to strip them off so the font is found.
-        xub_StrLen nFeat = aSearchName.indexOf(grutils::GrFeatureParser::FEAT_PREFIX);
+        sal_Int32 nFeat = aSearchName.indexOf(grutils::GrFeatureParser::FEAT_PREFIX);
         String aOrigName = rFSD.maTargetName;
-        String aBaseFontName(aSearchName, 0, (nFeat != STRING_NOTFOUND)?nFeat:aSearchName.getLength());
-        if (nFeat != STRING_NOTFOUND && STRING_NOTFOUND !=
+        String aBaseFontName(aSearchName, 0, (nFeat != -1)?nFeat:aSearchName.getLength());
+        if (nFeat != -1 && -1 !=
             aSearchName.indexOf(grutils::GrFeatureParser::FEAT_ID_VALUE_SEPARATOR, nFeat))
         {
             aSearchName = aBaseFontName;
@@ -2543,7 +2543,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( FontSelectPattern& rFSD,
             else if( aSearchName.equalsIgnoreAsciiCase( "hgpminchob" ) )
                 aBoldName = OUString("hgpminchoe");
 
-            if( aBoldName.getLength() && ImplFindBySearchName( aBoldName ) )
+            if( !aBoldName.isEmpty() && ImplFindBySearchName( aBoldName ) )
             {
                 // the other font is available => use it
                 aSearchName = aBoldName;
@@ -2672,7 +2672,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( FontSelectPattern& rFSD,
 
     // use font fallback
     const FontNameAttr* pFontAttr = NULL;
-    if( aSearchName.getLength() )
+    if( !aSearchName.isEmpty() )
     {
         // get fallback info using FontSubstConfiguration and
         // the target name, it's shortened name and family name in that order
@@ -2706,7 +2706,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( FontSelectPattern& rFSD,
     while( nTokenPos != -1 )
     {
         rFSD.maTargetName = GetNextFontToken( rFSD.GetFamilyName(), nTokenPos );
-        if( !rFSD.maTargetName.getLength() )
+        if( rFSD.maTargetName.isEmpty() )
             continue;
 
         aSearchName = rFSD.maTargetName;


More information about the Libreoffice-commits mailing list