[Libreoffice-commits] core.git: basic/source embeddedobj/source extensions/source svl/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 1 21:01:13 UTC 2021


 basic/source/runtime/dllmgr-x64.cxx       |    3 ++-
 embeddedobj/source/msole/olecomponent.cxx |    2 +-
 extensions/source/ole/oleobjw.cxx         |   10 ++++------
 svl/source/crypto/cryptosign.cxx          |   12 ++++++++----
 4 files changed, 15 insertions(+), 12 deletions(-)

New commits:
commit eebd84b337506c8fff151493f9b51bd127dbc89f
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Jun 1 16:57:14 2021 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Jun 1 23:00:26 2021 +0200

    loplugin:stringview (clang-cl)
    
    Change-Id: Id1f8f24fec638efcdf5a04ca7253e6f401afd2fe
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116548
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

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))


More information about the Libreoffice-commits mailing list