summaryrefslogtreecommitdiff
path: root/package/inc
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-10-20 21:13:50 +0200
committerMatúš Kukan <matus.kukan@collabora.com>2014-11-17 10:49:20 +0100
commit2d92a84a6aac37e34d1699fdebe0270468b4f746 (patch)
tree0ea2d2eb83775800e6bbf0106ef26cd09f39137e /package/inc
parent15678e7483369fae400c3b289c85e63001b3d131 (diff)
package: Move most ZipOutputEntry's methods back to ZipOutputStream
We want to use ZipOutputEntry only for deflating (and maybe rename it). ca13a9377e4a36436e4c82bb33648d0f3b6db6f5 was not a good idea because the data still needs to be written sequentially anyway. Otherwise it's hard to get offset positions of individual entries right. Since this commit rawCloseEntry needs to be called always; also when we use write&closeEntry because we don't call writeEXT in closeEntry anymore. Need to rename and add comments later. Change-Id: I03bd48ca6e108e6253a77a137746165909ca3c3d
Diffstat (limited to 'package/inc')
-rw-r--r--package/inc/ZipOutputEntry.hxx18
-rw-r--r--package/inc/ZipOutputStream.hxx17
2 files changed, 20 insertions, 15 deletions
diff --git a/package/inc/ZipOutputEntry.hxx b/package/inc/ZipOutputEntry.hxx
index a1d03d3ebc40..73bd8a481afd 100644
--- a/package/inc/ZipOutputEntry.hxx
+++ b/package/inc/ZipOutputEntry.hxx
@@ -19,16 +19,17 @@
#ifndef INCLUDED_PACKAGE_INC_ZIPOUTPUTENTRY_HXX
#define INCLUDED_PACKAGE_INC_ZIPOUTPUTENTRY_HXX
+#include <com/sun/star/io/IOException.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/xml/crypto/XCipherContext.hpp>
#include <com/sun/star/xml/crypto/XDigestContext.hpp>
#include <package/Deflater.hxx>
-#include <ByteChucker.hxx>
#include <CRC32.hxx>
struct ZipEntry;
+class ZipOutputStream;
class ZipPackageStream;
class ZipOutputEntry
@@ -40,7 +41,7 @@ class ZipOutputEntry
::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XDigestContext > m_xDigestContext;
CRC32 m_aCRC;
- ByteChucker &m_rChucker;
+ ZipOutputStream* m_pZipOutputStream;
ZipEntry *m_pCurrentEntry;
sal_Int16 m_nDigested;
bool m_bEncryptCurrentEntry;
@@ -49,29 +50,18 @@ class ZipOutputEntry
public:
ZipOutputEntry(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
- ByteChucker& rChucker, ZipEntry& rEntry, ZipPackageStream* pStream, bool bEncrypt = false);
+ ZipOutputStream *pZipOutputStream, ZipEntry& rEntry, ZipPackageStream* pStream, bool bEncrypt = false);
~ZipOutputEntry();
- // rawWrite to support a direct write to the output stream
- void SAL_CALL rawWrite( ::com::sun::star::uno::Sequence< sal_Int8 >& rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength )
- throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- void SAL_CALL rawCloseEntry( )
- throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-
// XZipOutputEntry interfaces
void SAL_CALL closeEntry( )
throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
void SAL_CALL write( const ::com::sun::star::uno::Sequence< sal_Int8 >& rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength )
throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- static sal_uInt32 getCurrentDosTime ( );
private:
void doDeflate();
- sal_Int32 writeLOC( const ZipEntry &rEntry )
- throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- void writeEXT( const ZipEntry &rEntry )
- throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
};
#endif
diff --git a/package/inc/ZipOutputStream.hxx b/package/inc/ZipOutputStream.hxx
index 95c27f3a959a..6775bd02c3be 100644
--- a/package/inc/ZipOutputStream.hxx
+++ b/package/inc/ZipOutputStream.hxx
@@ -27,6 +27,7 @@
#include <vector>
struct ZipEntry;
+class ZipPackageStream;
class ZipOutputStream
{
@@ -35,22 +36,36 @@ class ZipOutputStream
ByteChucker m_aChucker;
bool m_bFinished;
+ ZipEntry *m_pCurrentEntry;
public:
ZipOutputStream(
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > &xOStream );
~ZipOutputStream();
- void addEntry( ZipEntry *pZipEntry );
+ // rawWrite to support a direct write to the output stream
+ void rawWrite( ::com::sun::star::uno::Sequence< sal_Int8 >& rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength )
+ throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ void rawCloseEntry()
+ throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+ void putNextEntry( ZipEntry& rEntry, bool bEncrypt = false )
+ throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
void finish()
throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
ByteChucker& getChucker();
+ static sal_uInt32 getCurrentDosTime();
+
private:
void writeEND(sal_uInt32 nOffset, sal_uInt32 nLength)
throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
void writeCEN( const ZipEntry &rEntry )
throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ sal_Int32 writeLOC( const ZipEntry &rEntry )
+ throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ void writeEXT( const ZipEntry &rEntry )
+ throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
};
#endif