Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
3e3b8483
Kaydet (Commit)
3e3b8483
authored
Eki 21, 2014
tarafından
Matúš Kukan
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
package: Use memory stream for compressing zip entries
Change-Id: Ibf81dc3cd8a9a9da3dfd6ee6e587a522c4d56a44
üst
3e7ab1ac
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
20 deletions
+26
-20
ZipOutputEntry.hxx
package/inc/ZipOutputEntry.hxx
+6
-4
ZipOutputStream.hxx
package/inc/ZipOutputStream.hxx
+0
-1
ZipOutputEntry.cxx
package/source/zipapi/ZipOutputEntry.cxx
+11
-7
ZipOutputStream.cxx
package/source/zipapi/ZipOutputStream.cxx
+0
-5
ZipPackage.cxx
package/source/zippackage/ZipPackage.cxx
+6
-2
ZipPackageStream.cxx
package/source/zippackage/ZipPackageStream.cxx
+3
-1
No files found.
package/inc/ZipOutputEntry.hxx
Dosyayı görüntüle @
3e3b8483
...
...
@@ -29,19 +29,19 @@
#include <CRC32.hxx>
struct
ZipEntry
;
class
Zip
OutputStream
;
class
Zip
PackageBuffer
;
class
ZipPackageStream
;
class
ZipOutputEntry
{
::
com
::
sun
::
star
::
uno
::
Sequence
<
sal_Int8
>
m_aDeflateBuffer
;
ZipUtils
::
Deflater
m_aDeflater
;
ZipUtils
::
Deflater
m_aDeflater
;
css
::
uno
::
Reference
<
ZipPackageBuffer
>
m_pBuffer
;
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
xml
::
crypto
::
XCipherContext
>
m_xCipherContext
;
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
xml
::
crypto
::
XDigestContext
>
m_xDigestContext
;
CRC32
m_aCRC
;
ZipOutputStream
*
m_pZipOutputStream
;
ZipEntry
*
m_pCurrentEntry
;
sal_Int16
m_nDigested
;
bool
m_bEncryptCurrentEntry
;
...
...
@@ -50,10 +50,12 @@ class ZipOutputEntry
public
:
ZipOutputEntry
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
uno
::
XComponentContext
>&
rxContext
,
Zip
OutputStream
*
pZipOutputStream
,
Zip
Entry
&
rEntry
,
ZipPackageStream
*
pStream
,
bool
bEncrypt
=
false
);
ZipEntry
&
rEntry
,
ZipPackageStream
*
pStream
,
bool
bEncrypt
=
false
);
~
ZipOutputEntry
();
css
::
uno
::
Sequence
<
sal_Int8
>
getData
();
// XZipOutputEntry interfaces
void
SAL_CALL
closeEntry
(
)
throw
(
::
com
::
sun
::
star
::
io
::
IOException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
...
...
package/inc/ZipOutputStream.hxx
Dosyayı görüntüle @
3e3b8483
...
...
@@ -53,7 +53,6 @@ public:
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
();
...
...
package/source/zipapi/ZipOutputEntry.cxx
Dosyayı görüntüle @
3e3b8483
...
...
@@ -24,11 +24,10 @@
#include <osl/time.h>
#include <ByteChucker.hxx>
#include <PackageConstants.hxx>
#include <ZipEntry.hxx>
#include <ZipFile.hxx>
#include <Zip
OutputStream
.hxx>
#include <Zip
PackageBuffer
.hxx>
#include <ZipPackageStream.hxx>
using
namespace
com
::
sun
::
star
;
...
...
@@ -39,13 +38,12 @@ using namespace com::sun::star::packages::zip::ZipConstants;
/** This class is used to deflate Zip entries
*/
ZipOutputEntry
::
ZipOutputEntry
(
const
uno
::
Reference
<
uno
::
XComponentContext
>&
rxContext
,
ZipOutputStream
*
pOutputStream
,
ZipEntry
&
rEntry
,
ZipPackageStream
*
pStream
,
bool
bEncrypt
)
:
m_aDeflateBuffer
(
n_ConstBufferSize
)
,
m_aDeflater
(
DEFAULT_COMPRESSION
,
true
)
,
m_p
ZipOutputStream
(
pOutputStream
)
,
m_p
Buffer
(
new
ZipPackageBuffer
(
n_ConstBufferSize
)
)
,
m_pCurrentEntry
(
&
rEntry
)
,
m_nDigested
(
0
)
,
m_bEncryptCurrentEntry
(
bEncrypt
)
...
...
@@ -64,6 +62,12 @@ ZipOutputEntry::~ZipOutputEntry( void )
{
}
uno
::
Sequence
<
sal_Int8
>
ZipOutputEntry
::
getData
()
{
m_pBuffer
->
realloc
(
m_pBuffer
->
getPosition
());
return
m_pBuffer
->
getSequence
();
}
void
SAL_CALL
ZipOutputEntry
::
closeEntry
()
throw
(
IOException
,
RuntimeException
)
{
...
...
@@ -151,7 +155,7 @@ void ZipOutputEntry::doDeflate()
// FIXME64: uno::Sequence not 64bit safe.
uno
::
Sequence
<
sal_Int8
>
aEncryptionBuffer
=
m_xCipherContext
->
convertWithCipherContext
(
aTmpBuffer
);
m_p
ZipOutputStream
->
getChucker
().
W
riteBytes
(
aEncryptionBuffer
);
m_p
Buffer
->
w
riteBytes
(
aEncryptionBuffer
);
// the sizes as well as checksum for encrypted streams is calculated here
m_pCurrentEntry
->
nCompressedSize
+=
aEncryptionBuffer
.
getLength
();
...
...
@@ -160,7 +164,7 @@ void ZipOutputEntry::doDeflate()
}
else
{
m_p
ZipOutputStream
->
getChucker
().
W
riteBytes
(
aTmpBuffer
);
m_p
Buffer
->
w
riteBytes
(
aTmpBuffer
);
}
}
...
...
@@ -170,7 +174,7 @@ void ZipOutputEntry::doDeflate()
uno
::
Sequence
<
sal_Int8
>
aEncryptionBuffer
=
m_xCipherContext
->
finalizeCipherContextAndDispose
();
if
(
aEncryptionBuffer
.
getLength
()
)
{
m_p
ZipOutputStream
->
getChucker
().
W
riteBytes
(
aEncryptionBuffer
);
m_p
Buffer
->
w
riteBytes
(
aEncryptionBuffer
);
// the sizes as well as checksum for encrypted streams is calculated hier
m_pCurrentEntry
->
nCompressedSize
+=
aEncryptionBuffer
.
getLength
();
...
...
package/source/zipapi/ZipOutputStream.cxx
Dosyayı görüntüle @
3e3b8483
...
...
@@ -108,11 +108,6 @@ void ZipOutputStream::finish( )
m_xStream
->
flush
();
}
ByteChucker
&
ZipOutputStream
::
getChucker
()
{
return
m_aChucker
;
}
void
ZipOutputStream
::
writeEND
(
sal_uInt32
nOffset
,
sal_uInt32
nLength
)
throw
(
IOException
,
RuntimeException
)
{
...
...
package/source/zippackage/ZipPackage.cxx
Dosyayı görüntüle @
3e3b8483
...
...
@@ -1040,9 +1040,11 @@ void ZipPackage::WriteManifest( ZipOutputStream& aZipOut, const vector< uno::Seq
// the manifest.xml is never encrypted - so pass an empty reference
aZipOut
.
putNextEntry
(
*
pEntry
);
ZipOutputEntry
aZipEntry
(
m_xContext
,
&
aZipOut
,
*
pEntry
,
NULL
);
ZipOutputEntry
aZipEntry
(
m_xContext
,
*
pEntry
,
NULL
);
aZipEntry
.
write
(
pBuffer
->
getSequence
(),
0
,
nBufferLength
);
aZipEntry
.
closeEntry
();
uno
::
Sequence
<
sal_Int8
>
aCompressedData
=
aZipEntry
.
getData
();
aZipOut
.
rawWrite
(
aCompressedData
,
0
,
aCompressedData
.
getLength
());
aZipOut
.
rawCloseEntry
();
}
...
...
@@ -1092,9 +1094,11 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< uno:
// there is no encryption in this format currently
aZipOut
.
putNextEntry
(
*
pEntry
);
ZipOutputEntry
aZipEntry
(
m_xContext
,
&
aZipOut
,
*
pEntry
,
NULL
);
ZipOutputEntry
aZipEntry
(
m_xContext
,
*
pEntry
,
NULL
);
aZipEntry
.
write
(
pBuffer
->
getSequence
(),
0
,
nBufferLength
);
aZipEntry
.
closeEntry
();
uno
::
Sequence
<
sal_Int8
>
aCompressedData
=
aZipEntry
.
getData
();
aZipOut
.
rawWrite
(
aCompressedData
,
0
,
aCompressedData
.
getLength
());
aZipOut
.
rawCloseEntry
();
}
...
...
package/source/zippackage/ZipPackageStream.cxx
Dosyayı görüntüle @
3e3b8483
...
...
@@ -748,7 +748,7 @@ bool ZipPackageStream::saveChild(
}
else
{
ZipOutputEntry
aZipEntry
(
m_xContext
,
&
rZipOut
,
*
pTempEntry
,
this
,
bToBeEncrypted
);
ZipOutputEntry
aZipEntry
(
m_xContext
,
*
pTempEntry
,
this
,
bToBeEncrypted
);
do
{
nLength
=
xStream
->
readBytes
(
aSeq
,
n_ConstBufferSize
);
...
...
@@ -756,6 +756,8 @@ bool ZipPackageStream::saveChild(
}
while
(
nLength
==
n_ConstBufferSize
);
aZipEntry
.
closeEntry
();
uno
::
Sequence
<
sal_Int8
>
aCompressedData
=
aZipEntry
.
getData
();
rZipOut
.
rawWrite
(
aCompressedData
,
0
,
aCompressedData
.
getLength
());
}
rZipOut
.
rawCloseEntry
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment