[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - vcl/source

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


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

New commits:
commit 172c33146d7e8b4f741d52ab7c9dfdb55c847401
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
    
    (cherry picked from commit cc1a7748c867716966b6a38e75f89df5d92ee104)
    
    Conflicts:
    	vcl/source/gdi/dibtools.cxx
    
    Change-Id: Ie6c0aeab5988b68954a0bdd460317ac9539d8a5f

diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index dac2c8c..2759c20 100644
--- a/vcl/source/gdi/dibtools.cxx
+++ b/vcl/source/gdi/dibtools.cxx
@@ -781,17 +781,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_Size nSavedStreamPos( rIStm.Tell() );
+    const sal_Size nStreamLength( rIStm.Seek( STREAM_SEEK_TO_END ) );
+    rIStm.Seek( nSavedStreamPos );
 
+    sal_uInt16 nTmp16 = 0;
     rIStm >> nTmp16;
 
     if ( ( 0x4D42 == nTmp16 ) || ( 0x4142 == nTmp16 ) )
     {
+        sal_uInt32 nTmp32(0);
         if ( 0x4142 == nTmp16 )
         {
             rIStm.SeekRel( 12L );
@@ -809,7 +810,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