diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-10-09 13:31:44 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-10-09 16:59:42 +0100 |
commit | ae95703819348938bf9e44bd635365e3e48cd05d (patch) | |
tree | 673328fb2669241829e582e4d9824ef1ee7eb5e9 /tools | |
parent | OSL_ENSURE -> SAL_WARN_IF (diff) | |
download | core-ae95703819348938bf9e44bd635365e3e48cd05d.tar.gz core-ae95703819348938bf9e44bd635365e3e48cd05d.zip |
Related: fdo#38838 remove UniString::SetToken & UniString::SearchAscii
Change-Id: I5219578fbeb40a0fe363f03c64021a83f7e505fb
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/string/strascii.cxx | 58 | ||||
-rw-r--r-- | tools/source/string/tustring.cxx | 38 |
2 files changed, 0 insertions, 96 deletions
diff --git a/tools/source/string/strascii.cxx b/tools/source/string/strascii.cxx index 5ae3967badf0..83cf85a42c08 100644 --- a/tools/source/string/strascii.cxx +++ b/tools/source/string/strascii.cxx @@ -63,21 +63,6 @@ static sal_Int32 ImplStringCompareAscii( const sal_Unicode* pStr1, const sal_Cha return nRet; } -static sal_Int32 ImplStringCompareWithoutZeroAscii( const sal_Unicode* pStr1, const sal_Char* pStr2, - xub_StrLen nCount ) -{ - sal_Int32 nRet = 0; - while ( nCount && - ((nRet = ((sal_Int32)*pStr1)-((sal_Int32)((unsigned char)*pStr2))) == 0) ) - { - ++pStr1, - ++pStr2, - --nCount; - } - - return nRet; -} - UniString& UniString::AppendAscii( const sal_Char* pAsciiStr ) { DBG_CHKTHIS( UniString, DbgCheckUniString ); @@ -168,47 +153,4 @@ StringCompare UniString::CompareToAscii( const sal_Char* pAsciiStr, return COMPARE_GREATER; } -xub_StrLen UniString::SearchAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex ) const -{ - DBG_CHKTHIS( UniString, DbgCheckUniString ); - DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, STRING_LEN ), - "UniString::SearchAscii() - pAsciiStr include characters > 127" ); - - sal_Int32 nLen = mpData->mnLen; - xub_StrLen nStrLen = ImplStringLen( pAsciiStr ); - - // If length of pAsciiStr is 0 or index exceeds length, it was not found - if ( !nStrLen || (nIndex >= nLen) ) - return STRING_NOTFOUND; - - const sal_Unicode* pStr = mpData->maStr; - pStr += nIndex; - - if ( nStrLen == 1 ) - { - sal_Unicode cSearch = (unsigned char)*pAsciiStr; - while ( nIndex < nLen ) - { - if ( *pStr == cSearch ) - return nIndex; - ++pStr, - ++nIndex; - } - } - else - { - // Only search within string - while ( nLen - nIndex >= nStrLen ) - { - // Check if string matches - if ( ImplStringCompareWithoutZeroAscii( pStr, pAsciiStr, nStrLen ) == 0 ) - return nIndex; - ++pStr, - ++nIndex; - } - } - - return STRING_NOTFOUND; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx index 9b10bdebf985..c339941b2a3d 100644 --- a/tools/source/string/tustring.cxx +++ b/tools/source/string/tustring.cxx @@ -235,44 +235,6 @@ xub_StrLen STRING::Match( const STRING& rStr ) const return STRING_MATCH; } -void STRING::SetToken( xub_StrLen nToken, STRCODE cTok, const STRING& rStr, - xub_StrLen nIndex ) -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING ); - - const STRCODE* pStr = mpData->maStr; - xub_StrLen nLen = (xub_StrLen)mpData->mnLen; - xub_StrLen nTok = 0; - xub_StrLen nFirstChar = nIndex; - xub_StrLen i = nFirstChar; - - // Determine token position and length - pStr += i; - while ( i < nLen ) - { - // Increase token count if match - if ( *pStr == cTok ) - { - ++nTok; - - if ( nTok == nToken ) - nFirstChar = i+1; - else - { - if ( nTok > nToken ) - break; - } - } - - ++pStr, - ++i; - } - - if ( nTok >= nToken ) - Replace( nFirstChar, i-nFirstChar, rStr ); -} - STRING STRING::GetToken( xub_StrLen nToken, STRCODE cTok, sal_Int32& rIndex ) const { DBG_CHKTHIS( STRING, DBGCHECKSTRING ); |