[Libreoffice-commits] core.git: 3 commits - include/svl lotuswordpro/source package/inc package/source svl/source unusedcode.easy

Caolán McNamara caolanm at redhat.com
Fri Dec 12 03:49:39 PST 2014


 include/svl/style.hxx                       |   11 +--
 include/svl/zforlist.hxx                    |   12 ++-
 lotuswordpro/source/filter/lwpsvstream.cxx  |   18 -----
 lotuswordpro/source/filter/lwpsvstream.hxx  |    4 -
 package/inc/ByteChucker.hxx                 |   37 +++++++++--
 package/inc/ByteGrabber.hxx                 |   16 +++-
 package/source/zipapi/ByteChucker.cxx       |   47 --------------
 package/source/zipapi/ByteGrabber.cxx       |   90 ++++------------------------
 package/source/zipapi/MemoryByteGrabber.hxx |   79 ++++++++++--------------
 package/source/zipapi/ZipFile.cxx           |   87 ++++++++++++---------------
 svl/source/items/style.cxx                  |    6 -
 svl/source/numbers/zforlist.cxx             |    6 -
 unusedcode.easy                             |    1 
 13 files changed, 144 insertions(+), 270 deletions(-)

New commits:
commit efa5db0755f0a0af41b9958ef3d5edeaddaed056
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Dec 12 09:46:25 2014 +0000

    leave this Clone as inline
    
    so code isn't generated for it unless the new_clone is required,
    which it isn't under gcc.
    
    Change-Id: I07e0b3e4b2e07625509b51ba7d37e24440f56cfe

diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx
index 4b06d40..e2df52d 100644
--- a/include/svl/zforlist.hxx
+++ b/include/svl/zforlist.hxx
@@ -255,7 +255,7 @@ public:
                                          sal_Unicode cZero );
                         ~NfCurrencyEntry() {}
 
-    NfCurrencyEntry* Clone() const;
+    inline NfCurrencyEntry* Clone() const;
 
                         /// Symbols and language identical
     bool                operator==( const NfCurrencyEntry& r ) const;
@@ -305,9 +305,15 @@ public:
 };
 
 /**
- * Necessary for ptr_vector on Windows. Please don't remove this, or at
- * least check it on Windows before attempting to remove it.
+ * Necessary for ptr_vector on Windows. Please don't remove these, or at
+ * least check it on Windows before attempting to remove them.
  */
+NfCurrencyEntry* NfCurrencyEntry::Clone() const
+{
+    return new NfCurrencyEntry(
+       aSymbol, aBankSymbol, eLanguage, nPositiveFormat, nNegativeFormat, nDigits, cZeroChar);
+}
+
 inline NfCurrencyEntry* new_clone( const NfCurrencyEntry& r )
 {
     return r.Clone();
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index b9672a0..cb7af29 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -3837,12 +3837,6 @@ NfCurrencyEntry::NfCurrencyEntry(
     nPositiveFormat(nPositiveFmt), nNegativeFormat(nNegativeFmt),
     nDigits(nDig), cZeroChar(cZero) {}
 
-NfCurrencyEntry* NfCurrencyEntry::Clone() const
-{
-    return new NfCurrencyEntry(
-       aSymbol, aBankSymbol, eLanguage, nPositiveFormat, nNegativeFormat, nDigits, cZeroChar);
-}
-
 bool NfCurrencyEntry::operator==( const NfCurrencyEntry& r ) const
 {
     return aSymbol      == r.aSymbol
diff --git a/unusedcode.easy b/unusedcode.easy
index ee18f77..0c3074a 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -8,7 +8,6 @@ GDriveSession::GDriveSession()
 ImpBitmap::ImplCrop(Rectangle const&)
 ImpBitmap::ImplErase(Color const&)
 ImpBitmap::ImplSetSalBitmap(SalBitmap*)
-NfCurrencyEntry::Clone() const
 OpenGLContext::init(_XDisplay*, unsigned long, unsigned int, unsigned int, int)
 OpenGLContext::renderToFile()
 OpenGLContext::requestSingleBufferedRendering()
commit 2c2e80da68efcee5bffdb61d9c078f9360a639a4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Dec 12 09:42:47 2014 +0000

    callcatcher: remove newly unused code
    
    and rework reads to just return the read value
    
    Change-Id: I5d2f01064465c65859ec4ba031ec9dfa16403487

diff --git a/lotuswordpro/source/filter/lwpsvstream.cxx b/lotuswordpro/source/filter/lwpsvstream.cxx
index b65696f..e49b8b1 100644
--- a/lotuswordpro/source/filter/lwpsvstream.cxx
+++ b/lotuswordpro/source/filter/lwpsvstream.cxx
@@ -88,24 +88,6 @@ LwpSvStream& LwpSvStream::ReadUInt32( sal_uInt32& rUInt32 )
     return *this;
 }
 
-LwpSvStream& LwpSvStream::ReadInt8( sal_Int8& rInt8 )
-{
-    m_pStream->ReadSChar( rInt8 );
-    return *this;
-}
-
-LwpSvStream& LwpSvStream::ReadInt16( sal_Int16& rInt16 )
-{
-    m_pStream->ReadInt16( rInt16 );
-    return *this;
-}
-
-LwpSvStream& LwpSvStream::ReadInt32( sal_Int32& rInt32 )
-{
-    m_pStream->ReadInt32( rInt32 );
-    return *this;
-}
-
 /**
  * @descr       SeekRel in stream
 */
diff --git a/lotuswordpro/source/filter/lwpsvstream.hxx b/lotuswordpro/source/filter/lwpsvstream.hxx
index 0917cd4..40cb435 100644
--- a/lotuswordpro/source/filter/lwpsvstream.hxx
+++ b/lotuswordpro/source/filter/lwpsvstream.hxx
@@ -76,10 +76,6 @@ public:
     LwpSvStream& ReadUInt16( sal_uInt16& rUInt16 );
     LwpSvStream& ReadUInt32( sal_uInt32& rUInt32 );
 
-    LwpSvStream& ReadInt8( sal_Int8& rInt8 );
-    LwpSvStream& ReadInt16( sal_Int16& rInt16 );
-    LwpSvStream& ReadInt32( sal_Int32& rInt32 );
-
     static const sal_uInt32 LWP_STREAM_BASE;
 
     LwpSvStream * GetCompressedStream()
diff --git a/package/inc/ByteChucker.hxx b/package/inc/ByteChucker.hxx
index 7e3e60c..e317e8a 100644
--- a/package/inc/ByteChucker.hxx
+++ b/package/inc/ByteChucker.hxx
@@ -48,12 +48,37 @@ public:
     sal_Int64 GetPosition()
         throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
 
-    ByteChucker& WriteInt8(sal_Int8 nInt8);
-    ByteChucker& WriteInt16(sal_Int16 nInt16);
-    ByteChucker& WriteInt32(sal_Int32 nInt32);
-    ByteChucker& WriteUInt8(sal_uInt8 nuInt8);
-    ByteChucker& WriteUInt16(sal_uInt16 nuInt16);
-    ByteChucker& WriteUInt32(sal_uInt32 nuInt32);
+    void WriteInt16(sal_Int16 nInt16)
+    {
+        p2Sequence[0] = static_cast< sal_Int8 >((nInt16 >>  0 ) & 0xFF);
+        p2Sequence[1] = static_cast< sal_Int8 >((nInt16 >>  8 ) & 0xFF);
+        WriteBytes( a2Sequence );
+    }
+
+    void WriteInt32(sal_Int32 nInt32)
+    {
+        p4Sequence[0] = static_cast< sal_Int8 >((nInt32 >>  0 ) & 0xFF);
+        p4Sequence[1] = static_cast< sal_Int8 >((nInt32 >>  8 ) & 0xFF);
+        p4Sequence[2] = static_cast< sal_Int8 >((nInt32 >> 16 ) & 0xFF);
+        p4Sequence[3] = static_cast< sal_Int8 >((nInt32 >> 24 ) & 0xFF);
+        WriteBytes( a4Sequence );
+    }
+
+    void WriteUInt16(sal_uInt16 nuInt16)
+    {
+        p2Sequence[0] = static_cast< sal_Int8 >((nuInt16 >>  0 ) & 0xFF);
+        p2Sequence[1] = static_cast< sal_Int8 >((nuInt16 >>  8 ) & 0xFF);
+        WriteBytes( a2Sequence );
+    }
+
+    void WriteUInt32(sal_uInt32 nuInt32)
+    {
+        p4Sequence[0] = static_cast < sal_Int8 > ((nuInt32 >>  0 ) & 0xFF);
+        p4Sequence[1] = static_cast < sal_Int8 > ((nuInt32 >>  8 ) & 0xFF);
+        p4Sequence[2] = static_cast < sal_Int8 > ((nuInt32 >> 16 ) & 0xFF);
+        p4Sequence[3] = static_cast < sal_Int8 > ((nuInt32 >> 24 ) & 0xFF);
+        WriteBytes( a4Sequence );
+    }
 };
 
 #endif
diff --git a/package/inc/ByteGrabber.hxx b/package/inc/ByteGrabber.hxx
index 26df1b1..2791e0b 100644
--- a/package/inc/ByteGrabber.hxx
+++ b/package/inc/ByteGrabber.hxx
@@ -58,12 +58,16 @@ public:
     sal_Int64 SAL_CALL getLength(  )
         throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
 
-    ByteGrabber& ReadInt8(sal_Int8& rInt8);
-    ByteGrabber& ReadInt16(sal_Int16& rInt16);
-    ByteGrabber& ReadInt32(sal_Int32& rInt32);
-    ByteGrabber& ReadUInt8(sal_uInt8& ruInt8);
-    ByteGrabber& ReadUInt16(sal_uInt16& ruInt16);
-    ByteGrabber& ReadUInt32(sal_uInt32& ruInt32);
+    sal_uInt16 ReadUInt16();
+    sal_uInt32 ReadUInt32();
+    sal_Int16 ReadInt16()
+    {
+        return static_cast<sal_Int16>(ReadUInt16());
+    }
+    sal_Int32 ReadInt32()
+    {
+        return static_cast<sal_Int32>(ReadUInt32());
+    }
 };
 
 #endif
diff --git a/package/source/zipapi/ByteChucker.cxx b/package/source/zipapi/ByteChucker.cxx
index 5bcf642..8354c7c 100644
--- a/package/source/zipapi/ByteChucker.cxx
+++ b/package/source/zipapi/ByteChucker.cxx
@@ -54,51 +54,4 @@ sal_Int64 ByteChucker::GetPosition(  )
     return xSeek->getPosition();
 }
 
-ByteChucker& ByteChucker::WriteInt8(sal_Int8 nInt8)
-{
-    p1Sequence[0] = nInt8  & 0xFF;
-    WriteBytes( a1Sequence );
-    return *this;
-}
-
-ByteChucker& ByteChucker::WriteInt16(sal_Int16 nInt16)
-{
-    p2Sequence[0] = static_cast< sal_Int8 >((nInt16 >>  0 ) & 0xFF);
-    p2Sequence[1] = static_cast< sal_Int8 >((nInt16 >>  8 ) & 0xFF);
-    WriteBytes( a2Sequence );
-    return *this;
-}
-ByteChucker& ByteChucker::WriteInt32(sal_Int32 nInt32)
-{
-    p4Sequence[0] = static_cast< sal_Int8 >((nInt32 >>  0 ) & 0xFF);
-    p4Sequence[1] = static_cast< sal_Int8 >((nInt32 >>  8 ) & 0xFF);
-    p4Sequence[2] = static_cast< sal_Int8 >((nInt32 >> 16 ) & 0xFF);
-    p4Sequence[3] = static_cast< sal_Int8 >((nInt32 >> 24 ) & 0xFF);
-    WriteBytes( a4Sequence );
-    return *this;
-}
-
-ByteChucker& ByteChucker::WriteUInt8(sal_uInt8 nuInt8)
-{
-    p1Sequence[0] = nuInt8  & 0xFF;
-    WriteBytes( a1Sequence );
-    return *this;
-}
-ByteChucker& ByteChucker::WriteUInt16(sal_uInt16 nuInt16)
-{
-    p2Sequence[0] = static_cast< sal_Int8 >((nuInt16 >>  0 ) & 0xFF);
-    p2Sequence[1] = static_cast< sal_Int8 >((nuInt16 >>  8 ) & 0xFF);
-    WriteBytes( a2Sequence );
-    return *this;
-}
-ByteChucker& ByteChucker::WriteUInt32(sal_uInt32 nuInt32)
-{
-    p4Sequence[0] = static_cast < sal_Int8 > ((nuInt32 >>  0 ) & 0xFF);
-    p4Sequence[1] = static_cast < sal_Int8 > ((nuInt32 >>  8 ) & 0xFF);
-    p4Sequence[2] = static_cast < sal_Int8 > ((nuInt32 >> 16 ) & 0xFF);
-    p4Sequence[3] = static_cast < sal_Int8 > ((nuInt32 >> 24 ) & 0xFF);
-    WriteBytes( a4Sequence );
-    return *this;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/package/source/zipapi/ByteGrabber.cxx b/package/source/zipapi/ByteGrabber.cxx
index 9b47a36..65643be 100644
--- a/package/source/zipapi/ByteGrabber.cxx
+++ b/package/source/zipapi/ByteGrabber.cxx
@@ -100,90 +100,32 @@ sal_Int64 SAL_CALL ByteGrabber::getLength(  )
         throw io::IOException(THROW_WHERE );
 }
 
-ByteGrabber& ByteGrabber::ReadInt8(sal_Int8& rInt8)
+sal_uInt16 ByteGrabber::ReadUInt16()
 {
     ::osl::MutexGuard aGuard( m_aMutex );
-    if (xStream->readBytes(aSequence,1) != 1)
-        rInt8 = 0;
-    else
-        rInt8 = aSequence[0] & 0xFF;
-    return *this;
-}
-
-ByteGrabber& ByteGrabber::ReadInt16(sal_Int16& rInt16)
-{
-    ::osl::MutexGuard aGuard( m_aMutex );
-    if (xStream->readBytes ( aSequence, 2) != 2)
-        rInt16 = 0;
-    else
-    {
-        pSequence = aSequence.getConstArray();
-        rInt16 = static_cast <sal_Int16>
-               ( (pSequence[0] & 0xFF)
-              | (pSequence[1] & 0xFF) << 8);
-    }
-    return *this;
-}
-
-ByteGrabber& ByteGrabber::ReadInt32(sal_Int32& rInt32)
-{
-    ::osl::MutexGuard aGuard( m_aMutex );
-
-    if (xStream->readBytes(aSequence, 4) != 4)
-        rInt32 = 0;
-    else
-    {
-        pSequence = aSequence.getConstArray();
-        rInt32 = static_cast < sal_Int32 >
-                ( (pSequence[0] & 0xFF)
-              | ( pSequence[1] & 0xFF ) << 8
-              | ( pSequence[2] & 0xFF ) << 16
-              | ( pSequence[3] & 0xFF ) << 24 );
-    }
-    return *this;
-}
 
-ByteGrabber& ByteGrabber::ReadUInt8(sal_uInt8& rInt8)
-{
-    ::osl::MutexGuard aGuard( m_aMutex );
+    if (xStream->readBytes(aSequence, 2) != 2)
+        return 0;
 
-    if (xStream->readBytes(aSequence,1) != 1)
-        rInt8 = 0;
-    else
-        rInt8 = static_cast < sal_uInt8 > (aSequence[0] & 0xFF );
-    return *this;
+    pSequence = aSequence.getConstArray();
+    return static_cast <sal_uInt16>
+           ( (pSequence[0] & 0xFF)
+          | (pSequence[1] & 0xFF) << 8);
 }
-ByteGrabber& ByteGrabber::ReadUInt16(sal_uInt16& rInt16)
-{
-    ::osl::MutexGuard aGuard( m_aMutex );
 
-    if (xStream->readBytes(aSequence, 2) != 2)
-        rInt16 = 0;
-    else
-    {
-        pSequence = aSequence.getConstArray();
-        rInt16 = static_cast <sal_uInt16>
-               ( (pSequence[0] & 0xFF)
-              | (pSequence[1] & 0xFF) << 8);
-    }
-    return *this;
-}
-ByteGrabber& ByteGrabber::ReadUInt32(sal_uInt32& ruInt32)
+sal_uInt32 ByteGrabber::ReadUInt32()
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
     if (xStream->readBytes(aSequence, 4) != 4)
-        ruInt32 = 0;
-    else
-    {
-        pSequence = aSequence.getConstArray();
-        ruInt32 = static_cast < sal_uInt32 >
-                ( (pSequence[0] & 0xFF)
-              | ( pSequence[1] & 0xFF ) << 8
-              | ( pSequence[2] & 0xFF ) << 16
-              | ( pSequence[3] & 0xFF ) << 24 );
-    }
-    return *this;
+        return 0;
+
+    pSequence = aSequence.getConstArray();
+    return static_cast < sal_uInt32 >
+            ( (pSequence[0] & 0xFF)
+          | ( pSequence[1] & 0xFF ) << 8
+          | ( pSequence[2] & 0xFF ) << 16
+          | ( pSequence[3] & 0xFF ) << 24 );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/package/source/zipapi/MemoryByteGrabber.hxx b/package/source/zipapi/MemoryByteGrabber.hxx
index 318b93c..5a1b1eb 100644
--- a/package/source/zipapi/MemoryByteGrabber.hxx
+++ b/package/source/zipapi/MemoryByteGrabber.hxx
@@ -99,70 +99,57 @@ public:
     {
         return mnEnd;
     }
-    MemoryByteGrabber& ReadInt8(sal_Int8& rInt8)
+    sal_Int8 ReadInt8()
     {
         if (mnCurrent + 1 > mnEnd )
-            rInt8 = 0;
-        else
-            rInt8 = mpBuffer [mnCurrent++] & 0xFF;
-        return *this;
+            return 0;
+        return mpBuffer [mnCurrent++] & 0xFF;
     }
-    MemoryByteGrabber& ReadInt16(sal_Int16& rInt16)
+    sal_Int16 ReadInt16()
     {
         if (mnCurrent + 2 > mnEnd )
-            rInt16 = 0;
-        else
-        {
-            rInt16  =   mpBuffer[mnCurrent++] & 0xFF;
-            rInt16 |= ( mpBuffer[mnCurrent++] & 0xFF ) << 8;
-        }
-        return *this;
+            return 0;
+        sal_Int16 nInt16  =   mpBuffer[mnCurrent++] & 0xFF;
+        nInt16 |= ( mpBuffer[mnCurrent++] & 0xFF ) << 8;
+        return nInt16;
     }
-    MemoryByteGrabber& ReadInt32(sal_Int32& rInt32)
+    sal_Int32 ReadInt32()
     {
         if (mnCurrent + 4 > mnEnd )
-            rInt32 = 0;
-        else
-        {
-            rInt32  =   mpBuffer[mnCurrent++] & 0xFF;
-            rInt32 |= ( mpBuffer[mnCurrent++] & 0xFF ) << 8;
-            rInt32 |= ( mpBuffer[mnCurrent++] & 0xFF ) << 16;
-            rInt32 |= ( mpBuffer[mnCurrent++] & 0xFF ) << 24;
-        }
-        return *this;
+            return 0;
+
+        sal_Int32 nInt32  =   mpBuffer[mnCurrent++] & 0xFF;
+        nInt32 |= ( mpBuffer[mnCurrent++] & 0xFF ) << 8;
+        nInt32 |= ( mpBuffer[mnCurrent++] & 0xFF ) << 16;
+        nInt32 |= ( mpBuffer[mnCurrent++] & 0xFF ) << 24;
+        return nInt32;
     }
 
-    MemoryByteGrabber& ReadUInt8(sal_uInt8& rInt8)
+    sal_uInt8 ReadUInt8()
     {
         if (mnCurrent + 1 > mnEnd )
-            rInt8 = 0;
-        else
-            rInt8 = mpBuffer [mnCurrent++] & 0xFF;
-        return *this;
+            return 0;
+        return mpBuffer [mnCurrent++] & 0xFF;
     }
-    MemoryByteGrabber& ReadUInt16(sal_uInt16& rInt16)
+    sal_uInt16 ReadUInt16()
     {
         if (mnCurrent + 2 > mnEnd )
-            rInt16 = 0;
-        else
-        {
-            rInt16  =   mpBuffer [mnCurrent++] & 0xFF;
-            rInt16 |= ( mpBuffer [mnCurrent++] & 0xFF ) << 8;
-        }
-        return *this;
+            return 0;
+
+        sal_uInt16 nInt16  =   mpBuffer [mnCurrent++] & 0xFF;
+        nInt16 |= ( mpBuffer [mnCurrent++] & 0xFF ) << 8;
+        return nInt16;
     }
-    MemoryByteGrabber& ReadUInt32(sal_uInt32& rInt32)
+    sal_uInt32 ReadUInt32()
     {
         if (mnCurrent + 4 > mnEnd )
-            rInt32 = 0;
-        else
-        {
-            rInt32  =   mpBuffer [mnCurrent++] & 0xFF;
-            rInt32 |= ( mpBuffer [mnCurrent++] & 0xFF ) << 8;
-            rInt32 |= ( mpBuffer [mnCurrent++] & 0xFF ) << 16;
-            rInt32 |= ( mpBuffer [mnCurrent++] & 0xFF ) << 24;
-        }
-        return *this;
+            return 0;
+
+        sal_uInt32 nInt32  =   mpBuffer [mnCurrent++] & 0xFF;
+        nInt32 |= ( mpBuffer [mnCurrent++] & 0xFF ) << 8;
+        nInt32 |= ( mpBuffer [mnCurrent++] & 0xFF ) << 16;
+        nInt32 |= ( mpBuffer [mnCurrent++] & 0xFF ) << 24;
+        return nInt32;
     }
 };
 
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 0fe8ff2..a860f05 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -634,24 +634,22 @@ bool ZipFile::readLOC( ZipEntry &rEntry )
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
-    sal_Int32 nTestSig, nTime, nCRC, nSize, nCompressedSize;
-    sal_Int16 nVersion, nFlag, nHow, nPathLen, nExtraLen;
     sal_Int64 nPos = -rEntry.nOffset;
 
     aGrabber.seek(nPos);
-    aGrabber.ReadInt32( nTestSig );
+    sal_Int32 nTestSig = aGrabber.ReadInt32();
 
     if (nTestSig != LOCSIG)
         throw ZipIOException("Invalid LOC header (bad signature)" );
-    aGrabber.ReadInt16( nVersion );
-    aGrabber.ReadInt16( nFlag );
-    aGrabber.ReadInt16( nHow );
-    aGrabber.ReadInt32( nTime );
-    aGrabber.ReadInt32( nCRC );
-    aGrabber.ReadInt32( nCompressedSize );
-    aGrabber.ReadInt32( nSize );
-    aGrabber.ReadInt16( nPathLen );
-    aGrabber.ReadInt16( nExtraLen );
+    sal_Int16 nVersion = aGrabber.ReadInt16();
+    aGrabber.ReadInt16(); //flag
+    aGrabber.ReadInt16(); //how
+    aGrabber.ReadInt32(); //time
+    aGrabber.ReadInt32(); //crc
+    aGrabber.ReadInt32(); //compressed size
+    aGrabber.ReadInt32(); //size
+    sal_Int16 nPathLen = aGrabber.ReadInt16();
+    sal_Int16 nExtraLen = aGrabber.ReadInt16();
     rEntry.nOffset = aGrabber.getPosition() + nPathLen + nExtraLen;
 
     // FIXME64: need to read 64bit LOC
@@ -754,8 +752,8 @@ sal_Int32 ZipFile::readCEN()
     throw(IOException, ZipException, RuntimeException)
 {
     // this method is called in constructor only, no need for mutex
-    sal_Int32 nCenLen, nCenPos = -1, nCenOff, nEndPos, nLocPos;
-    sal_uInt16 nCount, nTotal;
+    sal_Int32 nCenPos = -1, nEndPos, nLocPos;
+    sal_uInt16 nCount;
 
     try
     {
@@ -763,9 +761,9 @@ sal_Int32 ZipFile::readCEN()
         if (nEndPos == -1)
             return -1;
         aGrabber.seek(nEndPos + ENDTOT);
-        aGrabber.ReadUInt16( nTotal );
-        aGrabber.ReadInt32( nCenLen );
-        aGrabber.ReadInt32( nCenOff );
+        sal_uInt16 nTotal = aGrabber.ReadUInt16();
+        sal_Int32 nCenLen = aGrabber.ReadInt32();
+        sal_Int32 nCenOff = aGrabber.ReadInt32();
 
         if ( nTotal * CENHDR > nCenLen )
             throw ZipException("invalid END header (bad entry count)" );
@@ -791,39 +789,36 @@ sal_Int32 ZipFile::readCEN()
         MemoryByteGrabber aMemGrabber ( aCENBuffer );
 
         ZipEntry aEntry;
-        sal_Int32 nTestSig;
         sal_Int16 nCommentLen;
 
         for (nCount = 0 ; nCount < nTotal; nCount++)
         {
-            aMemGrabber.ReadInt32( nTestSig );
+            sal_Int32 nTestSig = aMemGrabber.ReadInt32();
             if ( nTestSig != CENSIG )
                 throw ZipException("Invalid CEN header (bad signature)" );
 
             aMemGrabber.skipBytes ( 2 );
-            aMemGrabber.ReadInt16( aEntry.nVersion );
+            aEntry.nVersion = aMemGrabber.ReadInt16();
 
             if ( ( aEntry.nVersion & 1 ) == 1 )
                 throw ZipException("Invalid CEN header (encrypted entry)" );
 
-            aMemGrabber.ReadInt16( aEntry.nFlag );
-            aMemGrabber.ReadInt16( aEntry.nMethod );
+            aEntry.nFlag = aMemGrabber.ReadInt16();
+            aEntry.nMethod = aMemGrabber.ReadInt16();
 
             if ( aEntry.nMethod != STORED && aEntry.nMethod != DEFLATED)
                 throw ZipException("Invalid CEN header (bad compression method)" );
 
-            aMemGrabber.ReadInt32( aEntry.nTime );
-            aMemGrabber.ReadInt32( aEntry.nCrc );
+            aEntry.nTime = aMemGrabber.ReadInt32();
+            aEntry.nCrc = aMemGrabber.ReadInt32();
 
-            sal_uInt32 nCompressedSize, nSize, nOffset;
-
-            aMemGrabber.ReadUInt32( nCompressedSize );
-            aMemGrabber.ReadUInt32( nSize );
-            aMemGrabber.ReadInt16( aEntry.nPathLen );
-            aMemGrabber.ReadInt16( aEntry.nExtraLen );
-            aMemGrabber.ReadInt16( nCommentLen );
+            sal_uInt32 nCompressedSize = aMemGrabber.ReadUInt32();
+            sal_uInt32 nSize = aMemGrabber.ReadUInt32();
+            aEntry.nPathLen = aMemGrabber.ReadInt16();
+            aEntry.nExtraLen = aMemGrabber.ReadInt16();
+            nCommentLen = aMemGrabber.ReadInt16();
             aMemGrabber.skipBytes ( 8 );
-            aMemGrabber.ReadUInt32( nOffset );
+            sal_uInt32 nOffset = aMemGrabber.ReadUInt32();
 
             // FIXME64: need to read the 64bit header instead
             if ( nSize == 0xffffffff ||
@@ -905,22 +900,20 @@ sal_Int32 ZipFile::recover()
                     ZipEntry aEntry;
                     MemoryByteGrabber aMemGrabber ( Sequence< sal_Int8 >( ((sal_Int8*)(&(pBuffer[nPos+4]))), 26 ) );
 
-                    aMemGrabber.ReadInt16( aEntry.nVersion );
+                    aEntry.nVersion = aMemGrabber.ReadInt16();
                     if ( ( aEntry.nVersion & 1 ) != 1 )
                     {
-                        aMemGrabber.ReadInt16( aEntry.nFlag );
-                        aMemGrabber.ReadInt16( aEntry.nMethod );
+                        aEntry.nFlag = aMemGrabber.ReadInt16();
+                        aEntry.nMethod = aMemGrabber.ReadInt16();
 
                         if ( aEntry.nMethod == STORED || aEntry.nMethod == DEFLATED )
                         {
-                            sal_uInt32 nCompressedSize, nSize;
-
-                            aMemGrabber.ReadInt32( aEntry.nTime );
-                            aMemGrabber.ReadInt32( aEntry.nCrc );
-                            aMemGrabber.ReadUInt32( nCompressedSize );
-                            aMemGrabber.ReadUInt32( nSize );
-                            aMemGrabber.ReadInt16( aEntry.nPathLen );
-                            aMemGrabber.ReadInt16( aEntry.nExtraLen );
+                            aEntry.nTime = aMemGrabber.ReadInt32();
+                            aEntry.nCrc = aMemGrabber.ReadInt32();
+                            sal_uInt32 nCompressedSize = aMemGrabber.ReadUInt32();
+                            sal_uInt32 nSize = aMemGrabber.ReadUInt32();
+                            aEntry.nPathLen = aMemGrabber.ReadInt16();
+                            aEntry.nExtraLen = aMemGrabber.ReadInt16();
 
                             // FIXME64: need to read the 64bit header instead
                             if ( nSize == 0xffffffff ||
@@ -974,13 +967,11 @@ sal_Int32 ZipFile::recover()
                 }
                 else if (pBuffer[nPos] == 'P' && pBuffer[nPos+1] == 'K' && pBuffer[nPos+2] == 7 && pBuffer[nPos+3] == 8 )
                 {
-                    sal_Int32 nCRC32;
-                    sal_uInt32 nCompressedSize32, nSize32;
                     sal_Int64 nCompressedSize, nSize;
                     MemoryByteGrabber aMemGrabber ( Sequence< sal_Int8 >( ((sal_Int8*)(&(pBuffer[nPos+4]))), 12 ) );
-                    aMemGrabber.ReadInt32( nCRC32 );
-                    aMemGrabber.ReadUInt32( nCompressedSize32 );
-                    aMemGrabber.ReadUInt32( nSize32 );
+                    sal_Int32 nCRC32 = aMemGrabber.ReadInt32();
+                    sal_uInt32 nCompressedSize32 = aMemGrabber.ReadUInt32();
+                    sal_uInt32 nSize32 = aMemGrabber.ReadUInt32();
 
                     // FIXME64: work to be done here ...
                     nCompressedSize = nCompressedSize32;
commit c928840ef2a41ca373ad9070d8e9160c216260da
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Dec 12 09:41:38 2014 +0000

    leave the deliberately unused, not-for-use method inline
    
    doing so means code is not generated for it seeing as its not used, moving it
    out means code is generated for it and its detected as unused code
    
    Change-Id: I72edc89446bdfac50069e0b509fc7f90540e0d4a

diff --git a/include/svl/style.hxx b/include/svl/style.hxx
index 34ba57b..904ac85 100644
--- a/include/svl/style.hxx
+++ b/include/svl/style.hxx
@@ -274,8 +274,6 @@ public:
     SfxStyleSheetBase&          Add( const SfxStyleSheetBase& );
 };
 
-
-
 class SVL_DLLPUBLIC SfxStyleSheet: public SfxStyleSheetBase,
                      public SfxListener, public SfxBroadcaster, public svl::StyleSheetUser
 {
@@ -292,11 +290,14 @@ public:
     virtual bool        SetParent( const OUString& ) SAL_OVERRIDE;
 
 protected:
-    SfxStyleSheet(); // do not use! needed by MSVC at compile time to satisfy ImplInheritanceHelper2
+    SfxStyleSheet() // do not use! needed by MSVC at compile time to satisfy ImplInheritanceHelper2
+        : SfxStyleSheetBase(OUString("dummy"), NULL, SFX_STYLE_FAMILY_ALL, 0)
+    {
+        assert(false);
+    }
     virtual             ~SfxStyleSheet();
-};
-
 
+};
 
 class SVL_DLLPUBLIC SfxStyleSheetPool: public SfxStyleSheetBasePool
 {
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index 9d78b6c..cddf81b 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -884,12 +884,6 @@ void SfxStyleSheetBase::Store( SvStream& )
 {
 }
 
-SfxStyleSheet::SfxStyleSheet() // do not use! needed by MSVC at compile time to satisfy ImplInheritanceHelper2
-    : SfxStyleSheetBase(OUString("dummy"), NULL, SFX_STYLE_FAMILY_ALL, 0)
-{
-    assert(false);
-}
-
 SfxStyleSheet::SfxStyleSheet(const OUString &rName,
                              const SfxStyleSheetBasePool& r_Pool,
                              SfxStyleFamily eFam,


More information about the Libreoffice-commits mailing list