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

Caolán McNamara caolanm at redhat.com
Sun Jan 21 20:15:16 UTC 2018


 lotuswordpro/source/filter/bencont.cxx   |   14 ++++++--------
 lotuswordpro/source/filter/bento.hxx     |    2 +-
 lotuswordpro/source/filter/lwpgrfobj.cxx |   11 ++---------
 3 files changed, 9 insertions(+), 18 deletions(-)

New commits:
commit 430a56228ad50dde9399af30d638411380f93258
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 20 20:56:47 2018 +0000

    just return SvMemoryStream*
    
    Change-Id: I5c577984055e01f49c4e04685dc4df6672c8fc87
    Reviewed-on: https://gerrit.libreoffice.org/48255
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/lotuswordpro/source/filter/bencont.cxx b/lotuswordpro/source/filter/bencont.cxx
index d3c046882e0f..71eda29213bd 100644
--- a/lotuswordpro/source/filter/bencont.cxx
+++ b/lotuswordpro/source/filter/bencont.cxx
@@ -267,12 +267,11 @@ sal_uInt64 GetSvStreamSize(SvStream * pStream)
 *   Find hazily according to object ID
 *   @param  pObjectname - format as "GrXX,XXXXXXXX" wherein XX is high part of object ID, and XXXXXXXX is low part
 */
-void LtcBenContainer::CreateGraphicStream(SvStream * &pStream, const char *pObjectName)
+SvMemoryStream* LtcBenContainer::CreateGraphicStream(const char *pObjectName)
 {
     if (!pObjectName)
     {
-        pStream = nullptr;
-        return;
+        return nullptr;
     }
     // construct the string of property name
     char sSName[64]="";
@@ -301,8 +300,7 @@ void LtcBenContainer::CreateGraphicStream(SvStream * &pStream, const char *pObje
     // the 'D' stream is NULL or it has invalid length
     if (nLen <= 0)
     {
-        pStream = nullptr;
-        return;
+        return nullptr;
     }
 
     char * pBuf = new char[nLen];
@@ -310,13 +308,13 @@ void LtcBenContainer::CreateGraphicStream(SvStream * &pStream, const char *pObje
     char * pPointer = pBuf;
     if (xD)
     {
-        auto nRead = xD->ReadBytes(pPointer, nDLen);
+        xD->ReadBytes(pPointer, nDLen);
         xD.reset();
     }
     pPointer += nDLen;
     if (xS)
     {
-        auto nRead = xS->ReadBytes(pPointer, nLen - nDLen);
+        xS->ReadBytes(pPointer, nLen - nDLen);
         xS.reset();
     }
 
@@ -324,7 +322,7 @@ void LtcBenContainer::CreateGraphicStream(SvStream * &pStream, const char *pObje
     assert(pMemStream != nullptr);
     pMemStream->ObjectOwnsMemory(true);
 
-    pStream = pMemStream;
+    return pMemStream;
 }
 
 sal_uLong LtcBenContainer::remainingSize() const
diff --git a/lotuswordpro/source/filter/bento.hxx b/lotuswordpro/source/filter/bento.hxx
index 322653aee938..f1cd48b4abae 100644
--- a/lotuswordpro/source/filter/bento.hxx
+++ b/lotuswordpro/source/filter/bento.hxx
@@ -221,7 +221,7 @@ public: // Internal methods
 
     LtcUtBenValueStream * FindNextValueStreamWithPropertyName(const char * sPropertyName);
     LtcUtBenValueStream * FindValueStreamWithPropertyName(const char * sPropertyName);
-    void CreateGraphicStream(SvStream * &pStream,  const char *pObjectName);
+    SvMemoryStream* CreateGraphicStream(const char *pObjectName);
 
     sal_uLong GetSize() const { return m_ulLength; }
 private: // Data
diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx
index 5bcc918187d2..5731b34acdff 100644
--- a/lotuswordpro/source/filter/lwpgrfobj.cxx
+++ b/lotuswordpro/source/filter/lwpgrfobj.cxx
@@ -305,15 +305,13 @@ void LwpGraphicObject::CreateDrawObjects()
     if (ulRet != OpenStormBento::BenErr_OK)
         return;
 
-    SvStream* pDrawObjStream = nullptr;
-
     // get graphic object's bento object name
     LwpObjectID& rMyID = GetObjectID();
     std::string aGrfObjName;
     GetBentoNamebyID(rMyID,  aGrfObjName);
 
     // get bento stream by the name
-    pBentoContainer->CreateGraphicStream(pDrawObjStream, aGrfObjName.c_str());
+    SvStream* pDrawObjStream = pBentoContainer->CreateGraphicStream(aGrfObjName.c_str());
     if (pDrawObjStream)
     {
         LwpSdwFileLoader fileLoader(pDrawObjStream, this);
@@ -357,17 +355,13 @@ sal_uInt32 LwpGraphicObject::GetRawGrafData(sal_uInt8*& pGrafData)
             return 0;
     }
 
-    SvStream* pGrafStream = nullptr;
-
     // get graphic object's bento object name
     LwpObjectID& rMyID = GetObjectID();
     std::string aGrfObjName;
     GetBentoNamebyID(rMyID,  aGrfObjName);
 
     // get bento stream by the name
-    pBentoContainer->CreateGraphicStream(pGrafStream, aGrfObjName.c_str());
-    SvMemoryStream* pMemGrafStream = static_cast<SvMemoryStream*>(pGrafStream);
-
+    SvMemoryStream* pMemGrafStream = pBentoContainer->CreateGraphicStream(aGrfObjName.c_str());
     if (pMemGrafStream)
     {
         // read image data
@@ -376,7 +370,6 @@ sal_uInt32 LwpGraphicObject::GetRawGrafData(sal_uInt8*& pGrafData)
         pMemGrafStream->ReadBytes(pGrafData, nDataLen);
 
         delete pMemGrafStream;
-        pMemGrafStream = nullptr;
 
         return nDataLen;
     }


More information about the Libreoffice-commits mailing list