From: 이춘석/On-Device Lab(SR)/Staff Engineer/삼성전자 Date: Wed, 15 May 2019 07:54:54 +0000 (+0900) Subject: Remove Obsolescent Functions (atoi) (#5191) X-Git-Tag: submit/tizen/20190809.050447~809 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8d3a2ea780785a43f7db73aaca07a4167de6fb2f;p=platform%2Fcore%2Fml%2Fnnfw.git Remove Obsolescent Functions (atoi) (#5191) This patch will replace atoi function with strtol. Reference : https://wiki.sei.cmu.edu/confluence/display/c/MSC24-C.+Do+not+use+deprecated+or+obsolescent+functions Signed-off-by: Chunseok Lee --- diff --git a/contrib/benchmark_acl/src/Benchmark.cpp b/contrib/benchmark_acl/src/Benchmark.cpp index ba60012..4a761ec 100644 --- a/contrib/benchmark_acl/src/Benchmark.cpp +++ b/contrib/benchmark_acl/src/Benchmark.cpp @@ -24,7 +24,7 @@ Count::Count() : _value(1) if (env) { - _value = atoi(env); + _value = std::strtol(env, NULL, 0); } } diff --git a/libs/tflite/src/ext/nnapi_delegate.cpp b/libs/tflite/src/ext/nnapi_delegate.cpp index b530dd7..a957c5f 100644 --- a/libs/tflite/src/ext/nnapi_delegate.cpp +++ b/libs/tflite/src/ext/nnapi_delegate.cpp @@ -112,7 +112,7 @@ int32_t GetAndroidSdkVersion() { return 0xFFFF; } } - return atoi(sdkVersion); + return std::strtol(sdkVersion, NULL, 0); } FATAL("No %s prop", sdkProp); #endif // __ANDROID__ diff --git a/runtimes/pure_arm_compute/src/logging.h b/runtimes/pure_arm_compute/src/logging.h index 914b630..447da03 100644 --- a/runtimes/pure_arm_compute/src/logging.h +++ b/runtimes/pure_arm_compute/src/logging.h @@ -41,7 +41,7 @@ public: { auto env = std::getenv("PURE_ARM_COMPUTE_LOG_ENABLE"); - if (env && std::atoi(env) > 0) + if (env && std::strtol(env, NULL, 0) > 0) { _enabled = true; } diff --git a/tests/tools/tflite_benchmark_model/benchmark_tflite_model.cc b/tests/tools/tflite_benchmark_model/benchmark_tflite_model.cc index efc8bae..cb8b49d 100644 --- a/tests/tools/tflite_benchmark_model/benchmark_tflite_model.cc +++ b/tests/tools/tflite_benchmark_model/benchmark_tflite_model.cc @@ -321,7 +321,7 @@ void BenchmarkTfLiteModel::Init() { ::profiling::Context::get().setProfiler(interpreter->GetProfiler()); auto enable_sync = std::getenv("PROFILING_OP_SYNC"); - if (enable_sync && std::atoi(enable_sync) != 0) + if (enable_sync && std::strtol(enable_sync, NULL, 0) != 0) { ::profiling::Context::get().setSync(); }