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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 26 16:53:56 UTC 2020


 sfx2/source/appl/sfxhelp.cxx |   17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

New commits:
commit ff8a9eebfa1b3d8975b735d26bcd5c721b7995ea
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Aug 26 15:49:08 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Aug 26 18:53:16 2020 +0200

    Better use std::string_view than OUStringLiteral here
    
    Change-Id: Id62324beaa108d9421711989ee4fa09e4c7798ce
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101407
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index bd559af59fde..4b71403785a4 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -51,7 +51,6 @@
 #include <unotools/pathoptions.hxx>
 #include <rtl/byteseq.hxx>
 #include <rtl/ustring.hxx>
-#include <o3tl/safeint.hxx>
 #include <officecfg/Office/Common.hxx>
 #include <osl/process.h>
 #include <osl/file.hxx>
@@ -781,12 +780,12 @@ bool rewriteFlatpakHelpRootUrl(OUString * helpRootUrl) {
                 std::string_view const line(
                     reinterpret_cast<char const *>(bytes.getConstArray()), bytes.getLength());
                 if (instance) {
-                    static constexpr auto keyPath = OUStringLiteral("app-path=");
-                    static constexpr auto keyExtensions = OUStringLiteral("app-extensions=");
-                    if (!havePath && line.length() >= o3tl::make_unsigned(keyPath.size)
-                        && line.substr(0, keyPath.size) == keyPath.data)
+                    static constexpr auto keyPath = std::string_view("app-path=");
+                    static constexpr auto keyExtensions = std::string_view("app-extensions=");
+                    if (!havePath && line.length() >= keyPath.size()
+                        && line.substr(0, keyPath.size()) == keyPath.data())
                     {
-                        auto const value = line.substr(keyPath.size);
+                        auto const value = line.substr(keyPath.size());
                         if (!rtl_convertStringToUString(
                                 &path.pData, value.data(), value.length(),
                                 osl_getThreadTextEncoding(),
@@ -801,10 +800,10 @@ bool rewriteFlatpakHelpRootUrl(OUString * helpRootUrl) {
                             throw Failure();
                         }
                         havePath = true;
-                    } else if (!haveExtensions && line.length() >= o3tl::make_unsigned(keyExtensions.size)
-                               && line.substr(0, keyExtensions.size) == keyExtensions.data)
+                    } else if (!haveExtensions && line.length() >= keyExtensions.size()
+                               && line.substr(0, keyExtensions.size()) == keyExtensions.data())
                     {
-                        auto const value = line.substr(keyExtensions.size);
+                        auto const value = line.substr(keyExtensions.size());
                         if (!rtl_convertStringToUString(
                                 &extensions.pData, value.data(), value.length(),
                                 osl_getThreadTextEncoding(),


More information about the Libreoffice-commits mailing list