From b28e1878292703256fa02ca7195090bd22e14e8d Mon Sep 17 00:00:00 2001 From: Martin Gallwey Date: Fri, 24 Nov 2000 09:34:27 +0000 Subject: [PATCH] #80556# now builds under Solaris correctly --- package/inc/ZipFile.hxx | 5 +- package/inc/ZipOutputStream.hxx | 6 +- package/source/zipapi/CRC32.cxx | 10 +-- package/source/zipapi/ZipFile.cxx | 62 ++++++++----------- .../source/zippackage/ZipPackageFolder.cxx | 14 ++--- .../source/zippackage/ZipPackageStream.cxx | 12 ++-- package/source/zippackage/makefile.mk | 14 ++--- 7 files changed, 57 insertions(+), 66 deletions(-) diff --git a/package/inc/ZipFile.hxx b/package/inc/ZipFile.hxx index a2b0dd6b4aae..82d2b5071e63 100644 --- a/package/inc/ZipFile.hxx +++ b/package/inc/ZipFile.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ZipFile.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-11-24 10:34:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -105,7 +105,6 @@ private: ByteGrabber aGrabber; com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xStream; public: - //ZipFile( void ); ZipFile( com::sun::star::uno::Reference < com::sun::star::io::XInputStream > &xInput); virtual ~ZipFile(); diff --git a/package/inc/ZipOutputStream.hxx b/package/inc/ZipOutputStream.hxx index 69940b8d100f..371dff12de3e 100644 --- a/package/inc/ZipOutputStream.hxx +++ b/package/inc/ZipOutputStream.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ZipOutputStream.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-11-24 10:34:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -113,7 +113,7 @@ private: CRC32 aCRC; sal_Bool bFinished; ByteChucker aChucker; - ::std::vector <::com::sun::star::package::ZipEntry> aZipList; + ::std::vector < ::com::sun::star::package::ZipEntry > aZipList; public: ZipOutputStream( com::sun::star::uno::Reference < com::sun::star::io::XOutputStream > &xOStream, sal_Int32 nNewBufferSize); diff --git a/package/source/zipapi/CRC32.cxx b/package/source/zipapi/CRC32.cxx index ca866f761fc5..0021bafbdf93 100644 --- a/package/source/zipapi/CRC32.cxx +++ b/package/source/zipapi/CRC32.cxx @@ -2,9 +2,9 @@ * * $RCSfile: CRC32.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mtg $ $Date: 2000-11-16 11:55:52 $ + * last change: $Author: mtg $ $Date: 2000-11-24 10:34:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -75,11 +75,13 @@ CRC32::CRC32() CRC32::~CRC32() { } -void CRC32::reset() +void SAL_CALL CRC32::reset() + throw(uno::RuntimeException) { nCRC=0; } -sal_Int32 CRC32::getValue() +sal_Int32 SAL_CALL CRC32::getValue() + throw(uno::RuntimeException) { return nCRC & 0xFFFFFFFFL; } diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 15156aeb9d86..7fa83bbd6e01 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ZipFile.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: mtg $ $Date: 2000-11-23 14:15:51 $ + * last change: $Author: mtg $ $Date: 2000-11-24 10:34:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -89,26 +89,6 @@ ZipFile::ZipFile (uno::Reference < io::XInputStream > &xInput) readCEN(); } -/* -ZipFile::ZipFile( void ) -:pEntries(NULL) -, pTable(NULL) -, nTotal(0) -, nTableLen(0) -{ -} -void SAL_CALL ZipFile::setInputStream( const uno::Reference< io::XInputStream >& xInput ) - throw(io::IOException, package::ZipException, uno::RuntimeException) -{ - xStream = uno::Reference (xInput); - aGrabber.setInputStream ( xInput ); - readCEN(); -} -*/ - -//ZipFile::ZipFile (const uno::Reference < lang::XMultiServiceFactory > &xFactory) -//{ -//} ZipFile::~ZipFile() { if (pEntries != NULL) @@ -128,11 +108,13 @@ ZipFile::~ZipFile() } } -void ZipFile::close() +void SAL_CALL ZipFile::close( ) + throw(io::IOException, uno::RuntimeException) { } -uno::Reference ZipFile::entries() +uno::Reference< container::XEnumeration > SAL_CALL ZipFile::entries( ) + throw(uno::RuntimeException) { uno::Reference< container::XEnumeration> xEnumRef; xEnumRef= new ZipEnumeration( uno::Sequence < package::ZipEntry > (pEntries, nTotal) ); @@ -140,32 +122,37 @@ uno::Reference ZipFile::entries() // xEnumRef = uno::Reference < container::XEnumeration>( static_cast < container::XEnumeration *> (pEnum), uno::UNO_QUERY ); return xEnumRef; } -::rtl::OUString ZipFile::getName() +::rtl::OUString SAL_CALL ZipFile::getName( ) + throw(uno::RuntimeException) { return sName; } -sal_Int32 ZipFile::getSize() +sal_Int32 SAL_CALL ZipFile::getSize( ) + throw(uno::RuntimeException) { return nTotal; } -uno::Type ZipFile::getElementType() +uno::Type SAL_CALL ZipFile::getElementType( ) + throw(uno::RuntimeException) { return ::getCppuType((package::ZipEntry *) 0); } -sal_Bool ZipFile::hasElements() +sal_Bool SAL_CALL ZipFile::hasElements( ) + throw(uno::RuntimeException) { return (nTotal>0); } -uno::Any ZipFile::getByName(const ::rtl::OUString& rName) +uno::Any SAL_CALL ZipFile::getByName( const ::rtl::OUString& aName ) + throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) { uno::Any aAny; - sal_Int32 nHash = abs(rName.hashCode() % nTableLen); + sal_Int32 nHash = abs(aName.hashCode() % nTableLen); ZipEntryImpl * pEntry = pTable[nHash]; while (pEntry != NULL) { - if (rName == pEntry->getName()) + if (aName == pEntry->getName()) { //uno::Reference < package::ZepEntry > xEntry = pEntry; aAny <<= *(pEntry->pEntry); @@ -176,26 +163,29 @@ uno::Any ZipFile::getByName(const ::rtl::OUString& rName) throw container::NoSuchElementException(); return aAny; } -uno::Sequence ZipFile::getElementNames() +uno::Sequence< ::rtl::OUString > SAL_CALL ZipFile::getElementNames( ) + throw(uno::RuntimeException) { OUString *pNames = new OUString[nTotal]; for (int i = 0; i < nTotal; i++) pNames[i] = pEntries[i].sName; return uno::Sequence (pNames, nTotal); } -sal_Bool ZipFile::hasByName(const ::rtl::OUString& rName) +sal_Bool SAL_CALL ZipFile::hasByName( const ::rtl::OUString& aName ) + throw(uno::RuntimeException) { - sal_Int32 nHash = abs(rName.hashCode() % nTableLen); + sal_Int32 nHash = abs(aName.hashCode() % nTableLen); ZipEntryImpl * pEntry = pTable[nHash]; while (pEntry != NULL) { - if (rName == pEntry->getName()) + if (aName == pEntry->getName()) return sal_True; pEntry = pEntry->pNext; } return sal_False; } -uno::Reference< io::XInputStream> ZipFile::getInputStream(const package::ZipEntry& rEntry) +uno::Reference< io::XInputStream > SAL_CALL ZipFile::getInputStream( const package::ZipEntry& rEntry ) + throw(io::IOException, package::ZipException, uno::RuntimeException) { sal_Int64 nEnd = rEntry.nCompressedSize == 0 ? rEntry.nSize : rEntry.nCompressedSize; if (rEntry.nOffset <= 0) diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx index cce6c113c899..2782d6d6ae51 100644 --- a/package/source/zippackage/ZipPackageFolder.cxx +++ b/package/source/zippackage/ZipPackageFolder.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ZipPackageFolder.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: mtg $ $Date: 2000-11-23 14:15:52 $ + * last change: $Author: mtg $ $Date: 2000-11-24 10:34:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -195,9 +195,9 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL ZipPackageFolder::getProperty void SAL_CALL ZipPackageFolder::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { - if (aPropertyName == L"MediaType") + if (aPropertyName == OUString::createFromAscii("MediaType")) aValue >>= sMediaType; - else if (aPropertyName == L"Size") + else if (aPropertyName == OUString::createFromAscii("Size")) aValue >>= aEntry.nSize; else throw beans::UnknownPropertyException(); @@ -205,13 +205,13 @@ 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) { - if (PropertyName == L"MediaType") + if (PropertyName == OUString::createFromAscii("MediaType")) { uno::Any aAny; aAny <<= sMediaType; return aAny; } - else if (PropertyName == L"Size") + else if (PropertyName == OUString::createFromAscii("Size")) { uno::Any aAny; aAny <<= aEntry.nSize; @@ -268,7 +268,7 @@ void ZipPackageFolder::saveContents(rtl::OUString &rPath) if (bIsFolder) { time_t nTime = 0; - pFolder->aEntry.sName = rPath + pFolder->getName() + L"/"; + pFolder->aEntry.sName = rPath + pFolder->getName() + OUString::createFromAscii("/"); #ifdef _DEBUG_RECURSION_ /*pFolder->aEntry.nMethod = STORED;*/ ByteString sByte(String(pFolder->aEntry.sName),RTL_TEXTENCODING_ASCII_US); diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index d9f8e9b26893..106d9225cc5f 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ZipPackageStream.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: mtg $ $Date: 2000-11-23 14:15:52 $ + * last change: $Author: mtg $ $Date: 2000-11-24 10:34:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -155,9 +155,9 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL ZipPackageStream::getProperty void SAL_CALL ZipPackageStream::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { - if (aPropertyName == L"MediaType") + if (aPropertyName == ::rtl::OUString::createFromAscii("MediaType")) aValue >>= aEntry.sComment; - else if (aPropertyName == L"Size") + else if (aPropertyName == ::rtl::OUString::createFromAscii("Size")) aValue >>= aEntry.nSize; else throw beans::UnknownPropertyException(); @@ -165,13 +165,13 @@ 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) { - if (PropertyName == L"MediaType") + if (PropertyName == ::rtl::OUString::createFromAscii("MediaType")) { uno::Any aAny; aAny <<= aEntry.sComment; return aAny; } - else if (PropertyName == L"Size") + else if (PropertyName == ::rtl::OUString::createFromAscii("Size")) { uno::Any aAny; aAny <<= aEntry.nSize; diff --git a/package/source/zippackage/makefile.mk b/package/source/zippackage/makefile.mk index 60ff9e969ce2..268c4e1a53ca 100644 --- a/package/source/zippackage/makefile.mk +++ b/package/source/zippackage/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.5 $ +# $Revision: 1.6 $ # -# last change: $Author: mtg $ $Date: 2000-11-21 12:08:47 $ +# last change: $Author: mtg $ $Date: 2000-11-24 10:34:27 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -76,12 +76,12 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- SLOFILES= \ - $(SLO)$/ZipPackage.obj \ - $(SLO)$/ZipPackageBuffer.obj \ - $(SLO)$/ZipPackageEntry.obj \ - $(SLO)$/ZipPackageFolder.obj \ + $(SLO)$/ZipPackage.obj \ + $(SLO)$/ZipPackageBuffer.obj \ + $(SLO)$/ZipPackageEntry.obj \ + $(SLO)$/ZipPackageFolder.obj \ $(SLO)$/ZipPackageFolderEnumeration.obj \ - $(SLO)$/ZipPackageSink.obj \ + $(SLO)$/ZipPackageSink.obj \ $(SLO)$/ZipPackageStream.obj # --- UNO stuff ---------------------------------------------------