summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-11-05 11:06:18 +0200
committerNoel Grandin <noel@peralex.com>2013-11-11 12:58:12 +0200
commit0a9ef5a18e148c7a5c9a088e153a7873d1564841 (patch)
tree3c3bc21e7ee4f836a1d056695175e0b1a91eda26 /connectivity
parent7944301424aac0943e4ecc0410f495b210ad3b79 (diff)
convert OUString 0==compareToAscii to equalsAscii
Convert code like: 0 == aStr.compareToAscii("XXX") to aStr.equalsAscii("XXX") which is both clearer and faster. Change-Id: I2e906d7d38494db38eb292702fadb781b1251e07
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/file/FConnection.cxx8
-rw-r--r--connectivity/source/drivers/mozab/MConnection.cxx24
-rw-r--r--connectivity/source/drivers/odbcbase/OConnection.cxx26
-rw-r--r--connectivity/source/drivers/postgresql/pq_databasemetadata.cxx12
-rw-r--r--connectivity/source/drivers/postgresql/pq_driver.cxx2
5 files changed, 36 insertions, 36 deletions
diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx
index 91beb1414048..3b37bec8c87a 100644
--- a/connectivity/source/drivers/file/FConnection.cxx
+++ b/connectivity/source/drivers/file/FConnection.cxx
@@ -100,9 +100,9 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >&
const PropertyValue *pEnd = pIter + info.getLength();
for(;pIter != pEnd;++pIter)
{
- if(0 == pIter->Name.compareToAscii("Extension"))
+ if( pIter->Name.equalsAscii("Extension"))
OSL_VERIFY( pIter->Value >>= aExt );
- else if(0 == pIter->Name.compareToAscii("CharSet"))
+ else if( pIter->Name.equalsAscii("CharSet"))
{
OUString sIanaName;
OSL_VERIFY( pIter->Value >>= sIanaName );
@@ -114,11 +114,11 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >&
else
m_nTextEncoding = RTL_TEXTENCODING_DONTKNOW;
}
- else if (0 == pIter->Name.compareToAscii("ShowDeleted"))
+ else if( pIter->Name.equalsAscii("ShowDeleted"))
{
OSL_VERIFY( pIter->Value >>= m_bShowDeleted );
}
- else if (0 == pIter->Name.compareToAscii("EnableSQL92Check"))
+ else if( pIter->Name.equalsAscii("EnableSQL92Check"))
{
pIter->Value >>= m_bCheckSQL92;
}
diff --git a/connectivity/source/drivers/mozab/MConnection.cxx b/connectivity/source/drivers/mozab/MConnection.cxx
index 8112a537b748..685c13e84722 100644
--- a/connectivity/source/drivers/mozab/MConnection.cxx
+++ b/connectivity/source/drivers/mozab/MConnection.cxx
@@ -196,21 +196,21 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >&
m_sPassword = OUString( "");
m_bUseSSL = sal_False;
- if ( aAddrbookScheme.compareToAscii( getSdbcScheme( SDBC_MOZILLA ) ) == 0 ) {
+ if ( aAddrbookScheme.equalsAscii( getSdbcScheme( SDBC_MOZILLA ) ) ) {
m_sMozillaURI = OUString::createFromAscii( getSchemeURI( SCHEME_MOZILLA ) );
m_eSDBCAddressType = SDBCAddress::Mozilla;
if(!sAdditionalInfo.isEmpty())
m_sMozillaProfile = sAdditionalInfo;
}
else
- if ( aAddrbookScheme.compareToAscii( getSdbcScheme( SDBC_THUNDERBIRD ) ) == 0 ) {
+ if ( aAddrbookScheme.equalsAscii( getSdbcScheme( SDBC_THUNDERBIRD ) ) ) {
//Yes. I am sure it is SCHEME_MOZILLA
m_sMozillaURI = OUString::createFromAscii( getSchemeURI( SCHEME_MOZILLA ) );
m_eSDBCAddressType = SDBCAddress::ThunderBird;
if(!sAdditionalInfo.isEmpty())
m_sMozillaProfile = sAdditionalInfo;
}
- else if ( aAddrbookScheme.compareToAscii( getSdbcScheme( SDBC_LDAP ) ) == 0 ) {
+ else if ( aAddrbookScheme.equalsAscii( getSdbcScheme( SDBC_LDAP ) ) ) {
OUString sBaseDN;
sal_Int32 nPortNumber = -1;
@@ -243,31 +243,31 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >&
{
OSL_TRACE( "info[%d].Name = %s", pInfo - info.getConstArray(), OUtoCStr( pInfo->Name ) );
- if ( 0 == pInfo->Name.compareToAscii("HostName") )
+ if ( pInfo->Name.equalsAscii("HostName") )
{
pInfo->Value >>= m_sHostName;
}
- else if ( 0 == pInfo->Name.compareToAscii("BaseDN") )
+ else if ( pInfo->Name.equalsAscii("BaseDN") )
{
pInfo->Value >>= sBaseDN;
}
- else if ( 0 == pInfo->Name.compareToAscii("user") )
+ else if ( pInfo->Name.equalsAscii("user") )
{
pInfo->Value >>= m_sBindDN;
}
- else if ( 0 == pInfo->Name.compareToAscii("password") )
+ else if ( pInfo->Name.equalsAscii("password") )
{
pInfo->Value >>= m_sPassword;
}
- else if ( 0 == pInfo->Name.compareToAscii("UseSSL") )
+ else if ( pInfo->Name.equalsAscii("UseSSL") )
{
pInfo->Value >>= m_bUseSSL;
}
- else if ( 0 == pInfo->Name.compareToAscii("PortNumber") )
+ else if ( pInfo->Name.equalsAscii("PortNumber") )
{
OSL_VERIFY( pInfo->Value >>= nPortNumber );
}
- else if ( 0 == pInfo->Name.compareToAscii("MaxRowCount") )
+ else if ( pInfo->Name.equalsAscii("MaxRowCount") )
{
pInfo->Value >>= m_nMaxResultRecords;
}
@@ -295,11 +295,11 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >&
m_sMozillaURI += OUString( "?(or(DisplayName,=,DontDoThisAtHome)))");
}
- else if ( aAddrbookScheme.compareToAscii( getSdbcScheme( SDBC_OUTLOOK_MAPI ) ) == 0 ) {
+ else if ( aAddrbookScheme.equalsAscii( getSdbcScheme( SDBC_OUTLOOK_MAPI ) ) ) {
m_sMozillaURI = OUString::createFromAscii( getSchemeURI( SCHEME_OUTLOOK_MAPI ) );
m_eSDBCAddressType = SDBCAddress::Outlook;
}
- else if ( aAddrbookScheme.compareToAscii( getSdbcScheme( SDBC_OUTLOOK_EXPRESS ) ) == 0 ) {
+ else if ( aAddrbookScheme.equalsAscii( getSdbcScheme( SDBC_OUTLOOK_EXPRESS ) ) ) {
m_sMozillaURI = OUString::createFromAscii( getSchemeURI( SCHEME_OUTLOOK_EXPRESS ) );
m_eSDBCAddressType = SDBCAddress::OutlookExp;
}
diff --git a/connectivity/source/drivers/odbcbase/OConnection.cxx b/connectivity/source/drivers/odbcbase/OConnection.cxx
index 2e09b8287714..0a35a58e849f 100644
--- a/connectivity/source/drivers/odbcbase/OConnection.cxx
+++ b/connectivity/source/drivers/odbcbase/OConnection.cxx
@@ -151,7 +151,7 @@ SQLRETURN OConnection::OpenConnection(const OUString& aConnectStr,sal_Int32 nTim
{
OUString aVal;
OTools::GetInfo(this,m_aConnectionHandle,SQL_DATA_SOURCE_READ_ONLY,aVal,*this,getTextEncoding());
- m_bReadOnly = !aVal.compareToAscii("Y");
+ m_bReadOnly = aVal.equalsAscii("Y");
}
catch(Exception&)
{
@@ -210,49 +210,49 @@ SQLRETURN OConnection::Construct(const OUString& url,const Sequence< PropertyVal
const PropertyValue *pEnd = pBegin + info.getLength();
for(;pBegin != pEnd;++pBegin)
{
- if(!pBegin->Name.compareToAscii(pTimeout))
+ if( pBegin->Name.equalsAscii(pTimeout))
OSL_VERIFY( pBegin->Value >>= nTimeout );
- else if(!pBegin->Name.compareToAscii(pSilent))
+ else if( pBegin->Name.equalsAscii(pSilent))
OSL_VERIFY( pBegin->Value >>= bSilent );
- else if(!pBegin->Name.compareToAscii(pPrivName))
+ else if( pBegin->Name.equalsAscii(pPrivName))
OSL_VERIFY( pBegin->Value >>= m_bIgnoreDriverPrivileges );
- else if(!pBegin->Name.compareToAscii(pVerColName))
+ else if( pBegin->Name.equalsAscii(pVerColName))
OSL_VERIFY( pBegin->Value >>= m_bPreventGetVersionColumns );
- else if(!pBegin->Name.compareToAscii(pParaName))
+ else if( pBegin->Name.equalsAscii(pParaName))
OSL_VERIFY( pBegin->Value >>= m_bParameterSubstitution );
- else if(!pBegin->Name.compareToAscii(pRetrieving))
+ else if( pBegin->Name.equalsAscii(pRetrieving))
{
sal_Bool bAutoRetrievingEnabled = sal_False;
OSL_VERIFY( pBegin->Value >>= bAutoRetrievingEnabled );
enableAutoRetrievingEnabled(bAutoRetrievingEnabled);
}
- else if(!pBegin->Name.compareToAscii(pRetriStmt))
+ else if( pBegin->Name.equalsAscii(pRetriStmt))
{
OUString sGeneratedValueStatement;
OSL_VERIFY( pBegin->Value >>= sGeneratedValueStatement );
setAutoRetrievingStatement(sGeneratedValueStatement);
}
- else if(!pBegin->Name.compareToAscii(pUser))
+ else if( pBegin->Name.equalsAscii(pUser))
{
OSL_VERIFY( pBegin->Value >>= aUID );
aDSN = aDSN + ";UID=" + aUID;
}
- else if(!pBegin->Name.compareToAscii(pPwd))
+ else if( pBegin->Name.equalsAscii(pPwd))
{
OSL_VERIFY( pBegin->Value >>= aPWD );
aDSN = aDSN + ";PWD=" + aPWD;
}
- else if(!pBegin->Name.compareToAscii(pUseCatalog))
+ else if( pBegin->Name.equalsAscii(pUseCatalog))
{
OSL_VERIFY( pBegin->Value >>= m_bUseCatalog );
}
- else if(!pBegin->Name.compareToAscii(pSysDrv))
+ else if( pBegin->Name.equalsAscii(pSysDrv))
{
OSL_VERIFY( pBegin->Value >>= aSysDrvSettings );
aDSN += ";";
aDSN += aSysDrvSettings;
}
- else if(0 == pBegin->Name.compareToAscii(pCharSet))
+ else if( pBegin->Name.equalsAscii(pCharSet))
{
OUString sIanaName;
OSL_VERIFY( pBegin->Value >>= sIanaName );
diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
index 295784fb0f4c..69d764427945 100644
--- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
@@ -1186,9 +1186,9 @@ sal_Bool DatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw (SQLExc
row[1] <<= xRow->getString( 1 );
row[2] <<= xRow->getString( 2 );
OUString type = xRow->getString(3);
- if( 0 == type.compareToAscii( "r" ) )
+ if( type.equalsAscii( "r" ) )
{
- if( 0 == xRow->getString(1).compareToAscii( "pg_catalog" ) )
+ if( xRow->getString(1).equalsAscii( "pg_catalog" ) )
{
row[3] <<= statics.SYSTEM_TABLE;
}
@@ -1197,7 +1197,7 @@ sal_Bool DatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw (SQLExc
row[3] <<= statics.TABLE;
}
}
- else if( 0 == type.compareToAscii( "v" ) )
+ else if( type.equalsAscii( "v" ) )
{
row[3] <<= statics.VIEW;
}
@@ -1324,7 +1324,7 @@ sal_Int32 typeNameToDataType( const OUString &typeName, const OUString &typtype
// string representation. Additionally, the edit-table-type-selection-box
// is not so unuseable anymore.
sal_Int32 ret = com::sun::star::sdbc::DataType::LONGVARCHAR;
- if( 0 == typtype.compareToAscii( "b" ) )
+ if( typtype.equalsAscii( "b" ) )
{
// as long as the OOo framework does not support arrays,
// the user is better of with interpreting arrays as strings !
@@ -1342,11 +1342,11 @@ sal_Int32 typeNameToDataType( const OUString &typeName, const OUString &typtype
ret = ii->second;
}
}
- else if( 0 == typtype.compareToAscii( "c" ) )
+ else if( typtype.equalsAscii( "c" ) )
{
ret = com::sun::star::sdbc::DataType::STRUCT;
}
- else if( 0 == typtype.compareToAscii( "d" ) )
+ else if( typtype.equalsAscii( "d" ) )
{
ret = com::sun::star::sdbc::DataType::LONGVARCHAR;
}
diff --git a/connectivity/source/drivers/postgresql/pq_driver.cxx b/connectivity/source/drivers/postgresql/pq_driver.cxx
index 98206bed7ae3..5f1fedb72e36 100644
--- a/connectivity/source/drivers/postgresql/pq_driver.cxx
+++ b/connectivity/source/drivers/postgresql/pq_driver.cxx
@@ -329,7 +329,7 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL postgresql_sdbc_component_getFactory(
for( sal_Int32 i = 0 ; g_entries[i].create ; i ++ )
{
OUString implName = g_entries[i].getImplementationName();
- if( 0 == implName.compareToAscii( pImplName ) )
+ if( implName.equalsAscii( pImplName ) )
{
Reference< XComponentContext > defaultContext(
comphelper::getComponentContext( xSmgr ) );