[Libreoffice-commits] core.git: package/inc package/source

Kohei Yoshida kohei.yoshida at collabora.com
Wed Jan 11 14:44:33 UTC 2017


 package/inc/ZipFile.hxx           |   49 ++++++++++----------------------------
 package/source/zipapi/ZipFile.cxx |   21 +---------------
 2 files changed, 15 insertions(+), 55 deletions(-)

New commits:
commit a544fd5fa233135f150b44c843a14be461952ecd
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Jan 10 22:05:13 2017 -0500

    Remove unnecessary UNO-ness from ZipFile class.
    
    This class is only used inside package module, and totally private
    to the module.
    
    Change-Id: Ib00e7066c22a74c0b16c8d6ecf72b99ac42682dd
    Reviewed-on: https://gerrit.libreoffice.org/32945
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>

diff --git a/package/inc/ZipFile.hxx b/package/inc/ZipFile.hxx
index c32d582..bfc056f 100644
--- a/package/inc/ZipFile.hxx
+++ b/package/inc/ZipFile.hxx
@@ -53,7 +53,6 @@ class ZipEnumeration;
 
 class ZipFile
 {
-protected:
     ::osl::Mutex    m_aMutex;
 
     EntryHash       aEntries;
@@ -82,20 +81,21 @@ protected:
 
     void getSizeAndCRC( sal_Int64 nOffset, sal_Int64 nCompressedSize, sal_Int64 *nSize, sal_Int32 *nCRC );
 
+    bool readLOC( ZipEntry &rEntry );
+    sal_Int32 readCEN();
+    sal_Int32 findEND();
+    void recover();
+
 public:
 
     ZipFile( css::uno::Reference < css::io::XInputStream > &xInput,
              const css::uno::Reference < css::uno::XComponentContext > &rxContext,
-             bool bInitialise
-             )
-        throw(css::io::IOException, css::packages::zip::ZipException, css::uno::RuntimeException);
+             bool bInitialise );
 
     ZipFile( css::uno::Reference < css::io::XInputStream > &xInput,
              const css::uno::Reference < css::uno::XComponentContext > &rxContext,
              bool bInitialise,
-             bool bForceRecover
-             )
-        throw(css::io::IOException, css::packages::zip::ZipException, css::uno::RuntimeException);
+             bool bForceRecover );
 
     ~ZipFile();
 
@@ -106,8 +106,7 @@ public:
             ZipEntry& rEntry,
             const ::rtl::Reference < EncryptionData > &rData,
             bool bDecrypt,
-            const rtl::Reference<SotMutexHolder>& aMutexHolder )
-        throw(css::io::IOException, css::packages::zip::ZipException, css::uno::RuntimeException);
+            const rtl::Reference<SotMutexHolder>& aMutexHolder );
 
     static css::uno::Reference< css::xml::crypto::XDigestContext > StaticGetDigestContextForChecksum(
             const css::uno::Reference< css::uno::XComponentContext >& xArgContext,
@@ -135,10 +134,7 @@ public:
     static css::uno::Reference< css::io::XInputStream > StaticGetDataFromRawStream(
             const css::uno::Reference< css::uno::XComponentContext >& rxContext,
             const css::uno::Reference< css::io::XInputStream >& xStream,
-            const ::rtl::Reference < EncryptionData > &rData )
-        throw ( css::packages::WrongPasswordException,
-                css::packages::zip::ZipIOException,
-                css::uno::RuntimeException );
+            const ::rtl::Reference < EncryptionData > &rData );
 
     static bool StaticHasValidPassword (
             const css::uno::Reference< css::uno::XComponentContext >& rxContext,
@@ -149,40 +145,21 @@ public:
             ZipEntry& rEntry,
             const ::rtl::Reference < EncryptionData > &rData,
             bool bDecrypt,
-            const rtl::Reference<SotMutexHolder>& aMutexHolder )
-        throw(css::io::IOException, css::packages::zip::ZipException, css::uno::RuntimeException);
+            const rtl::Reference<SotMutexHolder>& aMutexHolder );
 
     css::uno::Reference< css::io::XInputStream > SAL_CALL getDataStream(
             ZipEntry& rEntry,
             const ::rtl::Reference < EncryptionData > &rData,
             bool bDecrypt,
-            const rtl::Reference<SotMutexHolder>& aMutexHolder )
-        throw ( css::packages::WrongPasswordException,
-                css::io::IOException,
-                css::packages::zip::ZipException,
-                css::uno::RuntimeException );
+            const rtl::Reference<SotMutexHolder>& aMutexHolder );
 
     css::uno::Reference< css::io::XInputStream > SAL_CALL getWrappedRawStream(
             ZipEntry& rEntry,
             const ::rtl::Reference < EncryptionData > &rData,
             const OUString& aMediaType,
-            const rtl::Reference<SotMutexHolder>& aMutexHolder )
-        throw ( css::packages::NoEncryptionException,
-                css::io::IOException,
-                css::packages::zip::ZipException,
-                css::uno::RuntimeException );
-
-    ZipEnumeration * SAL_CALL entries(  );
-protected:
-    bool        readLOC ( ZipEntry &rEntry)
-        throw(css::io::IOException, css::packages::zip::ZipException, css::uno::RuntimeException);
-    sal_Int32       readCEN()
-        throw(css::io::IOException, css::packages::zip::ZipException, css::uno::RuntimeException);
-    sal_Int32       findEND()
-        throw(css::io::IOException, css::packages::zip::ZipException, css::uno::RuntimeException);
-    void            recover()
-        throw(css::io::IOException, css::packages::zip::ZipException, css::uno::RuntimeException);
+            const rtl::Reference<SotMutexHolder>& aMutexHolder );
 
+    ZipEnumeration* entries();
 };
 
 #endif
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index da44e34..943fde1 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -68,7 +68,6 @@ using ZipUtils::Inflater;
 /** This class is used to read entries from a zip file
  */
 ZipFile::ZipFile( uno::Reference < XInputStream > &xInput, const uno::Reference < XComponentContext > & rxContext, bool bInitialise )
-    throw(IOException, ZipException, RuntimeException)
 : aGrabber(xInput)
 , aInflater( true )
 , xStream(xInput)
@@ -87,7 +86,6 @@ ZipFile::ZipFile( uno::Reference < XInputStream > &xInput, const uno::Reference
 }
 
 ZipFile::ZipFile( uno::Reference < XInputStream > &xInput, const uno::Reference < XComponentContext > & rxContext, bool bInitialise, bool bForceRecovery)
-    throw(IOException, ZipException, RuntimeException)
 : aGrabber(xInput)
 , aInflater( true )
 , xStream(xInput)
@@ -379,7 +377,6 @@ bool ZipFile::StaticFillData (  ::rtl::Reference< BaseEncryptionData > & rData,
 uno::Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const uno::Reference< uno::XComponentContext >& rxContext,
                                                                 const uno::Reference< XInputStream >& xStream,
                                                                 const ::rtl::Reference< EncryptionData > &rData )
-        throw ( packages::WrongPasswordException, ZipIOException, RuntimeException )
 {
     if ( !rData.is() )
         throw ZipIOException("Encrypted stream without encryption data!" );
@@ -521,7 +518,7 @@ uno::Reference< XInputStream > ZipFile::createUnbufferedStream(
     return new XUnbufferedStream ( m_xContext, aMutexHolder, rEntry, xStream, rData, nStreamMode, bIsEncrypted, aMediaType, bRecoveryMode );
 }
 
-ZipEnumeration * SAL_CALL ZipFile::entries(  )
+ZipEnumeration* ZipFile::entries()
 {
     return new ZipEnumeration ( aEntries );
 }
@@ -530,7 +527,6 @@ uno::Reference< XInputStream > SAL_CALL ZipFile::getInputStream( ZipEntry& rEntr
         const ::rtl::Reference< EncryptionData > &rData,
         bool bIsEncrypted,
         const rtl::Reference<SotMutexHolder>& aMutexHolder )
-    throw(IOException, ZipException, RuntimeException)
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
@@ -558,10 +554,6 @@ uno::Reference< XInputStream > SAL_CALL ZipFile::getDataStream( ZipEntry& rEntry
         const ::rtl::Reference< EncryptionData > &rData,
         bool bIsEncrypted,
         const rtl::Reference<SotMutexHolder>& aMutexHolder )
-    throw ( packages::WrongPasswordException,
-            IOException,
-            ZipException,
-            RuntimeException )
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
@@ -598,7 +590,6 @@ uno::Reference< XInputStream > SAL_CALL ZipFile::getRawData( ZipEntry& rEntry,
         const ::rtl::Reference< EncryptionData >& rData,
         bool bIsEncrypted,
         const rtl::Reference<SotMutexHolder>& aMutexHolder )
-    throw(IOException, ZipException, RuntimeException)
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
@@ -613,10 +604,6 @@ uno::Reference< XInputStream > SAL_CALL ZipFile::getWrappedRawStream(
         const ::rtl::Reference< EncryptionData >& rData,
         const OUString& aMediaType,
         const rtl::Reference<SotMutexHolder>& aMutexHolder )
-    throw ( packages::NoEncryptionException,
-            IOException,
-            ZipException,
-            RuntimeException )
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
@@ -630,7 +617,6 @@ uno::Reference< XInputStream > SAL_CALL ZipFile::getWrappedRawStream(
 }
 
 bool ZipFile::readLOC( ZipEntry &rEntry )
-    throw(IOException, ZipException, RuntimeException)
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
@@ -700,8 +686,7 @@ bool ZipFile::readLOC( ZipEntry &rEntry )
     return true;
 }
 
-sal_Int32 ZipFile::findEND( )
-    throw(IOException, ZipException, RuntimeException)
+sal_Int32 ZipFile::findEND()
 {
     // this method is called in constructor only, no need for mutex
     sal_Int32 nLength, nPos, nEnd;
@@ -743,7 +728,6 @@ sal_Int32 ZipFile::findEND( )
 }
 
 sal_Int32 ZipFile::readCEN()
-    throw(IOException, ZipException, RuntimeException)
 {
     // this method is called in constructor only, no need for mutex
     sal_Int32 nCenPos = -1, nEndPos, nLocPos;
@@ -861,7 +845,6 @@ sal_Int32 ZipFile::readCEN()
 }
 
 void ZipFile::recover()
-    throw(IOException, ZipException, RuntimeException)
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 


More information about the Libreoffice-commits mailing list