diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-04-29 12:48:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-04-30 10:40:22 +0200 |
commit | 26166ad838aa4f8fac933a4d14ef5025911cbecb (patch) | |
tree | a58958449556e27175e635a19107fc6de8d0bf4a | |
parent | 10d2f2ebf13801feca8d14ecce96f7f5239409c2 (diff) |
loplugin:ostr in package
Change-Id: I0acc6261ab2ab2b6de52907feeaa0944f708e410
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166852
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
20 files changed, 184 insertions, 185 deletions
diff --git a/package/qa/cppunit/test_package.cxx b/package/qa/cppunit/test_package.cxx index 911e0ea60319..989ae31044d5 100644 --- a/package/qa/cppunit/test_package.cxx +++ b/package/qa/cppunit/test_package.cxx @@ -55,7 +55,7 @@ namespace BootstrapFixtureBase::setUp(); OUString aURL = m_directories.getURLFromSrc(u"/package/qa/cppunit/data/a2z.zip"); - uno::Sequence<beans::NamedValue> aNVs{ { "URL", uno::Any(aURL) } }; + uno::Sequence<beans::NamedValue> aNVs{ { u"URL"_ustr, uno::Any(aURL) } }; uno::Sequence<uno::Any> aArgs{ uno::Any(aNVs) }; uno::Reference<uno::XComponentContext> xCxt = comphelper::getProcessComponentContext(); @@ -63,7 +63,7 @@ namespace uno::Reference<packages::zip::XZipFileAccess2> xZip( xSvcMgr->createInstanceWithArgumentsAndContext( - "com.sun.star.packages.zip.ZipFileAccess", aArgs, xCxt), + u"com.sun.star.packages.zip.ZipFileAccess"_ustr, aArgs, xCxt), uno::UNO_QUERY); CPPUNIT_ASSERT(xZip.is()); @@ -208,7 +208,7 @@ namespace // and have ZIP64 format "Data descriptor". OUString aURL2 = m_directories.getURLFromSrc(u"/package/qa/cppunit/data/export64.zip"); - uno::Sequence<beans::NamedValue> aNVs2{ { "URL", uno::Any(aURL2) } }; + uno::Sequence<beans::NamedValue> aNVs2{ { u"URL"_ustr, uno::Any(aURL2) } }; uno::Sequence<uno::Any> aArgs2{ uno::Any(aNVs2) }; uno::Reference<uno::XComponentContext> xCxt = comphelper::getProcessComponentContext(); @@ -217,7 +217,7 @@ namespace // Without Zip64 support, it would crash here uno::Reference<packages::zip::XZipFileAccess2> xZip2( xSvcMgr->createInstanceWithArgumentsAndContext( - "com.sun.star.packages.zip.ZipFileAccess", aArgs2, xCxt), + u"com.sun.star.packages.zip.ZipFileAccess"_ustr, aArgs2, xCxt), uno::UNO_QUERY); CPPUNIT_ASSERT(xZip2.is()); @@ -228,7 +228,7 @@ namespace // Check if the styles.xml seems to be right uno::Reference<io::XInputStream> xStrm; - xNA->getByName("styles.xml") >>= xStrm; + xNA->getByName(u"styles.xml"_ustr) >>= xStrm; CPPUNIT_ASSERT(xStrm.is()); // Filesize check sal_Int32 nSize = xStrm->available(); diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx index 9b33e6bb371e..7593bb035206 100644 --- a/package/source/manifest/ManifestExport.cxx +++ b/package/source/manifest/ManifestExport.cxx @@ -248,7 +248,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con // TODO: the algorithm should rather be configurable pNewAttrList->AddAttribute( isODF13 ? ATTRIBUTE_ALGORITHM13 : ATTRIBUTE_ALGORITHM, - "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p" ); + u"http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"_ustr ); xHandler->startElement(isODF13 ? ELEMENT_ENCRYPTIONMETHOD13 : ELEMENT_ENCRYPTIONMETHOD, pNewAttrList); xHandler->endElement(isODF13 ? ELEMENT_ENCRYPTIONMETHOD13 : ELEMENT_ENCRYPTIONMETHOD); xHandler->ignorableWhitespace ( sWhiteSpace ); diff --git a/package/source/manifest/ManifestReader.cxx b/package/source/manifest/ManifestReader.cxx index d21748889082..1e6a6ed848c7 100644 --- a/package/source/manifest/ManifestReader.cxx +++ b/package/source/manifest/ManifestReader.cxx @@ -78,7 +78,7 @@ Sequence< Sequence< PropertyValue > > SAL_CALL ManifestReader::readManifestSeque OUString ManifestReader::getImplementationName() { - return "com.sun.star.packages.manifest.comp.ManifestReader"; + return u"com.sun.star.packages.manifest.comp.ManifestReader"_ustr; } sal_Bool SAL_CALL ManifestReader::supportsService(OUString const & rServiceName) @@ -88,7 +88,7 @@ sal_Bool SAL_CALL ManifestReader::supportsService(OUString const & rServiceName) Sequence < OUString > ManifestReader::getSupportedServiceNames() { - return { "com.sun.star.packages.manifest.ManifestReader" }; + return { u"com.sun.star.packages.manifest.ManifestReader"_ustr }; } diff --git a/package/source/manifest/ManifestWriter.cxx b/package/source/manifest/ManifestWriter.cxx index e4a4b480dfbb..1a847953fdf7 100644 --- a/package/source/manifest/ManifestWriter.cxx +++ b/package/source/manifest/ManifestWriter.cxx @@ -68,7 +68,7 @@ void SAL_CALL ManifestWriter::writeManifestSequence( const Reference< XOutputStr OUString ManifestWriter::getImplementationName() { - return "com.sun.star.packages.manifest.comp.ManifestWriter"; + return u"com.sun.star.packages.manifest.comp.ManifestWriter"_ustr; } sal_Bool SAL_CALL ManifestWriter::supportsService(OUString const & rServiceName) @@ -77,7 +77,7 @@ sal_Bool SAL_CALL ManifestWriter::supportsService(OUString const & rServiceName) } Sequence < OUString > ManifestWriter::getSupportedServiceNames() { - return { "com.sun.star.packages.manifest.ManifestWriter" }; + return { u"com.sun.star.packages.manifest.ManifestWriter"_ustr }; } diff --git a/package/source/xstor/ocompinstream.cxx b/package/source/xstor/ocompinstream.cxx index a7dd8ab2191a..8a23169f6814 100644 --- a/package/source/xstor/ocompinstream.cxx +++ b/package/source/xstor/ocompinstream.cxx @@ -305,7 +305,7 @@ OUString SAL_CALL OInputCompStream::getTargetByID( const OUString& sID ) throw uno::RuntimeException(); const uno::Sequence< beans::StringPair > aSeq = getRelationshipByID( sID ); - auto pRel = lcl_findPairByName(aSeq, "Target"); + auto pRel = lcl_findPairByName(aSeq, u"Target"_ustr); if (pRel != aSeq.end()) return pRel->Second; @@ -326,7 +326,7 @@ OUString SAL_CALL OInputCompStream::getTypeByID( const OUString& sID ) throw uno::RuntimeException(); const uno::Sequence< beans::StringPair > aSeq = getRelationshipByID( sID ); - auto pRel = lcl_findPairByName(aSeq, "Type"); + auto pRel = lcl_findPairByName(aSeq, u"Type"_ustr); if (pRel != aSeq.end()) return pRel->Second; @@ -348,7 +348,7 @@ uno::Sequence< beans::StringPair > SAL_CALL OInputCompStream::getRelationshipByI // TODO/LATER: in future the unification of the ID could be checked const uno::Sequence< uno::Sequence< beans::StringPair > > aSeq = getAllRelationships(); - const beans::StringPair aIDRel("Id", sID); + const beans::StringPair aIDRel(u"Id"_ustr, sID); auto pRel = std::find_if(aSeq.begin(), aSeq.end(), [&aIDRel](const uno::Sequence<beans::StringPair>& rRel){ return std::find(rRel.begin(), rRel.end(), aIDRel) != rRel.end(); }); @@ -373,7 +373,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OInputCompStream::g // TODO/LATER: in future the unification of the ID could be checked const uno::Sequence< uno::Sequence< beans::StringPair > > aSeq = getAllRelationships(); - const beans::StringPair aTypeRel("Type", sType); + const beans::StringPair aTypeRel(u"Type"_ustr, sType); std::vector< uno::Sequence<beans::StringPair> > aResult; aResult.reserve(aSeq.getLength()); @@ -407,7 +407,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OInputCompStream::g return aResult; } - throw io::IOException("relations info could not be read"); // the relations info could not be read + throw io::IOException(u"relations info could not be read"_ustr); // the relations info could not be read } void SAL_CALL OInputCompStream::insertRelationshipByID( const OUString& /*sID*/, const uno::Sequence< beans::StringPair >& /*aEntry*/, sal_Bool /*bReplace*/ ) diff --git a/package/source/xstor/ohierarchyholder.cxx b/package/source/xstor/ohierarchyholder.cxx index d9b5b137434d..b2fb66cfc29e 100644 --- a/package/source/xstor/ohierarchyholder.cxx +++ b/package/source/xstor/ohierarchyholder.cxx @@ -41,7 +41,7 @@ uno::Reference< embed::XExtendedStorageStream > OHierarchyHolder_Impl::GetStream uno::Reference< embed::XStorage > xOwnStor( m_xWeakOwnStorage.get(), uno::UNO_QUERY_THROW ); if ( !( nStorageMode & embed::ElementModes::WRITE ) && ( nStreamMode & embed::ElementModes::WRITE ) ) - throw io::IOException("invalid storage/stream mode combo"); + throw io::IOException(u"invalid storage/stream mode combo"_ustr); uno::Reference< embed::XExtendedStorageStream > xResult = m_xChild->GetStreamHierarchically( nStorageMode, aListPath, nStreamMode, aEncryptionData ); @@ -83,7 +83,7 @@ uno::Reference< embed::XExtendedStorageStream > OHierarchyElement_Impl::GetStrea std::unique_lock aGuard( m_aMutex ); if ( !( nStorageMode & embed::ElementModes::WRITE ) && ( nStreamMode & embed::ElementModes::WRITE ) ) - throw io::IOException("invalid storage/stream mode combo"); + throw io::IOException(u"invalid storage/stream mode combo"_ustr); if ( aListPath.empty() ) throw uno::RuntimeException(); @@ -309,7 +309,7 @@ void SAL_CALL OHierarchyElement_Impl::commited( const css::lang::EventObject& /* { css::uno::Any anyEx = cppu::getCaughtException(); throw lang::WrappedTargetRuntimeException( - "Can not commit storage sequence!", + u"Can not commit storage sequence!"_ustr, uno::Reference< uno::XInterface >(), anyEx ); } diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index b45f41089e0d..437750525ae7 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -332,7 +332,7 @@ bool OWriteStream_Impl::IsEncrypted() uno::Reference< beans::XPropertySet > xPropSet( m_xPackageStream, uno::UNO_QUERY ); if ( xPropSet.is() ) { - uno::Any aValue = xPropSet->getPropertyValue("WasEncrypted"); + uno::Any aValue = xPropSet->getPropertyValue(u"WasEncrypted"_ustr); if ( !( aValue >>= bWasEncr ) ) { SAL_WARN( "package.xstor", "The property WasEncrypted has wrong type!" ); @@ -582,7 +582,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetTempFileAsStream() // in case the stream can not be open // an exception should be thrown if ( !xTempStream.is() ) - throw io::IOException("no temp stream"); //TODO: + throw io::IOException(u"no temp stream"_ustr); //TODO: return xTempStream; } @@ -636,7 +636,7 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt SAL_WARN_IF( !m_xPackageStream.is(), "package.xstor", "No package stream is set!" ); if ( m_bHasDataToFlush ) - throw io::IOException("m_bHasDataToFlush==true"); + throw io::IOException(u"m_bHasDataToFlush==true"_ustr); OSL_ENSURE( !m_oTempFile.has_value() && !m_xCacheStream.is(), "The temporary must not exist!" ); @@ -655,8 +655,8 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt // Thus if Compressed property is provided it must be set as the latest one bool bCompressedIsSet = false; bool bCompressed = false; - OUString aComprPropName( "Compressed" ); - OUString aMedTypePropName( "MediaType" ); + OUString aComprPropName( u"Compressed"_ustr ); + OUString aMedTypePropName( u"MediaType"_ustr ); for ( const auto& rProp : aProps ) { if ( rProp.Name == aComprPropName ) @@ -697,7 +697,7 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt // set to be encrypted but do not use encryption key xPropertySet->setPropertyValue( STORAGE_ENCRYPTION_KEYS_PROPERTY, uno::Any( uno::Sequence< beans::NamedValue >() ) ); - xPropertySet->setPropertyValue( "Encrypted", uno::Any( true ) ); + xPropertySet->setPropertyValue( u"Encrypted"_ustr, uno::Any( true ) ); } // the stream should be free soon, after package is stored @@ -788,7 +788,7 @@ void OWriteStream_Impl::Commit() // set to be encrypted but do not use encryption key xPropertySet->setPropertyValue( STORAGE_ENCRYPTION_KEYS_PROPERTY, uno::Any( uno::Sequence< beans::NamedValue >() ) ); - xPropertySet->setPropertyValue( "Encrypted", + xPropertySet->setPropertyValue( u"Encrypted"_ustr, uno::Any( true ) ); } else if ( m_bHasCachedEncryptionData ) @@ -886,7 +886,7 @@ uno::Sequence< beans::PropertyValue > OWriteStream_Impl::InsertOwnProps( else if ( m_nRelInfoStatus == RELINFO_CHANGED_STREAM_READ || m_nRelInfoStatus == RELINFO_CHANGED ) aPropVal.Value <<= m_aNewRelInfo; else // m_nRelInfoStatus == RELINFO_CHANGED_BROKEN || m_nRelInfoStatus == RELINFO_BROKEN - throw io::IOException( "Wrong relinfo stream!" ); + throw io::IOException( u"Wrong relinfo stream!"_ustr ); } if (!aPropVal.Name.isEmpty()) { @@ -1049,7 +1049,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > OWriteStream_Impl::GetAllRel else if ( m_nRelInfoStatus == RELINFO_CHANGED_STREAM_READ || m_nRelInfoStatus == RELINFO_CHANGED ) return m_aNewRelInfo; else // m_nRelInfoStatus == RELINFO_CHANGED_BROKEN || m_nRelInfoStatus == RELINFO_BROKEN - throw io::IOException( "Wrong relinfo stream!" ); + throw io::IOException( u"Wrong relinfo stream!"_ustr ); } void OWriteStream_Impl::CopyInternallyTo_Impl( const uno::Reference< io::XStream >& xDestStream ) @@ -1381,7 +1381,7 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar uno::Reference< beans::XPropertySet > xProps( m_xPackageStream, uno::UNO_QUERY_THROW ); bool bEncr = false; - xProps->getPropertyValue( "Encrypted" ) >>= bEncr; + xProps->getPropertyValue( u"Encrypted"_ustr ) >>= bEncr; if ( !bEncr ) throw packages::NoEncryptionException(); @@ -1468,8 +1468,8 @@ void OWriteStream_Impl::CommitStreamRelInfo( const uno::Reference< embed::XStora // set the mediatype uno::Reference< beans::XPropertySet > xPropSet( xRelsStream, uno::UNO_QUERY_THROW ); xPropSet->setPropertyValue( - "MediaType", - uno::Any( OUString("application/vnd.openxmlformats-package.relationships+xml" ) ) ); + u"MediaType"_ustr, + uno::Any( u"application/vnd.openxmlformats-package.relationships+xml"_ustr ) ); m_nRelInfoStatus = RELINFO_READ; } @@ -1492,8 +1492,8 @@ void OWriteStream_Impl::CommitStreamRelInfo( const uno::Reference< embed::XStora // set the mediatype uno::Reference< beans::XPropertySet > xPropSet( xRelsStream, uno::UNO_QUERY_THROW ); - xPropSet->setPropertyValue("MediaType", - uno::Any( OUString("application/vnd.openxmlformats-package.relationships+xml" ) ) ); + xPropSet->setPropertyValue(u"MediaType"_ustr, + uno::Any( u"application/vnd.openxmlformats-package.relationships+xml"_ustr ) ); if ( m_nRelInfoStatus == RELINFO_CHANGED_STREAM ) m_nRelInfoStatus = RELINFO_NO_INIT; @@ -1657,7 +1657,7 @@ void OWriteStream::CopyToStreamInternally_Impl( const uno::Reference< io::XStrea // now the properties can be copied // the order of the properties setting is not important for StorageStream API - OUString aPropName ("Compressed"); + OUString aPropName (u"Compressed"_ustr); xDestProps->setPropertyValue( aPropName, getPropertyValue( aPropName ) ); if ( m_nStorageType == embed::StorageFormats::PACKAGE || m_nStorageType == embed::StorageFormats::OFOPXML ) { @@ -1984,7 +1984,7 @@ uno::Reference< io::XOutputStream > SAL_CALL OWriteStream::getOutputStream() } catch( const io::IOException& r ) { - throw lang::WrappedTargetRuntimeException("OWriteStream::getOutputStream: Could not create backing temp file", + throw lang::WrappedTargetRuntimeException(u"OWriteStream::getOutputStream: Could not create backing temp file"_ustr, getXWeak(), css::uno::Any ( r ) ); } @@ -2324,7 +2324,7 @@ void SAL_CALL OWriteStream::dispose() { uno::Any aCaught( ::cppu::getCaughtException() ); SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); - throw lang::WrappedTargetRuntimeException("Can not commit/revert the storage!", + throw lang::WrappedTargetRuntimeException(u"Can not commit/revert the storage!"_ustr, getXWeak(), aCaught ); } @@ -2453,7 +2453,7 @@ sal_Bool SAL_CALL OWriteStream::hasEncryptionData() { uno::Any aCaught( ::cppu::getCaughtException() ); SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); - throw lang::WrappedTargetRuntimeException( "Problems on hasEncryptionData!", + throw lang::WrappedTargetRuntimeException( u"Problems on hasEncryptionData!"_ustr, getXWeak(), aCaught ); } @@ -2501,7 +2501,7 @@ OUString SAL_CALL OWriteStream::getTargetByID( const OUString& sID ) throw uno::RuntimeException(); const uno::Sequence< beans::StringPair > aSeq = getRelationshipByID( sID ); - auto pRel = lcl_findPairByName(aSeq, "Target"); + auto pRel = lcl_findPairByName(aSeq, u"Target"_ustr); if (pRel != aSeq.end()) return pRel->Second; @@ -2522,7 +2522,7 @@ OUString SAL_CALL OWriteStream::getTypeByID( const OUString& sID ) throw uno::RuntimeException(); const uno::Sequence< beans::StringPair > aSeq = getRelationshipByID( sID ); - auto pRel = lcl_findPairByName(aSeq, "Type"); + auto pRel = lcl_findPairByName(aSeq, u"Type"_ustr); if (pRel != aSeq.end()) return pRel->Second; @@ -2544,7 +2544,7 @@ uno::Sequence< beans::StringPair > SAL_CALL OWriteStream::getRelationshipByID( // TODO/LATER: in future the unification of the ID could be checked const uno::Sequence< uno::Sequence< beans::StringPair > > aSeq = getAllRelationships(); - const beans::StringPair aIDRel("Id", sID); + const beans::StringPair aIDRel(u"Id"_ustr, sID); auto pRel = std::find_if(aSeq.begin(), aSeq.end(), [&aIDRel](const uno::Sequence<beans::StringPair>& rRel) { return std::find(rRel.begin(), rRel.end(), aIDRel) != rRel.end(); }); @@ -2569,7 +2569,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OWriteStream::getRe // TODO/LATER: in future the unification of the ID could be checked const uno::Sequence< uno::Sequence< beans::StringPair > > aSeq = getAllRelationships(); - const beans::StringPair aTypeRel("Type", sType); + const beans::StringPair aTypeRel(u"Type"_ustr, sType); std::vector< uno::Sequence<beans::StringPair> > aResult; aResult.reserve(aSeq.getLength()); @@ -2609,7 +2609,7 @@ void SAL_CALL OWriteStream::insertRelationshipByID( const OUString& sID, const if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); - const beans::StringPair aIDRel("Id", sID); + const beans::StringPair aIDRel(u"Id"_ustr, sID); uno::Sequence<beans::StringPair>* pPair = nullptr; @@ -2660,7 +2660,7 @@ void SAL_CALL OWriteStream::removeRelationshipByID( const OUString& sID ) throw uno::RuntimeException(); uno::Sequence< uno::Sequence< beans::StringPair > > aSeq = getAllRelationships(); - const beans::StringPair aIDRel("Id", sID); + const beans::StringPair aIDRel(u"Id"_ustr, sID); auto pRel = std::find_if(std::cbegin(aSeq), std::cend(aSeq), [&aIDRel](const uno::Sequence< beans::StringPair >& rRel) { return std::find(rRel.begin(), rRel.end(), aIDRel) != rRel.end(); }); @@ -2693,7 +2693,7 @@ void SAL_CALL OWriteStream::insertRelationships( const uno::Sequence< uno::Sequ if ( m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException(); - OUString aIDTag( "Id" ); + OUString aIDTag( u"Id"_ustr ); const uno::Sequence< uno::Sequence< beans::StringPair > > aSeq = getAllRelationships(); std::vector< uno::Sequence<beans::StringPair> > aResultVec; aResultVec.reserve(aSeq.getLength() + aEntries.getLength()); @@ -3085,7 +3085,7 @@ void SAL_CALL OWriteStream::commit() { uno::Any aCaught( ::cppu::getCaughtException() ); SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); - throw embed::StorageWrappedTargetException( "Problems on commit!", + throw embed::StorageWrappedTargetException( u"Problems on commit!"_ustr, getXWeak(), aCaught ); } @@ -3141,7 +3141,7 @@ void SAL_CALL OWriteStream::revert() { uno::Any aCaught(::cppu::getCaughtException()); SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); - throw embed::StorageWrappedTargetException("Problems on revert!", + throw embed::StorageWrappedTargetException(u"Problems on revert!"_ustr, getXWeak(), aCaught); } diff --git a/package/source/xstor/switchpersistencestream.cxx b/package/source/xstor/switchpersistencestream.cxx index ff6118726628..ef07966f09d0 100644 --- a/package/source/xstor/switchpersistencestream.cxx +++ b/package/source/xstor/switchpersistencestream.cxx @@ -162,7 +162,7 @@ void SwitchablePersistenceStream::CopyAndSwitchPersistenceTo( const uno::Referen // the provided stream must be empty xTargetSeek.set( xTargetStream, uno::UNO_QUERY_THROW ); if ( xTargetSeek->getLength() ) - throw io::IOException("provided stream not empty"); + throw io::IOException(u"provided stream not empty"_ustr); } uno::Reference< io::XTruncate > xTargetTruncate( xTargetStream, uno::UNO_QUERY_THROW ); diff --git a/package/source/xstor/xfactory.cxx b/package/source/xstor/xfactory.cxx index 4d48b2b5b1fe..22d72ca2c58a 100644 --- a/package/source/xstor/xfactory.cxx +++ b/package/source/xstor/xfactory.cxx @@ -144,7 +144,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr else if ( !( aArguments[0] >>= xStream ) && !( aArguments[0] >>= xInputStream ) ) { OSL_FAIL( "Wrong first argument!" ); - throw uno::Exception("wrong first arg", nullptr); // TODO: Illegal argument + throw uno::Exception(u"wrong first arg"_ustr, nullptr); // TODO: Illegal argument } // retrieve mediadescriptor and set storage properties @@ -159,7 +159,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr { if ( !aURL.isEmpty() ) { - aPropsToSet = { comphelper::makePropertyValue("URL", aURL) }; + aPropsToSet = { comphelper::makePropertyValue(u"URL"_ustr, aURL) }; } sal_Int32 nNumArgs = 1; @@ -217,7 +217,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr else { OSL_FAIL( "Wrong third argument!" ); - throw uno::Exception("wrong 3rd arg", nullptr); // TODO: Illegal argument + throw uno::Exception(u"wrong 3rd arg"_ustr, nullptr); // TODO: Illegal argument } } @@ -227,7 +227,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr { // if xInputStream is set the storage should be open from it if ( nStorageMode & embed::ElementModes::WRITE ) - throw uno::Exception("storagemode==write", nullptr); // TODO: access denied + throw uno::Exception(u"storagemode==write"_ustr, nullptr); // TODO: access denied uno::Reference< io::XSeekable > xSeekable( xInputStream, uno::UNO_QUERY ); if ( !xSeekable.is() ) @@ -237,7 +237,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr } if ( !CheckPackageSignature_Impl( xInputStream, xSeekable ) ) - throw io::IOException("package signature check failed, probably not a package file", nullptr); // TODO: this is not a package file + throw io::IOException(u"package signature check failed, probably not a package file"_ustr, nullptr); // TODO: this is not a package file return cppu::getXWeak( new OStorage(xInputStream, nStorageMode, aPropsToSet, m_xContext, nStorageType)); @@ -246,7 +246,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr { if ( ( ( nStorageMode & embed::ElementModes::WRITE ) && !xStream->getOutputStream().is() ) || !xStream->getInputStream().is() ) - throw uno::Exception("access denied", nullptr); // TODO: access denied + throw uno::Exception(u"access denied"_ustr, nullptr); // TODO: access denied uno::Reference< io::XSeekable > xSeekable( xStream, uno::UNO_QUERY ); if ( !xSeekable.is() ) @@ -262,12 +262,12 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr new OStorage(xStream, nStorageMode, aPropsToSet, m_xContext, nStorageType)); } - throw uno::Exception("no input stream or regular stream", nullptr); // general error during creation + throw uno::Exception(u"no input stream or regular stream"_ustr, nullptr); // general error during creation } OUString SAL_CALL OStorageFactory::getImplementationName() { - return "com.sun.star.comp.embed.StorageFactory"; + return u"com.sun.star.comp.embed.StorageFactory"_ustr; } sal_Bool SAL_CALL OStorageFactory::supportsService( const OUString& ServiceName ) @@ -277,8 +277,8 @@ sal_Bool SAL_CALL OStorageFactory::supportsService( const OUString& ServiceName uno::Sequence< OUString > SAL_CALL OStorageFactory::getSupportedServiceNames() { - return { "com.sun.star.embed.StorageFactory", - "com.sun.star.comp.embed.StorageFactory" }; + return { u"com.sun.star.embed.StorageFactory"_ustr, + u"com.sun.star.comp.embed.StorageFactory"_ustr }; } diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index ba35e6973569..d394052c01ce 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -90,8 +90,8 @@ void OStorage_Impl::completeStorageStreamCopy_Impl( // TODO: headers of encrypted streams should be copied also ::comphelper::OStorageHelper::CopyInputToOutput( xSourceInStream, xDestOutStream ); - uno::Sequence<OUString> aPropNames { "Compressed", "MediaType", - "UseCommonStoragePasswordEncryption" }; + uno::Sequence<OUString> aPropNames { u"Compressed"_ustr, u"MediaType"_ustr, + u"UseCommonStoragePasswordEncryption"_ustr }; if ( nStorageType == embed::StorageFormats::OFOPXML ) { @@ -301,7 +301,7 @@ OStorage_Impl::~OStorage_Impl() m_xPackageFolder.clear(); m_xPackage.clear(); - OUString aPropertyName = "URL"; + OUString aPropertyName = u"URL"_ustr; for (const auto& rProp : m_xProperties) { if ( rProp.Name == aPropertyName ) @@ -388,7 +388,7 @@ void OStorage_Impl::OpenOwnPackage() } // do not allow elements to remove themself from the old container in case of insertion to another container - pArguments[ 1 ] <<= beans::NamedValue( "AllowRemoveOnInsert", + pArguments[ 1 ] <<= beans::NamedValue( u"AllowRemoveOnInsert"_ustr, uno::Any( false ) ); sal_Int32 nArgNum = 2; @@ -418,7 +418,7 @@ void OStorage_Impl::OpenOwnPackage() // let the package support only plain zip format beans::NamedValue aNamedValue; aNamedValue.Name = "StorageFormat"; - aNamedValue.Value <<= OUString( "ZipFormat" ); + aNamedValue.Value <<= u"ZipFormat"_ustr; aArguments.realloc( ++nArgNum ); pArguments = aArguments.getArray(); pArguments[nArgNum-1] <<= aNamedValue; @@ -428,14 +428,14 @@ void OStorage_Impl::OpenOwnPackage() // let the package support OFOPXML media type handling beans::NamedValue aNamedValue; aNamedValue.Name = "StorageFormat"; - aNamedValue.Value <<= OUString( "OFOPXMLFormat" ); + aNamedValue.Value <<= u"OFOPXMLFormat"_ustr; aArguments.realloc( ++nArgNum ); pArguments = aArguments.getArray(); pArguments[nArgNum-1] <<= aNamedValue; } m_xPackage.set( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( - "com.sun.star.packages.comp.ZipPackage", aArguments, m_xContext), + u"com.sun.star.packages.comp.ZipPackage"_ustr, aArguments, m_xContext), uno::UNO_QUERY ); } @@ -444,7 +444,7 @@ void OStorage_Impl::OpenOwnPackage() if ( xHNameAccess.is() ) { - uno::Any aFolder = xHNameAccess->getByHierarchicalName("/"); + uno::Any aFolder = xHNameAccess->getByHierarchicalName(u"/"_ustr); aFolder >>= m_xPackageFolder; } } @@ -481,7 +481,7 @@ void OStorage_Impl::GetStorageProperties() if ( !m_bControlVersion ) { - xProps->getPropertyValue( "Version" ) >>= m_aVersion; + xProps->getPropertyValue( u"Version"_ustr ) >>= m_aVersion; m_bControlVersion = true; } @@ -613,7 +613,7 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); sal_Int32 nDestMode = embed::ElementModes::READ; - xPropSet->getPropertyValue( "OpenMode" ) >>= nDestMode; + xPropSet->getPropertyValue( u"OpenMode"_ustr ) >>= nDestMode; if ( !( nDestMode & embed::ElementModes::WRITE ) ) throw io::IOException( THROW_WHERE ); // TODO: access_denied @@ -633,15 +633,15 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes // move storage properties to the destination one ( means changeable properties ) if ( m_nStorageType == embed::StorageFormats::PACKAGE ) { - xPropSet->setPropertyValue( "MediaType", uno::Any( m_aMediaType ) ); - xPropSet->setPropertyValue( "Version", uno::Any( m_aVersion ) ); + xPropSet->setPropertyValue( u"MediaType"_ustr, uno::Any( m_aMediaType ) ); + xPropSet->setPropertyValue( u"Version"_ustr, uno::Any( m_aVersion ) ); } if ( m_nStorageType == embed::StorageFormats::PACKAGE ) { // if this is a root storage, the common key from current one should be moved there bool bIsRoot = false; - if ( ( xPropSet->getPropertyValue( "IsRoot" ) >>= bIsRoot ) && bIsRoot ) + if ( ( xPropSet->getPropertyValue( u"IsRoot"_ustr ) >>= bIsRoot ) && bIsRoot ) { try { @@ -840,7 +840,7 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, uno::Reference< beans::XPropertySet > xProps( xDestStream, uno::UNO_QUERY_THROW ); xProps->setPropertyValue( - "UseCommonStoragePasswordEncryption", + u"UseCommonStoragePasswordEncryption"_ustr, uno::Any( true ) ); } else @@ -874,7 +874,7 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, uno::Reference< beans::XPropertySet > xProps( xDestStream, uno::UNO_QUERY_THROW ); xProps->setPropertyValue( - "UseCommonStoragePasswordEncryption", + u"UseCommonStoragePasswordEncryption"_ustr, uno::Any( true ) ); } catch( const packages::WrongPasswordException& ) @@ -1140,8 +1140,8 @@ void OStorage_Impl::Commit() { // move properties to the destination package folder uno::Reference< beans::XPropertySet > xProps( xNewPackageFolder, uno::UNO_QUERY_THROW ); - xProps->setPropertyValue( "MediaType", uno::Any( m_aMediaType ) ); - xProps->setPropertyValue( "Version", uno::Any( m_aVersion ) ); + xProps->setPropertyValue( u"MediaType"_ustr, uno::Any( m_aMediaType ) ); + xProps->setPropertyValue( u"Version"_ustr, uno::Any( m_aVersion ) ); } if ( m_nStorageType == embed::StorageFormats::OFOPXML ) @@ -1580,7 +1580,7 @@ void OStorage_Impl::CreateRelStorage() if ( !m_pRelStorElement ) { - m_pRelStorElement = new SotElement_Impl( "_rels", true, true ); + m_pRelStorElement = new SotElement_Impl( u"_rels"_ustr, true, true ); m_pRelStorElement->m_xStorage = CreateNewStorageImpl(embed::ElementModes::WRITE); if (m_pRelStorElement->m_xStorage) m_pRelStorElement->m_xStorage->m_pParent = nullptr; // the relation storage is completely controlled by parent @@ -1641,7 +1641,7 @@ uno::Reference< io::XInputStream > OStorage_Impl::GetRelInfoStreamForName( void OStorage_Impl::CommitRelInfo( const uno::Reference< container::XNameContainer >& xNewPackageFolder ) { // this method should be used only in OStorage_Impl::Commit() method - OUString aRelsStorName("_rels"); + OUString aRelsStorName(u"_rels"_ustr); if ( !xNewPackageFolder.is() ) throw uno::RuntimeException( THROW_WHERE ); @@ -1659,7 +1659,7 @@ void OStorage_Impl::CommitRelInfo( const uno::Reference< container::XNameContain CreateRelStorage(); uno::Reference<io::XStream> xRelsStream = m_xRelStorage->openStreamElement( - ".rels", embed::ElementModes::TRUNCATE | embed::ElementModes::READWRITE); + u".rels"_ustr, embed::ElementModes::TRUNCATE | embed::ElementModes::READWRITE); uno::Reference<io::XOutputStream> xOutStream = xRelsStream->getOutputStream(); if (!xOutStream.is()) @@ -1671,8 +1671,7 @@ void OStorage_Impl::CommitRelInfo( const uno::Reference< container::XNameContain // set the mediatype uno::Reference<beans::XPropertySet> xPropSet(xRelsStream, uno::UNO_QUERY_THROW); xPropSet->setPropertyValue( - "MediaType", uno::Any(OUString( - "application/vnd.openxmlformats-package.relationships+xml"))); + u"MediaType"_ustr, uno::Any(u"application/vnd.openxmlformats-package.relationships+xml"_ustr)); m_nRelInfoStatus = RELINFO_READ; } @@ -1685,7 +1684,7 @@ void OStorage_Impl::CommitRelInfo( const uno::Reference< container::XNameContain CreateRelStorage(); uno::Reference<io::XStream> xRelsStream = m_xRelStorage->openStreamElement( - ".rels", embed::ElementModes::TRUNCATE | embed::ElementModes::READWRITE); + u".rels"_ustr, embed::ElementModes::TRUNCATE | embed::ElementModes::READWRITE); uno::Reference<io::XOutputStream> xOutputStream = xRelsStream->getOutputStream(); if (!xOutputStream.is()) @@ -1698,8 +1697,8 @@ void OStorage_Impl::CommitRelInfo( const uno::Reference< container::XNameContain // set the mediatype uno::Reference<beans::XPropertySet> xPropSet(xRelsStream, uno::UNO_QUERY_THROW); xPropSet->setPropertyValue( - "MediaType", - uno::Any(OUString("application/vnd.openxmlformats-package.relationships+xml"))); + u"MediaType"_ustr, + uno::Any(u"application/vnd.openxmlformats-package.relationships+xml"_ustr)); m_xNewRelInfoStream.clear(); if (m_nRelInfoStatus == RELINFO_CHANGED_STREAM) @@ -4436,7 +4435,7 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const OUString& aPropertyName ) SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); throw lang::WrappedTargetException( - "Can't read contents!", + u"Can't read contents!"_ustr, getXWeak(), aCaught ); } @@ -4616,7 +4615,7 @@ OUString SAL_CALL OStorage::getTargetByID( const OUString& sID ) throw uno::RuntimeException( THROW_WHERE ); const uno::Sequence< beans::StringPair > aSeq = getRelationshipByID( sID ); - auto pRel = lcl_findPairByName(aSeq, "Target"); + auto pRel = lcl_findPairByName(aSeq, u"Target"_ustr); if (pRel != aSeq.end()) return pRel->Second; @@ -4637,7 +4636,7 @@ OUString SAL_CALL OStorage::getTypeByID( const OUString& sID ) throw uno::RuntimeException( THROW_WHERE ); const uno::Sequence< beans::StringPair > aSeq = getRelationshipByID( sID ); - auto pRel = lcl_findPairByName(aSeq, "Type"); + auto pRel = lcl_findPairByName(aSeq, u"Type"_ustr); if (pRel != aSeq.end()) return pRel->Second; @@ -4659,7 +4658,7 @@ uno::Sequence< beans::StringPair > SAL_CALL OStorage::getRelationshipByID( cons // TODO/LATER: in future the unification of the ID could be checked const uno::Sequence< uno::Sequence< beans::StringPair > > aSeq = getAllRelationships(); - const beans::StringPair aIDRel("Id", sID); + const beans::StringPair aIDRel(u"Id"_ustr, sID); auto pRel = std::find_if(aSeq.begin(), aSeq.end(), [&aIDRel](const uno::Sequence<beans::StringPair>& rRel) { @@ -4690,7 +4689,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OStorage::getRelati std::copy_if(aSeq.begin(), aSeq.end(), std::back_inserter(aResult), [&sType](const uno::Sequence<beans::StringPair>& rRel) { - auto pRel = lcl_findPairByName(rRel, "Type"); + auto pRel = lcl_findPairByName(rRel, u"Type"_ustr); return pRel != rRel.end() // the type is usually a URL, so the check should be case insensitive && pRel->Second.equalsIgnoreAsciiCase( sType ); @@ -4749,7 +4748,7 @@ void SAL_CALL OStorage::insertRelationshipByID( const OUString& sID, const uno: if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); - const beans::StringPair aIDRel("Id", sID); + const beans::StringPair aIDRel(u"Id"_ustr, sID); uno::Sequence<beans::StringPair>* pResult = nullptr; @@ -4800,7 +4799,7 @@ void SAL_CALL OStorage::removeRelationshipByID( const OUString& sID ) throw uno::RuntimeException( THROW_WHERE ); uno::Sequence< uno::Sequence< beans::StringPair > > aSeq = getAllRelationships(); - const beans::StringPair aIDRel("Id", sID); + const beans::StringPair aIDRel(u"Id"_ustr, sID); auto pRel = std::find_if(std::cbegin(aSeq), std::cend(aSeq), [&aIDRel](const uno::Sequence< beans::StringPair >& rRel) { return std::find(rRel.begin(), rRel.end(), aIDRel) != rRel.end(); }); @@ -4833,7 +4832,7 @@ void SAL_CALL OStorage::insertRelationships( const uno::Sequence< uno::Sequence if ( m_pImpl->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); - OUString aIDTag( "Id" ); + OUString aIDTag( u"Id"_ustr ); const uno::Sequence< uno::Sequence< beans::StringPair > > aSeq = getAllRelationships(); std::vector< uno::Sequence<beans::StringPair> > aResultVec; aResultVec.reserve(aSeq.getLength() + aEntries.getLength()); diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx index 8b628b14ddfe..dae87e632fd8 100644 --- a/package/source/zipapi/XUnbufferedStream.cxx +++ b/package/source/zipapi/XUnbufferedStream.cxx @@ -79,10 +79,10 @@ XUnbufferedStream::XUnbufferedStream( } if (mnZipSize < 0) - throw ZipIOException("The stream seems to be broken!"); + throw ZipIOException(u"The stream seems to be broken!"_ustr); if (o3tl::checked_add(maEntry.nOffset, nSize, mnZipEnd)) - throw ZipIOException("Integer-overflow"); + throw ZipIOException(u"Integer-overflow"_ustr); bool bHaveEncryptData = rData.is() && rData->m_aInitVector.hasElements() && ((rData->m_aSalt.hasElements() && (rData->m_oPBKDFIterationCount || rData->m_oArgon2Args)) @@ -236,18 +236,18 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa nRead += nLastRead; if ( nRead > nRequestedBytes ) throw RuntimeException( - "Should not be possible to read more than requested!" ); + u"Should not be possible to read more than requested!"_ustr ); if ( maInflater.finished() || maInflater.getLastInflateError() ) - throw ZipIOException("The stream seems to be broken!" ); + throw ZipIOException(u"The stream seems to be broken!"_ustr ); if ( maInflater.needsDictionary() ) - throw ZipIOException("Dictionaries are not supported!" ); + throw ZipIOException(u"Dictionaries are not supported!"_ustr ); sal_Int32 nDiff = static_cast< sal_Int32 >( mnZipEnd - mnZipCurrent ); if ( nDiff <= 0 ) { - throw ZipIOException("The stream seems to be broken!" ); + throw ZipIOException(u"The stream seems to be broken!"_ustr ); } mxZipSeek->seek ( mnZipCurrent ); @@ -259,7 +259,7 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa sal_Int32 nZipRead = mxZipStream->readBytes( maCompBuffer, nToRead ); if ( nZipRead < nToRead ) - throw ZipIOException("No expected data!" ); + throw ZipIOException(u"No expected data!"_ustr ); mnZipCurrent += nZipRead; // maCompBuffer now has the data, check if we need to decrypt @@ -298,7 +298,7 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa maCRC.update( aData ); if ( mnZipSize + maHeader.getLength() == mnMyCurrent && maCRC.getValue() != maEntry.nCrc ) - throw ZipIOException("The stream seems to be broken!" ); + throw ZipIOException(u"The stream seems to be broken!"_ustr ); } } diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 78823c83476d..5ef6936f7170 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -93,7 +93,7 @@ ZipFile::ZipFile( rtl::Reference<comphelper::RefCountedMutex> aMutexHolder, if (bInitialise && readCEN() == -1 ) { aEntries.clear(); - throw ZipException( "stream data looks to be broken" ); + throw ZipException( u"stream data looks to be broken"_ustr ); } } @@ -117,7 +117,7 @@ ZipFile::ZipFile( rtl::Reference< comphelper::RefCountedMutex > aMutexHolder, else if ( readCEN() == -1 ) { aEntries.clear(); - throw ZipException("stream data looks to be broken" ); + throw ZipException(u"stream data looks to be broken"_ustr ); } } } @@ -173,7 +173,7 @@ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const un if (xEncryptionData->m_nDerivedKeySize < 0) { - throw ZipIOException("Invalid derived key length!" ); + throw ZipIOException(u"Invalid derived key length!"_ustr ); } uno::Sequence< sal_Int8 > aDerivedKey( xEncryptionData->m_nDerivedKeySize ); @@ -213,7 +213,7 @@ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const un if (rc != ARGON2_OK) { SAL_WARN("package", "argon2id_ctx failed to derive key: " << argon2_error_message(rc)); - throw ZipIOException("argon2id_ctx failed to derive key"); + throw ZipIOException(u"argon2id_ctx failed to derive key"_ustr); } } else if ( rtl_Digest_E_None != rtl_digest_PBKDF2( reinterpret_cast< sal_uInt8* >( aDerivedKey.getArray() ), @@ -224,7 +224,7 @@ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const un xEncryptionData->m_aSalt.getLength(), *xEncryptionData->m_oPBKDFIterationCount) ) { - throw ZipIOException("Can not create derived key!" ); + throw ZipIOException(u"Can not create derived key!"_ustr ); } if (xEncryptionData->m_nEncAlg == xml::crypto::CipherID::AES_CBC_W3C_PADDING @@ -244,7 +244,7 @@ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const un } else { - throw ZipIOException("Unknown cipher algorithm is requested!" ); + throw ZipIOException(u"Unknown cipher algorithm is requested!"_ustr ); } return xResult; @@ -749,14 +749,14 @@ uno::Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const ::rtl::Reference<EncryptionData> &rData) { if (!rData.is()) - throw ZipIOException("Encrypted stream without encryption data!" ); + throw ZipIOException(u"Encrypted stream without encryption data!"_ustr ); if (!rData->m_aKey.hasElements()) throw packages::WrongPasswordException(THROW_WHERE); uno::Reference<XSeekable> xSeek(xStream, UNO_QUERY); if (!xSeek.is()) - throw ZipIOException("The stream must be seekable!"); + throw ZipIOException(u"The stream must be seekable!"_ustr); // if we have a digest, then this file is an encrypted one and we should // check if we can decrypt it or not @@ -860,7 +860,7 @@ uno::Reference< XInputStream > ZipFile::getDataStream( ZipEntry& rEntry, // in case no digest is provided there is no way // to detect password correctness if ( !rData.is() ) - throw ZipException("Encrypted stream without encryption data!" ); + throw ZipException(u"Encrypted stream without encryption data!"_ustr ); // if we have a digest, then this file is an encrypted one and we should // check if we can decrypt it or not @@ -923,7 +923,7 @@ void ZipFile::readLOC( ZipEntry &rEntry ) aGrabber.seek(nPos); sal_Int32 nTestSig = aGrabber.ReadInt32(); if (nTestSig != LOCSIG) - throw ZipIOException("Invalid LOC header (bad signature)" ); + throw ZipIOException(u"Invalid LOC header (bad signature)"_ustr ); // Ignore all (duplicated) information from the local file header. // various programs produced "broken" zip files; even LO at some point. @@ -978,7 +978,7 @@ void ZipFile::readLOC( ZipEntry &rEntry ) } if ( bBroken && !bRecoveryMode ) - throw ZipIOException("The stream seems to be broken!" ); + throw ZipIOException(u"The stream seems to be broken!"_ustr ); } sal_Int32 ZipFile::findEND() @@ -998,7 +998,7 @@ sal_Int32 ZipFile::findEND() auto nSize = nLength - nEnd; if (nSize != aGrabber.readBytes(aBuffer, nSize)) - throw ZipException("Zip END signature not found!" ); + throw ZipException(u"Zip END signature not found!"_ustr ); const sal_Int8 *pBuffer = aBuffer.getConstArray(); @@ -1012,17 +1012,17 @@ sal_Int32 ZipFile::findEND() } catch ( IllegalArgumentException& ) { - throw ZipException("Zip END signature not found!" ); + throw ZipException(u"Zip END signature not found!"_ustr ); } catch ( NotConnectedException& ) { - throw ZipException("Zip END signature not found!" ); + throw ZipException(u"Zip END signature not found!"_ustr ); } catch ( BufferSizeExceededException& ) { - throw ZipException("Zip END signature not found!" ); + throw ZipException(u"Zip END signature not found!"_ustr ); } - throw ZipException("Zip END signature not found!" ); + throw ZipException(u"Zip END signature not found!"_ustr ); } sal_Int32 ZipFile::readCEN() @@ -1042,25 +1042,25 @@ sal_Int32 ZipFile::readCEN() sal_Int32 nCenOff = aGrabber.ReadInt32(); if ( nTotal * CENHDR > nCenLen ) - throw ZipException("invalid END header (bad entry count)" ); + throw ZipException(u"invalid END header (bad entry count)"_ustr ); if ( nTotal > ZIP_MAXENTRIES ) - throw ZipException("too many entries in ZIP File" ); + throw ZipException(u"too many entries in ZIP File"_ustr ); if ( nCenLen < 0 || nCenLen > nEndPos ) - throw ZipException("Invalid END header (bad central directory size)" ); + throw ZipException(u"Invalid END header (bad central directory size)"_ustr ); nCenPos = nEndPos - nCenLen; if ( nCenOff < 0 || nCenOff > nCenPos ) - throw ZipException("Invalid END header (bad central directory size)" ); + throw ZipException(u"Invalid END header (bad central directory size)"_ustr ); nLocPos = nCenPos - nCenOff; aGrabber.seek( nCenPos ); Sequence < sal_Int8 > aCENBuffer ( nCenLen ); sal_Int64 nRead = aGrabber.readBytes ( aCENBuffer, nCenLen ); if ( static_cast < sal_Int64 > ( nCenLen ) != nRead ) - throw ZipException ("Error reading CEN into memory buffer!" ); + throw ZipException (u"Error reading CEN into memory buffer!"_ustr ); MemoryByteGrabber aMemGrabber(aCENBuffer); @@ -1072,19 +1072,19 @@ sal_Int32 ZipFile::readCEN() { sal_Int32 nTestSig = aMemGrabber.ReadInt32(); if ( nTestSig != CENSIG ) - throw ZipException("Invalid CEN header (bad signature)" ); + throw ZipException(u"Invalid CEN header (bad signature)"_ustr ); sal_uInt16 versionMadeBy = aMemGrabber.ReadUInt16(); aEntry.nVersion = aMemGrabber.ReadInt16(); aEntry.nFlag = aMemGrabber.ReadInt16(); if ( ( aEntry.nFlag & 1 ) == 1 ) - throw ZipException("Invalid CEN header (encrypted entry)" ); + throw ZipException(u"Invalid CEN header (encrypted entry)"_ustr ); aEntry.nMethod = aMemGrabber.ReadInt16(); if ( aEntry.nMethod != STORED && aEntry.nMethod != DEFLATED) - throw ZipException("Invalid CEN header (bad compression method)" ); + throw ZipException(u"Invalid CEN header (bad compression method)"_ustr ); aEntry.nTime = aMemGrabber.ReadInt32(); aEntry.nCrc = aMemGrabber.ReadInt32(); @@ -1099,16 +1099,16 @@ sal_Int32 ZipFile::readCEN() sal_uInt64 nOffset = aMemGrabber.ReadUInt32(); if ( aEntry.nPathLen < 0 ) - throw ZipException("unexpected name length" ); + throw ZipException(u"unexpected name length"_ustr ); if ( nCommentLen < 0 ) - throw ZipException("unexpected comment length" ); + throw ZipException(u"unexpected comment length"_ustr ); if ( aEntry.nExtraLen < 0 ) - throw ZipException("unexpected extra header info length" ); + throw ZipException(u"unexpected extra header info length"_ustr ); if (aEntry.nPathLen > aMemGrabber.remainingSize()) - throw ZipException("name too long"); + throw ZipException(u"name too long"_ustr); // read always in UTF8, some tools seem not to set UTF8 bit aEntry.sPath = OUString( reinterpret_cast<char const *>(aMemGrabber.getCurrentPos()), @@ -1116,7 +1116,7 @@ sal_Int32 ZipFile::readCEN() RTL_TEXTENCODING_UTF8 ); if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( aEntry.sPath, true ) ) - throw ZipException("Zip entry has an invalid name." ); + throw ZipException(u"Zip entry has an invalid name."_ustr ); aMemGrabber.skipBytes(aEntry.nPathLen); @@ -1129,9 +1129,9 @@ sal_Int32 ZipFile::readCEN() aEntry.nOffset = nOffset; if (o3tl::checked_add<sal_Int64>(aEntry.nOffset, nLocPos, aEntry.nOffset)) - throw ZipException("Integer-overflow"); + throw ZipException(u"Integer-overflow"_ustr); if (o3tl::checked_multiply<sal_Int64>(aEntry.nOffset, -1, aEntry.nOffset)) - throw ZipException("Integer-overflow"); + throw ZipException(u"Integer-overflow"_ustr); aMemGrabber.skipBytes(nCommentLen); @@ -1147,7 +1147,7 @@ sal_Int32 ZipFile::readCEN() } if (nCount != nTotal) - throw ZipException("Count != Total" ); + throw ZipException(u"Count != Total"_ustr ); } catch ( IllegalArgumentException & ) { @@ -1414,15 +1414,15 @@ void ZipFile::recover() } catch ( IllegalArgumentException& ) { - throw ZipException("Zip END signature not found!" ); + throw ZipException(u"Zip END signature not found!"_ustr ); } catch ( NotConnectedException& ) { - throw ZipException("Zip END signature not found!" ); + throw ZipException(u"Zip END signature not found!"_ustr ); } catch ( BufferSizeExceededException& ) { - throw ZipException("Zip END signature not found!" ); + throw ZipException(u"Zip END signature not found!"_ustr ); } } diff --git a/package/source/zipapi/ZipOutputStream.cxx b/package/source/zipapi/ZipOutputStream.cxx index 402a2930c0e2..87a713220a8b 100644 --- a/package/source/zipapi/ZipOutputStream.cxx +++ b/package/source/zipapi/ZipOutputStream.cxx @@ -219,7 +219,7 @@ static sal_uInt32 getTruncated( sal_Int64 nNum, bool *pIsTruncated ) void ZipOutputStream::writeCEN( const ZipEntry &rEntry ) { if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( rEntry.sPath, true ) ) - throw IOException("Unexpected character is used in file name." ); + throw IOException(u"Unexpected character is used in file name."_ustr ); OString sUTF8Name = OUStringToOString( rEntry.sPath, RTL_TEXTENCODING_UTF8 ); sal_Int16 nNameLength = static_cast < sal_Int16 > ( sUTF8Name.getLength() ); @@ -293,7 +293,7 @@ void ZipOutputStream::writeLOC( ZipEntry *pEntry, bool bEncrypt ) const ZipEntry &rEntry = *m_pCurrentEntry; if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( rEntry.sPath, true ) ) - throw IOException("Unexpected character is used in file name." ); + throw IOException(u"Unexpected character is used in file name."_ustr ); OString sUTF8Name = OUStringToOString( rEntry.sPath, RTL_TEXTENCODING_UTF8 ); sal_Int16 nNameLength = static_cast < sal_Int16 > ( sUTF8Name.getLength() ); diff --git a/package/source/zipapi/blowfishcontext.cxx b/package/source/zipapi/blowfishcontext.cxx index 1b5ed4a14893..f848f717c54f 100644 --- a/package/source/zipapi/blowfishcontext.cxx +++ b/package/source/zipapi/blowfishcontext.cxx @@ -33,7 +33,7 @@ uno::Reference< xml::crypto::XCipherContext > BlowfishCFB8CipherContext::Create( ::rtl::Reference< BlowfishCFB8CipherContext > xResult = new BlowfishCFB8CipherContext(); xResult->m_pCipher = rtl_cipher_create( rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream ); if ( !xResult->m_pCipher ) - throw uno::RuntimeException("Can not create cipher!" ); + throw uno::RuntimeException(u"Can not create cipher!"_ustr ); if ( rtl_Cipher_E_None != rtl_cipher_init( xResult->m_pCipher, @@ -43,7 +43,7 @@ uno::Reference< xml::crypto::XCipherContext > BlowfishCFB8CipherContext::Create( reinterpret_cast< const sal_uInt8* >( aInitVector.getConstArray() ), aInitVector.getLength() ) ) { - throw uno::RuntimeException("Can not initialize cipher!" ); + throw uno::RuntimeException(u"Can not initialize cipher!"_ustr ); } xResult->m_bEncrypt = bEncrypt; @@ -88,7 +88,7 @@ uno::Sequence< sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::convertWithCipherC if ( rtl_Cipher_E_None != nError ) { - throw uno::RuntimeException("Can not decrypt/encrypt with cipher!" ); + throw uno::RuntimeException(u"Can not decrypt/encrypt with cipher!"_ustr ); } return aResult; diff --git a/package/source/zipapi/sha1context.cxx b/package/source/zipapi/sha1context.cxx index 4b6cbd2d339d..6706259a6666 100644 --- a/package/source/zipapi/sha1context.cxx +++ b/package/source/zipapi/sha1context.cxx @@ -33,7 +33,7 @@ uno::Reference<xml::crypto::XDigestContext> StarOfficeSHA1DigestContext::Create( ::rtl::Reference<StarOfficeSHA1DigestContext> xResult = new StarOfficeSHA1DigestContext(); xResult->m_pDigest = rtl_digest_createSHA1(); if ( !xResult->m_pDigest ) - throw uno::RuntimeException("Can not create cipher!" ); + throw uno::RuntimeException(u"Can not create cipher!"_ustr ); return xResult; } diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 32b506953422..27770c2288d8 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -472,7 +472,7 @@ void ZipPackage::parseManifest() // if there is an encrypted inner package, there is no root // document, because instead there is a package, and it is not // an error - if (!m_xRootFolder->hasByName("encrypted-package")) + if (!m_xRootFolder->hasByName(u"encrypted-package"_ustr)) { m_bMediaTypeFallbackUsed = true; } @@ -481,8 +481,8 @@ void ZipPackage::parseManifest() else if ( !m_bForceRecovery ) { // the mimetype stream should contain the same information as manifest.xml - OUString const mediaTypeXML(m_xRootFolder->hasByName("encrypted-package") - ? m_xRootFolder->doGetByName("encrypted-package").xPackageEntry->GetMediaType() + OUString const mediaTypeXML(m_xRootFolder->hasByName(u"encrypted-package"_ustr) + ? m_xRootFolder->doGetByName(u"encrypted-package"_ustr).xPackageEntry->GetMediaType() : m_xRootFolder->GetMediaType()); if (mediaTypeXML != aPackageMediatype) { @@ -498,7 +498,7 @@ void ZipPackage::parseManifest() } m_bInconsistent = m_xRootFolder->LookForUnexpectedODF12Streams( - std::u16string_view(), m_xRootFolder->hasByName("encrypted-package")); + std::u16string_view(), m_xRootFolder->hasByName(u"encrypted-package"_ustr)); bool bODF12AndNewer = ( m_xRootFolder->GetVersion().compareTo( ODFVER_012_TEXT ) >= 0 ); if ( !m_bForceRecovery && bODF12AndNewer ) @@ -634,7 +634,7 @@ void ZipPackage::getZipFileContents() { ZipContentInfo& rInfo = pCurrent->doGetByName(sTemp); if (!rInfo.bFolder) - throw css::packages::zip::ZipIOException("Bad Zip File, stream as folder"); + throw css::packages::zip::ZipIOException(u"Bad Zip File, stream as folder"_ustr); pCurrent = rInfo.pFolder; } nOldIndex = nIndex+1; @@ -717,7 +717,7 @@ void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments ) Content aContent( m_aURL, uno::Reference< XCommandEnvironment >(), m_xContext ); - Any aAny = aContent.getPropertyValue("Size"); + Any aAny = aContent.getPropertyValue(u"Size"_ustr); sal_uInt64 aSize = 0; // kind of optimization: treat empty files as nonexistent files // and write to such files directly. Note that "Size" property is optional. @@ -940,7 +940,7 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName ) pPrevious = pCurrent; ZipContentInfo& rInfo = pCurrent->doGetByName(sTemp); if (!rInfo.bFolder) - throw css::packages::zip::ZipIOException("Bad Zip File, stream as folder"); + throw css::packages::zip::ZipIOException(u"Bad Zip File, stream as folder"_ustr); pCurrent = rInfo.pFolder; nOldIndex = nIndex+1; } @@ -1025,7 +1025,7 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName ) pPrevious = pCurrent; ZipContentInfo& rInfo = pCurrent->doGetByName(sTemp); if (!rInfo.bFolder) - throw css::packages::zip::ZipIOException("Bad Zip File, stream as folder"); + throw css::packages::zip::ZipIOException(u"Bad Zip File, stream as folder"_ustr); pCurrent = rInfo.pFolder; } else @@ -1055,7 +1055,7 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName ) catch (const uno::Exception&) { uno::Any e(::cppu::getCaughtException()); - throw lang::WrappedTargetRuntimeException("ZipPackage::hasByHierarchicalName", nullptr, e); + throw lang::WrappedTargetRuntimeException(u"ZipPackage::hasByHierarchicalName"_ustr, nullptr, e); } return false; } @@ -1160,10 +1160,10 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const std::vector< // Add at least the standard default entries. uno::Sequence< beans::StringPair > aDefaultsSequence { - { "xml", "application/xml" }, - { "rels", "application/vnd.openxmlformats-package.relationships+xml" }, - { "png", "image/png" }, - { "jpeg", "image/jpeg" } + { u"xml"_ustr, u"application/xml"_ustr }, + { u"rels"_ustr, u"application/vnd.openxmlformats-package.relationships+xml"_ustr }, + { u"png"_ustr, u"image/png"_ustr }, + { u"jpeg"_ustr, u"image/jpeg"_ustr } }; uno::Sequence< beans::StringPair > aOverridesSequence(aManList.size()); @@ -1338,7 +1338,7 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile() pPropSeq [PKG_MNFST_VERSION].Name = sVersion; pPropSeq [PKG_MNFST_VERSION].Value <<= m_xRootFolder->GetVersion(); pPropSeq [PKG_MNFST_FULLPATH].Name = sFullPath; - pPropSeq [PKG_MNFST_FULLPATH].Value <<= OUString("/"); + pPropSeq [PKG_MNFST_FULLPATH].Value <<= u"/"_ustr; if( bIsGpgEncrypt ) { @@ -1370,7 +1370,7 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile() } // call saveContents - it will recursively save sub-directories - m_xRootFolder->saveContents("", aManList, aZipOut, GetEncryptionKey(), + m_xRootFolder->saveContents(u""_ustr, aManList, aZipOut, GetEncryptionKey(), oPBKDF2IterationCount, oArgon2Args, aRandomPool.get()); } @@ -1460,7 +1460,7 @@ uno::Reference< XActiveDataStreamer > ZipPackage::openOriginalForOutput() try { Exception aDetect; - Any aAny = aOriginalContent.setPropertyValue("Size", Any( sal_Int64(0) ) ); + Any aAny = aOriginalContent.setPropertyValue(u"Size"_ustr, Any( sal_Int64(0) ) ); if( !( aAny >>= aDetect ) ) bTruncSuccess = true; } @@ -1483,7 +1483,7 @@ uno::Reference< XActiveDataStreamer > ZipPackage::openOriginalForOutput() aArg.Sink = xSink; aArg.Properties = uno::Sequence< Property >( 0 ); // unused - aOriginalContent.executeCommand("open", Any( aArg ) ); + aOriginalContent.executeCommand(u"open"_ustr, Any( aArg ) ); } catch( Exception& ) { @@ -1651,7 +1651,7 @@ void SAL_CALL ZipPackage::commitChanges() m_xContext ); OUString sTempURL; - Any aAny = xPropSet->getPropertyValue ("Uri"); + Any aAny = xPropSet->getPropertyValue (u"Uri"_ustr); aAny >>= sTempURL; TransferInfo aInfo; @@ -1662,7 +1662,7 @@ void SAL_CALL ZipPackage::commitChanges() rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); // if the file is still not corrupted, it can become after the next step - aContent.executeCommand ("transfer", Any(aInfo) ); + aContent.executeCommand (u"transfer"_ustr, Any(aInfo) ); } catch ( const css::uno::Exception& ) { @@ -1694,9 +1694,9 @@ void ZipPackage::DisconnectFromTargetAndThrowException_Impl( const uno::Referenc OUString aTempURL; try { uno::Reference< beans::XPropertySet > xTempFile( xTempStream, uno::UNO_QUERY_THROW ); - uno::Any aUrl = xTempFile->getPropertyValue("Uri"); + uno::Any aUrl = xTempFile->getPropertyValue(u"Uri"_ustr); aUrl >>= aTempURL; - xTempFile->setPropertyValue("RemoveFile", + xTempFile->setPropertyValue(u"RemoveFile"_ustr, uno::Any( false ) ); } catch ( uno::Exception& ) @@ -1752,12 +1752,12 @@ Sequence< ElementChange > SAL_CALL ZipPackage::getPendingChanges() OUString ZipPackage::getImplementationName() { - return "com.sun.star.packages.comp.ZipPackage"; + return u"com.sun.star.packages.comp.ZipPackage"_ustr; } Sequence< OUString > ZipPackage::getSupportedServiceNames() { - return { "com.sun.star.packages.Package" }; + return { u"com.sun.star.packages.Package"_ustr }; } sal_Bool SAL_CALL ZipPackage::supportsService( OUString const & rServiceName ) @@ -1902,16 +1902,16 @@ Any SAL_CALL ZipPackage::getPropertyValue( const OUString& PropertyName ) else if ( PropertyName == ENCRYPTION_ALGORITHMS_PROPERTY ) { ::comphelper::SequenceAsHashMap aAlgorithms; - aAlgorithms["StartKeyGenerationAlgorithm"] <<= m_nStartKeyGenerationID; - aAlgorithms["KeyDerivationFunction"] <<= m_nKeyDerivationFunctionID; - aAlgorithms["EncryptionAlgorithm"] <<= m_nCommonEncryptionID; + aAlgorithms[u"StartKeyGenerationAlgorithm"_ustr] <<= m_nStartKeyGenerationID; + aAlgorithms[u"KeyDerivationFunction"_ustr] <<= m_nKeyDerivationFunctionID; + aAlgorithms[u"EncryptionAlgorithm"_ustr] <<= m_nCommonEncryptionID; if (m_oChecksumDigestID) { - aAlgorithms["ChecksumAlgorithm"] <<= *m_oChecksumDigestID; + aAlgorithms[u"ChecksumAlgorithm"_ustr] <<= *m_oChecksumDigestID; } else { - aAlgorithms["ChecksumAlgorithm"]; + aAlgorithms[u"ChecksumAlgorithm"_ustr]; } return Any(aAlgorithms.getAsConstNamedValueList()); } @@ -1970,7 +1970,7 @@ extern "C" bool TestImportZip(SvStream& rStream) // explicitly tests the "RepairPackage" recovery mode rtl::Reference<ZipPackage> xPackage(new ZipPackage(comphelper::getProcessComponentContext())); css::uno::Reference<css::io::XInputStream> xStream(new utl::OInputStreamWrapper(rStream)); - css::uno::Sequence<Any> aArgs{ Any(xStream), Any(NamedValue("RepairPackage", Any(true))) }; + css::uno::Sequence<Any> aArgs{ Any(xStream), Any(NamedValue(u"RepairPackage"_ustr, Any(true))) }; xPackage->initialize(aArgs); return true; } diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx index bca4e46e1bc2..86cafeab55ba 100644 --- a/package/source/zippackage/ZipPackageFolder.cxx +++ b/package/source/zippackage/ZipPackageFolder.cxx @@ -294,7 +294,7 @@ void ZipPackageFolder::saveContents( } bool bMimeTypeStreamStored = false; - OUString aMimeTypeStreamName("mimetype"); + OUString aMimeTypeStreamName(u"mimetype"_ustr); if ( m_nFormat == embed::StorageFormats::ZIP && rPath.isEmpty() ) { // let the "mimetype" stream in root folder be stored as the first stream if it is zip format @@ -381,12 +381,12 @@ void ZipPackageFolder::doInsertByName ( ZipPackageEntry *pEntry, bool bSetParent OUString ZipPackageFolder::getImplementationName() { - return "ZipPackageFolder"; + return u"ZipPackageFolder"_ustr; } uno::Sequence< OUString > ZipPackageFolder::getSupportedServiceNames() { - return { "com.sun.star.packages.PackageFolder" }; + return { u"com.sun.star.packages.PackageFolder"_ustr }; } sal_Bool SAL_CALL ZipPackageFolder::supportsService( OUString const & rServiceName ) diff --git a/package/source/zippackage/ZipPackageFolderEnumeration.cxx b/package/source/zippackage/ZipPackageFolderEnumeration.cxx index 080592c95ffa..a8c697c6fc26 100644 --- a/package/source/zippackage/ZipPackageFolderEnumeration.cxx +++ b/package/source/zippackage/ZipPackageFolderEnumeration.cxx @@ -53,12 +53,12 @@ uno::Any SAL_CALL ZipPackageFolderEnumeration::nextElement() OUString ZipPackageFolderEnumeration::getImplementationName() { - return "ZipPackageFolderEnumeration"; + return u"ZipPackageFolderEnumeration"_ustr; } uno::Sequence<OUString> ZipPackageFolderEnumeration::getSupportedServiceNames() { - uno::Sequence<OUString> aNames{ "com.sun.star.packages.PackageFolderEnumeration" }; + uno::Sequence<OUString> aNames{ u"com.sun.star.packages.PackageFolderEnumeration"_ustr }; return aNames; } diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index a8acd928fa50..59ec5a77b291 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -296,22 +296,22 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( uno::Reference< XPropertySet > xNewPSProps( xNewPackStream, UNO_QUERY_THROW ); // copy all the properties of this stream to the new stream - xNewPSProps->setPropertyValue("MediaType", Any( msMediaType ) ); - xNewPSProps->setPropertyValue("Compressed", Any( m_bToBeCompressed ) ); + xNewPSProps->setPropertyValue(u"MediaType"_ustr, Any( msMediaType ) ); + xNewPSProps->setPropertyValue(u"Compressed"_ustr, Any( m_bToBeCompressed ) ); if ( m_bToBeEncrypted ) { xNewPSProps->setPropertyValue(ENCRYPTION_KEY_PROPERTY, Any( aKey ) ); - xNewPSProps->setPropertyValue("Encrypted", Any( true ) ); + xNewPSProps->setPropertyValue(u"Encrypted"_ustr, Any( true ) ); } // insert a new stream in the package uno::Reference< XInterface > xTmp; - Any aRoot = pPackage->getByHierarchicalName("/"); + Any aRoot = pPackage->getByHierarchicalName(u"/"_ustr); aRoot >>= xTmp; uno::Reference< container::XNameContainer > xRootNameContainer( xTmp, UNO_QUERY_THROW ); uno::Reference< XInterface > xNPSDummy( xNewPackStream, UNO_QUERY ); - xRootNameContainer->insertByName("dummy", Any( xNPSDummy ) ); + xRootNameContainer->insertByName(u"dummy"_ustr, Any( xNPSDummy ) ); // commit the temporary package pPackage->commitChanges(); @@ -594,11 +594,11 @@ bool ZipPackageStream::saveChild( uno::Sequence<sal_Int8> aVector(GetIVSize()); if (rtl_random_getBytes(rRandomPool, aSalt.getArray(), 16) != rtl_Random_E_None) { - throw uno::RuntimeException("rtl_random_getBytes failed"); + throw uno::RuntimeException(u"rtl_random_getBytes failed"_ustr); } if (rtl_random_getBytes(rRandomPool, aVector.getArray(), aVector.getLength()) != rtl_Random_E_None) { - throw uno::RuntimeException("rtl_random_getBytes failed"); + throw uno::RuntimeException(u"rtl_random_getBytes failed"_ustr); } if ( !m_bHaveOwnKey ) { @@ -1349,12 +1349,12 @@ void ZipPackageStream::setSize ( const sal_Int64 nNewSize ) } OUString ZipPackageStream::getImplementationName() { - return "ZipPackageStream"; + return u"ZipPackageStream"_ustr; } Sequence< OUString > ZipPackageStream::getSupportedServiceNames() { - return { "com.sun.star.packages.PackageStream" }; + return { u"com.sun.star.packages.PackageStream"_ustr }; } sal_Bool SAL_CALL ZipPackageStream::supportsService( OUString const & rServiceName ) diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx index 8056347bfb35..0b659a420e73 100644 --- a/package/source/zippackage/zipfileaccess.cxx +++ b/package/source/zippackage/zipfileaccess.cxx @@ -285,7 +285,7 @@ uno::Any SAL_CALL OZipFileAccess::getByName( const OUString& aName ) catch (const uno::Exception&) { css::uno::Any anyEx = cppu::getCaughtException(); - throw lang::WrappedTargetException( "This package is unusable!", + throw lang::WrappedTargetException( u"This package is unusable!"_ustr, getXWeak(), anyEx); } @@ -453,7 +453,7 @@ void SAL_CALL OZipFileAccess::removeEventListener( const uno::Reference< lang::X OUString SAL_CALL OZipFileAccess::getImplementationName() { - return "com.sun.star.comp.package.zip.ZipFileAccess"; + return u"com.sun.star.comp.package.zip.ZipFileAccess"_ustr; } sal_Bool SAL_CALL OZipFileAccess::supportsService( const OUString& ServiceName ) @@ -463,8 +463,8 @@ sal_Bool SAL_CALL OZipFileAccess::supportsService( const OUString& ServiceName ) uno::Sequence< OUString > SAL_CALL OZipFileAccess::getSupportedServiceNames() { - return { "com.sun.star.packages.zip.ZipFileAccess", - "com.sun.star.comp.packages.zip.ZipFileAccess" }; + return { u"com.sun.star.packages.zip.ZipFileAccess"_ustr, + u"com.sun.star.comp.packages.zip.ZipFileAccess"_ustr }; } |