Various cppcheck fixes (#337)

This commit is contained in:
Konstantinos Margaritis
2025-05-30 12:27:28 +03:00
committed by GitHub
parent 4f40db0755
commit 7b505226ed
11 changed files with 31 additions and 29 deletions

View File

@@ -142,9 +142,9 @@ static really_inline
char *makeHex(const unsigned char *pat, unsigned patlen) {
size_t hexlen = patlen * 4;
char *hexbuf = reinterpret_cast<char *>(malloc(hexlen + 1));
unsigned i;
char *buf;
for (i = 0, buf = hexbuf; i < patlen; i++, buf += 4) {
if (!hexbuf) abort();
char *buf = hexbuf;
for (size_t i = 0; i < patlen; i++, buf += 4) {
snprintf(buf, 5, "\\x%02x", (unsigned char)pat[i]);
}
hexbuf[hexlen] = '\0';