diff options
author | Herbert Dürr <hdu@apache.org> | 2013-11-28 15:52:32 +0000 |
---|---|---|
committer | Herbert Dürr <hdu@apache.org> | 2013-11-28 15:52:32 +0000 |
commit | 1a15756db5173403fcdbc3ad522c3a76e88a7082 (patch) | |
tree | 915c55a6ea8920d9bf44229129cdfcd2679a3914 /connectivity | |
parent | b8354e209b88f3375635f20542096ed1dac24ba8 (diff) |
#i123068# remove implicit conversions from rtl strings to their elements
Notes
Notes:
prefer: 112bdf84d684590e042725c7173e059b4afa2f83
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/inc/connectivity/CommonTools.hxx | 4 | ||||
-rw-r--r-- | connectivity/source/commontools/CommonTools.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/adabas/BConnection.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/drivers/adabas/BDriver.cxx | 67 | ||||
-rw-r--r-- | connectivity/source/drivers/jdbc/Class.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx | 18 | ||||
-rw-r--r-- | connectivity/source/parse/sqlflex.l | 2 | ||||
-rw-r--r-- | connectivity/source/parse/sqlnode.cxx | 6 |
8 files changed, 56 insertions, 49 deletions
diff --git a/connectivity/inc/connectivity/CommonTools.hxx b/connectivity/inc/connectivity/CommonTools.hxx index 75e2967b1582..749646c364fd 100644 --- a/connectivity/inc/connectivity/CommonTools.hxx +++ b/connectivity/inc/connectivity/CommonTools.hxx @@ -49,6 +49,10 @@ namespace connectivity { //------------------------------------------------------------------------------ OOO_DLLPUBLIC_DBTOOLS sal_Bool match(const sal_Unicode* pWild, const sal_Unicode* pStr, const sal_Unicode cEscape); + inline sal_Bool match( const rtl::OUString& rWild, const sal_Unicode* pStr, sal_Unicode cEscape) + { return match( rWild.getStr(), pStr, cEscape); } + inline sal_Bool match( const rtl::OUString& rWild, const rtl::OUString& rStr, sal_Unicode cEscape) + { return match( rWild, rStr.getStr(), cEscape); } //------------------------------------------------------------------------------ OOO_DLLPUBLIC_DBTOOLS rtl::OUString toString(const ::com::sun::star::uno::Any& rValue); OOO_DLLPUBLIC_DBTOOLS rtl::OUString toDateString(const ::com::sun::star::util::Date& rDate); diff --git a/connectivity/source/commontools/CommonTools.cxx b/connectivity/source/commontools/CommonTools.cxx index d3e65f7742db..63253d518506 100644 --- a/connectivity/source/commontools/CommonTools.cxx +++ b/connectivity/source/commontools/CommonTools.cxx @@ -280,7 +280,7 @@ namespace connectivity { ::rtl::OString sClassName = ::rtl::OUStringToOString(_sClassName, RTL_TEXTENCODING_ASCII_US); sClassName = sClassName.replace('.','/'); - jobject out = pEnv->FindClass(sClassName); + jobject out = pEnv->FindClass( sClassName.getStr()); bRet = out != NULL; pEnv->DeleteLocalRef( out ); } diff --git a/connectivity/source/drivers/adabas/BConnection.cxx b/connectivity/source/drivers/adabas/BConnection.cxx index 7bc32c961627..c1ced8dd8060 100644 --- a/connectivity/source/drivers/adabas/BConnection.cxx +++ b/connectivity/source/drivers/adabas/BConnection.cxx @@ -108,8 +108,8 @@ SQLRETURN OAdabasConnection::Construct( const ::rtl::OUString& url,const Sequenc } m_sUser = aUID; - if ( sHostName.getLength() ) - aDSN = sHostName + ':' + aDSN; + if( !sHostName.isEmpty() ) + aDSN = sHostName + ::rtl::OUString::createFromAscii(":") + aDSN; SQLRETURN nSQLRETURN = openConnectionWithAuth(aDSN,nTimeout, aUID,aPWD); return nSQLRETURN; diff --git a/connectivity/source/drivers/adabas/BDriver.cxx b/connectivity/source/drivers/adabas/BDriver.cxx index ad2dd125ee61..985a46410d8b 100644 --- a/connectivity/source/drivers/adabas/BDriver.cxx +++ b/connectivity/source/drivers/adabas/BDriver.cxx @@ -44,6 +44,9 @@ #include <memory> #include <sys/stat.h> +inline SvStream& operator<<( SvStream& s, const rtl::OString r) { return (s << r.getStr()); } +inline SvStream& operator<<( SvStream& s, const rtl::OUString r) { return (s << ::rtl::OUStringToOString(r,gsl_getSystemTextEncoding())); } + #if defined(UNX) const char sNewLine = '\012'; #else @@ -959,7 +962,7 @@ void ODriver::createDb( const TDatabaseStruct& _aInfo) { ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(aInitFile.GetURL(),STREAM_WRITE) ); (*pFileStream) << "ALTER USER \"" - << ::rtl::OString(_aInfo.sSysUser,_aInfo.sSysUser.getLength(),gsl_getSystemTextEncoding()) + << _aInfo.sSysUser << "\" NOT EXCLUSIVE " << sNewLine; pFileStream->Flush(); @@ -989,13 +992,13 @@ int ODriver::X_PARAM(const ::rtl::OUString& _DBNAME, << ".exe" #endif << " -d " - << ::rtl::OString(_DBNAME,_DBNAME.getLength(),gsl_getSystemTextEncoding()) + << _DBNAME << " -u " - << ::rtl::OString(_USR,_USR.getLength(),gsl_getSystemTextEncoding()) + << _USR << "," - << ::rtl::OString(_PWD,_PWD.getLength(),gsl_getSystemTextEncoding()) + << _PWD << " " - << ::rtl::OString(_CMD,_CMD.getLength(),gsl_getSystemTextEncoding()) + << _CMD #if defined(WNT) #if (OSL_DEBUG_LEVEL > 1) || defined(DBG_UTIL) << " >> %DBWORK%\\create.log 2>&1" @@ -1197,15 +1200,15 @@ void ODriver::XUTIL(const ::rtl::OUString& _rParam, "utility" #endif << " -u " - << ::rtl::OString(_USRNAME,_USRNAME.getLength(),gsl_getSystemTextEncoding()) + << _USRNAME << "," - << ::rtl::OString(_USRPWD,_USRPWD.getLength(),gsl_getSystemTextEncoding()) + << _USRPWD << " -d " - << ::rtl::OString(_DBNAME,_DBNAME.getLength(),gsl_getSystemTextEncoding()) + << _DBNAME << " " - << ::rtl::OString(_rParam,_rParam.getLength(),gsl_getSystemTextEncoding()) + << _rParam << " > " - << ::rtl::OString(sPhysicalPath.GetBuffer(),sPhysicalPath.Len(),gsl_getSystemTextEncoding()) + << sPhysicalPath << " 2>&1" << sNewLine; pFileStream->Flush(); @@ -1248,20 +1251,20 @@ void ODriver::LoadBatch(const ::rtl::OUString& sDBName, << ".exe" #endif << " -d " - << ::rtl::OString(sDBName,sDBName.getLength(),gsl_getSystemTextEncoding()) + << sDBName << " -u " - << ::rtl::OString(_rUSR,_rUSR.getLength(),gsl_getSystemTextEncoding()) + << _rUSR << "," - << ::rtl::OString(_rPWD,_rPWD.getLength(),gsl_getSystemTextEncoding()); + << _rPWD; if ( !isKernelVersion(CURRENT_DB_VERSION) ) (*pFileStream) << " -S adabas -b "; else (*pFileStream) << " -S NATIVE -b "; - (*pFileStream) << ::rtl::OString(_rBatch,_rBatch.getLength(),gsl_getSystemTextEncoding()) + (*pFileStream) << _rBatch << " > " - << ::rtl::OString(sPhysicalPath.GetBuffer(),sPhysicalPath.Len(),gsl_getSystemTextEncoding()) + << sPhysicalPath << " 2>&1" << sNewLine; @@ -1378,7 +1381,7 @@ void ODriver::fillEnvironmentVariables() { String sTemp; LocalFileHelper::ConvertURLToPhysicalName(_aDBInfo.sSysDevSpace,sTemp); - (*pFileStream) << ::rtl::OString(sTemp.GetBuffer(),sTemp.Len(),gsl_getSystemTextEncoding()); + (*pFileStream) << sTemp; } (*pFileStream) << "\n* log devspace size:\n"; (*pFileStream) << ::rtl::OString::valueOf(_aDBInfo.nLogSize); @@ -1386,7 +1389,7 @@ void ODriver::fillEnvironmentVariables() { String sTemp; LocalFileHelper::ConvertURLToPhysicalName(_aDBInfo.sTransLogName,sTemp); - (*pFileStream) << ::rtl::OString(sTemp.GetBuffer(),sTemp.Len(),gsl_getSystemTextEncoding()); + (*pFileStream) << sTemp; } (*pFileStream) << "\n* data devspace size:\n"; (*pFileStream) << ::rtl::OString::valueOf(_aDBInfo.nDataSize); @@ -1394,7 +1397,7 @@ void ODriver::fillEnvironmentVariables() { String sTemp; LocalFileHelper::ConvertURLToPhysicalName(_aDBInfo.sDataDevName,sTemp); - (*pFileStream) << ::rtl::OString(sTemp.GetBuffer(),sTemp.Len(),gsl_getSystemTextEncoding()); + (*pFileStream) << sTemp; } (*pFileStream) << "\n* END INIT CONFIG\n"; @@ -1405,7 +1408,7 @@ void ODriver::fillEnvironmentVariables() { String sTemp; LocalFileHelper::ConvertURLToPhysicalName(_aDBInfo.sBackupFile,sTemp); - (*pFileStream) << ::rtl::OString(sTemp.GetBuffer(),sTemp.Len(),gsl_getSystemTextEncoding()); + (*pFileStream) << sTemp; } (*pFileStream) << "' BLOCKSIZE 8\n"; (*pFileStream) << "if $rc <> 0 then stop\n"; @@ -1415,9 +1418,9 @@ void ODriver::fillEnvironmentVariables() else { (*pFileStream) << "ACTIVATE SERVERDB SYSDBA \""; - (*pFileStream) << ::rtl::OString(_aDBInfo.sSysUser,_aDBInfo.sSysUser.getLength(),gsl_getSystemTextEncoding()); + (*pFileStream) << _aDBInfo.sSysUser; (*pFileStream) << "\" PASSWORD \""; - (*pFileStream) << ::rtl::OString(_aDBInfo.sSysPassword,_aDBInfo.sSysPassword.getLength(),gsl_getSystemTextEncoding()); + (*pFileStream) << _aDBInfo.sSysPassword; (*pFileStream) << "\"\n"; } (*pFileStream) << "if $rc <> 0 then stop\n"; @@ -1441,11 +1444,11 @@ void ODriver::X_CONS(const ::rtl::OUString& sDBName,const ::rtl::OString& _ACTIO << ".exe" #endif << " " - << ::rtl::OString(sDBName,sDBName.getLength(),gsl_getSystemTextEncoding()) + << sDBName << " SHOW " << _ACTION << " > " - << ::rtl::OString(sPhysicalPath.GetBuffer(),sPhysicalPath.Len(),gsl_getSystemTextEncoding()) + << sPhysicalPath << sNewLine; pFileStream->Flush(); } @@ -1524,9 +1527,9 @@ sal_Bool ODriver::isVersion(const ::rtl::OUString& sDBName, const char* _pVersio << ".exe" #endif << " " - << ::rtl::OString(sDBName,sDBName.getLength(),gsl_getSystemTextEncoding()) + << sDBName << " KERNELVERSION > " - << ::rtl::OString(sPhysicalPath.GetBuffer(),sPhysicalPath.Len(),gsl_getSystemTextEncoding()) + << sPhysicalPath << sNewLine; } @@ -1574,9 +1577,9 @@ void ODriver::checkAndInsertNewDevSpace(const ::rtl::OUString& sDBName, << ".exe" #endif << " " - << ::rtl::OString(sDBName,sDBName.getLength(),gsl_getSystemTextEncoding()) + << sDBName << " DATA_CACHE_PAGES > " - << ::rtl::OString(sPhysicalPath.GetBuffer(),sPhysicalPath.Len(),gsl_getSystemTextEncoding()) + << sPhysicalPath << sNewLine; } @@ -1621,7 +1624,7 @@ sal_Bool ODriver::isKernelVersion(const char* _pVersion) (*pFileStream) << "dbversion" << " > " - << ::rtl::OString(sPhysicalPath.GetBuffer(),sPhysicalPath.Len(),gsl_getSystemTextEncoding()) + << sPhysicalPath << sNewLine; } @@ -1731,13 +1734,13 @@ void ODriver::installSystemTables( const TDatabaseStruct& _aInfo) pFileStream->Seek(STREAM_SEEK_TO_END); (*pFileStream) << "x_dbinst" << " -d " - << ::rtl::OString(_aInfo.sDBName,_aInfo.sDBName.getLength(),gsl_getSystemTextEncoding()) + << _aInfo.sDBName << " -u " - << ::rtl::OString(_aInfo.sSysUser,_aInfo.sSysUser.getLength(),gsl_getSystemTextEncoding()) + << _aInfo.sSysUser << "," - << ::rtl::OString(_aInfo.sSysPassword,_aInfo.sSysPassword.getLength(),gsl_getSystemTextEncoding()) + << _aInfo.sSysPassword << " -w " - << ::rtl::OString(_aInfo.sDomainPassword,_aInfo.sDomainPassword.getLength(),gsl_getSystemTextEncoding()) + << _aInfo.sDomainPassword << " -b "; if ( isKernelVersion(ADABAS_KERNEL_11) ) diff --git a/connectivity/source/drivers/jdbc/Class.cxx b/connectivity/source/drivers/jdbc/Class.cxx index 7f2705a48225..36b222abff9e 100644 --- a/connectivity/source/drivers/jdbc/Class.cxx +++ b/connectivity/source/drivers/jdbc/Class.cxx @@ -53,7 +53,7 @@ java_lang_Class * java_lang_Class::forName( const ::rtl::OUString& _par0 ) { ::rtl::OString sClassName = ::rtl::OUStringToOString(_par0, RTL_TEXTENCODING_JAVA_UTF8); sClassName = sClassName.replace('.','/'); - out = t.pEnv->FindClass(sClassName); + out = t.pEnv->FindClass( sClassName.getStr()); ThrowSQLException(t.pEnv,0); } //t.pEnv // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx index a7b7f1e7aa40..f4d397f8cb75 100644 --- a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx @@ -879,7 +879,7 @@ void ODatabaseMetaDataResultSet::openTables(const Any& catalog, const ::rtl::OUS const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL, *pPKO = pSchemaPat && pSchemaPat->getLength() ? aPKO.getStr() : NULL, - *pPKN = aPKN = ::rtl::OUStringToOString(tableNamePattern,m_nTextEncoding).getStr(); + *pPKN = (aPKN = ::rtl::OUStringToOString(tableNamePattern,m_nTextEncoding)).getStr(); const char *pCOL = NULL; @@ -981,8 +981,8 @@ void ODatabaseMetaDataResultSet::openColumnPrivileges( const Any& catalog, cons const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL, *pPKO = pSchemaPat && pSchemaPat->getLength() ? aPKO.getStr() : NULL, - *pPKN = aPKN = ::rtl::OUStringToOString(table,m_nTextEncoding).getStr(), - *pCOL = aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding).getStr(); + *pPKN = (aPKN = ::rtl::OUStringToOString(table,m_nTextEncoding)).getStr(), + *pCOL = (aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding)).getStr(); SQLRETURN nRetcode = N3SQLColumnPrivileges(m_aStatementHandle, @@ -1014,8 +1014,8 @@ void ODatabaseMetaDataResultSet::openColumns( const Any& catalog, const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL, *pPKO = pSchemaPat && pSchemaPat->getLength() && pSchemaPat->getLength() ? aPKO.getStr() : NULL, - *pPKN = aPKN = ::rtl::OUStringToOString(tableNamePattern,m_nTextEncoding).getStr(), - *pCOL = aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding).getStr(); + *pPKN = (aPKN = ::rtl::OUStringToOString(tableNamePattern,m_nTextEncoding)).getStr(), + *pCOL = (aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding)).getStr(); SQLRETURN nRetcode = N3SQLColumns(m_aStatementHandle, @@ -1081,8 +1081,8 @@ void ODatabaseMetaDataResultSet::openProcedureColumns( const Any& catalog, const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL, *pPKO = pSchemaPat && pSchemaPat->getLength() ? aPKO.getStr() : NULL, - *pPKN = aPKN = ::rtl::OUStringToOString(procedureNamePattern,m_nTextEncoding).getStr(), - *pCOL = aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding).getStr(); + *pPKN = (aPKN = ::rtl::OUStringToOString(procedureNamePattern,m_nTextEncoding)).getStr(), + *pCOL = (aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding)).getStr(); SQLRETURN nRetcode = N3SQLProcedureColumns(m_aStatementHandle, @@ -1115,7 +1115,7 @@ void ODatabaseMetaDataResultSet::openProcedures(const Any& catalog, const ::rtl: const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL, *pPKO = pSchemaPat && pSchemaPat->getLength() ? aPKO.getStr() : NULL, - *pPKN = aPKN = ::rtl::OUStringToOString(procedureNamePattern,m_nTextEncoding).getStr(); + *pPKN = (aPKN = ::rtl::OUStringToOString(procedureNamePattern,m_nTextEncoding)).getStr(); SQLRETURN nRetcode = N3SQLProcedures(m_aStatementHandle, @@ -1145,7 +1145,7 @@ void ODatabaseMetaDataResultSet::openSpecialColumns(sal_Bool _bRowVer,const Any& const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL, *pPKO = pSchemaPat && pSchemaPat->getLength() ? aPKO.getStr() : NULL, - *pPKN = aPKN = ::rtl::OUStringToOString(table,m_nTextEncoding).getStr(); + *pPKN = (aPKN = ::rtl::OUStringToOString(table,m_nTextEncoding)).getStr(); SQLRETURN nRetcode = N3SQLSpecialColumns(m_aStatementHandle,_bRowVer ? SQL_ROWVER : SQL_BEST_ROWID, diff --git a/connectivity/source/parse/sqlflex.l b/connectivity/source/parse/sqlflex.l index 042084c977c8..304a4e18be4a 100644 --- a/connectivity/source/parse/sqlflex.l +++ b/connectivity/source/parse/sqlflex.l @@ -784,7 +784,7 @@ void OSQLScanner::prepareScan(const ::rtl::OUString & rNewStatement, const IPars BEGIN(m_nRule); m_sErrorMessage = ::rtl::OUString(); - m_sStatement = ::rtl::OString(rNewStatement,rNewStatement.getLength(), RTL_TEXTENCODING_UTF8); + m_sStatement = ::rtl::OUStringToOString( rNewStatement, RTL_TEXTENCODING_UTF8); m_nCurrentPos = 0; m_bInternational = bInternational; m_pContext = pContext; diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index a971cbc1d310..6306fcbf76ca 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -1576,7 +1576,7 @@ OSQLParseNode::OSQLParseNode(const ::rtl::OString &_rNewValue, SQLNodeType eNewNodeType, sal_uInt32 nNewNodeID) :m_pParent(NULL) - ,m_aNodeValue(_rNewValue,_rNewValue.getLength(),RTL_TEXTENCODING_UTF8) + ,m_aNodeValue( rtl::OStringToOUString( _rNewValue, RTL_TEXTENCODING_UTF8)) ,m_eNodeType(eNewNodeType) ,m_nNodeID(nNewNodeID) { @@ -2465,7 +2465,7 @@ void OSQLParseNode::parseLeaf(::rtl::OUStringBuffer& rString, const SQLParseNode rString.appendAscii(" "); const ::rtl::OString sT = OSQLParser::TokenIDToStr(m_nNodeID, rParam.bInternational ? &rParam.m_rContext : NULL); - rString.append(::rtl::OUString(sT,sT.getLength(),RTL_TEXTENCODING_UTF8)); + rString.append( ::rtl::OStringToOUString( sT, RTL_TEXTENCODING_UTF8)); } break; case SQL_NODE_STRING: if (rString.getLength()) @@ -2550,7 +2550,7 @@ void OSQLParseNode::parseLeaf(::rtl::OUStringBuffer& rString, const SQLParseNode sal_Int32 OSQLParser::getFunctionReturnType(const ::rtl::OUString& _sFunctionName, const IParseContext* pContext) { sal_Int32 nType = DataType::VARCHAR; - ::rtl::OString sFunctionName(_sFunctionName,_sFunctionName.getLength(),RTL_TEXTENCODING_UTF8); + ::rtl::OString sFunctionName( rtl::OUStringToOString( _sFunctionName, RTL_TEXTENCODING_UTF8)); if(sFunctionName.equalsIgnoreAsciiCase(TokenIDToStr(SQL_TOKEN_ASCII,pContext))) nType = DataType::INTEGER; else if(sFunctionName.equalsIgnoreAsciiCase(TokenIDToStr(SQL_TOKEN_BIT_LENGTH,pContext))) nType = DataType::INTEGER; |