[Libreoffice-commits] .: 31 commits - basctl/source cui/source extensions/source package/inc package/source setup_native/source
Jan Holesovsky
kendy at kemper.freedesktop.org
Wed Mar 23 09:24:41 PDT 2011
basctl/source/basicide/baside2b.cxx | 1
basctl/source/basicide/basidesh.cxx | 5
basctl/source/basicide/bastype2.cxx | 2
cui/source/tabpages/numpages.cxx | 11
cui/source/tabpages/page.cxx | 7
extensions/source/ole/unoobjw.cxx | 2
extensions/source/plugin/unx/sysplug.cxx | 2
package/inc/ZipPackageFolder.hxx | 7
package/source/zippackage/ZipPackageFolder.cxx | 651 ++++++++++++-------------
setup_native/source/win32/msi-encodinglist.txt | 6
10 files changed, 370 insertions(+), 324 deletions(-)
New commits:
commit ca0087ca4d7ade3cf755617e977a1cb39c73b10c
Merge: 940604a... 1dce4c0...
Author: Jan Holesovsky <kendy at suse.cz>
Date: Wed Mar 23 16:58:53 2011 +0100
Merge commit 'ooo/DEV300_m103'
Conflicts:
package/source/zippackage/ZipPackageFolder.cxx
diff --cc cui/source/tabpages/page.cxx
index 29d4a80,12ccfc4..52db5d6
mode 100644,100755..100755
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
diff --cc package/source/zippackage/ZipPackageFolder.cxx
index 5923473,1631f0a..e6f2f12
--- a/package/source/zippackage/ZipPackageFolder.cxx
+++ b/package/source/zippackage/ZipPackageFolder.cxx
@@@ -320,386 -318,407 +318,407 @@@ bool ZipPackageFolder::saveChild( cons
const OUString sSizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Size" ) );
const OUString sDigestProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Digest" ) );
- sal_Bool bHaveEncryptionKey = rEncryptionKey.getLength() ? sal_True : sal_False;
+ Sequence < PropertyValue > aPropSet (PKG_SIZE_NOENCR_MNFST);
- if ( maContents.begin() == maContents.end() && rPath.getLength() && m_nFormat != embed::StorageFormats::OFOPXML )
+ OSL_ENSURE( ( rInfo.bFolder && rInfo.pFolder ) || ( !rInfo.bFolder && rInfo.pStream ), "A valid child object is expected!" );
+ if ( rInfo.bFolder )
{
- // it is an empty subfolder, use workaround to store it
- ZipEntry* pTempEntry = new ZipEntry();
- ZipPackageFolder::copyZipEntry ( *pTempEntry, aEntry );
- pTempEntry->nPathLen = (sal_Int16)( ::rtl::OUStringToOString( rPath, RTL_TEXTENCODING_UTF8 ).getLength() );
- pTempEntry->nExtraLen = -1;
- pTempEntry->sPath = rPath;
+ OUString sTempName = rPath + rShortName + OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
- try
+ if ( rInfo.pFolder->GetMediaType().getLength() )
{
- rtl::Reference < EncryptionData > aEmptyEncr;
- rZipOut.putNextEntry ( *pTempEntry, aEmptyEncr, sal_False );
- rZipOut.rawCloseEntry();
- }
- catch ( ZipException& )
- {
- OSL_FAIL( "Error writing ZipOutputStream" );
- bWritingFailed = sal_True;
- }
- catch ( IOException& )
- {
- OSL_FAIL( "Error writing ZipOutputStream" );
- bWritingFailed = sal_True;
+ aPropSet[PKG_MNFST_MEDIATYPE].Name = sMediaTypeProperty;
+ aPropSet[PKG_MNFST_MEDIATYPE].Value <<= rInfo.pFolder->GetMediaType();
+ aPropSet[PKG_MNFST_VERSION].Name = sVersionProperty;
+ aPropSet[PKG_MNFST_VERSION].Value <<= rInfo.pFolder->GetVersion();
+ aPropSet[PKG_MNFST_FULLPATH].Name = sFullPathProperty;
+ aPropSet[PKG_MNFST_FULLPATH].Value <<= sTempName;
}
+ else
+ aPropSet.realloc( 0 );
+
+ rInfo.pFolder->saveContents( sTempName, rManList, rZipOut, rEncryptionKey, rRandomPool);
}
+ else
+ {
+ // if pTempEntry is necessary, it will be released and passed to the ZipOutputStream
- // and be deleted in the ZipOutputStream destructor
++ // and be deleted in the ZipOutputStream destructor
+ auto_ptr < ZipEntry > pAutoTempEntry ( new ZipEntry );
+ ZipEntry* pTempEntry = pAutoTempEntry.get();
- for ( ContentHash::const_iterator aCI = maContents.begin(), aEnd = maContents.end();
- aCI != aEnd;
- ++aCI)
- {
- const OUString &rShortName = (*aCI).first;
- const ContentInfo &rInfo = *(*aCI).second;
+ // In case the entry we are reading is also the entry we are writing, we will
+ // store the ZipEntry data in pTempEntry
- Sequence < PropertyValue > aPropSet (PKG_SIZE_NOENCR_MNFST);
+ ZipPackageFolder::copyZipEntry ( *pTempEntry, rInfo.pStream->aEntry );
+ pTempEntry->sPath = rPath + rShortName;
+ pTempEntry->nPathLen = (sal_Int16)( ::rtl::OUStringToOString( pTempEntry->sPath, RTL_TEXTENCODING_UTF8 ).getLength() );
- if ( rInfo.bFolder )
- pFolder = rInfo.pFolder;
- else
- pStream = rInfo.pStream;
-
- if ( rInfo.bFolder )
- {
- OUString sTempName = rPath + rShortName + OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
-
- if ( pFolder->GetMediaType().getLength() )
- {
- aPropSet[PKG_MNFST_MEDIATYPE].Name = sMediaTypeProperty;
- aPropSet[PKG_MNFST_MEDIATYPE].Value <<= pFolder->GetMediaType();
- aPropSet[PKG_MNFST_VERSION].Name = sVersionProperty;
- aPropSet[PKG_MNFST_VERSION].Value <<= pFolder->GetVersion();
- aPropSet[PKG_MNFST_FULLPATH].Name = sFullPathProperty;
- aPropSet[PKG_MNFST_FULLPATH].Value <<= sTempName;
- }
- else
- aPropSet.realloc( 0 );
+ sal_Bool bToBeEncrypted = rInfo.pStream->IsToBeEncrypted() && (rEncryptionKey.getLength() || rInfo.pStream->HasOwnKey());
+ sal_Bool bToBeCompressed = bToBeEncrypted ? sal_True : rInfo.pStream->IsToBeCompressed();
- pFolder->saveContents( sTempName, rManList, rZipOut, rEncryptionKey, rRandomPool);
- }
- else
- {
- // if pTempEntry is necessary, it will be released and passed to the ZipOutputStream
- // and be deleted in the ZipOutputStream destructor
- auto_ptr < ZipEntry > pAutoTempEntry ( new ZipEntry );
- ZipEntry* pTempEntry = pAutoTempEntry.get();
+ aPropSet[PKG_MNFST_MEDIATYPE].Name = sMediaTypeProperty;
+ aPropSet[PKG_MNFST_MEDIATYPE].Value <<= rInfo.pStream->GetMediaType( );
+ aPropSet[PKG_MNFST_VERSION].Name = sVersionProperty;
+ aPropSet[PKG_MNFST_VERSION].Value <<= ::rtl::OUString(); // no version is stored for streams currently
+ aPropSet[PKG_MNFST_FULLPATH].Name = sFullPathProperty;
+ aPropSet[PKG_MNFST_FULLPATH].Value <<= pTempEntry->sPath;
- // 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, pStream->aEntry );
- pTempEntry->sPath = rPath + rShortName;
- pTempEntry->nPathLen = (sal_Int16)( ::rtl::OUStringToOString( pTempEntry->sPath, RTL_TEXTENCODING_UTF8 ).getLength() );
+ OSL_ENSURE( rInfo.pStream->GetStreamMode() != PACKAGE_STREAM_NOTSET, "Unacceptable ZipPackageStream mode!" );
- sal_Bool bToBeEncrypted = pStream->IsToBeEncrypted() && (bHaveEncryptionKey || pStream->HasOwnKey());
- sal_Bool bToBeCompressed = bToBeEncrypted ? sal_True : pStream->IsToBeCompressed();
+ sal_Bool bRawStream = sal_False;
+ if ( rInfo.pStream->GetStreamMode() == PACKAGE_STREAM_DETECT )
+ bRawStream = rInfo.pStream->ParsePackageRawStream();
+ else if ( rInfo.pStream->GetStreamMode() == PACKAGE_STREAM_RAW )
+ bRawStream = sal_True;
- aPropSet[PKG_MNFST_MEDIATYPE].Name = sMediaTypeProperty;
- aPropSet[PKG_MNFST_MEDIATYPE].Value <<= pStream->GetMediaType( );
- aPropSet[PKG_MNFST_VERSION].Name = sVersionProperty;
- aPropSet[PKG_MNFST_VERSION].Value <<= ::rtl::OUString(); // no version is stored for streams currently
- aPropSet[PKG_MNFST_FULLPATH].Name = sFullPathProperty;
- aPropSet[PKG_MNFST_FULLPATH].Value <<= pTempEntry->sPath;
+ sal_Bool bTransportOwnEncrStreamAsRaw = sal_False;
+ // During the storing the original size of the stream can be changed
+ // TODO/LATER: get rid of this hack
+ sal_Int32 nOwnStreamOrigSize = bRawStream ? rInfo.pStream->GetMagicalHackSize() : rInfo.pStream->getSize();
+ sal_Bool bUseNonSeekableAccess = sal_False;
+ Reference < XInputStream > xStream;
+ if ( !rInfo.pStream->IsPackageMember() && !bRawStream && !bToBeEncrypted && bToBeCompressed )
+ {
+ // the stream is not a package member, not a raw stream,
+ // it should not be encrypted and it should be compressed,
+ // in this case nonseekable access can be used
- OSL_ENSURE( pStream->GetStreamMode() != PACKAGE_STREAM_NOTSET, "Unacceptable ZipPackageStream mode!" );
+ xStream = rInfo.pStream->GetOwnStreamNoWrap();
+ Reference < XSeekable > xSeek ( xStream, UNO_QUERY );
- sal_Bool bRawStream = sal_False;
- if ( pStream->GetStreamMode() == PACKAGE_STREAM_DETECT )
- bRawStream = pStream->ParsePackageRawStream();
- else if ( pStream->GetStreamMode() == PACKAGE_STREAM_RAW )
- bRawStream = sal_True;
+ bUseNonSeekableAccess = ( xStream.is() && !xSeek.is() );
+ }
- sal_Bool bTransportOwnEncrStreamAsRaw = sal_False;
- // During the storing the original size of the stream can be changed
- // TODO/LATER: get rid of this hack
- sal_Int32 nOwnStreamOrigSize = bRawStream ? pStream->GetMagicalHackSize() : pStream->getSize();
+ if ( !bUseNonSeekableAccess )
+ {
+ xStream = rInfo.pStream->getRawData();
- sal_Bool bUseNonSeekableAccess = sal_False;
- Reference < XInputStream > xStream;
- if ( !pStream->IsPackageMember() && !bRawStream && !bToBeEncrypted && bToBeCompressed )
+ if ( !xStream.is() )
{
- // the stream is not a package member, not a raw stream,
- // it should not be encrypted and it should be compressed,
- // in this case nonseekable access can be used
-
- xStream = pStream->GetOwnStreamNoWrap();
- Reference < XSeekable > xSeek ( xStream, UNO_QUERY );
-
- bUseNonSeekableAccess = ( xStream.is() && !xSeek.is() );
- VOS_ENSURE( 0, "ZipPackageStream didn't have a stream associated with it, skipping!" );
++ OSL_FAIL( "ZipPackageStream didn't have a stream associated with it, skipping!" );
+ bSuccess = false;
+ return bSuccess;
}
- if ( !bUseNonSeekableAccess )
+ Reference < XSeekable > xSeek ( xStream, UNO_QUERY );
+ try
{
- xStream = pStream->getRawData();
-
- if ( !xStream.is() )
+ if ( xSeek.is() )
{
- OSL_FAIL( "ZipPackageStream didn't have a stream associated with it, skipping!" );
- bWritingFailed = sal_True;
- continue;
- }
-
- Reference < XSeekable > xSeek ( xStream, UNO_QUERY );
- try
- {
- if ( xSeek.is() )
+ // If the stream is a raw one, then we should be positioned
+ // at the beginning of the actual data
+ if ( !bToBeCompressed || bRawStream )
{
- // If the stream is a raw one, then we should be positioned
- // at the beginning of the actual data
- if ( !bToBeCompressed || bRawStream )
- {
- // The raw stream can neither be encrypted nor connected
- OSL_ENSURE( !bRawStream || ( !bToBeCompressed && !bToBeEncrypted ), "The stream is already encrypted!\n" );
- xSeek->seek ( bRawStream ? pStream->GetMagicalHackPos() : 0 );
- ImplSetStoredData ( *pTempEntry, xStream );
-
- // TODO/LATER: Get rid of hacks related to switching of Flag Method and Size properties!
- }
- else if ( bToBeEncrypted )
- {
- // this is the correct original size
- pTempEntry->nSize = static_cast < sal_Int32 > ( xSeek->getLength() );
- nOwnStreamOrigSize = pTempEntry->nSize;
- }
-
- xSeek->seek ( 0 );
+ // The raw stream can neither be encrypted nor connected
+ OSL_ENSURE( !bRawStream || !bToBeCompressed && !bToBeEncrypted, "The stream is already encrypted!\n" );
+ xSeek->seek ( bRawStream ? rInfo.pStream->GetMagicalHackPos() : 0 );
+ ImplSetStoredData ( *pTempEntry, xStream );
+
+ // TODO/LATER: Get rid of hacks related to switching of Flag Method and Size properties!
}
- else
+ else if ( bToBeEncrypted )
{
- // Okay, we don't have an xSeekable stream. This is possibly bad.
- // check if it's one of our own streams, if it is then we know that
- // each time we ask for it we'll get a new stream that will be
- // at position zero...otherwise, assert and skip this stream...
- if ( pStream->IsPackageMember() )
- {
- // if the password has been changed than the stream should not be package member any more
- if ( pStream->IsEncrypted() && pStream->IsToBeEncrypted() )
- {
- // Should be handled close to the raw stream handling
- bTransportOwnEncrStreamAsRaw = sal_True;
- pTempEntry->nMethod = STORED;
-
- // TODO/LATER: get rid of this situation
- // this size should be different from the one that will be stored in manifest.xml
- // it is used in storing algorithms and after storing the correct size will be set
- pTempEntry->nSize = pTempEntry->nCompressedSize;
- }
- }
- else
- {
- OSL_FAIL( "The package component requires that every stream either be FROM a package or it must support XSeekable!" );
- continue;
- }
+ // this is the correct original size
+ pTempEntry->nSize = static_cast < sal_Int32 > ( xSeek->getLength() );
+ nOwnStreamOrigSize = pTempEntry->nSize;
}
- }
- catch ( Exception& )
- {
- OSL_FAIL( "The stream provided to the package component has problems!" );
- bWritingFailed = sal_True;
- continue;
- }
- if ( bToBeEncrypted || bRawStream || bTransportOwnEncrStreamAsRaw )
+ xSeek->seek ( 0 );
+ }
+ else
{
- if ( bToBeEncrypted && !bTransportOwnEncrStreamAsRaw )
+ // Okay, we don't have an xSeekable stream. This is possibly bad.
+ // check if it's one of our own streams, if it is then we know that
+ // each time we ask for it we'll get a new stream that will be
+ // at position zero...otherwise, assert and skip this stream...
+ if ( rInfo.pStream->IsPackageMember() )
{
- Sequence < sal_uInt8 > aSalt ( 16 ), aVector ( 8 );
- rtl_random_getBytes ( rRandomPool, aSalt.getArray(), 16 );
- rtl_random_getBytes ( rRandomPool, aVector.getArray(), 8 );
- sal_Int32 nIterationCount = 1024;
-
- if ( !pStream->HasOwnKey() )
- pStream->setKey ( rEncryptionKey );
-
- pStream->setInitialisationVector ( aVector );
- pStream->setSalt ( aSalt );
- pStream->setIterationCount ( nIterationCount );
+ // if the password has been changed than the stream should not be package member any more
+ if ( rInfo.pStream->IsEncrypted() && rInfo.pStream->IsToBeEncrypted() )
+ {
+ // Should be handled close to the raw stream handling
+ bTransportOwnEncrStreamAsRaw = sal_True;
+ pTempEntry->nMethod = STORED;
+
+ // TODO/LATER: get rid of this situation
+ // this size should be different from the one that will be stored in manifest.xml
+ // it is used in storing algorithms and after storing the correct size will be set
+ pTempEntry->nSize = pTempEntry->nCompressedSize;
+ }
}
-
- // last property is digest, which is inserted later if we didn't have
- // a magic header
- aPropSet.realloc(PKG_SIZE_ENCR_MNFST);
-
- aPropSet[PKG_MNFST_INIVECTOR].Name = sInitialisationVectorProperty;
- aPropSet[PKG_MNFST_INIVECTOR].Value <<= pStream->getInitialisationVector();
- aPropSet[PKG_MNFST_SALT].Name = sSaltProperty;
- aPropSet[PKG_MNFST_SALT].Value <<= pStream->getSalt();
- aPropSet[PKG_MNFST_ITERATION].Name = sIterationCountProperty;
- aPropSet[PKG_MNFST_ITERATION].Value <<= pStream->getIterationCount ();
-
- // Need to store the uncompressed size in the manifest
- OSL_ENSURE( nOwnStreamOrigSize >= 0, "The stream size was not correctly initialized!\n" );
- aPropSet[PKG_MNFST_UCOMPSIZE].Name = sSizeProperty;
- aPropSet[PKG_MNFST_UCOMPSIZE].Value <<= nOwnStreamOrigSize;
-
- if ( bRawStream || bTransportOwnEncrStreamAsRaw )
+ else
{
- aPropSet[PKG_MNFST_DIGEST].Name = sDigestProperty;
- aPropSet[PKG_MNFST_DIGEST].Value <<= pStream->getDigest();
- VOS_ENSURE( 0, "The package component requires that every stream either be FROM a package or it must support XSeekable!" );
++ OSL_FAIL( "The package component requires that every stream either be FROM a package or it must support XSeekable!" );
+ bSuccess = false;
+ return bSuccess;
}
}
}
-
- // If the entry is already stored in the zip file in the format we
- // want for this write...copy it raw
- if ( !bUseNonSeekableAccess
- && ( bRawStream || bTransportOwnEncrStreamAsRaw
- || ( pStream->IsPackageMember() && !bToBeEncrypted
- && ( ( pStream->aEntry.nMethod == DEFLATED && bToBeCompressed )
- || ( pStream->aEntry.nMethod == STORED && !bToBeCompressed ) ) ) ) )
+ catch ( Exception& )
{
- // If it's a PackageMember, then it's an unbuffered stream and we need
- // to get a new version of it as we can't seek backwards.
- if ( pStream->IsPackageMember() )
- {
- xStream = pStream->getRawData();
- if ( !xStream.is() )
- {
- // Make sure that we actually _got_ a new one !
- OSL_FAIL( "ZipPackageStream didn't have a stream associated with it, skipping!" );
- continue;
- }
- }
- VOS_ENSURE( 0, "The stream provided to the package component has problems!" );
++ OSL_FAIL( "The stream provided to the package component has problems!" );
+ bSuccess = false;
+ return bSuccess;
+ }
- try
+ if ( bToBeEncrypted || bRawStream || bTransportOwnEncrStreamAsRaw )
+ {
+ if ( bToBeEncrypted && !bTransportOwnEncrStreamAsRaw )
{
- if ( bRawStream )
- xStream->skipBytes( pStream->GetMagicalHackPos() );
- Sequence < sal_uInt8 > aSalt ( 16 ), aVector ( 8 );
++ Sequence < sal_uInt8 > aSalt ( 16 ), aVector ( 8 );
+ rtl_random_getBytes ( rRandomPool, aSalt.getArray(), 16 );
+ rtl_random_getBytes ( rRandomPool, aVector.getArray(), 8 );
+ sal_Int32 nIterationCount = 1024;
-
+
- rZipOut.putNextEntry ( *pTempEntry, pStream->getEncryptionData(), sal_False );
- // the entry is provided to the ZipOutputStream that will delete it
- pAutoTempEntry.release();
+ if ( !rInfo.pStream->HasOwnKey() )
+ rInfo.pStream->setKey ( rEncryptionKey );
- Sequence < sal_Int8 > aSeq ( n_ConstBufferSize );
- sal_Int32 nLength;
+ rInfo.pStream->setInitialisationVector ( aVector );
+ rInfo.pStream->setSalt ( aSalt );
+ rInfo.pStream->setIterationCount ( nIterationCount );
+ }
- do
- {
- nLength = xStream->readBytes( aSeq, n_ConstBufferSize );
- rZipOut.rawWrite(aSeq, 0, nLength);
- }
- while ( nLength == n_ConstBufferSize );
+ // last property is digest, which is inserted later if we didn't have
+ // a magic header
+ aPropSet.realloc(PKG_SIZE_ENCR_MNFST);
- rZipOut.rawCloseEntry();
- }
- catch ( ZipException& )
+ aPropSet[PKG_MNFST_INIVECTOR].Name = sInitialisationVectorProperty;
+ aPropSet[PKG_MNFST_INIVECTOR].Value <<= rInfo.pStream->getInitialisationVector();
+ aPropSet[PKG_MNFST_SALT].Name = sSaltProperty;
+ aPropSet[PKG_MNFST_SALT].Value <<= rInfo.pStream->getSalt();
+ aPropSet[PKG_MNFST_ITERATION].Name = sIterationCountProperty;
+ aPropSet[PKG_MNFST_ITERATION].Value <<= rInfo.pStream->getIterationCount ();
-
++
+ // Need to store the uncompressed size in the manifest
+ OSL_ENSURE( nOwnStreamOrigSize >= 0, "The stream size was not correctly initialized!\n" );
+ aPropSet[PKG_MNFST_UCOMPSIZE].Name = sSizeProperty;
+ aPropSet[PKG_MNFST_UCOMPSIZE].Value <<= nOwnStreamOrigSize;
+
+ if ( bRawStream || bTransportOwnEncrStreamAsRaw )
{
- OSL_FAIL( "Error writing ZipOutputStream" );
- bWritingFailed = sal_True;
+ aPropSet[PKG_MNFST_DIGEST].Name = sDigestProperty;
+ aPropSet[PKG_MNFST_DIGEST].Value <<= rInfo.pStream->getDigest();
}
- catch ( IOException& )
+ }
+ }
+
+ // If the entry is already stored in the zip file in the format we
+ // want for this write...copy it raw
+ if ( !bUseNonSeekableAccess
+ && ( bRawStream || bTransportOwnEncrStreamAsRaw
+ || ( rInfo.pStream->IsPackageMember() && !bToBeEncrypted
+ && ( ( rInfo.pStream->aEntry.nMethod == DEFLATED && bToBeCompressed )
+ || ( rInfo.pStream->aEntry.nMethod == STORED && !bToBeCompressed ) ) ) ) )
+ {
+ // If it's a PackageMember, then it's an unbuffered stream and we need
+ // to get a new version of it as we can't seek backwards.
+ if ( rInfo.pStream->IsPackageMember() )
- {
++ {
+ xStream = rInfo.pStream->getRawData();
+ if ( !xStream.is() )
{
- OSL_FAIL( "Error writing ZipOutputStream" );
- bWritingFailed = sal_True;
+ // Make sure that we actually _got_ a new one !
- VOS_ENSURE( 0, "ZipPackageStream didn't have a stream associated with it, skipping!" );
++ OSL_FAIL( "ZipPackageStream didn't have a stream associated with it, skipping!" );
+ bSuccess = false;
+ return bSuccess;
}
}
- else
+
+ try
{
- // This stream is defenitly not a raw stream
-
- // If nonseekable access is used the stream should be at the beginning and
- // is useless after the storing. Thus if the storing fails the package should
- // be thrown away ( as actually it is done currently )!
- // To allow to reuse the package after the error, the optimization must be removed!
-
- // If it's a PackageMember, then our previous reference held a 'raw' stream
- // so we need to re-get it, unencrypted, uncompressed and positioned at the
- // beginning of the stream
- if ( pStream->IsPackageMember() )
- {
- xStream = pStream->getInputStream();
- if ( !xStream.is() )
- {
- // Make sure that we actually _got_ a new one !
- OSL_FAIL( "ZipPackageStream didn't have a stream associated with it, skipping!" );
- continue;
- }
- }
+ if ( bRawStream )
+ xStream->skipBytes( rInfo.pStream->GetMagicalHackPos() );
+
+ rZipOut.putNextEntry ( *pTempEntry, rInfo.pStream->getEncryptionData(), sal_False );
+ // the entry is provided to the ZipOutputStream that will delete it
+ pAutoTempEntry.release();
+
+ Sequence < sal_Int8 > aSeq ( n_ConstBufferSize );
+ sal_Int32 nLength;
- if ( bToBeCompressed )
+ do
{
- pTempEntry->nMethod = DEFLATED;
- pTempEntry->nCrc = pTempEntry->nCompressedSize = pTempEntry->nSize = -1;
+ nLength = xStream->readBytes( aSeq, n_ConstBufferSize );
+ rZipOut.rawWrite(aSeq, 0, nLength);
}
+ while ( nLength == n_ConstBufferSize );
- try
- {
- rZipOut.putNextEntry ( *pTempEntry, pStream->getEncryptionData(), bToBeEncrypted);
- // the entry is provided to the ZipOutputStream that will delete it
- pAutoTempEntry.release();
+ rZipOut.rawCloseEntry();
+ }
+ catch ( ZipException& )
+ {
- VOS_ENSURE( 0, "Error writing ZipOutputStream" );
++ OSL_FAIL( "Error writing ZipOutputStream" );
+ bSuccess = false;
+ }
+ catch ( IOException& )
+ {
- VOS_ENSURE( 0, "Error writing ZipOutputStream" );
++ OSL_FAIL( "Error writing ZipOutputStream" );
+ bSuccess = false;
+ }
+ }
+ else
+ {
+ // This stream is defenitly not a raw stream
-
+
- sal_Int32 nLength;
- Sequence < sal_Int8 > aSeq (n_ConstBufferSize);
- do
- {
- nLength = xStream->readBytes(aSeq, n_ConstBufferSize);
- rZipOut.write(aSeq, 0, nLength);
- }
- while ( nLength == n_ConstBufferSize );
+ // If nonseekable access is used the stream should be at the beginning and
+ // is useless after the storing. Thus if the storing fails the package should
+ // be thrown away ( as actually it is done currently )!
+ // To allow to reuse the package after the error, the optimization must be removed!
-
+
- rZipOut.closeEntry();
- }
- catch ( ZipException& )
- {
- OSL_FAIL( "Error writing ZipOutputStream" );
- bWritingFailed = sal_True;
- }
- catch ( IOException& )
+ // If it's a PackageMember, then our previous reference held a 'raw' stream
+ // so we need to re-get it, unencrypted, uncompressed and positioned at the
+ // beginning of the stream
+ if ( rInfo.pStream->IsPackageMember() )
- {
++ {
+ xStream = rInfo.pStream->getInputStream();
+ if ( !xStream.is() )
{
- OSL_FAIL( "Error writing ZipOutputStream" );
- bWritingFailed = sal_True;
+ // Make sure that we actually _got_ a new one !
- VOS_ENSURE( 0, "ZipPackageStream didn't have a stream associated with it, skipping!" );
++ OSL_FAIL( "ZipPackageStream didn't have a stream associated with it, skipping!" );
+ bSuccess = false;
+ return bSuccess;
}
+ }
- if ( bToBeEncrypted )
- {
- aPropSet[PKG_MNFST_DIGEST].Name = sDigestProperty;
- aPropSet[PKG_MNFST_DIGEST].Value <<= pStream->getDigest();
- pStream->SetIsEncrypted ( sal_True );
- }
+ if ( bToBeCompressed )
+ {
+ pTempEntry->nMethod = DEFLATED;
+ pTempEntry->nCrc = pTempEntry->nCompressedSize = pTempEntry->nSize = -1;
}
- if( !bWritingFailed )
+ try
{
- if ( !pStream->IsPackageMember() )
- {
- pStream->CloseOwnStreamIfAny();
- pStream->SetPackageMember ( sal_True );
- }
+ rZipOut.putNextEntry ( *pTempEntry, rInfo.pStream->getEncryptionData(), bToBeEncrypted);
+ // the entry is provided to the ZipOutputStream that will delete it
+ pAutoTempEntry.release();
- if ( bRawStream )
- {
- // the raw stream was integrated and now behaves
- // as usual encrypted stream
- pStream->SetToBeEncrypted( sal_True );
- }
-
- // Remove hacky bit from entry flags
- if ( pTempEntry->nFlag & ( 1 << 4 ) )
+ sal_Int32 nLength;
+ Sequence < sal_Int8 > aSeq (n_ConstBufferSize);
+ do
{
- pTempEntry->nFlag &= ~( 1 << 4 );
- pTempEntry->nMethod = STORED;
+ nLength = xStream->readBytes(aSeq, n_ConstBufferSize);
+ rZipOut.write(aSeq, 0, nLength);
}
+ while ( nLength == n_ConstBufferSize );
- // Then copy it back afterwards...
- ZipPackageFolder::copyZipEntry ( pStream->aEntry, *pTempEntry );
+ rZipOut.closeEntry();
+ }
+ catch ( ZipException& )
+ {
- VOS_ENSURE( 0, "Error writing ZipOutputStream" );
++ OSL_FAIL( "Error writing ZipOutputStream" );
+ bSuccess = false;
+ }
+ catch ( IOException& )
+ {
- VOS_ENSURE( 0, "Error writing ZipOutputStream" );
++ OSL_FAIL( "Error writing ZipOutputStream" );
+ bSuccess = false;
+ }
+
+ if ( bToBeEncrypted )
+ {
+ aPropSet[PKG_MNFST_DIGEST].Name = sDigestProperty;
+ aPropSet[PKG_MNFST_DIGEST].Value <<= rInfo.pStream->getDigest();
+ rInfo.pStream->SetIsEncrypted ( sal_True );
+ }
+ }
+
+ if( bSuccess )
+ {
+ if ( !rInfo.pStream->IsPackageMember() )
+ {
+ rInfo.pStream->CloseOwnStreamIfAny();
+ rInfo.pStream->SetPackageMember ( sal_True );
+ }
- // TODO/LATER: get rid of this hack ( the encrypted stream size property is changed during saving )
- if ( pStream->IsEncrypted() )
- pStream->setSize( nOwnStreamOrigSize );
+ if ( bRawStream )
+ {
+ // the raw stream was integrated and now behaves
+ // as usual encrypted stream
+ rInfo.pStream->SetToBeEncrypted( sal_True );
+ }
- pStream->aEntry.nOffset *= -1;
+ // Remove hacky bit from entry flags
+ if ( pTempEntry->nFlag & ( 1 << 4 ) )
+ {
+ pTempEntry->nFlag &= ~( 1 << 4 );
+ pTempEntry->nMethod = STORED;
}
+
+ // Then copy it back afterwards...
+ ZipPackageFolder::copyZipEntry ( rInfo.pStream->aEntry, *pTempEntry );
+
+ // TODO/LATER: get rid of this hack ( the encrypted stream size property is changed during saving )
+ if ( rInfo.pStream->IsEncrypted() )
+ rInfo.pStream->setSize( nOwnStreamOrigSize );
+
+ rInfo.pStream->aEntry.nOffset *= -1;
+ }
+ }
+
+ // folder can have a mediatype only in package format
+ if ( aPropSet.getLength()
+ && ( m_nFormat == embed::StorageFormats::PACKAGE || ( m_nFormat == embed::StorageFormats::OFOPXML && !rInfo.bFolder ) ) )
+ rManList.push_back( aPropSet );
+
+ return bSuccess;
+ }
+
+ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < PropertyValue > > &rManList, ZipOutputStream & rZipOut, Sequence < sal_Int8 > &rEncryptionKey, rtlRandomPool &rRandomPool)
+ throw(RuntimeException)
+ {
+ bool bWritingFailed = false;
+
+ if ( maContents.begin() == maContents.end() && rPath.getLength() && m_nFormat != embed::StorageFormats::OFOPXML )
+ {
+ // it is an empty subfolder, use workaround to store it
+ ZipEntry* pTempEntry = new ZipEntry();
+ ZipPackageFolder::copyZipEntry ( *pTempEntry, aEntry );
+ pTempEntry->nPathLen = (sal_Int16)( ::rtl::OUStringToOString( rPath, RTL_TEXTENCODING_UTF8 ).getLength() );
+ pTempEntry->nExtraLen = -1;
+ pTempEntry->sPath = rPath;
+
+ try
+ {
- vos::ORef < EncryptionData > aEmptyEncr;
++ rtl::Reference < EncryptionData > aEmptyEncr;
+ rZipOut.putNextEntry ( *pTempEntry, aEmptyEncr, sal_False );
+ rZipOut.rawCloseEntry();
}
+ catch ( ZipException& )
+ {
- VOS_ENSURE( 0, "Error writing ZipOutputStream" );
++ OSL_FAIL( "Error writing ZipOutputStream" );
+ bWritingFailed = true;
+ }
+ catch ( IOException& )
+ {
- VOS_ENSURE( 0, "Error writing ZipOutputStream" );
++ OSL_FAIL( "Error writing ZipOutputStream" );
+ bWritingFailed = true;
+ }
+ }
+
+ bool bMimeTypeStreamStored = false;
+ ::rtl::OUString aMimeTypeStreamName( RTL_CONSTASCII_USTRINGPARAM( "mimetype" ) );
+ if ( m_nFormat == embed::StorageFormats::ZIP && !rPath.getLength() )
+ {
+ // let the "mimtype" stream in root folder be stored as the first stream if it is zip format
+ ContentHash::iterator aIter = maContents.find ( aMimeTypeStreamName );
+ if ( aIter != maContents.end() && !(*aIter).second->bFolder )
+ {
+ bMimeTypeStreamStored = true;
+ bWritingFailed = !saveChild( (*aIter).first, *(*aIter).second, rPath, rManList, rZipOut, rEncryptionKey, rRandomPool );
+ }
+ }
+
+ for ( ContentHash::const_iterator aCI = maContents.begin(), aEnd = maContents.end();
- aCI != aEnd;
++ aCI != aEnd;
+ aCI++)
- {
++ {
+ const OUString &rShortName = (*aCI).first;
+ const ContentInfo &rInfo = *(*aCI).second;
-
+
- // folder can have a mediatype only in package format
- if ( aPropSet.getLength()
- && ( m_nFormat == embed::StorageFormats::PACKAGE || ( m_nFormat == embed::StorageFormats::OFOPXML && !rInfo.bFolder ) ) )
- rManList.push_back( aPropSet );
+ if ( !bMimeTypeStreamStored || !rShortName.equals( aMimeTypeStreamName ) )
+ bWritingFailed = !saveChild( rShortName, rInfo, rPath, rManList, rZipOut, rEncryptionKey, rRandomPool );
}
if( bWritingFailed )
commit 1dce4c03c133f2aa16d822abe7162dda6c4812a6
Merge: 5e37deb... 24303a2...
Author: obo <obo at openoffice.org>
Date: Wed Mar 16 09:37:48 2011 +0100
CWS-TOOLING: integrate CWS l10n36
commit 5e37deb18443f44684aa0f92760b5431592a5f94
Merge: d250239... e476a98...
Author: obo <obo at openoffice.org>
Date: Wed Mar 16 08:29:30 2011 +0100
CWS-TOOLING: integrate CWS debuglevels
commit e476a981e65c98a45e984977a20712129eefd2e7
Merge: b222fc3... d250239...
Author: Frank Schoenheit [fs] <frank.schoenheit at oracle.com>
Date: Mon Mar 14 09:47:56 2011 +0100
debuglevels: pulled and merged DEV300.m102
commit 24303a2b518755f017b8489d6655926b25a441c5
Author: Ivo Hinkelmann <ihi at openoffice.org>
Date: Tue Mar 8 12:55:52 2011 +0100
l10n36: #i117281# add isocodes fur jbo kab nso ny so
diff --git a/setup_native/source/win32/msi-encodinglist.txt b/setup_native/source/win32/msi-encodinglist.txt
index ebfe937..ea4baf3 100644
--- a/setup_native/source/win32/msi-encodinglist.txt
+++ b/setup_native/source/win32/msi-encodinglist.txt
@@ -36,6 +36,7 @@ fi 1252 1035
fo 1252 1080 # Faroese
fr 1252 1036
fr-CA 1252 3084
+fur 0 1585
ga 0 2108 # Irish
gd 0 1084 # Gaelic (Scotland)
gl 1252 1110 # Galician
@@ -51,7 +52,9 @@ id 1252 1057 # Indonesian
is 1252 1039 # Icelandic
it 1252 1040
ja 932 1041
+jbo 0 1624
ka 0 1079 # Georgian
+kab 0 1625
kid 1252 1033 # key id pseudo language
kk 0 1087
km 0 1107 # Khmer
@@ -84,6 +87,8 @@ nn 1252 2068
no 1252 1044
nr 0 1580 # Ndebele South
ns 0 1132 # Northern Sotho (Sepedi)
+nso 0 1132
+ny 0 1598
oc 1252 1154 # Occitan-lengadocian
om 0 2162
or 0 1096 # Oriya
@@ -116,6 +121,7 @@ st 0 1072 # Southern Sotho, Sutu
sv 1252 1053
sw 1252 1089 # Swahili
sw-TZ 1252 1089 # Swahili
+so 0 1143
ta 0 1097 # Tamil
ta-IN 0 1097 # Tamil
te 0 1098
commit d250239870bd9a2c63f466b15befdb4e7072d310
Merge: 9bece33... d527965...
Author: Ivo Hinkelmann <ihi at openoffice.org>
Date: Mon Mar 7 17:31:32 2011 +0100
CWS-TOOLING: integrate CWS os146
diff --cc cui/source/tabpages/page.cxx
index 83413f6,d1ca879..12ccfc4
mode 100644,100755..100755
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
commit 9bece331b05f224d8936b16b4a383f97c88e35c7
Merge: b3bf07a... 0fcf765...
Author: Ivo Hinkelmann <ihi at openoffice.org>
Date: Mon Mar 7 13:36:42 2011 +0100
CWS-TOOLING: integrate CWS fwk165
commit b3bf07a60f2c24706c73b361b72751387452a354
Author: Ivo Hinkelmann <ihi at openoffice.org>
Date: Thu Mar 3 14:40:13 2011 +0100
masterfix DEV300: MinGW fix
diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index bd06e3c..c01ab3f 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -931,7 +931,7 @@ HRESULT InterfaceOleWrapper_Impl::doInvoke( DISPPARAMS * pdispparams, VARIANT *
// try to write back out parameter
if (outIndex.getLength() > 0)
{
- const INT16* pOutIndex = outIndex.getConstArray();
+ const sal_Int16* pOutIndex = outIndex.getConstArray();
const Any* pOutParams = outParams.getConstArray();
for (sal_Int32 i = 0; i < outIndex.getLength(); i++)
commit 13de95aed5f8d29c7004d987c6f2f028aee19b70
Merge: 2c63f13... fb80046...
Author: Ivo Hinkelmann <ihi at openoffice.org>
Date: Mon Feb 28 17:06:12 2011 +0100
CWS-TOOLING: integrate CWS ab81
commit 2c63f131bf43a6c110c94a6592578742adab30ab
Merge: e887a29... d1b66c7...
Author: Ivo Hinkelmann <ihi at openoffice.org>
Date: Mon Feb 28 16:55:36 2011 +0100
CWS-TOOLING: integrate CWS sw34bf03
commit b222fc371ccce73fda67ada22f50a169811bd048
Merge: 93a3007... e887a29...
Author: Frank Schoenheit [fs] <frank.schoenheit at oracle.com>
Date: Wed Feb 23 12:42:39 2011 +0100
debuglevels: pulled and merged latest changes from DEV300_next
commit 93a30070a2a7188496cbecca7a0969e74e4da8fb
Merge: 3fc6dc3... d7aedca...
Author: Frank Schoenheit [fs] <frank.schoenheit at oracle.com>
Date: Wed Feb 23 09:58:44 2011 +0100
debuglevels: merged to-be-m101
commit fb800468e556a8d99a09e04f517766ba14217a29
Merge: 22f9eba... 9648a57...
Author: Andreas Bregas <ab at openoffice.org>
Date: Fri Feb 18 10:28:34 2011 +0100
ab81: resync to m100
commit 22f9eba01dfe448413e80c8195129e490820c72e
Author: Andreas Bregas <ab at openoffice.org>
Date: Thu Feb 17 10:48:27 2011 +0100
ab81: #i115671# Fixed Save button handling in Basic IDE
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index eee7c5a..445dd05 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -309,7 +309,10 @@ void BasicIDEShell::onDocumentSave( const ScriptDocument& /*_rDocument*/ )
void BasicIDEShell::onDocumentSaveDone( const ScriptDocument& /*_rDocument*/ )
{
- // not interested in
+ // #i115671: Update SID_SAVEDOC after saving is completed
+ SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
+ if ( pBindings )
+ pBindings->Invalidate( SID_SAVEDOC );
}
void BasicIDEShell::onDocumentSaveAs( const ScriptDocument& /*_rDocument*/ )
commit 7d97d71560ae2d00af0e8b45e9fdb6c3c2694301
Author: Andreas Bregas <ab at openoffice.org>
Date: Thu Feb 17 10:40:14 2011 +0100
ab81: #i108119# Fixed undo slot handling
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 571c32e..5cb66e4 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -465,6 +465,7 @@ void __EXPORT EditorWindow::KeyInput( const KeyEvent& rKEvt )
{
pBindings->Invalidate( SID_SAVEDOC );
pBindings->Invalidate( SID_DOC_MODIFIED );
+ pBindings->Invalidate( SID_UNDO );
}
if ( rKEvt.GetKeyCode().GetCode() == KEY_INSERT )
pBindings->Invalidate( SID_ATTR_INSERT );
commit d52796551a11684136b34a6eed1cd470faec47e7
Author: os <os at openoffice.org>
Date: Wed Feb 16 11:53:46 2011 +0100
USHORT removed
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
old mode 100644
new mode 100755
index cc5fca1..d1ca879
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -605,7 +605,7 @@ void SvxPageDescPage::Reset( const SfxItemSet& rSet )
ResStringArray aPaperAry( CUI_RES( nAryId ) );
sal_uInt32 nCnt = aPaperAry.Count();
- USHORT nUserPos = LISTBOX_ENTRY_NOTFOUND;
+ sal_uInt16 nUserPos = LISTBOX_ENTRY_NOTFOUND;
for ( sal_uInt32 i = 0; i < nCnt; ++i )
{
String aStr = aPaperAry.GetString(i);
commit a38e508534cc814788793de5c36264fd2d3d500a
Author: Andreas Bregas <ab at openoffice.org>
Date: Wed Feb 16 10:59:57 2011 +0100
ab81: #i86628# BasicTreeListBox::ImpCreateLibSubEntries(): Refer to right LibraryContainer in dialog mode
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index 9aac98d..8af9652 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -383,7 +383,7 @@ void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const
// dialogs
if ( nMode & BROWSEMODE_DIALOGS )
{
- Reference< script::XLibraryContainer > xDlgLibContainer( rDocument.getLibraryContainer( E_SCRIPTS ) );
+ Reference< script::XLibraryContainer > xDlgLibContainer( rDocument.getLibraryContainer( E_DIALOGS ) );
if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryLoaded( aOULibName ) )
{
commit 0fcf7651825df914672c7c5c42b6e5c4cc3dd6ee
Merge: 81436d3... 9648a57...
Author: Carsten Driesner <cd at openoffice.org>
Date: Wed Feb 16 10:30:35 2011 +0100
fwk165: Rebase to DEV300m100
commit aee7923651770cac9fffde1e8116edf78c156239
Merge: 0f6ac37... 9648a57...
Author: os <os at openoffice.org>
Date: Tue Feb 15 16:01:31 2011 +0100
m100 merged
commit 3fc6dc381b070c2d533c2eb7da84ed0f1f33c179
Merge: f873ed2... 9648a57...
Author: Frank Schoenheit [fs] <frank.schoenheit at oracle.com>
Date: Mon Feb 14 23:26:54 2011 +0100
debuglevels: pulled and merged DEV300.m100
commit f873ed2597c0cb4667e6c1a660e78262d1078682
Author: Frank Schoenheit [fs] <frank.schoenheit at oracle.com>
Date: Sun Feb 13 20:23:40 2011 +0100
debuglevels: silence unxsoli4.pro+debug warning
diff --git a/extensions/source/plugin/unx/sysplug.cxx b/extensions/source/plugin/unx/sysplug.cxx
index c14bc72..d3d340e 100644
--- a/extensions/source/plugin/unx/sysplug.cxx
+++ b/extensions/source/plugin/unx/sysplug.cxx
@@ -109,7 +109,7 @@ UnxPluginComm::~UnxPluginComm()
int status = 16777216;
pid_t nExit = waitpid( m_nCommPID, &status, WUNTRACED );
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "child %d (plugin app child %d) exited with status %d\n", nExit, m_nCommPID, WEXITSTATUS(status) );
+ fprintf( stderr, "child %d (plugin app child %d) exited with status %d\n", (int)nExit, (int)m_nCommPID, (int)WEXITSTATUS(status) );
#else
(void)nExit;
#endif
commit d1b66c7cbee4019b38cb47a9aeb81d3ceb4b47d7
Merge: bf6fdfb... 9648a57...
Author: Michael Stahl <mst at openoffice.org>
Date: Fri Feb 11 15:41:40 2011 +0100
sw34bf03: merge to-be-m100 DEV300_next
diff --cc cui/source/tabpages/numpages.cxx
index 5b3d3cc,505a3f1..29a6568
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@@ -859,12 -856,9 +859,12 @@@ IMPL_LINK(SvxNumPickTabPage, NumSelectH
break;
SvxNumberFormat aFmt(pActNum->GetLevel(i));
aFmt.SetNumberingType( pLevelSettings->nNumberType );
- USHORT nUpperLevelOrChar = (USHORT)pLevelSettings->nParentNumbering;
+ sal_uInt16 nUpperLevelOrChar = (sal_uInt16)pLevelSettings->nParentNumbering;
if(aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL)
{
+ // #i93908# clear suffix for bullet lists
+ aFmt.SetPrefix(::rtl::OUString());
+ aFmt.SetSuffix(::rtl::OUString());
if( pLevelSettings->sBulletFont.getLength() &&
pLevelSettings->sBulletFont.compareTo(
rActBulletFont.GetName()))
commit 81436d3a10a6841c3683f7e4ef762753c551b3d5
Author: Carsten Driesner <cd at openoffice.org>
Date: Thu Feb 10 11:09:01 2011 +0100
fwk165: #i116290# Fixed build breaker with gcc
diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx
index dcbf4f9..1631f0a 100644
--- a/package/source/zippackage/ZipPackageFolder.cxx
+++ b/package/source/zippackage/ZipPackageFolder.cxx
@@ -319,7 +319,6 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
const OUString sDigestProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Digest" ) );
Sequence < PropertyValue > aPropSet (PKG_SIZE_NOENCR_MNFST);
- ZipPackageStream *pStream = NULL;
OSL_ENSURE( ( rInfo.bFolder && rInfo.pFolder ) || ( !rInfo.bFolder && rInfo.pStream ), "A valid child object is expected!" );
if ( rInfo.bFolder )
commit 3a666335473104fa1de28bc235757b2dd57bab58
Author: Mikhail Voytenko <mav at openoffice.org>
Date: Mon Feb 7 17:10:57 2011 +0100
fwk165: #i116290# let mimetype stream be zipped as the first one
diff --git a/package/inc/ZipPackageFolder.hxx b/package/inc/ZipPackageFolder.hxx
index d2963f8..b96675d 100644
--- a/package/inc/ZipPackageFolder.hxx
+++ b/package/inc/ZipPackageFolder.hxx
@@ -39,7 +39,12 @@ namespace beans
{
struct PropertyValue;
}
+namespace packages
+{
+ class ContentInfo;
+}
} } }
+
class ZipFile;
class ZipPackage;
class ZipOutputStream;
@@ -85,6 +90,8 @@ public:
void setPackageFormat_Impl( sal_Int32 nFormat ) { m_nFormat = nFormat; }
void setRemoveOnInsertMode_Impl( sal_Bool bRemove ) { this->mbAllowRemoveOnInsert = bRemove; }
+ bool saveChild(const rtl::OUString &rShortName, const com::sun::star::packages::ContentInfo &rInfo, rtl::OUString &rPath, std::vector < com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > > &rManList, ZipOutputStream & rZipOut, com::sun::star::uno::Sequence < sal_Int8 > &rEncryptionKey, rtlRandomPool & rRandomPool);
+
// Recursive functions
void saveContents(rtl::OUString &rPath, std::vector < com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > > &rManList, ZipOutputStream & rZipOut, com::sun::star::uno::Sequence < sal_Int8 > &rEncryptionKey, rtlRandomPool & rRandomPool)
throw(::com::sun::star::uno::RuntimeException);
diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx
index 70df279..dcbf4f9 100644
--- a/package/source/zippackage/ZipPackageFolder.cxx
+++ b/package/source/zippackage/ZipPackageFolder.cxx
@@ -48,8 +48,8 @@
using namespace com::sun::star::packages::zip::ZipConstants;
using namespace com::sun::star::packages::zip;
-using namespace com::sun::star::container;
using namespace com::sun::star::packages;
+using namespace com::sun::star::container;
using namespace com::sun::star::beans;
using namespace com::sun::star::lang;
using namespace com::sun::star::uno;
@@ -305,12 +305,10 @@ static void ImplSetStoredData( ZipEntry & rEntry, Reference < XInputStream> & rS
rEntry.nCrc = aCRC32.getValue();
}
-void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < PropertyValue > > &rManList, ZipOutputStream & rZipOut, Sequence < sal_Int8 > &rEncryptionKey, rtlRandomPool &rRandomPool)
- throw(RuntimeException)
+bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo &rInfo, OUString &rPath, std::vector < Sequence < PropertyValue > > &rManList, ZipOutputStream & rZipOut, Sequence < sal_Int8 > &rEncryptionKey, rtlRandomPool &rRandomPool)
{
- sal_Bool bWritingFailed = sal_False;
- ZipPackageFolder *pFolder = NULL;
- ZipPackageStream *pStream = NULL;
+ bool bSuccess = true;
+
const OUString sMediaTypeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) );
const OUString sVersionProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Version" ) );
const OUString sFullPathProperty ( RTL_CONSTASCII_USTRINGPARAM ( "FullPath" ) );
@@ -320,386 +318,408 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
const OUString sSizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Size" ) );
const OUString sDigestProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Digest" ) );
- sal_Bool bHaveEncryptionKey = rEncryptionKey.getLength() ? sal_True : sal_False;
+ Sequence < PropertyValue > aPropSet (PKG_SIZE_NOENCR_MNFST);
+ ZipPackageStream *pStream = NULL;
- if ( maContents.begin() == maContents.end() && rPath.getLength() && m_nFormat != embed::StorageFormats::OFOPXML )
+ OSL_ENSURE( ( rInfo.bFolder && rInfo.pFolder ) || ( !rInfo.bFolder && rInfo.pStream ), "A valid child object is expected!" );
+ if ( rInfo.bFolder )
{
- // it is an empty subfolder, use workaround to store it
- ZipEntry* pTempEntry = new ZipEntry();
- ZipPackageFolder::copyZipEntry ( *pTempEntry, aEntry );
- pTempEntry->nPathLen = (sal_Int16)( ::rtl::OUStringToOString( rPath, RTL_TEXTENCODING_UTF8 ).getLength() );
- pTempEntry->nExtraLen = -1;
- pTempEntry->sPath = rPath;
+ OUString sTempName = rPath + rShortName + OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
- try
- {
- vos::ORef < EncryptionData > aEmptyEncr;
- rZipOut.putNextEntry ( *pTempEntry, aEmptyEncr, sal_False );
- rZipOut.rawCloseEntry();
- }
- catch ( ZipException& )
+ if ( rInfo.pFolder->GetMediaType().getLength() )
{
- VOS_ENSURE( 0, "Error writing ZipOutputStream" );
- bWritingFailed = sal_True;
- }
- catch ( IOException& )
- {
- VOS_ENSURE( 0, "Error writing ZipOutputStream" );
- bWritingFailed = sal_True;
+ aPropSet[PKG_MNFST_MEDIATYPE].Name = sMediaTypeProperty;
+ aPropSet[PKG_MNFST_MEDIATYPE].Value <<= rInfo.pFolder->GetMediaType();
+ aPropSet[PKG_MNFST_VERSION].Name = sVersionProperty;
+ aPropSet[PKG_MNFST_VERSION].Value <<= rInfo.pFolder->GetVersion();
+ aPropSet[PKG_MNFST_FULLPATH].Name = sFullPathProperty;
+ aPropSet[PKG_MNFST_FULLPATH].Value <<= sTempName;
}
- }
+ else
+ aPropSet.realloc( 0 );
- for ( ContentHash::const_iterator aCI = maContents.begin(), aEnd = maContents.end();
- aCI != aEnd;
- aCI++)
- {
- const OUString &rShortName = (*aCI).first;
- const ContentInfo &rInfo = *(*aCI).second;
+ rInfo.pFolder->saveContents( sTempName, rManList, rZipOut, rEncryptionKey, rRandomPool);
+ }
+ else
+ {
+ // if pTempEntry is necessary, it will be released and passed to the ZipOutputStream
+ // and be deleted in the ZipOutputStream destructor
+ auto_ptr < ZipEntry > pAutoTempEntry ( new ZipEntry );
+ ZipEntry* pTempEntry = pAutoTempEntry.get();
- Sequence < 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 ( rInfo.bFolder )
- pFolder = rInfo.pFolder;
- else
- pStream = rInfo.pStream;
-
- if ( rInfo.bFolder )
- {
- OUString sTempName = rPath + rShortName + OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
+ ZipPackageFolder::copyZipEntry ( *pTempEntry, rInfo.pStream->aEntry );
+ pTempEntry->sPath = rPath + rShortName;
+ pTempEntry->nPathLen = (sal_Int16)( ::rtl::OUStringToOString( pTempEntry->sPath, RTL_TEXTENCODING_UTF8 ).getLength() );
- if ( pFolder->GetMediaType().getLength() )
- {
- aPropSet[PKG_MNFST_MEDIATYPE].Name = sMediaTypeProperty;
- aPropSet[PKG_MNFST_MEDIATYPE].Value <<= pFolder->GetMediaType();
- aPropSet[PKG_MNFST_VERSION].Name = sVersionProperty;
- aPropSet[PKG_MNFST_VERSION].Value <<= pFolder->GetVersion();
- aPropSet[PKG_MNFST_FULLPATH].Name = sFullPathProperty;
- aPropSet[PKG_MNFST_FULLPATH].Value <<= sTempName;
- }
- else
- aPropSet.realloc( 0 );
+ sal_Bool bToBeEncrypted = rInfo.pStream->IsToBeEncrypted() && (rEncryptionKey.getLength() || rInfo.pStream->HasOwnKey());
+ sal_Bool bToBeCompressed = bToBeEncrypted ? sal_True : rInfo.pStream->IsToBeCompressed();
- pFolder->saveContents( sTempName, rManList, rZipOut, rEncryptionKey, rRandomPool);
- }
- else
- {
- // if pTempEntry is necessary, it will be released and passed to the ZipOutputStream
- // and be deleted in the ZipOutputStream destructor
- auto_ptr < ZipEntry > pAutoTempEntry ( new ZipEntry );
- ZipEntry* pTempEntry = pAutoTempEntry.get();
+ aPropSet[PKG_MNFST_MEDIATYPE].Name = sMediaTypeProperty;
+ aPropSet[PKG_MNFST_MEDIATYPE].Value <<= rInfo.pStream->GetMediaType( );
+ aPropSet[PKG_MNFST_VERSION].Name = sVersionProperty;
+ aPropSet[PKG_MNFST_VERSION].Value <<= ::rtl::OUString(); // no version is stored for streams currently
+ aPropSet[PKG_MNFST_FULLPATH].Name = sFullPathProperty;
+ aPropSet[PKG_MNFST_FULLPATH].Value <<= pTempEntry->sPath;
- // 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, pStream->aEntry );
- pTempEntry->sPath = rPath + rShortName;
- pTempEntry->nPathLen = (sal_Int16)( ::rtl::OUStringToOString( pTempEntry->sPath, RTL_TEXTENCODING_UTF8 ).getLength() );
+ OSL_ENSURE( rInfo.pStream->GetStreamMode() != PACKAGE_STREAM_NOTSET, "Unacceptable ZipPackageStream mode!" );
- sal_Bool bToBeEncrypted = pStream->IsToBeEncrypted() && (bHaveEncryptionKey || pStream->HasOwnKey());
- sal_Bool bToBeCompressed = bToBeEncrypted ? sal_True : pStream->IsToBeCompressed();
+ sal_Bool bRawStream = sal_False;
+ if ( rInfo.pStream->GetStreamMode() == PACKAGE_STREAM_DETECT )
+ bRawStream = rInfo.pStream->ParsePackageRawStream();
+ else if ( rInfo.pStream->GetStreamMode() == PACKAGE_STREAM_RAW )
+ bRawStream = sal_True;
- aPropSet[PKG_MNFST_MEDIATYPE].Name = sMediaTypeProperty;
- aPropSet[PKG_MNFST_MEDIATYPE].Value <<= pStream->GetMediaType( );
- aPropSet[PKG_MNFST_VERSION].Name = sVersionProperty;
- aPropSet[PKG_MNFST_VERSION].Value <<= ::rtl::OUString(); // no version is stored for streams currently
- aPropSet[PKG_MNFST_FULLPATH].Name = sFullPathProperty;
- aPropSet[PKG_MNFST_FULLPATH].Value <<= pTempEntry->sPath;
+ sal_Bool bTransportOwnEncrStreamAsRaw = sal_False;
+ // During the storing the original size of the stream can be changed
+ // TODO/LATER: get rid of this hack
+ sal_Int32 nOwnStreamOrigSize = bRawStream ? rInfo.pStream->GetMagicalHackSize() : rInfo.pStream->getSize();
+ sal_Bool bUseNonSeekableAccess = sal_False;
+ Reference < XInputStream > xStream;
+ if ( !rInfo.pStream->IsPackageMember() && !bRawStream && !bToBeEncrypted && bToBeCompressed )
+ {
+ // the stream is not a package member, not a raw stream,
+ // it should not be encrypted and it should be compressed,
+ // in this case nonseekable access can be used
- OSL_ENSURE( pStream->GetStreamMode() != PACKAGE_STREAM_NOTSET, "Unacceptable ZipPackageStream mode!" );
+ xStream = rInfo.pStream->GetOwnStreamNoWrap();
+ Reference < XSeekable > xSeek ( xStream, UNO_QUERY );
- sal_Bool bRawStream = sal_False;
- if ( pStream->GetStreamMode() == PACKAGE_STREAM_DETECT )
- bRawStream = pStream->ParsePackageRawStream();
- else if ( pStream->GetStreamMode() == PACKAGE_STREAM_RAW )
- bRawStream = sal_True;
+ bUseNonSeekableAccess = ( xStream.is() && !xSeek.is() );
+ }
- sal_Bool bTransportOwnEncrStreamAsRaw = sal_False;
- // During the storing the original size of the stream can be changed
- // TODO/LATER: get rid of this hack
- sal_Int32 nOwnStreamOrigSize = bRawStream ? pStream->GetMagicalHackSize() : pStream->getSize();
+ if ( !bUseNonSeekableAccess )
+ {
+ xStream = rInfo.pStream->getRawData();
- sal_Bool bUseNonSeekableAccess = sal_False;
- Reference < XInputStream > xStream;
- if ( !pStream->IsPackageMember() && !bRawStream && !bToBeEncrypted && bToBeCompressed )
+ if ( !xStream.is() )
{
- // the stream is not a package member, not a raw stream,
- // it should not be encrypted and it should be compressed,
- // in this case nonseekable access can be used
-
- xStream = pStream->GetOwnStreamNoWrap();
- Reference < XSeekable > xSeek ( xStream, UNO_QUERY );
-
- bUseNonSeekableAccess = ( xStream.is() && !xSeek.is() );
+ VOS_ENSURE( 0, "ZipPackageStream didn't have a stream associated with it, skipping!" );
+ bSuccess = false;
+ return bSuccess;
}
- if ( !bUseNonSeekableAccess )
+ Reference < XSeekable > xSeek ( xStream, UNO_QUERY );
+ try
{
- xStream = pStream->getRawData();
-
- if ( !xStream.is() )
+ if ( xSeek.is() )
{
- VOS_ENSURE( 0, "ZipPackageStream didn't have a stream associated with it, skipping!" );
- bWritingFailed = sal_True;
- continue;
- }
-
- Reference < XSeekable > xSeek ( xStream, UNO_QUERY );
- try
- {
- if ( xSeek.is() )
+ // If the stream is a raw one, then we should be positioned
+ // at the beginning of the actual data
+ if ( !bToBeCompressed || bRawStream )
{
- // If the stream is a raw one, then we should be positioned
- // at the beginning of the actual data
- if ( !bToBeCompressed || bRawStream )
- {
- // The raw stream can neither be encrypted nor connected
- OSL_ENSURE( !bRawStream || !bToBeCompressed && !bToBeEncrypted, "The stream is already encrypted!\n" );
- xSeek->seek ( bRawStream ? pStream->GetMagicalHackPos() : 0 );
- ImplSetStoredData ( *pTempEntry, xStream );
-
- // TODO/LATER: Get rid of hacks related to switching of Flag Method and Size properties!
- }
- else if ( bToBeEncrypted )
- {
- // this is the correct original size
- pTempEntry->nSize = static_cast < sal_Int32 > ( xSeek->getLength() );
- nOwnStreamOrigSize = pTempEntry->nSize;
- }
-
- xSeek->seek ( 0 );
+ // The raw stream can neither be encrypted nor connected
+ OSL_ENSURE( !bRawStream || !bToBeCompressed && !bToBeEncrypted, "The stream is already encrypted!\n" );
+ xSeek->seek ( bRawStream ? rInfo.pStream->GetMagicalHackPos() : 0 );
+ ImplSetStoredData ( *pTempEntry, xStream );
+
+ // TODO/LATER: Get rid of hacks related to switching of Flag Method and Size properties!
}
- else
+ else if ( bToBeEncrypted )
{
- // Okay, we don't have an xSeekable stream. This is possibly bad.
- // check if it's one of our own streams, if it is then we know that
- // each time we ask for it we'll get a new stream that will be
- // at position zero...otherwise, assert and skip this stream...
- if ( pStream->IsPackageMember() )
- {
- // if the password has been changed than the stream should not be package member any more
- if ( pStream->IsEncrypted() && pStream->IsToBeEncrypted() )
- {
- // Should be handled close to the raw stream handling
- bTransportOwnEncrStreamAsRaw = sal_True;
- pTempEntry->nMethod = STORED;
-
- // TODO/LATER: get rid of this situation
- // this size should be different from the one that will be stored in manifest.xml
- // it is used in storing algorithms and after storing the correct size will be set
- pTempEntry->nSize = pTempEntry->nCompressedSize;
- }
- }
- else
- {
- VOS_ENSURE( 0, "The package component requires that every stream either be FROM a package or it must support XSeekable!" );
- continue;
- }
+ // this is the correct original size
+ pTempEntry->nSize = static_cast < sal_Int32 > ( xSeek->getLength() );
+ nOwnStreamOrigSize = pTempEntry->nSize;
}
- }
- catch ( Exception& )
- {
- VOS_ENSURE( 0, "The stream provided to the package component has problems!" );
- bWritingFailed = sal_True;
- continue;
- }
- if ( bToBeEncrypted || bRawStream || bTransportOwnEncrStreamAsRaw )
+ xSeek->seek ( 0 );
+ }
+ else
{
- if ( bToBeEncrypted && !bTransportOwnEncrStreamAsRaw )
+ // Okay, we don't have an xSeekable stream. This is possibly bad.
+ // check if it's one of our own streams, if it is then we know that
+ // each time we ask for it we'll get a new stream that will be
+ // at position zero...otherwise, assert and skip this stream...
+ if ( rInfo.pStream->IsPackageMember() )
{
- Sequence < sal_uInt8 > aSalt ( 16 ), aVector ( 8 );
- rtl_random_getBytes ( rRandomPool, aSalt.getArray(), 16 );
- rtl_random_getBytes ( rRandomPool, aVector.getArray(), 8 );
- sal_Int32 nIterationCount = 1024;
-
- if ( !pStream->HasOwnKey() )
- pStream->setKey ( rEncryptionKey );
-
- pStream->setInitialisationVector ( aVector );
- pStream->setSalt ( aSalt );
- pStream->setIterationCount ( nIterationCount );
+ // if the password has been changed than the stream should not be package member any more
+ if ( rInfo.pStream->IsEncrypted() && rInfo.pStream->IsToBeEncrypted() )
+ {
+ // Should be handled close to the raw stream handling
+ bTransportOwnEncrStreamAsRaw = sal_True;
+ pTempEntry->nMethod = STORED;
+
+ // TODO/LATER: get rid of this situation
+ // this size should be different from the one that will be stored in manifest.xml
+ // it is used in storing algorithms and after storing the correct size will be set
+ pTempEntry->nSize = pTempEntry->nCompressedSize;
+ }
}
-
- // last property is digest, which is inserted later if we didn't have
- // a magic header
- aPropSet.realloc(PKG_SIZE_ENCR_MNFST);
-
- aPropSet[PKG_MNFST_INIVECTOR].Name = sInitialisationVectorProperty;
- aPropSet[PKG_MNFST_INIVECTOR].Value <<= pStream->getInitialisationVector();
- aPropSet[PKG_MNFST_SALT].Name = sSaltProperty;
- aPropSet[PKG_MNFST_SALT].Value <<= pStream->getSalt();
- aPropSet[PKG_MNFST_ITERATION].Name = sIterationCountProperty;
- aPropSet[PKG_MNFST_ITERATION].Value <<= pStream->getIterationCount ();
-
- // Need to store the uncompressed size in the manifest
- OSL_ENSURE( nOwnStreamOrigSize >= 0, "The stream size was not correctly initialized!\n" );
- aPropSet[PKG_MNFST_UCOMPSIZE].Name = sSizeProperty;
- aPropSet[PKG_MNFST_UCOMPSIZE].Value <<= nOwnStreamOrigSize;
-
- if ( bRawStream || bTransportOwnEncrStreamAsRaw )
+ else
{
- aPropSet[PKG_MNFST_DIGEST].Name = sDigestProperty;
- aPropSet[PKG_MNFST_DIGEST].Value <<= pStream->getDigest();
+ VOS_ENSURE( 0, "The package component requires that every stream either be FROM a package or it must support XSeekable!" );
+ bSuccess = false;
+ return bSuccess;
}
}
}
-
- // If the entry is already stored in the zip file in the format we
- // want for this write...copy it raw
- if ( !bUseNonSeekableAccess
- && ( bRawStream || bTransportOwnEncrStreamAsRaw
- || ( pStream->IsPackageMember() && !bToBeEncrypted
- && ( ( pStream->aEntry.nMethod == DEFLATED && bToBeCompressed )
- || ( pStream->aEntry.nMethod == STORED && !bToBeCompressed ) ) ) ) )
+ catch ( Exception& )
{
- // If it's a PackageMember, then it's an unbuffered stream and we need
- // to get a new version of it as we can't seek backwards.
- if ( pStream->IsPackageMember() )
- {
- xStream = pStream->getRawData();
- if ( !xStream.is() )
- {
- // Make sure that we actually _got_ a new one !
- VOS_ENSURE( 0, "ZipPackageStream didn't have a stream associated with it, skipping!" );
- continue;
- }
- }
+ VOS_ENSURE( 0, "The stream provided to the package component has problems!" );
+ bSuccess = false;
+ return bSuccess;
+ }
- try
+ if ( bToBeEncrypted || bRawStream || bTransportOwnEncrStreamAsRaw )
+ {
+ if ( bToBeEncrypted && !bTransportOwnEncrStreamAsRaw )
{
- if ( bRawStream )
- xStream->skipBytes( pStream->GetMagicalHackPos() );
-
- rZipOut.putNextEntry ( *pTempEntry, pStream->getEncryptionData(), sal_False );
- // the entry is provided to the ZipOutputStream that will delete it
- pAutoTempEntry.release();
-
- Sequence < sal_Int8 > aSeq ( n_ConstBufferSize );
- sal_Int32 nLength;
-
- do
- {
- nLength = xStream->readBytes( aSeq, n_ConstBufferSize );
- rZipOut.rawWrite(aSeq, 0, nLength);
- }
- while ( nLength == n_ConstBufferSize );
+ Sequence < sal_uInt8 > aSalt ( 16 ), aVector ( 8 );
+ rtl_random_getBytes ( rRandomPool, aSalt.getArray(), 16 );
+ rtl_random_getBytes ( rRandomPool, aVector.getArray(), 8 );
+ sal_Int32 nIterationCount = 1024;
+
+ if ( !rInfo.pStream->HasOwnKey() )
+ rInfo.pStream->setKey ( rEncryptionKey );
- rZipOut.rawCloseEntry();
- }
- catch ( ZipException& )
- {
- VOS_ENSURE( 0, "Error writing ZipOutputStream" );
- bWritingFailed = sal_True;
+ rInfo.pStream->setInitialisationVector ( aVector );
+ rInfo.pStream->setSalt ( aSalt );
+ rInfo.pStream->setIterationCount ( nIterationCount );
}
- catch ( IOException& )
+
+ // last property is digest, which is inserted later if we didn't have
+ // a magic header
+ aPropSet.realloc(PKG_SIZE_ENCR_MNFST);
+
+ aPropSet[PKG_MNFST_INIVECTOR].Name = sInitialisationVectorProperty;
+ aPropSet[PKG_MNFST_INIVECTOR].Value <<= rInfo.pStream->getInitialisationVector();
+ aPropSet[PKG_MNFST_SALT].Name = sSaltProperty;
+ aPropSet[PKG_MNFST_SALT].Value <<= rInfo.pStream->getSalt();
+ aPropSet[PKG_MNFST_ITERATION].Name = sIterationCountProperty;
+ aPropSet[PKG_MNFST_ITERATION].Value <<= rInfo.pStream->getIterationCount ();
+
+ // Need to store the uncompressed size in the manifest
+ OSL_ENSURE( nOwnStreamOrigSize >= 0, "The stream size was not correctly initialized!\n" );
+ aPropSet[PKG_MNFST_UCOMPSIZE].Name = sSizeProperty;
+ aPropSet[PKG_MNFST_UCOMPSIZE].Value <<= nOwnStreamOrigSize;
+
+ if ( bRawStream || bTransportOwnEncrStreamAsRaw )
{
- VOS_ENSURE( 0, "Error writing ZipOutputStream" );
- bWritingFailed = sal_True;
+ aPropSet[PKG_MNFST_DIGEST].Name = sDigestProperty;
+ aPropSet[PKG_MNFST_DIGEST].Value <<= rInfo.pStream->getDigest();
}
}
- else
- {
- // This stream is defenitly not a raw stream
-
- // If nonseekable access is used the stream should be at the beginning and
- // is useless after the storing. Thus if the storing fails the package should
- // be thrown away ( as actually it is done currently )!
- // To allow to reuse the package after the error, the optimization must be removed!
-
- // If it's a PackageMember, then our previous reference held a 'raw' stream
- // so we need to re-get it, unencrypted, uncompressed and positioned at the
- // beginning of the stream
- if ( pStream->IsPackageMember() )
- {
- xStream = pStream->getInputStream();
- if ( !xStream.is() )
- {
- // Make sure that we actually _got_ a new one !
- VOS_ENSURE( 0, "ZipPackageStream didn't have a stream associated with it, skipping!" );
- continue;
- }
- }
+ }
- if ( bToBeCompressed )
+ // If the entry is already stored in the zip file in the format we
+ // want for this write...copy it raw
+ if ( !bUseNonSeekableAccess
+ && ( bRawStream || bTransportOwnEncrStreamAsRaw
+ || ( rInfo.pStream->IsPackageMember() && !bToBeEncrypted
+ && ( ( rInfo.pStream->aEntry.nMethod == DEFLATED && bToBeCompressed )
+ || ( rInfo.pStream->aEntry.nMethod == STORED && !bToBeCompressed ) ) ) ) )
+ {
+ // If it's a PackageMember, then it's an unbuffered stream and we need
+ // to get a new version of it as we can't seek backwards.
+ if ( rInfo.pStream->IsPackageMember() )
+ {
+ xStream = rInfo.pStream->getRawData();
+ if ( !xStream.is() )
{
- pTempEntry->nMethod = DEFLATED;
- pTempEntry->nCrc = pTempEntry->nCompressedSize = pTempEntry->nSize = -1;
+ // Make sure that we actually _got_ a new one !
+ VOS_ENSURE( 0, "ZipPackageStream didn't have a stream associated with it, skipping!" );
+ bSuccess = false;
+ return bSuccess;
}
+ }
- try
- {
- rZipOut.putNextEntry ( *pTempEntry, pStream->getEncryptionData(), bToBeEncrypted);
- // the entry is provided to the ZipOutputStream that will delete it
- pAutoTempEntry.release();
+ try
+ {
+ if ( bRawStream )
+ xStream->skipBytes( rInfo.pStream->GetMagicalHackPos() );
- sal_Int32 nLength;
- Sequence < sal_Int8 > aSeq (n_ConstBufferSize);
- do
- {
- nLength = xStream->readBytes(aSeq, n_ConstBufferSize);
- rZipOut.write(aSeq, 0, nLength);
- }
- while ( nLength == n_ConstBufferSize );
+ rZipOut.putNextEntry ( *pTempEntry, rInfo.pStream->getEncryptionData(), sal_False );
+ // the entry is provided to the ZipOutputStream that will delete it
+ pAutoTempEntry.release();
- rZipOut.closeEntry();
- }
- catch ( ZipException& )
- {
- VOS_ENSURE( 0, "Error writing ZipOutputStream" );
- bWritingFailed = sal_True;
- }
- catch ( IOException& )
+ Sequence < sal_Int8 > aSeq ( n_ConstBufferSize );
+ sal_Int32 nLength;
+
+ do
{
- VOS_ENSURE( 0, "Error writing ZipOutputStream" );
- bWritingFailed = sal_True;
+ nLength = xStream->readBytes( aSeq, n_ConstBufferSize );
+ rZipOut.rawWrite(aSeq, 0, nLength);
}
+ while ( nLength == n_ConstBufferSize );
- if ( bToBeEncrypted )
+ rZipOut.rawCloseEntry();
+ }
+ catch ( ZipException& )
+ {
+ VOS_ENSURE( 0, "Error writing ZipOutputStream" );
+ bSuccess = false;
+ }
+ catch ( IOException& )
+ {
+ VOS_ENSURE( 0, "Error writing ZipOutputStream" );
+ bSuccess = false;
+ }
+ }
+ else
+ {
+ // This stream is defenitly not a raw stream
+
+ // If nonseekable access is used the stream should be at the beginning and
+ // is useless after the storing. Thus if the storing fails the package should
+ // be thrown away ( as actually it is done currently )!
+ // To allow to reuse the package after the error, the optimization must be removed!
+
+ // If it's a PackageMember, then our previous reference held a 'raw' stream
+ // so we need to re-get it, unencrypted, uncompressed and positioned at the
+ // beginning of the stream
+ if ( rInfo.pStream->IsPackageMember() )
+ {
+ xStream = rInfo.pStream->getInputStream();
+ if ( !xStream.is() )
{
- aPropSet[PKG_MNFST_DIGEST].Name = sDigestProperty;
- aPropSet[PKG_MNFST_DIGEST].Value <<= pStream->getDigest();
- pStream->SetIsEncrypted ( sal_True );
+ // Make sure that we actually _got_ a new one !
+ VOS_ENSURE( 0, "ZipPackageStream didn't have a stream associated with it, skipping!" );
+ bSuccess = false;
+ return bSuccess;
}
}
- if( !bWritingFailed )
+ if ( bToBeCompressed )
{
- if ( !pStream->IsPackageMember() )
- {
- pStream->CloseOwnStreamIfAny();
- pStream->SetPackageMember ( sal_True );
- }
+ pTempEntry->nMethod = DEFLATED;
+ pTempEntry->nCrc = pTempEntry->nCompressedSize = pTempEntry->nSize = -1;
+ }
- if ( bRawStream )
- {
- // the raw stream was integrated and now behaves
- // as usual encrypted stream
- pStream->SetToBeEncrypted( sal_True );
- }
-
- // Remove hacky bit from entry flags
- if ( pTempEntry->nFlag & ( 1 << 4 ) )
+ try
+ {
+ rZipOut.putNextEntry ( *pTempEntry, rInfo.pStream->getEncryptionData(), bToBeEncrypted);
+ // the entry is provided to the ZipOutputStream that will delete it
+ pAutoTempEntry.release();
+
+ sal_Int32 nLength;
+ Sequence < sal_Int8 > aSeq (n_ConstBufferSize);
+ do
{
- pTempEntry->nFlag &= ~( 1 << 4 );
- pTempEntry->nMethod = STORED;
+ nLength = xStream->readBytes(aSeq, n_ConstBufferSize);
+ rZipOut.write(aSeq, 0, nLength);
}
+ while ( nLength == n_ConstBufferSize );
- // Then copy it back afterwards...
- ZipPackageFolder::copyZipEntry ( pStream->aEntry, *pTempEntry );
+ rZipOut.closeEntry();
+ }
+ catch ( ZipException& )
+ {
+ VOS_ENSURE( 0, "Error writing ZipOutputStream" );
+ bSuccess = false;
+ }
+ catch ( IOException& )
+ {
+ VOS_ENSURE( 0, "Error writing ZipOutputStream" );
+ bSuccess = false;
+ }
+
+ if ( bToBeEncrypted )
+ {
+ aPropSet[PKG_MNFST_DIGEST].Name = sDigestProperty;
+ aPropSet[PKG_MNFST_DIGEST].Value <<= rInfo.pStream->getDigest();
+ rInfo.pStream->SetIsEncrypted ( sal_True );
+ }
+ }
+
+ if( bSuccess )
+ {
+ if ( !rInfo.pStream->IsPackageMember() )
+ {
+ rInfo.pStream->CloseOwnStreamIfAny();
+ rInfo.pStream->SetPackageMember ( sal_True );
+ }
- // TODO/LATER: get rid of this hack ( the encrypted stream size property is changed during saving )
- if ( pStream->IsEncrypted() )
- pStream->setSize( nOwnStreamOrigSize );
+ if ( bRawStream )
+ {
+ // the raw stream was integrated and now behaves
+ // as usual encrypted stream
+ rInfo.pStream->SetToBeEncrypted( sal_True );
+ }
- pStream->aEntry.nOffset *= -1;
+ // Remove hacky bit from entry flags
+ if ( pTempEntry->nFlag & ( 1 << 4 ) )
+ {
+ pTempEntry->nFlag &= ~( 1 << 4 );
+ pTempEntry->nMethod = STORED;
}
+
+ // Then copy it back afterwards...
+ ZipPackageFolder::copyZipEntry ( rInfo.pStream->aEntry, *pTempEntry );
+
+ // TODO/LATER: get rid of this hack ( the encrypted stream size property is changed during saving )
+ if ( rInfo.pStream->IsEncrypted() )
+ rInfo.pStream->setSize( nOwnStreamOrigSize );
+
+ rInfo.pStream->aEntry.nOffset *= -1;
}
+ }
- // folder can have a mediatype only in package format
- if ( aPropSet.getLength()
- && ( m_nFormat == embed::StorageFormats::PACKAGE || ( m_nFormat == embed::StorageFormats::OFOPXML && !rInfo.bFolder ) ) )
- rManList.push_back( aPropSet );
+ // folder can have a mediatype only in package format
+ if ( aPropSet.getLength()
+ && ( m_nFormat == embed::StorageFormats::PACKAGE || ( m_nFormat == embed::StorageFormats::OFOPXML && !rInfo.bFolder ) ) )
+ rManList.push_back( aPropSet );
+
+ return bSuccess;
+}
+
+void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < PropertyValue > > &rManList, ZipOutputStream & rZipOut, Sequence < sal_Int8 > &rEncryptionKey, rtlRandomPool &rRandomPool)
+ throw(RuntimeException)
+{
+ bool bWritingFailed = false;
+
+ if ( maContents.begin() == maContents.end() && rPath.getLength() && m_nFormat != embed::StorageFormats::OFOPXML )
+ {
+ // it is an empty subfolder, use workaround to store it
+ ZipEntry* pTempEntry = new ZipEntry();
+ ZipPackageFolder::copyZipEntry ( *pTempEntry, aEntry );
+ pTempEntry->nPathLen = (sal_Int16)( ::rtl::OUStringToOString( rPath, RTL_TEXTENCODING_UTF8 ).getLength() );
+ pTempEntry->nExtraLen = -1;
+ pTempEntry->sPath = rPath;
+
+ try
+ {
+ vos::ORef < EncryptionData > aEmptyEncr;
+ rZipOut.putNextEntry ( *pTempEntry, aEmptyEncr, sal_False );
+ rZipOut.rawCloseEntry();
+ }
+ catch ( ZipException& )
+ {
+ VOS_ENSURE( 0, "Error writing ZipOutputStream" );
+ bWritingFailed = true;
+ }
+ catch ( IOException& )
+ {
+ VOS_ENSURE( 0, "Error writing ZipOutputStream" );
+ bWritingFailed = true;
+ }
+ }
+
+ bool bMimeTypeStreamStored = false;
+ ::rtl::OUString aMimeTypeStreamName( RTL_CONSTASCII_USTRINGPARAM( "mimetype" ) );
+ if ( m_nFormat == embed::StorageFormats::ZIP && !rPath.getLength() )
+ {
+ // let the "mimtype" stream in root folder be stored as the first stream if it is zip format
+ ContentHash::iterator aIter = maContents.find ( aMimeTypeStreamName );
+ if ( aIter != maContents.end() && !(*aIter).second->bFolder )
+ {
+ bMimeTypeStreamStored = true;
+ bWritingFailed = !saveChild( (*aIter).first, *(*aIter).second, rPath, rManList, rZipOut, rEncryptionKey, rRandomPool );
+ }
+ }
+
+ for ( ContentHash::const_iterator aCI = maContents.begin(), aEnd = maContents.end();
+ aCI != aEnd;
+ aCI++)
+ {
+ const OUString &rShortName = (*aCI).first;
+ const ContentInfo &rInfo = *(*aCI).second;
+
+ if ( !bMimeTypeStreamStored || !rShortName.equals( aMimeTypeStreamName ) )
+ bWritingFailed = !saveChild( rShortName, rInfo, rPath, rManList, rZipOut, rEncryptionKey, rRandomPool );
}
if( bWritingFailed )
commit 0f6ac374bbb565a631e10588ccd67184c3998820
Merge: ca7ce06... 92e50a5...
Author: os <os at openoffice.org>
Date: Wed Feb 2 11:06:37 2011 +0100
os146: gnumake3 merged
commit ca7ce06f8fdf7fc01f3b50db017e8c6b296b0a18
Merge: 682d59a... 064fff2...
Author: os <os at openoffice.org>
Date: Tue Feb 1 14:56:26 2011 +0100
m98 merged
commit 682d59aedcfa3c7f791de38108ed60b0b9c6f260
Merge: c0d205e... 3053a9b...
Author: os <os at openoffice.org>
Date: Thu Jan 13 07:55:08 2011 +0100
m97 merged
commit c0d205e44e9418de5a9c21e303ace1570cf6b783
Merge: e260e50... 7a17f37...
Author: os <os at openoffice.org>
Date: Mon Jan 10 15:23:20 2011 +0100
m96 merged
diff --cc extensions/source/update/check/updatecheckconfig.hxx
index 1cf3207,7169ad4..7169ad4
mode 100644,100755..100644
--- a/extensions/source/update/check/updatecheckconfig.hxx
+++ b/extensions/source/update/check/updatecheckconfig.hxx
diff --cc extensions/source/update/check/updateprotocol.cxx
index 83d9829,98d17e5..98d17e5
mode 100644,100755..100644
--- a/extensions/source/update/check/updateprotocol.cxx
+++ b/extensions/source/update/check/updateprotocol.cxx
commit e260e504e46126202cf86fcb608250ff92d712ee
Author: os <os at openoffice.org>
Date: Tue Dec 28 15:25:10 2010 +0100
#i115915# paper size box needs valid selection
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index 20957bd..0902d52 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -605,6 +605,7 @@ void SvxPageDescPage::Reset( const SfxItemSet& rSet )
ResStringArray aPaperAry( CUI_RES( nAryId ) );
sal_uInt32 nCnt = aPaperAry.Count();
+ USHORT nUserPos = LISTBOX_ENTRY_NOTFOUND;
for ( sal_uInt32 i = 0; i < nCnt; ++i )
{
String aStr = aPaperAry.GetString(i);
@@ -614,9 +615,11 @@ void SvxPageDescPage::Reset( const SfxItemSet& rSet )
if ( eSize == ePaper )
nActPos = nPos;
+ if( eSize == PAPER_USER )
+ nUserPos = nPos;
}
- // aktuelles Papierformat selektieren
- aPaperSizeBox.SelectEntryPos( nActPos );
+ // preselect current paper format - #115915#: ePaper might not be in aPaperSizeBox so use PAPER_USER instead
+ aPaperSizeBox.SelectEntryPos( nActPos != LISTBOX_ENTRY_NOTFOUND ? nActPos : nUserPos );
// Applikationsspezifisch
commit bf6fdfbdb5835fba08178ab19b9707a89a48d2c9
Author: Michael Stahl <mst at openoffice.org>
Date: Fri Dec 17 11:00:57 2010 +0100
sw34bf03: #i93908#: ODF: fix bogus style:num-suffix on bullet lists:
Svx{Bullet,Num}PickTabPage, SwAutoFormat, SwWrtShell::NumOrBulletOn():
clear suffix when bullet lists are created.
xmlnumi.cxx: ignore style:num-suffix written by defective OOo versions.
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 234d9ed..5b3d3cc 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -613,6 +613,9 @@ IMPL_LINK(SvxBulletPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG)
{
SvxNumberFormat aFmt(pActNum->GetLevel(i));
aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL );
+ // #i93908# clear suffix for bullet lists
+ aFmt.SetPrefix(::rtl::OUString());
+ aFmt.SetSuffix(::rtl::OUString());
aFmt.SetBulletFont(&rActBulletFont);
aFmt.SetBulletChar(cChar );
aFmt.SetCharFmtName(sBulletCharFmtName);
@@ -859,6 +862,9 @@ IMPL_LINK(SvxNumPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG)
USHORT nUpperLevelOrChar = (USHORT)pLevelSettings->nParentNumbering;
if(aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL)
{
+ // #i93908# clear suffix for bullet lists
+ aFmt.SetPrefix(::rtl::OUString());
+ aFmt.SetSuffix(::rtl::OUString());
if( pLevelSettings->sBulletFont.getLength() &&
pLevelSettings->sBulletFont.compareTo(
rActBulletFont.GetName()))
@@ -908,9 +914,10 @@ IMPL_LINK(SvxNumPickTabPage, NumSelectHdl_Impl, ValueSet*, EMPTYARG)
aFmt.SetCharFmtName(sNumCharFmtName);
// #62069# // #92724#
aFmt.SetBulletRelSize(100);
+ // #i93908#
+ aFmt.SetPrefix(pLevelSettings->sPrefix);
+ aFmt.SetSuffix(pLevelSettings->sSuffix);
}
- aFmt.SetPrefix(pLevelSettings->sPrefix);
- aFmt.SetSuffix(pLevelSettings->sSuffix);
pActNum->SetLevel(i, aFmt);
}
}
commit 840a65db80c1c96bee612b1042f7b21bef8908de
Merge: 77fea6c... e65508e...
Author: os <os at openoffice.org>
Date: Wed Dec 8 08:30:33 2010 +0100
DEV300 m95 merged
More information about the Libreoffice-commits
mailing list