diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-02-18 15:03:40 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-02-19 13:38:45 +0000 |
commit | 5cb7271cbecaad3b97cc42e78b362edcb95ce488 (patch) | |
tree | 907227bdd0a32d04325fd8c5a2760a1838f1ef58 /vcl | |
parent | eb7cb5b61c43ba7c78cb0a8d4aef3780df0151cd (diff) |
ByteString->rtl::OString
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/generic/fontmanager/fontmanager.cxx | 96 | ||||
-rw-r--r-- | vcl/generic/fontmanager/helper.cxx | 18 | ||||
-rw-r--r-- | vcl/unx/generic/app/salinst.cxx | 9 | ||||
-rw-r--r-- | vcl/unx/generic/printer/ppdparser.cxx | 84 | ||||
-rw-r--r-- | vcl/unx/generic/printer/printerinfomanager.cxx | 24 |
5 files changed, 112 insertions, 119 deletions
diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx index cf45f7f25ce2..bb24eb6e7371 100644 --- a/vcl/generic/fontmanager/fontmanager.cxx +++ b/vcl/generic/fontmanager/fontmanager.cxx @@ -135,37 +135,37 @@ inline sal_uInt32 getUInt32BE( const sal_uInt8*& pBuffer ) // ------------------------------------------------------------------------- -static FontWeight parseWeight( const ByteString& rWeight ) +static FontWeight parseWeight( const rtl::OString& rWeight ) { FontWeight eWeight = WEIGHT_DONTKNOW; - if( rWeight.Search( "bold" ) != STRING_NOTFOUND ) + if (rWeight.indexOfL(RTL_CONSTASCII_STRINGPARAM("bold") ) != -1) { - if( rWeight.Search( "emi" ) != STRING_NOTFOUND ) // semi, demi + if (rWeight.indexOfL(RTL_CONSTASCII_STRINGPARAM("emi")) != -1) // semi, demi eWeight = WEIGHT_SEMIBOLD; - else if( rWeight.Search( "ultra" ) != STRING_NOTFOUND ) + else if (rWeight.indexOfL(RTL_CONSTASCII_STRINGPARAM("ultra")) != -1) eWeight = WEIGHT_ULTRABOLD; else eWeight = WEIGHT_BOLD; } - else if( rWeight.Search( "heavy" ) != STRING_NOTFOUND ) + else if (rWeight.indexOfL(RTL_CONSTASCII_STRINGPARAM("heavy")) != -1) eWeight = WEIGHT_BOLD; - else if( rWeight.Search( "light" ) != STRING_NOTFOUND ) + else if (rWeight.indexOfL(RTL_CONSTASCII_STRINGPARAM("light")) != -1) { - if( rWeight.Search( "emi" ) != STRING_NOTFOUND ) // semi, demi + if (rWeight.indexOfL(RTL_CONSTASCII_STRINGPARAM("emi")) != -1) // semi, demi eWeight = WEIGHT_SEMILIGHT; - else if( rWeight.Search( "ultra" ) != STRING_NOTFOUND ) + else if (rWeight.indexOfL(RTL_CONSTASCII_STRINGPARAM("ultra")) != -1) eWeight = WEIGHT_ULTRALIGHT; else eWeight = WEIGHT_LIGHT; } - else if( rWeight.Search( "black" ) != STRING_NOTFOUND ) + else if (rWeight.indexOfL(RTL_CONSTASCII_STRINGPARAM("black")) != -1) eWeight = WEIGHT_BLACK; - else if( rWeight.Equals( "demi" ) ) + else if (rWeight.equalsL(RTL_CONSTASCII_STRINGPARAM("demi"))) eWeight = WEIGHT_SEMIBOLD; - else if( rWeight.Equals( "book" ) || - rWeight.Equals( "semicondensed" ) ) + else if (rWeight.equalsL(RTL_CONSTASCII_STRINGPARAM("book")) || + rWeight.equalsL(RTL_CONSTASCII_STRINGPARAM("semicondensed"))) eWeight = WEIGHT_LIGHT; - else if( rWeight.Equals( "medium" ) || rWeight.Equals( "roman" ) ) + else if (rWeight.equalsL(RTL_CONSTASCII_STRINGPARAM("medium")) || rWeight.equalsL(RTL_CONSTASCII_STRINGPARAM("roman"))) eWeight = WEIGHT_MEDIUM; else eWeight = WEIGHT_NORMAL; @@ -253,11 +253,11 @@ bool PrintFontManager::TrueTypeFontFile::queryMetricPage( int nPage, MultiAtomPr { bool bSuccess = false; - ByteString aFile( PrintFontManager::get().getFontFile( this ) ); + rtl::OString aFile( PrintFontManager::get().getFontFile( this ) ); TrueTypeFont* pTTFont = NULL; - if( OpenTTFontFile( aFile.GetBuffer(), m_nCollectionEntry, &pTTFont ) == SF_OK ) + if( OpenTTFontFile( aFile.getStr(), m_nCollectionEntry, &pTTFont ) == SF_OK ) { if( ! m_pMetrics ) { @@ -643,9 +643,8 @@ bool PrintFontManager::PrintFont::readAfmMetrics( const OString& rFileName, Mult m_eItalic = ITALIC_NONE; // weight - ByteString aLowerWeight( pInfo->gfi->weight ); - aLowerWeight.ToLowerAscii(); - m_eWeight = parseWeight( aLowerWeight ); + rtl::OString aWeight( pInfo->gfi->weight ); + m_eWeight = parseWeight( aWeight.toAsciiLowerCase() ); // pitch m_ePitch = pInfo->gfi->isFixedPitch ? PITCH_FIXED : PITCH_VARIABLE; @@ -1137,16 +1136,16 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, :: } if (eFormat == UNKNOWN) { - ByteString aExt( rFontFile.copy( rFontFile.lastIndexOf( '.' )+1 ) ); - if( aExt.EqualsIgnoreCaseAscii( "pfb" ) || aExt.EqualsIgnoreCaseAscii( "pfa" ) ) + rtl::OString aExt( rFontFile.copy( rFontFile.lastIndexOf( '.' )+1 ) ); + if( aExt.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("pfb")) || aExt.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("pfa")) ) eFormat = TYPE1; - else if( aExt.EqualsIgnoreCaseAscii( "afm" ) ) + else if( aExt.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("afm"))) eFormat = AFM; - else if( aExt.EqualsIgnoreCaseAscii( "ttf" ) - || aExt.EqualsIgnoreCaseAscii( "ttc" ) - || aExt.EqualsIgnoreCaseAscii( "tte" ) ) // #i33947# for Gaiji support + else if( aExt.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("ttf")) + || aExt.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("ttc")) + || aExt.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("tte")) ) // #i33947# for Gaiji support eFormat = TRUETYPE; - else if( aExt.EqualsIgnoreCaseAscii( "otf" ) ) // check for TTF- and PS-OpenType too + else if( aExt.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("otf")) ) // check for TTF- and PS-OpenType too eFormat = CFF; } @@ -1158,29 +1157,26 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, :: for( unsigned int i = 0; i < SAL_N_ELEMENTS(pSuffix); i++ ) { - ByteString aName( rFontFile ); - aName.Erase( aName.Len()-4 ); - aName.Append( pSuffix[i] ); + rtl::OString aName = rtl::OStringBuffer( + rFontFile.copy(0, rFontFile.getLength() - 4)). + append(pSuffix[i]).makeStringAndClear(); rtl::OStringBuffer aFilePath(aDir); aFilePath.append('/').append(aName); - ByteString aAfmFile; + rtl::OString aAfmFile; if( access( aFilePath.makeStringAndClear().getStr(), R_OK ) ) { // try in subdirectory afm instead - aFilePath.append(aDir).append("/afm/").append(aName); + aFilePath.append(aDir).append(RTL_CONSTASCII_STRINGPARAM("/afm/")).append(aName); - if( ! access(aFilePath.getStr(), R_OK) ) - { - aAfmFile = "afm/"; - aAfmFile += aName; - } + if (!access(aFilePath.getStr(), R_OK)) + aAfmFile = rtl::OString(RTL_CONSTASCII_STRINGPARAM("afm/")) + aName; } else aAfmFile = aName; - if( aAfmFile.Len() ) + if( !aAfmFile.isEmpty() ) { Type1FontFile* pFont = new Type1FontFile(); pFont->m_nDirectory = nDirID; @@ -1510,11 +1506,11 @@ bool PrintFontManager::analyzeTrueTypeFile( PrintFont* pFont ) const { bool bSuccess = false; rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); - ByteString aFile = getFontFile( pFont ); + rtl::OString aFile = getFontFile( pFont ); TrueTypeFont* pTTFont = NULL; TrueTypeFontFile* pTTFontFile = static_cast< TrueTypeFontFile* >(pFont); - if( OpenTTFontFile( aFile.GetBuffer(), pTTFontFile->m_nCollectionEntry, &pTTFont ) == SF_OK ) + if( OpenTTFontFile( aFile.getStr(), pTTFontFile->m_nCollectionEntry, &pTTFont ) == SF_OK ) { TTGlobalFontInfo aInfo; GetTTGlobalFontInfo( pTTFont, & aInfo ); @@ -1562,7 +1558,9 @@ bool PrintFontManager::analyzeTrueTypeFile( PrintFont* pFont ) const if( aInfo.usubfamily ) pFont->m_aStyleName = OUString( aInfo.usubfamily ); - pFont->m_nPSName = m_pAtoms->getAtom( ATOM_PSNAME, String( ByteString( aInfo.psname ), aEncoding ), sal_True ); + pFont->m_nPSName = m_pAtoms->getAtom( ATOM_PSNAME, + rtl::OUString(aInfo.psname, rtl_str_getLength(aInfo.psname), aEncoding), + sal_True ); switch( aInfo.weight ) { case FW_THIN: pFont->m_eWeight = WEIGHT_THIN; break; @@ -1652,7 +1650,7 @@ bool PrintFontManager::analyzeTrueTypeFile( PrintFont* pFont ) const } #if OSL_DEBUG_LEVEL > 1 else - fprintf( stderr, "could not OpenTTFont \"%s\"\n", aFile.GetBuffer() ); + fprintf( stderr, "could not OpenTTFont \"%s\"\n", aFile.getStr() ); #endif return bSuccess; @@ -2471,8 +2469,8 @@ bool PrintFontManager::isFontDownloadingAllowed( fontID nFont ) const if( pTTFontFile->m_nTypeFlags & TYPEFLAG_INVALID ) { TrueTypeFont* pTTFont = NULL; - ByteString aFile = getFontFile( pFont ); - if( OpenTTFontFile( aFile.GetBuffer(), pTTFontFile->m_nCollectionEntry, &pTTFont ) == SF_OK ) + rtl::OString aFile = getFontFile( pFont ); + if( OpenTTFontFile( aFile.getStr(), pTTFontFile->m_nCollectionEntry, &pTTFont ) == SF_OK ) { // get type flags TTGlobalFontInfo aInfo; @@ -2645,11 +2643,11 @@ bool PrintFontManager::createFontSubset( // prepare system name for read access for subset source file // TODO: since this file is usually already mmapped there is no need to open it again - const ByteString aFromFile = getFontFile( pFont ); + const rtl::OString aFromFile = getFontFile( pFont ); TrueTypeFont* pTTFont = NULL; // TODO: rename to SfntFont TrueTypeFontFile* pTTFontFile = static_cast< TrueTypeFontFile* >(pFont); - if( OpenTTFontFile( aFromFile.GetBuffer(), pTTFontFile->m_nCollectionEntry, &pTTFont ) != SF_OK ) + if( OpenTTFontFile( aFromFile.getStr(), pTTFontFile->m_nCollectionEntry, &pTTFont ) != SF_OK ) return false; // prepare system name for write access for subset file target @@ -2657,7 +2655,7 @@ bool PrintFontManager::createFontSubset( if( osl_File_E_None != osl_getSystemPathFromFileURL( rOutFile.pData, &aSysPath.pData ) ) return false; const rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); - const ByteString aToFile( OUStringToOString( aSysPath, aEncoding ) ); + const rtl::OString aToFile( OUStringToOString( aSysPath, aEncoding ) ); // do CFF subsetting if possible int nCffLength = 0; @@ -2671,7 +2669,7 @@ bool PrintFontManager::createFontSubset( aRequestedGlyphs[i] = pGID[i]; #endif // create subset file at requested path - FILE* pOutFile = fopen( aToFile.GetBuffer(), "wb" ); + FILE* pOutFile = fopen( aToFile.getStr(), "wb" ); // create font subset const char* pGlyphSetName = NULL; // TODO: better name? const bool bOK = rInfo.CreateFontSubset( @@ -2717,7 +2715,7 @@ bool PrintFontManager::createFontSubset( } bool bSuccess = ( SF_OK == CreateTTFromTTGlyphs( pTTFont, - aToFile.GetBuffer(), + aToFile.getStr(), pGID, pEnc, nGlyphs, @@ -2742,8 +2740,8 @@ void PrintFontManager::getGlyphWidths( fontID nFont, { TrueTypeFont* pTTFont = NULL; TrueTypeFontFile* pTTFontFile = static_cast< TrueTypeFontFile* >(pFont); - ByteString aFromFile = getFontFile( pFont ); - if( OpenTTFontFile( aFromFile.GetBuffer(), pTTFontFile->m_nCollectionEntry, &pTTFont ) != SF_OK ) + rtl::OString aFromFile = getFontFile( pFont ); + if( OpenTTFontFile( aFromFile.getStr(), pTTFontFile->m_nCollectionEntry, &pTTFont ) != SF_OK ) return; int nGlyphs = GetTTGlyphCount( pTTFont ); if( nGlyphs > 0 ) diff --git a/vcl/generic/fontmanager/helper.cxx b/vcl/generic/fontmanager/helper.cxx index 85a3490bece3..514dfc8b934b 100644 --- a/vcl/generic/fontmanager/helper.cxx +++ b/vcl/generic/fontmanager/helper.cxx @@ -364,19 +364,17 @@ void psp::normPath( OString& rPath ) { char buf[PATH_MAX]; - ByteString aPath( rPath ); - // double slashes and slash at end are probably // removed by realpath anyway, but since this runs // on many different platforms let's play it safe - while( aPath.SearchAndReplace( "//", "/" ) != STRING_NOTFOUND ) - ; - if( aPath.Len() > 0 && aPath.GetChar( aPath.Len()-1 ) == '/' ) - aPath.Erase( aPath.Len()-1 ); - - if( ( aPath.Search( "./" ) != STRING_NOTFOUND || - aPath.Search( "~" ) != STRING_NOTFOUND ) - && realpath( aPath.GetBuffer(), buf ) ) + rtl::OString aPath = rPath.replaceAll("//", "/"); + + if( !aPath.isEmpty() && aPath[aPath.getLength()-1] == '/' ) + aPath = aPath.copy(0, aPath.getLength()-1); + + if( ( aPath.indexOfL(RTL_CONSTASCII_STRINGPARAM("./")) != -1 || + aPath.indexOf( '~' ) != -1 ) + && realpath( aPath.getStr(), buf ) ) { rPath = buf; } diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx index 3fac1ecaa659..9bf80c45655e 100644 --- a/vcl/unx/generic/app/salinst.cxx +++ b/vcl/unx/generic/app/salinst.cxx @@ -311,15 +311,12 @@ void X11SalInstance::FillFontPathList( std::list< rtl::OString >& o_rFontPaths ) // TODO: replace environment variables while( aStream.IsOpen() && ! aStream.IsEof() ) { - ByteString aLine; + rtl::OString aLine; aStream.ReadLine( aLine ); - // need an OString for normpath - OString aNLine( aLine ); - psp::normPath( aNLine ); - aLine = aNLine; + psp::normPath( aLine ); // try to avoid bad fonts in some cases static bool bAvoid = (strncasecmp( lang, "ar", 2 ) == 0) || (strncasecmp( lang, "he", 2 ) == 0) || strncasecmp( lang, "iw", 2 ) == 0 || (strncasecmp( lang, "hi", 2 ) == 0); - if( bAvoid && aLine.Search( "iso_8859" ) != STRING_NOTFOUND ) + if( bAvoid && aLine.indexOfL(RTL_CONSTASCII_STRINGPARAM("iso_8859")) != -1 ) continue; o_rFontPaths.push_back( aLine ); } diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index 36a53b6aa65b..0885836e06b2 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -971,11 +971,11 @@ void PPDParser::parse( ::std::list< rtl::OString >& rLines ) PPDParser::hash_type::const_iterator keyit; while( line != rLines.end() ) { - ByteString aCurrentLine( *line ); + rtl::OString aCurrentLine( *line ); ++line; - if( aCurrentLine.GetChar(0) != '*' ) + if( aCurrentLine[0] != '*' ) continue; - if( aCurrentLine.GetChar(1) == '%' ) + if( aCurrentLine[1] == '%' ) continue; ByteString aKey = GetCommandLineToken( 0, comphelper::string::getToken(aCurrentLine, 0, ':') ); @@ -1035,10 +1035,10 @@ void PPDParser::parse( ::std::list< rtl::OString >& rLines ) } String aOption; - nPos = aCurrentLine.Search( ':' ); - if( nPos != STRING_NOTFOUND ) + nPos = aCurrentLine.indexOf(':'); + if( nPos != -1 ) { - aOption = String( aCurrentLine.Copy( 1, nPos-1 ), RTL_TEXTENCODING_MS_1252 ); + aOption = rtl::OStringToOUString( aCurrentLine.copy( 1, nPos-1 ), RTL_TEXTENCODING_MS_1252 ); aOption = GetCommandLineToken( 1, aOption ); int nTransPos = aOption.Search( '/' ); if( nTransPos != STRING_NOTFOUND ) @@ -1052,14 +1052,14 @@ void PPDParser::parse( ::std::list< rtl::OString >& rLines ) if( nPos != STRING_NOTFOUND ) { // found a colon, there may be an option - ByteString aLine = aCurrentLine.Copy( 1, nPos-1 ); + ByteString aLine = aCurrentLine.copy( 1, nPos-1 ); aLine = WhitespaceToSpace( aLine ); int nTransPos = aLine.Search( '/' ); if( nTransPos != STRING_NOTFOUND ) aOptionTranslation = handleTranslation( aLine.Copy( nTransPos+1 ), bIsGlobalizedLine ); // read in more lines if necessary for multiline values - aLine = aCurrentLine.Copy( nPos+1 ); + aLine = aCurrentLine.copy( nPos+1 ); if( aLine.Len() ) { //while( ! ( aLine.GetTokenCount( '"' ) & 1 ) && @@ -1218,21 +1218,21 @@ void PPDParser::parse( ::std::list< rtl::OString >& rLines ) void PPDParser::parseOpenUI(const rtl::OString& rLine) { String aTranslation; - ByteString aKey = rLine; + rtl::OString aKey = rLine; - int nPos = aKey.Search( ':' ); - if( nPos != STRING_NOTFOUND ) - aKey.Erase( nPos ); - nPos = aKey.Search( '/' ); - if( nPos != STRING_NOTFOUND ) + sal_Int32 nPos = aKey.indexOf(':'); + if( nPos != -1 ) + aKey = aKey.copy(0, nPos); + nPos = aKey.indexOf('/'); + if( nPos != -1 ) { - aTranslation = handleTranslation( aKey.Copy( nPos + 1 ), false ); - aKey.Erase( nPos ); + aTranslation = handleTranslation( aKey.copy( nPos + 1 ), false ); + aKey = aKey.copy(0, nPos); } aKey = GetCommandLineToken( 1, aKey ); - aKey.Erase( 0, 1 ); + aKey = aKey.copy(1); - String aUniKey( aKey, RTL_TEXTENCODING_MS_1252 ); + String aUniKey(rtl::OStringToOUString(aKey, RTL_TEXTENCODING_MS_1252)); PPDParser::hash_type::const_iterator keyit = m_aKeys.find( aUniKey ); PPDKey* pKey; if( keyit == m_aKeys.end() ) @@ -1247,10 +1247,10 @@ void PPDParser::parseOpenUI(const rtl::OString& rLine) m_pTranslator->insertKey( pKey->getKey(), aTranslation ); sal_Int32 nIndex = 0; - ByteString aValue = WhitespaceToSpace( rLine.getToken( 1, ':', nIndex ) ); - if( aValue.CompareIgnoreCaseToAscii( "boolean" ) == COMPARE_EQUAL ) + rtl::OString aValue = WhitespaceToSpace( rLine.getToken( 1, ':', nIndex ) ); + if( aValue.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("boolean"))) pKey->m_eUIType = PPDKey::Boolean; - else if( aValue.CompareIgnoreCaseToAscii( "pickmany" ) == COMPARE_EQUAL ) + else if (aValue.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("pickmany"))) pKey->m_eUIType = PPDKey::PickMany; else pKey->m_eUIType = PPDKey::PickOne; @@ -1264,7 +1264,7 @@ void PPDParser::parseOrderDependency(const rtl::OString& rLine) aLine = aLine.copy( nPos+1 ); sal_Int32 nOrder = GetCommandLineToken( 0, aLine ).toInt32(); - ByteString aSetup = GetCommandLineToken( 1, aLine ); + rtl::OString aSetup = GetCommandLineToken( 1, aLine ); String aKey(rtl::OStringToOUString(GetCommandLineToken(2, aLine), RTL_TEXTENCODING_MS_1252)); if( aKey.GetChar( 0 ) != '*' ) return; // invalid order depency @@ -1281,15 +1281,15 @@ void PPDParser::parseOrderDependency(const rtl::OString& rLine) pKey = keyit->second; pKey->m_nOrderDependency = nOrder; - if( aSetup.Equals( "ExitServer" ) ) + if( aSetup.equalsL(RTL_CONSTASCII_STRINGPARAM("ExitServer")) ) pKey->m_eSetupType = PPDKey::ExitServer; - else if( aSetup.Equals( "Prolog" ) ) + else if( aSetup.equalsL(RTL_CONSTASCII_STRINGPARAM("Prolog")) ) pKey->m_eSetupType = PPDKey::Prolog; - else if( aSetup.Equals( "DocumentSetup" ) ) + else if( aSetup.equalsL(RTL_CONSTASCII_STRINGPARAM("DocumentSetup")) ) pKey->m_eSetupType = PPDKey::DocumentSetup; - else if( aSetup.Equals( "PageSetup" ) ) + else if( aSetup.equalsL(RTL_CONSTASCII_STRINGPARAM("PageSetup")) ) pKey->m_eSetupType = PPDKey::PageSetup; - else if( aSetup.Equals( "JCLSetup" ) ) + else if( aSetup.equalsL(RTL_CONSTASCII_STRINGPARAM("JCLSetup")) ) pKey->m_eSetupType = PPDKey::JCLSetup; else pKey->m_eSetupType = PPDKey::AnySetup; @@ -1871,13 +1871,13 @@ char* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const hash_type::const_iterator it; for( it = m_aCurrentValues.begin(); it != m_aCurrentValues.end(); ++it ) { - ByteString aCopy(rtl::OUStringToOString(it->first->getKey(), RTL_TEXTENCODING_MS_1252)); - rBytes += aCopy.Len(); + rtl::OString aCopy(rtl::OUStringToOString(it->first->getKey(), RTL_TEXTENCODING_MS_1252)); + rBytes += aCopy.getLength(); rBytes += 1; // for ':' if( it->second ) { aCopy = rtl::OUStringToOString(it->second->m_aOption, RTL_TEXTENCODING_MS_1252); - rBytes += aCopy.Len(); + rBytes += aCopy.getLength(); } else rBytes += 4; @@ -1889,17 +1889,17 @@ char* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const char* pRun = pBuffer; for( it = m_aCurrentValues.begin(); it != m_aCurrentValues.end(); ++it ) { - ByteString aCopy(rtl::OUStringToOString(it->first->getKey(), RTL_TEXTENCODING_MS_1252)); - int nBytes = aCopy.Len(); - memcpy( pRun, aCopy.GetBuffer(), nBytes ); + rtl::OString aCopy(rtl::OUStringToOString(it->first->getKey(), RTL_TEXTENCODING_MS_1252)); + int nBytes = aCopy.getLength(); + memcpy( pRun, aCopy.getStr(), nBytes ); pRun += nBytes; *pRun++ = ':'; if( it->second ) aCopy = rtl::OUStringToOString(it->second->m_aOption, RTL_TEXTENCODING_MS_1252); else aCopy = "*nil"; - nBytes = aCopy.Len(); - memcpy( pRun, aCopy.GetBuffer(), nBytes ); + nBytes = aCopy.getLength(); + memcpy( pRun, aCopy.getStr(), nBytes ); pRun += nBytes; *pRun++ = 0; @@ -1919,15 +1919,15 @@ void PPDContext::rebuildFromStreamBuffer( char* pBuffer, sal_uLong nBytes ) char* pRun = pBuffer; while( nBytes && *pRun ) { - ByteString aLine( pRun ); - int nPos = aLine.Search( ':' ); - if( nPos != STRING_NOTFOUND ) + rtl::OString aLine( pRun ); + sal_Int32 nPos = aLine.indexOf(':'); + if( nPos != -1 ) { - const PPDKey* pKey = m_pParser->getKey( String( aLine.Copy( 0, nPos ), RTL_TEXTENCODING_MS_1252 ) ); + const PPDKey* pKey = m_pParser->getKey( rtl::OStringToOUString( aLine.copy( 0, nPos ), RTL_TEXTENCODING_MS_1252 ) ); if( pKey ) { const PPDValue* pValue = NULL; - String aOption( aLine.Copy( nPos+1 ), RTL_TEXTENCODING_MS_1252 ); + String aOption( aLine.copy( nPos+1 ), RTL_TEXTENCODING_MS_1252 ); if( ! aOption.EqualsAscii( "*nil" ) ) pValue = pKey->getValue( aOption ); m_aCurrentValues[ pKey ] = pValue; @@ -1936,8 +1936,8 @@ void PPDContext::rebuildFromStreamBuffer( char* pBuffer, sal_uLong nBytes ) #endif } } - nBytes -= aLine.Len()+1; - pRun += aLine.Len()+1; + nBytes -= aLine.getLength()+1; + pRun += aLine.getLength()+1; } } diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx index f538b9497914..48b5b0245cbe 100644 --- a/vcl/unx/generic/printer/printerinfomanager.cxx +++ b/vcl/unx/generic/printer/printerinfomanager.cxx @@ -325,13 +325,13 @@ void PrinterInfoManager::initialize() } // get the PPDContext of global JobData - for( int nKey = 0; nKey < aConfig.GetKeyCount(); nKey++ ) + for( int nKey = 0; nKey < aConfig.GetKeyCount(); ++nKey ) { - ByteString aKey( aConfig.GetKeyName( nKey ) ); - if( aKey.CompareTo( "PPD_", 4 ) == COMPARE_EQUAL ) + rtl::OString aKey( aConfig.GetKeyName( nKey ) ); + if (aKey.matchL(RTL_CONSTASCII_STRINGPARAM("PPD_"))) { aValue = aConfig.ReadKey( aKey ); - const PPDKey* pKey = m_aGlobalDefaults.m_pParser->getKey( String( aKey.Copy( 4 ), RTL_TEXTENCODING_ISO_8859_1 ) ); + const PPDKey* pKey = m_aGlobalDefaults.m_pParser->getKey( String( aKey.copy( 4 ), RTL_TEXTENCODING_ISO_8859_1 ) ); if( pKey ) { m_aGlobalDefaults.m_aContext. @@ -340,10 +340,10 @@ void PrinterInfoManager::initialize() sal_True ); } } - else if( aKey.Len() > 10 && aKey.CompareTo("SubstFont_", 10 ) == COMPARE_EQUAL ) + else if (aKey.matchL(RTL_CONSTASCII_STRINGPARAM("SubstFont_"))) { aValue = aConfig.ReadKey( aKey ); - m_aGlobalDefaults.m_aFontSubstitutes[ OStringToOUString( aKey.Copy( 10 ), RTL_TEXTENCODING_ISO_8859_1 ) ] = OStringToOUString( aValue, RTL_TEXTENCODING_ISO_8859_1 ); + m_aGlobalDefaults.m_aFontSubstitutes[ OStringToOUString( aKey.copy( 10 ), RTL_TEXTENCODING_ISO_8859_1 ) ] = OStringToOUString( aValue, RTL_TEXTENCODING_ISO_8859_1 ); } } #if OSL_DEBUG_LEVEL > 1 @@ -533,13 +533,13 @@ void PrinterInfoManager::initialize() // now iterate over all keys to extract multi key information: // 1. PPDContext information // 2. Font substitution table - for( int nKey = 0; nKey < aConfig.GetKeyCount(); nKey++ ) + for( int nKey = 0; nKey < aConfig.GetKeyCount(); ++nKey ) { - ByteString aKey( aConfig.GetKeyName( nKey ) ); - if( aKey.CompareTo( "PPD_", 4 ) == COMPARE_EQUAL && aPrinter.m_aInfo.m_pParser ) + rtl::OString aKey( aConfig.GetKeyName( nKey ) ); + if( aKey.matchL(RTL_CONSTASCII_STRINGPARAM("PPD_")) && aPrinter.m_aInfo.m_pParser ) { aValue = aConfig.ReadKey( aKey ); - const PPDKey* pKey = aPrinter.m_aInfo.m_pParser->getKey( String( aKey.Copy( 4 ), RTL_TEXTENCODING_ISO_8859_1 ) ); + const PPDKey* pKey = aPrinter.m_aInfo.m_pParser->getKey( String( aKey.copy( 4 ), RTL_TEXTENCODING_ISO_8859_1 ) ); if( pKey ) { aPrinter.m_aInfo.m_aContext. @@ -548,10 +548,10 @@ void PrinterInfoManager::initialize() sal_True ); } } - else if( aKey.Len() > 10 && aKey.CompareTo("SubstFont_", 10 ) == COMPARE_EQUAL ) + else if( aKey.matchL(RTL_CONSTASCII_STRINGPARAM("SubstFont_")) ) { aValue = aConfig.ReadKey( aKey ); - aPrinter.m_aInfo.m_aFontSubstitutes[ OStringToOUString( aKey.Copy( 10 ), RTL_TEXTENCODING_ISO_8859_1 ) ] = OStringToOUString( aValue, RTL_TEXTENCODING_ISO_8859_1 ); + aPrinter.m_aInfo.m_aFontSubstitutes[ OStringToOUString( aKey.copy( 10 ), RTL_TEXTENCODING_ISO_8859_1 ) ] = OStringToOUString( aValue, RTL_TEXTENCODING_ISO_8859_1 ); } } |