From 293e17494d4005cf81edd941086452a755a0bc61 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 14 Mar 2013 20:34:54 +0800 Subject: [PATCH 1/2] fixed #1830: Force casting `unsigned short*` to `jschar*` for `cc_utf8_to_utf16`. --- scripting/javascript/bindings/cocos2d_specifics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripting/javascript/bindings/cocos2d_specifics.cpp b/scripting/javascript/bindings/cocos2d_specifics.cpp index 2a3c4b4e79..a77551eab7 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.cpp +++ b/scripting/javascript/bindings/cocos2d_specifics.cpp @@ -2567,7 +2567,7 @@ JSBool js_cocos2dx_CCFileUtils_getStringFromFile(JSContext *cx, uint32_t argc, j unsigned char* ret = cobj->getFileData(arg0, "rb", &size); if (ret && size > 0) { //JSString* str = JS_NewStringCopyN(cx, (const char*)ret, (size_t)size); - jschar* strUTF16 = cc_utf8_to_utf16((char*)ret); + jschar* strUTF16 = (jschar*)cc_utf8_to_utf16((char*)ret); JSString* str = JS_NewUCStringCopyZ(cx, strUTF16); if (str != NULL) { JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(str)); From 911f60748467e20eccb8b1cd1d1fec897320f8cb Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 14 Mar 2013 20:38:52 +0800 Subject: [PATCH 2/2] Tabs ~> 4 spaces --- scripting/javascript/bindings/cocos2d_specifics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripting/javascript/bindings/cocos2d_specifics.cpp b/scripting/javascript/bindings/cocos2d_specifics.cpp index a77551eab7..33e9737e34 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.cpp +++ b/scripting/javascript/bindings/cocos2d_specifics.cpp @@ -2567,7 +2567,7 @@ JSBool js_cocos2dx_CCFileUtils_getStringFromFile(JSContext *cx, uint32_t argc, j unsigned char* ret = cobj->getFileData(arg0, "rb", &size); if (ret && size > 0) { //JSString* str = JS_NewStringCopyN(cx, (const char*)ret, (size_t)size); - jschar* strUTF16 = (jschar*)cc_utf8_to_utf16((char*)ret); + jschar* strUTF16 = (jschar*)cc_utf8_to_utf16((char*)ret); JSString* str = JS_NewUCStringCopyZ(cx, strUTF16); if (str != NULL) { JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(str));