Update wrt-plugins-common_0.3.53
[framework/web/wrt-plugins-common.git] / src / CommonsJavaScript / Converter.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 1d97810..60d58e1
@@ -244,6 +244,11 @@ JSValueRef Converter::toJSValueRefLong(const long arg) {
     return JSValueMakeNumber(m_context, arg);
 }
 
+JSValueRef Converter::toJSValueRef(long long int arg)
+{
+    return JSValueMakeNumber(m_context, arg);
+}
+
 JSValueRef Converter::toJSValueRef(double arg)
 {
     return JSValueMakeNumber(m_context, arg);
@@ -347,20 +352,14 @@ std::string Converter::toString_(const JSValueRef& arg)
 
     JSValueRef exception = NULL;
     JSStringRef str = JSValueToStringCopy(m_context, arg, &exception);
-    if ((NULL == str) || (NULL != exception)) {
+    if (NULL == str) {
         ThrowMsg(ConversionException, "Couldn't cast to a string.");
     }
 
     size_t jsSize = JSStringGetMaximumUTF8CStringSize(str);
     if (jsSize > 0) {
-        jsSize = jsSize + 1;
         DPL::ScopedArray<char> buffer(new char[jsSize]);
-        size_t written = JSStringGetUTF8CString(str, buffer.Get(), jsSize);
-        if (written > jsSize) {
-            JSStringRelease(str);
-            ThrowMsg(ConversionException,
-                     "Conversion could not be fully performed.");
-        }
+        JSStringGetUTF8CString(str, buffer.Get(), jsSize);
         result = buffer.Get();
     }
     JSStringRelease(str);