mirror of https://github.com/swig/swig
C90 fixes for Javascript JSC
This commit is contained in:
parent
9e56ae10cf
commit
59ff3e6a3a
|
@ -402,6 +402,7 @@ static JSStaticFunction $jsnspace_functions[] = {
|
|||
};
|
||||
|
||||
static JSClassDefinition $jsnspace_classDefinition;
|
||||
static JSObjectRef $jsmangledname_object;
|
||||
%}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
@ -412,7 +413,7 @@ static JSClassDefinition $jsnspace_classDefinition;
|
|||
%{
|
||||
$jsmangledname_classDefinition.staticFunctions = $jsmangledname_functions;
|
||||
$jsmangledname_classDefinition.staticValues = $jsmangledname_values;
|
||||
JSObjectRef $jsmangledname_object = JSObjectMake(context, JSClassCreate(&$jsmangledname_classDefinition), NULL);
|
||||
$jsmangledname_object = JSObjectMake(context, JSClassCreate(&$jsmangledname_classDefinition), NULL);
|
||||
%}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
|
@ -76,11 +76,12 @@ SWIG_From_dec(unsigned long)(unsigned long value)
|
|||
SWIGINTERN int
|
||||
SWIG_AsVal_dec(unsigned long)(JSValueRef obj, unsigned long *val)
|
||||
{
|
||||
long longVal;
|
||||
if(!JSValueIsNumber(context, obj)) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
|
||||
long longVal = (long) JSValueToNumber(context, obj, NULL);
|
||||
longVal = (long) JSValueToNumber(context, obj, NULL);
|
||||
|
||||
if(longVal < 0) {
|
||||
return SWIG_OverflowError;
|
||||
|
@ -142,11 +143,12 @@ SWIG_From_dec(unsigned long long)(unsigned long long value)
|
|||
SWIGINTERN int
|
||||
SWIG_AsVal_dec(unsigned long long)(JSValueRef obj, unsigned long long *val)
|
||||
{
|
||||
long long longVal;
|
||||
if(!JSValueIsNumber(context, obj)) {
|
||||
return SWIG_TypeError;
|
||||
}
|
||||
|
||||
long long longVal = (unsigned long long) JSValueToNumber(context, obj, NULL);
|
||||
longVal = (unsigned long long) JSValueToNumber(context, obj, NULL);
|
||||
|
||||
if(longVal < 0) {
|
||||
return SWIG_OverflowError;
|
||||
|
|
|
@ -52,6 +52,7 @@ SWIG_JSC_FromCharPtrAndSize(JSContextRef context, const char* carray, size_t siz
|
|||
return JSValueMakeUndefined(context);
|
||||
} else {
|
||||
JSStringRef jsstring;
|
||||
JSValueRef result;
|
||||
if(size < 2) {
|
||||
char c[2];
|
||||
int i;
|
||||
|
@ -63,7 +64,7 @@ SWIG_JSC_FromCharPtrAndSize(JSContextRef context, const char* carray, size_t siz
|
|||
} else {
|
||||
jsstring = JSStringCreateWithUTF8CString(carray);
|
||||
}
|
||||
JSValueRef result = JSValueMakeString(context, jsstring);
|
||||
result = JSValueMakeString(context, jsstring);
|
||||
JSStringRelease(jsstring);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1792,6 +1792,7 @@ int JSCEmitter::emitNamespaces() {
|
|||
namespace_definition.replace("$jsglobalvariables", variables)
|
||||
.replace("$jsglobalfunctions", functions)
|
||||
.replace("$jsnspace", name_mangled)
|
||||
.replace("$jsmangledname", name_mangled)
|
||||
.pretty_print(f_wrap_cpp);
|
||||
|
||||
Template t_createNamespace(getTemplate("jsc_nspace_definition"));
|
||||
|
|
Loading…
Reference in New Issue