diff options
author | Noel Grandin <noel@peralex.com> | 2014-11-06 07:45:00 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-11-06 13:51:10 +0200 |
commit | 05050cdb23de586870bf479a9df5ced06828d498 (patch) | |
tree | a34c3bba9a921a5e9abf23d5757c15dfaea0ceac /connectivity | |
parent | 8f266781a6bd6a629bce65c0f613683047c9a794 (diff) |
use the new OUString::fromUtf8 method
Change-Id: I771004b7ccab3344a67e827e45bc34c22ffa5f77
Diffstat (limited to 'connectivity')
12 files changed, 23 insertions, 34 deletions
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 47d3472ca7a6..86a2dc6c7919 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -1946,7 +1946,7 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow, cons aStringToSubstitutes.push_back(::std::pair<const sal_Char* , OUString >("$columnname$", aColName)); aStringToSubstitutes.push_back(::std::pair<const sal_Char* , OUString >("$precision$", OUString::number(nLen))); aStringToSubstitutes.push_back(::std::pair<const sal_Char* , OUString >("$scale$", OUString::number(nScale))); - aStringToSubstitutes.push_back(::std::pair<const sal_Char* , OUString >("$value$", OStringToOUString(aDefaultValue,RTL_TEXTENCODING_UTF8))); + aStringToSubstitutes.push_back(::std::pair<const sal_Char* , OUString >("$value$", OUString::fromUtf8(aDefaultValue))); const OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( STR_INVALID_COLUMN_DECIMAL_VALUE diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx index c53523b5d479..4bc4f316fe0a 100644 --- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx +++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx @@ -214,8 +214,7 @@ namespace connectivity if( pSpec ) { - aName = OStringToOUString( g_param_spec_get_name( ( GParamSpec * )pSpec ), - RTL_TEXTENCODING_UTF8 ); + aName = OUString::fromUtf8( g_param_spec_get_name( ( GParamSpec * )pSpec ) ); aName = aName.replace( '-', '_' ); } return aName; @@ -1155,12 +1154,10 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables( ODatabaseMetaDataResultSet::ORow aRow(3); aRow.reserve(6); - OUString aHumanName = OStringToOUString( e_source_get_display_name( pSource ), - RTL_TEXTENCODING_UTF8 ); + OUString aHumanName = OUString::fromUtf8( e_source_get_display_name( pSource ) ); aRow.push_back(new ORowSetValueDecorator(aHumanName)); //tablename aRow.push_back(new ORowSetValueDecorator(aTable)); - OUString aUID = OStringToOUString( e_source_get_uid( pSource ), - RTL_TEXTENCODING_UTF8 ); + OUString aUID = OUString::fromUtf8( e_source_get_uid( pSource ) ); aRow.push_back(new ORowSetValueDecorator(aUID)); //comment //I'd prefer to swap the comment and the human name and //just use e_source_registry_ref_source(get_e_source_registry(), aUID); @@ -1207,8 +1204,7 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables( { ESource *pSource = E_SOURCE (s->data); - OUString aName = OStringToOUString( e_source_peek_name( pSource ), - RTL_TEXTENCODING_UTF8 ); + OUString aName = OUString::fromUtf8( e_source_peek_name( pSource ) ); ODatabaseMetaDataResultSet::ORow aRow(3); aRow.reserve(6); diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx b/connectivity/source/drivers/evoab2/NResultSet.cxx index bbf643c78a7e..59c9cf67db5c 100644 --- a/connectivity/source/drivers/evoab2/NResultSet.cxx +++ b/connectivity/source/drivers/evoab2/NResultSet.cxx @@ -98,7 +98,7 @@ valueToOUString( GValue& _rValue ) { const char *pStr = g_value_get_string( &_rValue ); OString aStr( pStr ? pStr : "" ); - OUString sResult( OStringToOUString( aStr, RTL_TEXTENCODING_UTF8 ) ); + OUString sResult( OUString::fromUtf8( aStr ) ); g_value_unset( &_rValue ); return sResult; } diff --git a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx index 8e6a0746383c..084cefd35083 100644 --- a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx +++ b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx @@ -110,8 +110,7 @@ OUString SAL_CALL OEvoabResultSetMetaData::getColumnLabel( sal_Int32 nColumnNum OUString aLabel; if( pSpec ) - aLabel = OStringToOUString( g_param_spec_get_nick( (GParamSpec *) pSpec ), - RTL_TEXTENCODING_UTF8 ); + aLabel = OUString::fromUtf8( g_param_spec_get_nick( (GParamSpec *) pSpec ) ); return aLabel; } diff --git a/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx b/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx index c4a239ade780..136734306be7 100644 --- a/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx +++ b/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx @@ -60,7 +60,7 @@ bool MDatabaseMetaDataHelper::getTableStrings( OConnection* _pCon, std::set<std::string> lists; _pCon->getMorkParser("AddressBook")->retrieveLists(lists); for (::std::set<std::string>::iterator iter = lists.begin(); iter != lists.end(); ++iter) { - OUString groupTableName = OStringToOUString((*iter).c_str(), RTL_TEXTENCODING_UTF8); + OUString groupTableName = OUString::fromUtf8((*iter).c_str()); SAL_INFO("connectivity.mork", "add Table " << groupTableName); _rStrings.push_back(groupTableName); diff --git a/connectivity/source/drivers/mork/MNSINIParser.cxx b/connectivity/source/drivers/mork/MNSINIParser.cxx index b33baa1e82df..ff8f932ff12b 100644 --- a/connectivity/source/drivers/mork/MNSINIParser.cxx +++ b/connectivity/source/drivers/mork/MNSINIParser.cxx @@ -60,8 +60,7 @@ IniParser::IniParser(OUString const & rIniName) throw(com::sun::star::io::IOExce struct ini_NameValue nameValue; nameValue.sName = OStringToOUString( line.copy(0,nIndex).trim(), RTL_TEXTENCODING_ASCII_US ); - nameValue.sValue = OStringToOUString( - line.copy(nIndex+1).trim(), RTL_TEXTENCODING_UTF8 ); + nameValue.sValue = OUString::fromUtf8( line.copy(nIndex+1).trim() ); aSection->lList.push_back(nameValue); diff --git a/connectivity/source/drivers/mork/MQueryHelper.cxx b/connectivity/source/drivers/mork/MQueryHelper.cxx index 686af4e09148..1fff2cc8b510 100644 --- a/connectivity/source/drivers/mork/MQueryHelper.cxx +++ b/connectivity/source/drivers/mork/MQueryHelper.cxx @@ -243,7 +243,7 @@ sal_Int32 MQueryHelper::executeQuery(OConnection* xConnection, MQueryExpression std::string value = xMork->getValue(CellsIter->second); OString key(column.c_str(), static_cast<sal_Int32>(column.size())); OString valueOString(value.c_str(), static_cast<sal_Int32>(value.size())); - OUString valueOUString = OStringToOUString( valueOString, RTL_TEXTENCODING_UTF8 ); + OUString valueOUString = OUString::fromUtf8( valueOString ); entry->setValue(key, valueOUString); } ::std::vector< sal_Bool > vector = entryMatchedByExpression(this, &expr, entry); diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx index 9b36e68f2fd0..9450a8a2b722 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx @@ -67,8 +67,7 @@ IniParser::IniParser(OUString const & rIniName) throw(com::sun::star::io::IOExce struct ini_NameValue nameValue; nameValue.sName = OStringToOUString( line.copy(0,nIndex).trim(), RTL_TEXTENCODING_ASCII_US ); - nameValue.sValue = OStringToOUString( - line.copy(nIndex+1).trim(), RTL_TEXTENCODING_UTF8 ); + nameValue.sValue = OUString::fromUtf8( line.copy(nIndex+1).trim() ); aSection->lList.push_back(nameValue); diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx index 17428fd96fe2..e077f8420109 100644 --- a/connectivity/source/drivers/postgresql/pq_tools.cxx +++ b/connectivity/source/drivers/postgresql/pq_tools.cxx @@ -125,7 +125,7 @@ void bufferEscapeConstant( OUStringBuffer & buf, const OUString & value, Connect strbuf.setLength( len ); // Previously here RTL_TEXTENCODING_ASCII_US; as we set the PostgreSQL client_encoding to UTF8, // we get UTF8 here, too. I'm not sure why it worked well before... - buf.append( OStringToOUString( strbuf.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ) ); + buf.append( OUString::fromUtf8( strbuf.makeStringAndClear() ) ); } static inline void ibufferQuoteConstant( OUStringBuffer & buf, const OUString & value, ConnectionSettings *settings ) @@ -168,7 +168,7 @@ static inline void ibufferQuoteIdentifier( OUStringBuffer & buf, const OUString -1, Any()); } - buf.append( OStringToOUString( cstr, RTL_TEXTENCODING_UTF8 ) ); + buf.append( OUString::fromUtf8( cstr ) ); PQfreemem( cstr ); } @@ -553,11 +553,11 @@ void splitConcatenatedIdentifier( const OUString & source, OUString *first, OUSt { case 1: *first = OUString(); - *second = OStringToOUString( vec[0], RTL_TEXTENCODING_UTF8 ); + *second = OUString::fromUtf8( vec[0] ); break; case 3: - *first = OStringToOUString( vec[0], RTL_TEXTENCODING_UTF8 ); - *second = OStringToOUString( vec[2], RTL_TEXTENCODING_UTF8 ); + *first = OUString::fromUtf8( vec[0] ); + *second = OUString::fromUtf8( vec[2] ); break; default: SAL_WARN("connectivity.postgresql", @@ -706,15 +706,12 @@ com::sun::star::uno::Sequence< sal_Int32 > parseIntArray( const OUString & str ) { sal_Int32 start = 0; IntVector vec; -// printf( ">%s<\n" , OUStringToOString( str, RTL_TEXTENCODING_UTF8 ).getStr() ); for( sal_Int32 i = str.indexOf( ' ' ) ; i != -1 ; i = str.indexOf( ' ', start) ) { vec.push_back( (sal_Int32)rtl_ustr_toInt32( &str.pData->buffer[start], 10 ) ); -// printf( "found %d\n" , rtl_ustr_toInt32( &str.pData->buffer[start], 10 )); start = i + 1; } vec.push_back( (sal_Int32)rtl_ustr_toInt32( &str.pData->buffer[start], 10 ) ); -// printf( "found %d\n" , rtl_ustr_toInt32( &str.pData->buffer[start], 10 )); return sequence_of_vector(vec); } diff --git a/connectivity/source/parse/sqlflex.l b/connectivity/source/parse/sqlflex.l index 330a853c9d75..ae8a1b2db351 100644 --- a/connectivity/source/parse/sqlflex.l +++ b/connectivity/source/parse/sqlflex.l @@ -523,13 +523,13 @@ sal_Int32 gatherString(int delim, sal_Int32 nTyp) switch(nTyp) { case 0: - SQL_NEW_NODE(::rtl::OStringToOUString(sBuffer.makeStringAndClear(),RTL_TEXTENCODING_UTF8), SQL_NODE_NAME); + SQL_NEW_NODE(::rtl::OUString::fromUtf8(sBuffer.makeStringAndClear()), SQL_NODE_NAME); return SQL_TOKEN_NAME; case 1: - SQL_NEW_NODE(::rtl::OStringToOUString(sBuffer.makeStringAndClear(),RTL_TEXTENCODING_UTF8), SQL_NODE_STRING); + SQL_NEW_NODE(::rtl::OUString::fromUtf8(sBuffer.makeStringAndClear()), SQL_NODE_STRING); return SQL_TOKEN_STRING; case 2: - SQL_NEW_NODE(::rtl::OStringToOUString(sBuffer.makeStringAndClear(),RTL_TEXTENCODING_UTF8), SQL_NODE_ACCESS_DATE); + SQL_NEW_NODE(::rtl::OUString::fromUtf8(sBuffer.makeStringAndClear()), SQL_NODE_ACCESS_DATE); return SQL_TOKEN_ACCESS_DATE; } } diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index eb2abedff3d2..c767867cf47e 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -1603,7 +1603,7 @@ OSQLParseNode::OSQLParseNode(const OString &_rNewValue, SQLNodeType eNewNodeType, sal_uInt32 nNewNodeID) :m_pParent(NULL) - ,m_aNodeValue(OStringToOUString(_rNewValue,RTL_TEXTENCODING_UTF8)) + ,m_aNodeValue(OUString::fromUtf8(_rNewValue)) ,m_eNodeType(eNewNodeType) ,m_nNodeID(nNewNodeID) { @@ -2301,7 +2301,7 @@ void OSQLParseNode::showParseTree( OUStringBuffer& _inout_rBuffer, sal_uInt32 nL case SQL_NODE_KEYWORD: _inout_rBuffer.appendAscii( "SQL_KEYWORD: " ); - _inout_rBuffer.append( OStringToOUString( OSQLParser::TokenIDToStr( getTokenID() ), RTL_TEXTENCODING_UTF8 ) ); + _inout_rBuffer.append( OUString::fromUtf8( OSQLParser::TokenIDToStr( getTokenID() ) ) ); _inout_rBuffer.append( '\n' ); break; @@ -2442,7 +2442,7 @@ void OSQLParseNode::parseLeaf(OUStringBuffer& rString, const SQLParseNodeParamet rString.appendAscii(" "); const OString sT = OSQLParser::TokenIDToStr(m_nNodeID, rParam.bInternational ? &rParam.m_rContext : NULL); - rString.append(OStringToOUString(sT,RTL_TEXTENCODING_UTF8)); + rString.append(OUString::fromUtf8(sT)); } break; case SQL_NODE_STRING: if (!rString.isEmpty()) diff --git a/connectivity/workben/iniParser/main.cxx b/connectivity/workben/iniParser/main.cxx index e029b4acc900..f19719d84bfd 100644 --- a/connectivity/workben/iniParser/main.cxx +++ b/connectivity/workben/iniParser/main.cxx @@ -102,8 +102,7 @@ public: struct ini_NameValue nameValue; nameValue.sName = OStringToOUString( line.copy(0,nIndex).trim(), RTL_TEXTENCODING_ASCII_US ); - nameValue.sValue = OStringToOUString( - line.copy(nIndex+1).trim(), RTL_TEXTENCODING_UTF8 ); + nameValue.sValue = OUString::fromUtf8(line.copy(nIndex+1).trim()); aSection->lList.push_back(nameValue); |