diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-09-20 15:24:47 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-09-20 16:54:54 +0100 |
commit | 2c0831ebbf940833c3fecc66abd1ce0f3a29cd10 (patch) | |
tree | 2915f157a0857d3158b94e8dcdbcb97879106fb5 /vcl | |
parent | 2f33cf5115df156cc17f6218ca42ca367cd32cf4 (diff) |
ByteString->rtl::OString[Buffer]
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/bitmapex.cxx | 7 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 74 | ||||
-rw-r--r-- | vcl/unx/generic/fontmanager/fontmanager.cxx | 21 |
3 files changed, 53 insertions, 49 deletions
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index 584eacf2c360..0db0df76427e 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -32,6 +32,7 @@ #include <ctype.h> #include <rtl/crc.h> +#include <rtl/strbuf.hxx> #include <tools/stream.hxx> #include <tools/debug.hxx> @@ -112,8 +113,10 @@ BitmapEx::BitmapEx( const ResId& rResId ) : if( !aImageTree->loadImage( aFileName, aCurrentSymbolsStyle, *this, true ) ) { #ifdef DBG_UTIL - ByteString aErrorStr( "BitmapEx::BitmapEx( const ResId& rResId ): could not load image <" ); - OSL_FAIL( ( ( aErrorStr += ByteString( aFileName, RTL_TEXTENCODING_ASCII_US ) ) += '>' ).GetBuffer() ); + rtl::OStringBuffer aErrorStr(RTL_CONSTASCII_STRINGPARAM( + "BitmapEx::BitmapEx( const ResId& rResId ): could not load image <")); + aErrorStr.append(rtl::OUStringToOString(aFileName, RTL_TEXTENCODING_ASCII_US)).append('>'); + OSL_FAIL(aErrorStr.getStr()); #endif } } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index d0646e09a8d8..321daba1e268 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -4195,7 +4195,7 @@ Window::Window( Window* pParent, const ResId& rResId ) #if OSL_DEBUG_LEVEL > 0 namespace { - void lcl_appendWindowInfo( ByteString& io_rErrorString, const Window& i_rWindow ) + rtl::OString lcl_createWindowInfo(const Window& i_rWindow) { // skip border windows, they don't carry information which helps diagnosing the problem const Window* pWindow( &i_rWindow ); @@ -4204,11 +4204,13 @@ namespace if ( !pWindow ) pWindow = &i_rWindow; - io_rErrorString += char(13); - io_rErrorString += typeid( *pWindow ).name(); - io_rErrorString += " (window text: '"; - io_rErrorString += ByteString( pWindow->GetText(), RTL_TEXTENCODING_UTF8 ); - io_rErrorString += "')"; + rtl::OStringBuffer aErrorString; + aErrorString.append(char(13)); + aErrorString.append(typeid( *pWindow ).name()); + aErrorString.append(" (window text: '"); + aErrorString.append(rtl::OUStringToOString(pWindow->GetText(), RTL_TEXTENCODING_UTF8)); + aErrorString.append("')"); + return aErrorString.makeStringAndClear(); } } #endif @@ -4338,7 +4340,7 @@ Window::~Window() #if OSL_DEBUG_LEVEL > 0 if ( sal_True ) // always perform these tests in non-pro versions { - ByteString aErrorStr; + rtl::OStringBuffer aErrorStr; sal_Bool bError = sal_False; Window* pTempWin = mpWindowImpl->mpFrameData->mpFirstOverlap; while ( pTempWin ) @@ -4346,7 +4348,7 @@ Window::~Window() if ( ImplIsRealParentPath( pTempWin ) ) { bError = sal_True; - lcl_appendWindowInfo( aErrorStr, *pTempWin ); + aErrorStr.append(lcl_createWindowInfo(*pTempWin)); } pTempWin = pTempWin->mpWindowImpl->mpNextOverlap; } @@ -4372,48 +4374,48 @@ Window::~Window() if ( ImplIsRealParentPath( pTempWin ) ) { bError = sal_True; - lcl_appendWindowInfo( aErrorStr, *pTempWin ); + aErrorStr.append(lcl_createWindowInfo(*pTempWin)); } pTempWin = pTempWin->mpWindowImpl->mpFrameData->mpNextFrame; } if ( bError ) { - ByteString aTempStr( "Window (" ); - aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 ); - aTempStr += ") with living SystemWindow(s) destroyed: "; - aTempStr += aErrorStr; - OSL_FAIL( aTempStr.GetBuffer() ); - GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! + rtl::OStringBuffer aTempStr( "Window (" ); + aTempStr.append(rtl::OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8)); + aTempStr.append(") with living SystemWindow(s) destroyed: "); + aTempStr.append(aErrorStr); + OSL_FAIL( aTempStr.getStr() ); + GetpApp()->Abort(rtl::OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in non-pro version, this must be fixed! } if ( mpWindowImpl->mpFirstChild ) { - ByteString aTempStr( "Window (" ); - aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 ); - aTempStr += ") with living Child(s) destroyed: "; + rtl::OStringBuffer aTempStr("Window ("); + aTempStr.append(rtl::OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8)); + aTempStr.append(") with living Child(s) destroyed: "); pTempWin = mpWindowImpl->mpFirstChild; while ( pTempWin ) { - lcl_appendWindowInfo( aTempStr, *pTempWin ); + aTempStr.append(lcl_createWindowInfo(*pTempWin)); pTempWin = pTempWin->mpWindowImpl->mpNext; } - OSL_FAIL( aTempStr.GetBuffer() ); - GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! + OSL_FAIL( aTempStr.getStr() ); + GetpApp()->Abort(rtl::OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in non-pro version, this must be fixed! } if ( mpWindowImpl->mpFirstOverlap ) { - ByteString aTempStr( "Window (" ); - aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 ); - aTempStr += ") with living SystemWindow(s) destroyed: "; + rtl::OStringBuffer aTempStr("Window ("); + aTempStr.append(rtl::OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8)); + aTempStr.append(") with living SystemWindow(s) destroyed: "); pTempWin = mpWindowImpl->mpFirstOverlap; while ( pTempWin ) { - lcl_appendWindowInfo( aTempStr, *pTempWin ); + aTempStr.append(lcl_createWindowInfo(*pTempWin)); pTempWin = pTempWin->mpWindowImpl->mpNext; } - OSL_FAIL( aTempStr.GetBuffer() ); - GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! + OSL_FAIL( aTempStr.getStr() ); + GetpApp()->Abort(rtl::OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in non-pro version, this must be fixed! } Window* pMyParent = this; @@ -4427,11 +4429,11 @@ Window::~Window() } if ( pMySysWin && pMySysWin->ImplIsInTaskPaneList( this ) ) { - ByteString aTempStr( "Window (" ); - aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 ); - aTempStr += ") still in TaskPanelList!"; - OSL_FAIL( aTempStr.GetBuffer() ); - GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! + rtl::OStringBuffer aTempStr("Window ("); + aTempStr.append(rtl::OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8)); + aTempStr.append(") still in TaskPanelList!"); + OSL_FAIL( aTempStr.getStr() ); + GetpApp()->Abort(rtl::OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in non-pro version, this must be fixed! } } #endif @@ -4453,10 +4455,10 @@ Window::~Window() } else { - ByteString aTempStr( "Window (" ); - aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 ); - aTempStr += ") not found in TaskPanelList!"; - OSL_FAIL( aTempStr.GetBuffer() ); + rtl::OStringBuffer aTempStr("Window ("); + aTempStr.append(rtl::OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8)); + aTempStr.append(") not found in TaskPanelList!"); + OSL_FAIL( aTempStr.getStr() ); } } diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx index dbd73f829845..0028f0499032 100644 --- a/vcl/unx/generic/fontmanager/fontmanager.cxx +++ b/vcl/unx/generic/fontmanager/fontmanager.cxx @@ -1020,16 +1020,16 @@ bool PrintFontManager::PrintFont::readAfmMetrics( const OString& rFileName, Mult continue; } - ByteString aTranslate; + rtl::OStringBuffer aTranslate; if( pChar->code & 0xff000000 ) - aTranslate += (char)(pChar->code >> 24 ); + aTranslate.append((char)(pChar->code >> 24)); if( pChar->code & 0xffff0000 ) - aTranslate += (char)((pChar->code & 0x00ff0000) >> 16 ); + aTranslate.append((char)((pChar->code & 0x00ff0000) >> 16)); if( pChar->code & 0xffffff00 ) - aTranslate += (char)((pChar->code & 0x0000ff00) >> 8 ); - aTranslate += (char)(pChar->code & 0xff); - String aUni( aTranslate, m_aEncoding ); - pUnicodes[i] = *aUni.GetBuffer(); + aTranslate.append((char)((pChar->code & 0x0000ff00) >> 8 )); + aTranslate.append((char)(pChar->code & 0xff)); + rtl::OUString aUni(rtl::OStringToOUString(aTranslate.makeStringAndClear(), m_aEncoding)); + pUnicodes[i] = aUni.toChar(); } else pUnicodes[i] = 0; @@ -2403,11 +2403,10 @@ void PrintFontManager::initialize() while( ! readdir_r( pDIR, (struct dirent*)aDirEntBuffer, &pDirEntry ) && pDirEntry ) { - ByteString aFile( aDir ); - aFile += '/'; - aFile += pDirEntry->d_name; + rtl::OStringBuffer aFile(aDir); + aFile.append('/').append(pDirEntry->d_name); struct stat aStat; - if( ! stat( aFile.GetBuffer(), &aStat ) + if( ! stat( aFile.getStr(), &aStat ) && S_ISREG( aStat.st_mode ) ) { |