summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-10-23 13:29:32 +0200
committerNoel Grandin <noel@peralex.com>2013-11-04 08:06:10 +0200
commit0e6a2601b39cbadaff7f7506ba9e804f108060db (patch)
treeffd6bb4970f689d20087b721eb8dfd4bc86cd53f /ucb
parent457b349edbaf6d9dc747f3a631fee70e0c035bae (diff)
Convert code that calls OUString::getStr()[] to use the [] operator
This also means that this code now gets bounds checked in debug builds. Change-Id: Id777f85eaee6a737bbcb84625e6e110abe0e0f27
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/core/ucb.cxx2
-rw-r--r--ucb/source/core/ucbstore.cxx2
-rw-r--r--ucb/source/ucp/ext/ucpext_content.cxx6
-rw-r--r--ucb/source/ucp/ext/ucpext_datasupplier.cxx4
-rw-r--r--ucb/source/ucp/file/shell.cxx6
-rw-r--r--ucb/source/ucp/hierarchy/hierarchydata.cxx2
-rw-r--r--ucb/source/ucp/hierarchy/hierarchyuri.cxx6
-rw-r--r--ucb/source/ucp/package/pkguri.cxx12
-rw-r--r--ucb/source/ucp/tdoc/tdoc_content.cxx4
-rw-r--r--ucb/source/ucp/tdoc/tdoc_storage.cxx2
-rw-r--r--ucb/source/ucp/tdoc/tdoc_uri.cxx6
-rw-r--r--ucb/source/ucp/webdav-neon/ContentProperties.cxx3
-rw-r--r--ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx7
-rw-r--r--ucb/source/ucp/webdav-neon/webdavprovider.cxx4
-rw-r--r--ucb/source/ucp/webdav/ContentProperties.cxx3
-rw-r--r--ucb/source/ucp/webdav/webdavdatasupplier.cxx7
-rw-r--r--ucb/source/ucp/webdav/webdavprovider.cxx4
17 files changed, 30 insertions, 50 deletions
diff --git a/ucb/source/core/ucb.cxx b/ucb/source/core/ucb.cxx
index 45cdb42e1028..3d0e7d77e718 100644
--- a/ucb/source/core/ucb.cxx
+++ b/ucb/source/core/ucb.cxx
@@ -138,7 +138,7 @@ void makeAndAppendXMLName(
sal_Int32 nCount = rIn.getLength();
for ( sal_Int32 n = 0; n < nCount; ++n )
{
- const sal_Unicode c = rIn.getStr()[ n ];
+ const sal_Unicode c = rIn[ n ];
switch ( c )
{
case '&':
diff --git a/ucb/source/core/ucbstore.cxx b/ucb/source/core/ucbstore.cxx
index ee7030c15ff5..73b28354a93d 100644
--- a/ucb/source/core/ucbstore.cxx
+++ b/ucb/source/core/ucbstore.cxx
@@ -58,7 +58,7 @@ OUString makeHierarchalNameSegment( const OUString & rIn )
sal_Int32 nCount = rIn.getLength();
for ( sal_Int32 n = 0; n < nCount; ++n )
{
- const sal_Unicode c = rIn.getStr()[ n ];
+ const sal_Unicode c = rIn[ n ];
switch ( c )
{
case '&':
diff --git a/ucb/source/ucp/ext/ucpext_content.cxx b/ucb/source/ucp/ext/ucpext_content.cxx
index 4ce4bf641021..37cbddf1c309 100644
--- a/ucb/source/ucp/ext/ucpext_content.cxx
+++ b/ucb/source/ucp/ext/ucpext_content.cxx
@@ -106,8 +106,8 @@ namespace ucb { namespace ucp { namespace ext
ENSURE_OR_RETURN( !i_rBaseURL.isEmpty(), "illegal base URL", i_rRelativeURL );
OUStringBuffer aComposer( i_rBaseURL );
- if ( i_rBaseURL.getStr()[ i_rBaseURL.getLength() - 1 ] != '/' )
- aComposer.append( sal_Unicode( '/' ) );
+ if ( !i_rBaseURL.endsWith("/") )
+ aComposer.append( '/' );
aComposer.append( i_rRelativeURL );
return aComposer.makeStringAndClear();
}
@@ -368,7 +368,7 @@ namespace ucb { namespace ucp { namespace ext
break;
}
- if ( sRelativeURL.getStr()[ sRelativeURL.getLength() - 1 ] == '/' )
+ if ( sRelativeURL.endsWith("/") )
sRelativeURL = sRelativeURL.copy( 0, sRelativeURL.getLength() - 1 );
// remove the last segment
diff --git a/ucb/source/ucp/ext/ucpext_datasupplier.cxx b/ucb/source/ucp/ext/ucpext_datasupplier.cxx
index 20a73c80ae47..57704ff666b7 100644
--- a/ucb/source/ucp/ext/ucpext_datasupplier.cxx
+++ b/ucb/source/ucp/ext/ucpext_datasupplier.cxx
@@ -113,8 +113,8 @@ namespace ucb { namespace ucp { namespace ext
ENSURE_OR_RETURN( !i_rBaseURL.isEmpty(), "illegal base URL", i_rRelativeURL );
OUStringBuffer aComposer( i_rBaseURL );
- if ( i_rBaseURL.getStr()[ i_rBaseURL.getLength() - 1 ] != '/' )
- aComposer.append( sal_Unicode( '/' ) );
+ if ( !i_rBaseURL.endsWith("/") )
+ aComposer.append( '/' );
aComposer.append( i_rRelativeURL );
return aComposer.makeStringAndClear();
}
diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx
index a9cd7e44ad81..538e013bf1ac 100644
--- a/ucb/source/ucp/file/shell.cxx
+++ b/ucb/source/ucp/file/shell.cxx
@@ -1967,9 +1967,9 @@ sal_Bool SAL_CALL shell::getUnqFromUrl( const OUString& Url,OUString& Unq )
Unq = Url;
sal_Int32 l = Unq.getLength()-1;
- if( ! err && Unq.getStr()[ l ] == '/' &&
- Unq.indexOf( '/', RTL_CONSTASCII_LENGTH("//") ) < l )
- Unq = Unq.copy(0, Unq.getLength() - 1);
+ if( ! err && Unq.endsWith("/") &&
+ Unq.indexOf( '/', RTL_CONSTASCII_LENGTH("//") ) != -1 )
+ Unq = Unq.copy(0, l);
return err;
}
diff --git a/ucb/source/ucp/hierarchy/hierarchydata.cxx b/ucb/source/ucp/hierarchy/hierarchydata.cxx
index 05eb221b2ccb..25cfffe77061 100644
--- a/ucb/source/ucp/hierarchy/hierarchydata.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchydata.cxx
@@ -63,7 +63,7 @@ void makeXMLName( const OUString & rIn, OUStringBuffer & rBuffer )
sal_Int32 nCount = rIn.getLength();
for ( sal_Int32 n = 0; n < nCount; ++n )
{
- const sal_Unicode c = rIn.getStr()[ n ];
+ const sal_Unicode c = rIn[ n ];
switch ( c )
{
case '&':
diff --git a/ucb/source/ucp/hierarchy/hierarchyuri.cxx b/ucb/source/ucp/hierarchy/hierarchyuri.cxx
index 23e5d0d316d8..fdbf1a7b957d 100644
--- a/ucb/source/ucp/hierarchy/hierarchyuri.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchyuri.cxx
@@ -82,8 +82,7 @@ void HierarchyUri::init() const
}
else if ( ( m_aUri.getLength() == HIERARCHY_URL_SCHEME_LENGTH + 2 )
&&
- ( m_aUri.getStr()[ HIERARCHY_URL_SCHEME_LENGTH + 1 ]
- == sal_Unicode( '/' ) ) )
+ ( m_aUri[ HIERARCHY_URL_SCHEME_LENGTH + 1 ] == '/' ) )
{
// root folder URI without service specifier.
m_aUri += OUString( "/" DEFAULT_DATA_SOURCE_SERVICE "/" );
@@ -93,8 +92,7 @@ void HierarchyUri::init() const
}
else if ( ( m_aUri.getLength() > HIERARCHY_URL_SCHEME_LENGTH + 2 )
&&
- ( m_aUri.getStr()[ HIERARCHY_URL_SCHEME_LENGTH + 2 ]
- != sal_Unicode( '/' ) ) )
+ ( m_aUri[ HIERARCHY_URL_SCHEME_LENGTH + 2 ] != '/' ) )
{
// other (no root folder) URI without service specifier.
m_aUri = m_aUri.replaceAt(
diff --git a/ucb/source/ucp/package/pkguri.cxx b/ucb/source/ucp/package/pkguri.cxx
index 29e9cd61c404..62300681b218 100644
--- a/ucb/source/ucp/package/pkguri.cxx
+++ b/ucb/source/ucp/package/pkguri.cxx
@@ -81,14 +81,11 @@ void PackageUri::init() const
}
// Scheme must be followed by '://'
- if ( ( m_aUri.getStr()[ PACKAGE_URL_SCHEME_LENGTH ]
- != sal_Unicode( ':' ) )
+ if ( ( m_aUri[ PACKAGE_URL_SCHEME_LENGTH ] != ':' )
||
- ( m_aUri.getStr()[ PACKAGE_URL_SCHEME_LENGTH + 1 ]
- != sal_Unicode( '/' ) )
+ ( m_aUri[ PACKAGE_URL_SCHEME_LENGTH + 1 ] != '/' )
||
- ( m_aUri.getStr()[ PACKAGE_URL_SCHEME_LENGTH + 2 ]
- != sal_Unicode( '/' ) ) )
+ ( m_aUri[ PACKAGE_URL_SCHEME_LENGTH + 2 ] != '/' ) )
{
// error, but remember that we did a init().
m_aPath = OUString( "/" );
@@ -135,8 +132,7 @@ void PackageUri::init() const
}
else if ( nEnd == ( aPureUri.getLength() - 1 ) )
{
- if ( aPureUri.getStr()[ aPureUri.getLength() - 2 ]
- == sal_Unicode( '/' ) )
+ if ( aPureUri[ aPureUri.getLength() - 2 ] == '/' )
{
// Only <scheme>://// or <scheme>://<something>//
diff --git a/ucb/source/ucp/tdoc/tdoc_content.cxx b/ucb/source/ucp/tdoc/tdoc_content.cxx
index a445ccd5ef2d..9f7c6e24fc46 100644
--- a/ucb/source/ucp/tdoc/tdoc_content.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_content.cxx
@@ -1835,9 +1835,9 @@ Content::queryChildContent( const OUString & rRelativeChildUri )
const OUString aMyId = getIdentifier()->getContentIdentifier();
OUStringBuffer aBuf( aMyId );
- if ( aMyId.getStr()[ aMyId.getLength() - 1 ] != sal_Unicode( '/' ) )
+ if ( !aMyId.endsWith("/") )
aBuf.appendAscii( "/" );
- if ( rRelativeChildUri.getStr()[ 0 ] != sal_Unicode( '/' ) )
+ if ( !rRelativeChildUri.startsWith("/") )
aBuf.append( rRelativeChildUri );
else
aBuf.append( rRelativeChildUri.copy( 1 ) );
diff --git a/ucb/source/ucp/tdoc/tdoc_storage.cxx b/ucb/source/ucp/tdoc/tdoc_storage.cxx
index 7f250371e59a..916ccf81c8aa 100644
--- a/ucb/source/ucp/tdoc/tdoc_storage.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_storage.cxx
@@ -114,7 +114,7 @@ StorageElementFactory::createStorage( const OUString & rUri,
}
OUString aUriKey
- ( ( rUri.getStr()[ rUri.getLength() - 1 ] == sal_Unicode( '/' ) )
+ ( rUri.endsWith("/")
? rUri.copy( 0, rUri.getLength() - 1 )
: rUri );
diff --git a/ucb/source/ucp/tdoc/tdoc_uri.cxx b/ucb/source/ucp/tdoc/tdoc_uri.cxx
index 037d4d937cb2..24110bf8d755 100644
--- a/ucb/source/ucp/tdoc/tdoc_uri.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_uri.cxx
@@ -65,15 +65,13 @@ void Uri::init() const
// Remember normalized scheme string.
m_aUri = m_aUri.replaceAt( 0, aScheme.getLength(), aScheme );
- if ( m_aUri.getStr()[ TDOC_URL_SCHEME_LENGTH ]
- != sal_Unicode( ':' ) )
+ if ( m_aUri[ TDOC_URL_SCHEME_LENGTH ] != ':' )
{
// Invaild (no ':' after <scheme>).
return;
}
- if ( m_aUri.getStr()[ TDOC_URL_SCHEME_LENGTH + 1 ]
- != sal_Unicode( '/' ) )
+ if ( m_aUri[ TDOC_URL_SCHEME_LENGTH + 1 ] != '/' )
{
// Invaild (no '/' after <scheme>:).
return;
diff --git a/ucb/source/ucp/webdav-neon/ContentProperties.cxx b/ucb/source/ucp/webdav-neon/ContentProperties.cxx
index 1439e0c7dc4d..b19cd24c19be 100644
--- a/ucb/source/ucp/webdav-neon/ContentProperties.cxx
+++ b/ucb/source/ucp/webdav-neon/ContentProperties.cxx
@@ -128,8 +128,7 @@ ContentProperties::ContentProperties( const DAVResource& rResource )
++it;
}
- if ( rResource.uri.getStr()[ rResource.uri.getLength() - 1 ]
- == sal_Unicode( '/' ) )
+ if ( rResource.uri.endsWith("/") )
m_bTrailingSlash = sal_True;
}
diff --git a/ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx b/ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx
index e84faf900146..64da40979533 100644
--- a/ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx
@@ -392,8 +392,7 @@ sal_Bool DataSupplier::getData()
m_pImpl->m_xContent->getResourceAccess().getURL() );
OUString aPath = aURI.GetPath();
- if ( aPath.getStr()[ aPath.getLength() - 1 ]
- == sal_Unicode( '/' ) )
+ if ( aPath.endsWith("/") )
aPath = aPath.copy( 0, aPath.getLength() - 1 );
aPath = NeonUri::unescape( aPath );
@@ -411,9 +410,7 @@ sal_Bool DataSupplier::getData()
{
NeonUri aCurrURI( rRes.uri );
OUString aCurrPath = aCurrURI.GetPath();
- if ( aCurrPath.getStr()[
- aCurrPath.getLength() - 1 ]
- == sal_Unicode( '/' ) )
+ if ( aCurrPath.endsWith("/") )
aCurrPath
= aCurrPath.copy(
0,
diff --git a/ucb/source/ucp/webdav-neon/webdavprovider.cxx b/ucb/source/ucp/webdav-neon/webdavprovider.cxx
index 389b0c5d466f..616d1bd664e6 100644
--- a/ucb/source/ucp/webdav-neon/webdavprovider.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavprovider.cxx
@@ -134,9 +134,7 @@ ContentProvider::queryContent(
if ( aURL.getLength() < ( aScheme.getLength() + 3 ) )
throw ucb::IllegalIdentifierException();
- if ( ( aURL.getStr()[ aScheme.getLength() ] != sal_Unicode( ':' ) ) ||
- ( aURL.getStr()[ aScheme.getLength() + 1 ] != sal_Unicode( '/' ) ) ||
- ( aURL.getStr()[ aScheme.getLength() + 2 ] != sal_Unicode( '/' ) ) )
+ if ( aURL.copy( aScheme.getLength(), 3 ) != "://" )
throw ucb::IllegalIdentifierException();
uno::Reference< ucb::XContentIdentifier > xCanonicId;
diff --git a/ucb/source/ucp/webdav/ContentProperties.cxx b/ucb/source/ucp/webdav/ContentProperties.cxx
index a1e78288cd56..e8416a212586 100644
--- a/ucb/source/ucp/webdav/ContentProperties.cxx
+++ b/ucb/source/ucp/webdav/ContentProperties.cxx
@@ -112,8 +112,7 @@ ContentProperties::ContentProperties( const DAVResource& rResource )
++it;
}
- if ( rResource.uri.getStr()[ rResource.uri.getLength() - 1 ]
- == sal_Unicode( '/' ) )
+ if ( rResource.uri.endsWith("/") )
m_bTrailingSlash = sal_True;
}
diff --git a/ucb/source/ucp/webdav/webdavdatasupplier.cxx b/ucb/source/ucp/webdav/webdavdatasupplier.cxx
index a50bb7e312bf..6834734f0e5a 100644
--- a/ucb/source/ucp/webdav/webdavdatasupplier.cxx
+++ b/ucb/source/ucp/webdav/webdavdatasupplier.cxx
@@ -391,8 +391,7 @@ sal_Bool DataSupplier::getData()
m_pImpl->m_xContent->getResourceAccess().getURL() );
OUString aPath = aURI.GetPath();
- if ( aPath.getStr()[ aPath.getLength() - 1 ]
- == sal_Unicode( '/' ) )
+ if ( aPath.endsWith("/") )
aPath = aPath.copy( 0, aPath.getLength() - 1 );
aPath = SerfUri::unescape( aPath );
@@ -410,9 +409,7 @@ sal_Bool DataSupplier::getData()
{
SerfUri aCurrURI( rRes.uri );
OUString aCurrPath = aCurrURI.GetPath();
- if ( aCurrPath.getStr()[
- aCurrPath.getLength() - 1 ]
- == sal_Unicode( '/' ) )
+ if ( aCurrPath.endsWith("/") )
aCurrPath
= aCurrPath.copy(
0,
diff --git a/ucb/source/ucp/webdav/webdavprovider.cxx b/ucb/source/ucp/webdav/webdavprovider.cxx
index b782b048f941..cb2dc41232fe 100644
--- a/ucb/source/ucp/webdav/webdavprovider.cxx
+++ b/ucb/source/ucp/webdav/webdavprovider.cxx
@@ -197,9 +197,7 @@ ContentProvider::queryContent(
if ( aURL.getLength() < ( aScheme.getLength() + 3 ) )
throw ucb::IllegalIdentifierException();
- if ( ( aURL.getStr()[ aScheme.getLength() ] != sal_Unicode( ':' ) ) ||
- ( aURL.getStr()[ aScheme.getLength() + 1 ] != sal_Unicode( '/' ) ) ||
- ( aURL.getStr()[ aScheme.getLength() + 2 ] != sal_Unicode( '/' ) ) )
+ if ( aURL.copy( aScheme.getLength(), 3 ) != "://" )
throw ucb::IllegalIdentifierException();
uno::Reference< ucb::XContentIdentifier > xCanonicId;