From 68a40694a872381730b17c9d917844f2acf7bb9e Mon Sep 17 00:00:00 2001 From: halx99 Date: Mon, 26 Apr 2021 17:28:58 +0800 Subject: [PATCH] Fix ci warnings [ci build] --- cocos/base/CCDirector.cpp | 2 +- cocos/ui/UITextFieldEx.cpp | 8 ++++---- extensions/DragonBones/CCArmatureDisplay.cpp | 1 - extensions/DragonBones/animation/TimelineState.cpp | 5 ----- extensions/DragonBones/armature/Armature.cpp | 2 +- extensions/DragonBones/factory/BaseFactory.cpp | 1 - 6 files changed, 6 insertions(+), 13 deletions(-) diff --git a/cocos/base/CCDirector.cpp b/cocos/base/CCDirector.cpp index da04988106..fff3c6abcb 100644 --- a/cocos/base/CCDirector.cpp +++ b/cocos/base/CCDirector.cpp @@ -231,7 +231,7 @@ void Director::setDefaultValues() // PVR v2 has alpha premultiplied ? bool pvr_alpha_premultiplied = conf->getValue("cocos2d.x.texture.pvrv2_has_alpha_premultiplied", Value(false)).asBool(); - Image::setPVRImagesHavePremultipliedAlpha(pvr_alpha_premultiplied); + Image::setCompressedImagesHavePMA(Image::CompressedImagePMAFlag::PVR, pvr_alpha_premultiplied); } void Director::setGLDefaultValues() diff --git a/cocos/ui/UITextFieldEx.cpp b/cocos/ui/UITextFieldEx.cpp index 3261153b4d..3468cfb28c 100644 --- a/cocos/ui/UITextFieldEx.cpp +++ b/cocos/ui/UITextFieldEx.cpp @@ -187,9 +187,9 @@ namespace ui { if (!utf8Text.empty() && length > 0) { // get the delete byte number - size_t deleteLen = 1; // default, erase 1 byte + int deleteLen = 1; // default, erase 1 byte - while ((length - deleteLen >= 0) && 0x80 == (0xC0 & utf8Text.at(length - deleteLen))) + while (length >= deleteLen && 0x80 == (0xC0 & utf8Text.at(length - deleteLen))) { ++deleteLen; } @@ -211,7 +211,7 @@ namespace ui { // get the delete byte number size_t addLen = 1; // default, erase 1 byte - while ((length + addLen < utf8Text.size()) && 0x80 == (0xC0 & utf8Text.at(length + addLen))) + while ((length + addLen) < utf8Text.size() && 0x80 == (0xC0 & utf8Text.at(length + addLen))) { ++addLen; } @@ -424,7 +424,6 @@ namespace ui { switch (code) { case EventKeyboard::KeyCode::KEY_LEFT_ARROW: - cocos2d::log("******** Move Left ********* "); this->__moveCursor(-1); break; case EventKeyboard::KeyCode::KEY_RIGHT_ARROW: @@ -434,6 +433,7 @@ namespace ui { case EventKeyboard::KeyCode::KEY_KP_DELETE: this->handleDeleteKeyEvent(); break; + default:; } } }; diff --git a/extensions/DragonBones/CCArmatureDisplay.cpp b/extensions/DragonBones/CCArmatureDisplay.cpp index f9683d3002..11b6e6162a 100644 --- a/extensions/DragonBones/CCArmatureDisplay.cpp +++ b/extensions/DragonBones/CCArmatureDisplay.cpp @@ -7,7 +7,6 @@ CCArmatureDisplay* CCArmatureDisplay::create() { CCArmatureDisplay* displayContainer = new (std::nothrow) CCArmatureDisplay(); if (displayContainer && displayContainer->init()) - if (displayContainer) { displayContainer->autorelease(); } diff --git a/extensions/DragonBones/animation/TimelineState.cpp b/extensions/DragonBones/animation/TimelineState.cpp index 34a5bde299..79ef052711 100644 --- a/extensions/DragonBones/animation/TimelineState.cpp +++ b/extensions/DragonBones/animation/TimelineState.cpp @@ -850,11 +850,6 @@ void DeformTimelineState::init(Armature* armature, AnimationState* animationStat const auto frameIntOffset = _animationData->frameIntOffset + _timelineArray[_timelineData->offset + (unsigned)BinaryOffset::TimelineFrameValueCount]; vertexOffset = _frameIntArray[frameIntOffset + (unsigned)BinaryOffset::DeformVertexOffset]; - if (vertexOffset < 0) - { - vertexOffset += 65536; // Fixed out of bouds bug. - } - _deformCount = _frameIntArray[frameIntOffset + (unsigned)BinaryOffset::DeformCount]; _valueCount = _frameIntArray[frameIntOffset + (unsigned)BinaryOffset::DeformValueCount]; _valueOffset = _frameIntArray[frameIntOffset + (unsigned)BinaryOffset::DeformValueOffset]; diff --git a/extensions/DragonBones/armature/Armature.cpp b/extensions/DragonBones/armature/Armature.cpp index 2d0290a661..cdfc5c107a 100644 --- a/extensions/DragonBones/armature/Armature.cpp +++ b/extensions/DragonBones/armature/Armature.cpp @@ -93,7 +93,7 @@ void Armature::_sortZOrder(const int16_t* slotIndices, unsigned offset) for (std::size_t i = 0, l = slotDatas.size(); i < l; ++i) { const auto slotIndex = isOriginal ? i : (std::size_t)slotIndices[offset + i]; - if (slotIndex < 0 || slotIndex >= l) + if (slotIndex >= l) { continue; } diff --git a/extensions/DragonBones/factory/BaseFactory.cpp b/extensions/DragonBones/factory/BaseFactory.cpp index edfe894a26..b0defb4e8d 100644 --- a/extensions/DragonBones/factory/BaseFactory.cpp +++ b/extensions/DragonBones/factory/BaseFactory.cpp @@ -213,7 +213,6 @@ std::pair BaseFactory::_getSlotDisplay(const BuildArmaturePa dataName = displayData->parent->parent->parent->name; } } - dataPackage != nullptr ? dataPackage->dataName : displayData->parent->parent->parent->name; std::pair display(nullptr, DisplayType::Image); switch (displayData->type)