diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-11-06 17:24:13 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-11-06 17:24:13 +0100 |
commit | fc0d57b7aff84f4bdca0a1f201527c265d5f0cf5 (patch) | |
tree | 49a72b76d2d2a92af6371748c19277778159b86d /connectivity/source/drivers | |
parent | e36dae401fc8963c9a92cb2c11d9b650b943c6d3 (diff) |
Revert "use the new OUString::fromUtf8 method"
This reverts commit 05050cdb23de586870bf479a9df5ced06828d498,
not all places that use e.g. OStringToOUString to convert potential UTF-8
are guaranteed to fulfil the prerequisites necessary to use fromUtf8 (and
some places like e.g. in codemaker are happy with the best-effort effect
of OStringToOUString's OSTRING_TO_OUSTRING_CVTFLAGS).
Diffstat (limited to 'connectivity/source/drivers')
9 files changed, 26 insertions, 16 deletions
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 86a2dc6c7919..47d3472ca7a6 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$", OUString::fromUtf8(aDefaultValue))); + aStringToSubstitutes.push_back(::std::pair<const sal_Char* , OUString >("$value$", OStringToOUString(aDefaultValue,RTL_TEXTENCODING_UTF8))); 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 4bc4f316fe0a..c53523b5d479 100644 --- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx +++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx @@ -214,7 +214,8 @@ namespace connectivity if( pSpec ) { - aName = OUString::fromUtf8( g_param_spec_get_name( ( GParamSpec * )pSpec ) ); + aName = OStringToOUString( g_param_spec_get_name( ( GParamSpec * )pSpec ), + RTL_TEXTENCODING_UTF8 ); aName = aName.replace( '-', '_' ); } return aName; @@ -1154,10 +1155,12 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables( ODatabaseMetaDataResultSet::ORow aRow(3); aRow.reserve(6); - OUString aHumanName = OUString::fromUtf8( e_source_get_display_name( pSource ) ); + OUString aHumanName = OStringToOUString( e_source_get_display_name( pSource ), + RTL_TEXTENCODING_UTF8 ); aRow.push_back(new ORowSetValueDecorator(aHumanName)); //tablename aRow.push_back(new ORowSetValueDecorator(aTable)); - OUString aUID = OUString::fromUtf8( e_source_get_uid( pSource ) ); + OUString aUID = OStringToOUString( e_source_get_uid( pSource ), + RTL_TEXTENCODING_UTF8 ); 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); @@ -1204,7 +1207,8 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables( { ESource *pSource = E_SOURCE (s->data); - OUString aName = OUString::fromUtf8( e_source_peek_name( pSource ) ); + OUString aName = OStringToOUString( e_source_peek_name( pSource ), + RTL_TEXTENCODING_UTF8 ); ODatabaseMetaDataResultSet::ORow aRow(3); aRow.reserve(6); diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx b/connectivity/source/drivers/evoab2/NResultSet.cxx index 59c9cf67db5c..bbf643c78a7e 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( OUString::fromUtf8( aStr ) ); + OUString sResult( OStringToOUString( aStr, RTL_TEXTENCODING_UTF8 ) ); g_value_unset( &_rValue ); return sResult; } diff --git a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx index 084cefd35083..8e6a0746383c 100644 --- a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx +++ b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx @@ -110,7 +110,8 @@ OUString SAL_CALL OEvoabResultSetMetaData::getColumnLabel( sal_Int32 nColumnNum OUString aLabel; if( pSpec ) - aLabel = OUString::fromUtf8( g_param_spec_get_nick( (GParamSpec *) pSpec ) ); + aLabel = OStringToOUString( g_param_spec_get_nick( (GParamSpec *) pSpec ), + RTL_TEXTENCODING_UTF8 ); return aLabel; } diff --git a/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx b/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx index 136734306be7..c4a239ade780 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 = OUString::fromUtf8((*iter).c_str()); + OUString groupTableName = OStringToOUString((*iter).c_str(), RTL_TEXTENCODING_UTF8); 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 ff8f932ff12b..b33baa1e82df 100644 --- a/connectivity/source/drivers/mork/MNSINIParser.cxx +++ b/connectivity/source/drivers/mork/MNSINIParser.cxx @@ -60,7 +60,8 @@ 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 = OUString::fromUtf8( line.copy(nIndex+1).trim() ); + nameValue.sValue = OStringToOUString( + line.copy(nIndex+1).trim(), RTL_TEXTENCODING_UTF8 ); aSection->lList.push_back(nameValue); diff --git a/connectivity/source/drivers/mork/MQueryHelper.cxx b/connectivity/source/drivers/mork/MQueryHelper.cxx index 1fff2cc8b510..686af4e09148 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 = OUString::fromUtf8( valueOString ); + OUString valueOUString = OStringToOUString( valueOString, RTL_TEXTENCODING_UTF8 ); 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 9450a8a2b722..9b36e68f2fd0 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx @@ -67,7 +67,8 @@ 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 = OUString::fromUtf8( line.copy(nIndex+1).trim() ); + nameValue.sValue = OStringToOUString( + line.copy(nIndex+1).trim(), RTL_TEXTENCODING_UTF8 ); aSection->lList.push_back(nameValue); diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx index e077f8420109..17428fd96fe2 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( OUString::fromUtf8( strbuf.makeStringAndClear() ) ); + buf.append( OStringToOUString( strbuf.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ) ); } 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( OUString::fromUtf8( cstr ) ); + buf.append( OStringToOUString( cstr, RTL_TEXTENCODING_UTF8 ) ); PQfreemem( cstr ); } @@ -553,11 +553,11 @@ void splitConcatenatedIdentifier( const OUString & source, OUString *first, OUSt { case 1: *first = OUString(); - *second = OUString::fromUtf8( vec[0] ); + *second = OStringToOUString( vec[0], RTL_TEXTENCODING_UTF8 ); break; case 3: - *first = OUString::fromUtf8( vec[0] ); - *second = OUString::fromUtf8( vec[2] ); + *first = OStringToOUString( vec[0], RTL_TEXTENCODING_UTF8 ); + *second = OStringToOUString( vec[2], RTL_TEXTENCODING_UTF8 ); break; default: SAL_WARN("connectivity.postgresql", @@ -706,12 +706,15 @@ 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); } |