chore(judger): use stoi() to convert string to int

This commit is contained in:
Baoshuo Ren 2022-11-07 07:49:40 +08:00
parent c84265a0a1
commit 722d8eb479
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
2 changed files with 4 additions and 4 deletions

View File

@ -620,7 +620,7 @@ int conf_int(const string &key, const int &val) {
if (config.count(key) == 0) { if (config.count(key) == 0) {
return val; return val;
} }
return atoi(config[key].c_str()); return stoi(config[key]);
} }
int conf_int(const string &key, int num, const int &val) { int conf_int(const string &key, int num, const int &val) {
ostringstream sout; ostringstream sout;
@ -628,7 +628,7 @@ int conf_int(const string &key, int num, const int &val) {
if (config.count(sout.str()) == 0) { if (config.count(sout.str()) == 0) {
return conf_int(key, val); return conf_int(key, val);
} }
return atoi(config[sout.str()].c_str()); return stoi(config[sout.str()]);
} }
int conf_int(const string &key) { int conf_int(const string &key) {
return conf_int(key, 0); return conf_int(key, 0);

View File

@ -488,7 +488,7 @@ int conf_int(const string &key, const int &val) {
if (uconfig.count(key) == 0) { if (uconfig.count(key) == 0) {
return val; return val;
} }
return atoi(uconfig[key].c_str()); return stoi(uconfig[key]);
} }
int conf_int(const string &key, int num, const int &val) { int conf_int(const string &key, int num, const int &val) {
ostringstream sout; ostringstream sout;
@ -496,7 +496,7 @@ int conf_int(const string &key, int num, const int &val) {
if (uconfig.count(sout.str()) == 0) { if (uconfig.count(sout.str()) == 0) {
return conf_int(key, val); return conf_int(key, val);
} }
return atoi(uconfig[sout.str()].c_str()); return stoi(uconfig[sout.str()]);
} }
int conf_int(const string &key) { int conf_int(const string &key) {
return conf_int(key, 0); return conf_int(key, 0);