[Libreoffice-commits] core.git: vcl/unx

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 8 22:56:19 UTC 2020


 vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e4dc69b2b97dbd56bd55e514a5abcbd3c2a2f2fb
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Dec 8 22:42:46 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Dec 8 23:55:32 2020 +0100

    Remove redundant strlen call
    
    068f244222edcc5916fe864a0265ab6ccb4e43d2 "gtk3_kde5: port away from
    boost::process" had introduced this as
    
        return OUString::fromUtf8(OString(ret.c_str(), ret.size()));
    
    (so would have preserved embedded NUL characters in ret, even if such should not
    exist in a pathname anyway and this form was likely not chosen over the shorter
    
        return OUString::fromUtf8(OString(ret.c_str()));
    
    with the intention of preserving embedded NULs).
    
    Then ec3aee0ef36f1ec3848581009b0de01e0ffd5e8f "Fix build with older versions of
    Boost" replaced that with
    
        return OUString::fromUtf8(OString(ret.c_str(), strlen(ret.c_str())));
    
    which has the exact opposite effect of cutting at the first embedded NUL (which,
    again, was likely not the motivation for choosing this form).
    
    Change-Id: Ic2d432907bce38a0314a0556a9540d08cdc42929
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107443
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx
index 80c15938bdaf..e9c9f4621820 100644
--- a/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx
+++ b/vcl/unx/gtk3_kde5/gtk3_kde5_filepicker_ipc.cxx
@@ -53,7 +53,7 @@ OUString applicationDirPath()
     const auto utf8Path = applicationSystemPath.toUtf8();
     auto ret = boost::filesystem::path(utf8Path.getStr(), utf8Path.getStr() + utf8Path.getLength());
     ret.remove_filename();
-    return OUString::fromUtf8(OString(ret.c_str(), strlen(ret.c_str())));
+    return OUString::fromUtf8(OString(ret.c_str()));
 }
 
 OUString findPickerExecutable()


More information about the Libreoffice-commits mailing list