Fixed compiling-warnings (MSVC2012): C4996(* was declared deprecated), C4305 (* truncation from 'double' to 'float'), C4018 (* signed/unsigned mismatch), C4800(* forcing value to bool 'true' or 'false').

This commit is contained in:
signmotion 2013-09-22 23:50:54 +03:00
parent 2bffc959fd
commit 7d139a3bc3
9 changed files with 23 additions and 23 deletions

View File

@ -236,7 +236,7 @@ void PhysicsWorld::drawWithShape(DrawNode* node, PhysicsShape* shape)
PhysicsHelper::cpvs2points(poly->tVerts, seg, num); PhysicsHelper::cpvs2points(poly->tVerts, seg, num);
node->drawPolygon(seg, num, Color4F(1, 0, 0, 0.3), 1, Color4F(1, 0, 0, 1)); node->drawPolygon(seg, num, Color4F(1.0f, 0.0f, 0.0f, 0.3f), 1.0f, Color4F(1.0f, 0.0f, 0.0f, 1.0f));
delete[] seg; delete[] seg;
break; break;

View File

@ -82,7 +82,7 @@ ActionObject* ActionManagerEx::getActionByName(const char* jsonName,const char*
{ {
return NULL; return NULL;
} }
for (unsigned int i=0; i<actionList->count(); i++) for (int i = 0; i < actionList->count(); i++)
{ {
ActionObject* action = dynamic_cast<ActionObject*>(actionList->getObjectAtIndex(i)); ActionObject* action = dynamic_cast<ActionObject*>(actionList->getObjectAtIndex(i));
if (strcmp(actionName, action->getName()) == 0) if (strcmp(actionName, action->getName()) == 0)

View File

@ -90,7 +90,7 @@ void DisplayManager::addDisplay(DisplayData *displayData, int index)
{ {
DecorativeDisplay *decoDisplay = NULL; DecorativeDisplay *decoDisplay = NULL;
if(index >= 0 && (unsigned int)index < _decoDisplayList->count()) if( (index >= 0) && (index < _decoDisplayList->count()) )
{ {
decoDisplay = (DecorativeDisplay *)_decoDisplayList->getObjectAtIndex(index); decoDisplay = (DecorativeDisplay *)_decoDisplayList->getObjectAtIndex(index);
} }
@ -114,7 +114,7 @@ void DisplayManager::addDisplay(Node *display, int index)
{ {
DecorativeDisplay *decoDisplay = NULL; DecorativeDisplay *decoDisplay = NULL;
if(index >= 0 && (unsigned int)index < _decoDisplayList->count()) if( (index >= 0) && (index < _decoDisplayList->count()) )
{ {
decoDisplay = (DecorativeDisplay *)_decoDisplayList->getObjectAtIndex(index); decoDisplay = (DecorativeDisplay *)_decoDisplayList->getObjectAtIndex(index);
} }

View File

@ -704,7 +704,7 @@ MovementData *DataReaderHelper::decodeMovement(tinyxml2::XMLElement *movementXML
} }
if( movementXML->QueryIntAttribute(A_LOOP, &(loop)) == tinyxml2::XML_SUCCESS) if( movementXML->QueryIntAttribute(A_LOOP, &(loop)) == tinyxml2::XML_SUCCESS)
{ {
movementData->loop = (bool)loop; movementData->loop = (loop != 0);
} }
const char *_easing = movementXML->Attribute(A_TWEEN_EASING); const char *_easing = movementXML->Attribute(A_TWEEN_EASING);
@ -855,7 +855,7 @@ MovementBoneData *DataReaderHelper::decodeMovementBone(tinyxml2::XMLElement *mov
//! Change rotation range from (-180 -- 180) to (-infinity -- infinity) //! Change rotation range from (-180 -- 180) to (-infinity -- infinity)
CCFrameData **frames = (CCFrameData **)movBoneData->frameList.data->arr; FrameData **frames = (FrameData **)movBoneData->frameList.data->arr;
for (int i = movBoneData->frameList.count() - 1; i >= 0; i--) for (int i = movBoneData->frameList.count() - 1; i >= 0; i--)
{ {
if (i > 0) if (i > 0)
@ -1432,7 +1432,7 @@ MovementBoneData *DataReaderHelper::decodeMovementBone(cs::JsonDictionary &json)
if (s_CocoStudioVersion < VERSION_CHANGE_ROTATION_RANGE) if (s_CocoStudioVersion < VERSION_CHANGE_ROTATION_RANGE)
{ {
//! Change rotation range from (-180 -- 180) to (-infinity -- infinity) //! Change rotation range from (-180 -- 180) to (-infinity -- infinity)
CCFrameData **frames = (CCFrameData **)movementBoneData->frameList.data->arr; FrameData **frames = (FrameData **)movementBoneData->frameList.data->arr;
for (int i = movementBoneData->frameList.count() - 1; i >= 0; i--) for (int i = movementBoneData->frameList.count() - 1; i >= 0; i--)
{ {
if (i > 0) if (i > 0)

View File

@ -261,7 +261,7 @@ void UIPageView::updateChildrenSize()
} }
Size selfSize = getSize(); Size selfSize = getSize();
for (unsigned int i=0; i<_pages->count(); i++) for (int i = 0; i < _pages->count(); i++)
{ {
Layout* page = dynamic_cast<Layout*>(_pages->getObjectAtIndex(i)); Layout* page = dynamic_cast<Layout*>(_pages->getObjectAtIndex(i));
page->setSize(selfSize); page->setSize(selfSize);

View File

@ -105,7 +105,7 @@ const char* DictionaryHelper::getStringValue(cocos2d::Dictionary* root,const cha
bool DictionaryHelper::getBooleanValue(cocos2d::Dictionary* root,const char* key) bool DictionaryHelper::getBooleanValue(cocos2d::Dictionary* root,const char* key)
{ {
return this->getIntValue(root, key); return (getIntValue( root, key ) != 0);
} }
cocos2d::Array* DictionaryHelper::getArrayValue(cocos2d::Dictionary *root, const char *key) cocos2d::Array* DictionaryHelper::getArrayValue(cocos2d::Dictionary *root, const char *key)
@ -163,9 +163,9 @@ bool DictionaryHelper::objectToBooleanValue(cocos2d::Object *obj)
{ {
if (!obj) if (!obj)
{ {
return 0; return false;
} }
return this->objectToIntValue(obj); return (objectToIntValue( obj ) != 0);
} }
cocos2d::Array* DictionaryHelper::objectToCCArray(cocos2d::Object *obj) cocos2d::Array* DictionaryHelper::objectToCCArray(cocos2d::Object *obj)

View File

@ -308,7 +308,7 @@ NS_CC_EXT_BEGIN
} }
pAudio->preloadBackgroundMusic(pPath.c_str()); pAudio->preloadBackgroundMusic(pPath.c_str());
pAudio->setFile(pPath.c_str()); pAudio->setFile(pPath.c_str());
bool bLoop = subDict->getItemIntValue("loop", 0); const bool bLoop = (subDict->getItemIntValue("loop", 0) != 0);
pAudio->setLoop(bLoop); pAudio->setLoop(bLoop);
gb->addComponent(pAudio); gb->addComponent(pAudio);
pAudio->playBackgroundMusic(pPath.c_str(), bLoop); pAudio->playBackgroundMusic(pPath.c_str(), bLoop);
@ -354,7 +354,7 @@ NS_CC_EXT_BEGIN
int y = dict->getItemIntValue("y", 0); int y = dict->getItemIntValue("y", 0);
node->setPosition(Point(x, y)); node->setPosition(Point(x, y));
bool bVisible = (bool)(dict->getItemIntValue("visible", 1)); const bool bVisible = (dict->getItemIntValue("visible", 1) != 0);
node->setVisible(bVisible); node->setVisible(bVisible);
int nTag = dict->getItemIntValue("objecttag", -1); int nTag = dict->getItemIntValue("objecttag", -1);

View File

@ -52,7 +52,7 @@ bool UINodeContainerTest::init()
m_pUiLayer->addWidget(nodeContainer); m_pUiLayer->addWidget(nodeContainer);
Sprite* sprite = Sprite::create("cocosgui/ccicon.png"); Sprite* sprite = Sprite::create("cocosgui/ccicon.png");
sprite->setPosition(Point(0, sprite->boundingBox().size.height / 4)); sprite->setPosition(Point(0, sprite->getBoundingBox().size.height / 4));
nodeContainer->addRenderer(sprite, 0); nodeContainer->addRenderer(sprite, 0);
return true; return true;

View File

@ -67,8 +67,8 @@ void UITextFieldTest::textFieldEvent(Object *pSender, TextFiledEventType type)
{ {
UITextField* textField = dynamic_cast<UITextField*>(pSender); UITextField* textField = dynamic_cast<UITextField*>(pSender);
Size screenSize = CCDirector::getInstance()->getWinSize(); Size screenSize = CCDirector::getInstance()->getWinSize();
textField->runAction(CCMoveTo::create(0.225, textField->runAction(CCMoveTo::create(0.225f,
Point(screenSize.width / 2.0f, screenSize.height / 2.0f + textField->getContentSize().height / 2))); Point(screenSize.width / 2.0f, screenSize.height / 2.0f + textField->getContentSize().height / 2.0f)));
m_pDisplayValueLabel->setText(CCString::createWithFormat("attach with IME")->getCString()); m_pDisplayValueLabel->setText(CCString::createWithFormat("attach with IME")->getCString());
} }
break; break;
@ -77,7 +77,7 @@ void UITextFieldTest::textFieldEvent(Object *pSender, TextFiledEventType type)
{ {
UITextField* textField = dynamic_cast<UITextField*>(pSender); UITextField* textField = dynamic_cast<UITextField*>(pSender);
Size screenSize = CCDirector::getInstance()->getWinSize(); Size screenSize = CCDirector::getInstance()->getWinSize();
textField->runAction(CCMoveTo::create(0.175, Point(screenSize.width / 2.0f, screenSize.height / 2.0f))); textField->runAction(CCMoveTo::create(0.175f, Point(screenSize.width / 2.0f, screenSize.height / 2.0f)));
m_pDisplayValueLabel->setText(CCString::createWithFormat("detach with IME")->getCString()); m_pDisplayValueLabel->setText(CCString::createWithFormat("detach with IME")->getCString());
} }
break; break;
@ -155,8 +155,8 @@ void UITextFieldTest_MaxLength::textFieldEvent(Object *pSender, TextFiledEventTy
{ {
UITextField* textField = dynamic_cast<UITextField*>(pSender); UITextField* textField = dynamic_cast<UITextField*>(pSender);
Size screenSize = CCDirector::getInstance()->getWinSize(); Size screenSize = CCDirector::getInstance()->getWinSize();
textField->runAction(CCMoveTo::create(0.225, textField->runAction(CCMoveTo::create(0.225f,
Point(screenSize.width / 2.0f, screenSize.height / 2.0f + textField->getContentSize().height / 2))); Point(screenSize.width / 2.0f, screenSize.height / 2.0f + textField->getContentSize().height / 2.0f)));
m_pDisplayValueLabel->setText(CCString::createWithFormat("attach with IME max length %d", textField->getMaxLength())->getCString()); m_pDisplayValueLabel->setText(CCString::createWithFormat("attach with IME max length %d", textField->getMaxLength())->getCString());
} }
break; break;
@ -165,7 +165,7 @@ void UITextFieldTest_MaxLength::textFieldEvent(Object *pSender, TextFiledEventTy
{ {
UITextField* textField = dynamic_cast<UITextField*>(pSender); UITextField* textField = dynamic_cast<UITextField*>(pSender);
Size screenSize = CCDirector::getInstance()->getWinSize(); Size screenSize = CCDirector::getInstance()->getWinSize();
textField->runAction(CCMoveTo::create(0.175, Point(screenSize.width / 2.0f, screenSize.height / 2.0f))); textField->runAction(CCMoveTo::create(0.175f, Point(screenSize.width / 2.0f, screenSize.height / 2.0f)));
m_pDisplayValueLabel->setText(CCString::createWithFormat("detach with IME max length %d", textField->getMaxLength())->getCString()); m_pDisplayValueLabel->setText(CCString::createWithFormat("detach with IME max length %d", textField->getMaxLength())->getCString());
} }
break; break;
@ -249,8 +249,8 @@ void UITextFieldTest_Password::textFieldEvent(Object *pSender, TextFiledEventTyp
{ {
UITextField* textField = dynamic_cast<UITextField*>(pSender); UITextField* textField = dynamic_cast<UITextField*>(pSender);
Size screenSize = CCDirector::getInstance()->getWinSize(); Size screenSize = CCDirector::getInstance()->getWinSize();
textField->runAction(CCMoveTo::create(0.225, textField->runAction(CCMoveTo::create(0.225f,
Point(screenSize.width / 2.0f, screenSize.height / 2.0f + textField->getContentSize().height / 2))); Point(screenSize.width / 2.0f, screenSize.height / 2.0f + textField->getContentSize().height / 2.0f)));
m_pDisplayValueLabel->setText(CCString::createWithFormat("attach with IME password")->getCString()); m_pDisplayValueLabel->setText(CCString::createWithFormat("attach with IME password")->getCString());
} }
break; break;
@ -259,7 +259,7 @@ void UITextFieldTest_Password::textFieldEvent(Object *pSender, TextFiledEventTyp
{ {
UITextField* textField = dynamic_cast<UITextField*>(pSender); UITextField* textField = dynamic_cast<UITextField*>(pSender);
Size screenSize = CCDirector::getInstance()->getWinSize(); Size screenSize = CCDirector::getInstance()->getWinSize();
textField->runAction(CCMoveTo::create(0.175, Point(screenSize.width / 2.0f, screenSize.height / 2.0f))); textField->runAction(CCMoveTo::create(0.175f, Point(screenSize.width / 2.0f, screenSize.height / 2.0f)));
m_pDisplayValueLabel->setText(CCString::createWithFormat("detach with IME password")->getCString()); m_pDisplayValueLabel->setText(CCString::createWithFormat("detach with IME password")->getCString());
} }
break; break;