diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-10 08:26:22 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-10 09:51:34 +0200 |
commit | 239ceb315521d9e88fb8290ba391c70a53095af4 (patch) | |
tree | 89d2c12874823ae5eea38385e5f89d5cc902b707 /oox/source/crypto | |
parent | 58a9c936bb065384d50e122ee2ac9037dd60cc32 (diff) |
loplugin:ostr in oox
Change-Id: I08124ce2da1facbe2e84aa4a7a8e25fec24fa962
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167428
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox/source/crypto')
-rw-r--r-- | oox/source/crypto/AgileEngine.cxx | 6 | ||||
-rw-r--r-- | oox/source/crypto/CryptTools.cxx | 16 | ||||
-rw-r--r-- | oox/source/crypto/DocumentDecryption.cxx | 4 | ||||
-rw-r--r-- | oox/source/crypto/Standard2007Engine.cxx | 2 | ||||
-rw-r--r-- | oox/source/crypto/StrongEncryptionDataSpace.cxx | 16 |
5 files changed, 22 insertions, 22 deletions
diff --git a/oox/source/crypto/AgileEngine.cxx b/oox/source/crypto/AgileEngine.cxx index 857034777357..5fa217d42044 100644 --- a/oox/source/crypto/AgileEngine.cxx +++ b/oox/source/crypto/AgileEngine.cxx @@ -702,11 +702,11 @@ bool AgileEngine::encryptEncryptionKey(OUString const & rPassword) bool AgileEngine::setupEncryption(OUString const & rPassword) { if (meEncryptionPreset == AgileEncryptionPreset::AES_128_SHA1) - setupEncryptionParameters({ 100000, 16, 128, 20, 16, OUString("AES"), OUString("ChainingModeCBC"), OUString("SHA1") }); + setupEncryptionParameters({ 100000, 16, 128, 20, 16, u"AES"_ustr, u"ChainingModeCBC"_ustr, u"SHA1"_ustr }); else if (meEncryptionPreset == AgileEncryptionPreset::AES_128_SHA384) - setupEncryptionParameters({ 100000, 16, 128, 48, 16, OUString("AES"), OUString("ChainingModeCBC"), OUString("SHA384") }); + setupEncryptionParameters({ 100000, 16, 128, 48, 16, u"AES"_ustr, u"ChainingModeCBC"_ustr, u"SHA384"_ustr }); else - setupEncryptionParameters({ 100000, 16, 256, 64, 16, OUString("AES"), OUString("ChainingModeCBC"), OUString("SHA512") }); + setupEncryptionParameters({ 100000, 16, 256, 64, 16, u"AES"_ustr, u"ChainingModeCBC"_ustr, u"SHA512"_ustr }); return setupEncryptionKey(rPassword); } diff --git a/oox/source/crypto/CryptTools.cxx b/oox/source/crypto/CryptTools.cxx index 17729828ac42..e8e842abeb43 100644 --- a/oox/source/crypto/CryptTools.cxx +++ b/oox/source/crypto/CryptTools.cxx @@ -227,7 +227,7 @@ struct CryptoImpl int wrap_key_len = PK11_GetBestKeyLength(mSlot, wrap_mechanism); mWrapKey = PK11_KeyGen(mSlot, wrap_mechanism, nullptr, wrap_key_len, nullptr); if (!mWrapKey) - throw css::uno::RuntimeException("PK11_KeyGen SymKey failure", css::uno::Reference<css::uno::XInterface>()); + throw css::uno::RuntimeException(u"PK11_KeyGen SymKey failure"_ustr, css::uno::Reference<css::uno::XInterface>()); /* * Encrypt authkey with wrapping key @@ -239,7 +239,7 @@ struct CryptoImpl SECItem tmp_sec_item = {}; mWrapKeyContext = PK11_CreateContextBySymKey(wrap_mechanism, CKA_ENCRYPT, mWrapKey, &tmp_sec_item); if (!mWrapKeyContext) - throw css::uno::RuntimeException("PK11_CreateContextBySymKey failure", css::uno::Reference<css::uno::XInterface>()); + throw css::uno::RuntimeException(u"PK11_CreateContextBySymKey failure"_ustr, css::uno::Reference<css::uno::XInterface>()); unsigned char wrapped_key_data[MAX_WRAPPED_KEY_LEN]; int wrapped_key_len = sizeof(wrapped_key_data); @@ -247,11 +247,11 @@ struct CryptoImpl if (PK11_CipherOp(mWrapKeyContext, wrapped_key_data, &wrapped_key_len, sizeof(wrapped_key_data), key->data, key->len) != SECSuccess) { - throw css::uno::RuntimeException("PK11_CipherOp failure", css::uno::Reference<css::uno::XInterface>()); + throw css::uno::RuntimeException(u"PK11_CipherOp failure"_ustr, css::uno::Reference<css::uno::XInterface>()); } if (PK11_Finalize(mWrapKeyContext) != SECSuccess) - throw css::uno::RuntimeException("PK11_Finalize failure", css::uno::Reference<css::uno::XInterface>()); + throw css::uno::RuntimeException(u"PK11_Finalize failure"_ustr, css::uno::Reference<css::uno::XInterface>()); /* * Finally unwrap sym key @@ -300,7 +300,7 @@ struct CryptoImpl mSlot = PK11_GetBestSlot(mechanism, nullptr); if (!mSlot) - throw css::uno::RuntimeException("NSS Slot failure", css::uno::Reference<css::uno::XInterface>()); + throw css::uno::RuntimeException(u"NSS Slot failure"_ustr, css::uno::Reference<css::uno::XInterface>()); SECItem keyItem; keyItem.type = siBuffer; @@ -309,7 +309,7 @@ struct CryptoImpl mSymKey = ImportSymKey(mechanism, CKA_ENCRYPT, &keyItem); if (!mSymKey) - throw css::uno::RuntimeException("NSS SymKey failure", css::uno::Reference<css::uno::XInterface>()); + throw css::uno::RuntimeException(u"NSS SymKey failure"_ustr, css::uno::Reference<css::uno::XInterface>()); mSecParam = PK11_ParamFromIV(mechanism, pIvItem); mContext = PK11_CreateContextBySymKey(mechanism, operation, mSymKey, mSecParam); @@ -338,7 +338,7 @@ struct CryptoImpl mSlot = PK11_GetBestSlot(aMechanism, nullptr); if (!mSlot) - throw css::uno::RuntimeException("NSS Slot failure", css::uno::Reference<css::uno::XInterface>()); + throw css::uno::RuntimeException(u"NSS Slot failure"_ustr, css::uno::Reference<css::uno::XInterface>()); SECItem aKeyItem; aKeyItem.data = rKey.data(); @@ -346,7 +346,7 @@ struct CryptoImpl mSymKey = ImportSymKey(aMechanism, CKA_SIGN, &aKeyItem); if (!mSymKey) - throw css::uno::RuntimeException("NSS SymKey failure", css::uno::Reference<css::uno::XInterface>()); + throw css::uno::RuntimeException(u"NSS SymKey failure"_ustr, css::uno::Reference<css::uno::XInterface>()); SECItem param; param.data = nullptr; diff --git a/oox/source/crypto/DocumentDecryption.cxx b/oox/source/crypto/DocumentDecryption.cxx index 858558433cba..b6963f22c75e 100644 --- a/oox/source/crypto/DocumentDecryption.cxx +++ b/oox/source/crypto/DocumentDecryption.cxx @@ -99,7 +99,7 @@ bool DocumentDecryption::readEncryptionInfo() // Read 0x6DataSpaces/DataSpaceMap uno::Reference<io::XInputStream> xDataSpaceMap - = mrOleStorage.openInputStream("\006DataSpaces/DataSpaceMap"); + = mrOleStorage.openInputStream(u"\006DataSpaces/DataSpaceMap"_ustr); OUString sDataSpaceName; if (xDataSpaceMap.is()) @@ -202,7 +202,7 @@ bool DocumentDecryption::decrypt(const uno::Reference<io::XStream>& xDocumentStr // open the required input streams in the encrypted package uno::Reference<io::XInputStream> xEncryptedPackage - = mrOleStorage.openInputStream("EncryptedPackage"); + = mrOleStorage.openInputStream(u"EncryptedPackage"_ustr); // create temporary file for unencrypted package uno::Reference<io::XOutputStream> xDecryptedPackage = xDocumentStream->getOutputStream(); diff --git a/oox/source/crypto/Standard2007Engine.cxx b/oox/source/crypto/Standard2007Engine.cxx index bcc3dc558ff3..792c6c27cc7a 100644 --- a/oox/source/crypto/Standard2007Engine.cxx +++ b/oox/source/crypto/Standard2007Engine.cxx @@ -29,7 +29,7 @@ void lclRandomGenerateValues(sal_uInt8* aArray, sal_uInt32 aSize) { if (rtl_random_getBytes(nullptr, aArray, aSize) != rtl_Random_E_None) { - throw css::uno::RuntimeException("rtl_random_getBytes failed"); + throw css::uno::RuntimeException(u"rtl_random_getBytes failed"_ustr); } } diff --git a/oox/source/crypto/StrongEncryptionDataSpace.cxx b/oox/source/crypto/StrongEncryptionDataSpace.cxx index fd1b823b8870..976b407fb7e9 100644 --- a/oox/source/crypto/StrongEncryptionDataSpace.cxx +++ b/oox/source/crypto/StrongEncryptionDataSpace.cxx @@ -130,8 +130,8 @@ sal_Bool StrongEncryptionDataSpace::setupEncryption(const Sequence<NamedValue>& Sequence<NamedValue> StrongEncryptionDataSpace::createEncryptionData(const OUString& rPassword) { comphelper::SequenceAsHashMap aEncryptionData; - aEncryptionData["OOXPassword"] <<= rPassword; - aEncryptionData["CryptoType"] <<= OUString("StrongEncryptionDataSpace"); + aEncryptionData[u"OOXPassword"_ustr] <<= rPassword; + aEncryptionData[u"CryptoType"_ustr] <<= u"StrongEncryptionDataSpace"_ustr; return aEncryptionData.getAsConstNamedValueList(); } @@ -150,7 +150,7 @@ StrongEncryptionDataSpace::encrypt(const Reference<XInputStream>& rxInputStream) Reference<XOutputStream> xOutputStream( mxContext->getServiceManager()->createInstanceWithContext( - "com.sun.star.io.SequenceOutputStream", mxContext), + u"com.sun.star.io.SequenceOutputStream"_ustr, mxContext), UNO_QUERY); mCryptoEngine->encrypt(rxInputStream, xOutputStream, aLength); @@ -158,11 +158,11 @@ StrongEncryptionDataSpace::encrypt(const Reference<XInputStream>& rxInputStream) comphelper::SequenceAsHashMap aStreams; Reference<XSequenceOutputStream> xEncodedFileSequenceStream(xOutputStream, UNO_QUERY); - aStreams["EncryptedPackage"] <<= xEncodedFileSequenceStream->getWrittenBytes(); + aStreams[u"EncryptedPackage"_ustr] <<= xEncodedFileSequenceStream->getWrittenBytes(); Reference<XOutputStream> aEncryptionInfoStream( mxContext->getServiceManager()->createInstanceWithContext( - "com.sun.star.io.SequenceOutputStream", mxContext), + u"com.sun.star.io.SequenceOutputStream"_ustr, mxContext), UNO_QUERY); BinaryXOutputStream rStream(aEncryptionInfoStream, false); mCryptoEngine->writeEncryptionInfo(rStream); @@ -170,14 +170,14 @@ StrongEncryptionDataSpace::encrypt(const Reference<XInputStream>& rxInputStream) Reference<XSequenceOutputStream> aEncryptionInfoSequenceStream(aEncryptionInfoStream, UNO_QUERY); - aStreams["EncryptionInfo"] <<= aEncryptionInfoSequenceStream->getWrittenBytes(); + aStreams[u"EncryptionInfo"_ustr] <<= aEncryptionInfoSequenceStream->getWrittenBytes(); return aStreams.getAsConstNamedValueList(); } OUString SAL_CALL StrongEncryptionDataSpace::getImplementationName() { - return "com.sun.star.comp.oox.crypto.StrongEncryptionDataSpace"; + return u"com.sun.star.comp.oox.crypto.StrongEncryptionDataSpace"_ustr; } sal_Bool SAL_CALL StrongEncryptionDataSpace::supportsService(const OUString& rServiceName) @@ -187,7 +187,7 @@ sal_Bool SAL_CALL StrongEncryptionDataSpace::supportsService(const OUString& rSe css::uno::Sequence<OUString> SAL_CALL StrongEncryptionDataSpace::getSupportedServiceNames() { - Sequence<OUString> aServices{ "com.sun.star.packages.PackageEncryption" }; + Sequence<OUString> aServices{ u"com.sun.star.packages.PackageEncryption"_ustr }; return aServices; } |