From 7a06928bcf638e1eeedebc9d53c306a1b852cc9b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 21 Oct 2013 10:21:01 +0200 Subject: convert code to use OUString::endsWith Convert places that call aStr[aStr.getLength()-1] == 'x' to use the shorter form aStr.endsWith("x") Change-Id: I1b3a19c0e89b8989cdbeed440f95fc76f9a4b6b6 --- svl/qa/unit/test_URIHelper.cxx | 2 +- svl/source/passwordcontainer/passwordcontainer.cxx | 8 ++++---- svl/source/passwordcontainer/syscreds.cxx | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'svl') diff --git a/svl/qa/unit/test_URIHelper.cxx b/svl/qa/unit/test_URIHelper.cxx index 3d160d66bee5..313ce6538c96 100644 --- a/svl/qa/unit/test_URIHelper.cxx +++ b/svl/qa/unit/test_URIHelper.cxx @@ -162,7 +162,7 @@ css::uno::Any Content::execute( uri += "/"; break; case '2': - if (uri.getLength() > 0 && uri[uri.getLength() - 1] == '/') { + if (uri.endsWith("/")) { uri = uri.copy(0, uri.getLength() -1); } break; diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index 8c4f7d28361f..ad99f8bb19bc 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -788,8 +788,8 @@ UrlRecord PasswordContainer::find( else { OUString tmpUrl( aUrl ); - if ( tmpUrl.getStr()[tmpUrl.getLength() - 1] != (sal_Unicode)'/' ) - tmpUrl += OUString("/"); + if ( !tmpUrl.endsWith("/") ) + tmpUrl += "/"; aIter = m_aContainer.lower_bound( tmpUrl ); if( aIter != m_aContainer.end() && aIter->first.match( tmpUrl ) ) @@ -919,7 +919,7 @@ void SAL_CALL PasswordContainer::remove( const OUString& aURL, const OUString& a if( aInd > 0 && aUrl.getLength()-1 == aInd ) aUrl = aUrl.copy( 0, aUrl.getLength() - 1 ); else - aUrl += OUString("/"); + aUrl += "/"; aIter = m_aContainer.find( aUrl ); } @@ -960,7 +960,7 @@ void SAL_CALL PasswordContainer::removePersistent( const OUString& aURL, const O if( aInd > 0 && aUrl.getLength()-1 == aInd ) aUrl = aUrl.copy( 0, aUrl.getLength() - 1 ); else - aUrl += OUString("/"); + aUrl += "/"; aIter = m_aContainer.find( aUrl ); } diff --git a/svl/source/passwordcontainer/syscreds.cxx b/svl/source/passwordcontainer/syscreds.cxx index 9423acfc005f..5bd60dcf8537 100644 --- a/svl/source/passwordcontainer/syscreds.cxx +++ b/svl/source/passwordcontainer/syscreds.cxx @@ -141,8 +141,8 @@ namespace else { OUString tmpUrl( aUrl ); - if ( tmpUrl.getStr()[tmpUrl.getLength() - 1] != (sal_Unicode)'/' ) - tmpUrl += OUString("/"); + if ( !tmpUrl.endsWith("/") ) + tmpUrl += "/"; aIter = rContainer.lower_bound( tmpUrl ); if( aIter != rContainer.end() && aIter->match( tmpUrl ) ) -- cgit