diff options
author | Noel <noelgrandin@gmail.com> | 2020-11-25 08:14:07 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-11-30 12:32:14 +0100 |
commit | 8332d6d8200e8ca1f22dd98d9373efd5a431d09c (patch) | |
tree | dd45d452202998297b8562743ea6345462304d04 /comphelper | |
parent | d05a4cfbdcece491f7385dbeaa7eca03f2fdc1d5 (diff) |
loplugin:stringviewparam include comparisons with string literals
Change-Id: I8ba1214500dddaf413c506a4b82f43d63cda804b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106559
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/qa/unit/test_hash.cxx | 2 | ||||
-rw-r--r-- | comphelper/source/misc/docpasswordhelper.cxx | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/comphelper/qa/unit/test_hash.cxx b/comphelper/qa/unit/test_hash.cxx index 8b6e5a393d23..0bcc3f8ed56c 100644 --- a/comphelper/qa/unit/test_hash.cxx +++ b/comphelper/qa/unit/test_hash.cxx @@ -121,7 +121,7 @@ void TestHash::testSHA512_NoSaltNoSpin() void TestHash::testSHA512_saltspin() { const OUString aHash = comphelper::DocPasswordHelper::GetOoxHashAsBase64( "pwd", "876MLoKTq42+/DLp415iZQ==", 100000, - comphelper::Hash::IterCount::APPEND, "SHA-512"); + comphelper::Hash::IterCount::APPEND, u"SHA-512"); CPPUNIT_ASSERT_EQUAL(OUString("5l3mgNHXpWiFaBPv5Yso1Xd/UifWvQWmlDnl/hsCYbFT2sJCzorjRmBCQ/3qeDu6Q/4+GIE8a1DsdaTwYh1q2g=="), aHash); } diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx index d528d57e5cbf..4cc0f5c74269 100644 --- a/comphelper/source/misc/docpasswordhelper.cxx +++ b/comphelper/source/misc/docpasswordhelper.cxx @@ -260,16 +260,16 @@ std::vector<unsigned char> DocPasswordHelper::GetOoxHashAsVector( const std::vector<unsigned char>& rSaltValue, sal_uInt32 nSpinCount, comphelper::Hash::IterCount eIterCount, - const OUString& rAlgorithmName) + std::u16string_view rAlgorithmName) { comphelper::HashType eType; - if (rAlgorithmName == "SHA-512" || rAlgorithmName == "SHA512") + if (rAlgorithmName == u"SHA-512" || rAlgorithmName == u"SHA512") eType = comphelper::HashType::SHA512; - else if (rAlgorithmName == "SHA-256" || rAlgorithmName == "SHA256") + else if (rAlgorithmName == u"SHA-256" || rAlgorithmName == u"SHA256") eType = comphelper::HashType::SHA256; - else if (rAlgorithmName == "SHA-1" || rAlgorithmName == "SHA1") // "SHA1" might be in the wild + else if (rAlgorithmName == u"SHA-1" || rAlgorithmName == u"SHA1") // "SHA1" might be in the wild eType = comphelper::HashType::SHA1; - else if (rAlgorithmName == "MD5") + else if (rAlgorithmName == u"MD5") eType = comphelper::HashType::MD5; else return std::vector<unsigned char>(); @@ -283,7 +283,7 @@ css::uno::Sequence<sal_Int8> DocPasswordHelper::GetOoxHashAsSequence( const OUString& rSaltValue, sal_uInt32 nSpinCount, comphelper::Hash::IterCount eIterCount, - const OUString& rAlgorithmName) + std::u16string_view rAlgorithmName) { std::vector<unsigned char> aSaltVec; if (!rSaltValue.isEmpty()) @@ -303,7 +303,7 @@ OUString DocPasswordHelper::GetOoxHashAsBase64( const OUString& rSaltValue, sal_uInt32 nSpinCount, comphelper::Hash::IterCount eIterCount, - const OUString& rAlgorithmName) + std::u16string_view rAlgorithmName) { css::uno::Sequence<sal_Int8> aSeq( GetOoxHashAsSequence( rPassword, rSaltValue, nSpinCount, eIterCount, rAlgorithmName)); |