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

David Tardon dtardon at redhat.com
Tue Feb 27 18:11:19 UTC 2018


 writerperfect/source/common/WPXSvInputStream.cxx             |   11 +-
 writerperfect/source/writer/exp/XMLFootnoteImportContext.cxx |   50 +++++------
 writerperfect/source/writer/exp/XMLFootnoteImportContext.hxx |   10 +-
 3 files changed, 37 insertions(+), 34 deletions(-)

New commits:
commit 4a731b030e21112f4a8aad10eda3ee2e263c881b
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Feb 27 19:09:12 2018 +0100

    astyle
    
    Change-Id: I3ea599f491a464458865ce42930be4728ede5dc9

diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx
index 83ea69cc348b..971280b8e25b 100644
--- a/writerperfect/source/common/WPXSvInputStream.cxx
+++ b/writerperfect/source/common/WPXSvInputStream.cxx
@@ -233,7 +233,7 @@ void OLEStorageImpl::traverse(const tools::SvRef<SotStorage> &rStorage, const rt
             if (!rvngName.isEmpty() && rvngName.toChar()<32)
                 rvngName=rvngName.copy(1);
             maStreams.emplace_back(rtl::OUStringToOString(concatPath(rPath, baseName), RTL_TEXTENCODING_UTF8),
-                                              rtl::OUStringToOString(concatPath(rPath, rvngName), RTL_TEXTENCODING_UTF8));
+                                   rtl::OUStringToOString(concatPath(rPath, rvngName), RTL_TEXTENCODING_UTF8));
             maNameMap[concatPath(rPath, rvngName)] = maStreams.size() - 1;
         }
         else if (aIt->IsStorage())
@@ -308,7 +308,7 @@ struct ZipStorageImpl
     void initialize();
 
     Reference<XInputStream> getStream(const rtl::OUString &rPath);
-    Reference<XInputStream> const & getStream(std::size_t nId);
+    Reference<XInputStream> const &getStream(std::size_t nId);
 
 private:
     void traverse(const Reference<container::XNameAccess> &rxEnum);
@@ -361,7 +361,7 @@ Reference<XInputStream> ZipStorageImpl::getStream(const rtl::OUString &rPath)
     return maStreams[aIt->second].xStream;
 }
 
-Reference<XInputStream> const & ZipStorageImpl::getStream(const std::size_t nId)
+Reference<XInputStream> const &ZipStorageImpl::getStream(const std::size_t nId)
 {
     if (!maStreams[nId].xStream.is())
         maStreams[nId].xStream = createStream(rtl::OStringToOUString(maStreams[nId].aName, RTL_TEXTENCODING_UTF8));
diff --git a/writerperfect/source/writer/exp/XMLFootnoteImportContext.cxx b/writerperfect/source/writer/exp/XMLFootnoteImportContext.cxx
index e23f60932773..f8ac4d1bb082 100644
--- a/writerperfect/source/writer/exp/XMLFootnoteImportContext.cxx
+++ b/writerperfect/source/writer/exp/XMLFootnoteImportContext.cxx
@@ -22,29 +22,29 @@ namespace exp
 class XMLTextNoteCitationContext : public XMLImportContext
 {
 public:
-    XMLTextNoteCitationContext(XMLImport& rImport, librevenge::RVNGPropertyList& rProperties);
+    XMLTextNoteCitationContext(XMLImport &rImport, librevenge::RVNGPropertyList &rProperties);
 
-    void SAL_CALL characters(const OUString& rCharacters) override;
-    void SAL_CALL endElement(const OUString& rName) override;
+    void SAL_CALL characters(const OUString &rCharacters) override;
+    void SAL_CALL endElement(const OUString &rName) override;
 
 private:
-    librevenge::RVNGPropertyList& m_rProperties;
+    librevenge::RVNGPropertyList &m_rProperties;
     OUString m_aCharacters;
 };
 
-XMLTextNoteCitationContext::XMLTextNoteCitationContext(XMLImport& rImport,
-                                                       librevenge::RVNGPropertyList& rProperties)
+XMLTextNoteCitationContext::XMLTextNoteCitationContext(XMLImport &rImport,
+                                                       librevenge::RVNGPropertyList &rProperties)
     : XMLImportContext(rImport)
     , m_rProperties(rProperties)
 {
 }
 
-void XMLTextNoteCitationContext::endElement(const OUString& /*rName*/)
+void XMLTextNoteCitationContext::endElement(const OUString & /*rName*/)
 {
     m_rProperties.insert("librevenge:number", m_aCharacters.toUtf8().getStr());
 }
 
-void XMLTextNoteCitationContext::characters(const OUString& rCharacters)
+void XMLTextNoteCitationContext::characters(const OUString &rCharacters)
 {
     m_aCharacters += rCharacters;
 }
@@ -53,54 +53,54 @@ void XMLTextNoteCitationContext::characters(const OUString& rCharacters)
 class XMLFootnoteBodyImportContext : public XMLImportContext
 {
 public:
-    XMLFootnoteBodyImportContext(XMLImport& rImport,
-                                 const librevenge::RVNGPropertyList& rProperties);
+    XMLFootnoteBodyImportContext(XMLImport &rImport,
+                                 const librevenge::RVNGPropertyList &rProperties);
 
     rtl::Reference<XMLImportContext>
-    CreateChildContext(const OUString& rName,
-                       const css::uno::Reference<css::xml::sax::XAttributeList>& xAttribs) override;
+    CreateChildContext(const OUString &rName,
+                       const css::uno::Reference<css::xml::sax::XAttributeList> &xAttribs) override;
 
     void SAL_CALL
-    startElement(const OUString& rName,
-                 const css::uno::Reference<css::xml::sax::XAttributeList>& xAttribs) override;
-    void SAL_CALL endElement(const OUString& rName) override;
+    startElement(const OUString &rName,
+                 const css::uno::Reference<css::xml::sax::XAttributeList> &xAttribs) override;
+    void SAL_CALL endElement(const OUString &rName) override;
 
 private:
-    const librevenge::RVNGPropertyList& m_rProperties;
+    const librevenge::RVNGPropertyList &m_rProperties;
 };
 
 XMLFootnoteBodyImportContext::XMLFootnoteBodyImportContext(
-    XMLImport& rImport, const librevenge::RVNGPropertyList& rProperties)
+    XMLImport &rImport, const librevenge::RVNGPropertyList &rProperties)
     : XMLImportContext(rImport)
     , m_rProperties(rProperties)
 {
 }
 
 rtl::Reference<XMLImportContext> XMLFootnoteBodyImportContext::CreateChildContext(
-    const OUString& rName, const css::uno::Reference<css::xml::sax::XAttributeList>& /*xAttribs*/)
+    const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> & /*xAttribs*/)
 {
     return CreateTextChildContext(mrImport, rName);
 }
 
 void XMLFootnoteBodyImportContext::startElement(
-    const OUString& /*rName*/,
-    const css::uno::Reference<css::xml::sax::XAttributeList>& /*xAttribs*/)
+    const OUString & /*rName*/,
+    const css::uno::Reference<css::xml::sax::XAttributeList> & /*xAttribs*/)
 {
     mrImport.GetGenerator().openFootnote(m_rProperties);
 }
 
-void XMLFootnoteBodyImportContext::endElement(const OUString& /*rName*/)
+void XMLFootnoteBodyImportContext::endElement(const OUString & /*rName*/)
 {
     mrImport.GetGenerator().closeFootnote();
 }
 
-XMLFootnoteImportContext::XMLFootnoteImportContext(XMLImport& rImport)
+XMLFootnoteImportContext::XMLFootnoteImportContext(XMLImport &rImport)
     : XMLImportContext(rImport)
 {
 }
 
 rtl::Reference<XMLImportContext> XMLFootnoteImportContext::CreateChildContext(
-    const OUString& rName, const css::uno::Reference<css::xml::sax::XAttributeList>& /*xAttribs*/)
+    const OUString &rName, const css::uno::Reference<css::xml::sax::XAttributeList> & /*xAttribs*/)
 {
     if (rName == "text:note-citation")
         return new XMLTextNoteCitationContext(mrImport, m_aProperties);
@@ -111,8 +111,8 @@ rtl::Reference<XMLImportContext> XMLFootnoteImportContext::CreateChildContext(
 }
 
 void XMLFootnoteImportContext::startElement(
-    const OUString& /*rName*/,
-    const css::uno::Reference<css::xml::sax::XAttributeList>& /*xAttribs*/)
+    const OUString & /*rName*/,
+    const css::uno::Reference<css::xml::sax::XAttributeList> & /*xAttribs*/)
 {
 }
 } // namespace exp
diff --git a/writerperfect/source/writer/exp/XMLFootnoteImportContext.hxx b/writerperfect/source/writer/exp/XMLFootnoteImportContext.hxx
index 22594f2ddd76..489288a6387f 100644
--- a/writerperfect/source/writer/exp/XMLFootnoteImportContext.hxx
+++ b/writerperfect/source/writer/exp/XMLFootnoteImportContext.hxx
@@ -24,15 +24,15 @@ namespace exp
 class XMLFootnoteImportContext : public XMLImportContext
 {
 public:
-    XMLFootnoteImportContext(XMLImport& rImport);
+    XMLFootnoteImportContext(XMLImport &rImport);
 
     rtl::Reference<XMLImportContext>
-    CreateChildContext(const OUString& rName,
-                       const css::uno::Reference<css::xml::sax::XAttributeList>& xAttribs) override;
+    CreateChildContext(const OUString &rName,
+                       const css::uno::Reference<css::xml::sax::XAttributeList> &xAttribs) override;
 
     void SAL_CALL
-    startElement(const OUString& rName,
-                 const css::uno::Reference<css::xml::sax::XAttributeList>& xAttribs) override;
+    startElement(const OUString &rName,
+                 const css::uno::Reference<css::xml::sax::XAttributeList> &xAttribs) override;
 
 private:
     librevenge::RVNGPropertyList m_aProperties;
commit 9534a8fe3e84bfcc7d0d2addac4dd8cd96746d99
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Feb 27 17:47:19 2018 +0100

    set number of read bytes correctly
    
    It was wrong if we read less than was expected.
    
    Thanks to Antti Levomäki and Christian Jalio from Forcepoint.
    
    Change-Id: I070c1731d1aace4c101fa01efed0c28734c44899

diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx
index c44175e5f485..83ea69cc348b 100644
--- a/writerperfect/source/common/WPXSvInputStream.cxx
+++ b/writerperfect/source/common/WPXSvInputStream.cxx
@@ -877,7 +877,10 @@ const unsigned char *WPXSvInputStream::read(unsigned long numBytes, unsigned lon
     if (!mpImpl->mnReadBufferLength)
         return nullptr;
 
-    numBytesRead = numBytes;
+    if (numBytes <= mpImpl->mnReadBufferLength)
+        numBytesRead = numBytes;
+    else
+        numBytesRead = mpImpl->mnReadBufferLength;
 
     mpImpl->mnReadBufferPos += numBytesRead;
     return mpImpl->mpReadBuffer;


More information about the Libreoffice-commits mailing list