diff --git a/Lib/javascript/v8/arrays_javascript.i b/Lib/javascript/v8/arrays_javascript.i index 8bcbee83c..6dc7e4b9b 100644 --- a/Lib/javascript/v8/arrays_javascript.i +++ b/Lib/javascript/v8/arrays_javascript.i @@ -30,38 +30,33 @@ %define JAVASCRIPT_ARRAYS_IN_DECL(NAME, CTYPE, ANY, ANYLENGTH) %typemap(in, fragment=NAME) CTYPE[ANY] { - if ($input->IsArray()) - { + if ($input->IsArray()) { // Convert into Array v8::Local array = v8::Local::Cast($input); int length = ANYLENGTH; - $1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length); + $1 = ($*1_ltype *)malloc(sizeof($*1_ltype) * length); // Get each element from array - for (int i = 0; i < length; i++) - { + for (int i = 0; i < length; i++) { v8::Local jsvalue = SWIGV8_ARRAY_GET(array, i); $*1_ltype temp; // Get primitive value from JSObject int res = SWIG_AsVal(CTYPE)(jsvalue, &temp); - if (!SWIG_IsOK(res)) - { + if (!SWIG_IsOK(res)) { SWIG_exception_fail(SWIG_ERROR, "Failed to convert $input to double"); } arg$argnum[i] = temp; } - } - else - { + } else { SWIG_exception_fail(SWIG_ERROR, "$input is not an array"); } } %typemap(freearg) CTYPE[ANY] { - free($1); + free($1); } %enddef @@ -72,8 +67,7 @@ int length = $1_dim0; v8::Local array = SWIGV8_ARRAY_NEW(length); - for (int i = 0; i < length; i++) - { + for (int i = 0; i < length; i++) { SWIGV8_ARRAY_SET(array, i, SWIG_From(CTYPE)($1[i])); } diff --git a/Lib/javascript/v8/javascriptcomplex.swg b/Lib/javascript/v8/javascriptcomplex.swg index e6b78899c..7b3c5547e 100644 --- a/Lib/javascript/v8/javascriptcomplex.swg +++ b/Lib/javascript/v8/javascriptcomplex.swg @@ -39,23 +39,23 @@ SWIG_AsVal_dec(Type) (SWIGV8_VALUE o, Type* val) if (o->IsArray()) { SWIGV8_ARRAY array = SWIGV8_ARRAY::Cast(o); - if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2]."); + if (array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2]."); double re, im; int res; res = SWIG_AsVal(double)(SWIGV8_ARRAY_GET(array, 0), &re); - if(!SWIG_IsOK(res)) { + if (!SWIG_IsOK(res)) { return SWIG_TypeError; } res = SWIG_AsVal(double)(SWIGV8_ARRAY_GET(array, 1), &im); - if(!SWIG_IsOK(res)) { + if (!SWIG_IsOK(res)) { return SWIG_TypeError; } if (val) *val = Constructor(re, im); return SWIG_OK; - } else if(o->IsNumber()){ + } else if (o->IsNumber()) { double d; int res = SWIG_AddCast(SWIG_AsVal(double)(o, &d)); if (SWIG_IsOK(res)) { @@ -81,17 +81,17 @@ SWIG_AsVal_dec(Type) (SWIGV8_VALUE o, Type* val) if (o->IsArray()) { SWIGV8_ARRAY array = SWIGV8_ARRAY::Cast(o); - if(array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2]."); + if (array->Length() != 2) SWIG_Error(SWIG_TypeError, "Illegal argument for complex: must be array[2]."); double re, im; int res; res = SWIG_AsVal(double)(SWIGV8_ARRAY_GET(array, 0), &re); - if(!SWIG_IsOK(res)) { + if (!SWIG_IsOK(res)) { return SWIG_TypeError; } res = SWIG_AsVal(double)(SWIGV8_ARRAY_GET(array, 1), &im); - if(!SWIG_IsOK(res)) { + if (!SWIG_IsOK(res)) { return SWIG_TypeError; } @@ -102,7 +102,7 @@ SWIG_AsVal_dec(Type) (SWIGV8_VALUE o, Type* val) } else { return SWIG_OverflowError; } - } else if(o->IsNumber()){ + } else if (o->IsNumber()) { float re; int res = SWIG_AddCast(SWIG_AsVal(float)(o, &re)); if (SWIG_IsOK(res)) {