diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-09-17 14:09:38 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-09-17 23:20:46 +0100 |
commit | f20bafad82340f1f735c1804a34ddd3a34c00e74 (patch) | |
tree | 40f33eee2c3fd94c60c1b81be057fc0a2a64c004 /tools/source | |
parent | 98f84dfaeff753f6bf7c8b841466dbb0319e9037 (diff) |
ditch ByteString::Expand
Diffstat (limited to 'tools/source')
-rw-r--r-- | tools/source/string/strimp.cxx | 31 | ||||
-rw-r--r-- | tools/source/string/tustring.cxx | 31 |
2 files changed, 31 insertions, 31 deletions
diff --git a/tools/source/string/strimp.cxx b/tools/source/string/strimp.cxx index 3d15cb29b26c..d8428750526b 100644 --- a/tools/source/string/strimp.cxx +++ b/tools/source/string/strimp.cxx @@ -769,37 +769,6 @@ STRING& STRING::Erase( xub_StrLen nIndex, xub_StrLen nCount ) // ----------------------------------------------------------------------- -STRING& STRING::Expand( xub_StrLen nCount, STRCODE cExpandChar ) -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - - // Muss der String erweitert werden - sal_Int32 nLen = mpData->mnLen; - if ( nCount <= nLen ) - return *this; - - // Neuen String anlegen - STRINGDATA* pNewData = ImplAllocData( nCount ); - - // Alten String kopieren - memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) ); - - // und initialisieren - STRCODE* pStr = pNewData->maStr; - pStr += nLen; - for (sal_Int32 i = nCount - nLen; i > 0; --i) { - *pStr++ = cExpandChar; - } - - // Alte Daten loeschen und Neue zuweisen - STRING_RELEASE((STRING_TYPE *)mpData); - mpData = pNewData; - - return *this; -} - -// ----------------------------------------------------------------------- - STRING& STRING::EraseLeadingChars( STRCODE c ) { DBG_CHKTHIS( STRING, DBGCHECKSTRING ); diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx index 720d5a24b002..0f9874140769 100644 --- a/tools/source/string/tustring.cxx +++ b/tools/source/string/tustring.cxx @@ -474,4 +474,35 @@ STRING& STRING::Fill( xub_StrLen nCount, STRCODE cFillChar ) return *this; } +// ----------------------------------------------------------------------- + +STRING& STRING::Expand( xub_StrLen nCount, STRCODE cExpandChar ) +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + + // Muss der String erweitert werden + sal_Int32 nLen = mpData->mnLen; + if ( nCount <= nLen ) + return *this; + + // Neuen String anlegen + STRINGDATA* pNewData = ImplAllocData( nCount ); + + // Alten String kopieren + memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) ); + + // und initialisieren + STRCODE* pStr = pNewData->maStr; + pStr += nLen; + for (sal_Int32 i = nCount - nLen; i > 0; --i) { + *pStr++ = cExpandChar; + } + + // Alte Daten loeschen und Neue zuweisen + STRING_RELEASE((STRING_TYPE *)mpData); + mpData = pNewData; + + return *this; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |