[Libreoffice-commits] core.git: registry/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Sat Sep 5 18:21:37 UTC 2020


 registry/source/regimpl.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit aa357e56e8b6185e66ce763ca48fff61fe718bd7
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Sat Sep 5 18:25:07 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Sat Sep 5 20:21:00 2020 +0200

    Improve some OUString to OString conversions
    
    ...dropping an intermediary OUString temporary (assuming that way of
    constructing an OUString temporary from a pointer was not chosen deliberately to
    cut of the string at a potential embedded NUL).
    
    (This change is a prerequisite for making the OUString ctor taking a raw pointer
    explicit.)
    
    Change-Id: I752a0e63b86cb5e3d1a97ede1d855b9602a353c2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102081
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
index f0c8162434d4..60d90faa9c6c 100644
--- a/registry/source/regimpl.cxx
+++ b/registry/source/regimpl.cxx
@@ -1383,7 +1383,7 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_
                 std::unique_ptr<sal_Unicode[]> value(new sal_Unicode[size]);
                 readString(aBuffer.data(), value.get(), size);
 
-                OString uStr = OUStringToOString(value.get(), RTL_TEXTENCODING_UTF8);
+                OString uStr(value.get(), rtl_ustr_getLength(value.get()), RTL_TEXTENCODING_UTF8);
                 fprintf(stdout, "L\"%s\"\n", uStr.getStr());
             }
             break;
@@ -1498,7 +1498,7 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_
                     if (offset > 8)
                         fprintf(stdout, "%s              ", indent);
 
-                    uStr = OUStringToOString(pValue, RTL_TEXTENCODING_UTF8);
+                    uStr = OString(pValue, rtl_ustr_getLength(pValue), RTL_TEXTENCODING_UTF8);
                     fprintf(
                         stdout, "%lu = L\"%s\"\n",
                         sal::static_int_cast< unsigned long >(i),


More information about the Libreoffice-commits mailing list