diff options
author | Noel Grandin <noel@peralex.com> | 2013-10-23 13:29:32 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-11-04 08:06:10 +0200 |
commit | 0e6a2601b39cbadaff7f7506ba9e804f108060db (patch) | |
tree | ffd6bb4970f689d20087b721eb8dfd4bc86cd53f /connectivity | |
parent | 457b349edbaf6d9dc747f3a631fee70e0c035bae (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 'connectivity')
5 files changed, 8 insertions, 10 deletions
diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx index 82d170266684..f27bc142da55 100644 --- a/connectivity/source/commontools/predicateinput.cxx +++ b/connectivity/source/commontools/predicateinput.cxx @@ -67,7 +67,7 @@ namespace dbtools sal_Unicode nReturn( _nFallback ); if ( !_rSeparator.isEmpty() ) - nReturn = static_cast< sal_Char >( _rSeparator.getStr()[0] ); + nReturn = static_cast< sal_Char >( _rSeparator[0] ); return nReturn; } @@ -150,8 +150,8 @@ namespace dbtools { // yes -> force a quoted text and try again OUString sQuoted( _rStatement ); if ( !sQuoted.isEmpty() - && ( (sQuoted.getStr()[0] != '\'') - || (sQuoted.getStr()[ sQuoted.getLength() - 1 ] != '\'' ) + && ( !sQuoted.startsWith("'") + || !sQuoted.endsWith("'") ) ) { @@ -296,9 +296,7 @@ namespace dbtools // '-characters to the text. If we would give this to predicateTree this would add // two additional '-characters which we don't want. So check the field format. // FS - 06.01.00 - 71532 - sal_Bool bValidQuotedText = ( sValue.getLength() >= 2 ) - && ( sValue.getStr()[0] == '\'' ) - && ( sValue.getStr()[ sValue.getLength() - 1 ] == '\'' ); + sal_Bool bValidQuotedText = sValue.startsWith("'") && sValue.endsWith("'"); // again : as normalizePredicateString always did a conversion on the value text, // bValidQuotedText == sal_True implies that we have a text field, as no other field // values will be formatted with the quote characters diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx index 3e26231dc936..a70e58814d20 100644 --- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx +++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx @@ -290,7 +290,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( { if (aURL.getExtension().isEmpty()) { - sal_Unicode nChar = aURL.getBase().getStr()[0]; + sal_Unicode nChar = aURL.getBase()[0]; if(match(tableNamePattern,aURL.getBase(),'\0') && ( !bCheckEnabled || ( bCheckEnabled && ((nChar < '0' || nChar > '9')))) ) { aRow.push_back(new ORowSetValueDecorator(OUString(aURL.getBase()))); diff --git a/connectivity/source/drivers/file/FStringFunctions.cxx b/connectivity/source/drivers/file/FStringFunctions.cxx index acac9ac82a93..a5cf7ce486ce 100644 --- a/connectivity/source/drivers/file/FStringFunctions.cxx +++ b/connectivity/source/drivers/file/FStringFunctions.cxx @@ -160,7 +160,7 @@ ORowSetValue OOp_RTrim::operate(const ORowSetValue& lhs) const OUString sRet = lhs; OUString sNew = sRet.trim(); - return sRet.copy(0,sRet.lastIndexOf(sNew.getStr()[sNew.getLength()-1])+1); + return sRet.copy(0,sRet.lastIndexOf(sNew[sNew.getLength()-1])+1); } //------------------------------------------------------------------ ORowSetValue OOp_Space::operate(const ORowSetValue& lhs) const diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx index d4c9ea1a5494..295784fb0f4c 100644 --- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx +++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx @@ -1807,7 +1807,7 @@ static void columnMetaData2DatabaseTypeDescription( i++; int start = i; while( array[i] && array[i] != '}' && array[i] != ',' ) i++; - row[3] <<= OUString( &array.getStr()[start], i - start ); + row[3] <<= array.copy(start, i - start ); vec.push_back( row ); } } diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx index 79f383cd027f..ed7e514073c8 100644 --- a/connectivity/source/drivers/postgresql/pq_tools.cxx +++ b/connectivity/source/drivers/postgresql/pq_tools.cxx @@ -363,7 +363,7 @@ OUString extractTableFromInsert( const OUString & sql ) } } } - ret = OUString( &sql.getStr()[start], i - start ).trim(); + ret = sql.copy(start, i - start ).trim(); // printf( "pq_statement: parsed table name %s from insert\n" , // OUStringToOString( ret, RTL_TEXTENCODING_ASCII_US).getStr() ); } |