From 1bd0f904376692e89e3e5bf4ffe8361afaa33526 Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 6 Jan 2014 20:02:01 +0800 Subject: [PATCH] Warning fix in js_manual_conversions.cpp/h --- .../bindings/js_manual_conversions.cpp | 70 +++++++++---------- .../bindings/js_manual_conversions.h | 4 +- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/cocos/scripting/javascript/bindings/js_manual_conversions.cpp b/cocos/scripting/javascript/bindings/js_manual_conversions.cpp index fe3c22d985..43bf044b8a 100644 --- a/cocos/scripting/javascript/bindings/js_manual_conversions.cpp +++ b/cocos/scripting/javascript/bindings/js_manual_conversions.cpp @@ -1270,7 +1270,7 @@ JSBool jsval_to_std_vector_int( JSContext *cx, jsval vp, std::vector* ret) // native --> jsval -jsval ccarray_to_jsval(JSContext* cx, Array *arr) +jsval ccarray_to_jsval(JSContext* cx, __Array *arr) { JSObject *jsretArr = JS_NewArrayObject(cx, 0, NULL); @@ -1286,27 +1286,27 @@ jsval ccarray_to_jsval(JSContext* cx, Array *arr) arrElement = OBJECT_TO_JSVAL(jsproxy->obj); } else { - String* strVal = NULL; - Dictionary* dictVal = NULL; - Array* arrVal = NULL; - Double* doubleVal = NULL; - Bool* boolVal = NULL; - Float* floatVal = NULL; - Integer* intVal = NULL; + __String* strVal = NULL; + __Dictionary* dictVal = NULL; + __Array* arrVal = NULL; + __Double* doubleVal = NULL; + __Bool* boolVal = NULL; + __Float* floatVal = NULL; + __Integer* intVal = NULL; - if ((strVal = dynamic_cast(obj))) { + if ((strVal = dynamic_cast(obj))) { arrElement = c_string_to_jsval(cx, strVal->getCString()); - } else if ((dictVal = dynamic_cast(obj))) { + } else if ((dictVal = dynamic_cast(obj))) { arrElement = ccdictionary_to_jsval(cx, dictVal); - } else if ((arrVal = dynamic_cast(obj))) { + } else if ((arrVal = dynamic_cast(obj))) { arrElement = ccarray_to_jsval(cx, arrVal); - } else if ((doubleVal = dynamic_cast(obj))) { + } else if ((doubleVal = dynamic_cast<__Double*>(obj))) { arrElement = DOUBLE_TO_JSVAL(doubleVal->getValue()); - } else if ((floatVal = dynamic_cast(obj))) { + } else if ((floatVal = dynamic_cast<__Float*>(obj))) { arrElement = DOUBLE_TO_JSVAL(floatVal->getValue()); - } else if ((intVal = dynamic_cast(obj))) { + } else if ((intVal = dynamic_cast<__Integer*>(obj))) { arrElement = INT_TO_JSVAL(intVal->getValue()); - } else if ((boolVal = dynamic_cast(obj))) { + } else if ((boolVal = dynamic_cast<__Bool*>(obj))) { arrElement = BOOLEAN_TO_JSVAL(boolVal->getValue() ? JS_TRUE : JS_FALSE); } else { CCASSERT(false, "the type isn't suppored."); @@ -1320,7 +1320,7 @@ jsval ccarray_to_jsval(JSContext* cx, Array *arr) return OBJECT_TO_JSVAL(jsretArr); } -jsval ccdictionary_to_jsval(JSContext* cx, Dictionary* dict) +jsval ccdictionary_to_jsval(JSContext* cx, __Dictionary* dict) { JSObject* jsRet = JS_NewObject(cx, NULL, NULL, NULL); DictElement* pElement = NULL; @@ -1334,27 +1334,27 @@ jsval ccdictionary_to_jsval(JSContext* cx, Dictionary* dict) dictElement = OBJECT_TO_JSVAL(jsproxy->obj); } else { - String* strVal = NULL; - Dictionary* dictVal = NULL; - Array* arrVal = NULL; - Double* doubleVal = NULL; - Bool* boolVal = NULL; - Float* floatVal = NULL; - Integer* intVal = NULL; + __String* strVal = NULL; + __Dictionary* dictVal = NULL; + __Array* arrVal = NULL; + __Double* doubleVal = NULL; + __Bool* boolVal = NULL; + __Float* floatVal = NULL; + __Integer* intVal = NULL; - if ((strVal = dynamic_cast(obj))) { + if ((strVal = dynamic_cast(obj))) { dictElement = c_string_to_jsval(cx, strVal->getCString()); - } else if ((dictVal = dynamic_cast(obj))) { + } else if ((dictVal = dynamic_cast<__Dictionary*>(obj))) { dictElement = ccdictionary_to_jsval(cx, dictVal); - } else if ((arrVal = dynamic_cast(obj))) { + } else if ((arrVal = dynamic_cast<__Array*>(obj))) { dictElement = ccarray_to_jsval(cx, arrVal); - } else if ((doubleVal = dynamic_cast(obj))) { + } else if ((doubleVal = dynamic_cast<__Double*>(obj))) { dictElement = DOUBLE_TO_JSVAL(doubleVal->getValue()); - } else if ((floatVal = dynamic_cast(obj))) { + } else if ((floatVal = dynamic_cast<__Float*>(obj))) { dictElement = DOUBLE_TO_JSVAL(floatVal->getValue()); - } else if ((intVal = dynamic_cast(obj))) { + } else if ((intVal = dynamic_cast<__Integer*>(obj))) { dictElement = INT_TO_JSVAL(intVal->getValue()); - } else if ((boolVal = dynamic_cast(obj))) { + } else if ((boolVal = dynamic_cast<__Bool*>(obj))) { dictElement = BOOLEAN_TO_JSVAL(boolVal->getValue() ? JS_TRUE : JS_FALSE); } else { CCASSERT(false, "the type isn't suppored."); @@ -1369,7 +1369,7 @@ jsval ccdictionary_to_jsval(JSContext* cx, Dictionary* dict) return OBJECT_TO_JSVAL(jsRet); } -JSBool jsval_to_ccdictionary(JSContext* cx, jsval v, Dictionary** ret) +JSBool jsval_to_ccdictionary(JSContext* cx, jsval v, __Dictionary** ret) { if (JSVAL_IS_NULL(v) || JSVAL_IS_VOID(v)) { @@ -1384,7 +1384,7 @@ JSBool jsval_to_ccdictionary(JSContext* cx, jsval v, Dictionary** ret) } JSObject* it = JS_NewPropertyIterator(cx, tmp); - Dictionary* dict = NULL; + __Dictionary* dict = NULL; while (true) { @@ -1404,7 +1404,7 @@ JSBool jsval_to_ccdictionary(JSContext* cx, jsval v, Dictionary** ret) JSStringWrapper keyWrapper(JSVAL_TO_STRING(key), cx); if (!dict) { - dict = Dictionary::create(); + dict = __Dictionary::create(); } JS::RootedValue value(cx); @@ -1423,7 +1423,7 @@ JSBool jsval_to_ccdictionary(JSContext* cx, jsval v, Dictionary** ret) } else if (!JS_IsArrayObject(cx, tmp)){ // It's a normal js object. - Dictionary* dictVal = NULL; + __Dictionary* dictVal = NULL; JSBool ok = jsval_to_ccdictionary(cx, value, &dictVal); if (ok) { dict->setObject(dictVal, keyWrapper.get()); @@ -1431,7 +1431,7 @@ JSBool jsval_to_ccdictionary(JSContext* cx, jsval v, Dictionary** ret) } else { // It's a js array object. - Array* arrVal = NULL; + __Array* arrVal = NULL; JSBool ok = jsval_to_ccarray(cx, value, &arrVal); if (ok) { dict->setObject(arrVal, keyWrapper.get()); diff --git a/cocos/scripting/javascript/bindings/js_manual_conversions.h b/cocos/scripting/javascript/bindings/js_manual_conversions.h index 751cd995ee..4820c13bea 100644 --- a/cocos/scripting/javascript/bindings/js_manual_conversions.h +++ b/cocos/scripting/javascript/bindings/js_manual_conversions.h @@ -224,8 +224,8 @@ jsval ccsize_to_jsval(JSContext* cx, const cocos2d::Size& v); jsval cccolor4b_to_jsval(JSContext* cx, const cocos2d::Color4B& v); jsval cccolor4f_to_jsval(JSContext* cx, const cocos2d::Color4F& v); jsval cccolor3b_to_jsval(JSContext* cx, const cocos2d::Color3B& v); -jsval ccdictionary_to_jsval(JSContext* cx, cocos2d::Dictionary *dict); -jsval ccarray_to_jsval(JSContext* cx, cocos2d::Array *arr); +jsval ccdictionary_to_jsval(JSContext* cx, cocos2d::__Dictionary *dict); +jsval ccarray_to_jsval(JSContext* cx, cocos2d::__Array *arr); jsval ccacceleration_to_jsval(JSContext* cx, const cocos2d::Acceleration& v); jsval ccaffinetransform_to_jsval(JSContext* cx, const cocos2d::AffineTransform& t); jsval FontDefinition_to_jsval(JSContext* cx, const cocos2d::FontDefinition& t);