Remove Obsolescent Functions (atoi) (#5191)
author이춘석/On-Device Lab(SR)/Staff Engineer/삼성전자 <chunseok.lee@samsung.com>
Wed, 15 May 2019 07:54:54 +0000 (16:54 +0900)
committer오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Wed, 15 May 2019 07:54:54 +0000 (16:54 +0900)
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 <chunseok.lee@samsung.com>
contrib/benchmark_acl/src/Benchmark.cpp
libs/tflite/src/ext/nnapi_delegate.cpp
runtimes/pure_arm_compute/src/logging.h
tests/tools/tflite_benchmark_model/benchmark_tflite_model.cc

index ba60012..4a761ec 100644 (file)
@@ -24,7 +24,7 @@ Count::Count() : _value(1)
 
   if (env)
   {
-    _value = atoi(env);
+    _value = std::strtol(env, NULL, 0);
   }
 }
 
index b530dd7..a957c5f 100644 (file)
@@ -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__
index 914b630..447da03 100644 (file)
@@ -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;
     }
index efc8bae..cb8b49d 100644 (file)
@@ -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();
   }