[Libreoffice-commits] core.git: include/tools tools/qa tools/source ucb/source

Stephan Bergmann sbergman at redhat.com
Sun Mar 4 15:13:40 UTC 2018


 include/tools/urlobj.hxx                      |    3 ++-
 tools/qa/cppunit/test_urlobj.cxx              |    8 ++++----
 tools/source/fsys/urlobj.cxx                  |    4 ++--
 ucb/source/ucp/webdav-neon/webdavprovider.hxx |    4 ++--
 ucb/source/ucp/webdav/webdavprovider.hxx      |    4 ++--
 5 files changed, 12 insertions(+), 11 deletions(-)

New commits:
commit e05263e0f23af6f3fccf56f1a488baad7b3ee55f
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sun Mar 4 13:52:05 2018 +0100

    Change INetURLObject::isSchemeEqualTo parameter to u16string_view
    
    Change-Id: I003fa0c6f9c485d0579f3dd18331e63548a3777c
    Reviewed-on: https://gerrit.libreoffice.org/50728
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/include/tools/urlobj.hxx b/include/tools/urlobj.hxx
index dca8f6c07b74..cceab871a383 100644
--- a/include/tools/urlobj.hxx
+++ b/include/tools/urlobj.hxx
@@ -25,6 +25,7 @@
 #include <rtl/ustrbuf.hxx>
 #include <rtl/textenc.h>
 #include <sal/types.h>
+#include <o3tl/string_view.hxx>
 #include <o3tl/typed_flags_set.hxx>
 
 #include <memory>
@@ -383,7 +384,7 @@ public:
 
     bool isSchemeEqualTo(INetProtocol scheme) const { return scheme == m_eScheme; }
 
-    bool isSchemeEqualTo(OUString const & scheme) const;
+    bool isSchemeEqualTo(o3tl::u16string_view scheme) const;
 
     /** Check if the scheme is one of the WebDAV scheme
      *  we know about.
diff --git a/tools/qa/cppunit/test_urlobj.cxx b/tools/qa/cppunit/test_urlobj.cxx
index 71554d2d8a41..f9996172a863 100644
--- a/tools/qa/cppunit/test_urlobj.cxx
+++ b/tools/qa/cppunit/test_urlobj.cxx
@@ -322,7 +322,7 @@ namespace tools_urlobj
 
         void urlobjTest_isSchemeEqualTo() {
             CPPUNIT_ASSERT(INetURLObject().isSchemeEqualTo(INetProtocol::NotValid));
-            CPPUNIT_ASSERT(!INetURLObject().isSchemeEqualTo(""));
+            CPPUNIT_ASSERT(!INetURLObject().isSchemeEqualTo(u""));
             CPPUNIT_ASSERT(
                 INetURLObject("http://example.org").isSchemeEqualTo(
                     INetProtocol::Http));
@@ -330,11 +330,11 @@ namespace tools_urlobj
                 !INetURLObject("http://example.org").isSchemeEqualTo(
                     INetProtocol::Https));
             CPPUNIT_ASSERT(
-                INetURLObject("http://example.org").isSchemeEqualTo("Http"));
+                INetURLObject("http://example.org").isSchemeEqualTo(u"Http"));
             CPPUNIT_ASSERT(
-                !INetURLObject("http://example.org").isSchemeEqualTo("dav"));
+                !INetURLObject("http://example.org").isSchemeEqualTo(u"dav"));
             CPPUNIT_ASSERT(
-                INetURLObject("dav://example.org").isSchemeEqualTo("dav"));
+                INetURLObject("dav://example.org").isSchemeEqualTo(u"dav"));
         }
 
         void urlobjTest_isAnyKnownWebDAVScheme() {
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index b72976850345..6a3b2ef712c2 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -3889,10 +3889,10 @@ OUString INetURLObject::getExternalURL() const
     return aTheExtURIRef;
 }
 
-bool INetURLObject::isSchemeEqualTo(OUString const & scheme) const {
+bool INetURLObject::isSchemeEqualTo(o3tl::u16string_view scheme) const {
     return m_aScheme.isPresent()
         && (rtl_ustr_compareIgnoreAsciiCase_WithLength(
-                scheme.getStr(), scheme.getLength(),
+                scheme.data(), scheme.size(),
                 m_aAbsURIRef.getStr() + m_aScheme.getBegin(),
                 m_aScheme.getLength())
             == 0);
diff --git a/ucb/source/ucp/webdav-neon/webdavprovider.hxx b/ucb/source/ucp/webdav-neon/webdavprovider.hxx
index 9794cd413bf3..3e90c7fef5ab 100644
--- a/ucb/source/ucp/webdav-neon/webdavprovider.hxx
+++ b/ucb/source/ucp/webdav-neon/webdavprovider.hxx
@@ -51,8 +51,8 @@ namespace webdav_ucp {
 #define VNDSUNSTARWEBDAVS_URL_SCHEME "vnd.sun.star.webdavs"
 #define HTTP_URL_SCHEME              "http"
 #define HTTPS_URL_SCHEME             "https"
-#define DAV_URL_SCHEME               "dav"
-#define DAVS_URL_SCHEME              "davs"
+#define DAV_URL_SCHEME               u"dav"
+#define DAVS_URL_SCHEME              u"davs"
 #define WEBDAV_URL_SCHEME            "webdav"
 #define WEBDAVS_URL_SCHEME           "webdavs"
 
diff --git a/ucb/source/ucp/webdav/webdavprovider.hxx b/ucb/source/ucp/webdav/webdavprovider.hxx
index a9375260816b..d01455b25332 100644
--- a/ucb/source/ucp/webdav/webdavprovider.hxx
+++ b/ucb/source/ucp/webdav/webdavprovider.hxx
@@ -45,8 +45,8 @@ namespace http_dav_ucp {
 #define VNDSUNSTARWEBDAVS_URL_SCHEME "vnd.sun.star.webdavs"
 #define HTTP_URL_SCHEME              "http"
 #define HTTPS_URL_SCHEME             "https"
-#define DAV_URL_SCHEME               "dav"
-#define DAVS_URL_SCHEME              "davs"
+#define DAV_URL_SCHEME               u"dav"
+#define DAVS_URL_SCHEME              u"davs"
 #define WEBDAV_URL_SCHEME            "webdav"
 #define WEBDAVS_URL_SCHEME           "webdavs"
 


More information about the Libreoffice-commits mailing list