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

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


 lotuswordpro/inc/lwpsvstream.hxx           |    4 +--
 lotuswordpro/source/filter/bencont.cxx     |   11 ++++------
 lotuswordpro/source/filter/bento.hxx       |   31 ++++++++++++++---------------
 lotuswordpro/source/filter/benval.cxx      |   16 +++++++-------
 lotuswordpro/source/filter/lwpsvstream.cxx |    2 -
 lotuswordpro/source/filter/tocread.cxx     |    4 +--
 lotuswordpro/source/filter/utbenvs.cxx     |    5 ----
 7 files changed, 34 insertions(+), 39 deletions(-)

New commits:
commit 6a0fb0debf67e63e0b52f3a8255773679c254c4e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 20 20:42:37 2018 +0000

    align types
    
    Change-Id: I6080d92ec26f9ee9bf3eb4319a36c10ae38caca2
    Reviewed-on: https://gerrit.libreoffice.org/48253
    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/inc/lwpsvstream.hxx b/lotuswordpro/inc/lwpsvstream.hxx
index d39aee929e7b..7b119403d761 100644
--- a/lotuswordpro/inc/lwpsvstream.hxx
+++ b/lotuswordpro/inc/lwpsvstream.hxx
@@ -67,8 +67,8 @@ class LwpSvStream
 {
 public:
     LwpSvStream(SvStream* pStream, LwpSvStream * pCompressed = nullptr);
-    sal_Int32 Read( void* bytes, sal_Int32 nBytesToRead );
-    void SeekRel( sal_Int64 pos );
+    size_t Read(void* bytes, size_t nBytesToRead);
+    void SeekRel(sal_Int64 pos);
     sal_Int64 Tell();
     sal_Int64 Seek(sal_Int64 pos);
     bool CheckSeek(sal_Int64 pos);
diff --git a/lotuswordpro/source/filter/bencont.cxx b/lotuswordpro/source/filter/bencont.cxx
index 7340f046fa53..6a03ba73a8f3 100644
--- a/lotuswordpro/source/filter/bencont.cxx
+++ b/lotuswordpro/source/filter/bencont.cxx
@@ -170,8 +170,8 @@ LtcBenContainer::LtcBenContainer(LwpSvStream * pStream)
 *   @param  number of bytes read
 *   @return BenError
 */
-BenError LtcBenContainer::Read(void * pBuffer, unsigned long MaxSize,
-  unsigned long * pAmtRead)
+BenError LtcBenContainer::Read(void * pBuffer, size_t MaxSize,
+  size_t* pAmtRead)
 {
     *pAmtRead = cpStream->Read(pBuffer, MaxSize);
     return BenErr_OK;
@@ -182,11 +182,10 @@ BenError LtcBenContainer::Read(void * pBuffer, unsigned long MaxSize,
 *   @param  number of bytes to be read
 *   @return BenError
 */
-BenError LtcBenContainer::ReadKnownSize(void * pBuffer, unsigned long Amt)
+BenError LtcBenContainer::ReadKnownSize(void * pBuffer, size_t Amt)
 {
-    sal_uLong ulLength;
-    ulLength = cpStream->Read(pBuffer, Amt);
-    if(ulLength == Amt)
+    size_t ulLength = cpStream->Read(pBuffer, Amt);
+    if (ulLength == Amt)
     {
         return BenErr_OK;
     }
diff --git a/lotuswordpro/source/filter/bento.hxx b/lotuswordpro/source/filter/bento.hxx
index 069a408cbc5d..322653aee938 100644
--- a/lotuswordpro/source/filter/bento.hxx
+++ b/lotuswordpro/source/filter/bento.hxx
@@ -128,13 +128,13 @@ class CBenValueSegment;
 class CBenNamedObject;
 class CBenPropertyName;
 
-typedef unsigned char BenByte;
-typedef unsigned short BenWord;
-typedef unsigned long BenDWord;
+typedef sal_uInt8 BenByte;
+typedef sal_uInt16 BenWord;
+typedef sal_uInt32 BenDWord;
 
-typedef unsigned long BenContainerPos;
-typedef unsigned long BenObjectID;
-typedef unsigned long BenGeneration;
+typedef sal_uInt32 BenContainerPos;
+typedef sal_uInt32 BenObjectID;
+typedef sal_uInt32 BenGeneration;
 
 sal_uLong BenOpenContainer(LwpSvStream * pStream, LtcBenContainer ** ppContainer);
 
@@ -187,10 +187,9 @@ protected: // Overridden methods
 
 private: // Data
     CBenValue * cpValue;
-    unsigned long cCurrentPosition;
+    size_t cCurrentPosition;
 
     sal_uLong m_ulValueLength;      // Added by , sum of length of all sub-valuesegments
-//  void    GetAmountLeft(sal_uLong * pAmtLeft);    useless in SODC
 };
 
 class LtcBenContainer
@@ -210,9 +209,9 @@ public: // Internal methods
     ~LtcBenContainer();
 
     sal_uLong remainingSize() const;
-    BenError Read(void * pBuffer, unsigned long MaxSize,
-      unsigned long * pAmtRead);
-    BenError ReadKnownSize(void * pBuffer, unsigned long Amt);
+    BenError Read(void * pBuffer, size_t MaxSize,
+      size_t* pAmtRead);
+    BenError ReadKnownSize(void * pBuffer, size_t Amt);
     BenError SeekToPosition(BenContainerPos Pos);
     BenError SeekFromEnd(long Offset);
 
@@ -253,9 +252,9 @@ private: // Data
 class CBenValue : public CBenIDListElmt
 {
 public:
-    unsigned long GetValueSize();
+    size_t GetValueSize();
     void ReadValueData(void * pBuffer,
-      unsigned long Offset, unsigned long MaxSize, unsigned long * pAmtRead);
+      size_t Offset, size_t MaxSize, size_t* pAmtRead);
 
     CBenProperty * BEN_EXPORT GetProperty() { return cpProperty; }
 
@@ -309,7 +308,7 @@ class CBenValueSegment : public CUtListElmt
 {
 public: // Internal methods
     CBenValueSegment(CBenValue * pValue, BenContainerPos Pos,
-      unsigned long Size) : CUtListElmt(&pValue->GetValueSegments())
+      size_t Size) : CUtListElmt(&pValue->GetValueSegments())
       { cpValue = pValue; cImmediate = false; cPos = Pos;
       cSize = Size; }
     CBenValueSegment(CBenValue * pValue, const void  * pImmData,
@@ -318,7 +317,7 @@ public: // Internal methods
       std::memcpy(cImmData, pImmData, Size); cSize = Size; }
     bool IsImmediate() { return cImmediate; }
     BenContainerPos GetPosition() { return cPos; }
-    unsigned long GetSize() { return cSize; }
+    size_t GetSize() { return cSize; }
     BenByte * GetImmediateData() { return cImmData; }
 
 private: // Data
@@ -329,7 +328,7 @@ private: // Data
         BenContainerPos cPos;
         BenByte cImmData[4];
     };
-    unsigned long cSize;
+    size_t cSize;
 };
 
 inline CBenValueSegment * CBenValue::GetNextValueSegment(CBenValueSegment const *
diff --git a/lotuswordpro/source/filter/benval.cxx b/lotuswordpro/source/filter/benval.cxx
index 9ccc1a2efe09..9cd7404f996d 100644
--- a/lotuswordpro/source/filter/benval.cxx
+++ b/lotuswordpro/source/filter/benval.cxx
@@ -64,10 +64,10 @@
 namespace OpenStormBento
 {
 
-unsigned long
+size_t
 CBenValue::GetValueSize()
 {
-    unsigned long Size = 0;
+    size_t Size = 0;
     CBenValueSegment * pCurr = nullptr;
     while ((pCurr = GetNextValueSegment(pCurr)) != nullptr)
         Size += pCurr->GetSize();
@@ -75,11 +75,11 @@ CBenValue::GetValueSize()
 }
 
 void
-CBenValue::ReadValueData(void * pReadBuffer, unsigned long Offset,
-  unsigned long Amt, unsigned long * pAmtRead)
+CBenValue::ReadValueData(void * pReadBuffer, size_t Offset,
+  size_t Amt, size_t* pAmtRead)
 {
     BenError Err;
-    unsigned long SegOffset = 0;
+    size_t SegOffset = 0;
     *pAmtRead = 0;
     CBenValueSegment * pCurrSeg = nullptr;
     LtcBenContainer * pContainer = GetProperty()->GetContainer();
@@ -99,13 +99,13 @@ CBenValue::ReadValueData(void * pReadBuffer, unsigned long Offset,
 
         if (SegOffset <= Offset && Offset < SegOffset + pCurrSeg->GetSize()) /// begin at current segment
         {
-            unsigned long OffsetIntoSeg = Offset - SegOffset;  /// relative value in this value segment stream
+            size_t OffsetIntoSeg = Offset - SegOffset;  /// relative value in this value segment stream
 
-            unsigned long AmtThisSeg = std::min(Amt, pCurrSeg->GetSize() -
+            size_t AmtThisSeg = std::min(Amt, pCurrSeg->GetSize() -
                 OffsetIntoSeg);           /// size read in this segment, it's minimal value between Amt &
                                           /// remain part from OffsetIntoSeg to the end of this segment
 
-            unsigned long AmtReadThisSeg; /// actual read size in this segment
+            size_t AmtReadThisSeg; /// actual read size in this segment
             if (pCurrSeg->IsImmediate())
             {
                 std::memcpy(pBuffer, pCurrSeg->GetImmediateData() +
diff --git a/lotuswordpro/source/filter/lwpsvstream.cxx b/lotuswordpro/source/filter/lwpsvstream.cxx
index 723d8c333a54..4ab5c03c4251 100644
--- a/lotuswordpro/source/filter/lwpsvstream.cxx
+++ b/lotuswordpro/source/filter/lwpsvstream.cxx
@@ -66,7 +66,7 @@ LwpSvStream::LwpSvStream(SvStream* pStream, LwpSvStream * pCompressed)
 /**
  * @descr       read nBytesToRead bytes to buf
 */
-sal_Int32 LwpSvStream::Read(void* buf, sal_Int32 nBytesToRead)
+size_t LwpSvStream::Read(void* buf, size_t nBytesToRead)
 {
     return m_pStream->ReadBytes(buf, nBytesToRead);
 }
diff --git a/lotuswordpro/source/filter/tocread.cxx b/lotuswordpro/source/filter/tocread.cxx
index fcbd329380d6..e6af6f42e8f1 100644
--- a/lotuswordpro/source/filter/tocread.cxx
+++ b/lotuswordpro/source/filter/tocread.cxx
@@ -256,7 +256,7 @@ CBenTOCReader::ReadTOC()
                         return BenErr_NamedObjectError;
 
                     BenContainerPos Pos;
-                    unsigned long Length;
+                    sal_uInt32 Length;
 
                     if ((Err = GetDWord(&Pos)) != BenErr_OK)
                         return Err;
@@ -393,7 +393,7 @@ CBenTOCReader::ReadSegment(CBenValue * pValue, BenByte * pLookAhead)
 
     bool Immediate = false;
     bool EightByteOffset = false;
-    unsigned long Offset(0), Length(0);
+    sal_uInt32 Offset(0), Length(0);
 
     switch (*pLookAhead)
     {
diff --git a/lotuswordpro/source/filter/utbenvs.cxx b/lotuswordpro/source/filter/utbenvs.cxx
index aac43171f8cd..dc508c168664 100644
--- a/lotuswordpro/source/filter/utbenvs.cxx
+++ b/lotuswordpro/source/filter/utbenvs.cxx
@@ -65,11 +65,8 @@ namespace OpenStormBento
 */
 std::size_t LtcUtBenValueStream::GetData(void* pData, std::size_t nSize)
 {
-    //unsigned long AmtLeft;
-    unsigned long AmtRead;
-    //GetAmountLeft(&AmtLeft);
+    size_t AmtRead;
 
-    //unsigned long AmtShouldRead = UtMin(nSize, AmtLeft);
     /*BenError Err = */cpValue->ReadValueData(pData, cCurrentPosition, nSize,
       &AmtRead);
     cCurrentPosition += AmtRead;


More information about the Libreoffice-commits mailing list