build: Fix cppcheck issues

This commit is contained in:
WerWolv
2025-07-10 13:57:08 +02:00
parent e58ce527c6
commit da2aa85a8a
40 changed files with 87 additions and 230 deletions

View File

@@ -99,6 +99,7 @@ namespace hex::plugin::builtin {
socket.writeString(packet);
auto receivedPacket = socket.readString(6);
std::ignore = receivedPacket;
}
bool enableNoAckMode(const wolv::net::SocketClient &socket) {
@@ -157,7 +158,7 @@ namespace hex::plugin::builtin {
if (size <= CacheLineSize) {
std::scoped_lock lock(m_cacheLock);
const auto &cacheLine = std::find_if(m_cache.begin(), m_cache.end(), [&](auto &line) {
const auto &cacheLine = std::ranges::find_if(m_cache, [&](const auto &line) {
return line.address == alignedOffset;
});

View File

@@ -102,7 +102,7 @@ namespace hex::plugin::builtin {
if (!data.empty() && checksum != 0x00)
throw std::runtime_error("Checksum mismatch");
while (std::isspace(string[offset]) && offset < string.length())
while (offset < string.length() && std::isspace(string[offset]))
offset++;
// Construct region
@@ -145,7 +145,7 @@ namespace hex::plugin::builtin {
}
}
while (std::isspace(string[offset]) && offset < string.length())
while (offset < string.length() && std::isspace(string[offset]))
offset++;
}

View File

@@ -57,21 +57,21 @@ namespace hex::plugin::builtin {
return value;
};
enum class RecordType {
Header = 0x00,
Data16 = 0x01,
Data24 = 0x02,
Data32 = 0x03,
Reserved = 0x04,
Count16 = 0x05,
Count24 = 0x06,
StartAddress32 = 0x07,
StartAddress24 = 0x08,
StartAddress16 = 0x09,
} recordType;
bool endOfFile = false;
try {
enum class RecordType {
Header = 0x00,
Data16 = 0x01,
Data24 = 0x02,
Data32 = 0x03,
Reserved = 0x04,
Count16 = 0x05,
Count24 = 0x06,
StartAddress32 = 0x07,
StartAddress24 = 0x08,
StartAddress16 = 0x09,
} recordType;
bool endOfFile = false;
while (offset < string.length()) {
// Parse record start
if (c() != 'S')
@@ -159,7 +159,7 @@ namespace hex::plugin::builtin {
break;
}
while (std::isspace(string[offset]) && offset < string.length())
while (offset < string.length() && std::isspace(string[offset]))
offset++;
}
} catch (const std::runtime_error &e) {