sal/osl/w32/file_url.cxx | 6 ++++-- svx/source/form/formcontroller.cxx | 2 +- vcl/unx/gtk3/gtkframe.cxx | 4 ++-- xmlhelp/source/cxxhelp/provider/urlparameter.hxx | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-)
New commits: commit d7910847fba1694c83dc57a1f27b8eaabb2a7d85 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Sun Apr 9 13:32:12 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun Apr 9 19:27:44 2023 +0200 use more OStringToOUString both because it is more obvious to read, and it takes a string_view, which is handy Change-Id: Ic201cfa0434446f51436d23c33d3f1a919ed65be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150167 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx index 8c525042ddef..a14f8d4b9b39 100644 --- a/sal/osl/w32/file_url.cxx +++ b/sal/osl/w32/file_url.cxx @@ -502,8 +502,10 @@ static std::optional<OUString> osl_decodeURL_(const OString& sUTF8) } } - return bValidEncoded ? OUString(aBuffer.getStr(), aBuffer.getLength(), RTL_TEXTENCODING_UTF8) - : std::optional<OUString>(); + if (!bValidEncoded) + return std::nullopt; + + return OStringToOUString(aBuffer, RTL_TEXTENCODING_UTF8); } static OUString osl_encodeURL_(std::u16string_view sURL) diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index b1063a46df2f..bf5306bc71c5 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -3082,7 +3082,7 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos) { OString aVal = m_pParser->getContext().getIntlKeywordAscii(IParseContext::InternationalKeyCode::And); OUString aCompText = aRow[rFieldInfo.xText] + " " + - OUString(aVal.getStr(),aVal.getLength(),RTL_TEXTENCODING_ASCII_US) + " " + + OStringToOUString(aVal, RTL_TEXTENCODING_ASCII_US) + " " + ::comphelper::getString(rRefValue.Value); aRow[rFieldInfo.xText] = aCompText; } diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx index 824af112fa5d..1b1a1c0595b0 100644 --- a/vcl/unx/gtk3/gtkframe.cxx +++ b/vcl/unx/gtk3/gtkframe.cxx @@ -2713,7 +2713,7 @@ OUString GtkSalFrame::GetKeyName( sal_uInt16 nKeyCode ) KeyCodeToGdkKey(nKeyCode, &nGtkKeyCode, &nGtkModifiers ); gchar* pName = gtk_accelerator_get_label(nGtkKeyCode, nGtkModifiers); - OUString aRet(pName, rtl_str_getLength(pName), RTL_TEXTENCODING_UTF8); + OUString aRet = OStringToOUString(pName, strlen(pName), RTL_TEXTENCODING_UTF8); g_free(pName); return aRet; } @@ -4859,7 +4859,7 @@ public: OUString aStr; gchar *pText = reinterpret_cast<gchar*>(gtk_selection_data_get_text(m_pData)); if (pText) - aStr = OUString(pText, rtl_str_getLength(pText), RTL_TEXTENCODING_UTF8); + aStr = OStringToOUString(pText, strlen(pText), RTL_TEXTENCODING_UTF8); g_free(pText); aRet <<= aStr.replaceAll("\r\n", "\n"); } diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.hxx b/xmlhelp/source/cxxhelp/provider/urlparameter.hxx index 0a555607129c..850cb8591900 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.hxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.hxx @@ -91,7 +91,7 @@ namespace chelp { //running into a later problem with strings >= 255 const char* pTitle = m_ptr + 3 + m_ptr[0] + static_cast<sal_Int32>(m_ptr[ 1+ static_cast<sal_Int32>(m_ptr[0]) ]); - return OUString(pTitle, rtl_str_getLength(pTitle), RTL_TEXTENCODING_UTF8); + return OStringToOUString(pTitle, strlen(pTitle), RTL_TEXTENCODING_UTF8); }