mirror of https://github.com/axmolengine/axmol.git
fixes compiler warnings
* converts some `int` to `ssize_t` * adds `const` to `title()` and `subtitle()`
This commit is contained in:
parent
92dba007c7
commit
99ae4d86d3
|
@ -399,7 +399,7 @@ int ActionNode::getLastFrameIndex()
|
|||
continue;
|
||||
}
|
||||
bFindFrame = true;
|
||||
int lastInex = cArray->count() - 1;
|
||||
ssize_t lastInex = cArray->count() - 1;
|
||||
ActionFrame* frame = (ActionFrame*)(cArray->getObjectAtIndex(lastInex));
|
||||
int iFrameIndex = frame->getFrameIndex();
|
||||
|
||||
|
@ -428,7 +428,7 @@ bool ActionNode::updateActionToTimeLine(float fTime)
|
|||
{
|
||||
continue;
|
||||
}
|
||||
int frameCount = cArray->count();
|
||||
ssize_t frameCount = cArray->count();
|
||||
for (int i = 0; i < frameCount; i++)
|
||||
{
|
||||
ActionFrame* frame = (ActionFrame*)(cArray->getObjectAtIndex(i));
|
||||
|
|
|
@ -37,7 +37,7 @@ UIWidget* UIHelper::seekWidgetByTag(UIWidget* root, int tag)
|
|||
return root;
|
||||
}
|
||||
cocos2d::ccArray* arrayRootChildren = root->getChildren()->data;
|
||||
int length = arrayRootChildren->num;
|
||||
ssize_t length = arrayRootChildren->num;
|
||||
for (int i=0;i<length;i++)
|
||||
{
|
||||
UIWidget* child = (UIWidget*)(arrayRootChildren->arr[i]);
|
||||
|
@ -61,7 +61,7 @@ UIWidget* UIHelper::seekWidgetByName(UIWidget* root, const char *name)
|
|||
return root;
|
||||
}
|
||||
cocos2d::ccArray* arrayRootChildren = root->getChildren()->data;
|
||||
int length = arrayRootChildren->num;
|
||||
ssize_t length = arrayRootChildren->num;
|
||||
for (int i=0;i<length;i++)
|
||||
{
|
||||
UIWidget* child = (UIWidget*)(arrayRootChildren->arr[i]);
|
||||
|
@ -81,7 +81,7 @@ UIWidget* UIHelper::seekWidgetByRelativeName(UIWidget *root, const char *name)
|
|||
return nullptr;
|
||||
}
|
||||
cocos2d::ccArray* arrayRootChildren = root->getChildren()->data;
|
||||
int length = arrayRootChildren->num;
|
||||
ssize_t length = arrayRootChildren->num;
|
||||
for (int i=0;i<length;i++)
|
||||
{
|
||||
UIWidget* child = (UIWidget*)(arrayRootChildren->arr[i]);
|
||||
|
@ -106,7 +106,7 @@ UIWidget* UIHelper::seekActionWidgetByActionTag(UIWidget* root, int tag)
|
|||
return root;
|
||||
}
|
||||
cocos2d::ccArray* arrayRootChildren = root->getChildren()->data;
|
||||
int length = arrayRootChildren->num;
|
||||
ssize_t length = arrayRootChildren->num;
|
||||
for (int i=0;i<length;i++)
|
||||
{
|
||||
UIWidget* child = (UIWidget*)(arrayRootChildren->arr[i]);
|
||||
|
|
|
@ -71,8 +71,8 @@ void UIInputManager::registWidget(UIWidget* widget)
|
|||
bool UIInputManager::checkTouchEvent(UIWidget *root, const Point &touchPoint)
|
||||
{
|
||||
ccArray* arrayRootChildren = root->getChildren()->data;
|
||||
int length = arrayRootChildren->num;
|
||||
for (int i=length-1; i >= 0; i--)
|
||||
ssize_t length = arrayRootChildren->num;
|
||||
for (ssize_t i=length-1; i >= 0; i--)
|
||||
{
|
||||
UIWidget* widget = (UIWidget*)(arrayRootChildren->arr[i]);
|
||||
if (checkTouchEvent(widget, touchPoint))
|
||||
|
@ -130,7 +130,7 @@ void UIInputManager::update(float dt)
|
|||
}
|
||||
}
|
||||
ccArray* arrayWidget = _checkedDoubleClickWidget->data;
|
||||
int widgetCount = arrayWidget->num;
|
||||
ssize_t widgetCount = arrayWidget->num;
|
||||
for (int i=0;i<widgetCount;i++)
|
||||
{
|
||||
UIWidget* widget = (UIWidget*)(arrayWidget->arr[i]);
|
||||
|
@ -173,7 +173,7 @@ void UIInputManager::onTouchEnd(Touch* touch)
|
|||
_touchEndedPoint.x = touch->getLocation().x;
|
||||
_touchEndedPoint.y = touch->getLocation().y;
|
||||
ccArray* selectedWidgetArray = _selectedWidgets->data;
|
||||
int length = selectedWidgetArray->num;
|
||||
ssize_t length = selectedWidgetArray->num;
|
||||
for (int i=0; i<length; ++i)
|
||||
{
|
||||
UIWidget* hitWidget = (UIWidget*)(selectedWidgetArray->arr[0]);
|
||||
|
@ -188,7 +188,7 @@ void UIInputManager::onTouchCancelled(Touch* touch)
|
|||
_touchEndedPoint.x = touch->getLocation().x;
|
||||
_touchEndedPoint.y = touch->getLocation().y;
|
||||
ccArray* selectedWidgetArray = _selectedWidgets->data;
|
||||
int length = selectedWidgetArray->num;
|
||||
ssize_t length = selectedWidgetArray->num;
|
||||
for (int i=0; i<length; ++i)
|
||||
{
|
||||
UIWidget* hitWidget = (UIWidget*)(selectedWidgetArray->arr[0]);
|
||||
|
|
|
@ -128,7 +128,7 @@ void UILayout::onSizeChanged()
|
|||
if (strcmp(getDescription(), "Layout") == 0)
|
||||
{
|
||||
cocos2d::ccArray* arrayChildren = _children->data;
|
||||
int length = arrayChildren->num;
|
||||
ssize_t length = arrayChildren->num;
|
||||
for (int i=0; i<length; ++i)
|
||||
{
|
||||
UIWidget* child = (UIWidget*)arrayChildren->arr[i];
|
||||
|
@ -452,7 +452,7 @@ void UILayout::setLayoutType(LayoutType type)
|
|||
_layoutType = type;
|
||||
|
||||
cocos2d::ccArray* layoutChildrenArray = getChildren()->data;
|
||||
int length = layoutChildrenArray->num;
|
||||
ssize_t length = layoutChildrenArray->num;
|
||||
for (int i=0; i<length; i++)
|
||||
{
|
||||
UIWidget* child = dynamic_cast<UIWidget*>(layoutChildrenArray->arr[i]);
|
||||
|
@ -474,7 +474,7 @@ void UILayout::doLayout()
|
|||
case LAYOUT_LINEAR_VERTICAL:
|
||||
{
|
||||
cocos2d::ccArray* layoutChildrenArray = getChildren()->data;
|
||||
int length = layoutChildrenArray->num;
|
||||
ssize_t length = layoutChildrenArray->num;
|
||||
cocos2d::Size layoutSize = getSize();
|
||||
float topBoundary = layoutSize.height;
|
||||
for (int i=0; i<length; ++i)
|
||||
|
@ -515,7 +515,7 @@ void UILayout::doLayout()
|
|||
case LAYOUT_LINEAR_HORIZONTAL:
|
||||
{
|
||||
cocos2d::ccArray* layoutChildrenArray = getChildren()->data;
|
||||
int length = layoutChildrenArray->num;
|
||||
ssize_t length = layoutChildrenArray->num;
|
||||
cocos2d::Size layoutSize = getSize();
|
||||
float leftBoundary = 0.0f;
|
||||
for (int i=0; i<length; ++i)
|
||||
|
@ -556,8 +556,8 @@ void UILayout::doLayout()
|
|||
case LAYOUT_RELATIVE:
|
||||
{
|
||||
cocos2d::ccArray* layoutChildrenArray = getChildren()->data;
|
||||
int length = layoutChildrenArray->num;
|
||||
int unlayoutChildCount = length;
|
||||
ssize_t length, unlayoutChildCount;
|
||||
length = unlayoutChildCount = layoutChildrenArray->num;
|
||||
cocos2d::Size layoutSize = getSize();
|
||||
|
||||
for (int i=0; i<length; i++)
|
||||
|
|
|
@ -92,7 +92,7 @@ void UIListView::updateInnerContainerSize()
|
|||
switch (_direction) {
|
||||
case SCROLLVIEW_DIR_VERTICAL:
|
||||
{
|
||||
int childrenCount = _items->count();
|
||||
ssize_t childrenCount = _items->count();
|
||||
float totalHeight = _model->getSize().height * childrenCount + (childrenCount - 1) * _itemsMargin;
|
||||
float finalWidth = _size.width;
|
||||
float finalHeight = totalHeight;
|
||||
|
@ -101,7 +101,7 @@ void UIListView::updateInnerContainerSize()
|
|||
}
|
||||
case SCROLLVIEW_DIR_HORIZONTAL:
|
||||
{
|
||||
int childrenCount = _items->count();
|
||||
ssize_t childrenCount = _items->count();
|
||||
float totalWidth = _model->getSize().width * childrenCount + (childrenCount - 1) * _itemsMargin;
|
||||
float finalWidth = totalWidth;
|
||||
float finalHeight = _size.height;
|
||||
|
@ -373,7 +373,7 @@ void UIListView::refreshView()
|
|||
return;
|
||||
}
|
||||
cocos2d::ccArray* arrayItems = _items->data;
|
||||
int length = arrayItems->num;
|
||||
ssize_t length = arrayItems->num;
|
||||
for (int i=0; i<length; i++)
|
||||
{
|
||||
UIWidget* item = (UIWidget*)(arrayItems->arr[i]);
|
||||
|
|
|
@ -91,7 +91,7 @@ void UIPageView::addWidgetToPage(UIWidget *widget, int pageIdx, bool forceCreate
|
|||
{
|
||||
return;
|
||||
}
|
||||
int pageCount = _pages->count();
|
||||
ssize_t pageCount = _pages->count();
|
||||
if (pageIdx < 0 || pageIdx >= pageCount)
|
||||
{
|
||||
if (forceCreate)
|
||||
|
@ -168,7 +168,7 @@ void UIPageView::insertPage(UILayout* page, int idx)
|
|||
return;
|
||||
}
|
||||
|
||||
int pageCount = _pages->count();
|
||||
ssize_t pageCount = _pages->count();
|
||||
if (idx >= pageCount)
|
||||
{
|
||||
addPage(page);
|
||||
|
@ -186,7 +186,7 @@ void UIPageView::insertPage(UILayout* page, int idx)
|
|||
page->setSize(pvSize);
|
||||
}
|
||||
cocos2d::ccArray* arrayPages = _pages->data;
|
||||
int length = arrayPages->num;
|
||||
ssize_t length = arrayPages->num;
|
||||
for (int i=(idx+1); i<length; i++) {
|
||||
UIWidget* behindPage = dynamic_cast<UIWidget*>(arrayPages->arr[i]);
|
||||
cocos2d::Point formerPos = behindPage->getPosition();
|
||||
|
@ -286,7 +286,7 @@ void UIPageView::updateChildrenPosition()
|
|||
return;
|
||||
}
|
||||
|
||||
int pageCount = _pages->data->num;
|
||||
ssize_t pageCount = _pages->data->num;
|
||||
if (pageCount <= 0)
|
||||
{
|
||||
_curPageIdx = 0;
|
||||
|
@ -411,7 +411,7 @@ void UIPageView::onTouchEnded(const cocos2d::Point &touchPoint)
|
|||
void UIPageView::movePages(float offset)
|
||||
{
|
||||
cocos2d::ccArray* arrayPages = _pages->data;
|
||||
int length = arrayPages->num;
|
||||
ssize_t length = arrayPages->num;
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
UIWidget* child = (UIWidget*)(arrayPages->arr[i]);
|
||||
|
@ -502,7 +502,7 @@ void UIPageView::handleReleaseLogic(const cocos2d::Point &touchPoint)
|
|||
if (curPage)
|
||||
{
|
||||
cocos2d::Point curPagePos = curPage->getPosition();
|
||||
int pageCount = _pages->count();
|
||||
ssize_t pageCount = _pages->count();
|
||||
float curPageLocation = curPagePos.x;
|
||||
float pageWidth = getSize().width;
|
||||
float boundary = pageWidth/2.0f;
|
||||
|
@ -613,7 +613,7 @@ UIWidget* UIPageView::createCloneInstance()
|
|||
void UIPageView::copyClonedWidgetChildren(UIWidget* model)
|
||||
{
|
||||
cocos2d::ccArray* arrayPages = dynamic_cast<UIPageView*>(model)->getPages()->data;
|
||||
int length = arrayPages->num;
|
||||
ssize_t length = arrayPages->num;
|
||||
for (int i=0; i<length; i++)
|
||||
{
|
||||
UILayout* page = (UILayout*)(arrayPages->arr[i]);
|
||||
|
|
|
@ -149,7 +149,7 @@ bool UIWidget::addChild(UIWidget *child)
|
|||
return false;
|
||||
}
|
||||
child->setParent(this);
|
||||
int childrenCount = _children->data->num;
|
||||
ssize_t childrenCount = _children->data->num;
|
||||
if (childrenCount <= 0)
|
||||
{
|
||||
_children->addObject(child);
|
||||
|
@ -158,7 +158,7 @@ bool UIWidget::addChild(UIWidget *child)
|
|||
{
|
||||
bool seekSucceed = false;
|
||||
cocos2d::ccArray* arrayChildren = _children->data;
|
||||
for (int i=childrenCount-1; i>=0; --i)
|
||||
for (ssize_t i=childrenCount-1; i>=0; --i)
|
||||
{
|
||||
UIWidget* widget = (UIWidget*)(arrayChildren->arr[i]);
|
||||
if (child->getZOrder() >= widget->getZOrder())
|
||||
|
@ -226,7 +226,7 @@ void UIWidget::removeAllChildren()
|
|||
{
|
||||
return;
|
||||
}
|
||||
int times = _children->data->num;
|
||||
ssize_t times = _children->data->num;
|
||||
for (int i=0; i<times; ++i)
|
||||
{
|
||||
UIWidget* lastChild = (UIWidget*)(_children->getLastObject());
|
||||
|
@ -238,7 +238,7 @@ void UIWidget::reorderChild(UIWidget* child)
|
|||
{
|
||||
CC_SAFE_RETAIN(child);
|
||||
_children->removeObject(child);
|
||||
int childrenCount = _children->data->num;
|
||||
ssize_t childrenCount = _children->data->num;
|
||||
if (childrenCount <= 0)
|
||||
{
|
||||
_children->addObject(child);
|
||||
|
@ -247,7 +247,7 @@ void UIWidget::reorderChild(UIWidget* child)
|
|||
{
|
||||
bool seekSucceed = false;
|
||||
cocos2d::ccArray* arrayChildren = _children->data;
|
||||
for (int i=childrenCount-1; i>=0; --i)
|
||||
for (ssize_t i=childrenCount-1; i>=0; --i)
|
||||
{
|
||||
UIWidget* widget = (UIWidget*)(arrayChildren->arr[i]);
|
||||
if (child->getZOrder() >= widget->getZOrder())
|
||||
|
@ -287,7 +287,7 @@ void UIWidget::setEnabled(bool enabled)
|
|||
dynamic_cast<UIRectClippingNode*>(_renderer)->setEnabled(enabled);
|
||||
}
|
||||
cocos2d::ccArray* arrayChildren = _children->data;
|
||||
int childrenCount = arrayChildren->num;
|
||||
ssize_t childrenCount = arrayChildren->num;
|
||||
for (int i = 0; i < childrenCount; i++)
|
||||
{
|
||||
UIWidget* child = dynamic_cast<UIWidget*>(arrayChildren->arr[i]);
|
||||
|
@ -1166,7 +1166,7 @@ UIWidget* UIWidget::createCloneInstance()
|
|||
void UIWidget::copyClonedWidgetChildren(UIWidget* model)
|
||||
{
|
||||
cocos2d::ccArray* arrayWidgetChildren = model->getChildren()->data;
|
||||
int length = arrayWidgetChildren->num;
|
||||
ssize_t length = arrayWidgetChildren->num;
|
||||
for (int i=0; i<length; i++)
|
||||
{
|
||||
UIWidget* child = (UIWidget*)(arrayWidgetChildren->arr[i]);
|
||||
|
|
|
@ -1428,9 +1428,6 @@ void TestEasing::updateSubTitle()
|
|||
label->setString(str.c_str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void TestChangeAnimationInternal::onEnter()
|
||||
{
|
||||
ArmatureTestLayer::onEnter();
|
||||
|
@ -1451,11 +1448,11 @@ void TestChangeAnimationInternal::onExit()
|
|||
{
|
||||
Director::getInstance()->setAnimationInterval(1/60.0f);
|
||||
}
|
||||
std::string TestChangeAnimationInternal::title()
|
||||
std::string TestChangeAnimationInternal::title() const
|
||||
{
|
||||
return "Test change animation internal";
|
||||
}
|
||||
std::string TestChangeAnimationInternal::subtitle()
|
||||
std::string TestChangeAnimationInternal::subtitle() const
|
||||
{
|
||||
return "Touch to change animation internal";
|
||||
}
|
||||
|
|
|
@ -362,7 +362,7 @@ public:
|
|||
class TestEasing : public ArmatureTestLayer
|
||||
{
|
||||
public:
|
||||
virtual void onEnter();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
|
||||
|
@ -376,10 +376,10 @@ public:
|
|||
class TestChangeAnimationInternal : public ArmatureTestLayer
|
||||
{
|
||||
public:
|
||||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
virtual void onEnter()override;
|
||||
virtual void onExit() override;
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
|
||||
void onTouchesEnded(const std::vector<Touch*>& touches, Event* event);
|
||||
};
|
||||
|
|
|
@ -899,12 +899,12 @@ void LayerBug3162A::step(float dt)
|
|||
_layer[0]->setCascadeOpacityEnabled(!_layer[0]->isCascadeOpacityEnabled());
|
||||
}
|
||||
|
||||
std::string LayerBug3162A::title()
|
||||
std::string LayerBug3162A::title() const
|
||||
{
|
||||
return "Bug 3162 red layer cascade opacity eable/disable";
|
||||
}
|
||||
|
||||
std::string LayerBug3162A::subtitle()
|
||||
std::string LayerBug3162A::subtitle() const
|
||||
{
|
||||
return "g and b layer opacity is effected/diseffected with r layer";
|
||||
}
|
||||
|
@ -945,12 +945,12 @@ void LayerBug3162B::step(float dt)
|
|||
_layer[0]->setCascadeColorEnabled(!_layer[0]->isCascadeColorEnabled());
|
||||
}
|
||||
|
||||
std::string LayerBug3162B::title()
|
||||
std::string LayerBug3162B::title() const
|
||||
{
|
||||
return "Bug 3162 bottom layer cascade color eable/disable";
|
||||
}
|
||||
|
||||
std::string LayerBug3162B::subtitle()
|
||||
std::string LayerBug3162B::subtitle() const
|
||||
{
|
||||
return "u and m layer color is effected/diseffected with b layer";
|
||||
}
|
||||
|
|
|
@ -178,9 +178,9 @@ class LayerBug3162A : public LayerTest
|
|||
{
|
||||
public:
|
||||
CREATE_FUNC(LayerBug3162A);
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
|
||||
void step(float dt);
|
||||
|
||||
|
@ -192,9 +192,9 @@ class LayerBug3162B : public LayerTest
|
|||
{
|
||||
public:
|
||||
CREATE_FUNC(LayerBug3162B);
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
virtual void onEnter() override;
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
|
||||
void step(float dt);
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ public:
|
|||
_title = file;
|
||||
}
|
||||
virtual void onEnter();
|
||||
virtual std::string title()
|
||||
virtual std::string title() const override
|
||||
{
|
||||
return _title;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue