Kaydet (Commit) 829db12d authored tarafından Olivier Hallot's avatar Olivier Hallot Kaydeden (comit) Luboš Luňák

Fix for fdo43460 Part XXVI getLength() to isEmpty()

Please find attached a partial fix for Easy Hack FDO43460

Part XXVI
Module
package
üst 6af59644
...@@ -127,7 +127,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > xHa ...@@ -127,7 +127,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > xHa
pValue->Value >>= aVersion; pValue->Value >>= aVersion;
} }
if ( aPath.getLength() && aMediaType.getLength() && aVersion.getLength() ) if ( !aPath.isEmpty() && !aMediaType.isEmpty() && !aVersion.isEmpty() )
break; break;
} }
...@@ -142,7 +142,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > xHa ...@@ -142,7 +142,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > xHa
sal_Bool bProvideDTD = sal_False; sal_Bool bProvideDTD = sal_False;
sal_Bool bAcceptNonemptyVersion = sal_False; sal_Bool bAcceptNonemptyVersion = sal_False;
sal_Bool bStoreStartKeyGeneration = 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 ) ) ) 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 ) ) ) || 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 ...@@ -215,7 +215,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > xHa
{ {
pValue->Value >>= aString; pValue->Value >>= aString;
// the version is stored only if it is not empty // the version is stored only if it is not empty
if ( bAcceptNonemptyVersion && aString.getLength() ) if ( bAcceptNonemptyVersion && !aString.isEmpty() )
pAttrList->AddAttribute ( sVersionAttribute, sCdataAttribute, aString ); pAttrList->AddAttribute ( sVersionAttribute, sCdataAttribute, aString );
} }
else if (pValue->Name.equals (sFullPathProperty) ) else if (pValue->Name.equals (sFullPathProperty) )
......
...@@ -72,7 +72,7 @@ OStringList_Impl OHierarchyHolder_Impl::GetListPathFromString( const ::rtl::OUSt ...@@ -72,7 +72,7 @@ OStringList_Impl OHierarchyHolder_Impl::GetListPathFromString( const ::rtl::OUSt
do do
{ {
::rtl::OUString aName = aPath.getToken( 0, '/', nIndex ); ::rtl::OUString aName = aPath.getToken( 0, '/', nIndex );
if ( !aName.getLength() ) if ( aName.isEmpty() )
throw lang::IllegalArgumentException(); throw lang::IllegalArgumentException();
aResult.push_back( aName ); aResult.push_back( aName );
......
...@@ -266,7 +266,7 @@ const sal_Int32 n_ConstBufferSize = 32000; ...@@ -266,7 +266,7 @@ const sal_Int32 n_ConstBufferSize = 32000;
::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception") ) ); ::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 throw uno::RuntimeException(); // TODO: can not create tempfile
return aTempURL; return aTempURL;
...@@ -323,7 +323,7 @@ OWriteStream_Impl::~OWriteStream_Impl() ...@@ -323,7 +323,7 @@ OWriteStream_Impl::~OWriteStream_Impl()
{ {
DisposeWrappers(); DisposeWrappers();
if ( m_aTempURL.getLength() ) if ( !m_aTempURL.isEmpty() )
{ {
KillFile( m_aTempURL, GetServiceFactory() ); KillFile( m_aTempURL, GetServiceFactory() );
m_aTempURL = ::rtl::OUString(); m_aTempURL = ::rtl::OUString();
...@@ -411,7 +411,7 @@ sal_Bool OWriteStream_Impl::IsEncrypted() ...@@ -411,7 +411,7 @@ sal_Bool OWriteStream_Impl::IsEncrypted()
if ( m_bForceEncrypted || m_bHasCachedEncryptionData ) if ( m_bForceEncrypted || m_bHasCachedEncryptionData )
return sal_True; return sal_True;
if ( m_aTempURL.getLength() || m_xCacheStream.is() ) if ( !m_aTempURL.isEmpty() || m_xCacheStream.is() )
return sal_False; return sal_False;
GetStreamProperties(); GetStreamProperties();
...@@ -568,7 +568,7 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor ...@@ -568,7 +568,7 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor
::rtl::OUString aTempURL = GetNewTempFileURL( GetServiceFactory() ); ::rtl::OUString aTempURL = GetNewTempFileURL( GetServiceFactory() );
try { try {
if ( aTempURL.getLength() && xStream.is() ) if ( !aTempURL.isEmpty() && xStream.is() )
{ {
uno::Reference < ucb::XSimpleFileAccess > xTempAccess( uno::Reference < ucb::XSimpleFileAccess > xTempAccess(
GetServiceFactory()->createInstance ( GetServiceFactory()->createInstance (
...@@ -607,7 +607,7 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor ...@@ -607,7 +607,7 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor
throw; throw;
} }
if ( aTempURL.getLength() ) if ( !aTempURL.isEmpty() )
CleanCacheStream(); CleanCacheStream();
m_aTempURL = aTempURL; m_aTempURL = aTempURL;
...@@ -620,7 +620,7 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor ...@@ -620,7 +620,7 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor
::rtl::OUString OWriteStream_Impl::FillTempGetFileName() ::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 // 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(); uno::Reference< io::XInputStream > xOrigStream = m_xPackageStream->getDataStream();
if ( !xOrigStream.is() ) if ( !xOrigStream.is() )
...@@ -653,12 +653,12 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor ...@@ -653,12 +653,12 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor
m_xCacheStream = xCacheStream; m_xCacheStream = xCacheStream;
m_xCacheSeek->seek( 0 ); m_xCacheSeek->seek( 0 );
} }
else if ( !m_aTempURL.getLength() ) else if ( m_aTempURL.isEmpty() )
{ {
m_aTempURL = GetNewTempFileURL( GetServiceFactory() ); m_aTempURL = GetNewTempFileURL( GetServiceFactory() );
try { try {
if ( m_aTempURL.getLength() ) if ( !m_aTempURL.isEmpty() )
{ {
uno::Reference < ucb::XSimpleFileAccess > xTempAccess( uno::Reference < ucb::XSimpleFileAccess > xTempAccess(
GetServiceFactory()->createInstance ( GetServiceFactory()->createInstance (
...@@ -710,10 +710,10 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetTempFileAsStream() ...@@ -710,10 +710,10 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetTempFileAsStream()
if ( !m_xCacheStream.is() ) if ( !m_xCacheStream.is() )
{ {
if ( !m_aTempURL.getLength() ) if ( m_aTempURL.isEmpty() )
m_aTempURL = FillTempGetFileName(); m_aTempURL = FillTempGetFileName();
if ( m_aTempURL.getLength() ) if ( !m_aTempURL.isEmpty() )
{ {
// the temporary file is not used if the cache is used // the temporary file is not used if the cache is used
uno::Reference < ucb::XSimpleFileAccess > xTempAccess( uno::Reference < ucb::XSimpleFileAccess > xTempAccess(
...@@ -755,10 +755,10 @@ uno::Reference< io::XInputStream > OWriteStream_Impl::GetTempFileAsInputStream() ...@@ -755,10 +755,10 @@ uno::Reference< io::XInputStream > OWriteStream_Impl::GetTempFileAsInputStream()
if ( !m_xCacheStream.is() ) if ( !m_xCacheStream.is() )
{ {
if ( !m_aTempURL.getLength() ) if ( m_aTempURL.isEmpty() )
m_aTempURL = FillTempGetFileName(); m_aTempURL = FillTempGetFileName();
if ( m_aTempURL.getLength() ) if ( !m_aTempURL.isEmpty() )
{ {
// the temporary file is not used if the cache is used // the temporary file is not used if the cache is used
uno::Reference < ucb::XSimpleFileAccess > xTempAccess( uno::Reference < ucb::XSimpleFileAccess > xTempAccess(
...@@ -810,7 +810,7 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt ...@@ -810,7 +810,7 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt
if ( m_bHasDataToFlush ) if ( m_bHasDataToFlush )
throw io::IOException(); 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 // use new file as current persistent representation
// the new file will be removed after it's stream is closed // the new file will be removed after it's stream is closed
...@@ -912,7 +912,7 @@ void OWriteStream_Impl::Commit() ...@@ -912,7 +912,7 @@ void OWriteStream_Impl::Commit()
m_xCacheSeek = uno::Reference< io::XSeekable >(); m_xCacheSeek = uno::Reference< io::XSeekable >();
} }
else if ( m_aTempURL.getLength() ) else if ( !m_aTempURL.isEmpty() )
{ {
if ( m_pAntiImpl ) if ( m_pAntiImpl )
m_pAntiImpl->DeInit(); m_pAntiImpl->DeInit();
...@@ -999,7 +999,7 @@ void OWriteStream_Impl::Revert() ...@@ -999,7 +999,7 @@ void OWriteStream_Impl::Revert()
if ( !m_bHasDataToFlush ) if ( !m_bHasDataToFlush )
return; // nothing to do 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() ) if ( m_xCacheStream.is() )
{ {
...@@ -1007,7 +1007,7 @@ void OWriteStream_Impl::Revert() ...@@ -1007,7 +1007,7 @@ void OWriteStream_Impl::Revert()
m_xCacheSeek = uno::Reference< io::XSeekable >(); m_xCacheSeek = uno::Reference< io::XSeekable >();
} }
if ( m_aTempURL.getLength() ) if ( !m_aTempURL.isEmpty() )
{ {
KillFile( m_aTempURL, GetServiceFactory() ); KillFile( m_aTempURL, GetServiceFactory() );
m_aTempURL = ::rtl::OUString(); m_aTempURL = ::rtl::OUString();
...@@ -1391,7 +1391,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre ...@@ -1391,7 +1391,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre
if ( ( nStreamMode & embed::ElementModes::READWRITE ) == embed::ElementModes::READ ) if ( ( nStreamMode & embed::ElementModes::READWRITE ) == embed::ElementModes::READ )
{ {
uno::Reference< io::XInputStream > xInStream; uno::Reference< io::XInputStream > xInStream;
if ( m_xCacheStream.is() || m_aTempURL.getLength() ) if ( m_xCacheStream.is() || !m_aTempURL.isEmpty() )
xInStream = GetTempFileAsInputStream(); //TODO: xInStream = GetTempFileAsInputStream(); //TODO:
else else
xInStream = m_xPackageStream->getDataStream(); xInStream = m_xPackageStream->getDataStream();
...@@ -1412,7 +1412,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre ...@@ -1412,7 +1412,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre
} }
else if ( ( nStreamMode & embed::ElementModes::READWRITE ) == embed::ElementModes::SEEKABLEREAD ) 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 // The stream does not exist in the storage
throw io::IOException(); throw io::IOException();
...@@ -1443,7 +1443,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre ...@@ -1443,7 +1443,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre
uno::Reference< io::XStream > xStream; uno::Reference< io::XStream > xStream;
if ( ( nStreamMode & embed::ElementModes::TRUNCATE ) == embed::ElementModes::TRUNCATE ) if ( ( nStreamMode & embed::ElementModes::TRUNCATE ) == embed::ElementModes::TRUNCATE )
{ {
if ( m_aTempURL.getLength() ) if ( !m_aTempURL.isEmpty() )
{ {
KillFile( m_aTempURL, GetServiceFactory() ); KillFile( m_aTempURL, GetServiceFactory() );
m_aTempURL = ::rtl::OUString(); m_aTempURL = ::rtl::OUString();
...@@ -1463,7 +1463,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre ...@@ -1463,7 +1463,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre
} }
else if ( !m_bHasInsertedStreamOptimization ) 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 // The stream does not exist in the storage
m_bHasDataToFlush = sal_True; m_bHasDataToFlush = sal_True;
...@@ -1698,10 +1698,10 @@ void OWriteStream_Impl::CommitStreamRelInfo( const uno::Reference< embed::XStora ...@@ -1698,10 +1698,10 @@ void OWriteStream_Impl::CommitStreamRelInfo( const uno::Reference< embed::XStora
if ( m_nStorageType == embed::StorageFormats::OFOPXML ) 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" ); "Wrong relation persistence information is provided!\n" );
if ( !xRelStorage.is() || !aOrigStreamName.getLength() || !aNewStreamName.getLength() ) if ( !xRelStorage.is() || aOrigStreamName.isEmpty() || aNewStreamName.isEmpty() )
throw uno::RuntimeException(); throw uno::RuntimeException();
if ( m_nRelInfoStatus == RELINFO_BROKEN || m_nRelInfoStatus == RELINFO_CHANGED_BROKEN ) 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 ) ...@@ -2370,7 +2370,7 @@ void SAL_CALL OWriteStream::writeBytes( const uno::Sequence< sal_Int8 >& aData )
m_xSeekable->seek( 0 ); m_xSeekable->seek( 0 );
// it is enough to copy the cached stream, the cache should already contain everything // 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(); DeInit();
// the last position is known and it is differs from the current stream position // the last position is known and it is differs from the current stream position
......
...@@ -150,7 +150,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr ...@@ -150,7 +150,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr
if ( aArguments[0] >>= aURL ) if ( aArguments[0] >>= aURL )
{ {
if ( !aURL.getLength() ) if ( aURL.isEmpty() )
{ {
OSL_FAIL( "Empty URL is provided!\n" ); OSL_FAIL( "Empty URL is provided!\n" );
throw lang::IllegalArgumentException(); // TODO: throw lang::IllegalArgumentException(); // TODO:
...@@ -191,7 +191,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr ...@@ -191,7 +191,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr
{ {
if( aArguments[2] >>= aDescr ) if( aArguments[2] >>= aDescr )
{ {
if ( aURL.getLength() ) if ( !aURL.isEmpty() )
{ {
aPropsToSet.realloc(1); aPropsToSet.realloc(1);
aPropsToSet[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL") ); aPropsToSet[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL") );
......
...@@ -135,7 +135,7 @@ sal_Bool isLocalFile_Impl( ::rtl::OUString aURL ) ...@@ -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() ...@@ -292,7 +292,7 @@ void ZipPackage::parseManifest()
pDerivedKeySize = &( pValue[j].Value ); pDerivedKeySize = &( pValue[j].Value );
} }
if ( sPath.getLength() && hasByHierarchicalName ( sPath ) ) if ( !sPath.isEmpty() && hasByHierarchicalName ( sPath ) )
{ {
aAny = getByHierarchicalName( sPath ); aAny = getByHierarchicalName( sPath );
uno::Reference < XUnoTunnel > xUnoTunnel; uno::Reference < XUnoTunnel > xUnoTunnel;
...@@ -505,7 +505,7 @@ void ZipPackage::parseContentType() ...@@ -505,7 +505,7 @@ void ZipPackage::parseContentType()
else else
aPath = aContentTypeInfo[1][nInd].First; aPath = aContentTypeInfo[1][nInd].First;
if ( aPath.getLength() && hasByHierarchicalName( aPath ) ) if ( !aPath.isEmpty() && hasByHierarchicalName( aPath ) )
{ {
uno::Any aIterAny = getByHierarchicalName( aPath ); uno::Any aIterAny = getByHierarchicalName( aPath );
uno::Reference < lang::XUnoTunnel > xIterTunnel; uno::Reference < lang::XUnoTunnel > xIterTunnel;
...@@ -583,7 +583,7 @@ void ZipPackage::getZipFileContents() ...@@ -583,7 +583,7 @@ void ZipPackage::getZipFileContents()
pCurrent = pCurrent->doGetByName( sTemp ).pFolder; pCurrent = pCurrent->doGetByName( sTemp ).pFolder;
nOldIndex = nIndex+1; nOldIndex = nIndex+1;
} }
if ( nStreamIndex != -1 && sDirName.getLength() ) if ( nStreamIndex != -1 && !sDirName.isEmpty() )
m_aRecent [ sDirName ] = pCurrent; m_aRecent [ sDirName ] = pCurrent;
} }
if ( rName.getLength() -1 != nStreamIndex ) if ( rName.getLength() -1 != nStreamIndex )
...@@ -1112,7 +1112,7 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< uno: ...@@ -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 ), OSL_ENSURE( ( *aIter )[PKG_MNFST_MEDIATYPE].Name.equals( sMediaType ) && ( *aIter )[PKG_MNFST_FULLPATH].Name.equals( sFullPath ),
"The mediatype sequence format is wrong!\n" ); "The mediatype sequence format is wrong!\n" );
( *aIter )[PKG_MNFST_MEDIATYPE].Value >>= aType; ( *aIter )[PKG_MNFST_MEDIATYPE].Value >>= aType;
if ( aType.getLength() ) if ( !aType.isEmpty() )
{ {
// only nonempty type makes sence here // only nonempty type makes sence here
nSeqLength++; nSeqLength++;
......
...@@ -67,7 +67,7 @@ OUString SAL_CALL ZipPackageEntry::getName( ) ...@@ -67,7 +67,7 @@ OUString SAL_CALL ZipPackageEntry::getName( )
void SAL_CALL ZipPackageEntry::setName( const OUString& aName ) void SAL_CALL ZipPackageEntry::setName( const OUString& aName )
throw(RuntimeException) throw(RuntimeException)
{ {
if ( pParent && msName.getLength() && pParent->hasByName ( msName ) ) if ( pParent && !msName.isEmpty() && pParent->hasByName ( msName ) )
pParent->removeByName ( msName ); pParent->removeByName ( msName );
// unfortunately no other exception than RuntimeException can be thrown here // unfortunately no other exception than RuntimeException can be thrown here
...@@ -91,7 +91,7 @@ void ZipPackageEntry::doSetParent ( ZipPackageFolder * pNewParent, sal_Bool bIns ...@@ -91,7 +91,7 @@ void ZipPackageEntry::doSetParent ( ZipPackageFolder * pNewParent, sal_Bool bIns
{ {
// xParent = pParent = pNewParent; // xParent = pParent = pNewParent;
pParent = pNewParent; pParent = pNewParent;
if ( bInsert && msName.getLength() && !pNewParent->hasByName ( msName ) ) if ( bInsert && !msName.isEmpty() && !pNewParent->hasByName ( msName ) )
pNewParent->doInsertByName ( this, sal_False ); pNewParent->doInsertByName ( this, sal_False );
} }
...@@ -107,7 +107,7 @@ void SAL_CALL ZipPackageEntry::setParent( const uno::Reference< XInterface >& xN ...@@ -107,7 +107,7 @@ void SAL_CALL ZipPackageEntry::setParent( const uno::Reference< XInterface >& xN
if ( pNewParent != pParent ) if ( pNewParent != pParent )
{ {
if ( pParent && msName.getLength() && pParent->hasByName ( msName ) && mbAllowRemoveOnInsert ) if ( pParent && !msName.isEmpty() && pParent->hasByName ( msName ) && mbAllowRemoveOnInsert )
pParent->removeByName( msName ); pParent->removeByName( msName );
doSetParent ( pNewParent, sal_True ); doSetParent ( pNewParent, sal_True );
} }
......
...@@ -129,7 +129,7 @@ sal_Bool ZipPackageFolder::LookForUnexpectedODF12Streams( const ::rtl::OUString& ...@@ -129,7 +129,7 @@ sal_Bool ZipPackageFolder::LookForUnexpectedODF12Streams( const ::rtl::OUString&
{ {
// the stream is not in META-INF and ist notregistered in manifest.xml, // the stream is not in META-INF and ist notregistered in manifest.xml,
// check whether it is an internal part of the package format // 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" ) ) ) ) || !rShortName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "mimetype" ) ) ) )
{ {
// if it is not "mimetype" from the root it is not a part of the package // 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 ...@@ -326,7 +326,7 @@ bool ZipPackageFolder::saveChild( const ::rtl::OUString &rShortName, const Conte
{ {
::rtl::OUString sTempName = rPath + rShortName + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) ); ::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].Name = sMediaTypeProperty;
aPropSet[PKG_MNFST_MEDIATYPE].Value <<= rInfo.pFolder->GetMediaType(); aPropSet[PKG_MNFST_MEDIATYPE].Value <<= rInfo.pFolder->GetMediaType();
...@@ -688,7 +688,7 @@ void ZipPackageFolder::saveContents( ::rtl::OUString &rPath, std::vector < uno:: ...@@ -688,7 +688,7 @@ void ZipPackageFolder::saveContents( ::rtl::OUString &rPath, std::vector < uno::
{ {
bool bWritingFailed = false; 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 // it is an empty subfolder, use workaround to store it
ZipEntry* pTempEntry = new ZipEntry(); ZipEntry* pTempEntry = new ZipEntry();
...@@ -714,7 +714,7 @@ void ZipPackageFolder::saveContents( ::rtl::OUString &rPath, std::vector < uno:: ...@@ -714,7 +714,7 @@ void ZipPackageFolder::saveContents( ::rtl::OUString &rPath, std::vector < uno::
bool bMimeTypeStreamStored = false; bool bMimeTypeStreamStored = false;
::rtl::OUString aMimeTypeStreamName( RTL_CONSTASCII_USTRINGPARAM( "mimetype" ) ); ::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 // 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::iterator aIter = maContents.find ( aMimeTypeStreamName );
......
...@@ -721,7 +721,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, ...@@ -721,7 +721,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
if ( aValue >>= sMediaType ) if ( aValue >>= sMediaType )
{ {
if ( sMediaType.getLength() > 0 ) if ( !sMediaType.isEmpty() )
{ {
if ( sMediaType.indexOf ( OUString( RTL_CONSTASCII_USTRINGPARAM ( "text" ) ) ) != -1 if ( sMediaType.indexOf ( OUString( RTL_CONSTASCII_USTRINGPARAM ( "text" ) ) ) != -1
|| sMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM ( "application/vnd.sun.star.oleobject" ) ) ) ) || sMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM ( "application/vnd.sun.star.oleobject" ) ) ) )
......
...@@ -77,7 +77,7 @@ OZipFileAccess::~OZipFileAccess() ...@@ -77,7 +77,7 @@ OZipFileAccess::~OZipFileAccess()
// ---------------------------------------------------------------- // ----------------------------------------------------------------
uno::Sequence< ::rtl::OUString > OZipFileAccess::GetPatternsFromString_Impl( const ::rtl::OUString& aString ) uno::Sequence< ::rtl::OUString > OZipFileAccess::GetPatternsFromString_Impl( const ::rtl::OUString& aString )
{ {
if ( !aString.getLength() ) if ( aString.isEmpty() )
return uno::Sequence< ::rtl::OUString >(); return uno::Sequence< ::rtl::OUString >();
uno::Sequence< ::rtl::OUString > aPattern( 1 ); uno::Sequence< ::rtl::OUString > aPattern( 1 );
...@@ -131,7 +131,7 @@ sal_Bool OZipFileAccess::StringGoodForPattern_Impl( const ::rtl::OUString& aStri ...@@ -131,7 +131,7 @@ sal_Bool OZipFileAccess::StringGoodForPattern_Impl( const ::rtl::OUString& aStri
if ( nInd == 0 ) if ( nInd == 0 )
{ {
if ( !aPattern[0].getLength() ) if ( aPattern[0].isEmpty() )
return sal_True; return sal_True;
return aString.equals( aPattern[0] ); return aString.equals( aPattern[0] );
...@@ -145,7 +145,7 @@ sal_Bool OZipFileAccess::StringGoodForPattern_Impl( const ::rtl::OUString& aStri ...@@ -145,7 +145,7 @@ sal_Bool OZipFileAccess::StringGoodForPattern_Impl( const ::rtl::OUString& aStri
{ {
for ( sal_Int32 nCurInd = aPattern.getLength() - 2; nCurInd > 0; nCurInd-- ) for ( sal_Int32 nCurInd = aPattern.getLength() - 2; nCurInd > 0; nCurInd-- )
{ {
if ( !aPattern[nCurInd].getLength() ) if ( aPattern[nCurInd].isEmpty() )
continue; continue;
if ( nEndInd == nBeginInd ) if ( nEndInd == nBeginInd )
...@@ -186,7 +186,7 @@ void SAL_CALL OZipFileAccess::initialize( const uno::Sequence< uno::Any >& aArgu ...@@ -186,7 +186,7 @@ void SAL_CALL OZipFileAccess::initialize( const uno::Sequence< uno::Any >& aArgu
if ( !aArguments.getLength() ) if ( !aArguments.getLength() )
throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); 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; ::rtl::OUString aParamURL;
uno::Reference< io::XStream > xStream; uno::Reference< io::XStream > xStream;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment