diff options
author | Noel Grandin <noel@peralex.com> | 2014-06-04 11:43:58 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-06-04 11:52:34 +0200 |
commit | cc25f70ef1e9fa7637b4bfd332ebdc33844a41c2 (patch) | |
tree | 76fe846c5b4ec24faa6ee53d34c49554eac3d4a8 /svtools | |
parent | compareToAscii -> equalsAscii (diff) | |
download | core-cc25f70ef1e9fa7637b4bfd332ebdc33844a41c2.tar.gz core-cc25f70ef1e9fa7637b4bfd332ebdc33844a41c2.zip |
compareTo -> equals
convert OUString::compareTo usage to equals to startsWith where it
is more appropriate
Change-Id: I6f5b5b7942429c0099ad082ba4984fd18e422121
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/contnr/fileview.cxx | 8 | ||||
-rw-r--r-- | svtools/source/contnr/templwin.cxx | 2 | ||||
-rw-r--r-- | svtools/source/svhtml/parhtml.cxx | 21 |
3 files changed, 14 insertions, 17 deletions
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 8b664c75647c..93afb641ba10 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -249,12 +249,12 @@ HashedEntry::~HashedEntry() inline bool HashedEntry::operator ==( const HashedEntry& rRef ) const { - return mnHashCode == rRef.mnHashCode && maName.reverseCompareTo( rRef.maName ) == 0; + return mnHashCode == rRef.mnHashCode && maName == rRef.maName; } inline bool HashedEntry::operator !=( const HashedEntry& rRef ) const { - return mnHashCode != rRef.mnHashCode || maName.reverseCompareTo( rRef.maName ) != 0; + return mnHashCode != rRef.mnHashCode || maName != rRef.maName; } inline bool HashedEntry::operator <( const HashedEntry& rRef ) const @@ -2468,7 +2468,7 @@ bool SvtFileView_Impl::SearchNextEntry( sal_uInt32& nIndex, const OUString& rTit while ( nIndex < nEnd ) { SortingData_Impl* pData = maContent[ nIndex ]; - if ( rTitle.compareTo( pData->GetLowerTitle(), rTitle.getLength() ) == 0 ) + if ( pData->GetLowerTitle().startsWith( rTitle ) ) return true; nIndex += 1; } @@ -2479,7 +2479,7 @@ bool SvtFileView_Impl::SearchNextEntry( sal_uInt32& nIndex, const OUString& rTit while ( nIndex < nEnd && nIndex <= nStart ) { SortingData_Impl* pData = maContent[ nIndex ]; - if ( rTitle.compareTo( pData->GetLowerTitle(), rTitle.getLength() ) == 0 ) + if ( pData->GetLowerTitle().startsWith( rTitle ) ) return true; nIndex += 1; } diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index c800c6c4db04..6141fae75de2 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -537,7 +537,7 @@ void SvtFileViewWindow_Impl::OpenFolder( const OUString& rURL ) { sal_Int32 nSampFoldLen = aSamplesFolderURL.getLength(); aFileView.EnableNameReplacing( - nSampFoldLen && rURL.compareTo( aSamplesFolderURL, nSampFoldLen ) == 0 ); + nSampFoldLen && rURL.startsWith( aSamplesFolderURL ) ); aFileView.Initialize( rURL, "", NULL ); } aNewFolderLink.Call( this ); diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index 93e8c2df55ae..c9d70c9d9c62 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -883,8 +883,7 @@ int HTMLParser::_GetNextRawToken() { if( !bReadComment ) { - if( aTok.compareTo( OOO_STRING_SVTOOLS_HTML_comment, 3 ) - == 0 ) + if( aTok.startsWith( OOO_STRING_SVTOOLS_HTML_comment ) ) { bReadComment = true; } @@ -893,9 +892,9 @@ int HTMLParser::_GetNextRawToken() // A script has to end with "</SCRIPT>". But // ">" is optional for security reasons bDone = bOffState && - 0 == ( bReadScript - ? aTok.compareTo(OOO_STRING_SVTOOLS_HTML_script) - : aTok.compareTo(aEndToken) ); + ( bReadScript + ? aTok.equals(OOO_STRING_SVTOOLS_HTML_script) + : aTok.equals(aEndToken) ); } } if( bReadComment && '>'==nNextCh && aTok.endsWith( "--" ) ) @@ -908,13 +907,11 @@ int HTMLParser::_GetNextRawToken() { // Style sheets can be closed by </STYLE>, </HEAD> or <BODY> if( bOffState ) - bDone = aTok.compareTo(OOO_STRING_SVTOOLS_HTML_style) - == 0 || - aTok.compareTo(OOO_STRING_SVTOOLS_HTML_head) - == 0; + bDone = aTok.equals(OOO_STRING_SVTOOLS_HTML_style) || + aTok.equals(OOO_STRING_SVTOOLS_HTML_head); else bDone = - aTok.compareTo(OOO_STRING_SVTOOLS_HTML_body) == 0; + aTok.equals(OOO_STRING_SVTOOLS_HTML_body); } if( bDone ) @@ -1958,7 +1955,7 @@ bool HTMLParser::InternalImgToPrivateURL( OUString& rURL ) bool bFound = false; - if( rURL.compareTo( OOO_STRING_SVTOOLS_HTML_internal_gopher,16) == 0 ) + if( rURL.startsWith( OOO_STRING_SVTOOLS_HTML_internal_gopher ) ) { OUString aName( rURL.copy(16) ); switch( aName[0] ) @@ -1986,7 +1983,7 @@ bool HTMLParser::InternalImgToPrivateURL( OUString& rURL ) break; } } - else if( rURL.compareTo( OOO_STRING_SVTOOLS_HTML_internal_icon,14) == 0 ) + else if( rURL.startsWith( OOO_STRING_SVTOOLS_HTML_internal_icon ) ) { OUString aName( rURL.copy(14) ); switch( aName[0] ) |