diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-10-07 13:56:26 +0200 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-10-10 13:50:03 +0200 |
commit | 3d8f059802c209dbd0cfddc454198fce24c876b5 (patch) | |
tree | c4abf5228abbc164ea741c0d3e2a8d7ab205154b | |
parent | 9a25d12534f91c13400a63e265fb5aa14c6aca66 (diff) |
package: Add some 'const' and prefix members
Change-Id: Id177c99ba8b91586cf61457ab2ef084af9c7f490
-rw-r--r-- | package/inc/ZipPackageEntry.hxx | 12 | ||||
-rw-r--r-- | package/inc/ZipPackageFolder.hxx | 6 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackageEntry.cxx | 24 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackageFolder.cxx | 10 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackageStream.cxx | 16 |
5 files changed, 34 insertions, 34 deletions
diff --git a/package/inc/ZipPackageEntry.hxx b/package/inc/ZipPackageEntry.hxx index c8cf1fa0a732..cfe1895f2804 100644 --- a/package/inc/ZipPackageEntry.hxx +++ b/package/inc/ZipPackageEntry.hxx @@ -44,24 +44,24 @@ protected: bool mbIsFolder:1; bool mbAllowRemoveOnInsert:1; // com::sun::star::uno::Reference < com::sun::star::container::XNameContainer > xParent; - OUString sMediaType; - ZipPackageFolder * pParent; + OUString msMediaType; + ZipPackageFolder* mpParent; public: ZipEntry aEntry; ZipPackageEntry ( bool bNewFolder = false ); virtual ~ZipPackageEntry( void ); - OUString & GetMediaType () { return sMediaType; } - void SetMediaType ( const OUString & sNewType) { sMediaType = sNewType; } + const OUString& GetMediaType () const { return msMediaType; } + void SetMediaType ( const OUString & sNewType) { msMediaType = sNewType; } void doSetParent ( ZipPackageFolder * pNewParent, bool bInsert ); bool IsFolder ( ) { return mbIsFolder; } - ZipPackageFolder* GetParent ( ) { return pParent; } + const ZipPackageFolder* GetParent () const { return mpParent; } void SetFolder ( bool bSetFolder ) { mbIsFolder = bSetFolder; } void clearParent ( void ) { // xParent.clear(); - pParent = NULL; + mpParent = NULL; } // XNamed virtual OUString SAL_CALL getName( ) diff --git a/package/inc/ZipPackageFolder.hxx b/package/inc/ZipPackageFolder.hxx index b885e3bf6339..81eddd7b069c 100644 --- a/package/inc/ZipPackageFolder.hxx +++ b/package/inc/ZipPackageFolder.hxx @@ -60,7 +60,7 @@ public: bool bAllowRemoveOnInsert ); virtual ~ZipPackageFolder(); - OUString& GetVersion() { return m_sVersion; } + const OUString& GetVersion() const { return m_sVersion; } void SetVersion( const OUString& aVersion ) { m_sVersion = aVersion; } bool LookForUnexpectedODF12Streams( const OUString& aPath ); @@ -79,10 +79,10 @@ public: void setPackageFormat_Impl( sal_Int32 nFormat ) { m_nFormat = nFormat; } void setRemoveOnInsertMode_Impl( bool bRemove ) { this->mbAllowRemoveOnInsert = bRemove; } - bool saveChild(const OUString &rShortName, const com::sun::star::packages::ContentInfo &rInfo, OUString &rPath, std::vector < com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > > &rManList, ZipOutputStream & rZipOut, const com::sun::star::uno::Sequence < sal_Int8 >& rEncryptionKey, rtlRandomPool & rRandomPool); + bool saveChild(const OUString &rShortName, const com::sun::star::packages::ContentInfo &rInfo, OUString &rPath, std::vector < com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > > &rManList, ZipOutputStream & rZipOut, const com::sun::star::uno::Sequence < sal_Int8 >& rEncryptionKey, rtlRandomPool & rRandomPool) const; // Recursive functions - void saveContents(OUString &rPath, std::vector < com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > > &rManList, ZipOutputStream & rZipOut, const com::sun::star::uno::Sequence< sal_Int8 > &rEncryptionKey, rtlRandomPool & rRandomPool) + void saveContents(OUString &rPath, std::vector < com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > > &rManList, ZipOutputStream & rZipOut, const com::sun::star::uno::Sequence< sal_Int8 > &rEncryptionKey, rtlRandomPool & rRandomPool) const throw(::com::sun::star::uno::RuntimeException); void releaseUpwardRef(); diff --git a/package/source/zippackage/ZipPackageEntry.cxx b/package/source/zippackage/ZipPackageEntry.cxx index 91b2e9466d07..860f7170434d 100644 --- a/package/source/zippackage/ZipPackageEntry.cxx +++ b/package/source/zippackage/ZipPackageEntry.cxx @@ -43,14 +43,14 @@ using namespace com::sun::star::packages::zip::ZipConstants; ZipPackageEntry::ZipPackageEntry ( bool bNewFolder ) : mbIsFolder ( bNewFolder ) , mbAllowRemoveOnInsert( true ) -, pParent ( NULL ) +, mpParent ( NULL ) { } ZipPackageEntry::~ZipPackageEntry() { // When the entry is destroyed it must be already disconnected from the parent - OSL_ENSURE( !pParent, "The parent must be disconnected already! Memory corruption is possible!\n" ); + OSL_ENSURE( !mpParent, "The parent must be disconnected already! Memory corruption is possible!\n" ); } // XChild @@ -62,8 +62,8 @@ OUString SAL_CALL ZipPackageEntry::getName( ) void SAL_CALL ZipPackageEntry::setName( const OUString& aName ) throw(RuntimeException, std::exception) { - if ( pParent && !msName.isEmpty() && pParent->hasByName ( msName ) ) - pParent->removeByName ( msName ); + if ( mpParent && !msName.isEmpty() && mpParent->hasByName ( msName ) ) + mpParent->removeByName ( msName ); // unfortunately no other exception than RuntimeException can be thrown here // usually the package is used through storage implementation, the problem should be detected there @@ -72,20 +72,20 @@ void SAL_CALL ZipPackageEntry::setName( const OUString& aName ) msName = aName; - if ( pParent ) - pParent->doInsertByName ( this, false ); + if ( mpParent ) + mpParent->doInsertByName ( this, false ); } uno::Reference< XInterface > SAL_CALL ZipPackageEntry::getParent( ) throw(RuntimeException, std::exception) { // return uno::Reference< XInterface >( xParent, UNO_QUERY ); - return uno::Reference< XInterface >( static_cast< ::cppu::OWeakObject* >( pParent ), UNO_QUERY ); + return uno::Reference< XInterface >( static_cast< ::cppu::OWeakObject* >( mpParent ), UNO_QUERY ); } void ZipPackageEntry::doSetParent ( ZipPackageFolder * pNewParent, bool bInsert ) { - // xParent = pParent = pNewParent; - pParent = pNewParent; + // xParent = mpParent = pNewParent; + mpParent = pNewParent; if ( bInsert && !msName.isEmpty() && !pNewParent->hasByName ( msName ) ) pNewParent->doInsertByName ( this, false ); } @@ -100,10 +100,10 @@ void SAL_CALL ZipPackageEntry::setParent( const uno::Reference< XInterface >& xN ZipPackageFolder *pNewParent = reinterpret_cast < ZipPackageFolder * > ( nTest ); - if ( pNewParent != pParent ) + if ( pNewParent != mpParent ) { - if ( pParent && !msName.isEmpty() && pParent->hasByName ( msName ) && mbAllowRemoveOnInsert ) - pParent->removeByName( msName ); + if ( mpParent && !msName.isEmpty() && mpParent->hasByName ( msName ) && mbAllowRemoveOnInsert ) + mpParent->removeByName( msName ); doSetParent ( pNewParent, true ); } } diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx index ce01b92d4ce5..9855dc172406 100644 --- a/package/source/zippackage/ZipPackageFolder.cxx +++ b/package/source/zippackage/ZipPackageFolder.cxx @@ -294,7 +294,7 @@ static void ImplSetStoredData( ZipEntry & rEntry, uno::Reference< XInputStream> rEntry.nCrc = aCRC32.getValue(); } -bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo &rInfo, OUString &rPath, std::vector < uno::Sequence < PropertyValue > > &rManList, ZipOutputStream & rZipOut, const uno::Sequence < sal_Int8 >& rEncryptionKey, rtlRandomPool &rRandomPool) +bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo &rInfo, OUString &rPath, std::vector < uno::Sequence < PropertyValue > > &rManList, ZipOutputStream & rZipOut, const uno::Sequence < sal_Int8 >& rEncryptionKey, rtlRandomPool &rRandomPool) const { bool bSuccess = true; @@ -675,7 +675,7 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo return bSuccess; } -void ZipPackageFolder::saveContents( OUString &rPath, std::vector < uno::Sequence < PropertyValue > > &rManList, ZipOutputStream & rZipOut, const uno::Sequence < sal_Int8 >& rEncryptionKey, rtlRandomPool &rRandomPool ) +void ZipPackageFolder::saveContents( OUString &rPath, std::vector < uno::Sequence < PropertyValue > > &rManList, ZipOutputStream & rZipOut, const uno::Sequence < sal_Int8 >& rEncryptionKey, rtlRandomPool &rRandomPool ) const throw( uno::RuntimeException ) { bool bWritingFailed = false; @@ -709,7 +709,7 @@ void ZipPackageFolder::saveContents( OUString &rPath, std::vector < uno::Sequenc if ( m_nFormat == embed::StorageFormats::ZIP && rPath.isEmpty() ) { // let the "mimtype" stream in root folder be stored as the first stream if it is zip format - ContentHash::iterator aIter = maContents.find ( aMimeTypeStreamName ); + ContentHash::const_iterator aIter = maContents.find ( aMimeTypeStreamName ); if ( aIter != maContents.end() && !(*aIter).second->bFolder ) { bMimeTypeStreamStored = true; @@ -779,7 +779,7 @@ void SAL_CALL ZipPackageFolder::setPropertyValue( const OUString& aPropertyName, // if ( m_nFormat != embed::StorageFormats::PACKAGE ) // throw UnknownPropertyException(THROW_WHERE ); - aValue >>= sMediaType; + aValue >>= msMediaType; } else if ( aPropertyName == "Version" ) aValue >>= m_sVersion; @@ -797,7 +797,7 @@ uno::Any SAL_CALL ZipPackageFolder::getPropertyValue( const OUString& PropertyNa // if ( m_nFormat != embed::StorageFormats::PACKAGE ) // throw UnknownPropertyException(THROW_WHERE ); - return uno::makeAny ( sMediaType ); + return uno::makeAny ( msMediaType ); } else if ( PropertyName == "Version" ) return uno::makeAny( m_sVersion ); diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index 1c827c4fc8f6..fee38a645a20 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -298,7 +298,7 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( throw RuntimeException(THROW_WHERE ); // copy all the properties of this stream to the new stream - xNewPSProps->setPropertyValue("MediaType", makeAny( sMediaType ) ); + xNewPSProps->setPropertyValue("MediaType", makeAny( msMediaType ) ); xNewPSProps->setPropertyValue("Compressed", makeAny( bToBeCompressed ) ); if ( bToBeEncrypted ) { @@ -406,7 +406,7 @@ bool ZipPackageStream::ParsePackageRawStream() m_nImportedDerivedKeySize = nDerivedKeySize; m_nImportedStartKeyAlgorithm = nStartKeyGenID; m_nMagicalHackSize = nMagHackSize; - sMediaType = aMediaType; + msMediaType = aMediaType; bOk = true; } @@ -600,7 +600,7 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawStream() if ( !bIsEncrypted || !GetEncryptionData().is() ) throw packages::NoEncryptionException(THROW_WHERE ); - return rZipPackage.getZipFile().getWrappedRawStream( aEntry, GetEncryptionData(), sMediaType, rZipPackage.GetSharedMutexRef() ); + return rZipPackage.getZipFile().getWrappedRawStream( aEntry, GetEncryptionData(), msMediaType, rZipPackage.GetSharedMutexRef() ); } else if ( GetOwnSeekStream().is() ) { @@ -703,12 +703,12 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, if ( rZipPackage.getFormat() != embed::StorageFormats::PACKAGE && rZipPackage.getFormat() != embed::StorageFormats::OFOPXML ) throw beans::PropertyVetoException(THROW_WHERE ); - if ( aValue >>= sMediaType ) + if ( aValue >>= msMediaType ) { - if ( !sMediaType.isEmpty() ) + if ( !msMediaType.isEmpty() ) { - if ( sMediaType.indexOf ( "text" ) != -1 - || sMediaType == "application/vnd.sun.star.oleobject" ) + if ( msMediaType.indexOf ( "text" ) != -1 + || msMediaType == "application/vnd.sun.star.oleobject" ) bToBeCompressed = true; else if ( !m_bCompressedIsSetFromOutside ) bToBeCompressed = false; @@ -859,7 +859,7 @@ Any SAL_CALL ZipPackageStream::getPropertyValue( const OUString& PropertyName ) Any aAny; if ( PropertyName == "MediaType" ) { - aAny <<= sMediaType; + aAny <<= msMediaType; return aAny; } else if ( PropertyName == "Size" ) |