[Libreoffice-commits] core.git: 4 commits - include/oox oox/qa oox/source

Noel Grandin noel at peralex.com
Wed Sep 9 23:51:30 PDT 2015


 include/oox/ole/vbaexport.hxx   |    8 ++++----
 oox/qa/unit/vba_compression.cxx |   28 ++++++++++++++--------------
 oox/source/ole/vbaexport.cxx    |    4 ++--
 3 files changed, 20 insertions(+), 20 deletions(-)

New commits:
commit 7b8e8e5d809bf2e172a4af1654415055654e30c8
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Sep 10 08:50:19 2015 +0200

    loplugin:cstylecast
    
    Change-Id: I237ee6cf764d5bca9147e6d5e0bbb1162ece06ac

diff --git a/oox/qa/unit/vba_compression.cxx b/oox/qa/unit/vba_compression.cxx
index 0247fb9..72b7bb2 100644
--- a/oox/qa/unit/vba_compression.cxx
+++ b/oox/qa/unit/vba_compression.cxx
@@ -92,8 +92,8 @@ void TestVbaCompression::testSimple1()
 
     CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize());
 
-    const sal_uInt8* pReferenceData = (const sal_uInt8*) aReferenceMemoryStream.GetData();
-    const sal_uInt8* pData = (const sal_uInt8*)aOutputMemoryStream.GetData();
+    const sal_uInt8* pReferenceData = static_cast<const sal_uInt8*>( aReferenceMemoryStream.GetData() );
+    const sal_uInt8* pData = static_cast<const sal_uInt8*>( aOutputMemoryStream.GetData() );
 
     size_t nSize = std::min(aReferenceMemoryStream.GetSize(),
             aOutputMemoryStream.GetSize());
@@ -114,8 +114,8 @@ void TestVbaCompression::testSimple2()
 
     CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize());
 
-    const sal_uInt8* pReferenceData = (const sal_uInt8*) aReferenceMemoryStream.GetData();
-    const sal_uInt8* pData = (const sal_uInt8*)aOutputMemoryStream.GetData();
+    const sal_uInt8* pReferenceData = static_cast<const sal_uInt8*>( aReferenceMemoryStream.GetData() );
+    const sal_uInt8* pData = static_cast<const sal_uInt8*>( aOutputMemoryStream.GetData() );
 
     size_t nSize = std::min(aReferenceMemoryStream.GetSize(),
             aOutputMemoryStream.GetSize());
@@ -136,8 +136,8 @@ void TestVbaCompression::testSimple3()
 
     CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize());
 
-    const sal_uInt8* pReferenceData = (const sal_uInt8*) aReferenceMemoryStream.GetData();
-    const sal_uInt8* pData = (const sal_uInt8*)aOutputMemoryStream.GetData();
+    const sal_uInt8* pReferenceData = static_cast<const sal_uInt8*>( aReferenceMemoryStream.GetData()  );
+    const sal_uInt8* pData = static_cast<const sal_uInt8*>( aOutputMemoryStream.GetData() );
 
     size_t nSize = std::min(aReferenceMemoryStream.GetSize(),
             aOutputMemoryStream.GetSize());
@@ -158,8 +158,8 @@ void TestVbaCompression::testComplex1()
 
     CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize());
 
-    const sal_uInt8* pReferenceData = (const sal_uInt8*) aReferenceMemoryStream.GetData();
-    const sal_uInt8* pData = (const sal_uInt8*)aOutputMemoryStream.GetData();
+    const sal_uInt8* pReferenceData = static_cast<const sal_uInt8*>( aReferenceMemoryStream.GetData() );
+    const sal_uInt8* pData = static_cast<const sal_uInt8*>( aOutputMemoryStream.GetData() );
 
     size_t nSize = std::min(aReferenceMemoryStream.GetSize(),
             aOutputMemoryStream.GetSize());
@@ -180,8 +180,8 @@ void TestVbaCompression::testSpec321()
 
     CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize());
 
-    const sal_uInt8* pReferenceData = (const sal_uInt8*) aReferenceMemoryStream.GetData();
-    const sal_uInt8* pData = (const sal_uInt8*)aOutputMemoryStream.GetData();
+    const sal_uInt8* pReferenceData = static_cast<const sal_uInt8*>( aReferenceMemoryStream.GetData() );
+    const sal_uInt8* pData = static_cast<const sal_uInt8*>( aOutputMemoryStream.GetData() );
 
     size_t nSize = std::min(aReferenceMemoryStream.GetSize(),
             aOutputMemoryStream.GetSize());
@@ -202,8 +202,8 @@ void TestVbaCompression::testSpec322()
 
     CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize());
 
-    const sal_uInt8* pReferenceData = (const sal_uInt8*) aReferenceMemoryStream.GetData();
-    const sal_uInt8* pData = (const sal_uInt8*)aOutputMemoryStream.GetData();
+    const sal_uInt8* pReferenceData = static_cast<const sal_uInt8*>( aReferenceMemoryStream.GetData() );
+    const sal_uInt8* pData = static_cast<const sal_uInt8*>( aOutputMemoryStream.GetData() );
 
     size_t nSize = std::min(aReferenceMemoryStream.GetSize(),
             aOutputMemoryStream.GetSize());
@@ -224,8 +224,8 @@ void TestVbaCompression::testSpec323()
 
     CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize());
 
-    const sal_uInt8* pReferenceData = (const sal_uInt8*) aReferenceMemoryStream.GetData();
-    const sal_uInt8* pData = (const sal_uInt8*)aOutputMemoryStream.GetData();
+    const sal_uInt8* pReferenceData = static_cast<const sal_uInt8*>( aReferenceMemoryStream.GetData() );
+    const sal_uInt8* pData = static_cast<const sal_uInt8*>( aOutputMemoryStream.GetData() );
 
     size_t nSize = std::min(aReferenceMemoryStream.GetSize(),
             aOutputMemoryStream.GetSize());
commit 9e2628503db9641b722e3dd373845fd9b435a938
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Sep 10 08:47:37 2015 +0200

    loplugin:staticmethods
    
    Change-Id: Id9313d02fe6036ff8d8cf8142269ed9b4042051d

diff --git a/include/oox/ole/vbaexport.hxx b/include/oox/ole/vbaexport.hxx
index 69d34b1..7b5b916 100644
--- a/include/oox/ole/vbaexport.hxx
+++ b/include/oox/ole/vbaexport.hxx
@@ -74,17 +74,17 @@ private:
     // DecompressedEnd according to the spec
     sal_uInt64 mnDecompressedEnd;
 
-    void PackCompressedChunkSize(size_t nSize, sal_uInt16& rHeader);
+    static void PackCompressedChunkSize(size_t nSize, sal_uInt16& rHeader);
 
-    void PackCompressedChunkFlag(bool bCompressed, sal_uInt16& rHeader);
+    static void PackCompressedChunkFlag(bool bCompressed, sal_uInt16& rHeader);
 
-    void PackCompressedChunkSignature(sal_uInt16& rHeader);
+    static void PackCompressedChunkSignature(sal_uInt16& rHeader);
 
     void compressTokenSequence();
 
     void compressToken(size_t index, sal_uInt8& nFlagByte);
 
-    void SetFlagBit(size_t index, bool bVal, sal_uInt8& rFlag);
+    static void SetFlagBit(size_t index, bool bVal, sal_uInt8& rFlag);
 
     sal_uInt16 CopyToken(size_t nLength, size_t nOffset);
 
commit 40bc832ff31ae37784fd53c2b37689074f4cbeac
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Sep 10 08:46:37 2015 +0200

    loplugin:literaltoboolconversion
    
    Change-Id: I037b1978ddf69e4348913af1ccdc953a1e825d1e

diff --git a/oox/source/ole/vbaexport.cxx b/oox/source/ole/vbaexport.cxx
index 3f9690f..26af809 100644
--- a/oox/source/ole/vbaexport.cxx
+++ b/oox/source/ole/vbaexport.cxx
@@ -174,7 +174,7 @@ void VBACompressionChunk::compressToken(size_t index, sal_uInt8& nFlagByte)
         {
             sal_uInt16 nToken = CopyToken(nLength, nOffset);
             setUInt16(mpCompressedChunkStream, mnCompressedCurrent, nToken);
-            SetFlagBit(index, 1, nFlagByte);
+            SetFlagBit(index, true, nFlagByte);
             mnCompressedCurrent += 2;
             mnDecompressedCurrent += nLength;
         }
commit 24baf6c30e89244465f0b33d6b40b0773f932f95
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Sep 10 08:45:52 2015 +0200

    loplugin:cstylecast
    
    Change-Id: Id42868685afabd42854655cb2fc5a48f932c888a

diff --git a/oox/source/ole/vbaexport.cxx b/oox/source/ole/vbaexport.cxx
index 9b1e751..3f9690f 100644
--- a/oox/source/ole/vbaexport.cxx
+++ b/oox/source/ole/vbaexport.cxx
@@ -300,7 +300,7 @@ void VBACompression::write()
     // section 2.4.1.1.1
     mrCompressedStream.WriteUInt8(0x01); // signature byte of a compressed container
     bool bStreamNotEnded = true;
-    const sal_uInt8* pData = (const sal_uInt8*)mrUncompressedStream.GetData();
+    const sal_uInt8* pData = static_cast<const sal_uInt8*>(mrUncompressedStream.GetData());
     sal_Size nSize = mrUncompressedStream.GetEndOfData();
     sal_Size nRemainingSize = nSize;
     while(bStreamNotEnded)


More information about the Libreoffice-commits mailing list