Kaydet (Commit) 82ea4fdc authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Use copy ctor instead of ZipPackageFolder::copyZipEntry

Change-Id: Ief103f2f4c66a2086f73c4d2ff332e769e6fc33b
üst 3d441992
......@@ -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; }
......
......@@ -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;
......
......@@ -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 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment