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 /sal | |
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 'sal')
-rw-r--r-- | sal/qa/osl/file/osl_File.cxx | 29 | ||||
-rw-r--r-- | sal/rtl/bootstrap.cxx | 8 |
2 files changed, 22 insertions, 15 deletions
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx index ddb11f93bffa..fdf44a098dd7 100644 --- a/sal/qa/osl/file/osl_File.cxx +++ b/sal/qa/osl/file/osl_File.cxx @@ -43,6 +43,7 @@ using namespace osl; using ::rtl::OUString; using ::rtl::OUStringToOString; using ::rtl::OString; +using ::rtl::OStringToOUString; // helper functions @@ -473,7 +474,7 @@ namespace osl_FileBase void getAbsoluteFileURL::check_getAbsoluteFileURL( rtl::OUString const& _suBaseURL, rtl::OString const& _sRelativeURL, ::osl::FileBase::RC _nAssumeError, rtl::OUString const& _suAssumeResultStr ) { - rtl::OUString suRelativeURL = rtl::OUString::fromUtf8(_sRelativeURL); + rtl::OUString suRelativeURL = rtl::OStringToOUString(_sRelativeURL, RTL_TEXTENCODING_UTF8); rtl::OString sBaseURL = rtl::OUStringToOString(_suBaseURL, RTL_TEXTENCODING_UTF8); rtl::OUString suResultURL; osl::FileBase::RC nError = FileBase::getAbsoluteFileURL( _suBaseURL, suRelativeURL, suResultURL ); @@ -673,21 +674,25 @@ namespace osl_FileBase // PRE: URL as String rtl::OUString suSource; rtl::OUString suStr; - suSource = rtl::OUString::fromUtf8(_sSource); - ::osl::FileBase::RC nError; - if ( bDirection ) - nError = osl::FileBase::getSystemPathFromFileURL( suSource, suStr ); - else - nError = osl::FileBase::getFileURLFromSystemPath( suSource, suStr ); + suSource = rtl::OStringToOUString(_sSource, RTL_TEXTENCODING_UTF8); + ::osl::FileBase::RC nError; + if ( bDirection ) + nError = osl::FileBase::getSystemPathFromFileURL( suSource, suStr ); + else + nError = osl::FileBase::getFileURLFromSystemPath( suSource, suStr ); // if the given string is gt length 0, // we check also this string rtl::OString sStr = rtl::OUStringToOString(suStr, RTL_TEXTENCODING_UTF8); rtl::OString sError = errorToString(nError); - if ( bDirection ) - printf("getSystemPathFromFileURL('%s') deliver system path: '%s', error '%s'\n", _sSource.getStr(), sStr.getStr(), sError.getStr() ); - else - printf("getFileURLFromSystemPath('%s') deliver File URL: '%s', error '%s'\n", _sSource.getStr(), sStr.getStr(), sError.getStr() ); + if ( bDirection ) + printf("getSystemPathFromFileURL('%s') deliver system path: '%s', error '%s'\n", _sSource.getStr(), sStr.getStr(), sError.getStr() ); + else + printf("getFileURLFromSystemPath('%s') deliver File URL: '%s', error '%s'\n", _sSource.getStr(), sStr.getStr(), sError.getStr() ); + + // rtl::OUString suStrEncode = rtl::Uri::encode(suStr, rtl_UriCharClassUnoParamValue, rtl_UriEncodeKeepEscapes, RTL_TEXTENCODING_UTF8); + // sStr = rtl::OUStringToOString(suStr, RTL_TEXTENCODING_UTF8); + // printf("UTF8: %s\n", sStr.getStr() ); if (!_sAssumeResultStr.isEmpty()) { @@ -4852,7 +4857,7 @@ namespace osl_Directory #endif tmp_x += rtl::OString(TEST_PATH_POSTFIX); - rc = FileBase::getFileURLFromSystemPath(rtl::OUString::fromUtf8(tmp_x), test_path); + rc = FileBase::getFileURLFromSystemPath(rtl::OStringToOUString(tmp_x, RTL_TEXTENCODING_UTF8), test_path); CPPUNIT_ASSERT_MESSAGE ( diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx index b2ca0a97bcd6..5719ae4301ec 100644 --- a/sal/rtl/bootstrap.cxx +++ b/sal/rtl/bootstrap.cxx @@ -377,7 +377,8 @@ Bootstrap_Impl::Bootstrap_Impl( OUString const & rIniName ) struct rtl_bootstrap_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 ); #if OSL_DEBUG_LEVEL > 1 OString name_tmp = OUStringToOString(nameValue.sName, RTL_TEXTENCODING_ASCII_US); @@ -986,13 +987,14 @@ rtl::OUString expandMacros( // replacement text (and if it did, it would fail to // detect cycles that pass through here): buf.append( - rtl::OUString::fromUtf8( + rtl::OStringToOUString( osl::Profile(seg[0]).readString( rtl::OUStringToOString( seg[1], RTL_TEXTENCODING_UTF8), rtl::OUStringToOString( seg[2], RTL_TEXTENCODING_UTF8), - rtl::OString()))); + rtl::OString()), + RTL_TEXTENCODING_UTF8)); } } } else { |