fix lua bindings warnings

This commit is contained in:
andyque 2014-03-20 16:48:12 +08:00
parent f26ae8a019
commit cf86fd619f
8 changed files with 15 additions and 15 deletions

View File

@ -224,7 +224,7 @@ __String* __String::create(const std::string& str)
return ret;
}
__String* __String::createWithData(const unsigned char* data, int nLen)
__String* __String::createWithData(const unsigned char* data, size_t nLen)
{
__String* ret = NULL;
if (data != NULL)

View File

@ -167,7 +167,7 @@ public:
* it means that you needn't do a release operation unless you retain it.
* @js NA
*/
static __String* createWithData(const unsigned char* pData, int nLen);
static __String* createWithData(const unsigned char* pData, size_t nLen);
/** create a string with a file,
* @return A String pointer which is an autorelease object pointer,

View File

@ -221,7 +221,7 @@ void LuaStack::addLuaLoader(lua_CFunction func)
// insert loader into index 2
lua_pushcfunction(_state, func); /* L: package, loaders, func */
for (int i = lua_objlen(_state, -2) + 1; i > 2; --i)
for (int i = (int)(lua_objlen(_state, -2) + 1); i > 2; --i)
{
lua_rawgeti(_state, -2, i - 1); /* L: package, loaders, func, function */
// we call lua_rawgeti, so the loader table now is at -3
@ -446,11 +446,11 @@ int LuaStack::executeFunction(int numArgs)
int ret = 0;
if (lua_isnumber(_state, -1))
{
ret = lua_tointeger(_state, -1);
ret = (int)lua_tointeger(_state, -1);
}
else if (lua_isboolean(_state, -1))
{
ret = lua_toboolean(_state, -1);
ret = (int)lua_toboolean(_state, -1);
}
// remove return value from stack
lua_pop(_state, 1); /* L: ... [G] */

View File

@ -1032,7 +1032,7 @@ bool luaval_to_array_of_Point(lua_State* L,int lo,Point **points, int *numPoints
lua_pop(L, 1);
}
*numPoints = len;
*numPoints = (int)len;
*points = array;
}
}

View File

@ -96,7 +96,7 @@ void LuaWebSocket::onMessage(WebSocket* ws, const WebSocket::Data& data)
if (data.isBinary) {
int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)this,ScriptHandlerMgr::HandlerType::WEBSOCKET_MESSAGE);
if (0 != handler) {
SendBinaryMessageToLua(handler, (const unsigned char*)data.bytes, data.len);
SendBinaryMessageToLua(handler, (const unsigned char*)data.bytes, (int)data.len);
}
}
else{
@ -107,7 +107,7 @@ void LuaWebSocket::onMessage(WebSocket* ws, const WebSocket::Data& data)
LuaStack* stack = LuaEngine::getInstance()->getLuaStack();
if (nullptr != stack)
{
stack->pushString(data.bytes,data.len);
stack->pushString(data.bytes,(int)data.len);
stack->executeFunctionByHandler(handler, 1);
}
}
@ -348,7 +348,7 @@ static int tolua_Cocos2d_WebSocket_sendString00(lua_State* tolua_S)
if (strlen(data) != size)
{
self->send((const unsigned char*)data, size);
self->send((const unsigned char*)data, (unsigned int)size);
}
else
{

View File

@ -2092,7 +2092,7 @@ static int tolua_bnd_cast_deprecated00(lua_State* tolua_S)
void* v = nullptr;
std::string strValue = "";
strValue = tolua_tostring(tolua_S,2,NULL);
int pos = strValue.find("CC");
size_t pos = strValue.find("CC");
if (pos == 0 &&
std::string::npos == strValue.find("CCBAnimationManager") &&
std::string::npos == strValue.find("CCString") &&

View File

@ -1 +1 @@
49e177aafe2822631bfae335acd747bf1e03e55b
99f00c770c5e8962571ec10047eb65f8fa1d5db0

View File

@ -58,7 +58,7 @@ void LuaMinXmlHttpRequest::_gotHeader(string header)
char * cstr = new char [header.length()+1];
// check for colon.
unsigned found_header_field = header.find_first_of(":");
size_t found_header_field = header.find_first_of(":");
if (found_header_field != std::string::npos)
{
@ -92,7 +92,7 @@ void LuaMinXmlHttpRequest::_gotHeader(string header)
ss << pch;
val = ss.str();
unsigned found_http = val.find("HTTP");
size_t found_http = val.find("HTTP");
// Check for HTTP Header to set statusText
if (found_http != std::string::npos) {
@ -200,9 +200,9 @@ void LuaMinXmlHttpRequest::handle_requestResponse(network::HttpClient *sender, n
CCLOG("%s completed", response->getHttpRequest()->getTag());
}
int statusCode = response->getResponseCode();
long statusCode = response->getResponseCode();
char statusString[64] = {};
sprintf(statusString, "HTTP Status Code: %d, tag = %s", statusCode, response->getHttpRequest()->getTag());
sprintf(statusString, "HTTP Status Code: %ld, tag = %s", statusCode, response->getHttpRequest()->getTag());
if (!response->isSucceed())
{