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);
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);