tests: use stoi() instead of atoi()

stoi() is simpler if we need to convert std::string to integer.

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2018-11-12 09:49:53 +08:00
parent d143450450
commit 83762041a4

View File

@ -122,8 +122,8 @@ int ErasureCodeBench::setup(int argc, char** argv) {
if (vm.count("erased") > 0) if (vm.count("erased") > 0)
erased = vm["erased"].as<vector<int> >(); erased = vm["erased"].as<vector<int> >();
k = atoi(profile["k"].c_str()); k = stoi(profile["k"]);
m = atoi(profile["m"].c_str()); m = stoi(profile["m"]);
if (k <= 0) { if (k <= 0) {
cout << "parameter k is " << k << ". But k needs to be > 0." << endl; cout << "parameter k is " << k << ". But k needs to be > 0." << endl;