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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 30 05:41:02 UTC 2020


 writerperfect/source/common/DocumentHandler.cxx |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit dab8e9f7a8f70a72040e2df9bb69361c3e355e6b
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Wed Apr 29 19:15:16 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Apr 30 07:40:28 2020 +0200

    no need to use strlen here
    
    since librevenge's string class already has the length
    
    Change-Id: I194ae49596dacc1205bdfb10d0a6a1833914f884
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93171
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/writerperfect/source/common/DocumentHandler.cxx b/writerperfect/source/common/DocumentHandler.cxx
index 869955aead67..35aa49181313 100644
--- a/writerperfect/source/common/DocumentHandler.cxx
+++ b/writerperfect/source/common/DocumentHandler.cxx
@@ -136,8 +136,7 @@ void DocumentHandler::startElement(const char* psName,
         {
             size_t keyLength = strlen(i.key());
             OUString sName(i.key(), keyLength, RTL_TEXTENCODING_UTF8);
-            OUString sValue(i()->getStr().cstr(), strlen(i()->getStr().cstr()),
-                            RTL_TEXTENCODING_UTF8);
+            OUString sValue(i()->getStr().cstr(), i()->getStr().len(), RTL_TEXTENCODING_UTF8);
 
             // libodfgen xml-encodes some attribute's value, so check if the value is encoded or not
             for (int j = 0; j < 9; ++j)
@@ -153,10 +152,9 @@ void DocumentHandler::startElement(const char* psName,
                 {
                     librevenge::RVNGString decodedValue("");
                     unescapeXML(i()->getStr().cstr(),
-                                static_cast<unsigned long>(strlen(i()->getStr().cstr())),
-                                decodedValue);
-                    sValue = OUString(decodedValue.cstr(), strlen(decodedValue.cstr()),
-                                      RTL_TEXTENCODING_UTF8);
+                                static_cast<unsigned long>(i()->getStr().len()), decodedValue);
+                    sValue
+                        = OUString(decodedValue.cstr(), decodedValue.len(), RTL_TEXTENCODING_UTF8);
                     break;
                 }
             }


More information about the Libreoffice-commits mailing list