Skip to content

Commit c4879fd

Browse files
committed
Use std_string instead of string_view
1 parent f28e812 commit c4879fd

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

.clang-tidy

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ Checks: >
3030
-bugprone-switch-missing-default-case,
3131
-bugprone-undelegated-constructor,
3232
-bugprone-unused-return-value,
33-
-bugprone-suspicious-stringview-data-usage,
3433
-clang-analyzer-core.CallAndMessage,
3534
-clang-analyzer-core.NonNullParamChecker,
3635
-clang-analyzer-core.NullDereference,

src/credentials/attestation_verifier/TestDACRevocationDelegateImpl.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ CHIP_ERROR TestDACRevocationDelegateImpl::SetDeviceAttestationRevocationSetPath(
5050
void TestDACRevocationDelegateImpl::ClearDeviceAttestationRevocationSetPath()
5151
{
5252
// clear the string_view
53-
mDeviceAttestationRevocationSetPath = mDeviceAttestationRevocationSetPath.substr(0, 0);
53+
mDeviceAttestationRevocationSetPath.clear();
5454
}
5555

5656
// This method parses the below JSON Scheme
@@ -69,10 +69,10 @@ void TestDACRevocationDelegateImpl::ClearDeviceAttestationRevocationSetPath()
6969
bool TestDACRevocationDelegateImpl::IsEntryInRevocationSet(const CharSpan & akidHexStr, const CharSpan & issuerNameBase64Str,
7070
const CharSpan & serialNumberHexStr)
7171
{
72-
std::ifstream file(mDeviceAttestationRevocationSetPath.data());
72+
std::ifstream file(mDeviceAttestationRevocationSetPath.c_str());
7373
if (!file.is_open())
7474
{
75-
ChipLogError(NotSpecified, "Failed to open file: %s", mDeviceAttestationRevocationSetPath.data());
75+
ChipLogError(NotSpecified, "Failed to open file: %s", mDeviceAttestationRevocationSetPath.c_str());
7676
return false;
7777
}
7878

@@ -188,19 +188,19 @@ void TestDACRevocationDelegateImpl::CheckForRevokedDACChain(
188188
onCompletion->mCall(onCompletion->mContext, info, attestationError);
189189
}
190190

191-
ChipLogDetail(NotSpecified, "Checking for revoked DAC in %s", mDeviceAttestationRevocationSetPath.data());
191+
ChipLogDetail(NotSpecified, "Checking for revoked DAC in %s", mDeviceAttestationRevocationSetPath.c_str());
192192

193193
if (IsCertificateRevoked(info.dacDerBuffer))
194194
{
195-
ChipLogProgress(NotSpecified, "Found revoked DAC in %s", mDeviceAttestationRevocationSetPath.data());
195+
ChipLogProgress(NotSpecified, "Found revoked DAC in %s", mDeviceAttestationRevocationSetPath.c_str());
196196
attestationError = AttestationVerificationResult::kDacRevoked;
197197
}
198198

199-
ChipLogDetail(NotSpecified, "Checking for revoked PAI in %s", mDeviceAttestationRevocationSetPath.data());
199+
ChipLogDetail(NotSpecified, "Checking for revoked PAI in %s", mDeviceAttestationRevocationSetPath.c_str());
200200

201201
if (IsCertificateRevoked(info.paiDerBuffer))
202202
{
203-
ChipLogProgress(NotSpecified, "Found revoked PAI in %s", mDeviceAttestationRevocationSetPath.data());
203+
ChipLogProgress(NotSpecified, "Found revoked PAI in %s", mDeviceAttestationRevocationSetPath.c_str());
204204

205205
if (attestationError == AttestationVerificationResult::kDacRevoked)
206206
{

src/credentials/attestation_verifier/TestDACRevocationDelegateImpl.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <credentials/attestation_verifier/DeviceAttestationVerifier.h>
2121
#include <lib/support/Span.h>
22+
#include <string>
2223
#include <string_view>
2324

2425
namespace chip {
@@ -58,7 +59,7 @@ class TestDACRevocationDelegateImpl : public DeviceAttestationRevocationDelegate
5859
const CharSpan & serialNumberHexStr);
5960
bool IsCertificateRevoked(const ByteSpan & certDer);
6061

61-
std::string_view mDeviceAttestationRevocationSetPath;
62+
std::string mDeviceAttestationRevocationSetPath;
6263
};
6364

6465
} // namespace Credentials

0 commit comments

Comments
 (0)