summaryrefslogtreecommitdiff
path: root/package/source/zipapi
diff options
context:
space:
mode:
authorMartin Gallwey <mtg@openoffice.org>2001-12-04 16:53:19 +0000
committerMartin Gallwey <mtg@openoffice.org>2001-12-04 16:53:19 +0000
commit90ddd03b58649e19dea12fb21de59e996f073965 (patch)
treee6c7cfc59d2698633bcad46e34d43482efa04294 /package/source/zipapi
parentecd83d3387e72bb6c5203670bb0171e4635c6a6b (diff)
#95155# support for unbuffered streams
Diffstat (limited to 'package/source/zipapi')
-rw-r--r--package/source/zipapi/CRC32.cxx31
1 files changed, 13 insertions, 18 deletions
diff --git a/package/source/zipapi/CRC32.cxx b/package/source/zipapi/CRC32.cxx
index a8e356a1a65c..b892b8e40811 100644
--- a/package/source/zipapi/CRC32.cxx
+++ b/package/source/zipapi/CRC32.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: CRC32.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: mtg $ $Date: 2001-11-15 20:13:09 $
+ * last change: $Author: mtg $ $Date: 2001-12-04 17:48:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,7 @@
*
************************************************************************/
#ifndef _CRC32_HXX
-#include "CRC32.hxx"
+#include <CRC32.hxx>
#endif
#ifndef _ZLIB_H
#include <external/zlib/zlib.h>
@@ -67,9 +67,6 @@
#ifndef _PACKAGE_CONSTANTS_HXX_
#include <PackageConstants.hxx>
#endif
-#ifndef _COM_SUN_STAR_IO_XSEEKABLE_HPP_
-#include <com/sun/star/io/XSeekable.hpp>
-#endif
#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
#include <com/sun/star/io/XInputStream.hpp>
#endif
@@ -124,20 +121,18 @@ void SAL_CALL CRC32::update(const Sequence< sal_Int8 > &b)
nCRC = crc32(nCRC, (const unsigned char*)b.getConstArray(),b.getLength());
}
-void SAL_CALL CRC32::updateStream( Reference < XInputStream > & xStream )
+sal_Int32 SAL_CALL CRC32::updateStream( Reference < XInputStream > & xStream )
throw ( RuntimeException )
{
- Reference < XSeekable > xSeek ( xStream, UNO_QUERY );
- if ( xSeek.is() )
+ sal_Int32 nLength, nTotal = 0;
+ Sequence < sal_Int8 > aSeq ( n_ConstBufferSize );
+ do
{
- sal_Int32 nLength = n_ConstBufferSize;
- sal_Int64 nCurrentPos = xSeek->getPosition();
- Sequence < sal_Int8 > aSeq ( n_ConstBufferSize );
- while ( nLength >= n_ConstBufferSize )
- {
- nLength = xStream->readBytes ( aSeq, n_ConstBufferSize );
- updateSegment ( aSeq, 0, nLength );
- }
- xSeek->seek ( nCurrentPos );
+ nLength = xStream->readBytes ( aSeq, n_ConstBufferSize );
+ updateSegment ( aSeq, 0, nLength );
+ nTotal += nLength;
}
+ while ( nLength == n_ConstBufferSize );
+
+ return nTotal;
}