summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package/inc/ByteChucker.hxx8
-rw-r--r--package/inc/ByteGrabber.hxx6
-rw-r--r--package/inc/CRC32.hxx6
-rw-r--r--package/inc/Deflater.hxx6
-rw-r--r--package/inc/Inflater.hxx6
-rw-r--r--package/inc/ZipEnumeration.hxx6
-rw-r--r--package/inc/ZipFile.hxx6
-rw-r--r--package/inc/ZipOutputStream.hxx6
-rw-r--r--package/inc/ZipPackage.hxx24
-rw-r--r--package/inc/ZipPackageBuffer.hxx6
-rw-r--r--package/inc/ZipPackageFolder.hxx30
-rw-r--r--package/source/zipapi/ByteChucker.cxx57
-rw-r--r--package/source/zipapi/ByteGrabber.cxx58
-rw-r--r--package/source/zipapi/CRC32.cxx6
-rw-r--r--package/source/zipapi/Deflater.cxx6
-rw-r--r--package/source/zipapi/EntryInputStream.cxx7
-rw-r--r--package/source/zipapi/Inflater.cxx6
-rw-r--r--package/source/zipapi/ZipEnumeration.cxx6
-rw-r--r--package/source/zipapi/ZipFile.cxx27
-rw-r--r--package/source/zipapi/ZipOutputStream.cxx53
-rw-r--r--package/source/zipapi/makefile.mk8
-rw-r--r--package/source/zippackage/ZipPackage.cxx216
-rw-r--r--package/source/zippackage/ZipPackageBuffer.cxx77
-rw-r--r--package/source/zippackage/ZipPackageEntry.cxx30
-rw-r--r--package/source/zippackage/ZipPackageFolder.cxx97
-rw-r--r--package/source/zippackage/ZipPackageFolderEnumeration.cxx8
-rw-r--r--package/source/zippackage/ZipPackageSink.cxx6
-rw-r--r--package/source/zippackage/ZipPackageStream.cxx39
28 files changed, 552 insertions, 265 deletions
diff --git a/package/inc/ByteChucker.hxx b/package/inc/ByteChucker.hxx
index 7abbe4c0ff5b..3658c07151bd 100644
--- a/package/inc/ByteChucker.hxx
+++ b/package/inc/ByteChucker.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ByteChucker.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: mtg $ $Date: 2000-11-29 13:47:16 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
@@ -73,6 +73,8 @@
#include <com/sun/star/io/XSeekable.hpp>
#endif
+#include <memory.h> //for memcpy
+
class ByteChucker
{
private:
diff --git a/package/inc/ByteGrabber.hxx b/package/inc/ByteGrabber.hxx
index 3f0fdc195d5b..65e3e937e875 100644
--- a/package/inc/ByteGrabber.hxx
+++ b/package/inc/ByteGrabber.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ByteGrabber.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: mtg $ $Date: 2000-12-13 17:00:36 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
diff --git a/package/inc/CRC32.hxx b/package/inc/CRC32.hxx
index e91419e42f6f..019c7438692a 100644
--- a/package/inc/CRC32.hxx
+++ b/package/inc/CRC32.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: CRC32.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: mtg $ $Date: 2000-11-21 12:07:58 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
diff --git a/package/inc/Deflater.hxx b/package/inc/Deflater.hxx
index 3489e329c169..1b6796cd942d 100644
--- a/package/inc/Deflater.hxx
+++ b/package/inc/Deflater.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: Deflater.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: mtg $ $Date: 2000-11-21 12:07:58 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
diff --git a/package/inc/Inflater.hxx b/package/inc/Inflater.hxx
index 0e6627861e17..a3c233c0ea6e 100644
--- a/package/inc/Inflater.hxx
+++ b/package/inc/Inflater.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: Inflater.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: mtg $ $Date: 2000-11-21 12:07:58 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
diff --git a/package/inc/ZipEnumeration.hxx b/package/inc/ZipEnumeration.hxx
index 835404dc2f09..4acdc17f2be6 100644
--- a/package/inc/ZipEnumeration.hxx
+++ b/package/inc/ZipEnumeration.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ZipEnumeration.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: mtg $ $Date: 2000-11-29 03:18:48 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
diff --git a/package/inc/ZipFile.hxx b/package/inc/ZipFile.hxx
index c7cc9dd1c805..251e8790eecd 100644
--- a/package/inc/ZipFile.hxx
+++ b/package/inc/ZipFile.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ZipFile.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: mtg $ $Date: 2000-12-13 17:00:36 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
diff --git a/package/inc/ZipOutputStream.hxx b/package/inc/ZipOutputStream.hxx
index 9d569f8b7d73..69adff5657a8 100644
--- a/package/inc/ZipOutputStream.hxx
+++ b/package/inc/ZipOutputStream.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ZipOutputStream.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: mtg $ $Date: 2000-12-13 17:00:36 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
diff --git a/package/inc/ZipPackage.hxx b/package/inc/ZipPackage.hxx
index b9840bb28a4c..1124a6079b24 100644
--- a/package/inc/ZipPackage.hxx
+++ b/package/inc/ZipPackage.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ZipPackage.hxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * last change: $Author: mtg $ $Date: 2000-12-13 17:00:36 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
@@ -93,6 +93,10 @@
#include <ucbhelper/content.hxx>
#endif
+#ifndef _COM_SUN_STAR_UCB_COMMANDABORTEDEXCEPTION_HPP_
+#include <com/sun/star/ucb/CommandAbortedException.hpp>
+#endif
+
#ifndef _ZIP_FILE_HXX
#include "ZipFile.hxx"
#endif
@@ -130,29 +134,31 @@
#endif
#include <vector>
+
class ZipPackageFolder;
-class ZipPackage : public com::sun::star::lang::XInitialization,
+class ZipPackage :
+ public ::cppu::OWeakObject,
+ public com::sun::star::lang::XInitialization,
public com::sun::star::lang::XSingleServiceFactory,
public com::sun::star::lang::XUnoTunnel,
public com::sun::star::container::XHierarchicalNameAccess,
- public com::sun::star::util::XChangesBatch,
- public ::cppu::OWeakObject
+ public com::sun::star::util::XChangesBatch
{
private:
ZipPackageFolder *pRootFolder;
ZipFile *pZipFile;
::ucb::Content *pContent;
sal_Bool bContained;
- ::std::vector < com::sun::star::uno::Reference < com::sun::star::lang::XSingleServiceFactory > > aContainedZips;
::com::sun::star::uno::Reference < com::sun::star::package::XZipFile > xZipFile;
- ::com::sun::star::uno::Reference < com::sun::star::lang::XUnoTunnel > xRootFolder;
+ ::com::sun::star::uno::Reference < com::sun::star::container::XNameContainer > xRootFolder;
::com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xContentStream;
::com::sun::star::uno::Reference < com::sun::star::io::XSeekable > xContentSeek;
const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xFactory;
sal_Bool isZipFile(com::sun::star::package::ZipEntry &rEntry);
void getZipFileContents();
void destroyFolderTree( ::com::sun::star::uno::Reference < ::com::sun::star::lang::XUnoTunnel > xFolder );
+ NameHash aRecent;
public:
ZipPackage (com::sun::star::uno::Reference < com::sun::star::io::XInputStream > &xInput,
@@ -168,10 +174,12 @@ public:
// XInterface
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType )
throw(::com::sun::star::uno::RuntimeException);
+
virtual void SAL_CALL acquire( )
throw();
virtual void SAL_CALL release( )
throw();
+
// XInitialization
virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
diff --git a/package/inc/ZipPackageBuffer.hxx b/package/inc/ZipPackageBuffer.hxx
index 93e5bd61db61..44336ecf8060 100644
--- a/package/inc/ZipPackageBuffer.hxx
+++ b/package/inc/ZipPackageBuffer.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ZipPackageBuffer.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: mtg $ $Date: 2000-12-13 17:00:36 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
diff --git a/package/inc/ZipPackageFolder.hxx b/package/inc/ZipPackageFolder.hxx
index 28a7fed0a963..7b30d1b034e7 100644
--- a/package/inc/ZipPackageFolder.hxx
+++ b/package/inc/ZipPackageFolder.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ZipPackageFolder.hxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: mtg $ $Date: 2000-12-13 17:00:36 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
@@ -93,6 +93,10 @@
#include <cppuhelper/typeprovider.hxx>
#endif
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+
#include <hash_map>
#include <time.h>
#include <utime.h>
@@ -113,7 +117,15 @@ struct hashFunc
return r1.hashCode();
}
};
-//#include "ZipPackageStream.hxx"
+typedef std::hash_map < rtl::OUString,
+ com::sun::star::uno::Reference < com::sun::star::lang::XUnoTunnel >,
+ hashFunc,
+ eqFunc > TunnelHash;
+
+typedef std::hash_map < rtl::OUString,
+ com::sun::star::uno::Reference < com::sun::star::container::XNameContainer >,
+ hashFunc,
+ eqFunc > NameHash;
/* This include must be after the above struct and typedef declarations.
* Ugly...but true :)
@@ -151,9 +163,9 @@ struct hashFunc
#include "ManifestEntry.hxx"
#endif
-typedef std::hash_map < rtl::OUString, com::sun::star::uno::Reference < com::sun::star::lang::XUnoTunnel > , hashFunc, eqFunc > TunnelHash;
class ZipPackage;
class ZipPackageFolder : public ZipPackageEntry,
+ public ::cppu::OWeakObject,
public ::com::sun::star::container::XNameContainer,
public ::com::sun::star::container::XEnumerationAccess,
public ::com::sun::star::beans::XPropertySet
@@ -162,25 +174,33 @@ private:
::rtl::OUString sMediaType;
TunnelHash aContents;
com::sun::star::uno::Reference < com::sun::star::uno::XInterface > xParent;
+ static com::sun::star::uno::Any aReturn;
public:
ZipPackage *pPackage;
+ com::sun::star::uno::Reference < com::sun::star::lang::XSingleServiceFactory > xPackage;
+
ZipPackageFolder ( void );
virtual ~ZipPackageFolder( void );
static void copyZipEntry( com::sun::star::package::ZipEntry &rDest, const com::sun::star::package::ZipEntry &rSource);
void saveContents(rtl::OUString &rPath, std::vector < ManifestEntry * > &rManList, ZipOutputStream & rZipOut)
throw(::com::sun::star::uno::RuntimeException);
+
void updateReferences( ZipFile * pNewZipFile);
+ void releaseUpwardRef( void );
+
inline sal_Bool isFolder( void ) {return sal_True;}
inline sal_Bool isStream( void ) {return sal_False;}
// XInterface
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType )
throw(::com::sun::star::uno::RuntimeException);
+
virtual void SAL_CALL acquire( )
throw();
virtual void SAL_CALL release( )
throw();
+
// XNameContainer
virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
diff --git a/package/source/zipapi/ByteChucker.cxx b/package/source/zipapi/ByteChucker.cxx
index d5dbbbfa6672..dcf039d3b38e 100644
--- a/package/source/zipapi/ByteChucker.cxx
+++ b/package/source/zipapi/ByteChucker.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ByteChucker.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: mtg $ $Date: 2000-12-01 10:49:47 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
@@ -129,53 +129,64 @@ sal_Int64 SAL_CALL ByteChucker::getLength( )
}
ByteChucker& ByteChucker::operator << (sal_Int8 nInt8)
{
- uno::Sequence< sal_Int8 > aSequence (1);
- aSequence[0]=nInt8 & 0xFF;
+ static uno::Sequence< sal_Int8 > aSequence (1);
+ static sal_Int8 *pArray = aSequence.getArray();
+
+ *pArray = nInt8 & 0xFF;
xStream->writeBytes(aSequence);
return *this;
}
ByteChucker& ByteChucker::operator << (sal_Int16 nInt16)
{
- uno::Sequence< sal_Int8 > aSequence (2);
- aSequence[0] = (nInt16 >>0 ) & 0xFF;
- aSequence[1] = (nInt16 >>8 ) & 0xFF;
+ static uno::Sequence< sal_Int8 > aSequence (2);
+ static sal_Int8 *pArray = aSequence.getArray();
+
+ *pArray = (nInt16 >> 0 ) & 0xFF;
+ *(pArray+1) = (nInt16 >> 8 ) & 0xFF;
xStream->writeBytes(aSequence);
return *this;
}
ByteChucker& ByteChucker::operator << (sal_Int32 nInt32)
{
- uno::Sequence< sal_Int8 > aSequence (4);
+ static uno::Sequence< sal_Int8 > aSequence (4);
+ static sal_Int8 *pArray = aSequence.getArray();
- aSequence[0] = (nInt32 >> 0 ) & 0xFF;
- aSequence[1] = (nInt32 >> 8 ) & 0xFF;
- aSequence[2] = (nInt32 >> 16 ) & 0xFF;
- aSequence[3] = (nInt32 >> 24 ) & 0xFF;
+ *pArray = (nInt32 >> 0 ) & 0xFF;
+ *(pArray+1) = (nInt32 >> 8 ) & 0xFF;
+ *(pArray+2) = (nInt32 >> 16 ) & 0xFF;
+ *(pArray+3) = (nInt32 >> 24 ) & 0xFF;
xStream->writeBytes(aSequence);
return *this;
}
ByteChucker& ByteChucker::operator << (sal_uInt8 nuInt8)
{
- uno::Sequence< sal_Int8 > aSequence (1);
- aSequence[0]=nuInt8 & 0xFF;
+ static uno::Sequence< sal_Int8 > aSequence (1);
+ static sal_Int8 *pArray = aSequence.getArray();
+
+ *pArray = nuInt8 & 0xFF;
xStream->writeBytes(aSequence);
return *this;
}
ByteChucker& ByteChucker::operator << (sal_uInt16 nuInt16)
{
- uno::Sequence< sal_Int8 > aSequence (2);
- aSequence[0] = (nuInt16 >>0 ) & 0xFF;
- aSequence[1] = (nuInt16 >>8 ) & 0xFF;
+ static uno::Sequence< sal_Int8 > aSequence (2);
+ static sal_Int8 *pArray = aSequence.getArray();
+
+ *pArray = (nuInt16 >> 0 ) & 0xFF;
+ *(pArray+1) = (nuInt16 >> 8 ) & 0xFF;
xStream->writeBytes(aSequence);
return *this;
}
ByteChucker& ByteChucker::operator << (sal_uInt32 nuInt32)
{
- uno::Sequence< sal_Int8 > aSequence (4);
- aSequence[0] = static_cast < sal_Int8 > (nuInt32 >> 0 ) & 0xFF;
- aSequence[1] = static_cast < sal_Int8 > (nuInt32 >> 8 ) & 0xFF;
- aSequence[2] = static_cast < sal_Int8 > (nuInt32 >> 16 ) & 0xFF;
- aSequence[3] = static_cast < sal_Int8 > (nuInt32 >> 24 ) & 0xFF;
+ static uno::Sequence< sal_Int8 > aSequence (4);
+ static sal_Int8 *pArray = aSequence.getArray();
+
+ *pArray = static_cast < sal_Int8 > ((nuInt32 >> 0 ) & 0xFF);
+ *(pArray+1) = static_cast < sal_Int8 > ((nuInt32 >> 8 ) & 0xFF);
+ *(pArray+2) = static_cast < sal_Int8 > ((nuInt32 >> 16 ) & 0xFF);
+ *(pArray+3) = static_cast < sal_Int8 > ((nuInt32 >> 24 ) & 0xFF);
xStream->writeBytes(aSequence);
return *this;
}
diff --git a/package/source/zipapi/ByteGrabber.cxx b/package/source/zipapi/ByteGrabber.cxx
index 6ee81797eeb3..ffe3eb834e42 100644
--- a/package/source/zipapi/ByteGrabber.cxx
+++ b/package/source/zipapi/ByteGrabber.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ByteGrabber.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: mtg $ $Date: 2000-12-13 17:00:43 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
@@ -146,80 +146,92 @@ sal_Int64 SAL_CALL ByteGrabber::getLength( )
}
ByteGrabber& ByteGrabber::operator >> (sal_Int8& rInt8)
{
- uno::Sequence< sal_Int8 > aSequence (1);
+ static uno::Sequence< sal_Int8 > aSequence (1);
+
if (xStream->readBytes(aSequence,1) != 1)
{
rInt8 = 0;
return *this;
}
- rInt8 = aSequence[0]& 0xFF;
+ const sal_Int8 *pArray = aSequence.getArray();
+ rInt8 = *(pArray) & 0xFF;
return *this;
}
ByteGrabber& ByteGrabber::operator >> (sal_Int16& rInt16)
{
- uno::Sequence< sal_Int8 > aSequence (2);
+ static uno::Sequence< sal_Int8 > aSequence (2);
+
if (xStream->readBytes(aSequence, 2) != 2)
{
rInt16 = 0;
return *this;
}
+ const sal_Int8 *pArray = aSequence.getArray();
rInt16 = static_cast <sal_Int16>
- (static_cast <sal_uInt8> (aSequence[0]& 0xFF)
- | static_cast <sal_uInt8> (aSequence[1]& 0xFF) << 8);
+ ((* pArray & 0xFF)
+ | (*(pArray+1)& 0xFF) << 8);
return *this;
}
ByteGrabber& ByteGrabber::operator >> (sal_Int32& rInt32)
{
- uno::Sequence< sal_Int8 > aSequence (4);
+ static uno::Sequence< sal_Int8 > aSequence (4);
+
if (xStream->readBytes(aSequence, 4) != 4)
{
rInt32 = 0;
return *this;
}
+ const sal_Int8 *pArray = aSequence.getArray();
rInt32 = static_cast < sal_Int32 >
- (static_cast < sal_uInt8> (aSequence[0]& 0xFF)
- | static_cast < sal_uInt8> (aSequence[1]& 0xFF) << 8
- | static_cast < sal_uInt8> (aSequence[2]& 0xFF) << 16
- | static_cast < sal_uInt8> (aSequence[3]& 0xFF) << 24 );
+ ((* (pArray ) & 0xFF)
+ | (* (pArray+1) & 0xFF) << 8
+ | (* (pArray+2) & 0xFF) << 16
+ | (* (pArray+3) & 0xFF) << 24 );
return *this;
}
ByteGrabber& ByteGrabber::operator >> (sal_uInt8& ruInt8)
{
- uno::Sequence< sal_Int8 > aSequence (1);
+ static uno::Sequence< sal_Int8 > aSequence (1);
+
if (xStream->readBytes(aSequence,1) != 1)
{
ruInt8 = 0;
return *this;
}
- ruInt8 = static_cast <sal_uInt8> (aSequence[0]& 0xFF);
+ const sal_Int8 *pArray = aSequence.getArray();
+ ruInt8 = static_cast <sal_uInt8> (* (pArray ) & 0xFF);
return *this;
}
ByteGrabber& ByteGrabber::operator >> (sal_uInt16& ruInt16)
{
- uno::Sequence< sal_Int8 > aSequence (2);
+ static uno::Sequence< sal_Int8 > aSequence (2);
+
if (xStream->readBytes(aSequence, 2) != 2)
{
ruInt16 = 0;
return *this;
}
+ const sal_Int8 *pArray = aSequence.getArray();
ruInt16 = static_cast <sal_uInt16>
- (static_cast < sal_uInt8 > (aSequence[0]& 0xFF)
- | static_cast < sal_uInt8 > (aSequence[1]& 0xFF) << 8);
+ ((* pArray & 0xFF)
+ | (*(pArray+1)& 0xFF) << 8);
return *this;
}
ByteGrabber& ByteGrabber::operator >> (sal_uInt32& ruInt32)
{
- uno::Sequence< sal_Int8 > aSequence (4);
+ static uno::Sequence< sal_Int8 > aSequence (4);
+
if (xStream->readBytes(aSequence, 4) != 4)
{
ruInt32 = 0;
return *this;
}
+ const sal_Int8 *pArray = aSequence.getArray();
ruInt32 = static_cast < sal_uInt32 >
- (static_cast < sal_uInt8> (aSequence[0]& 0xFF)
- | static_cast < sal_uInt8> (aSequence[1]& 0xFF) << 8
- | static_cast < sal_uInt8> (aSequence[2]& 0xFF) << 16
- | static_cast < sal_uInt8> (aSequence[3]& 0xFF) << 24);
+ ((* (pArray ) & 0xFF)
+ | (* (pArray+1) & 0xFF) << 8
+ | (* (pArray+2) & 0xFF) << 16
+ | (* (pArray+3) & 0xFF) << 24 );
return *this;
}
diff --git a/package/source/zipapi/CRC32.cxx b/package/source/zipapi/CRC32.cxx
index 0021bafbdf93..63ac06237619 100644
--- a/package/source/zipapi/CRC32.cxx
+++ b/package/source/zipapi/CRC32.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: CRC32.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: mtg $ $Date: 2000-11-24 10:34:26 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
diff --git a/package/source/zipapi/Deflater.cxx b/package/source/zipapi/Deflater.cxx
index 3dcec91fa237..1be58518f2ec 100644
--- a/package/source/zipapi/Deflater.cxx
+++ b/package/source/zipapi/Deflater.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: Deflater.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: mtg $ $Date: 2000-12-13 17:00:43 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
diff --git a/package/source/zipapi/EntryInputStream.cxx b/package/source/zipapi/EntryInputStream.cxx
index 51ab57f4b2f5..4a256bd6329d 100644
--- a/package/source/zipapi/EntryInputStream.cxx
+++ b/package/source/zipapi/EntryInputStream.cxx
@@ -1,10 +1,11 @@
+
/*************************************************************************
*
* $RCSfile: EntryInputStream.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: mtg $ $Date: 2000-12-13 17:00:43 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +55,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
diff --git a/package/source/zipapi/Inflater.cxx b/package/source/zipapi/Inflater.cxx
index 934cabb0862d..40ad73f64573 100644
--- a/package/source/zipapi/Inflater.cxx
+++ b/package/source/zipapi/Inflater.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: Inflater.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: mtg $ $Date: 2000-12-13 17:00:43 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
diff --git a/package/source/zipapi/ZipEnumeration.cxx b/package/source/zipapi/ZipEnumeration.cxx
index a04a36d86b5a..4d648cb20b37 100644
--- a/package/source/zipapi/ZipEnumeration.cxx
+++ b/package/source/zipapi/ZipEnumeration.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ZipEnumeration.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: obo $ $Date: 2000-12-04 16:04:49 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 82aa2caa6b2e..16e3980dc5f2 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ZipFile.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: mtg $ $Date: 2000-12-13 17:00:43 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
@@ -94,28 +94,13 @@ void ZipFile::updateFromManList(std::vector < ManifestEntry * > &rManList)
{
sal_Int32 i=0, nSize = rManList.size();
aEntries.clear();
- package::ZipEntry *pEntry = &rManList[i]->aEntry;
+ // This is a bitwise copy, = is not an overloaded operator
+ // I'm not sure how evil this is in this case...
for (;i < nSize ; i++)
{
- // This is a bitwise copy, = is not an overloaded operator
- // I'm not sure how evil this is in this case...
- aEntries[pEntry->sName] = *pEntry;//rManList[i]->aEntry;
- /*
- package::ZipEntry *pEntry = new package::ZipEntry;
- pEntry->nVersion = rManList[i]->aEntry.nVersion;
- pEntry->nFlag = rManList[i]->aEntry.nFlag;
- pEntry->nMethod = rManList[i]->aEntry.nMethod;
- pEntry->nTime = rManList[i]->aEntry.nTime;
- pEntry->nCrc = rManList[i]->aEntry.nCrc;
- pEntry->nCompressedSize = rManList[i]->aEntry.nCompressedSize;
- pEntry->nSize = rManList[i]->aEntry.nSize;
- pEntry->nOffset = rManList[i]->aEntry.nOffset;
- pEntry->sName = rManList[i]->aEntry.sName;
- pEntry->extra = rManList[i]->aEntry.extra;
- pEntry->sComment = rManList[i]->aEntry.sComment;
+ package::ZipEntry * pEntry = &rManList[i]->aEntry;
aEntries[pEntry->sName] = *pEntry;
- */
}
}
diff --git a/package/source/zipapi/ZipOutputStream.cxx b/package/source/zipapi/ZipOutputStream.cxx
index 56b43d05e570..57d7b70cb57e 100644
--- a/package/source/zipapi/ZipOutputStream.cxx
+++ b/package/source/zipapi/ZipOutputStream.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ZipOutputStream.cxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: mtg $ $Date: 2000-12-13 17:21:40 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
@@ -265,12 +265,21 @@ void ZipOutputStream::writeEND(sal_uInt32 nOffset, sal_uInt32 nLength)
throw(io::IOException, uno::RuntimeException)
{
sal_Int16 i=0, nCommentLength = static_cast < sal_Int16 > (sComment.getLength());
+ static uno::Sequence < sal_Int8 > aSequence (nCommentLength);
+ static sal_Int8 *pArray = aSequence.getArray();
+ static sal_Int16 nOldLength = nCommentLength;
+
+ if (nOldLength != nCommentLength)
+ {
+ nOldLength = nCommentLength;
+ aSequence.realloc (nOldLength);
+ pArray = aSequence.getArray();
+ }
const sal_Unicode *pChar = sComment.getStr();
- uno::Sequence < sal_Int8 > aSequence (nCommentLength);
for ( ; i < nCommentLength; i++)
{
VOS_ENSURE (pChar[i] <127, "Non US ASCII character in zipfile comment!");
- aSequence[i] = static_cast < const sal_Int8 > (pChar[i]);
+ *(pArray+i) = static_cast < const sal_Int8 > (pChar[i]);
}
aChucker << ENDSIG;
aChucker << static_cast < sal_Int16 > ( 0 );
@@ -290,6 +299,9 @@ void ZipOutputStream::writeCEN( const package::ZipEntry &rEntry )
nCommentLength = static_cast < sal_Int16 > ( rEntry.sComment.getLength() ) ,
nExtraLength = static_cast < sal_Int16 > ( rEntry.extra.getLength() );
sal_Int16 i = 0;
+ static uno::Sequence < sal_Int8 > aSequence (nNameLength);
+ static sal_Int8 *pArray = aSequence.getArray();
+ static sal_Int16 nOldLength=0;
aChucker << CENSIG;
aChucker << rEntry.nVersion;
@@ -316,11 +328,16 @@ void ZipOutputStream::writeCEN( const package::ZipEntry &rEntry )
aChucker.seek(nCurrent);
*/
const sal_Unicode *pChar = rEntry.sName.getStr();
- uno::Sequence < sal_Int8 > aSequence (nNameLength);
+ if (nOldLength != nNameLength)
+ {
+ nOldLength = nNameLength;
+ aSequence.realloc(nOldLength);
+ pArray = aSequence.getArray();
+ }
for ( ; i < nNameLength; i++)
{
VOS_ENSURE (pChar[i] <127, "Non US ASCII character in zipentry name!");
- aSequence[i] = static_cast < const sal_Int8 > (pChar[i]);
+ *(pArray+i) = static_cast < const sal_Int8 > (pChar[i]);
}
aChucker.writeBytes( aSequence );
@@ -328,11 +345,16 @@ void ZipOutputStream::writeCEN( const package::ZipEntry &rEntry )
aChucker.writeBytes( rEntry.extra);
if (nCommentLength)
{
- aSequence.realloc (nCommentLength);
+ if (nOldLength != nCommentLength)
+ {
+ nOldLength = nCommentLength;
+ aSequence.realloc (nOldLength);
+ pArray = aSequence.getArray();
+ }
for (i=0, pChar = rEntry.sComment.getStr(); i < nCommentLength; i++)
{
VOS_ENSURE (pChar[i] <127, "Non US ASCII character in zipentry comment!");
- aSequence[i] = static_cast < const sal_Int8 > (pChar[i]);
+ *(pArray+i) = static_cast < const sal_Int8 > (pChar[i]);
}
aChucker.writeBytes( aSequence );
}
@@ -350,6 +372,16 @@ void ZipOutputStream::writeLOC( const package::ZipEntry &rEntry )
throw(io::IOException, uno::RuntimeException)
{
sal_Int16 nNameLength = static_cast < sal_Int16 > (rEntry.sName.getLength());
+
+ static sal_Int16 nOldLength=nNameLength;
+ static uno::Sequence < sal_Int8 > aSequence(nNameLength);
+ static sal_Int8 *pArray = aSequence.getArray();
+ if ( nNameLength != nOldLength)
+ {
+ nOldLength = nNameLength;
+ aSequence.realloc(nOldLength);
+ pArray = aSequence.getArray();
+ }
sal_Int16 i=0;
aChucker << LOCSIG;
aChucker << rEntry.nVersion;
@@ -372,11 +404,10 @@ void ZipOutputStream::writeLOC( const package::ZipEntry &rEntry )
aChucker << static_cast <sal_Int16 > ( rEntry.extra.getLength());
const sal_Unicode *pChar = rEntry.sName.getStr();
- uno::Sequence < sal_Int8 > aSequence (nNameLength);
for ( ; i < nNameLength; i++)
{
VOS_ENSURE (pChar[i] <127, "Non US ASCII character in zipentry name!");
- aSequence[i] = static_cast < const sal_Int8 > (pChar[i]);
+ *(pArray+i) = static_cast < const sal_Int8 > (pChar[i]);
}
aChucker.writeBytes( aSequence );
if (rEntry.extra.getLength() != 0)
diff --git a/package/source/zipapi/makefile.mk b/package/source/zipapi/makefile.mk
index c6dacbff8ceb..17c149fed1c6 100644
--- a/package/source/zipapi/makefile.mk
+++ b/package/source/zipapi/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.3 $
+# $Revision: 1.4 $
#
-# last change: $Author: mtg $ $Date: 2000-11-24 11:16:05 $
+# last change: $Author: mtg $ $Date: 2000-12-19 21:55:39 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -90,8 +90,8 @@ SLOFILES= \
# --- UNO stuff ---------------------------------------------------
CPPUMAKERFLAGS=
-#UNOUCROUT=$(OUT)$/inc
-#INCPRE+=$(UNOUCROUT)
+UNOUCROUT=$(OUT)$/inc
+INCPRE+=$(UNOUCROUT)
UNOUCRDEP= $(SOLARBINDIR)$/applicat.rdb
UNOUCRRDB= $(SOLARBINDIR)$/applicat.rdb
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index 2dda1a2a6804..4302335fd325 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ZipPackage.cxx,v $
*
- * $Revision: 1.24 $
+ * $Revision: 1.25 $
*
- * last change: $Author: mtg $ $Date: 2000-12-13 17:00:47 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,16 +54,13 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
#ifndef _ZIP_PACKAGE_HXX
#include "ZipPackage.hxx"
#endif
-#ifndef _COM_SUN_STAR_UCB_COMMANDABORTEDEXCEPTION_HPP_
-#include <com/sun/star/ucb/CommandAbortedException.hpp>
-#endif
using namespace rtl;
using namespace com::sun::star::io;
@@ -97,7 +94,7 @@ ZipPackage::ZipPackage (Reference < XInputStream > &xNewInput,
xZipFile = Reference < XZipFile > ( pZipFile );
pRootFolder = new ZipPackageFolder( );
- xRootFolder = Reference < XUnoTunnel > ( pRootFolder );
+ xRootFolder = Reference < XNameContainer > ( pRootFolder );
getZipFileContents();
}
@@ -111,15 +108,21 @@ ZipPackage::ZipPackage (const Reference < XMultiServiceFactory > &xNewFactory)
, xZipFile (NULL)
, xFactory(xNewFactory)
{
-
pRootFolder = new ZipPackageFolder();
- xRootFolder = Reference < XUnoTunnel > (pRootFolder );
+ xRootFolder = Reference < XNameContainer > (pRootFolder );
}
ZipPackage::~ZipPackage( void )
{
if (pContent)
delete pContent;
+ // As all folders and streams contain raferences to their parents,
+ // we must remove these references so that they will be deleted when
+ // the hash_map of the root folder is cleared, releasing all subfolders
+ // and substreams which in turn release theirs, etc. When xRootFolder is
+ // released when this destructor completes, the folder tree should be
+ // deleted fully (and automagically).
+ pRootFolder->releaseUpwardRef();
}
void ZipPackage::destroyFolderTree( Reference < XUnoTunnel > xFolder )
@@ -148,30 +151,26 @@ void ZipPackage::destroyFolderTree( Reference < XUnoTunnel > xFolder )
bIsFolder = sal_False;
}
if (bIsFolder)
- {
destroyFolderTree(xTunnel);
- delete pFolder;
- }
else
- {
- delete pStream;
- }
+ pStream->release();
}
}
void ZipPackage::getZipFileContents()
{
Reference< XEnumeration > xEnum = pZipFile->entries();
- Reference< XNameContainer > xCurrent (xRootFolder, UNO_QUERY);
+ Reference< XNameContainer > xCurrent;
ZipPackageStream *pPkgStream;
ZipPackageFolder *pPkgFolder;
ZipEntry aEntry;
+ Any aAny;
while (xEnum->hasMoreElements())
{
- xCurrent = Reference < XNameContainer > (pRootFolder);
+ xCurrent = xRootFolder;
sal_Int32 nOldIndex =0,nIndex = 0;
- Any aAny = xEnum->nextElement();
+ aAny = xEnum->nextElement();
aAny >>= aEntry;
OUString &rName = aEntry.sName;
@@ -198,8 +197,8 @@ void ZipPackage::getZipFileContents()
}
else
{
- aAny = xCurrent->getByName(sTemp);
Reference < XUnoTunnel> xRef;
+ aAny = xCurrent->getByName(sTemp);
aAny >>= xRef;
xCurrent = Reference < XNameContainer > (xRef, UNO_QUERY);
}
@@ -230,8 +229,8 @@ void ZipPackage::getZipFileContents()
}
else
{
- aAny = xCurrent->getByName(sTemp);
Reference < XUnoTunnel> xRef;
+ aAny = xCurrent->getByName(sTemp);
aAny >>= xRef;
xCurrent = Reference < XNameContainer > (xRef, UNO_QUERY);
}
@@ -245,6 +244,7 @@ void ZipPackage::getZipFileContents()
pPkgFolder = pInZip->getRootFolder();
pPkgFolder->setName(sStreamName);
pPkgFolder->pPackage = pInZip;
+ pPkgFolder->xPackage = Reference < XSingleServiceFactory > (pInZip);
try
{
pPkgFolder->setParent( Reference < XInterface >(xCurrent, UNO_QUERY));
@@ -273,8 +273,8 @@ void ZipPackage::getZipFileContents()
}
if (hasByHierarchicalName(OUString::createFromAscii("META-INF/manifest.xml")))
{
- Any aAny = getByHierarchicalName(OUString::createFromAscii("META-INF/manifest.xml"));
Reference < XUnoTunnel > xTunnel;
+ aAny = getByHierarchicalName(OUString::createFromAscii("META-INF/manifest.xml"));
aAny >>= xTunnel;
Reference < XActiveDataSink > xSink (xTunnel, UNO_QUERY);
if (xSink.is())
@@ -320,19 +320,38 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
// File doesn't exist, we'll create it at commitChanges time
}
}
+/*
// XHierarchicalNameAccess
Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
throw(NoSuchElementException, RuntimeException)
{
+ static OUString sClear = OUString::createFromAscii("");
+ if (hasByHierarchicalName(aName))
+ {
+ sLastSearch = sClear;
+ return aKinglyAny;
+ }
+ else
+ throw NoSuchElementException();
+}
+sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
+ throw(RuntimeException)
+{
sal_Int32 nOldIndex =0,nIndex = 0;
- Any aAny;
+
+ if (aName == sLastSearch)
+ return sal_True;
+ else
+ sLastSearch=aName;
+
Reference < XNameContainer > xCurrent = Reference < XNameContainer > (pRootFolder);
if (aName[nOldIndex] == '/')
nOldIndex++;
if (aName == OUString::createFromAscii("/"))
{
- aAny <<= Reference < XUnoTunnel > (pRootFolder);
+ aKinglyAny <<= Reference < XUnoTunnel > (pRootFolder);
+ return sal_True;
}
else if (aName.lastIndexOf('/') == aName.getLength()-1)
{
@@ -344,6 +363,78 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
if (xCurrent->hasByName(sTemp))
{
Reference < XUnoTunnel > xRef;
+ aKinglyAny = xCurrent->getByName(sTemp);
+ aKinglyAny >>= xRef;
+ xCurrent = Reference < XNameContainer > (xRef, UNO_QUERY);
+ }
+ else
+ return sal_False;
+ nOldIndex = nIndex+1;
+ }
+ }
+ else
+ {
+ while ((nIndex = aName.indexOf('/', nOldIndex)) != -1)
+ {
+ OUString sTemp = aName.copy (nOldIndex, nIndex - nOldIndex);
+ if (nIndex == nOldIndex)
+ break;
+ if (xCurrent->hasByName(sTemp))
+ {
+ Reference < XUnoTunnel > xChildRef;
+ aKinglyAny = xCurrent->getByName(sTemp);
+ aKinglyAny >>= xChildRef;
+ xCurrent = Reference < XNameContainer > (xChildRef, UNO_QUERY);
+ }
+ else
+ return sal_False;
+
+ nOldIndex = nIndex+1;
+ }
+ OUString sStreamName = aName.copy( nOldIndex, aName.getLength() - nOldIndex);
+ if (xCurrent->hasByName(sStreamName))
+ aKinglyAny <<= xCurrent->getByName(sStreamName);
+ else
+ return sal_False;
+ }
+ return sal_True;
+}
+*/
+
+Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
+ throw(NoSuchElementException, RuntimeException)
+{
+ static OUString sTemp, sRoot = OUString::createFromAscii("/");
+ sal_Int32 nOldIndex =0, nIndex;
+ Any aAny;
+ Reference < XNameContainer > xCurrent (xRootFolder);
+ Reference < XNameContainer > xPrevious (NULL);
+
+ if (aName[nOldIndex] == '/')
+ nOldIndex++;
+
+ if (aName == sRoot)
+ aAny <<= Reference < XUnoTunnel > (pRootFolder);
+ else if (aName.lastIndexOf('/') == (nIndex = aName.getLength()-1))
+ {
+ if ( aRecent.count(aName) && (nOldIndex = aName.lastIndexOf('/', nIndex)) != -1)
+ {
+ sTemp = aName.copy(++nOldIndex, nIndex-nOldIndex);
+ if (aRecent[aName]->hasByName(sTemp) )
+ return aRecent[aName]->getByName(sTemp);
+ else
+ aRecent.erase(aName);
+ }
+ nOldIndex=0;
+ while ((nIndex = aName.indexOf('/', nOldIndex)) != -1)
+ {
+ sTemp = aName.copy (nOldIndex, nIndex - nOldIndex);
+ Reference < XUnoTunnel > xRef;
+
+ if (nIndex == nOldIndex)
+ break;
+ if (xCurrent->hasByName(sTemp))
+ {
aAny = xCurrent->getByName(sTemp);
aAny >>= xRef;
xCurrent = Reference < XNameContainer > (xRef, UNO_QUERY);
@@ -352,17 +443,28 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
throw NoSuchElementException();
nOldIndex = nIndex+1;
}
+ aRecent[aName] = xPrevious;
}
else
{
+ if ( aRecent.count(aName) && (nOldIndex = aName.lastIndexOf('/', nIndex)) != -1)
+ {
+ sTemp = aName.copy(++nOldIndex, nIndex-nOldIndex);
+ if (aRecent[aName]->hasByName(sTemp) )
+ return aRecent[aName]->getByName(sTemp);
+ else
+ aRecent.erase(aName);
+ }
+ nOldIndex=0;
while ((nIndex = aName.indexOf('/', nOldIndex)) != -1)
{
- OUString sTemp = aName.copy (nOldIndex, nIndex - nOldIndex);
+ sTemp = aName.copy (nOldIndex, nIndex - nOldIndex);
+ Reference < XUnoTunnel > xChildRef;
+
if (nIndex == nOldIndex)
break;
if (xCurrent->hasByName(sTemp))
{
- Reference < XUnoTunnel > xChildRef;
aAny = xCurrent->getByName(sTemp);
aAny >>= xChildRef;
xCurrent = Reference < XNameContainer > (xChildRef, UNO_QUERY);
@@ -374,56 +476,80 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
}
OUString sStreamName = aName.copy( nOldIndex, aName.getLength() - nOldIndex);
if (xCurrent->hasByName(sStreamName))
- aAny <<= xCurrent->getByName(sStreamName);
+ {
+ aRecent[aName] = xCurrent;
+ return xCurrent->getByName(sStreamName);
+ }
else
throw NoSuchElementException();
}
return aAny;
}
+
sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
throw(RuntimeException)
{
- sal_Int32 nOldIndex = 0, nIndex = 0;
+ static OUString sTemp, sRoot = OUString::createFromAscii("/");
+ sal_Int32 nOldIndex = 0, nIndex;
Any aAny;
- Reference < XNameContainer > xCurrent = Reference < XNameContainer > (pRootFolder);
+ Reference < XNameContainer > xCurrent (xRootFolder);
+ Reference < XNameContainer > xPrevious (NULL);
if (aName[nOldIndex] == '/')
nOldIndex++;
- if (aName == OUString::createFromAscii("/"))
- {
+ if (aName == sRoot)
return sal_True;
- }
- else if (aName.lastIndexOf('/') == aName.getLength()-1)
+ else if (aName.lastIndexOf('/') == (nIndex = aName.getLength()-1))
{
+ if ( aRecent.count(aName) && (nOldIndex = aName.lastIndexOf('/', nIndex)) != -1)
+ {
+ sTemp = aName.copy(++nOldIndex, nIndex - nOldIndex);
+ if (aRecent[aName]->hasByName(sTemp) )
+ return sal_True;
+ else
+ aRecent.erase(aName);
+ }
+ nOldIndex=0;
while ((nIndex = aName.indexOf('/', nOldIndex)) != -1)
{
- OUString sTemp = aName.copy (nOldIndex, nIndex - nOldIndex);
+ sTemp = aName.copy (nOldIndex, nIndex - nOldIndex);
+ Reference < XUnoTunnel > xRef;
if (nIndex == nOldIndex)
break;
if (xCurrent->hasByName(sTemp))
{
- Reference < XUnoTunnel > xRef;
aAny = xCurrent->getByName(sTemp);
aAny >>= xRef;
+ xPrevious = xCurrent;
xCurrent = Reference < XNameContainer > (xRef, UNO_QUERY);
}
else
return sal_False;
nOldIndex = nIndex+1;
}
+ aRecent[aName] = xPrevious;
return sal_True;
}
else
{
+ if ( aRecent.count(aName) && (nOldIndex = aName.lastIndexOf('/', nIndex)) != -1)
+ {
+ sTemp = aName.copy(++nOldIndex, nIndex - nOldIndex);
+ if (aRecent[aName]->hasByName(sTemp) )
+ return sal_True;
+ else
+ aRecent.erase(aName);
+ }
+ nOldIndex=0;
while ((nIndex = aName.indexOf('/', nOldIndex)) != -1)
{
- OUString sTemp = aName.copy (nOldIndex, nIndex - nOldIndex);
+ sTemp = aName.copy (nOldIndex, nIndex - nOldIndex);
+ Reference < XUnoTunnel > xChildRef;
if (nIndex == nOldIndex)
break;
if (xCurrent->hasByName(sTemp))
{
- Reference < XUnoTunnel > xChildRef;
aAny = xCurrent->getByName(sTemp);
aAny >>= xChildRef;
xCurrent = Reference < XNameContainer > (xChildRef, UNO_QUERY);
@@ -433,9 +559,16 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
nOldIndex = nIndex+1;
}
OUString sStreamName = aName.copy( nOldIndex, aName.getLength() - nOldIndex);
- return xCurrent->hasByName(sStreamName);
+
+ if (xCurrent->hasByName(sStreamName))
+ {
+ aRecent[aName] = xCurrent;
+ return sal_True;
+ }
+ return sal_False;
}
}
+
// XSingleServiceFactory
Reference< XInterface > SAL_CALL ZipPackage::createInstance( )
throw(Exception, RuntimeException)
@@ -473,8 +606,6 @@ ZipPackageBuffer & SAL_CALL ZipPackage::writeToBuffer( )
pZipOut->setMethod(DEFLATED);
pZipOut->setLevel(DEFAULT_COMPRESSION);
- Reference < XNameContainer > xZipRoot = Reference < XNameContainer > (xRootFolder, UNO_QUERY);
-
sal_Bool bAddMetaFolder = sal_False;
// Remove the old META-INF directory as this will be re-generated below.
@@ -482,15 +613,15 @@ ZipPackageBuffer & SAL_CALL ZipPackage::writeToBuffer( )
// are placed inside the Manifest et al. Note: saveContents is called
// recursively.
- if (xZipRoot->hasByName(OUString::createFromAscii("META-INF")))
- xZipRoot->removeByName(OUString::createFromAscii("META-INF"));
+ if (xRootFolder->hasByName(OUString::createFromAscii("META-INF")))
+ xRootFolder->removeByName(OUString::createFromAscii("META-INF"));
pRootFolder->saveContents(OUString::createFromAscii(""), aManList, *pZipOut);
ZipPackageFolder *pMetaInfFolder = new ZipPackageFolder();
ZipPackageStream *pManifestStream = new ZipPackageStream( pZipFile );
aAny <<= Reference < XUnoTunnel > (pMetaInfFolder);
- xZipRoot->insertByName(OUString::createFromAscii("META-INF"), aAny);
+ xRootFolder->insertByName(OUString::createFromAscii("META-INF"), aAny);
ZipPackageBuffer *pBuffer = new ZipPackageBuffer(65535);
Reference < XOutputStream > xManOutStream (pBuffer);
@@ -716,6 +847,7 @@ Any SAL_CALL ZipPackage::queryInterface( const Type& rType )
return OWeakObject::queryInterface ( rType ) ;
}
}
+
void SAL_CALL ZipPackage::acquire( )
throw()
{
diff --git a/package/source/zippackage/ZipPackageBuffer.cxx b/package/source/zippackage/ZipPackageBuffer.cxx
index 5911c0ba2e4a..1d25ee0cebf9 100644
--- a/package/source/zippackage/ZipPackageBuffer.cxx
+++ b/package/source/zippackage/ZipPackageBuffer.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ZipPackageBuffer.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: mtg $ $Date: 2000-12-13 17:00:47 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
@@ -100,17 +100,50 @@ void SAL_CALL ZipPackageBuffer::release(void)
sal_Int32 SAL_CALL ZipPackageBuffer::readBytes( Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
throw(NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
{
+ //const sal_Int8 *pBuffer = aBuffer.getConstArray()+nCurrent;
+
if (nBytesToRead < 0)
throw BufferSizeExceededException(::rtl::OUString(),*this);
if (nBytesToRead + nCurrent > nEnd)
nBytesToRead = static_cast < sal_Int32 > (nEnd - nCurrent);
- aData.realloc(nBytesToRead);
memcpy(aData.getArray(), aBuffer.getConstArray() + nCurrent, nBytesToRead);
nCurrent +=nBytesToRead;
-
return nBytesToRead;
+ //aData.realloc(nBytesToRead);
+ //memcpy(aData.getArray(), pBuffer + nCurrent, nBytesToRead);
+ //memcpy(pData, pBuffer, nBytesToRead);
+
+ // Optimisations for often called cases
+ /*
+ switch (nBytesToRead)
+ {
+ case 0:
+ return 0;
+ case 1:
+ *(pData++) = *pBuffer;
+ nCurrent +=1;
+ return 1;
+ case 2:
+ *(pData++) = *(pBuffer++);
+ * pData = *pBuffer;
+ nCurrent +=2;
+ return 2;
+ case 4:
+ *(pData++) = *(pBuffer++);
+ *(pData++) = *(pBuffer++);
+ *(pData++) = *(pBuffer++);
+ * pData = * pBuffer;
+ nCurrent +=4;
+ return 4;
+ default:
+ memcpy(pData, pBuffer, nBytesToRead);
+ nCurrent +=nBytesToRead;
+ return nBytesToRead;
+ }
+ //return nBytesToRead;
+ */
}
sal_Int32 SAL_CALL ZipPackageBuffer::readSomeBytes( Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
@@ -153,14 +186,44 @@ void SAL_CALL ZipPackageBuffer::writeBytes( const Sequence< sal_Int8 >& aData )
throw(NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
{
sal_Int64 nDataLen = aData.getLength();
+ const sal_Int8 *pData = aData.getConstArray();
+
if (nEnd + nDataLen > nBufferSize)
{
while (nEnd + nDataLen > nBufferSize)
nBufferSize *=2;
aBuffer.realloc(static_cast < sal_Int32 > (nBufferSize));
}
-
- memcpy(aBuffer.getArray()+nCurrent, aData.getConstArray(), static_cast < sal_Int32 > (nDataLen));
+ /*
+ sal_Int8 *pBuffer = aBuffer.getArray()+nCurrent;
+ switch (nDataLen)
+ {
+ case 0:
+ break;
+ case 1:
+ * pBuffer = *pData;
+ nCurrent++;
+ break;
+ case 2:
+ *(pBuffer++) = *(pData++);
+ * pBuffer = * pData ;
+ nCurrent +=2;
+ break;
+ case 4:
+ *(pBuffer++) = *(pData++);
+ *(pBuffer++) = *(pData++);
+ *(pBuffer++) = *(pData++);
+ * pBuffer = * pData ;
+ nCurrent +=4;
+ break;
+ default:
+ memcpy(pBuffer, pData, static_cast < sal_Int32 > (nDataLen));
+ nCurrent += nDataLen;
+ break;
+ }
+ */
+ //memcpy( pBuffer + nCurrent, aData.getConstArray(), static_cast < sal_Int32 > (nDataLen));
+ memcpy( aBuffer.getArray() + nCurrent, aData.getConstArray(), static_cast < sal_Int32 > (nDataLen));
nCurrent+=nDataLen;
if (nCurrent>nEnd)
nEnd = nCurrent;
diff --git a/package/source/zippackage/ZipPackageEntry.cxx b/package/source/zippackage/ZipPackageEntry.cxx
index 9cdcd3dd4474..0268ba576107 100644
--- a/package/source/zippackage/ZipPackageEntry.cxx
+++ b/package/source/zippackage/ZipPackageEntry.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ZipPackageEntry.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: obo $ $Date: 2000-12-04 16:16:42 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
@@ -70,27 +70,20 @@ ZipPackageEntry::ZipPackageEntry (void)
ZipPackageEntry::~ZipPackageEntry( void )
{
}
-
+/* I made these pure virtual to bypass a couple of virtual calls...
+ * acquire/release/queryInterface are called several thousand times in a single
+ * ZipPackage instance
uno::Any SAL_CALL ZipPackageEntry::queryInterface( const uno::Type& rType )
throw(uno::RuntimeException)
{
- // Ask for my own supported interfaces ...
- uno::Any aReturn ( ::cppu::queryInterface ( rType ,
+ return ( ::cppu::queryInterface ( rType ,
+ // OWeakObject interfaces
+ static_cast< uno::XWeak* > ( this ) ,
+ static_cast< uno::XInterface* > ( this ) ,
+ // my own interfaces
static_cast< container::XNamed* > ( this ) ,
static_cast< lang::XUnoTunnel* > ( this ) ,
static_cast< container::XChild* > ( this ) ) );
-
- // If searched interface supported by this class ...
- if ( aReturn.hasValue () == sal_True )
- {
- // ... return this information.
- return aReturn ;
- }
- else
- {
- // Else; ... ask baseclass for interfaces!
- return OWeakObject::queryInterface ( rType ) ;
- }
}
void SAL_CALL ZipPackageEntry::acquire( )
throw()
@@ -102,6 +95,7 @@ void SAL_CALL ZipPackageEntry::release( )
{
OWeakObject::release();
}
+*/
// XChild
::rtl::OUString SAL_CALL ZipPackageEntry::getName( )
throw(uno::RuntimeException)
diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx
index 32e4fbdb201a..3c03f25d8dcd 100644
--- a/package/source/zippackage/ZipPackageFolder.cxx
+++ b/package/source/zippackage/ZipPackageFolder.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ZipPackageFolder.cxx,v $
*
- * $Revision: 1.21 $
+ * $Revision: 1.22 $
*
- * last change: $Author: mtg $ $Date: 2000-12-13 17:00:47 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
@@ -64,6 +64,7 @@
using namespace com::sun::star::package::ZipConstants;
using namespace com::sun::star;
+using namespace cppu;
using namespace rtl;
ZipPackageFolder::ZipPackageFolder (void)
@@ -100,42 +101,41 @@ void ZipPackageFolder::copyZipEntry( com::sun::star::package::ZipEntry &rDest, c
uno::Any SAL_CALL ZipPackageFolder::queryInterface( const uno::Type& rType )
throw(uno::RuntimeException)
{
- // Ask for my own supported interfaces ...
- uno::Any aReturn ( ::cppu::queryInterface ( rType ,
- static_cast< container::XNamed* > ( this ) ,
- static_cast< container::XChild* > ( this ) ,
- static_cast< container::XNameContainer* > ( this ) ,
- static_cast< container::XEnumerationAccess* > ( this ) ,
- static_cast< lang::XUnoTunnel* > ( this ) ,
- static_cast< beans::XPropertySet* > ( this ) ) ) ;
-
- // If searched interface supported by this class ...
- if ( aReturn.hasValue () == sal_True )
- {
- // ... return this information.
- return aReturn ;
- }
- else
- {
- // Else; ... ask baseclass for interfaces!
- return ZipPackageEntry::queryInterface ( rType ) ;
- }
+ // cppu::queryInterface is an inline template so it's fast
+ // unfortunately, it always creates an Any...we should be able to optimise
+ // this with a class static containing supported interfaces
+ // ...will research this further ...mtg 15/12/00
+ return ::cppu::queryInterface ( rType ,
+ // OWeakObject interfaces
+ reinterpret_cast< uno::XInterface* > ( this ) ,
+ static_cast< uno::XWeak* > ( this ) ,
+ // ZipPackageEntry interfaces
+ static_cast< container::XNamed* > ( this ) ,
+ static_cast< container::XChild* > ( this ) ,
+ static_cast< lang::XUnoTunnel* > ( this ) ,
+ // my own interfaces
+ static_cast< container::XNameContainer* > ( this ) ,
+ static_cast< container::XEnumerationAccess* > ( this ) ,
+ static_cast< beans::XPropertySet* > ( this ) );
+
}
+
void SAL_CALL ZipPackageFolder::acquire( )
throw()
{
- ZipPackageEntry::acquire();
+ OWeakObject::acquire();
}
void SAL_CALL ZipPackageFolder::release( )
throw()
{
- ZipPackageEntry::release();
+ OWeakObject::release();
}
+
// XNameContainer
void SAL_CALL ZipPackageFolder::insertByName( const ::rtl::OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)
{
- OUString sName;
+ static OUString sName;
if (aName.indexOf('/', 0 ) == 0)
sName = aName.copy(1, aName.getLength());
else
@@ -165,7 +165,7 @@ void SAL_CALL ZipPackageFolder::insertByName( const ::rtl::OUString& aName, cons
void SAL_CALL ZipPackageFolder::removeByName( const ::rtl::OUString& Name )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
- OUString sName;
+ static OUString sName;
if (Name.indexOf('/', 0 ) == 0)
sName = Name.copy(1, Name.getLength());
else
@@ -196,7 +196,7 @@ uno::Any SAL_CALL ZipPackageFolder::getByName( const ::rtl::OUString& aName )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
uno::Any aAny;
- OUString sName;
+ static OUString sName;
if (aName.indexOf('/', 0 ) == 0)
sName = aName.copy(1, aName.getLength());
else
@@ -220,7 +220,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL ZipPackageFolder::getElementNames( )
sal_Bool SAL_CALL ZipPackageFolder::hasByName( const ::rtl::OUString& aName )
throw(uno::RuntimeException)
{
- OUString sName;
+ static OUString sName;
if (aName.indexOf('/', 0 ) == 0)
sName = aName.copy(1, aName.getLength());
else
@@ -231,7 +231,7 @@ sal_Bool SAL_CALL ZipPackageFolder::hasByName( const ::rtl::OUString& aName )
void SAL_CALL ZipPackageFolder::replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
- OUString sName;
+ static OUString sName;
if (aName.indexOf('/', 0 ) == 0)
sName = aName.copy(1, aName.getLength());
else
@@ -261,15 +261,14 @@ void SAL_CALL ZipPackageFolder::setPropertyValue( const ::rtl::OUString& aProper
uno::Any SAL_CALL ZipPackageFolder::getPropertyValue( const ::rtl::OUString& PropertyName )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
+ uno::Any aAny;
if (PropertyName == OUString::createFromAscii("MediaType"))
{
- uno::Any aAny;
aAny <<= sMediaType;
return aAny;
}
else if (PropertyName == OUString::createFromAscii("Size"))
{
- uno::Any aAny;
aAny <<= aEntry.nSize;
return aAny;
}
@@ -499,6 +498,40 @@ void ZipPackageFolder::saveContents(rtl::OUString &rPath, std::vector < Manifest
}
}
}
+
+void ZipPackageFolder::releaseUpwardRef( void )
+{
+ uno::Reference < lang::XUnoTunnel > xTunnel;
+ ZipPackageFolder *pFolder = NULL;
+ ZipPackageStream *pStream = NULL;
+ sal_Bool bIsFolder;
+ TunnelHash::const_iterator aCI = aContents.begin();
+
+ for (;aCI!=aContents.end();aCI++)
+ {
+ xTunnel = uno::Reference < lang::XUnoTunnel> ((*aCI).second, uno::UNO_QUERY);
+ sal_Int64 nTest=0;
+ if ((nTest = xTunnel->getSomething(ZipPackageFolder::getUnoTunnelImplementationId())) != 0)
+ {
+ pFolder = reinterpret_cast < ZipPackageFolder* > ( nTest );
+ bIsFolder = sal_True;
+ }
+ else
+ {
+ nTest = xTunnel->getSomething(ZipPackageStream::getUnoTunnelImplementationId());
+ pStream = reinterpret_cast < ZipPackageStream* > ( nTest );
+ bIsFolder = sal_False;
+ }
+
+ if (bIsFolder)
+ {
+ pFolder->releaseUpwardRef();
+ pFolder->clearParent();
+ }
+ else
+ pStream->clearParent();
+ }
+}
void ZipPackageFolder::updateReferences( ZipFile * pNewZipFile)
{
uno::Reference < lang::XUnoTunnel > xTunnel;
diff --git a/package/source/zippackage/ZipPackageFolderEnumeration.cxx b/package/source/zippackage/ZipPackageFolderEnumeration.cxx
index 55d882146549..9610dd46e941 100644
--- a/package/source/zippackage/ZipPackageFolderEnumeration.cxx
+++ b/package/source/zippackage/ZipPackageFolderEnumeration.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ZipPackageFolderEnumeration.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: obo $ $Date: 2000-12-04 16:18:49 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
@@ -78,7 +78,7 @@ ZipPackageFolderEnumeration::~ZipPackageFolderEnumeration( void )
sal_Bool SAL_CALL ZipPackageFolderEnumeration::hasMoreElements( )
throw(uno::RuntimeException)
{
- return (aIterator != rContents.end() );
+ return (aIterator != rContents.end() );
}
uno::Any SAL_CALL ZipPackageFolderEnumeration::nextElement( )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
diff --git a/package/source/zippackage/ZipPackageSink.cxx b/package/source/zippackage/ZipPackageSink.cxx
index ec9370b21e38..ab493f117e2d 100644
--- a/package/source/zippackage/ZipPackageSink.cxx
+++ b/package/source/zippackage/ZipPackageSink.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ZipPackageSink.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mtg $ $Date: 2000-11-21 10:43:06 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx
index e972aaa7238f..7a995630162d 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ZipPackageStream.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: mtg $ $Date: 2000-12-13 17:00:47 $
+ * last change: $Author: mtg $ $Date: 2000-12-19 21:55:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -54,7 +54,7 @@
*
* All Rights Reserved.
*
- * Contributor(s): _______________________________________
+ * Contributor(s): Martin Gallwey (gallwey@sun.com)
*
*
************************************************************************/
@@ -64,6 +64,7 @@
#endif
using namespace com::sun::star;
+using namespace cppu;
ZipPackageStream::ZipPackageStream (ZipFile *pInFile)
: pZipFile(pInFile)
@@ -101,36 +102,31 @@ void ZipPackageStream::setZipEntry( const package::ZipEntry &rInEntry)
uno::Any SAL_CALL ZipPackageStream::queryInterface( const uno::Type& rType )
throw(uno::RuntimeException)
{
- // Ask for my own supported interfaces ...
- uno::Any aReturn ( ::cppu::queryInterface ( rType ,
+ return ( ::cppu::queryInterface ( rType ,
+ // OWeakObject interfaces
+ reinterpret_cast< uno::XInterface* > ( this ) ,
+ static_cast< uno::XWeak* > ( this ) ,
+ // ZipPackageEntry interfaces
static_cast< container::XNamed* > ( this ) ,
static_cast< container::XChild* > ( this ) ,
- static_cast< io::XActiveDataSink* > ( this ) ,
static_cast< lang::XUnoTunnel* > ( this ) ,
- static_cast< beans::XPropertySet* > ( this ) ) );
+ // My own interfaces
+ static_cast< io::XActiveDataSink* > ( this ) ,
+ static_cast< beans::XPropertySet* > ( this ) ) );
- // If searched interface supported by this class ...
- if ( aReturn.hasValue () == sal_True )
- {
- // ... return this information.
- return aReturn ;
- }
- else
- {
- // Else; ... ask baseclass for interfaces!
- return ZipPackageEntry::queryInterface ( rType ) ;
- }
}
+
void SAL_CALL ZipPackageStream::acquire( )
throw()
{
- ZipPackageEntry::acquire();
+ OWeakObject::acquire();
}
void SAL_CALL ZipPackageStream::release( )
throw()
{
- ZipPackageEntry::release();
+ OWeakObject::release();
}
+
// XActiveDataSink
void SAL_CALL ZipPackageStream::setInputStream( const uno::Reference< io::XInputStream >& aStream )
throw(uno::RuntimeException)
@@ -196,15 +192,14 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const ::rtl::OUString& aProper
uno::Any SAL_CALL ZipPackageStream::getPropertyValue( const ::rtl::OUString& PropertyName )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
+ uno::Any aAny;
if (PropertyName == ::rtl::OUString::createFromAscii("MediaType"))
{
- uno::Any aAny;
aAny <<= sMediaType;
return aAny;
}
else if (PropertyName == ::rtl::OUString::createFromAscii("Size"))
{
- uno::Any aAny;
aAny <<= aEntry.nSize;
return aAny;
}