fix lots compile warnings

This commit is contained in:
andyque 2014-03-20 16:24:55 +08:00
parent af228ac7ac
commit 7ab639ec0f
25 changed files with 48 additions and 48 deletions

View File

@ -1 +1 @@
044fbe06a7419f54a1da5bd5e597fe75024b6b88
3eb192c0ace48e12066fefe4f9cbd2f59a442683

View File

@ -1 +1 @@
59cab787aa72667424fc666730a33ab58d8e42cb
e783430cb4c4cbc592d73c696ab10bc341c20b18

View File

@ -44,7 +44,7 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
buildConfiguration = "Release"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">

View File

@ -75,7 +75,7 @@ public:
/**
@brief If the sender doesn't want to delete the delText, return true;
*/
virtual bool onTextFieldDeleteBackward(TextFieldTTF * sender, const char * delText, int nLen)
virtual bool onTextFieldDeleteBackward(TextFieldTTF * sender, const char * delText, size_t nLen)
{
CC_UNUSED_PARAM(sender);
CC_UNUSED_PARAM(delText);

View File

@ -123,7 +123,7 @@ public:
/** Option field. You can set your post data here
*/
inline void setRequestData(const char* buffer, unsigned int len)
inline void setRequestData(const char* buffer, size_t len)
{
_requestData.assign(buffer, buffer + len);
};

View File

@ -109,7 +109,7 @@ bool UICCTextField::onTextFieldInsertText(TextFieldTTF *pSender, const char *tex
return false;
}
bool UICCTextField::onTextFieldDeleteBackward(TextFieldTTF *pSender, const char *delText, int nLen)
bool UICCTextField::onTextFieldDeleteBackward(TextFieldTTF *pSender, const char *delText, size_t nLen)
{
setDeleteBackward(true);
return false;

View File

@ -50,7 +50,7 @@ public:
virtual bool onTextFieldAttachWithIME(TextFieldTTF *pSender) override;
virtual bool onTextFieldDetachWithIME(TextFieldTTF * pSender) override;
virtual bool onTextFieldInsertText(TextFieldTTF * pSender, const char * text, size_t nLen) override;
virtual bool onTextFieldDeleteBackward(TextFieldTTF * pSender, const char * delText, int nLen) override;
virtual bool onTextFieldDeleteBackward(TextFieldTTF * pSender, const char * delText, size_t nLen) override;
void insertText(const char* text, size_t len);
void deleteBackward();

View File

@ -180,7 +180,7 @@ std::string ConsoleCustomCommand::subtitle() const
ConsoleUploadFile::ConsoleUploadFile()
{
srand (time(NULL));
srand ((unsigned)time(NULL));
int _id = rand()%100000;
char buf[32];
sprintf(buf, "%d", _id);
@ -278,10 +278,10 @@ void ConsoleUploadFile::uploadFile()
unsigned char *in;
in = (unsigned char *)buffer;
// copy the file into the buffer:
int ret = fread(buffer, 1, 3, fp);
size_t ret = fread(buffer, 1, 3, fp);
if (ret > 0)
{
base64Encode(in, ret, &out);
base64Encode(in, (unsigned int)ret, &out);
send(sfd, out, 4, 0);
free(out);
if(ret < 3)

View File

@ -60,7 +60,7 @@ void PrettyPrinterDemo::onEnter()
log("%s", vistor.getResult().c_str());
log("-------------------------------");
Set myset;
__Set myset;
for (int i = 0; i < 30; ++i) {
myset.addObject(String::createWithFormat("str: %d", i));
}

View File

@ -1039,7 +1039,7 @@ void TestColliderDetector::update(float delta)
const std::vector<Point> &vertexList = body->getCalculatedVertexList();
float minx = 0, miny = 0, maxx = 0, maxy = 0;
int length = vertexList.size();
size_t length = vertexList.size();
for (int i = 0; i<length; i++)
{
Point vertex = vertexList.at(i);

View File

@ -95,7 +95,7 @@ bool UIListViewTest_Vertical::init()
listView->setItemModel(default_item);
// add default item
int count = _array->count();
ssize_t count = _array->count();
for (int i = 0; i < count / 4; ++i)
{
listView->pushBackDefaultItem();
@ -125,7 +125,7 @@ bool UIListViewTest_Vertical::init()
}
// insert custom item
Vector<Widget*>& items = listView->getItems();
int items_count = items.size();
ssize_t items_count = items.size();
for (int i = 0; i < count / 4; ++i)
{
Button* custom_button = Button::create();
@ -149,7 +149,7 @@ bool UIListViewTest_Vertical::init()
{
Widget* item = listView->getItem(i);
Button* button = static_cast<Button*>(item->getChildByName("Title Button"));
int index = listView->getIndex(item);
ssize_t index = listView->getIndex(item);
button->setTitleText(static_cast<__String*>(_array->getObjectAtIndex(index))->getCString());
}
@ -278,7 +278,7 @@ bool UIListViewTest_Horizontal::init()
listView->setItemModel(default_item);
// add default item
int count = _array->count();
ssize_t count = _array->count();
for (int i = 0; i < count / 4; ++i)
{
listView->pushBackDefaultItem();
@ -308,7 +308,7 @@ bool UIListViewTest_Horizontal::init()
}
// insert custom item
Vector<Widget*>& items = listView->getItems();
int items_count = items.size();
ssize_t items_count = items.size();
for (int i = 0; i < count / 4; ++i)
{
Button* custom_button = Button::create();
@ -332,7 +332,7 @@ bool UIListViewTest_Horizontal::init()
{
Widget *item = listView->getItem(i);
Button *button = static_cast<Button*>(item->getChildByName("Title Button"));
int index = listView->getIndex(item);
ssize_t index = listView->getIndex(item);
button->setTitleText(static_cast<__String*>(_array->getObjectAtIndex(index))->getCString());
}

View File

@ -126,7 +126,7 @@ void HttpClientTest::onMenuPostTestClicked(cocos2d::Ref *sender)
// write the post data
const char* postData = "visitor=cocos2d&TestSuite=Extensions Test/NetworkTest";
request->setRequestData(postData, strlen(postData));
request->setRequestData(postData, strlen(postData));
request->setTag("POST test1");
HttpClient::getInstance()->send(request);
@ -145,7 +145,7 @@ void HttpClientTest::onMenuPostTestClicked(cocos2d::Ref *sender)
// write the post data
const char* postData = "visitor=cocos2d&TestSuite=Extensions Test/NetworkTest";
request->setRequestData(postData, strlen(postData));
request->setRequestData(postData, strlen(postData));
request->setTag("POST test2");
HttpClient::getInstance()->send(request);
@ -259,11 +259,11 @@ void HttpClientTest::onHttpRequestCompleted(HttpClient *sender, HttpResponse *re
log("%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());
_labelStatusCode->setString(statusString);
log("response code: %d", statusCode);
log("response code: %ld", statusCode);
if (!response->isSucceed())
{

View File

@ -197,7 +197,7 @@ void TestSearchPath::onEnter()
if (fp)
{
char szReadBuf[100] = {0};
int read = fread(szReadBuf, 1, strlen(szBuf), fp);
size_t read = fread(szReadBuf, 1, strlen(szBuf), fp);
if (read > 0)
log("The content of file from writable path: %s", szReadBuf);
fclose(fp);

View File

@ -55,7 +55,7 @@ protected:
float _moveTimer;
float _addTimer;
Vector<Sprite*> _childList;
int _preListSize;
ssize_t _preListSize;
int _printCount;
float _addChildStep;

View File

@ -1639,7 +1639,7 @@ void AddAndDeleteParticleSystems::onEnter()
void AddAndDeleteParticleSystems::removeSystem(float dt)
{
int nChildrenCount = _batchNode->getChildren().size();
ssize_t nChildrenCount = _batchNode->getChildren().size();
if (nChildrenCount > 0)
{
CCLOG("remove random system");

View File

@ -327,7 +327,7 @@ void TemplateVectorPerfTest::generateTestFunctions()
{ "replace", [=](){
Vector<Node*> nodeVector = createVector();
srand(time(nullptr));
srand((unsigned)time(nullptr));
ssize_t index = rand() % quantityOfNodes;
CC_PROFILER_START(this->profilerName());
@ -549,7 +549,7 @@ void ArrayPerfTest::generateTestFunctions()
{ "setObject", [=](){
__Array* nodeVector = createArray();
srand(time(nullptr));
srand((unsigned)time(nullptr));
ssize_t index = rand() % quantityOfNodes;
CC_PROFILER_START(this->profilerName());
@ -618,7 +618,7 @@ void ArrayPerfTest::generateTestFunctions()
} } ,
{ "removeAllObjects", [=](){
Array* nodeVector = createArray();
__Array* nodeVector = createArray();
CC_PROFILER_START(this->profilerName());
for( int i=0; i<quantityOfNodes; ++i)
@ -867,7 +867,7 @@ std::string TemplateMapStringKeyPerfTest::subtitle() const
void DictionaryStringKeyPerfTest::generateTestFunctions()
{
auto createDict = [this](){
Dictionary* ret = Dictionary::create();
__Dictionary* ret = __Dictionary::create();
for( int i=0; i<quantityOfNodes; ++i)
{
@ -880,7 +880,7 @@ void DictionaryStringKeyPerfTest::generateTestFunctions()
TestFunction testFunctions[] = {
{ "setObject", [=](){
Dictionary* dict = Dictionary::create();
__Dictionary* dict = __Dictionary::create();
std::string* keys = new std::string[quantityOfNodes];

View File

@ -90,7 +90,7 @@ void EventDispatcherBasicLayer::showCurrentTest()
void PerformanceEventDispatcherScene::initWithQuantityOfNodes(unsigned int nNodes)
{
_type = 0;
srand(time(nullptr));
srand((unsigned)time(nullptr));
auto s = Director::getInstance()->getWinSize();
// Title

View File

@ -266,12 +266,12 @@ void ScenarioTest::addNewSprites(int num)
void ScenarioTest::removeSprites()
{
int number = _spriteArray.size();
ssize_t number = _spriteArray.size();
if (number <= 0) {
return;
}
int removeNum = MIN(number, _spriteStepNum);
ssize_t removeNum = MIN(number, _spriteStepNum);
for (int i = 0; i < removeNum; ++i) {
auto sprite = _spriteArray.getRandomObject();
removeChild(sprite);
@ -324,12 +324,12 @@ void ScenarioTest::addParticleSystem(int num)
void ScenarioTest::removeParticleSystem()
{
int number = _parsysArray.size();
ssize_t number = _parsysArray.size();
if (number <= 0) {
return;
}
int removeNum = MIN(number, _parsysStepNum);
ssize_t removeNum = MIN(number, _parsysStepNum);
for (int i = 0; i < removeNum; ++i) {
auto par = _parsysArray.getRandomObject();
removeChild(par);

View File

@ -230,7 +230,7 @@ void TouchesPerformTest3::onEnter()
#define TOUCH_PROFILER_NAME "TouchProfileName"
#define TOUCHABLE_NODE_NUM 1000
srand(time(nullptr));
srand((unsigned)time(nullptr));
for (int i = 0; i < TOUCHABLE_NODE_NUM; ++i)
{

View File

@ -1530,7 +1530,7 @@ bool PhysicsContactTest::onContactBegin(PhysicsContact& contact)
PhysicsBody* a = contact.getShapeA()->getBody();
PhysicsBody* b = contact.getShapeB()->getBody();
PhysicsBody* body = (a->getCategoryBitmask() == 0x04 || a->getCategoryBitmask() == 0x08) ? a : b;
CC_UNUSED_PARAM(body);
CC_ASSERT(body->getCategoryBitmask() == 0x04 || body->getCategoryBitmask() == 0x08);
return true;

View File

@ -1 +1 @@
39606c4582eeb2df1285728e81b8f9553a527bc1
4bb0b2a6151e4910ea662bedd91a5be655ec05d1

View File

@ -166,7 +166,7 @@ void KeyboardNotificationLayer::keyboardWillShow(IMEKeyboardNotificationInfo& in
// move all the children node of KeyboardNotificationLayer
auto& children = getChildren();
Node * node = 0;
int count = children.size();
ssize_t count = children.size();
Point pos;
for (int i = 0; i < count; ++i)
{
@ -356,7 +356,7 @@ bool TextFieldTTFActionTest::onTextFieldDetachWithIME(TextFieldTTF * sender)
return false;
}
bool TextFieldTTFActionTest::onTextFieldInsertText(TextFieldTTF * sender, const char * text, int nLen)
bool TextFieldTTFActionTest::onTextFieldInsertText(TextFieldTTF * sender, const char * text, size_t nLen)
{
// if insert enter, treat as default to detach with ime
if ('\n' == *text)
@ -401,7 +401,7 @@ bool TextFieldTTFActionTest::onTextFieldInsertText(TextFieldTTF * sender, const
return false;
}
bool TextFieldTTFActionTest::onTextFieldDeleteBackward(TextFieldTTF * sender, const char * delText, int nLen)
bool TextFieldTTFActionTest::onTextFieldDeleteBackward(TextFieldTTF * sender, const char * delText, size_t nLen)
{
// create a delete text sprite and do some action
auto label = LabelTTF::create(delText, FONT_NAME, FONT_SIZE);

View File

@ -88,8 +88,8 @@ public:
// TextFieldDelegate
virtual bool onTextFieldAttachWithIME(TextFieldTTF * sender);
virtual bool onTextFieldDetachWithIME(TextFieldTTF * sender);
virtual bool onTextFieldInsertText(TextFieldTTF * sender, const char * text, int nLen);
virtual bool onTextFieldDeleteBackward(TextFieldTTF * sender, const char * delText, int nLen);
virtual bool onTextFieldInsertText(TextFieldTTF * sender, const char * text, size_t nLen) override;
virtual bool onTextFieldDeleteBackward(TextFieldTTF * sender, const char * delText, size_t nLen) override;
virtual bool onDraw(TextFieldTTF * sender);
};

View File

@ -930,7 +930,7 @@ TMXIsoZorder::TMXIsoZorder()
map->setPosition(Point(-s.width/2,0));
_tamara = Sprite::create(s_pathSister1);
map->addChild(_tamara, map->getChildren().size() );
map->addChild(_tamara, (int)map->getChildren().size() );
_tamara->retain();
int mapWidth = map->getMapSize().width * map->getTileSize().width;
_tamara->setPosition(CC_POINT_PIXELS_TO_POINTS(Point( mapWidth/2,0)));
@ -998,7 +998,7 @@ TMXOrthoZorder::TMXOrthoZorder()
CCLOG("ContentSize: %f, %f", s.width,s.height);
_tamara = Sprite::create(s_pathSister1);
map->addChild(_tamara, map->getChildren().size());
map->addChild(_tamara, (int)map->getChildren().size());
_tamara->retain();
_tamara->setAnchorPoint(Point(0.5f,0));

View File

@ -319,7 +319,7 @@ void TemplateVectorTest::onEnter()
// get random object
// Set the seed by time
srand(time(nullptr));
srand((unsigned)time(nullptr));
Vector<Node*> vecForRandom = createVector();
log("<--- begin ---->");
for (int i = 0; i < vecForRandom.size(); ++i)
@ -518,7 +518,7 @@ void TemplateMapTest::onEnter()
// get random object
// Set the seed by time
srand(time(nullptr));
srand((unsigned)time(nullptr));
Map<std::string, Node*> mapForRandom = createMap();
log("<--- begin ---->");
for (int i = 0; i < mapForRandom.size(); ++i)