lint: remove reinterpret_cast lint

Unhelpful.
This commit is contained in:
outfoxxed 2024-12-06 20:07:51 -08:00
parent be5e5fc4a5
commit 3fc1c914c7
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
15 changed files with 41 additions and 72 deletions

View file

@ -79,20 +79,14 @@ void PamConversation::onMessage() {
auto type = PamIpcEvent::Exit;
auto ok = this->pipes.readBytes(
reinterpret_cast<char*>(&type), // NOLINT
sizeof(PamIpcEvent)
);
auto ok = this->pipes.readBytes(reinterpret_cast<char*>(&type), sizeof(PamIpcEvent));
if (!ok) goto fail;
if (type == PamIpcEvent::Exit) {
auto code = PamIpcExitCode::OtherError;
ok = this->pipes.readBytes(
reinterpret_cast<char*>(&code), // NOLINT
sizeof(PamIpcExitCode)
);
ok = this->pipes.readBytes(reinterpret_cast<char*>(&code), sizeof(PamIpcExitCode));
if (!ok) goto fail;
@ -112,10 +106,7 @@ void PamConversation::onMessage() {
} else if (type == PamIpcEvent::Request) {
PamIpcRequestFlags flags {};
ok = this->pipes.readBytes(
reinterpret_cast<char*>(&flags), // NOLINT
sizeof(PamIpcRequestFlags)
);
ok = this->pipes.readBytes(reinterpret_cast<char*>(&flags), sizeof(PamIpcRequestFlags));
if (!ok) goto fail;

View file

@ -45,7 +45,7 @@ std::string PamIpcPipes::readString(bool* ok) const {
if (ok != nullptr) *ok = false;
uint32_t length = 0;
if (!this->readBytes(reinterpret_cast<char*>(&length), sizeof(length))) { // NOLINT
if (!this->readBytes(reinterpret_cast<char*>(&length), sizeof(length))) {
return "";
}
@ -61,7 +61,7 @@ std::string PamIpcPipes::readString(bool* ok) const {
bool PamIpcPipes::writeString(const std::string& string) const {
uint32_t length = string.length();
if (!this->writeBytes(reinterpret_cast<char*>(&length), sizeof(length))) { // NOLINT
if (!this->writeBytes(reinterpret_cast<char*>(&length), sizeof(length))) {
return false;
}

View file

@ -126,17 +126,11 @@ PamIpcExitCode PamSubprocess::exec(const char* configDir, const char* config, co
void PamSubprocess::sendCode(PamIpcExitCode code) {
{
auto eventType = PamIpcEvent::Exit;
auto ok = this->pipes.writeBytes(
reinterpret_cast<char*>(&eventType), // NOLINT
sizeof(PamIpcEvent)
);
auto ok = this->pipes.writeBytes(reinterpret_cast<char*>(&eventType), sizeof(PamIpcEvent));
if (!ok) goto fail;
ok = this->pipes.writeBytes(
reinterpret_cast<char*>(&code), // NOLINT
sizeof(PamIpcExitCode)
);
ok = this->pipes.writeBytes(reinterpret_cast<char*>(&code), sizeof(PamIpcExitCode));
if (!ok) goto fail;
@ -175,17 +169,12 @@ int PamSubprocess::conversation(
<< std::endl;
auto eventType = PamIpcEvent::Request;
auto ok = delegate->pipes.writeBytes(
reinterpret_cast<char*>(&eventType), // NOLINT
sizeof(PamIpcEvent)
);
auto ok = delegate->pipes.writeBytes(reinterpret_cast<char*>(&eventType), sizeof(PamIpcEvent));
if (!ok) goto fail;
ok = delegate->pipes.writeBytes(
reinterpret_cast<const char*>(&req), // NOLINT
sizeof(PamIpcRequestFlags)
);
ok =
delegate->pipes.writeBytes(reinterpret_cast<const char*>(&req), sizeof(PamIpcRequestFlags));
if (!ok) goto fail;
if (!delegate->pipes.writeString(msgString)) goto fail;