[PATCH] Changed compareTo to startsWith

Ricardo Botto (via Code Review) gerrit at gerrit.libreoffice.org
Sat May 18 12:25:35 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3956

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/56/3956/1

Changed compareTo to startsWith

Change-Id: Ia72e220f29c26bdf789bd3f1102b850aafcf525d
---
M vcl/generic/fontmanager/fontsubst.cxx
M vcl/source/gdi/outdev3.cxx
M vcl/source/window/window.cxx
3 files changed, 8 insertions(+), 10 deletions(-)



diff --git a/vcl/generic/fontmanager/fontsubst.cxx b/vcl/generic/fontmanager/fontsubst.cxx
index 94dcda1..36c683d 100644
--- a/vcl/generic/fontmanager/fontsubst.cxx
+++ b/vcl/generic/fontmanager/fontsubst.cxx
@@ -160,8 +160,8 @@
     if( rFontSelData.IsSymbolFont() )
         return false;
     // StarSymbol is a unicode font, but it still deserves the symbol flag
-    if( 0 == rFontSelData.maSearchName.compareTo( "starsymbol", 10)
-    ||  0 == rFontSelData.maSearchName.compareTo( "opensymbol", 10) )
+    if(rFontSelData.maSearchName.startsWith( "starsymbol" )
+    || rFontSelData.maSearchName.startsWith( "opensymbol" ) )
         return false;
 
     //see fdo#41556 and fdo#47636
@@ -229,8 +229,8 @@
     if( rFontSelData.IsSymbolFont() )
         return false;
     // StarSymbol is a unicode font, but it still deserves the symbol flag
-    if( 0 == rFontSelData.maSearchName.compareTo( "starsymbol", 10)
-    ||  0 == rFontSelData.maSearchName.compareTo( "opensymbol", 10) )
+    if(rFontSelData.maSearchName.startsWith( "starsymbol" )
+    || rFontSelData.maSearchName.startsWith( "opensymbol" ) )
         return false;
 
     const FontSelectPattern aOut = GetFcSubstitute( rFontSelData, rMissingCodes );
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index c1ee2f0..784b31f 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -695,8 +695,8 @@
 {
     // StarSymbol is a unicode font, but it still deserves the symbol flag
     if( !IsSymbolFont() )
-        if( 0 == GetFamilyName().compareTo( "starsymbol", 10)
-        ||  0 == GetFamilyName().compareTo( "opensymbol", 10) )
+        if( GetFamilyName().startsWith( "starsymbol")
+        ||  GetFamilyName().startsWith( "opensymbol") )
             SetSymbolFlag( true );
 }
 
@@ -755,11 +755,11 @@
     int nMatch = 0;
 
     const OUString& rFontName = rFSD.maTargetName;
-    if( (rFontName == GetFamilyName()) || rFontName.compareTo( GetFamilyName() ) )
+    if( (rFontName == GetFamilyName()) || rFontName == GetFamilyName() )
         nMatch += 240000;
 
     if( rStatus.mpTargetStyleName
-    &&  GetStyleName().compareTo( rStatus.mpTargetStyleName ) )
+    &&  GetStyleName() == rStatus.mpTargetStyleName )
         nMatch += 120000;
 
     if( (rFSD.GetPitch() != PITCH_DONTKNOW) && (rFSD.GetPitch() == GetPitch()) )
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index bc59719..13dfdb4 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -8856,8 +8856,6 @@
 
 sal_uInt16 Window::GetAccessibleRole() const
 {
-    using namespace ::com::sun::star;
-
     sal_uInt16 nRole = mpWindowImpl->mpAccessibleInfos ? mpWindowImpl->mpAccessibleInfos->nAccessibleRole : 0xFFFF;
     if ( nRole == 0xFFFF )
         nRole = getDefaultAccessibleRole();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia72e220f29c26bdf789bd3f1102b850aafcf525d
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Ricardo Botto <andarilho.botto at gmail.com>



More information about the LibreOffice mailing list