From d7910847fba1694c83dc57a1f27b8eaabb2a7d85 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 9 Apr 2023 13:32:12 +0200 Subject: 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 --- sal/osl/w32/file_url.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sal/osl/w32') 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 osl_decodeURL_(const OString& sUTF8) } } - return bValidEncoded ? OUString(aBuffer.getStr(), aBuffer.getLength(), RTL_TEXTENCODING_UTF8) - : std::optional(); + if (!bValidEncoded) + return std::nullopt; + + return OStringToOUString(aBuffer, RTL_TEXTENCODING_UTF8); } static OUString osl_encodeURL_(std::u16string_view sURL) -- cgit