mirror of https://github.com/axmolengine/axmol.git
Warning fix in js_manual_conversions.cpp/h
This commit is contained in:
parent
dd0e157c74
commit
1bd0f90437
|
@ -1270,7 +1270,7 @@ JSBool jsval_to_std_vector_int( JSContext *cx, jsval vp, std::vector<int>* ret)
|
||||||
|
|
||||||
// native --> jsval
|
// 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);
|
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);
|
arrElement = OBJECT_TO_JSVAL(jsproxy->obj);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
String* strVal = NULL;
|
__String* strVal = NULL;
|
||||||
Dictionary* dictVal = NULL;
|
__Dictionary* dictVal = NULL;
|
||||||
Array* arrVal = NULL;
|
__Array* arrVal = NULL;
|
||||||
Double* doubleVal = NULL;
|
__Double* doubleVal = NULL;
|
||||||
Bool* boolVal = NULL;
|
__Bool* boolVal = NULL;
|
||||||
Float* floatVal = NULL;
|
__Float* floatVal = NULL;
|
||||||
Integer* intVal = NULL;
|
__Integer* intVal = NULL;
|
||||||
|
|
||||||
if ((strVal = dynamic_cast<cocos2d::String *>(obj))) {
|
if ((strVal = dynamic_cast<cocos2d::__String *>(obj))) {
|
||||||
arrElement = c_string_to_jsval(cx, strVal->getCString());
|
arrElement = c_string_to_jsval(cx, strVal->getCString());
|
||||||
} else if ((dictVal = dynamic_cast<cocos2d::Dictionary*>(obj))) {
|
} else if ((dictVal = dynamic_cast<cocos2d::__Dictionary*>(obj))) {
|
||||||
arrElement = ccdictionary_to_jsval(cx, dictVal);
|
arrElement = ccdictionary_to_jsval(cx, dictVal);
|
||||||
} else if ((arrVal = dynamic_cast<cocos2d::Array*>(obj))) {
|
} else if ((arrVal = dynamic_cast<cocos2d::__Array*>(obj))) {
|
||||||
arrElement = ccarray_to_jsval(cx, arrVal);
|
arrElement = ccarray_to_jsval(cx, arrVal);
|
||||||
} else if ((doubleVal = dynamic_cast<Double*>(obj))) {
|
} else if ((doubleVal = dynamic_cast<__Double*>(obj))) {
|
||||||
arrElement = DOUBLE_TO_JSVAL(doubleVal->getValue());
|
arrElement = DOUBLE_TO_JSVAL(doubleVal->getValue());
|
||||||
} else if ((floatVal = dynamic_cast<Float*>(obj))) {
|
} else if ((floatVal = dynamic_cast<__Float*>(obj))) {
|
||||||
arrElement = DOUBLE_TO_JSVAL(floatVal->getValue());
|
arrElement = DOUBLE_TO_JSVAL(floatVal->getValue());
|
||||||
} else if ((intVal = dynamic_cast<Integer*>(obj))) {
|
} else if ((intVal = dynamic_cast<__Integer*>(obj))) {
|
||||||
arrElement = INT_TO_JSVAL(intVal->getValue());
|
arrElement = INT_TO_JSVAL(intVal->getValue());
|
||||||
} else if ((boolVal = dynamic_cast<Bool*>(obj))) {
|
} else if ((boolVal = dynamic_cast<__Bool*>(obj))) {
|
||||||
arrElement = BOOLEAN_TO_JSVAL(boolVal->getValue() ? JS_TRUE : JS_FALSE);
|
arrElement = BOOLEAN_TO_JSVAL(boolVal->getValue() ? JS_TRUE : JS_FALSE);
|
||||||
} else {
|
} else {
|
||||||
CCASSERT(false, "the type isn't suppored.");
|
CCASSERT(false, "the type isn't suppored.");
|
||||||
|
@ -1320,7 +1320,7 @@ jsval ccarray_to_jsval(JSContext* cx, Array *arr)
|
||||||
return OBJECT_TO_JSVAL(jsretArr);
|
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);
|
JSObject* jsRet = JS_NewObject(cx, NULL, NULL, NULL);
|
||||||
DictElement* pElement = NULL;
|
DictElement* pElement = NULL;
|
||||||
|
@ -1334,27 +1334,27 @@ jsval ccdictionary_to_jsval(JSContext* cx, Dictionary* dict)
|
||||||
dictElement = OBJECT_TO_JSVAL(jsproxy->obj);
|
dictElement = OBJECT_TO_JSVAL(jsproxy->obj);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
String* strVal = NULL;
|
__String* strVal = NULL;
|
||||||
Dictionary* dictVal = NULL;
|
__Dictionary* dictVal = NULL;
|
||||||
Array* arrVal = NULL;
|
__Array* arrVal = NULL;
|
||||||
Double* doubleVal = NULL;
|
__Double* doubleVal = NULL;
|
||||||
Bool* boolVal = NULL;
|
__Bool* boolVal = NULL;
|
||||||
Float* floatVal = NULL;
|
__Float* floatVal = NULL;
|
||||||
Integer* intVal = NULL;
|
__Integer* intVal = NULL;
|
||||||
|
|
||||||
if ((strVal = dynamic_cast<cocos2d::String *>(obj))) {
|
if ((strVal = dynamic_cast<cocos2d::__String *>(obj))) {
|
||||||
dictElement = c_string_to_jsval(cx, strVal->getCString());
|
dictElement = c_string_to_jsval(cx, strVal->getCString());
|
||||||
} else if ((dictVal = dynamic_cast<Dictionary*>(obj))) {
|
} else if ((dictVal = dynamic_cast<__Dictionary*>(obj))) {
|
||||||
dictElement = ccdictionary_to_jsval(cx, dictVal);
|
dictElement = ccdictionary_to_jsval(cx, dictVal);
|
||||||
} else if ((arrVal = dynamic_cast<Array*>(obj))) {
|
} else if ((arrVal = dynamic_cast<__Array*>(obj))) {
|
||||||
dictElement = ccarray_to_jsval(cx, arrVal);
|
dictElement = ccarray_to_jsval(cx, arrVal);
|
||||||
} else if ((doubleVal = dynamic_cast<Double*>(obj))) {
|
} else if ((doubleVal = dynamic_cast<__Double*>(obj))) {
|
||||||
dictElement = DOUBLE_TO_JSVAL(doubleVal->getValue());
|
dictElement = DOUBLE_TO_JSVAL(doubleVal->getValue());
|
||||||
} else if ((floatVal = dynamic_cast<Float*>(obj))) {
|
} else if ((floatVal = dynamic_cast<__Float*>(obj))) {
|
||||||
dictElement = DOUBLE_TO_JSVAL(floatVal->getValue());
|
dictElement = DOUBLE_TO_JSVAL(floatVal->getValue());
|
||||||
} else if ((intVal = dynamic_cast<Integer*>(obj))) {
|
} else if ((intVal = dynamic_cast<__Integer*>(obj))) {
|
||||||
dictElement = INT_TO_JSVAL(intVal->getValue());
|
dictElement = INT_TO_JSVAL(intVal->getValue());
|
||||||
} else if ((boolVal = dynamic_cast<Bool*>(obj))) {
|
} else if ((boolVal = dynamic_cast<__Bool*>(obj))) {
|
||||||
dictElement = BOOLEAN_TO_JSVAL(boolVal->getValue() ? JS_TRUE : JS_FALSE);
|
dictElement = BOOLEAN_TO_JSVAL(boolVal->getValue() ? JS_TRUE : JS_FALSE);
|
||||||
} else {
|
} else {
|
||||||
CCASSERT(false, "the type isn't suppored.");
|
CCASSERT(false, "the type isn't suppored.");
|
||||||
|
@ -1369,7 +1369,7 @@ jsval ccdictionary_to_jsval(JSContext* cx, Dictionary* dict)
|
||||||
return OBJECT_TO_JSVAL(jsRet);
|
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))
|
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);
|
JSObject* it = JS_NewPropertyIterator(cx, tmp);
|
||||||
Dictionary* dict = NULL;
|
__Dictionary* dict = NULL;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
@ -1404,7 +1404,7 @@ JSBool jsval_to_ccdictionary(JSContext* cx, jsval v, Dictionary** ret)
|
||||||
|
|
||||||
JSStringWrapper keyWrapper(JSVAL_TO_STRING(key), cx);
|
JSStringWrapper keyWrapper(JSVAL_TO_STRING(key), cx);
|
||||||
if (!dict) {
|
if (!dict) {
|
||||||
dict = Dictionary::create();
|
dict = __Dictionary::create();
|
||||||
}
|
}
|
||||||
|
|
||||||
JS::RootedValue value(cx);
|
JS::RootedValue value(cx);
|
||||||
|
@ -1423,7 +1423,7 @@ JSBool jsval_to_ccdictionary(JSContext* cx, jsval v, Dictionary** ret)
|
||||||
}
|
}
|
||||||
else if (!JS_IsArrayObject(cx, tmp)){
|
else if (!JS_IsArrayObject(cx, tmp)){
|
||||||
// It's a normal js object.
|
// It's a normal js object.
|
||||||
Dictionary* dictVal = NULL;
|
__Dictionary* dictVal = NULL;
|
||||||
JSBool ok = jsval_to_ccdictionary(cx, value, &dictVal);
|
JSBool ok = jsval_to_ccdictionary(cx, value, &dictVal);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
dict->setObject(dictVal, keyWrapper.get());
|
dict->setObject(dictVal, keyWrapper.get());
|
||||||
|
@ -1431,7 +1431,7 @@ JSBool jsval_to_ccdictionary(JSContext* cx, jsval v, Dictionary** ret)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// It's a js array object.
|
// It's a js array object.
|
||||||
Array* arrVal = NULL;
|
__Array* arrVal = NULL;
|
||||||
JSBool ok = jsval_to_ccarray(cx, value, &arrVal);
|
JSBool ok = jsval_to_ccarray(cx, value, &arrVal);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
dict->setObject(arrVal, keyWrapper.get());
|
dict->setObject(arrVal, keyWrapper.get());
|
||||||
|
|
|
@ -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 cccolor4b_to_jsval(JSContext* cx, const cocos2d::Color4B& v);
|
||||||
jsval cccolor4f_to_jsval(JSContext* cx, const cocos2d::Color4F& v);
|
jsval cccolor4f_to_jsval(JSContext* cx, const cocos2d::Color4F& v);
|
||||||
jsval cccolor3b_to_jsval(JSContext* cx, const cocos2d::Color3B& v);
|
jsval cccolor3b_to_jsval(JSContext* cx, const cocos2d::Color3B& v);
|
||||||
jsval ccdictionary_to_jsval(JSContext* cx, cocos2d::Dictionary *dict);
|
jsval ccdictionary_to_jsval(JSContext* cx, cocos2d::__Dictionary *dict);
|
||||||
jsval ccarray_to_jsval(JSContext* cx, cocos2d::Array *arr);
|
jsval ccarray_to_jsval(JSContext* cx, cocos2d::__Array *arr);
|
||||||
jsval ccacceleration_to_jsval(JSContext* cx, const cocos2d::Acceleration& v);
|
jsval ccacceleration_to_jsval(JSContext* cx, const cocos2d::Acceleration& v);
|
||||||
jsval ccaffinetransform_to_jsval(JSContext* cx, const cocos2d::AffineTransform& t);
|
jsval ccaffinetransform_to_jsval(JSContext* cx, const cocos2d::AffineTransform& t);
|
||||||
jsval FontDefinition_to_jsval(JSContext* cx, const cocos2d::FontDefinition& t);
|
jsval FontDefinition_to_jsval(JSContext* cx, const cocos2d::FontDefinition& t);
|
||||||
|
|
Loading…
Reference in New Issue