diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-06-01 16:57:14 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-06-01 23:00:26 +0200 |
commit | eebd84b337506c8fff151493f9b51bd127dbc89f (patch) | |
tree | 45284084864d587e245d6f5eaa1b19b546ec1dd5 | |
parent | 1193c331945481dd155a55c6695ff6fd88bd3d10 (diff) |
loplugin:stringview (clang-cl)
Change-Id: Id1f8f24fec638efcdf5a04ca7253e6f401afd2fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116548
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | basic/source/runtime/dllmgr-x64.cxx | 3 | ||||
-rw-r--r-- | embeddedobj/source/msole/olecomponent.cxx | 2 | ||||
-rw-r--r-- | extensions/source/ole/oleobjw.cxx | 10 | ||||
-rw-r--r-- | svl/source/crypto/cryptosign.cxx | 12 |
4 files changed, 15 insertions, 12 deletions
diff --git a/basic/source/runtime/dllmgr-x64.cxx b/basic/source/runtime/dllmgr-x64.cxx index bbffbe51f6c8..8fd83b116440 100644 --- a/basic/source/runtime/dllmgr-x64.cxx +++ b/basic/source/runtime/dllmgr-x64.cxx @@ -27,6 +27,7 @@ #include <algorithm> #include <cstddef> #include <map> +#include <string_view> #include <vector> #include <basic/sbx.hxx> @@ -496,7 +497,7 @@ ErrCode call( // require similar treatment, too: bool special = dll.equalsIgnoreAsciiCase("KERNEL32.DLL") && - (proc.name == OString("GetLogicalDriveStringsA")); + (proc.name == std::string_view("GetLogicalDriveStringsA")); for (sal_uInt32 i = 1; i < (arguments == nullptr ? 0 : arguments->Count()); ++i) { ErrCode e = marshal(true, arguments->Get(i), special && i == 2, stack, stack.size(), diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx index 19818bea342e..da5b02874b07 100644 --- a/embeddedobj/source/msole/olecomponent.cxx +++ b/embeddedobj/source/msole/olecomponent.cxx @@ -418,7 +418,7 @@ static OUString WinAccToVcl_Impl( const sal_Unicode* pStr ) } else { - aResult += OUString( pStr, 1 ); + aResult += OUStringChar( *pStr ); pStr++; } } diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx index 91f136a8a235..b9123a031ee8 100644 --- a/extensions/source/ole/oleobjw.cxx +++ b/extensions/source/ole/oleobjw.cxx @@ -1427,9 +1427,8 @@ uno::Any SAL_CALL IUnknownWrapper::directInvoke( const OUString& aName, const un "DISP_E_BADVARTYPE.", nullptr); break; case DISP_E_EXCEPTION: - message = "[automation bridge]: " - + OUString(o3tl::toU(excepinfo.bstrDescription), - ::SysStringLen(excepinfo.bstrDescription)); + message = OUString::Concat("[automation bridge]: ") + + o3tl::toU(excepinfo.bstrDescription); throw InvocationTargetException(message, Reference<XInterface>(), Any()); break; case DISP_E_MEMBERNOTFOUND: @@ -2049,9 +2048,8 @@ Any IUnknownWrapper::invokeWithDispIdComTlb(FuncDesc& aFuncDesc, "DISP_E_BADVARTYPE.", nullptr); break; case DISP_E_EXCEPTION: - message = "[automation bridge]: " - + OUString(o3tl::toU(excepinfo.bstrDescription), - ::SysStringLen(excepinfo.bstrDescription)); + message = OUString::Concat("[automation bridge]: ") + + o3tl::toU(excepinfo.bstrDescription); throw InvocationTargetException(message, Reference<XInterface>(), Any()); break; diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx index 6177dbb9d29c..b99dab35bf62 100644 --- a/svl/source/crypto/cryptosign.cxx +++ b/svl/source/crypto/cryptosign.cxx @@ -7,6 +7,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <sal/config.h> + +#include <string_view> + #include <svl/cryptosign.hxx> #include <svl/sigstruct.hxx> #include <config_crypto.h> @@ -2131,9 +2135,9 @@ bool Signing::Verify(const std::vector<unsigned char>& aData, return false; } auto pDigestID = reinterpret_cast<CRYPT_ALGORITHM_IDENTIFIER*>(pDigestBytes.get()); - if (OString(szOID_NIST_sha256) == pDigestID->pszObjId) + if (std::string_view(szOID_NIST_sha256) == pDigestID->pszObjId) rInformation.nDigestID = xml::crypto::DigestID::SHA256; - else if (OString(szOID_RSA_SHA1RSA) == pDigestID->pszObjId || OString(szOID_OIWSEC_sha1) == pDigestID->pszObjId) + else if (std::string_view(szOID_RSA_SHA1RSA) == pDigestID->pszObjId || std::string_view(szOID_OIWSEC_sha1) == pDigestID->pszObjId) rInformation.nDigestID = xml::crypto::DigestID::SHA1; else // Don't error out here, we can still verify the message digest correctly, just the digest ID won't be set. @@ -2239,7 +2243,7 @@ bool Signing::Verify(const std::vector<unsigned char>& aData, * { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) * smime(16) id-aa(2) 47 } */ - if (OString("1.2.840.113549.1.9.16.2.47") == rAttr.pszObjId) + if (std::string_view("1.2.840.113549.1.9.16.2.47") == rAttr.pszObjId) { rInformation.bHasSigningCertificate = true; break; @@ -2262,7 +2266,7 @@ bool Signing::Verify(const std::vector<unsigned char>& aData, { CRYPT_ATTRIBUTE& rAttr = pSignedAttributes->rgAttr[nAttr]; // Timestamp blob - if (OString("1.2.840.113549.1.9.16.2.14") == rAttr.pszObjId) + if (std::string_view("1.2.840.113549.1.9.16.2.14") == rAttr.pszObjId) { PCRYPT_TIMESTAMP_CONTEXT pTsContext; if (!CryptVerifyTimeStampSignature(rAttr.rgValue->pbData, rAttr.rgValue->cbData, nullptr, 0, nullptr, &pTsContext, nullptr, nullptr)) |