Fixing warnings in the wrt-plugins-common
[platform/framework/web/wrt-plugins-common.git] / src / CommonsJavaScript / Converter.cpp
index 27183f4..cdaed58 100644 (file)
@@ -85,7 +85,8 @@ long long Converter::toLongLong(const JSValueRef& arg)
 
 unsigned long Converter::toULong(const JSValueRef& arg)
 {
-    return static_cast<unsigned long>(toLong(arg));
+    double tmp = toNumber_(arg);
+    return (isNan(tmp) ? 0 : static_cast<unsigned long>(tmp));
 }
 
 std::size_t Converter::toSizeT(const JSValueRef& arg)
@@ -290,8 +291,10 @@ JSValueRef Converter::toJSValueRef(const tm& arg)
 
 JSValueRef Converter::toJSValueRef(const time_t arg)
 {
-    struct tm *tminfo = localtime(&arg);
-    return toJSValueRef(*tminfo);
+    struct tm tminfo;
+    memset(&tminfo,0,sizeof(tminfo));
+    localtime_r(&arg, &tminfo);
+    return toJSValueRef(tminfo);
 }
 
 JSValueRef Converter::toJSValueRef(const std::vector<std::string>& arg)