diff options
author | Olivier Hallot <olivier.hallot@documentfoundation.org> | 2012-01-01 19:03:17 -0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-01-02 19:17:17 +0100 |
commit | 829db12d7e3e93b4a44f79b39a0a9f0630439109 (patch) | |
tree | 8afe2c55ddb2846fc1e7a35c0212ca2304c6f3d5 /package | |
parent | Fix for fdo43460 Part XXV getLength() to isEmpty() (diff) | |
download | core-829db12d7e3e93b4a44f79b39a0a9f0630439109.tar.gz core-829db12d7e3e93b4a44f79b39a0a9f0630439109.zip |
Fix for fdo43460 Part XXVI getLength() to isEmpty()
Please find attached a partial fix for Easy Hack FDO43460
Part XXVI
Module
package
Diffstat (limited to 'package')
-rw-r--r-- | package/source/manifest/ManifestExport.cxx | 6 | ||||
-rw-r--r-- | package/source/xstor/ohierarchyholder.cxx | 2 | ||||
-rw-r--r-- | package/source/xstor/owriteablestream.cxx | 46 | ||||
-rw-r--r-- | package/source/xstor/xfactory.cxx | 4 | ||||
-rw-r--r-- | package/source/xstor/xstorage.cxx | 60 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackage.cxx | 10 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackageEntry.cxx | 6 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackageFolder.cxx | 8 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackageStream.cxx | 2 | ||||
-rw-r--r-- | package/source/zippackage/zipfileaccess.cxx | 8 |
10 files changed, 76 insertions, 76 deletions
diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx index a9e9f457705c..749050802276 100644 --- a/package/source/manifest/ManifestExport.cxx +++ b/package/source/manifest/ManifestExport.cxx @@ -127,7 +127,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > xHa pValue->Value >>= aVersion; } - if ( aPath.getLength() && aMediaType.getLength() && aVersion.getLength() ) + if ( !aPath.isEmpty() && !aMediaType.isEmpty() && !aVersion.isEmpty() ) break; } @@ -142,7 +142,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > xHa sal_Bool bProvideDTD = sal_False; sal_Bool bAcceptNonemptyVersion = sal_False; sal_Bool bStoreStartKeyGeneration = sal_False; - if ( aDocMediaType.getLength() ) + if ( !aDocMediaType.isEmpty() ) { if ( aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII ) ) ) || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII ) ) ) @@ -215,7 +215,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > xHa { pValue->Value >>= aString; // the version is stored only if it is not empty - if ( bAcceptNonemptyVersion && aString.getLength() ) + if ( bAcceptNonemptyVersion && !aString.isEmpty() ) pAttrList->AddAttribute ( sVersionAttribute, sCdataAttribute, aString ); } else if (pValue->Name.equals (sFullPathProperty) ) diff --git a/package/source/xstor/ohierarchyholder.cxx b/package/source/xstor/ohierarchyholder.cxx index 9ab6b157a603..c910e516de4c 100644 --- a/package/source/xstor/ohierarchyholder.cxx +++ b/package/source/xstor/ohierarchyholder.cxx @@ -72,7 +72,7 @@ OStringList_Impl OHierarchyHolder_Impl::GetListPathFromString( const ::rtl::OUSt do { ::rtl::OUString aName = aPath.getToken( 0, '/', nIndex ); - if ( !aName.getLength() ) + if ( aName.isEmpty() ) throw lang::IllegalArgumentException(); aResult.push_back( aName ); diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index b7de9dfb876b..dd0229341aca 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -266,7 +266,7 @@ const sal_Int32 n_ConstBufferSize = 32000; ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception") ) ); } - if ( !aTempURL.getLength() ) + if ( aTempURL.isEmpty() ) throw uno::RuntimeException(); // TODO: can not create tempfile return aTempURL; @@ -323,7 +323,7 @@ OWriteStream_Impl::~OWriteStream_Impl() { DisposeWrappers(); - if ( m_aTempURL.getLength() ) + if ( !m_aTempURL.isEmpty() ) { KillFile( m_aTempURL, GetServiceFactory() ); m_aTempURL = ::rtl::OUString(); @@ -411,7 +411,7 @@ sal_Bool OWriteStream_Impl::IsEncrypted() if ( m_bForceEncrypted || m_bHasCachedEncryptionData ) return sal_True; - if ( m_aTempURL.getLength() || m_xCacheStream.is() ) + if ( !m_aTempURL.isEmpty() || m_xCacheStream.is() ) return sal_False; GetStreamProperties(); @@ -568,7 +568,7 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor ::rtl::OUString aTempURL = GetNewTempFileURL( GetServiceFactory() ); try { - if ( aTempURL.getLength() && xStream.is() ) + if ( !aTempURL.isEmpty() && xStream.is() ) { uno::Reference < ucb::XSimpleFileAccess > xTempAccess( GetServiceFactory()->createInstance ( @@ -607,7 +607,7 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor throw; } - if ( aTempURL.getLength() ) + if ( !aTempURL.isEmpty() ) CleanCacheStream(); m_aTempURL = aTempURL; @@ -620,7 +620,7 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor ::rtl::OUString OWriteStream_Impl::FillTempGetFileName() { // should try to create cache first, if the amount of contents is too big, the temp file should be taken - if ( !m_xCacheStream.is() && !m_aTempURL.getLength() ) + if ( !m_xCacheStream.is() && m_aTempURL.isEmpty() ) { uno::Reference< io::XInputStream > xOrigStream = m_xPackageStream->getDataStream(); if ( !xOrigStream.is() ) @@ -653,12 +653,12 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor m_xCacheStream = xCacheStream; m_xCacheSeek->seek( 0 ); } - else if ( !m_aTempURL.getLength() ) + else if ( m_aTempURL.isEmpty() ) { m_aTempURL = GetNewTempFileURL( GetServiceFactory() ); try { - if ( m_aTempURL.getLength() ) + if ( !m_aTempURL.isEmpty() ) { uno::Reference < ucb::XSimpleFileAccess > xTempAccess( GetServiceFactory()->createInstance ( @@ -710,10 +710,10 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetTempFileAsStream() if ( !m_xCacheStream.is() ) { - if ( !m_aTempURL.getLength() ) + if ( m_aTempURL.isEmpty() ) m_aTempURL = FillTempGetFileName(); - if ( m_aTempURL.getLength() ) + if ( !m_aTempURL.isEmpty() ) { // the temporary file is not used if the cache is used uno::Reference < ucb::XSimpleFileAccess > xTempAccess( @@ -755,10 +755,10 @@ uno::Reference< io::XInputStream > OWriteStream_Impl::GetTempFileAsInputStream() if ( !m_xCacheStream.is() ) { - if ( !m_aTempURL.getLength() ) + if ( m_aTempURL.isEmpty() ) m_aTempURL = FillTempGetFileName(); - if ( m_aTempURL.getLength() ) + if ( !m_aTempURL.isEmpty() ) { // the temporary file is not used if the cache is used uno::Reference < ucb::XSimpleFileAccess > xTempAccess( @@ -810,7 +810,7 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt if ( m_bHasDataToFlush ) throw io::IOException(); - OSL_ENSURE( !m_aTempURL.getLength() && !m_xCacheStream.is(), "The temporary must not exist!\n" ); + OSL_ENSURE( m_aTempURL.isEmpty() && !m_xCacheStream.is(), "The temporary must not exist!\n" ); // use new file as current persistent representation // the new file will be removed after it's stream is closed @@ -912,7 +912,7 @@ void OWriteStream_Impl::Commit() m_xCacheSeek = uno::Reference< io::XSeekable >(); } - else if ( m_aTempURL.getLength() ) + else if ( !m_aTempURL.isEmpty() ) { if ( m_pAntiImpl ) m_pAntiImpl->DeInit(); @@ -999,7 +999,7 @@ void OWriteStream_Impl::Revert() if ( !m_bHasDataToFlush ) return; // nothing to do - OSL_ENSURE( m_aTempURL.getLength() || m_xCacheStream.is(), "The temporary must exist!\n" ); + OSL_ENSURE( !m_aTempURL.isEmpty() || m_xCacheStream.is(), "The temporary must exist!\n" ); if ( m_xCacheStream.is() ) { @@ -1007,7 +1007,7 @@ void OWriteStream_Impl::Revert() m_xCacheSeek = uno::Reference< io::XSeekable >(); } - if ( m_aTempURL.getLength() ) + if ( !m_aTempURL.isEmpty() ) { KillFile( m_aTempURL, GetServiceFactory() ); m_aTempURL = ::rtl::OUString(); @@ -1391,7 +1391,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre if ( ( nStreamMode & embed::ElementModes::READWRITE ) == embed::ElementModes::READ ) { uno::Reference< io::XInputStream > xInStream; - if ( m_xCacheStream.is() || m_aTempURL.getLength() ) + if ( m_xCacheStream.is() || !m_aTempURL.isEmpty() ) xInStream = GetTempFileAsInputStream(); //TODO: else xInStream = m_xPackageStream->getDataStream(); @@ -1412,7 +1412,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre } else if ( ( nStreamMode & embed::ElementModes::READWRITE ) == embed::ElementModes::SEEKABLEREAD ) { - if ( !m_xCacheStream.is() && !m_aTempURL.getLength() && !( m_xPackageStream->getDataStream().is() ) ) + if ( !m_xCacheStream.is() && m_aTempURL.isEmpty() && !( m_xPackageStream->getDataStream().is() ) ) { // The stream does not exist in the storage throw io::IOException(); @@ -1443,7 +1443,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre uno::Reference< io::XStream > xStream; if ( ( nStreamMode & embed::ElementModes::TRUNCATE ) == embed::ElementModes::TRUNCATE ) { - if ( m_aTempURL.getLength() ) + if ( !m_aTempURL.isEmpty() ) { KillFile( m_aTempURL, GetServiceFactory() ); m_aTempURL = ::rtl::OUString(); @@ -1463,7 +1463,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre } else if ( !m_bHasInsertedStreamOptimization ) { - if ( !m_aTempURL.getLength() && !m_xCacheStream.is() && !( m_xPackageStream->getDataStream().is() ) ) + if ( m_aTempURL.isEmpty() && !m_xCacheStream.is() && !( m_xPackageStream->getDataStream().is() ) ) { // The stream does not exist in the storage m_bHasDataToFlush = sal_True; @@ -1698,10 +1698,10 @@ void OWriteStream_Impl::CommitStreamRelInfo( const uno::Reference< embed::XStora if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { - OSL_ENSURE( aOrigStreamName.getLength() && aNewStreamName.getLength() && xRelStorage.is(), + OSL_ENSURE( !aOrigStreamName.isEmpty() && !aNewStreamName.isEmpty() && xRelStorage.is(), "Wrong relation persistence information is provided!\n" ); - if ( !xRelStorage.is() || !aOrigStreamName.getLength() || !aNewStreamName.getLength() ) + if ( !xRelStorage.is() || aOrigStreamName.isEmpty() || aNewStreamName.isEmpty() ) throw uno::RuntimeException(); if ( m_nRelInfoStatus == RELINFO_BROKEN || m_nRelInfoStatus == RELINFO_CHANGED_BROKEN ) @@ -2370,7 +2370,7 @@ void SAL_CALL OWriteStream::writeBytes( const uno::Sequence< sal_Int8 >& aData ) m_xSeekable->seek( 0 ); // it is enough to copy the cached stream, the cache should already contain everything - if ( m_pImpl->GetFilledTempFileIfNo( m_xInStream ).getLength() ) + if ( !m_pImpl->GetFilledTempFileIfNo( m_xInStream ).isEmpty() ) { DeInit(); // the last position is known and it is differs from the current stream position diff --git a/package/source/xstor/xfactory.cxx b/package/source/xstor/xfactory.cxx index 1a0938c458c5..3602ab0ec925 100644 --- a/package/source/xstor/xfactory.cxx +++ b/package/source/xstor/xfactory.cxx @@ -150,7 +150,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr if ( aArguments[0] >>= aURL ) { - if ( !aURL.getLength() ) + if ( aURL.isEmpty() ) { OSL_FAIL( "Empty URL is provided!\n" ); throw lang::IllegalArgumentException(); // TODO: @@ -191,7 +191,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr { if( aArguments[2] >>= aDescr ) { - if ( aURL.getLength() ) + if ( !aURL.isEmpty() ) { aPropsToSet.realloc(1); aPropsToSet[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL") ); diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index f5a3fdbd6cb9..3845d9c61820 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -659,7 +659,7 @@ void OStorage_Impl::ReadContents() } ::rtl::OUString aName = xNamed->getName(); - OSL_ENSURE( aName.getLength(), "Empty name!\n" ); + OSL_ENSURE( !aName.isEmpty(), "Empty name!\n" ); uno::Reference< container::XNameContainer > xNameContainer( xNamed, uno::UNO_QUERY ); @@ -802,7 +802,7 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, sal_Bool bDirect ) { OSL_ENSURE( xDest.is(), "No destination storage!\n" ); - OSL_ENSURE( aName.getLength(), "Empty element name!\n" ); + OSL_ENSURE( !aName.isEmpty(), "Empty element name!\n" ); ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); @@ -1398,7 +1398,7 @@ void OStorage_Impl::Revert() //----------------------------------------------- SotElement_Impl* OStorage_Impl::FindElement( const ::rtl::OUString& rName ) { - OSL_ENSURE( rName.getLength(), "Name is empty!" ); + OSL_ENSURE( !rName.isEmpty(), "Name is empty!" ); ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); @@ -1786,7 +1786,7 @@ void OStorage_Impl::CommitStreamRelInfo( SotElement_Impl* pStreamElement ) if ( m_nStorageType == embed::StorageFormats::OFOPXML && pStreamElement->m_pStream ) { - OSL_ENSURE( pStreamElement->m_aName.getLength(), "The name must not be empty!\n" ); + OSL_ENSURE( !pStreamElement->m_aName.isEmpty(), "The name must not be empty!\n" ); if ( !m_xRelStorage.is() ) { @@ -2494,7 +2494,7 @@ uno::Reference< io::XStream > SAL_CALL OStorage::openStreamElement( throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( !aStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, sal_False ) ) + if ( aStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML @@ -2612,7 +2612,7 @@ uno::Reference< embed::XStorage > SAL_CALL OStorage::openStorageElement( throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( !aStorName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStorName, sal_False ) ) + if ( aStorName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStorName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML @@ -2767,7 +2767,7 @@ uno::Reference< io::XStream > SAL_CALL OStorage::cloneStreamElement( const ::rtl throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( !aStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, sal_False ) ) + if ( aStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML @@ -2933,7 +2933,7 @@ void SAL_CALL OStorage::copyStorageElementLastCommitTo( throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( !aStorName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStorName, sal_False ) ) + if ( aStorName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStorName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML @@ -3027,7 +3027,7 @@ sal_Bool SAL_CALL OStorage::isStreamElement( const ::rtl::OUString& aElementName throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( !aElementName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) ) + if ( aElementName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML @@ -3096,7 +3096,7 @@ sal_Bool SAL_CALL OStorage::isStorageElement( const ::rtl::OUString& aElementNam throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( !aElementName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) ) + if ( aElementName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML @@ -3169,7 +3169,7 @@ void SAL_CALL OStorage::removeElement( const ::rtl::OUString& aElementName ) throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( !aElementName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) ) + if ( aElementName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML @@ -3263,8 +3263,8 @@ void SAL_CALL OStorage::renameElement( const ::rtl::OUString& aElementName, cons throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( !aElementName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) - || !aNewName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aNewName, sal_False ) ) + if ( aElementName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) + || aNewName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aNewName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML @@ -3370,8 +3370,8 @@ void SAL_CALL OStorage::copyElementTo( const ::rtl::OUString& aElementName, throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( !aElementName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) - || !aNewName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aNewName, sal_False ) ) + if ( aElementName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) + || aNewName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aNewName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( !xDest.is() ) @@ -3475,8 +3475,8 @@ void SAL_CALL OStorage::moveElementTo( const ::rtl::OUString& aElementName, throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( !aElementName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) - || !aNewName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aNewName, sal_False ) ) + if ( aElementName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) + || aNewName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aNewName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( !xDest.is() || xDest == uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ) ) @@ -3799,7 +3799,7 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getPlainRawStreamElement( if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // the interface is not supported and must not be accessible - if ( !sStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( sStreamName, sal_False ) ) + if ( sStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( sStreamName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); uno::Reference < io::XInputStream > xTempIn; @@ -3909,7 +3909,7 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getRawEncrStreamElement( if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE ) throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - if ( !sStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( sStreamName, sal_False ) ) + if ( sStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( sStreamName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); uno::Reference < io::XInputStream > xTempIn; @@ -4029,7 +4029,7 @@ void SAL_CALL OStorage::insertRawEncrStreamElement( const ::rtl::OUString& aStre if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE ) throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - if ( !aStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, sal_False ) ) + if ( aStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( !xInStream.is() ) @@ -4384,7 +4384,7 @@ uno::Any SAL_CALL OStorage::getByName( const ::rtl::OUString& aName ) throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( !aName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aName, sal_False ) ) + if ( aName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML @@ -4489,7 +4489,7 @@ sal_Bool SAL_CALL OStorage::hasByName( const ::rtl::OUString& aName ) throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( !aName.getLength() ) + if ( aName.isEmpty() ) return sal_False; if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML @@ -5704,7 +5704,7 @@ void SAL_CALL OStorage::insertStreamElementDirect( throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( !aStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, sal_False ) ) + if ( aStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML @@ -5797,8 +5797,8 @@ void SAL_CALL OStorage::copyElementDirectlyTo( throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( !aElementName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) - || !aNewName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aNewName, sal_False ) ) + if ( aElementName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) + || aNewName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aNewName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( !xDest.is() || xDest == uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ) ) @@ -6057,7 +6057,7 @@ uno::Any SAL_CALL OStorage::getElementPropertyValue( const ::rtl::OUString& aEle throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( !aElementName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) ) + if ( aElementName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML @@ -6160,7 +6160,7 @@ void SAL_CALL OStorage::copyStreamElementData( const ::rtl::OUString& aStreamNam throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( !aStreamName.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, sal_False ) ) + if ( aStreamName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamName, sal_False ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML @@ -6250,7 +6250,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openStreamEle throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( !aStreamPath.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamPath, sal_True ) ) + if ( aStreamPath.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamPath, sal_True ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) @@ -6322,7 +6322,7 @@ void SAL_CALL OStorage::removeStreamElementByHierarchicalName( const ::rtl::OUSt throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - if ( !aStreamPath.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamPath, sal_True ) ) + if ( aStreamPath.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamPath, sal_True ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) ) @@ -6362,7 +6362,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE ) throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - if ( !aStreamPath.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamPath, sal_True ) ) + if ( aStreamPath.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamPath, sal_True ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); if ( !aEncryptionData.getLength() ) diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index c07e7a142992..776ccbccdfb9 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -135,7 +135,7 @@ sal_Bool isLocalFile_Impl( ::rtl::OUString aURL ) } } - return ( aSystemPath.getLength() != 0 ); + return ( !aSystemPath.isEmpty() ); } } @@ -292,7 +292,7 @@ void ZipPackage::parseManifest() pDerivedKeySize = &( pValue[j].Value ); } - if ( sPath.getLength() && hasByHierarchicalName ( sPath ) ) + if ( !sPath.isEmpty() && hasByHierarchicalName ( sPath ) ) { aAny = getByHierarchicalName( sPath ); uno::Reference < XUnoTunnel > xUnoTunnel; @@ -505,7 +505,7 @@ void ZipPackage::parseContentType() else aPath = aContentTypeInfo[1][nInd].First; - if ( aPath.getLength() && hasByHierarchicalName( aPath ) ) + if ( !aPath.isEmpty() && hasByHierarchicalName( aPath ) ) { uno::Any aIterAny = getByHierarchicalName( aPath ); uno::Reference < lang::XUnoTunnel > xIterTunnel; @@ -583,7 +583,7 @@ void ZipPackage::getZipFileContents() pCurrent = pCurrent->doGetByName( sTemp ).pFolder; nOldIndex = nIndex+1; } - if ( nStreamIndex != -1 && sDirName.getLength() ) + if ( nStreamIndex != -1 && !sDirName.isEmpty() ) m_aRecent [ sDirName ] = pCurrent; } if ( rName.getLength() -1 != nStreamIndex ) @@ -1112,7 +1112,7 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< uno: OSL_ENSURE( ( *aIter )[PKG_MNFST_MEDIATYPE].Name.equals( sMediaType ) && ( *aIter )[PKG_MNFST_FULLPATH].Name.equals( sFullPath ), "The mediatype sequence format is wrong!\n" ); ( *aIter )[PKG_MNFST_MEDIATYPE].Value >>= aType; - if ( aType.getLength() ) + if ( !aType.isEmpty() ) { // only nonempty type makes sence here nSeqLength++; diff --git a/package/source/zippackage/ZipPackageEntry.cxx b/package/source/zippackage/ZipPackageEntry.cxx index 9a0e62c48515..1740f2e7472b 100644 --- a/package/source/zippackage/ZipPackageEntry.cxx +++ b/package/source/zippackage/ZipPackageEntry.cxx @@ -67,7 +67,7 @@ OUString SAL_CALL ZipPackageEntry::getName( ) void SAL_CALL ZipPackageEntry::setName( const OUString& aName ) throw(RuntimeException) { - if ( pParent && msName.getLength() && pParent->hasByName ( msName ) ) + if ( pParent && !msName.isEmpty() && pParent->hasByName ( msName ) ) pParent->removeByName ( msName ); // unfortunately no other exception than RuntimeException can be thrown here @@ -91,7 +91,7 @@ void ZipPackageEntry::doSetParent ( ZipPackageFolder * pNewParent, sal_Bool bIns { // xParent = pParent = pNewParent; pParent = pNewParent; - if ( bInsert && msName.getLength() && !pNewParent->hasByName ( msName ) ) + if ( bInsert && !msName.isEmpty() && !pNewParent->hasByName ( msName ) ) pNewParent->doInsertByName ( this, sal_False ); } @@ -107,7 +107,7 @@ void SAL_CALL ZipPackageEntry::setParent( const uno::Reference< XInterface >& xN if ( pNewParent != pParent ) { - if ( pParent && msName.getLength() && pParent->hasByName ( msName ) && mbAllowRemoveOnInsert ) + if ( pParent && !msName.isEmpty() && pParent->hasByName ( msName ) && mbAllowRemoveOnInsert ) pParent->removeByName( msName ); doSetParent ( pNewParent, sal_True ); } diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx index daee0f4fd0e1..48c51b42d364 100644 --- a/package/source/zippackage/ZipPackageFolder.cxx +++ b/package/source/zippackage/ZipPackageFolder.cxx @@ -129,7 +129,7 @@ sal_Bool ZipPackageFolder::LookForUnexpectedODF12Streams( const ::rtl::OUString& { // the stream is not in META-INF and ist notregistered in manifest.xml, // check whether it is an internal part of the package format - if ( aPath.getLength() + if ( !aPath.isEmpty() || !rShortName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "mimetype" ) ) ) ) { // if it is not "mimetype" from the root it is not a part of the package @@ -326,7 +326,7 @@ bool ZipPackageFolder::saveChild( const ::rtl::OUString &rShortName, const Conte { ::rtl::OUString sTempName = rPath + rShortName + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) ); - if ( rInfo.pFolder->GetMediaType().getLength() ) + if ( !rInfo.pFolder->GetMediaType().isEmpty() ) { aPropSet[PKG_MNFST_MEDIATYPE].Name = sMediaTypeProperty; aPropSet[PKG_MNFST_MEDIATYPE].Value <<= rInfo.pFolder->GetMediaType(); @@ -688,7 +688,7 @@ void ZipPackageFolder::saveContents( ::rtl::OUString &rPath, std::vector < uno:: { bool bWritingFailed = false; - if ( maContents.begin() == maContents.end() && rPath.getLength() && m_nFormat != embed::StorageFormats::OFOPXML ) + if ( maContents.begin() == maContents.end() && !rPath.isEmpty() && m_nFormat != embed::StorageFormats::OFOPXML ) { // it is an empty subfolder, use workaround to store it ZipEntry* pTempEntry = new ZipEntry(); @@ -714,7 +714,7 @@ void ZipPackageFolder::saveContents( ::rtl::OUString &rPath, std::vector < uno:: bool bMimeTypeStreamStored = false; ::rtl::OUString aMimeTypeStreamName( RTL_CONSTASCII_USTRINGPARAM( "mimetype" ) ); - if ( m_nFormat == embed::StorageFormats::ZIP && !rPath.getLength() ) + 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 ); diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index c2016420de07..b3db1c609436 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -721,7 +721,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, if ( aValue >>= sMediaType ) { - if ( sMediaType.getLength() > 0 ) + if ( !sMediaType.isEmpty() ) { if ( sMediaType.indexOf ( OUString( RTL_CONSTASCII_USTRINGPARAM ( "text" ) ) ) != -1 || sMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM ( "application/vnd.sun.star.oleobject" ) ) ) ) diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx index 35a0bb621b07..af6ba188057b 100644 --- a/package/source/zippackage/zipfileaccess.cxx +++ b/package/source/zippackage/zipfileaccess.cxx @@ -77,7 +77,7 @@ OZipFileAccess::~OZipFileAccess() // ---------------------------------------------------------------- uno::Sequence< ::rtl::OUString > OZipFileAccess::GetPatternsFromString_Impl( const ::rtl::OUString& aString ) { - if ( !aString.getLength() ) + if ( aString.isEmpty() ) return uno::Sequence< ::rtl::OUString >(); uno::Sequence< ::rtl::OUString > aPattern( 1 ); @@ -131,7 +131,7 @@ sal_Bool OZipFileAccess::StringGoodForPattern_Impl( const ::rtl::OUString& aStri if ( nInd == 0 ) { - if ( !aPattern[0].getLength() ) + if ( aPattern[0].isEmpty() ) return sal_True; return aString.equals( aPattern[0] ); @@ -145,7 +145,7 @@ sal_Bool OZipFileAccess::StringGoodForPattern_Impl( const ::rtl::OUString& aStri { for ( sal_Int32 nCurInd = aPattern.getLength() - 2; nCurInd > 0; nCurInd-- ) { - if ( !aPattern[nCurInd].getLength() ) + if ( aPattern[nCurInd].isEmpty() ) continue; if ( nEndInd == nBeginInd ) @@ -186,7 +186,7 @@ void SAL_CALL OZipFileAccess::initialize( const uno::Sequence< uno::Any >& aArgu if ( !aArguments.getLength() ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); - OSL_ENSURE( aArguments.getLength() == 1, "Too meny arguments are provided, only the first one will be used!\n" ); + OSL_ENSURE( aArguments.getLength() == 1, "Too many arguments are provided, only the first one will be used!\n" ); ::rtl::OUString aParamURL; uno::Reference< io::XStream > xStream; |