summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/pngread.cxx
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2007-06-11 13:25:42 +0000
committerOliver Bolte <obo@openoffice.org>2007-06-11 13:25:42 +0000
commit20845b6d05d11925f47bd436c4d1b536cd16060f (patch)
tree4e0555f9ad44c2978a8e60f8b9946b6ed28427b8 /vcl/source/gdi/pngread.cxx
parentde22658258a0d1c5792cd9a2888c9bfbaf94d8c8 (diff)
INTEGRATION: CWS vcl78 (1.21.142); FILE MERGED
2007/04/17 12:37:16 hdu 1.21.142.1: #i76229# handle short reads from PNG stream
Diffstat (limited to 'vcl/source/gdi/pngread.cxx')
-rw-r--r--vcl/source/gdi/pngread.cxx15
1 files changed, 10 insertions, 5 deletions
diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index 24c3c8a92f25..0f0ee76810d6 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: pngread.cxx,v $
*
- * $Revision: 1.21 $
+ * $Revision: 1.22 $
*
- * last change: $Author: kz $ $Date: 2006-11-06 14:49:40 $
+ * last change: $Author: obo $ $Date: 2007-06-11 14:25:42 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -300,9 +300,14 @@ bool PNGReaderImpl::ReadNextChunk()
if( mnChunkLen && !mrPNGStream.IsEof() )
{
rChunkData.aData.resize( mnChunkLen );
- sal_uInt8* pPtr = &rChunkData.aData[ 0 ];
- mrPNGStream.Read( pPtr, mnChunkLen );
- nCRC32 = rtl_crc32( nCRC32, pPtr, mnChunkLen );
+
+ sal_Size nBytesRead = 0;
+ do {
+ sal_uInt8* pPtr = &rChunkData.aData[ nBytesRead ];
+ nBytesRead += mrPNGStream.Read( pPtr, mnChunkLen - nBytesRead );
+ } while ( ( nBytesRead < mnChunkLen ) && ( mrPNGStream.GetError() == ERRCODE_NONE ) );
+
+ nCRC32 = rtl_crc32( nCRC32, &rChunkData.aData[ 0 ], mnChunkLen );
maDataIter = rChunkData.aData.begin();
}
sal_uInt32 nCheck;