From 8e2840072532bca40d4b0854d2c61e6acd1d49ee Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 5 Mar 2014 15:04:30 +0800 Subject: [PATCH] Some warning fixes in cpp-tests. --- .../cocostudio/CCSGUIReader.cpp | 8 ++-- tests/Classes/ConsoleTest/ConsoleTest.cpp | 3 +- .../CurrentLanguageTest.cpp | 6 +++ .../PerformanceContainerTest.cpp | 42 +++++++++---------- 4 files changed, 33 insertions(+), 26 deletions(-) diff --git a/cocos/editor-support/cocostudio/CCSGUIReader.cpp b/cocos/editor-support/cocostudio/CCSGUIReader.cpp index 6148c1b8dc..36776274bb 100644 --- a/cocos/editor-support/cocostudio/CCSGUIReader.cpp +++ b/cocos/editor-support/cocostudio/CCSGUIReader.cpp @@ -355,8 +355,8 @@ void WidgetPropertiesReader0250::setColorPropsForWidgetFromJsonDictionary(Widget widget->setAnchorPoint(Point(apxf, apyf)); bool flipX = DICTOOL->getBooleanValue_json(options, "flipX"); bool flipY = DICTOOL->getBooleanValue_json(options, "flipY"); - widget->setFlipX(flipX); - widget->setFlipY(flipY); + widget->setFlippedX(flipX); + widget->setFlippedY(flipY); } void WidgetPropertiesReader0250::setPropsForButtonFromJsonDictionary(Widget*widget,const rapidjson::Value& options) @@ -1129,8 +1129,8 @@ void WidgetPropertiesReader0300::setColorPropsForWidgetFromJsonDictionary(Widget widget->setAnchorPoint(Point(apxf, apyf)); bool flipX = DICTOOL->getBooleanValue_json(options, "flipX"); bool flipY = DICTOOL->getBooleanValue_json(options, "flipY"); - widget->setFlipX(flipX); - widget->setFlipY(flipY); + widget->setFlippedX(flipX); + widget->setFlippedY(flipY); } void WidgetPropertiesReader0300::setPropsForButtonFromJsonDictionary(Widget*widget,const rapidjson::Value& options) diff --git a/tests/Classes/ConsoleTest/ConsoleTest.cpp b/tests/Classes/ConsoleTest/ConsoleTest.cpp index a53ef0018d..d9c00916d0 100644 --- a/tests/Classes/ConsoleTest/ConsoleTest.cpp +++ b/tests/Classes/ConsoleTest/ConsoleTest.cpp @@ -199,11 +199,12 @@ ConsoleUploadFile::~ConsoleUploadFile() { _thread.join(); } + void ConsoleUploadFile::uploadFile() { struct addrinfo hints; struct addrinfo *result, *rp; - int sfd, s, j; + int sfd, s; /* Obtain address(es) matching host/port */ diff --git a/tests/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp b/tests/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp index a952a4225b..a858a5c6e0 100644 --- a/tests/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp +++ b/tests/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp @@ -54,6 +54,12 @@ CurrentLanguageTest::CurrentLanguageTest() case LanguageType::POLISH: labelLanguage->setString("current language is Polish"); break; + case LanguageType::DUTCH: + labelLanguage->setString("current language is Polish"); + break; + default: + CCASSERT(false, "Invalid language type."); + break; } addChild(labelLanguage); diff --git a/tests/Classes/PerformanceTest/PerformanceContainerTest.cpp b/tests/Classes/PerformanceTest/PerformanceContainerTest.cpp index 657c40b283..47a9cb9798 100644 --- a/tests/Classes/PerformanceTest/PerformanceContainerTest.cpp +++ b/tests/Classes/PerformanceTest/PerformanceContainerTest.cpp @@ -518,7 +518,7 @@ std::string ArrayPerfTest::subtitle() const void ArrayPerfTest::generateTestFunctions() { auto createArray = [this](){ - Array* ret = Array::create(); + __Array* ret = Array::create(); for( int i=0; iprofilerName()); for( int i=0; iprofilerName()); } } , { "insertObject", [=](){ - Array* nodeVector = Array::create(); + __Array* nodeVector = Array::create(); CC_PROFILER_START(this->profilerName()); for( int i=0; iprofilerName()); } } , { "setObject", [=](){ - Array* nodeVector = createArray(); + __Array* nodeVector = createArray(); srand(time(nullptr)); ssize_t index = rand() % quantityOfNodes; @@ -558,7 +558,7 @@ void ArrayPerfTest::generateTestFunctions() CC_PROFILER_STOP(this->profilerName()); } } , { "getIndexOfObject", [=](){ - Array* nodeVector = createArray(); + __Array* nodeVector = createArray(); Ref* objToGet = nodeVector->getObjectAtIndex(quantityOfNodes/3); ssize_t index = 0; CC_PROFILER_START(this->profilerName()); @@ -572,7 +572,7 @@ void ArrayPerfTest::generateTestFunctions() } } } , { "getObjectAtIndex", [=](){ - Array* nodeVector = createArray(); + __Array* nodeVector = createArray(); CC_PROFILER_START(this->profilerName()); for( int i=0; iprofilerName()); } } , { "containsObject", [=](){ - Array* nodeVector = createArray(); + __Array* nodeVector = createArray(); Ref* objToGet = nodeVector->getObjectAtIndex(quantityOfNodes/3); CC_PROFILER_START(this->profilerName()); @@ -589,7 +589,7 @@ void ArrayPerfTest::generateTestFunctions() CC_PROFILER_STOP(this->profilerName()); } } , { "removeObject", [=](){ - Array* nodeVector = createArray(); + __Array* nodeVector = createArray(); Node** nodes = (Node**)malloc(sizeof(Node*) * quantityOfNodes); for (int i = 0; i < quantityOfNodes; ++i) @@ -607,7 +607,7 @@ void ArrayPerfTest::generateTestFunctions() free(nodes); } } , { "removeObjectAtIndex", [=](){ - Array* nodeVector = createArray(); + __Array* nodeVector = createArray(); CC_PROFILER_START(this->profilerName()); for( int i=0; icount() == 0, "nodeVector was not empty."); } } , { "swap by index", [=](){ - Array* nodeVector = createArray(); + __Array* nodeVector = createArray(); int swapIndex1 = quantityOfNodes / 3; int swapIndex2 = quantityOfNodes / 3 * 2; @@ -640,7 +640,7 @@ void ArrayPerfTest::generateTestFunctions() } } , { "swap by object", [=](){ - Array* nodeVector = createArray(); + __Array* nodeVector = createArray(); Ref* swapNode1 = nodeVector->getObjectAtIndex(quantityOfNodes / 3); Ref* swapNode2 = nodeVector->getObjectAtIndex(quantityOfNodes / 3 * 2); @@ -652,7 +652,7 @@ void ArrayPerfTest::generateTestFunctions() } } , { "reverseObjects", [=](){ - Array* nodeVector = createArray(); + __Array* nodeVector = createArray(); CC_PROFILER_START(this->profilerName()); for( int i=0; iprofilerName()); @@ -970,13 +970,13 @@ void DictionaryStringKeyPerfTest::generateTestFunctions() Ref* obj; CCARRAY_FOREACH(keys, obj) { - auto key = static_cast(obj); + auto key = static_cast<__String*>(obj); allKeysString += (std::string("_") + key->getCString()); } } } , { "allKeysForObject", [=](){ - Dictionary* dict = Dictionary::create(); + __Dictionary* dict = Dictionary::create(); Node** nodes = (Node**) malloc(sizeof(Node*) * quantityOfNodes); Node* sameNode = Node::create(); @@ -1003,7 +1003,7 @@ void DictionaryStringKeyPerfTest::generateTestFunctions() Ref* obj; CCARRAY_FOREACH(keys, obj) { - auto key = static_cast(obj); + auto key = static_cast<__String*>(obj); allKeysString += (std::string("_") + key->getCString()); } @@ -1206,7 +1206,7 @@ std::string TemplateMapIntKeyPerfTest::subtitle() const void DictionaryIntKeyPerfTest::generateTestFunctions() { auto createDict = [this](){ - Dictionary* ret = Dictionary::create(); + __Dictionary* ret = Dictionary::create(); for( int i=0; iprofilerName()); for( int i=0; i(obj); + auto key = static_cast<__Integer*>(obj); allKeysInt += key->getValue(); } } } , { "allKeysForObject", [=](){ - Dictionary* dict = Dictionary::create(); + __Dictionary* dict = Dictionary::create(); Node** nodes = (Node**) malloc(sizeof(Node*) * quantityOfNodes); Node* sameNode = Node::create(); @@ -1319,7 +1319,7 @@ void DictionaryIntKeyPerfTest::generateTestFunctions() Ref* obj; CCARRAY_FOREACH(keys, obj) { - auto key = static_cast(obj); + auto key = static_cast<__Integer*>(obj); allKeysInt += key->getValue(); }