[PATCH] Polishing 7d1f4cdec307bb1e761bb5dd3d8231bba5833e10
Christina Roßmanith (via_Code_Review)
gerrit at gerrit.libreoffice.org
Tue Mar 12 02:07:29 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/2676
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/76/2676/1
Polishing 7d1f4cdec307bb1e761bb5dd3d8231bba5833e10
Change-Id: I73334fca8429dc0ad4250ce638027fa52245dec4
---
M unotools/source/misc/fontdefs.cxx
M vcl/aqua/source/gdi/atsui/salatsuifontutils.cxx
M vcl/generic/fontmanager/fontsubst.cxx
M vcl/generic/glyphs/glyphcache.cxx
M vcl/source/gdi/outdev3.cxx
5 files changed, 23 insertions(+), 25 deletions(-)
diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx
index fb24325..37c60dc 100644
--- a/unotools/source/misc/fontdefs.cxx
+++ b/unotools/source/misc/fontdefs.cxx
@@ -447,7 +447,7 @@
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 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 5703eac..214dec7 100644
--- a/vcl/aqua/source/gdi/atsui/salatsuifontutils.cxx
+++ b/vcl/aqua/source/gdi/atsui/salatsuifontutils.cxx
@@ -302,10 +302,10 @@
else if( eEncoding == RTL_TEXTENCODING_UCS4 )
aUtf16Name = OUString(); // TODO
else // assume the non-unicode encoded names are byte encoded
-+ aUtf16Name = OUString( &aNameBuffer[0], nNameLength, eEncoding );
+ 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 @@
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 @@
// 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 @@
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 @@
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 cb23cf5..95ef29a 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -1396,7 +1396,7 @@
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 @@
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 @@
}
// find the matching device font
- if( rFontSelData.maSearchName.getLength() != 0 )
+ if( !rFontSelData.maSearchName.isEmpty() )
pFallbackData = FindFontFamily( rFontSelData.maSearchName );
}
@@ -1536,11 +1536,11 @@
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 @@
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 @@
#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 @@
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 @@
// 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 @@
while( nTokenPos != -1 )
{
rFSD.maTargetName = GetNextFontToken( rFSD.GetFamilyName(), nTokenPos );
- if( !rFSD.maTargetName.getLength() )
+ if( rFSD.maTargetName.isEmpty() )
continue;
aSearchName = rFSD.maTargetName;
--
To view, visit https://gerrit.libreoffice.org/2676
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I73334fca8429dc0ad4250ce638027fa52245dec4
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Christina Roßmanith <ChrRossmanith at web.de>
More information about the LibreOffice
mailing list