From 7e7a487e904143cbc282a2b90c4cb3918bfa151f Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 14 Oct 2013 09:54:50 +0100 Subject: Related: fdo#38838 remove UniString::AppendAscii Change-Id: I0f929843d73eb445c8b1aa56d59cbbce844b9008 --- tools/source/string/strascii.cxx | 86 ---------------------------------------- 1 file changed, 86 deletions(-) (limited to 'tools') diff --git a/tools/source/string/strascii.cxx b/tools/source/string/strascii.cxx index 83cf85a42c08..85cca277286f 100644 --- a/tools/source/string/strascii.cxx +++ b/tools/source/string/strascii.cxx @@ -32,21 +32,6 @@ static sal_Bool ImplDbgCheckAsciiStr( const sal_Char* pAsciiStr, sal_Int32 nLen } #endif -static void ImplCopyAsciiStr( sal_Unicode* pDest, const sal_Char* pSrc, - sal_Int32 nLen ) -{ - DBG_ASSERT( ImplDbgCheckAsciiStr( pSrc, nLen ), - "UniString::CopyAsciiStr() - pAsciiStr include characters > 127" ); - - while ( nLen ) - { - *pDest = (unsigned char)*pSrc; - ++pDest, - ++pSrc, - --nLen; - } -} - static sal_Int32 ImplStringCompareAscii( const sal_Unicode* pStr1, const sal_Char* pStr2, xub_StrLen nCount ) { @@ -63,77 +48,6 @@ static sal_Int32 ImplStringCompareAscii( const sal_Unicode* pStr1, const sal_Cha return nRet; } -UniString& UniString::AppendAscii( const sal_Char* pAsciiStr ) -{ - DBG_CHKTHIS( UniString, DbgCheckUniString ); - DBG_ASSERT( pAsciiStr, "UniString::AppendAscii() - pAsciiStr is NULL" ); - - // determine string length - sal_Int32 nCopyLen = ImplStringLen( pAsciiStr ); - - // detect overflow - nCopyLen = ImplGetCopyLen( mpData->mnLen, nCopyLen ); - - // If appended string is not empty - if ( nCopyLen ) - { - // Allocate new string - UniStringData* pNewData = ImplAllocData( mpData->mnLen+nCopyLen ); - - // copy string data - memcpy( pNewData->maStr, mpData->maStr, mpData->mnLen*sizeof( sal_Unicode ) ); - ImplCopyAsciiStr( pNewData->maStr+mpData->mnLen, pAsciiStr, nCopyLen ); - - // release old string - STRING_RELEASE((STRING_TYPE *)mpData); - mpData = pNewData; - } - - return *this; -} - -UniString& UniString::AppendAscii( const sal_Char* pAsciiStr, xub_StrLen nLen ) -{ - DBG_CHKTHIS( UniString, DbgCheckUniString ); - DBG_ASSERT( pAsciiStr, "UniString::AppendAscii() - pAsciiStr is NULL" ); - - if ( nLen == STRING_LEN ) - nLen = ImplStringLen( pAsciiStr ); - -#ifdef DBG_UTIL - if ( DbgIsAssert() ) - { - for ( xub_StrLen i = 0; i < nLen; ++i ) - { - if ( !pAsciiStr[i] ) - { - OSL_FAIL( "UniString::AppendAscii() : nLen is wrong" ); - } - } - } -#endif - - // detect overflow - sal_Int32 nCopyLen = ImplGetCopyLen( mpData->mnLen, nLen ); - - // If appended string is not empty - if ( nCopyLen ) - { - // Allocate new string - UniStringData* pNewData = ImplAllocData( mpData->mnLen+nCopyLen ); - - // copy string data - memcpy( pNewData->maStr, mpData->maStr, mpData->mnLen*sizeof( sal_Unicode ) ); - ImplCopyAsciiStr( pNewData->maStr+mpData->mnLen, pAsciiStr, nCopyLen ); - - // release old string - STRING_RELEASE((STRING_TYPE *)mpData); - mpData = pNewData; - } - - return *this; -} - StringCompare UniString::CompareToAscii( const sal_Char* pAsciiStr, xub_StrLen nLen ) const { -- cgit