diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-09-23 07:19:08 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-09-25 19:24:23 +0200 |
commit | 98de5b40c8a3fd4e57477b6d994e3b1472207f71 (patch) | |
tree | 567fdbbaecbddbfc19f28a08da5d1f6d5207748c /tools/source | |
parent | 0552a91acde9dce28c0d92c552d21fbadfcb9184 (diff) |
Related: fdo#38838 remove UniString::EqualsIgnoreCaseAscii
Change-Id: Ib5c3a2daa4a48bc286b14fa2cebb3306ea0012bc
Diffstat (limited to 'tools/source')
-rw-r--r-- | tools/source/string/strascii.cxx | 80 | ||||
-rw-r--r-- | tools/source/string/tustring.cxx | 63 |
2 files changed, 0 insertions, 143 deletions
diff --git a/tools/source/string/strascii.cxx b/tools/source/string/strascii.cxx index 5fcea9fa7907..bf0d5a288f14 100644 --- a/tools/source/string/strascii.cxx +++ b/tools/source/string/strascii.cxx @@ -91,63 +91,6 @@ static sal_Int32 ImplStringCompareWithoutZeroAscii( const sal_Unicode* pStr1, co return nRet; } -static sal_Int32 ImplStringICompareAscii( const sal_Unicode* pStr1, const sal_Char* pStr2 ) -{ - sal_Int32 nRet; - sal_Unicode c1; - sal_Char c2; - do - { - // Convert if char is between 'A' and 'Z' - c1 = *pStr1; - c2 = *pStr2; - if ( (c1 >= 65) && (c1 <= 90) ) - c1 += 32; - if ( (c2 >= 65) && (c2 <= 90) ) - c2 += 32; - nRet = ((sal_Int32)c1)-((sal_Int32)((unsigned char)c2)); - if ( nRet != 0 ) - break; - - ++pStr1, - ++pStr2; - } - while ( c2 ); - - return nRet; -} - -static sal_Int32 ImplStringICompareAscii( const sal_Unicode* pStr1, const sal_Char* pStr2, - xub_StrLen nCount ) -{ - sal_Int32 nRet = 0; - sal_Unicode c1; - sal_Char c2; - do - { - if ( !nCount ) - break; - - // Convert if char is between 'A' and 'Z' - c1 = *pStr1; - c2 = *pStr2; - if ( (c1 >= 65) && (c1 <= 90) ) - c1 += 32; - if ( (c2 >= 65) && (c2 <= 90) ) - c2 += 32; - nRet = ((sal_Int32)c1)-((sal_Int32)((unsigned char)c2)); - if ( nRet != 0 ) - break; - - ++pStr1, - ++pStr2, - --nCount; - } - while ( c2 ); - - return nRet; -} - UniString& UniString::AssignAscii( const sal_Char* pAsciiStr ) { DBG_CHKTHIS( UniString, DbgCheckUniString ); @@ -322,15 +265,6 @@ sal_Bool UniString::EqualsAscii( const sal_Char* pAsciiStr ) const return (ImplStringCompareAscii( mpData->maStr, pAsciiStr ) == 0); } -sal_Bool UniString::EqualsIgnoreCaseAscii( const sal_Char* pAsciiStr ) const -{ - DBG_CHKTHIS( UniString, DbgCheckUniString ); - DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, STRING_LEN ), - "UniString::EqualsIgnoreCaseAscii() - pAsciiStr include characters > 127" ); - - return (ImplStringICompareAscii( mpData->maStr, pAsciiStr ) == 0); -} - sal_Bool UniString::EqualsAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex, xub_StrLen nLen ) const { @@ -345,20 +279,6 @@ sal_Bool UniString::EqualsAscii( const sal_Char* pAsciiStr, return (ImplStringCompareAscii( mpData->maStr+nIndex, pAsciiStr, nLen ) == 0); } -sal_Bool UniString::EqualsIgnoreCaseAscii( const sal_Char* pAsciiStr, - xub_StrLen nIndex, xub_StrLen nLen ) const -{ - DBG_CHKTHIS( UniString, DbgCheckUniString ); - DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, nLen ), - "UniString::EqualsIgnoreCaseAscii() - pAsciiStr include characters > 127" ); - - // Are there enough codes for comparing? - if ( nIndex > mpData->mnLen ) - return (*pAsciiStr == 0); - - return (ImplStringICompareAscii( mpData->maStr+nIndex, pAsciiStr, nLen ) == 0); -} - xub_StrLen UniString::SearchAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex ) const { DBG_CHKTHIS( UniString, DbgCheckUniString ); diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx index 4d081bd72d0e..2a73396929b0 100644 --- a/tools/source/string/tustring.cxx +++ b/tools/source/string/tustring.cxx @@ -124,54 +124,6 @@ STRING& STRING::Insert( const STRING& rStr, xub_StrLen nPos, xub_StrLen nLen, return *this; } -static sal_Int32 ImplStringICompareWithoutZero( const STRCODE* pStr1, const STRCODE* pStr2, - sal_Int32 nCount ) -{ - sal_Int32 nRet = 0; - STRCODE c1; - STRCODE c2; - do - { - if ( !nCount ) - break; - - // convert if char is between 'A' and 'Z' - c1 = *pStr1; - c2 = *pStr2; - if ( (c1 >= 65) && (c1 <= 90) ) - c1 += 32; - if ( (c2 >= 65) && (c2 <= 90) ) - c2 += 32; - nRet = ((sal_Int32)((STRCODEU)c1))-((sal_Int32)((STRCODEU)c2)); - - ++pStr1, - ++pStr2, - --nCount; - } - while ( nRet == 0 ); - - return nRet; -} - -sal_Bool STRING::EqualsIgnoreCaseAscii( const STRING& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING ); - - // Are there enough codes for comparing? - if ( nIndex > mpData->mnLen ) - return (rStr.mpData->mnLen == 0); - sal_Int32 nMaxLen = mpData->mnLen-nIndex; - if ( nMaxLen < nLen ) - { - if ( rStr.mpData->mnLen != nMaxLen ) - return sal_False; - nLen = static_cast< xub_StrLen >(nMaxLen); - } - - return (ImplStringICompareWithoutZero( mpData->maStr+nIndex, rStr.mpData->maStr, nLen ) == 0); -} - STRING& STRING::Insert( STRCODE c, xub_StrLen nIndex ) { DBG_CHKTHIS( STRING, DBGCHECKSTRING ); @@ -238,21 +190,6 @@ sal_Bool STRING::Equals( const STRING& rStr ) const return (ImplStringCompareWithoutZero( mpData->maStr, rStr.mpData->maStr, mpData->mnLen ) == 0); } -sal_Bool STRING::EqualsIgnoreCaseAscii( const STRING& rStr ) const -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING ); - - if ( mpData == rStr.mpData ) - return sal_True; - - if ( mpData->mnLen != rStr.mpData->mnLen ) - return sal_False; - - // compare string while ignoring case - return (ImplStringICompareWithoutZero( mpData->maStr, rStr.mpData->maStr, mpData->mnLen ) == 0); -} - sal_Bool STRING::Equals( const STRING& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const { DBG_CHKTHIS( STRING, DBGCHECKSTRING ); |