vcl/generic/fontmanager/fontcache.cxx | 39 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 19 deletions(-)
New commits: commit 4e85b537d1229348bef16bb006d9e6b5303bd6c9 Author: Caolán McNamara <caol...@redhat.com> Date: Fri Jan 13 14:26:03 2012 +0000 tidy some string types diff --git a/vcl/generic/fontmanager/fontcache.cxx b/vcl/generic/fontmanager/fontcache.cxx index 40877fc..616799a 100644 --- a/vcl/generic/fontmanager/fontcache.cxx +++ b/vcl/generic/fontmanager/fontcache.cxx @@ -267,7 +267,7 @@ void FontCache::read() OString aLine; aStream.ReadLine( aLine ); - if( !aLine.equals( rtl::OString(RTL_CONSTASCII_STRINGPARAM( CACHE_MAGIC )) ) ) + if (!aLine.equalsL(RTL_CONSTASCII_STRINGPARAM(CACHE_MAGIC))) { #if OSL_DEBUG_LEVEL >1 fprintf( stderr, "FontCache::read: cache file %s fails magic test\n", rtl::OUStringToOString(m_aCacheFile, osl_getThreadTextEncoding()).getStr() ); @@ -277,7 +277,6 @@ void FontCache::read() int nDir = 0; FontDirMap* pDir = NULL; - xub_StrLen nIndex; bool bKeepOnlyUserOverridden = false; do { @@ -286,12 +285,12 @@ void FontCache::read() aLine.compareTo( RTL_CONSTASCII_STRINGPARAM( "EmptyFontCacheDirectory:" ) ) == 0 ) { bool bEmpty = (aLine.compareTo( RTL_CONSTASCII_STRINGPARAM ("Empty" ) ) == 0); - xub_StrLen nSearchIndex = bEmpty ? 24 : 19; + sal_Int32 nSearchIndex = bEmpty ? 24 : 19; OString aDir; sal_Int64 nTimestamp = 0; - xub_StrLen nTEnd = aLine.indexOf( ':', nSearchIndex ); - if( nTEnd != STRING_NOTFOUND ) + sal_Int32 nTEnd = aLine.indexOf( ':', nSearchIndex ); + if( nTEnd != -1 ) { rtl::OString aTimeStamp = aLine.copy( nSearchIndex, nTEnd - nSearchIndex ); nTimestamp = aTimeStamp.toInt64(); @@ -368,6 +367,8 @@ void FontCache::read() default: break; } + sal_Int32 nIndex; + for( nIndex = 0; nIndex < nLen && pLine[nIndex] != ';'; nIndex++ ) ; @@ -376,7 +377,7 @@ void FontCache::read() sal_True ); while( nIndex < nLen ) { - xub_StrLen nLastIndex = nIndex+1; + sal_Int32 nLastIndex = nIndex+1; for( nIndex = nLastIndex ; nIndex < nLen && pLine[nIndex] != ';'; nIndex++ ) ; if( nIndex - nLastIndex ) commit eed2ad8025fbfd8c8b9ed8d83068700585bf7b13 Author: Christina Rossmanith <chrrossman...@web.de> Date: Thu Jan 12 10:52:31 2012 +0100 Replace (Byte)String with rtl::O(U)String diff --git a/vcl/generic/fontmanager/fontcache.cxx b/vcl/generic/fontmanager/fontcache.cxx index 9c71963..40877fc 100644 --- a/vcl/generic/fontmanager/fontcache.cxx +++ b/vcl/generic/fontmanager/fontcache.cxx @@ -265,9 +265,9 @@ void FontCache::read() } - ByteString aLine; + OString aLine; aStream.ReadLine( aLine ); - if( !aLine.Equals( CACHE_MAGIC ) ) + if( !aLine.equals( rtl::OString(RTL_CONSTASCII_STRINGPARAM( CACHE_MAGIC )) ) ) { #if OSL_DEBUG_LEVEL >1 fprintf( stderr, "FontCache::read: cache file %s fails magic test\n", rtl::OUStringToOString(m_aCacheFile, osl_getThreadTextEncoding()).getStr() ); @@ -282,20 +282,20 @@ void FontCache::read() do { aStream.ReadLine( aLine ); - if( aLine.CompareTo( "FontCacheDirectory:", 19 ) == COMPARE_EQUAL || - aLine.CompareTo( "EmptyFontCacheDirectory:", 24 ) == COMPARE_EQUAL ) + if( aLine.compareTo( RTL_CONSTASCII_STRINGPARAM( "FontCacheDirectory:" ) ) == 0 || + aLine.compareTo( RTL_CONSTASCII_STRINGPARAM( "EmptyFontCacheDirectory:" ) ) == 0 ) { - bool bEmpty = (aLine.CompareTo( "Empty", 5 ) == COMPARE_EQUAL); + bool bEmpty = (aLine.compareTo( RTL_CONSTASCII_STRINGPARAM ("Empty" ) ) == 0); xub_StrLen nSearchIndex = bEmpty ? 24 : 19; OString aDir; sal_Int64 nTimestamp = 0; - xub_StrLen nTEnd = aLine.Search( ':', nSearchIndex ); + xub_StrLen nTEnd = aLine.indexOf( ':', nSearchIndex ); if( nTEnd != STRING_NOTFOUND ) { - rtl::OString aTimeStamp = aLine.Copy( nSearchIndex, nTEnd - nSearchIndex ); + rtl::OString aTimeStamp = aLine.copy( nSearchIndex, nTEnd - nSearchIndex ); nTimestamp = aTimeStamp.toInt64(); - aDir = aLine.Copy( nTEnd+1 ); + aDir = aLine.copy( nTEnd+1 ); } else { @@ -327,12 +327,12 @@ void FontCache::read() m_aCache[ nDir ].m_bUserOverrideOnly = bKeepOnlyUserOverridden; } } - else if( pDir && aLine.CompareTo( "File:", 5 ) == COMPARE_EQUAL ) + else if( pDir && aLine.compareTo( RTL_CONSTASCII_STRINGPARAM( "File:" ) ) == 0 ) { - OString aFile( aLine.Copy( 5 ) ); + OString aFile( aLine.copy( 5 ) ); aStream.ReadLine( aLine ); - const char* pLine = aLine.GetBuffer(); + const char* pLine = aLine.getStr(); fonttype::type eType = (fonttype::type)atoi( pLine ); if( eType != fonttype::TrueType && @@ -350,8 +350,8 @@ void FontCache::read() for( int n = 0; n < nFonts; n++ ) { aStream.ReadLine( aLine ); - pLine = aLine.GetBuffer(); - int nLen = aLine.Len(); + pLine = aLine.getStr(); + int nLen = aLine.getLength(); PrintFontManager::PrintFont* pFont = NULL; switch( eType ) @@ -386,8 +386,8 @@ void FontCache::read() } } aStream.ReadLine( aLine ); - pLine = aLine.GetBuffer(); - nLen = aLine.Len(); + pLine = aLine.getStr(); + nLen = aLine.getLength(); // get up to 20 token positions const int nMaxTokens = 20;
_______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits