summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-02-22 21:16:56 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-02-23 08:49:29 +0100
commit82ea4fdc37c475c4a39842341b6f236c689ff755 (patch)
treeca58cc97f52275b0c6ea10f5b8c2238975cfd118 /package
parent3d441992df13d62109dc8385999ccc5ebe4bf338 (diff)
Use copy ctor instead of ZipPackageFolder::copyZipEntry
Change-Id: Ief103f2f4c66a2086f73c4d2ff332e769e6fc33b
Diffstat (limited to 'package')
-rw-r--r--package/inc/ZipPackageFolder.hxx1
-rw-r--r--package/source/zippackage/ZipPackageFolder.cxx18
-rw-r--r--package/source/zippackage/ZipPackageStream.cxx11
3 files changed, 6 insertions, 24 deletions
diff --git a/package/inc/ZipPackageFolder.hxx b/package/inc/ZipPackageFolder.hxx
index fb6a072751ea..e638cc6a1112 100644
--- a/package/inc/ZipPackageFolder.hxx
+++ b/package/inc/ZipPackageFolder.hxx
@@ -64,7 +64,6 @@ public:
ZipContentInfo& doGetByName( const OUString& aName );
- static void copyZipEntry( ZipEntry &rDest, const ZipEntry &rSource);
static css::uno::Sequence < sal_Int8 > static_getImplementationId();
void setPackageFormat_Impl( sal_Int32 nFormat ) { m_nFormat = nFormat; }
diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx
index 8bf0a8885d82..e7f0cca9813c 100644
--- a/package/source/zippackage/ZipPackageFolder.cxx
+++ b/package/source/zippackage/ZipPackageFolder.cxx
@@ -159,21 +159,6 @@ void ZipPackageFolder::setChildStreamsTypeByExtension( const beans::StringPair&
}
}
-void ZipPackageFolder::copyZipEntry( ZipEntry &rDest, const ZipEntry &rSource)
-{
- rDest.nVersion = rSource.nVersion;
- rDest.nFlag = rSource.nFlag;
- rDest.nMethod = rSource.nMethod;
- rDest.nTime = rSource.nTime;
- rDest.nCrc = rSource.nCrc;
- rDest.nCompressedSize = rSource.nCompressedSize;
- rDest.nSize = rSource.nSize;
- rDest.nOffset = rSource.nOffset;
- rDest.sPath = rSource.sPath;
- rDest.nPathLen = rSource.nPathLen;
- rDest.nExtraLen = rSource.nExtraLen;
-}
-
css::uno::Sequence < sal_Int8 > ZipPackageFolder::static_getImplementationId()
{
return lcl_CachedImplId::get().getImplementationId();
@@ -320,8 +305,7 @@ void ZipPackageFolder::saveContents(
if ( maContents.empty() && !rPath.isEmpty() && m_nFormat != embed::StorageFormats::OFOPXML )
{
// it is an empty subfolder, use workaround to store it
- ZipEntry* pTempEntry = new ZipEntry();
- ZipPackageFolder::copyZipEntry ( *pTempEntry, aEntry );
+ ZipEntry* pTempEntry = new ZipEntry(aEntry);
pTempEntry->nPathLen = (sal_Int16)( OUStringToOString( rPath, RTL_TEXTENCODING_UTF8 ).getLength() );
pTempEntry->nExtraLen = -1;
pTempEntry->sPath = rPath;
diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx
index d684493d4617..7f54260bba40 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -520,15 +520,14 @@ bool ZipPackageStream::saveChild(
uno::Sequence < beans::PropertyValue > aPropSet (PKG_SIZE_NOENCR_MNFST);
+ // In case the entry we are reading is also the entry we are writing, we will
+ // store the ZipEntry data in pTempEntry
+
// if pTempEntry is necessary, it will be released and passed to the ZipOutputStream
// and be deleted in the ZipOutputStream destructor
- std::unique_ptr < ZipEntry > pAutoTempEntry ( new ZipEntry );
+ std::unique_ptr < ZipEntry > pAutoTempEntry ( new ZipEntry(aEntry) );
ZipEntry* pTempEntry = pAutoTempEntry.get();
- // In case the entry we are reading is also the entry we are writing, we will
- // store the ZipEntry data in pTempEntry
-
- ZipPackageFolder::copyZipEntry ( *pTempEntry, aEntry );
pTempEntry->sPath = rPath;
pTempEntry->nPathLen = (sal_Int16)( OUStringToOString( pTempEntry->sPath, RTL_TEXTENCODING_UTF8 ).getLength() );
@@ -904,7 +903,7 @@ void ZipPackageStream::successfullyWritten( ZipEntry *pEntry )
}
// Then copy it back afterwards...
- ZipPackageFolder::copyZipEntry( aEntry, *pEntry );
+ aEntry = *pEntry;
// TODO/LATER: get rid of this hack ( the encrypted stream size property is changed during saving )
if ( m_bIsEncrypted )