clang-tidy: resolve 'readability-redundant-string-cstr'
Eliminate needless `c_str()` call.
```
../src/test/erase/crypto_test.cpp:67:20: error: redundant call to 'c_str' [readability-redundant-string-cstr,-warnings-as-errors]
CryptErase(testFileName.c_str(), std::move(mockCryptIface));
```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I1dce56443ca25172796f31e31d51f526c24fa18f
diff --git a/src/test/erase/crypto_test.cpp b/src/test/erase/crypto_test.cpp
index dd3954e..030f6bb 100644
--- a/src/test/erase/crypto_test.cpp
+++ b/src/test/erase/crypto_test.cpp
@@ -36,7 +36,7 @@
void SetUp() override
{
/* Create an empty file that we'll pretend is a 'storage device'. */
- testFile.open(testFileName.c_str(),
+ testFile.open(testFileName,
std::ios::out | std::ios::binary | std::ios::trunc);
testFile.close();
if (testFile.fail())
@@ -63,7 +63,7 @@
EXPECT_CALL(*mockCryptIface, cryptKeyslotDestroy(_, 0)).Times(1);
- CryptErase myCryptErase = CryptErase(testFileName.c_str(),
+ CryptErase myCryptErase = CryptErase(testFileName,
std::move(mockCryptIface));
EXPECT_NO_THROW(myCryptErase.doErase());
}
@@ -79,7 +79,7 @@
EXPECT_CALL(*mockCryptIface, cryptKeySlotMax(StrEq(CRYPT_LUKS2)))
.WillOnce(Return(-1));
- CryptErase myCryptErase = CryptErase(testFileName.c_str(),
+ CryptErase myCryptErase = CryptErase(testFileName,
std::move(mockCryptIface));
EXPECT_THROW(myCryptErase.doErase(), ResourceNotFound);
}
@@ -95,7 +95,7 @@
EXPECT_CALL(*mockCryptIface, cryptKeySlotMax(StrEq(CRYPT_LUKS2)))
.WillOnce(Return(0));
- CryptErase myCryptErase = CryptErase(testFileName.c_str(),
+ CryptErase myCryptErase = CryptErase(testFileName,
std::move(mockCryptIface));
EXPECT_THROW(myCryptErase.doErase(), ResourceNotFound);
}
@@ -114,7 +114,7 @@
EXPECT_CALL(*mockCryptIface, cryptKeySlotStatus(_, _))
.WillRepeatedly(Return(CRYPT_SLOT_INVALID));
- CryptErase myCryptErase = CryptErase(testFileName.c_str(),
+ CryptErase myCryptErase = CryptErase(testFileName,
std::move(mockCryptIface));
EXPECT_NO_THROW(myCryptErase.doErase());
}
@@ -136,7 +136,7 @@
EXPECT_CALL(*mockCryptIface, cryptKeyslotDestroy(_, 0))
.WillOnce(Return(-1));
- CryptErase myCryptErase = CryptErase(testFileName.c_str(),
+ CryptErase myCryptErase = CryptErase(testFileName,
std::move(mockCryptIface));
EXPECT_THROW(myCryptErase.doErase(), InternalFailure);
}