[Libreoffice-commits] core.git: 2 commits - svl/qa sw/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 3 19:58:52 UTC 2019


 svl/qa/unit/test_INetContentType.cxx |   12 ++++++------
 sw/source/filter/ww8/docxexport.cxx  |    7 +++----
 2 files changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 1f0c54c250c2390962105128dcf871aad0689323
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Dec 3 13:58:23 2019 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Dec 3 20:56:53 2019 +0100

    Adapt to C++20 deleted ostream << for sal_Unicode* (aka char16_t*)
    
    <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1423r3.html> "char8_t
    backward compatibility remediation", as implemented now by <https://gcc.gnu.org/
    git/?p=gcc.git;a=commit;h=0c5b35933e5b150df0ab487efb2f11ef5685f713> "libstdc++:
    P1423R3 char8_t remediation (2/4)" for -std=c++2a, deletes operator << overloads
    that would print a pointer rather than a (presumably expected) string.
    
    But here it should be fine to print pointers, esp. as there are null pointers
    involved.
    
    Change-Id: I62fad4cb9eaaa612989f035f686086ef29093d70
    Reviewed-on: https://gerrit.libreoffice.org/84351
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/svl/qa/unit/test_INetContentType.cxx b/svl/qa/unit/test_INetContentType.cxx
index e4a464e479f2..b68796726e0e 100644
--- a/svl/qa/unit/test_INetContentType.cxx
+++ b/svl/qa/unit/test_INetContentType.cxx
@@ -39,8 +39,8 @@ public:
 void Test::testBad() {
     OUString in("foo=bar");
     CPPUNIT_ASSERT_EQUAL(
-        static_cast<sal_Unicode const *>(nullptr),
-        INetMIME::scanContentType(in));
+        static_cast<void const *>(nullptr),
+        static_cast<void const *>(INetMIME::scanContentType(in)));
     OUString t;
     OUString s;
     INetContentTypeParameterList ps;
@@ -53,8 +53,8 @@ void Test::testBad() {
 void Test::testFull() {
     OUString in("foo/bar;baz=boz");
     CPPUNIT_ASSERT_EQUAL(
-        in.getStr() + in.getLength(),
-        INetMIME::scanContentType(in));
+        static_cast<void const *>(in.getStr() + in.getLength()),
+        static_cast<void const *>(INetMIME::scanContentType(in)));
     OUString t;
     OUString s;
     INetContentTypeParameterList ps;
@@ -69,8 +69,8 @@ void Test::testFull() {
 void Test::testFollow() {
     OUString in("foo/bar;baz=boz;base64,");
     CPPUNIT_ASSERT_EQUAL(
-        in.getStr() + std::strlen("foo/bar;baz=boz"),
-        INetMIME::scanContentType(in));
+        static_cast<void const *>(in.getStr() + std::strlen("foo/bar;baz=boz")),
+        static_cast<void const *>(INetMIME::scanContentType(in)));
     OUString t;
     OUString s;
     INetContentTypeParameterList ps;
commit 4e62db5876bac758904bb9fcc669f943a03d4c7a
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Dec 3 13:26:52 2019 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Dec 3 20:56:29 2019 +0100

    Use o3tl::doAccess, prevent -Werror=maybe-uninitialized
    
    Change-Id: I6a86db428dcf92083ee13298417b3d3027e45822
    Reviewed-on: https://gerrit.libreoffice.org/84338
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 2d04ac4986c0..94c1a6ad39d6 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -85,6 +85,7 @@
 #include <comphelper/processfactory.hxx>
 #include <comphelper/sequence.hxx>
 #include <comphelper/storagehelper.hxx>
+#include <o3tl/any.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <sal/log.hxx>
 #include <vcl/font.hxx>
@@ -1148,16 +1149,14 @@ void DocxExport::WriteSettings()
             }
             else if (rProp.Name == "HyphenationZone")
             {
-                sal_Int16 nHyphenationZone;
-                rProp.Value >>= nHyphenationZone;
+                sal_Int16 nHyphenationZone = *o3tl::doAccess<sal_Int16>(rProp.Value);
                 if (nHyphenationZone > 0)
                     pFS->singleElementNS(XML_w, XML_hyphenationZone, FSNS(XML_w, XML_val),
                                          OString::number(nHyphenationZone));
             }
             else if (rProp.Name == "NoHyphenateCaps")
             {
-                bool bNoHyphenateCaps;
-                rProp.Value >>= bNoHyphenateCaps;
+                bool bNoHyphenateCaps = *o3tl::doAccess<bool>(rProp.Value);
                 if (bNoHyphenateCaps)
                     pFS->singleElementNS(XML_w, XML_doNotHyphenateCaps);
             }


More information about the Libreoffice-commits mailing list