diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-09-22 09:02:16 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-09-22 15:01:04 +0100 |
commit | ac58231a01186d0935d0ff5fb2485d8750ed5022 (patch) | |
tree | 386ecb69491890ca62bd049a45bb7ee26e8dd5f5 /svtools | |
parent | callcatcher: remove unused code (diff) | |
download | core-ac58231a01186d0935d0ff5fb2485d8750ed5022.tar.gz core-ac58231a01186d0935d0ff5fb2485d8750ed5022.zip |
ByteString->rtl::OString[Buffer]
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/bmpmaker/bmpsum.cxx | 12 | ||||
-rw-r--r-- | svtools/inc/svtools/grfmgr.hxx | 10 | ||||
-rw-r--r-- | svtools/source/control/calendar.cxx | 15 | ||||
-rw-r--r-- | svtools/source/graphic/graphicunofactory.cxx | 2 | ||||
-rw-r--r-- | svtools/source/graphic/grfcache.cxx | 10 | ||||
-rw-r--r-- | svtools/source/graphic/grfcache.hxx | 4 | ||||
-rw-r--r-- | svtools/source/graphic/grfmgr.cxx | 8 | ||||
-rw-r--r-- | svtools/source/graphic/grfmgr2.cxx | 4 | ||||
-rw-r--r-- | svtools/source/misc/imap2.cxx | 15 | ||||
-rw-r--r-- | svtools/source/svhtml/htmlout.cxx | 43 | ||||
-rw-r--r-- | svtools/source/svrtf/parrtf.cxx | 39 |
11 files changed, 78 insertions, 84 deletions
diff --git a/svtools/bmpmaker/bmpsum.cxx b/svtools/bmpmaker/bmpsum.cxx index 215329aa41ff..adc644845bbb 100644 --- a/svtools/bmpmaker/bmpsum.cxx +++ b/svtools/bmpmaker/bmpsum.cxx @@ -36,6 +36,7 @@ #include <map> #include <rtl/crc.h> +#include <rtl/strbuf.hxx> #include <tools/stream.hxx> #include <tools/fsys.hxx> #include <vcl/svapp.hxx> @@ -411,14 +412,13 @@ void BmpSum::ProcessFileList( const String& rInFileList, // write new entries for( sal_uInt32 i = 0; i < aFileNameVector.size(); ++i ) { - ByteString aStr(rtl::OString::valueOf(static_cast<sal_Int64>(aPair.first))); - ByteString aFileName( aFileNameVector[ i ] ); + ByteString aFileName( aFileNameVector[ i ] ); DirEntry aSrcFile( aFileName ); - aStr += '\t'; - aStr += aFileName; - - aOStm.WriteLine( aStr ); + rtl::OStringBuffer aStr; + aStr.append(static_cast<sal_Int64>(aPair.first)) + .append('\t').append(aFileName); + aOStm.WriteLine( aStr.makeStringAndClear() ); // copy bitmap if( rOutPath.Len() ) diff --git a/svtools/inc/svtools/grfmgr.hxx b/svtools/inc/svtools/grfmgr.hxx index f43aec4cbae9..a7c58e17dd6e 100644 --- a/svtools/inc/svtools/grfmgr.hxx +++ b/svtools/inc/svtools/grfmgr.hxx @@ -229,7 +229,7 @@ private: void SVT_DLLPRIVATE ImplAssignGraphicData(); void SVT_DLLPRIVATE ImplSetGraphicManager( const GraphicManager* pMgr, - const ByteString* pID = NULL, + const rtl::OString* pID = NULL, const GraphicObject* pCopyObj = NULL ); void SVT_DLLPRIVATE ImplAutoSwapIn(); @@ -360,7 +360,7 @@ public: GraphicObject( const GraphicManager* pMgr = NULL ); GraphicObject( const Graphic& rGraphic, const GraphicManager* pMgr = NULL ); GraphicObject( const GraphicObject& rCacheObj, const GraphicManager* pMgr = NULL ); - GraphicObject( const ByteString& rUniqueID, const GraphicManager* pMgr = NULL ); + GraphicObject( const rtl::OString& rUniqueID, const GraphicManager* pMgr = NULL ); ~GraphicObject(); GraphicObject& operator=( const GraphicObject& rCacheObj ); @@ -435,7 +435,7 @@ public: void SetUserData( const String& rUserData ); String GetUserData() const; - ByteString GetUniqueID() const; + rtl::OString GetUniqueID() const; GraphicType GetType() const { return meType; } const Size& GetPrefSize() const { return maPrefSize; } @@ -649,7 +649,7 @@ private: void SVT_DLLPRIVATE ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubstitute, - const ByteString* pID = NULL, + const rtl::OString* pID = NULL, const GraphicObject* pCopyObj = NULL ); void SVT_DLLPRIVATE ImplUnregisterObj( const GraphicObject& rObj ); @@ -663,7 +663,7 @@ private: ); void SVT_DLLPRIVATE ImplGraphicObjectWasSwappedIn( const GraphicObject& rObj ); - ByteString SVT_DLLPRIVATE ImplGetUniqueID( const GraphicObject& rObj ) const; + rtl::OString SVT_DLLPRIVATE ImplGetUniqueID( const GraphicObject& rObj ) const; public: diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx index 71b28846ac55..46101bc413a5 100644 --- a/svtools/source/control/calendar.cxx +++ b/svtools/source/control/calendar.cxx @@ -29,6 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" +#include <rtl/strbuf.hxx> #include <vcl/svapp.hxx> #include <tools/table.hxx> #include <vcl/help.hxx> @@ -234,13 +235,15 @@ void Calendar::ImplInit( WinBits nWinStyle ) if (maCalendarWrapper.getUniqueID() != aGregorian) { #ifdef DBG_UTIL - ByteString aMsg( "Calendar::ImplInit: No ``gregorian'' calendar available for locale ``"); + rtl::OStringBuffer aMsg( "Calendar::ImplInit: No ``gregorian'' calendar available for locale ``"); lang::Locale aLoc( Application::GetAppLocaleDataWrapper().getLocale()); - aMsg += ByteString( String( aLoc.Language), RTL_TEXTENCODING_UTF8); - aMsg += '-'; - aMsg += ByteString( String( aLoc.Country), RTL_TEXTENCODING_UTF8); - aMsg += "'' and other calendars aren't supported. Using en-US fallback."; - DBG_ERRORFILE( aMsg.GetBuffer()); + aMsg.append(rtl::OUStringToOString(aLoc.Language, + RTL_TEXTENCODING_UTF8)); + aMsg.append('-'); + aMsg.append(rtl::OUStringToOString(aLoc.Country, + RTL_TEXTENCODING_UTF8)); + aMsg.append("'' and other calendars aren't supported. Using en-US fallback."); + DBG_ERRORFILE(aMsg.getStr()); #endif /* If we ever wanted to support other calendars than Gregorian a lot of * rewrite would be necessary to internally replace use of class Date diff --git a/svtools/source/graphic/graphicunofactory.cxx b/svtools/source/graphic/graphicunofactory.cxx index c1e2f13068de..bfa77d15ae19 100644 --- a/svtools/source/graphic/graphicunofactory.cxx +++ b/svtools/source/graphic/graphicunofactory.cxx @@ -92,7 +92,7 @@ void SAL_CALL GObjectImpl::setGraphic( const uno::Reference< graphic::XGraphic > ::osl::MutexGuard aGuard( m_aMutex ); rtl::OUString sId; if ( mpGObject.get() ) - sId = String( mpGObject->GetUniqueID().GetBuffer(), RTL_TEXTENCODING_ASCII_US ); + sId = rtl::OStringToOUString(mpGObject->GetUniqueID(), RTL_TEXTENCODING_ASCII_US); return sId; } diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index 573866020b42..3299deb23695 100644 --- a/svtools/source/graphic/grfcache.cxx +++ b/svtools/source/graphic/grfcache.cxx @@ -78,7 +78,7 @@ public: rID.mnID3 == mnID3 && rID.mnID4 == mnID4 ); } - ByteString GetIDString() const; + rtl::OString GetIDString() const; sal_Bool IsEmpty() const { return( 0 == mnID4 ); } }; @@ -134,7 +134,7 @@ GraphicID::GraphicID( const GraphicObject& rObj ) // ----------------------------------------------------------------------------- -ByteString GraphicID::GetIDString() const +rtl::OString GraphicID::GetIDString() const { rtl::OStringBuffer aHexStr; sal_Int32 nShift, nIndex = 0; @@ -587,7 +587,7 @@ GraphicCache::~GraphicCache() void GraphicCache::AddGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute, - const ByteString* pID, + const rtl::OString* pID, const GraphicObject* pCopyObj ) { @@ -866,9 +866,9 @@ sal_Bool GraphicCache::IsInDisplayCache( OutputDevice* pOut, const Point& rPt, c // ----------------------------------------------------------------------------- -ByteString GraphicCache::GetUniqueID( const GraphicObject& rObj ) const +rtl::OString GraphicCache::GetUniqueID( const GraphicObject& rObj ) const { - ByteString aRet; + rtl::OString aRet; GraphicCacheEntry* pEntry = ( (GraphicCache*) this )->ImplGetCacheEntry( rObj ); // ensure that the entry is correctly initialized (it has to be read at least once) diff --git a/svtools/source/graphic/grfcache.hxx b/svtools/source/graphic/grfcache.hxx index edc1aa67ceb5..efcfda8983a0 100644 --- a/svtools/source/graphic/grfcache.hxx +++ b/svtools/source/graphic/grfcache.hxx @@ -75,7 +75,7 @@ public: void AddGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute, - const ByteString* pID, + const rtl::OString* pID, const GraphicObject* pCopyObj ); @@ -85,7 +85,7 @@ public: sal_Bool FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ); void GraphicObjectWasSwappedIn( const GraphicObject& rObj ); - ByteString GetUniqueID( const GraphicObject& rObj ) const; + rtl::OString GetUniqueID( const GraphicObject& rObj ) const; public: diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index 4e3d99493a0f..52621ac5f43e 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -104,7 +104,7 @@ GraphicObject::GraphicObject( const GraphicObject& rGraphicObj, const GraphicMan ImplSetGraphicManager( pMgr, NULL, &rGraphicObj ); } -GraphicObject::GraphicObject( const ByteString& rUniqueID, const GraphicManager* pMgr ) : +GraphicObject::GraphicObject( const rtl::OString& rUniqueID, const GraphicManager* pMgr ) : mpLink ( NULL ), mpUserData ( NULL ) { @@ -163,7 +163,7 @@ void GraphicObject::ImplAssignGraphicData() mnAnimationLoopCount = ( mbAnimated ? maGraphic.GetAnimationLoopCount() : 0 ); } -void GraphicObject::ImplSetGraphicManager( const GraphicManager* pMgr, const ByteString* pID, const GraphicObject* pCopyObj ) +void GraphicObject::ImplSetGraphicManager( const GraphicManager* pMgr, const rtl::OString* pID, const GraphicObject* pCopyObj ) { if( !mpMgr || ( pMgr != mpMgr ) ) { @@ -378,12 +378,12 @@ void GraphicObject::Assign( const SvDataCopyStream& rCopyStream ) *this = (const GraphicObject& ) rCopyStream; } -ByteString GraphicObject::GetUniqueID() const +rtl::OString GraphicObject::GetUniqueID() const { if ( !IsInSwapIn() && ( IsEPS() || IsRenderGraphic() ) ) const_cast<GraphicObject*>(this)->FireSwapInRequest(); - ByteString aRet; + rtl::OString aRet; if( mpMgr ) aRet = mpMgr->ImplGetUniqueID( *this ); diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx index 60c778b62f0a..7534c47648af 100644 --- a/svtools/source/graphic/grfmgr2.cxx +++ b/svtools/source/graphic/grfmgr2.cxx @@ -227,7 +227,7 @@ sal_Bool GraphicManager::DrawObj( OutputDevice* pOut, const Point& rPt, const Si // ----------------------------------------------------------------------------- void GraphicManager::ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubstitute, - const ByteString* pID, const GraphicObject* pCopyObj ) + const rtl::OString* pID, const GraphicObject* pCopyObj ) { maObjList.push_back( (GraphicObject*)&rObj ); mpCache->AddGraphicObject( rObj, rSubstitute, pID, pCopyObj ); @@ -256,7 +256,7 @@ void GraphicManager::ImplGraphicObjectWasSwappedOut( const GraphicObject& rObj ) // ----------------------------------------------------------------------------- -ByteString GraphicManager::ImplGetUniqueID( const GraphicObject& rObj ) const +rtl::OString GraphicManager::ImplGetUniqueID( const GraphicObject& rObj ) const { return mpCache->GetUniqueID( rObj ); } diff --git a/svtools/source/misc/imap2.cxx b/svtools/source/misc/imap2.cxx index b28093172921..6ff6cad985e9 100644 --- a/svtools/source/misc/imap2.cxx +++ b/svtools/source/misc/imap2.cxx @@ -30,6 +30,7 @@ #include "precompiled_svtools.hxx" #include <string.h> +#include <rtl/strbuf.hxx> #include <vcl/svapp.hxx> #include <tools/urlobj.hxx> #include <vcl/wrkwin.hxx> @@ -263,7 +264,6 @@ sal_uLong ImageMap::ImpReadCERN( SvStream& rIStm, const String& rBaseURL ) void ImageMap::ImpReadCERNLine( const ByteString& rLine, const String& rBaseURL ) { ByteString aStr( rLine ); - ByteString aToken; aStr.EraseLeadingChars( ' ' ); aStr.EraseLeadingChars( '\t' ); @@ -273,12 +273,14 @@ void ImageMap::ImpReadCERNLine( const ByteString& rLine, const String& rBaseURL const char* pStr = aStr.GetBuffer(); char cChar = *pStr++; - // Anweisung finden + // Anweisung finden + rtl::OStringBuffer aBuf; while( ( cChar >= 'a' ) && ( cChar <= 'z' ) && NOTEOL( cChar ) ) { - aToken += cChar; + aBuf.append(cChar); cChar = *pStr++; } + rtl::OString aToken = aBuf.makeStringAndClear(); if ( NOTEOL( cChar ) ) { @@ -406,7 +408,6 @@ sal_uLong ImageMap::ImpReadNCSA( SvStream& rIStm, const String& rBaseURL ) void ImageMap::ImpReadNCSALine( const ByteString& rLine, const String& rBaseURL ) { ByteString aStr( rLine ); - ByteString aToken; aStr.EraseLeadingChars( ' ' ); aStr.EraseLeadingChars( '\t' ); @@ -416,12 +417,14 @@ void ImageMap::ImpReadNCSALine( const ByteString& rLine, const String& rBaseURL const char* pStr = aStr.GetBuffer(); char cChar = *pStr++; - // Anweisung finden + // Anweisung finden + rtl::OStringBuffer aBuf; while( ( cChar >= 'a' ) && ( cChar <= 'z' ) && NOTEOL( cChar ) ) { - aToken += cChar; + aBuf.append(cChar); cChar = *pStr++; } + rtl::OString aToken = aBuf.makeStringAndClear(); if ( NOTEOL( cChar ) ) { diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index 89bc665dcdc1..25fd6dfb165e 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -404,10 +404,11 @@ const sal_Char *lcl_svhtml_GetEntityForChar( sal_Unicode c, return pStr; } -void lcl_ConvertCharToHTML( sal_Unicode c, ByteString& rDest, +rtl::OString lcl_ConvertCharToHTML( sal_Unicode c, HTMLOutContext& rContext, String *pNonConvertableChars ) { + rtl::OStringBuffer aDest; DBG_ASSERT( RTL_TEXTENCODING_DONTKNOW != rContext.m_eDestEnc, "wrong destination encoding" ); const sal_Char *pStr = 0; @@ -449,8 +450,8 @@ void lcl_ConvertCharToHTML( sal_Unicode c, ByteString& rDest, DBG_ASSERT( (nInfo & (RTL_UNICODETOTEXT_INFO_ERROR|RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL)) == 0, "HTMLOut: error while flushing" ); sal_Char *pBuffer = cBuffer; while( nLen-- ) - rDest += *pBuffer++; - ((rDest += '&') += pStr) += ';'; + aDest.append(*pBuffer++); + aDest.append('&').append(pStr).append(';'); } else { @@ -463,7 +464,7 @@ void lcl_ConvertCharToHTML( sal_Unicode c, ByteString& rDest, { sal_Char *pBuffer = cBuffer; while( nLen-- ) - rDest += *pBuffer++; + aDest.append(*pBuffer++); } else { @@ -478,19 +479,22 @@ void lcl_ConvertCharToHTML( sal_Unicode c, ByteString& rDest, DBG_ASSERT( (nInfo & (RTL_UNICODETOTEXT_INFO_ERROR|RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL)) == 0, "HTMLOut: error while flushing" ); sal_Char *pBuffer = cBuffer; while( nLen-- ) - rDest += *pBuffer++; + aDest.append(*pBuffer++); - (((rDest += '&') += '#') += - ByteString(rtl::OString::valueOf(static_cast<sal_Int64>(c)))) += ';'; + aDest.append('&').append('#').append(static_cast<sal_Int64>(c)) + .append(';'); if( pNonConvertableChars && STRING_NOTFOUND == pNonConvertableChars->Search( c ) ) pNonConvertableChars->Append( c ); } } + return aDest.makeStringAndClear(); } -sal_Bool lcl_FlushToAscii( ByteString& rDest, HTMLOutContext& rContext ) +rtl::OString lcl_FlushToAscii( HTMLOutContext& rContext ) { + rtl::OStringBuffer aDest; + sal_Unicode c = 0; sal_Char cBuffer[TXTCONV_BUFFER_SIZE]; sal_uInt32 nInfo = 0; @@ -505,11 +509,10 @@ sal_Bool lcl_FlushToAscii( ByteString& rDest, HTMLOutContext& rContext ) cBuffer, TXTCONV_BUFFER_SIZE, nFlags, &nInfo, &nSrcChars ); DBG_ASSERT( (nInfo & (RTL_UNICODETOTEXT_INFO_ERROR|RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL)) == 0, "HTMLOut: error while flushing" ); - sal_Bool bRet = nLen > 0; sal_Char *pBuffer = cBuffer; while( nLen-- ) - rDest += *pBuffer++; - return bRet; + aDest.append(*pBuffer++); + return aDest.makeStringAndClear(); } void HTMLOutFuncs::ConvertStringToHTML( const String& rSrc, @@ -519,9 +522,9 @@ void HTMLOutFuncs::ConvertStringToHTML( const String& rSrc, { HTMLOutContext aContext( eDestEnc ); for( sal_uInt32 i=0UL, nLen = rSrc.Len(); i < nLen; i++ ) - lcl_ConvertCharToHTML( rSrc.GetChar( (xub_StrLen)i ), rDest, aContext, - pNonConvertableChars ); - lcl_FlushToAscii( rDest, aContext ); + rDest += ByteString(lcl_ConvertCharToHTML( + rSrc.GetChar( (xub_StrLen)i ), aContext, pNonConvertableChars)); + rDest += ByteString(lcl_FlushToAscii( aContext )); } SvStream& HTMLOutFuncs::Out_AsciiTag( SvStream& rStream, const sal_Char *pStr, @@ -537,9 +540,8 @@ SvStream& HTMLOutFuncs::Out_Char( SvStream& rStream, sal_Unicode c, HTMLOutContext& rContext, String *pNonConvertableChars ) { - ByteString sOut; - lcl_ConvertCharToHTML( c, sOut, rContext, pNonConvertableChars ); - rStream << sOut.GetBuffer(); + rtl::OString sOut = lcl_ConvertCharToHTML( c, rContext, pNonConvertableChars ); + rStream << sOut.getStr(); return rStream; } @@ -559,9 +561,10 @@ SvStream& HTMLOutFuncs::Out_String( SvStream& rStream, const String& rStr, SvStream& HTMLOutFuncs::FlushToAscii( SvStream& rStream, HTMLOutContext& rContext ) { - ByteString sOut; - if( lcl_FlushToAscii( sOut, rContext ) ) - rStream << sOut.GetBuffer(); + rtl::OString sOut = lcl_FlushToAscii( rContext ); + + if (sOut.getLength()) + rStream << sOut.getStr(); return rStream; } diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx index 02b102e578a1..12555a4c8804 100644 --- a/svtools/source/svrtf/parrtf.cxx +++ b/svtools/source/svrtf/parrtf.cxx @@ -339,30 +339,16 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak ) case '\'': { - ByteString aByteString; + rtl::OStringBuffer aByteString; while (1) { char c = (char)GetHexValue(); - - if (c) - { - aByteString.Append(c); - } - else - { - /* \'00 is a valid internal character in a - * string in RTF, however ByteString::Append - * does nothing if '\0' is passed in. It is - * otherwise capable of handling strings with - * embedded NULs, so add a '\1' and then - * change it, as ByteString::SetChar does not - * care if the character is '\0'. - */ - int nLen = aByteString.Len(); - - aByteString.Append('\001'); - aByteString.SetChar(nLen, '\0'); - } + /* + * Note: \'00 is a valid internal character in a + * string in RTF. rtl::OStringBuffer supports + * appending nulls fine + */ + aByteString.append(c); bool bBreak = false; sal_Char nSlash = '\\'; @@ -371,11 +357,10 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak ) wchar_t __next=GetNextChar(); if (__next>0xFF) // fix for #i43933# and #i35653# { - if (aByteString.Len()) - aStrBuffer.Append(String(aByteString, GetSrcEncoding())); + if (aByteString.getLength()) + aStrBuffer.Append(String(rtl::OStringToOUString(aByteString.makeStringAndClear(), GetSrcEncoding()))); aStrBuffer.Append((sal_Unicode)__next); - aByteString.Erase(); continue; } nSlash = (sal_Char)__next; @@ -390,7 +375,7 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak ) bBreak = true; break; default: - aByteString.Append(nSlash); + aByteString.append(nSlash); break; } } @@ -407,8 +392,8 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak ) bNextCh = false; - if (aByteString.Len()) - aStrBuffer.Append(String(aByteString, GetSrcEncoding())); + if (aByteString.getLength()) + aStrBuffer.Append(String(rtl::OStringToOUString(aByteString.makeStringAndClear(), GetSrcEncoding()))); } break; case '\\': |