From 3e42921c657bc93094f0c7d96855aae9b0be5a7e Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Tue, 8 Jan 2013 15:39:16 -0800 Subject: Improve warnings; fix const_db.txt bug. --- src/map/script.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/map/script.cpp') diff --git a/src/map/script.cpp b/src/map/script.cpp index 5411e59..25db80b 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -851,14 +851,21 @@ void read_constdb(void) if (line[0] == '/' && line[1] == '/') continue; - std::string name; + char *name = nullptr; int val; int type = 0; // if not provided - if (SSCANF(line, "%m[A-Za-z0-9_] %x %x", &name, &val, &type) < 2) - continue; - for (char& c : name) - c = tolower(c); - int n = add_str(name.c_str()); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat" + if (sscanf(line.c_str(), "%m[A-Za-z0-9_] %i %i", &name, &val, &type) < 2) + { + free(name); + continue; + } +#pragma GCC diagnostic pop + for (char *p = name; *p; ++p) + *p = tolower(*p); + int n = add_str(name); + free(name); str_data[n].type = type ? ScriptCode::PARAM : ScriptCode::INT; str_data[n].val = val; } -- cgit v1.2.3-70-g09d2