From 4e68edf0e58cbaa48230cdb562c6e9660a0c05c4 Mon Sep 17 00:00:00 2001 From: Eduardo Arias Date: Mon, 21 Oct 2024 15:52:14 -0300 Subject: [PATCH] Replace usage of sscanf with strtol to remove cppcheck inline suppression --- src/rules_set_properties.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/rules_set_properties.cc b/src/rules_set_properties.cc index ab4bdeda..d65d9a95 100644 --- a/src/rules_set_properties.cc +++ b/src/rules_set_properties.cc @@ -33,10 +33,8 @@ void ConfigUnicodeMap::loadConfig(std::string f, double configCodePage, const char *p = NULL; char *savedptr = NULL; const char *ucode = NULL; - int code = 0; int found = 0; int length = 0; - int Map = 0; int processing = 0; driver->m_unicodeMapTable.m_set = true; @@ -102,10 +100,10 @@ void ConfigUnicodeMap::loadConfig(std::string f, double configCodePage, if (mapping != NULL) { ucode = strtok_r(mapping, ":", &hmap); - sscanf(ucode, "%x", &code); // cppcheck-suppress invalidScanfArgType_int - sscanf(hmap, "%x", &Map); // cppcheck-suppress invalidScanfArgType_int + int code = strtol(ucode, nullptr, 16); + int map = strtol(hmap, nullptr, 16); if (code >= 0 && code <= 65535) { - driver->m_unicodeMapTable.m_unicodeMapTable->change(code, Map); + driver->m_unicodeMapTable.m_unicodeMapTable->change(code, map); } free(mapping);