From a3ad4cddf8e4291e3d28182c4bfff1fc29e2e633 Mon Sep 17 00:00:00 2001 From: mogemimi Date: Fri, 22 Apr 2016 12:20:05 +0900 Subject: [PATCH] Fix warnings about signed/unsigned mismatch --- cocos/3d/CCSprite3D.cpp | 2 +- cocos/network/WebSocket.cpp | 6 +++--- cocos/physics3d/CCPhysics3DComponent.cpp | 2 +- cocos/ui/UIRichText.cpp | 2 +- tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp | 2 +- .../Classes/MaterialSystemTest/MaterialSystemTest.cpp | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cocos/3d/CCSprite3D.cpp b/cocos/3d/CCSprite3D.cpp index 6e2779ccdd..b5cb0e760c 100644 --- a/cocos/3d/CCSprite3D.cpp +++ b/cocos/3d/CCSprite3D.cpp @@ -464,7 +464,7 @@ void Sprite3D::setMaterial(Material *material, int meshIndex) if (meshIndex == -1) { - for (size_t i = 0; i < _meshes.size(); i++) + for (ssize_t i = 0; i < _meshes.size(); i++) { _meshes.at(i)->setMaterial(i == 0 ? material : material->clone()); } diff --git a/cocos/network/WebSocket.cpp b/cocos/network/WebSocket.cpp index ef571822b3..ca04db0530 100644 --- a/cocos/network/WebSocket.cpp +++ b/cocos/network/WebSocket.cpp @@ -668,10 +668,10 @@ void WebSocket::onClientWritable() WsMessage* subThreadMsg = *iter; Data* data = (Data*)subThreadMsg->obj; - const size_t c_bufferSize = WS_RX_BUFFER_SIZE; + const ssize_t c_bufferSize = WS_RX_BUFFER_SIZE; - const size_t remaining = data->len - data->issued; - const size_t n = std::min(remaining, c_bufferSize ); + const ssize_t remaining = data->len - data->issued; + const ssize_t n = std::min(remaining, c_bufferSize); WebSocketFrame* frame = nullptr; diff --git a/cocos/physics3d/CCPhysics3DComponent.cpp b/cocos/physics3d/CCPhysics3DComponent.cpp index 39907e98e8..531ad289b7 100644 --- a/cocos/physics3d/CCPhysics3DComponent.cpp +++ b/cocos/physics3d/CCPhysics3DComponent.cpp @@ -100,7 +100,7 @@ void Physics3DComponent::addToPhysicsWorld(Physics3DWorld* world) { auto parent = _owner->getParent(); while (parent) { - for (int i = 0; i < components.size(); i++) { + for (size_t i = 0; i < components.size(); i++) { if (parent == components[i]->getOwner()) { //insert it here diff --git a/cocos/ui/UIRichText.cpp b/cocos/ui/UIRichText.cpp index 36972c9bec..44ead9a89d 100644 --- a/cocos/ui/UIRichText.cpp +++ b/cocos/ui/UIRichText.cpp @@ -1483,7 +1483,7 @@ static int getPrevWord(const std::string& text, int idx) static bool isWrappable(const std::string& text) { - for (int i=0; igetWinSize(); TTFConfig ttfConfig(ttfpaths[0],20, GlyphCollection::NEHE); - for (size_t i = 0; i < fontCount; ++i) { + for (int i = 0; i < fontCount; ++i) { ttfConfig.fontFilePath = ttfpaths[i]; auto label = Label::createWithTTF(ttfConfig, ttfpaths[i], TextHAlignment::CENTER,0); if( label ) { diff --git a/tests/cpp-tests/Classes/MaterialSystemTest/MaterialSystemTest.cpp b/tests/cpp-tests/Classes/MaterialSystemTest/MaterialSystemTest.cpp index c5ccc29eb8..59d318f6ff 100644 --- a/tests/cpp-tests/Classes/MaterialSystemTest/MaterialSystemTest.cpp +++ b/tests/cpp-tests/Classes/MaterialSystemTest/MaterialSystemTest.cpp @@ -422,7 +422,7 @@ void Material_parsePerformance::parsingTesting(unsigned int count) { std::clock_t begin = std::clock(); - for(int i=0;i