diff --git a/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp b/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp index 4c45d25758..0d4e6000c2 100644 --- a/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp +++ b/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp @@ -5712,7 +5712,7 @@ bool js_cocos2dx_AutoPolygon_generatePolygon(JSContext *cx, uint32_t argc, jsval double arg2; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); + ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AutoPolygon_generatePolygon : Error processing arguments"); cocos2d::PolygonInfo* ret = new (std::nothrow) cocos2d::PolygonInfo(cocos2d::AutoPolygon::generatePolygon(arg0, arg1, arg2)); jsval jsret = JSVAL_NULL; @@ -5729,8 +5729,8 @@ bool js_cocos2dx_AutoPolygon_generatePolygon(JSContext *cx, uint32_t argc, jsval double arg3; ok &= jsval_to_std_string(cx, args.get(0), &arg0); ok &= jsval_to_ccrect(cx, args.get(1), &arg1); - ok &= JS::ToNumber( cx, args.get(2), &arg2) && !isnan(arg2); - ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3); + ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2); + ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AutoPolygon_generatePolygon : Error processing arguments"); cocos2d::PolygonInfo* ret = new (std::nothrow) cocos2d::PolygonInfo(cocos2d::AutoPolygon::generatePolygon(arg0, arg1, arg2, arg3)); jsval jsret = JSVAL_NULL; diff --git a/cocos/scripting/js-bindings/manual/cocostudio/jsb_cocos2dx_studio_conversions.cpp b/cocos/scripting/js-bindings/manual/cocostudio/jsb_cocos2dx_studio_conversions.cpp index 409b9b102f..e0d9f5f1cc 100644 --- a/cocos/scripting/js-bindings/manual/cocostudio/jsb_cocos2dx_studio_conversions.cpp +++ b/cocos/scripting/js-bindings/manual/cocostudio/jsb_cocos2dx_studio_conversions.cpp @@ -56,7 +56,7 @@ bool jsval_to_animationInfo(JSContext* cx, JS::HandleValue vp, cocostudio::timel JS::ToNumber(cx, jsStartId, &startIndex) && JS::ToNumber(cx, jsEndId, &endIndex) && jsval_to_std_string(cx, jsName, &name) && - !isnan(startIndex) && !isnan(endIndex); + !std::isnan(startIndex) && !std::isnan(endIndex); JSB_PRECONDITION3(ok, cx, false, "Error processing arguments"); diff --git a/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp b/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp index e78200c403..14e2247ca1 100644 --- a/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp +++ b/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp @@ -482,7 +482,7 @@ bool jsval_to_ushort( JSContext *cx, JS::HandleValue vp, unsigned short *outval double dp; ok &= JS::ToNumber(cx, vp, &dp); JSB_PRECONDITION3(ok, cx, false, "Error processing arguments"); - ok &= !isnan(dp); + ok &= !std::isnan(dp); JSB_PRECONDITION3(ok, cx, false, "Error processing arguments"); *outval = (unsigned short)dp; @@ -496,7 +496,7 @@ bool jsval_to_int32( JSContext *cx, JS::HandleValue vp, int32_t *outval ) double dp; ok &= JS::ToNumber(cx, vp, &dp); JSB_PRECONDITION3(ok, cx, false, "Error processing arguments"); - ok &= !isnan(dp); + ok &= !std::isnan(dp); JSB_PRECONDITION3(ok, cx, false, "Error processing arguments"); *outval = (int32_t)dp; @@ -510,7 +510,7 @@ bool jsval_to_uint32( JSContext *cx, JS::HandleValue vp, uint32_t *outval ) double dp; ok &= JS::ToNumber(cx, vp, &dp); JSB_PRECONDITION3(ok, cx, false, "Error processing arguments"); - ok &= !isnan(dp); + ok &= !std::isnan(dp); JSB_PRECONDITION3(ok, cx, false, "Error processing arguments"); *outval = (uint32_t)dp; @@ -524,7 +524,7 @@ bool jsval_to_uint16( JSContext *cx, JS::HandleValue vp, uint16_t *outval ) double dp; ok &= JS::ToNumber(cx, vp, &dp); JSB_PRECONDITION3(ok, cx, false, "Error processing arguments"); - ok &= !isnan(dp); + ok &= !std::isnan(dp); JSB_PRECONDITION3(ok, cx, false, "Error processing arguments"); *outval = (uint16_t)dp; @@ -675,7 +675,8 @@ bool jsval_to_quaternion( JSContext *cx, JS::HandleValue v, cocos2d::Quaternion* JS::ToNumber(cx, y, &yy) && JS::ToNumber(cx, z, &zz) && JS::ToNumber(cx, w, &ww) && - !isnan(xx) && !isnan(yy) && !isnan(zz) && !isnan(ww); + !std::isnan(xx) && !std::isnan(yy) && !std::isnan(zz) && !std:: +isnan(ww); JSB_PRECONDITION3(ok, cx, false, "Error processing arguments"); @@ -1538,7 +1539,7 @@ bool jsval_to_vector2(JSContext *cx, JS::HandleValue vp, cocos2d::Vec2* ret) JS_GetProperty(cx, tmp, "y", &jsy) && JS::ToNumber(cx, jsx, &x) && JS::ToNumber(cx, jsy, &y) && - !isnan(x) && !isnan(y); + !std::isnan(x) && !std::isnan(y); JSB_PRECONDITION3(ok, cx, false, "Error processing arguments"); @@ -1562,7 +1563,7 @@ bool jsval_to_vector3(JSContext *cx, JS::HandleValue vp, cocos2d::Vec3* ret) JS::ToNumber(cx, jsx, &x) && JS::ToNumber(cx, jsy, &y) && JS::ToNumber(cx, jsz, &z) && - !isnan(x) && !isnan(y) && !isnan(z); + !std::isnan(x) && !std::isnan(y) && !std::isnan(z); JSB_PRECONDITION3(ok, cx, false, "Error processing arguments"); @@ -1590,7 +1591,7 @@ bool jsval_to_vector4(JSContext *cx, JS::HandleValue vp, cocos2d::Vec4* ret) JS::ToNumber(cx, jsy, &y) && JS::ToNumber(cx, jsz, &z) && JS::ToNumber(cx, jsw, &w) && - !isnan(x) && !isnan(y) && !isnan(z) && !isnan(w); + !std::isnan(x) && !std::isnan(y) && !std::isnan(z) && !std::isnan(w); JSB_PRECONDITION3(ok, cx, false, "Error processing arguments"); @@ -1657,7 +1658,7 @@ bool jsval_to_cctex2f(JSContext* cx, JS::HandleValue vp, cocos2d::Tex2F* ret) JS_GetProperty(cx, tmp, "y", &jsy) && JS::ToNumber(cx, jsx, &x) && JS::ToNumber(cx, jsy, &y) && - !isnan(x) && !isnan(y); + !std::isnan(x) && !std::isnan(y); JSB_PRECONDITION3(ok, cx, false, "Error processing arguments"); diff --git a/cocos/scripting/js-bindings/manual/physics3d/jsb_cocos2dx_physics3d_manual.cpp b/cocos/scripting/js-bindings/manual/physics3d/jsb_cocos2dx_physics3d_manual.cpp index 4c2711e5d5..73dabb9b52 100644 --- a/cocos/scripting/js-bindings/manual/physics3d/jsb_cocos2dx_physics3d_manual.cpp +++ b/cocos/scripting/js-bindings/manual/physics3d/jsb_cocos2dx_physics3d_manual.cpp @@ -321,9 +321,9 @@ bool js_cocos2dx_physics3d_Physics3dShape_initHeightfield(JSContext *cx, uint32_ ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); ok &= jsval_to_std_vector_float(cx, args.get(2), &arg2); - ok &= JS::ToNumber(cx, args.get(3), &arg3) && !isnan(arg3); - ok &= JS::ToNumber(cx, args.get(4), &arg4) && !isnan(arg4); - ok &= JS::ToNumber(cx, args.get(5), &arg5) && !isnan(arg5); + ok &= JS::ToNumber(cx, args.get(3), &arg3) && !std::isnan(arg3); + ok &= JS::ToNumber(cx, args.get(4), &arg4) && !std::isnan(arg4); + ok &= JS::ToNumber(cx, args.get(5), &arg5) && !std::isnan(arg5); arg6 = JS::ToBoolean(args.get(6)); arg7 = JS::ToBoolean(args.get(7)); if (argc == 9) @@ -363,9 +363,9 @@ bool js_cocos2dx_physics3d_Physics3dShape_createHeightfield(JSContext *cx, uint3 ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); ok &= jsval_to_std_vector_float(cx, args.get(2), &arg2); - ok &= JS::ToNumber( cx, args.get(3), &arg3) && !isnan(arg3); - ok &= JS::ToNumber( cx, args.get(4), &arg4) && !isnan(arg4); - ok &= JS::ToNumber( cx, args.get(5), &arg5) && !isnan(arg5); + ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3); + ok &= JS::ToNumber( cx, args.get(4), &arg4) && !std::isnan(arg4); + ok &= JS::ToNumber( cx, args.get(5), &arg5) && !std::isnan(arg5); arg6 = JS::ToBoolean(args.get(6)); arg7 = JS::ToBoolean(args.get(7)); if(argc == 9) diff --git a/tests/js-tests/project/Classes/js_Effect3D_bindings.cpp b/tests/js-tests/project/Classes/js_Effect3D_bindings.cpp index e7339c5db6..6c97c62047 100644 --- a/tests/js-tests/project/Classes/js_Effect3D_bindings.cpp +++ b/tests/js-tests/project/Classes/js_Effect3D_bindings.cpp @@ -422,7 +422,7 @@ bool js_cocos2dx_Effect3DOutline_setOutlineWidth(JSContext *cx, uint32_t argc, j JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Effect3DOutline_setOutlineWidth : Invalid Native Object"); if (argc == 1) { double arg0; - ok &= JS::ToNumber( cx, args.get(0), &arg0) && !isnan(arg0); + ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0); JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Effect3DOutline_setOutlineWidth : Error processing arguments"); cobj->setOutlineWidth(arg0); args.rval().setUndefined();