[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - package/source

Caolán McNamara caolanm at redhat.com
Wed Feb 7 13:12:36 UTC 2018


 package/source/zipapi/ZipFile.cxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit a224d33cbf098c361a7244569d5088044561f3ee
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 6 21:21:30 2018 +0000

    MemoryByteGrabber sequence has to exist for Grabber lifetime
    
    it just takes a c++ ref, so a temp is an unsuitable arg
    
    Change-Id: I40490e94d977df91b985bc4ae458b68ee85d5dfe
    Reviewed-on: https://gerrit.libreoffice.org/49323
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 547be25ed23a..cb85ecd655ae 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -866,7 +866,7 @@ sal_Int32 ZipFile::readCEN()
         if ( static_cast < sal_Int64 > ( nCenLen ) != nRead )
             throw ZipException ("Error reading CEN into memory buffer!" );
 
-        MemoryByteGrabber aMemGrabber ( aCENBuffer );
+        MemoryByteGrabber aMemGrabber(aCENBuffer);
 
         ZipEntry aEntry;
         sal_Int16 nCommentLen;
@@ -980,7 +980,8 @@ void ZipFile::recover()
                 if ( nPos < nBufSize - 30 && pBuffer[nPos] == 'P' && pBuffer[nPos+1] == 'K' && pBuffer[nPos+2] == 3 && pBuffer[nPos+3] == 4 )
                 {
                     ZipEntry aEntry;
-                    MemoryByteGrabber aMemGrabber ( Sequence< sal_Int8 >( &(pBuffer[nPos+4]), 26 ) );
+                    Sequence<sal_Int8> aTmpBuffer(&(pBuffer[nPos+4]), 26);
+                    MemoryByteGrabber aMemGrabber(aTmpBuffer);
 
                     aEntry.nVersion = aMemGrabber.ReadInt16();
                     if ( ( aEntry.nVersion & 1 ) != 1 )
@@ -1050,7 +1051,8 @@ void ZipFile::recover()
                 else if (pBuffer[nPos] == 'P' && pBuffer[nPos+1] == 'K' && pBuffer[nPos+2] == 7 && pBuffer[nPos+3] == 8 )
                 {
                     sal_Int64 nCompressedSize, nSize;
-                    MemoryByteGrabber aMemGrabber ( Sequence< sal_Int8 >( &(pBuffer[nPos+4]), 12 ) );
+                    Sequence<sal_Int8> aTmpBuffer(&(pBuffer[nPos+4]), 12);
+                    MemoryByteGrabber aMemGrabber(aTmpBuffer);
                     sal_Int32 nCRC32 = aMemGrabber.ReadInt32();
                     sal_uInt32 nCompressedSize32 = aMemGrabber.ReadUInt32();
                     sal_uInt32 nSize32 = aMemGrabber.ReadUInt32();


More information about the Libreoffice-commits mailing list