[Libreoffice-commits] core.git: Branch 'aoo/trunk' - vcl/source

Oliver-Rainer Wittmann orw at apache.org
Mon Mar 31 09:08:02 PDT 2014


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

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

    124555: restore stream position after Seek to end of stream

diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index 3aa5df4..d4ea127 100755
--- a/vcl/source/gdi/dibtools.cxx
+++ b/vcl/source/gdi/dibtools.cxx
@@ -775,17 +775,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_Int64 nStreamLength (rIStm.Seek(STREAM_SEEK_TO_END));
-    rIStm.Seek(STREAM_SEEK_TO_BEGIN);
+    const sal_Int64 nSavedStreamPos( rIStm.Tell() );
+    const sal_Int64 nStreamLength( rIStm.Seek( STREAM_SEEK_TO_END ) );
+    rIStm.Seek( nSavedStreamPos );
 
+    sal_uInt16 nTmp16 = 0;
     rIStm >> nTmp16;
 
     if ( ( 0x4D42 == nTmp16 ) || ( 0x4142 == nTmp16 ) )
     {
+        sal_uInt32 nTmp32;
         if ( 0x4142 == nTmp16 )
         {
             rIStm.SeekRel( 12L );
@@ -803,7 +804,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