diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-02-18 22:50:04 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-02-19 13:38:46 +0000 |
commit | 1a302e716a9e6b8a8cc2cae2777cfe227ff2b95c (patch) | |
tree | 55a64a7d36e5c0ff4d3e7cdc7aae1dd7416c94b9 /vcl/aqua | |
parent | c251139ca22e10f21cf5e4f23df2a1d10fc3925f (diff) |
risk converting ByteString to rtl::OString for OSes I don't have
Diffstat (limited to 'vcl/aqua')
-rw-r--r-- | vcl/aqua/source/app/salinst.cxx | 36 | ||||
-rw-r--r-- | vcl/aqua/source/gdi/salatslayout.cxx | 4 | ||||
-rw-r--r-- | vcl/aqua/source/gdi/salatsuifontutils.cxx | 143 | ||||
-rw-r--r-- | vcl/aqua/source/gdi/salgdi.cxx | 6 |
4 files changed, 94 insertions, 95 deletions
diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index dbff33c556b0..adae096e3e0c 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -316,46 +316,46 @@ void InitSalMain() oslFileError err2 = osl_getSystemPathFromFileURL(urlWorkDir.pData, &sysWorkDir); if (err2 == osl_File_E_None) { - ByteString aPath( getenv( "PATH" ) ); - ByteString aResPath( getenv( "STAR_RESOURCEPATH" ) ); - ByteString aLibPath( getenv( "DYLD_LIBRARY_PATH" ) ); - ByteString aCmdPath( OUStringToOString(OUString(sysWorkDir), RTL_TEXTENCODING_UTF8).getStr() ); - ByteString aTmpPath; + rtl::OString aPath( getenv( "PATH" ) ); + rtl::OString aResPath( getenv( "STAR_RESOURCEPATH" ) ); + rtl::OString aLibPath( getenv( "DYLD_LIBRARY_PATH" ) ); + rtl::OString aCmdPath( OUStringToOString(OUString(sysWorkDir), RTL_TEXTENCODING_UTF8).getStr() ); + rtl::OString aTmpPath; // Get absolute path of command's directory - if ( aCmdPath.Len() ) { + if ( !aCmdPath.isEmpty() ) { DirEntry aCmdDirEntry( aCmdPath ); aCmdDirEntry.ToAbs(); aCmdPath = rtl::OUStringToOString( aCmdDirEntry.GetPath().GetFull(), RTL_TEXTENCODING_ASCII_US ); } // Assign to PATH environment variable - if ( aCmdPath.Len() ) + if ( !aCmdPath.isEmpty() ) { - aTmpPath = ByteString( "PATH=" ); + aTmpPath = rtl::OString( "PATH=" ); aTmpPath += aCmdPath; - if ( aPath.Len() ) + if ( !aPath.isEmpty() ) aTmpPath += rtl::OUStringToOString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ); aTmpPath += aPath; - putenv( (char*)aTmpPath.GetBuffer() ); + putenv( (char*)aTmpPath.getStr() ); } // Assign to STAR_RESOURCEPATH environment variable - if ( aCmdPath.Len() ) + if ( !aCmdPath.isEmpty() ) { - aTmpPath = ByteString( "STAR_RESOURCEPATH=" ); + aTmpPath = rtl::OString( "STAR_RESOURCEPATH=" ); aTmpPath += aCmdPath; - if ( aResPath.Len() ) + if ( !aResPath.isEmpty() ) aTmpPath += rtl::OUStringToOString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ); aTmpPath += aResPath; - putenv( (char*)aTmpPath.GetBuffer() ); + putenv( (char*)aTmpPath.getStr() ); } // Assign to DYLD_LIBRARY_PATH environment variable - if ( aCmdPath.Len() ) + if ( !aCmdPath.isEmpty() ) { - aTmpPath = ByteString( "DYLD_LIBRARY_PATH=" ); + aTmpPath = rtl::OString( "DYLD_LIBRARY_PATH=" ); aTmpPath += aCmdPath; - if ( aLibPath.Len() ) + if ( !aLibPath.isEmpty() ) aTmpPath += rtl::OUStringToOString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US ); aTmpPath += aLibPath; - putenv( (char*)aTmpPath.GetBuffer() ); + putenv( (char*)aTmpPath.getStr() ); } } } diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx index a41d40d3d173..f51346f1e217 100644 --- a/vcl/aqua/source/gdi/salatslayout.cxx +++ b/vcl/aqua/source/gdi/salatslayout.cxx @@ -239,9 +239,9 @@ bool ATSLayout::LayoutText( ImplLayoutArgs& rArgs ) ByteCount nDummy; ATSUGetAttribute( mrATSUStyle, kATSUSizeTag, sizeof(fFontSize), &fFontSize, &nDummy); String aUniName( &rArgs.mpStr[rArgs.mnMinCharPos], mnCharCount ); - ByteString aCName( aUniName, RTL_TEXTENCODING_UTF8 ); + rtl::OString aCName(rtl::OUStringToOString(aUniName, RTL_TEXTENCODING_UTF8)); fprintf( stderr, "ATSLayout( \"%s\" %d..%d of %d) with h=%4.1f\n", - aCName.GetBuffer(),rArgs.mnMinCharPos,rArgs.mnEndCharPos,rArgs.mnLength,Fix2X(fFontSize) ); + aCName.getStr(),rArgs.mnMinCharPos,rArgs.mnEndCharPos,rArgs.mnLength,Fix2X(fFontSize) ); #endif // create the ATSUI layout diff --git a/vcl/aqua/source/gdi/salatsuifontutils.cxx b/vcl/aqua/source/gdi/salatsuifontutils.cxx index 5ca2e5ed5659..1a52f1071939 100644 --- a/vcl/aqua/source/gdi/salatsuifontutils.cxx +++ b/vcl/aqua/source/gdi/salatsuifontutils.cxx @@ -53,17 +53,16 @@ // and SFNT fonts on Mac usually do not contain an OS/2 table. static void UpdateAttributesFromPSName( const String& rPSName, ImplDevFontAttributes& rDFA ) { - ByteString aPSName( rtl::OUStringToOString( rPSName, RTL_TEXTENCODING_UTF8 ) ); - aPSName.ToLowerAscii(); + rtl::OString aPSName( rtl::OUStringToOString( rPSName, RTL_TEXTENCODING_UTF8 ).toAsciiLowerCase() ); // TODO: use a multi-string ignore-case matcher once it becomes available - if( (aPSName.Search("regular") != STRING_NOTFOUND) - || (aPSName.Search("normal") != STRING_NOTFOUND) - || (aPSName.Search("roman") != STRING_NOTFOUND) - || (aPSName.Search("medium") != STRING_NOTFOUND) - || (aPSName.Search("plain") != STRING_NOTFOUND) - || (aPSName.Search("standard") != STRING_NOTFOUND) - || (aPSName.Search("std") != STRING_NOTFOUND) ) + if( (aPSName.indexOf("regular") != -1) + || (aPSName.indexOf("normal") != -1) + || (aPSName.indexOf("roman") != -1) + || (aPSName.indexOf("medium") != -1) + || (aPSName.indexOf("plain") != -1) + || (aPSName.indexOf("standard") != -1) + || (aPSName.indexOf("std") != -1) ) { rDFA.meWidthType = WIDTH_NORMAL; rDFA.meWeight = WEIGHT_NORMAL; @@ -71,108 +70,108 @@ static void UpdateAttributesFromPSName( const String& rPSName, ImplDevFontAttrib } // heuristics for font weight - if (aPSName.Search("extrablack") != STRING_NOTFOUND) + if (aPSName.indexOf("extrablack") != -1) rDFA.meWeight = WEIGHT_BLACK; - else if (aPSName.Search("black") != STRING_NOTFOUND) + else if (aPSName.indexOf("black") != -1) rDFA.meWeight = WEIGHT_BLACK; - //else if (aPSName.Search("book") != STRING_NOTFOUND) + //else if (aPSName.indexOf("book") != -1) // rDFA.meWeight = WEIGHT_SEMIBOLD; - else if( (aPSName.Search("semibold") != STRING_NOTFOUND) - || (aPSName.Search("smbd") != STRING_NOTFOUND)) + else if( (aPSName.indexOf("semibold") != -1) + || (aPSName.indexOf("smbd") != -1)) rDFA.meWeight = WEIGHT_SEMIBOLD; - else if (aPSName.Search("ultrabold") != STRING_NOTFOUND) + else if (aPSName.indexOf("ultrabold") != -1) rDFA.meWeight = WEIGHT_ULTRABOLD; - else if (aPSName.Search("extrabold") != STRING_NOTFOUND) + else if (aPSName.indexOf("extrabold") != -1) rDFA.meWeight = WEIGHT_BLACK; - else if( (aPSName.Search("bold") != STRING_NOTFOUND) - || (aPSName.Search("-bd") != STRING_NOTFOUND)) + else if( (aPSName.indexOf("bold") != -1) + || (aPSName.indexOf("-bd") != -1)) rDFA.meWeight = WEIGHT_BOLD; - else if (aPSName.Search("extralight") != STRING_NOTFOUND) + else if (aPSName.indexOf("extralight") != -1) rDFA.meWeight = WEIGHT_ULTRALIGHT; - else if (aPSName.Search("ultralight") != STRING_NOTFOUND) + else if (aPSName.indexOf("ultralight") != -1) rDFA.meWeight = WEIGHT_ULTRALIGHT; - else if (aPSName.Search("light") != STRING_NOTFOUND) + else if (aPSName.indexOf("light") != -1) rDFA.meWeight = WEIGHT_LIGHT; - else if (aPSName.Search("thin") != STRING_NOTFOUND) + else if (aPSName.indexOf("thin") != -1) rDFA.meWeight = WEIGHT_THIN; - else if (aPSName.Search("-w3") != STRING_NOTFOUND) + else if (aPSName.indexOf("-w3") != -1) rDFA.meWeight = WEIGHT_LIGHT; - else if (aPSName.Search("-w4") != STRING_NOTFOUND) + else if (aPSName.indexOf("-w4") != -1) rDFA.meWeight = WEIGHT_SEMILIGHT; - else if (aPSName.Search("-w5") != STRING_NOTFOUND) + else if (aPSName.indexOf("-w5") != -1) rDFA.meWeight = WEIGHT_NORMAL; - else if (aPSName.Search("-w6") != STRING_NOTFOUND) + else if (aPSName.indexOf("-w6") != -1) rDFA.meWeight = WEIGHT_SEMIBOLD; - else if (aPSName.Search("-w7") != STRING_NOTFOUND) + else if (aPSName.indexOf("-w7") != -1) rDFA.meWeight = WEIGHT_BOLD; - else if (aPSName.Search("-w8") != STRING_NOTFOUND) + else if (aPSName.indexOf("-w8") != -1) rDFA.meWeight = WEIGHT_ULTRABOLD; - else if (aPSName.Search("-w9") != STRING_NOTFOUND) + else if (aPSName.indexOf("-w9") != -1) rDFA.meWeight = WEIGHT_BLACK; // heuristics for font slant - if( (aPSName.Search("italic") != STRING_NOTFOUND) - || (aPSName.Search(" ital") != STRING_NOTFOUND) - || (aPSName.Search("cursive") != STRING_NOTFOUND) - || (aPSName.Search("-it") != STRING_NOTFOUND) - || (aPSName.Search("lightit") != STRING_NOTFOUND) - || (aPSName.Search("mediumit") != STRING_NOTFOUND) - || (aPSName.Search("boldit") != STRING_NOTFOUND) - || (aPSName.Search("cnit") != STRING_NOTFOUND) - || (aPSName.Search("bdcn") != STRING_NOTFOUND) - || (aPSName.Search("bdit") != STRING_NOTFOUND) - || (aPSName.Search("condit") != STRING_NOTFOUND) - || (aPSName.Search("bookit") != STRING_NOTFOUND) - || (aPSName.Search("blackit") != STRING_NOTFOUND) ) + if( (aPSName.indexOf("italic") != -1) + || (aPSName.indexOf(" ital") != -1) + || (aPSName.indexOf("cursive") != -1) + || (aPSName.indexOf("-it") != -1) + || (aPSName.indexOf("lightit") != -1) + || (aPSName.indexOf("mediumit") != -1) + || (aPSName.indexOf("boldit") != -1) + || (aPSName.indexOf("cnit") != -1) + || (aPSName.indexOf("bdcn") != -1) + || (aPSName.indexOf("bdit") != -1) + || (aPSName.indexOf("condit") != -1) + || (aPSName.indexOf("bookit") != -1) + || (aPSName.indexOf("blackit") != -1) ) rDFA.meItalic = ITALIC_NORMAL; - if( (aPSName.Search("oblique") != STRING_NOTFOUND) - || (aPSName.Search("inclined") != STRING_NOTFOUND) - || (aPSName.Search("slanted") != STRING_NOTFOUND) ) + if( (aPSName.indexOf("oblique") != -1) + || (aPSName.indexOf("inclined") != -1) + || (aPSName.indexOf("slanted") != -1) ) rDFA.meItalic = ITALIC_OBLIQUE; // heuristics for font width - if( (aPSName.Search("condensed") != STRING_NOTFOUND) - || (aPSName.Search("-cond") != STRING_NOTFOUND) - || (aPSName.Search("boldcond") != STRING_NOTFOUND) - || (aPSName.Search("boldcn") != STRING_NOTFOUND) - || (aPSName.Search("cnit") != STRING_NOTFOUND) ) + if( (aPSName.indexOf("condensed") != -1) + || (aPSName.indexOf("-cond") != -1) + || (aPSName.indexOf("boldcond") != -1) + || (aPSName.indexOf("boldcn") != -1) + || (aPSName.indexOf("cnit") != -1) ) rDFA.meWidthType = WIDTH_CONDENSED; - else if (aPSName.Search("narrow") != STRING_NOTFOUND) + else if (aPSName.indexOf("narrow") != -1) rDFA.meWidthType = WIDTH_SEMI_CONDENSED; - else if (aPSName.Search("expanded") != STRING_NOTFOUND) + else if (aPSName.indexOf("expanded") != -1) rDFA.meWidthType = WIDTH_EXPANDED; - else if (aPSName.Search("wide") != STRING_NOTFOUND) + else if (aPSName.indexOf("wide") != -1) rDFA.meWidthType = WIDTH_EXPANDED; // heuristics for font pitch - if( (aPSName.Search("mono") != STRING_NOTFOUND) - || (aPSName.Search("courier") != STRING_NOTFOUND) - || (aPSName.Search("monaco") != STRING_NOTFOUND) - || (aPSName.Search("typewriter") != STRING_NOTFOUND) ) + if( (aPSName.indexOf("mono") != -1) + || (aPSName.indexOf("courier") != -1) + || (aPSName.indexOf("monaco") != -1) + || (aPSName.indexOf("typewriter") != -1) ) rDFA.mePitch = PITCH_FIXED; // heuristics for font family type - if( (aPSName.Search("script") != STRING_NOTFOUND) - || (aPSName.Search("chancery") != STRING_NOTFOUND) - || (aPSName.Search("zapfino") != STRING_NOTFOUND)) + if( (aPSName.indexOf("script") != -1) + || (aPSName.indexOf("chancery") != -1) + || (aPSName.indexOf("zapfino") != -1)) rDFA.meFamily = FAMILY_SCRIPT; - else if( (aPSName.Search("comic") != STRING_NOTFOUND) - || (aPSName.Search("outline") != STRING_NOTFOUND) - || (aPSName.Search("pinpoint") != STRING_NOTFOUND) ) + else if( (aPSName.indexOf("comic") != -1) + || (aPSName.indexOf("outline") != -1) + || (aPSName.indexOf("pinpoint") != -1) ) rDFA.meFamily = FAMILY_DECORATIVE; - else if( (aPSName.Search("sans") != STRING_NOTFOUND) - || (aPSName.Search("arial") != STRING_NOTFOUND) ) + else if( (aPSName.indexOf("sans") != -1) + || (aPSName.indexOf("arial") != -1) ) rDFA.meFamily = FAMILY_SWISS; - else if( (aPSName.Search("roman") != STRING_NOTFOUND) - || (aPSName.Search("times") != STRING_NOTFOUND) ) + else if( (aPSName.indexOf("roman") != -1) + || (aPSName.indexOf("times") != -1) ) rDFA.meFamily = FAMILY_ROMAN; // heuristics for codepoint semantic - if( (aPSName.Search("symbol") != STRING_NOTFOUND) - || (aPSName.Search("dings") != STRING_NOTFOUND) - || (aPSName.Search("dingbats") != STRING_NOTFOUND) - || (aPSName.Search("ornaments") != STRING_NOTFOUND) - || (aPSName.Search("embellishments") != STRING_NOTFOUND) ) + if( (aPSName.indexOf("symbol") != -1) + || (aPSName.indexOf("dings") != -1) + || (aPSName.indexOf("dingbats") != -1) + || (aPSName.indexOf("ornaments") != -1) + || (aPSName.indexOf("embellishments") != -1) ) rDFA.mbSymbolFlag = true; // #i100020# special heuristic for names with single-char styles diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index 34b10919e935..0fccd6d663bc 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -2222,7 +2222,7 @@ sal_Bool AquaSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, if( osl_File_E_None != osl_getSystemPathFromFileURL( rToFile.pData, &aSysPath.pData ) ) return sal_False; const rtl_TextEncoding aThreadEncoding = osl_getThreadTextEncoding(); - const ByteString aToFile( rtl::OUStringToOString( aSysPath, aThreadEncoding ) ); + const rtl::OString aToFile( rtl::OUStringToOString( aSysPath, aThreadEncoding ) ); // get the raw-bytes from the font to be subset ByteVector aBuffer; @@ -2240,7 +2240,7 @@ sal_Bool AquaSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, // NOTE: assuming that all glyphids requested on Aqua are fully translated // make the subsetter provide the requested subset - FILE* pOutFile = fopen( aToFile.GetBuffer(), "wb" ); + FILE* pOutFile = fopen( aToFile.getStr(), "wb" ); bool bRC = rInfo.CreateFontSubset( FontSubsetInfo::TYPE1_PFB, pOutFile, NULL, pGlyphIDs, pEncoding, nGlyphCount, pGlyphWidths ); fclose( pOutFile ); @@ -2338,7 +2338,7 @@ sal_Bool AquaSalGraphics::CreateFontSubset( const rtl::OUString& rToFile, free( pGlyphMetrics ); // write subset into destination file - nRC = ::CreateTTFromTTGlyphs( pSftFont, aToFile.GetBuffer(), aShortIDs, + nRC = ::CreateTTFromTTGlyphs( pSftFont, aToFile.getStr(), aShortIDs, aTempEncs, nGlyphCount, 0, NULL, 0 ); ::CloseTTFont(pSftFont); return (nRC == SF_OK); |