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

Oliver-Rainer Wittmann orw at apache.org
Tue Apr 1 01:29:28 PDT 2014


 vcl/source/gdi/dibtools.cxx |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

New commits:
commit cc1a7748c867716966b6a38e75f89df5d92ee104
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Mon Mar 31 14:37:21 2014 +0000

    Resolves: #i124555# restore stream position after Seek to end of stream
    
    (cherry picked from commit 61efddf5ab8cd318e022ca1ac817ba0879a55e23)
    
    Conflicts:
    	vcl/source/gdi/dibtools.cxx
    
    Change-Id: Ie6c0aeab5988b68954a0bdd460317ac9539d8a5f

diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index 1ffdcd9..5d71a46 100644
--- a/vcl/source/gdi/dibtools.cxx
+++ b/vcl/source/gdi/dibtools.cxx
@@ -766,17 +766,18 @@ bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, Bitmap* pBmpAlpha, sal_uLon
 
 bool ImplReadDIBFileHeader( SvStream& rIStm, sal_uLong& rOffset )
 {
-    sal_uInt32  nTmp32;
-    sal_uInt16  nTmp16 = 0;
-    bool    bRet = false;
+    bool bRet = false;
 
-    const sal_uLong nStreamLength (rIStm.Seek(STREAM_SEEK_TO_END));
-    rIStm.Seek(STREAM_SEEK_TO_BEGIN);
+    const sal_uInt64 nSavedStreamPos( rIStm.Tell() );
+    const sal_uInt64 nStreamLength( rIStm.Seek( STREAM_SEEK_TO_END ) );
+    rIStm.Seek( nSavedStreamPos );
 
+    sal_uInt16 nTmp16 = 0;
     rIStm.ReadUInt16( nTmp16 );
 
     if ( ( 0x4D42 == nTmp16 ) || ( 0x4142 == nTmp16 ) )
     {
+        sal_uInt32 nTmp32(0);
         if ( 0x4142 == nTmp16 )
         {
             rIStm.SeekRel( 12L );
@@ -794,7 +795,7 @@ bool ImplReadDIBFileHeader( SvStream& rIStm, sal_uLong& rOffset )
             bRet = ( rIStm.GetError() == 0UL );
         }
 
-        if (rOffset >= nStreamLength)
+        if ( rOffset >= nStreamLength )
         {
             // Offset claims that image starts past the end of the
             // stream.  Unlikely.


More information about the Libreoffice-commits mailing list