Skip to content

Commit 4e68edf

Browse files
committed
Replace usage of sscanf with strtol to remove cppcheck inline suppression
1 parent cdaf32f commit 4e68edf

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/rules_set_properties.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@ void ConfigUnicodeMap::loadConfig(std::string f, double configCodePage,
3333
const char *p = NULL;
3434
char *savedptr = NULL;
3535
const char *ucode = NULL;
36-
int code = 0;
3736
int found = 0;
3837
int length = 0;
39-
int Map = 0;
4038
int processing = 0;
4139

4240
driver->m_unicodeMapTable.m_set = true;
@@ -102,10 +100,10 @@ void ConfigUnicodeMap::loadConfig(std::string f, double configCodePage,
102100

103101
if (mapping != NULL) {
104102
ucode = strtok_r(mapping, ":", &hmap);
105-
sscanf(ucode, "%x", &code); // cppcheck-suppress invalidScanfArgType_int
106-
sscanf(hmap, "%x", &Map); // cppcheck-suppress invalidScanfArgType_int
103+
int code = strtol(ucode, nullptr, 16);
104+
int map = strtol(hmap, nullptr, 16);
107105
if (code >= 0 && code <= 65535) {
108-
driver->m_unicodeMapTable.m_unicodeMapTable->change(code, Map);
106+
driver->m_unicodeMapTable.m_unicodeMapTable->change(code, map);
109107
}
110108

111109
free(mapping);

0 commit comments

Comments
 (0)