mirror of https://github.com/axmolengine/axmol.git
Merge pull request #15451 from xpol/fixes-format-warnings
Fixes format warnings.
This commit is contained in:
commit
5f6f35fb91
|
@ -994,7 +994,7 @@ void SIOClientImpl::onClose(WebSocket* ws)
|
||||||
void SIOClientImpl::onError(WebSocket* ws, const WebSocket::ErrorCode& error)
|
void SIOClientImpl::onError(WebSocket* ws, const WebSocket::ErrorCode& error)
|
||||||
{
|
{
|
||||||
CC_UNUSED_PARAM(ws);
|
CC_UNUSED_PARAM(ws);
|
||||||
CCLOGERROR("Websocket error received: %d", error);
|
CCLOGERROR("Websocket error received: %d", static_cast<int>(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
//begin SIOClient methods
|
//begin SIOClient methods
|
||||||
|
|
|
@ -558,7 +558,7 @@ void WebSocket::onSubThreadLoop()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOGD("Ready state is closing or was closed, code=%d, quit websocket thread!\n", _readyState);
|
LOGD("Ready state is closing or was closed, code=%d, quit websocket thread!\n", static_cast<int>(_readyState));
|
||||||
_readStateMutex.unlock();
|
_readStateMutex.unlock();
|
||||||
_wsHelper->quitWebSocketThread();
|
_wsHelper->quitWebSocketThread();
|
||||||
}
|
}
|
||||||
|
|
|
@ -846,7 +846,7 @@ Texture2D::PixelFormat Texture2D::convertI8ToFormat(const unsigned char* data, s
|
||||||
// unsupported conversion or don't need to convert
|
// unsupported conversion or don't need to convert
|
||||||
if (format != PixelFormat::AUTO && format != PixelFormat::I8)
|
if (format != PixelFormat::AUTO && format != PixelFormat::I8)
|
||||||
{
|
{
|
||||||
CCLOG("Can not convert image format PixelFormat::I8 to format ID:%d, we will use it's origin format PixelFormat::I8", format);
|
CCLOG("Can not convert image format PixelFormat::I8 to format ID:%d, we will use it's origin format PixelFormat::I8", static_cast<int>(format));
|
||||||
}
|
}
|
||||||
|
|
||||||
*outData = (unsigned char*)data;
|
*outData = (unsigned char*)data;
|
||||||
|
@ -900,7 +900,7 @@ Texture2D::PixelFormat Texture2D::convertAI88ToFormat(const unsigned char* data,
|
||||||
// unsupported conversion or don't need to convert
|
// unsupported conversion or don't need to convert
|
||||||
if (format != PixelFormat::AUTO && format != PixelFormat::AI88)
|
if (format != PixelFormat::AUTO && format != PixelFormat::AI88)
|
||||||
{
|
{
|
||||||
CCLOG("Can not convert image format PixelFormat::AI88 to format ID:%d, we will use it's origin format PixelFormat::AI88", format);
|
CCLOG("Can not convert image format PixelFormat::AI88 to format ID:%d, we will use it's origin format PixelFormat::AI88", static_cast<int>(format));
|
||||||
}
|
}
|
||||||
|
|
||||||
*outData = (unsigned char*)data;
|
*outData = (unsigned char*)data;
|
||||||
|
@ -955,7 +955,7 @@ Texture2D::PixelFormat Texture2D::convertRGB888ToFormat(const unsigned char* dat
|
||||||
// unsupported conversion or don't need to convert
|
// unsupported conversion or don't need to convert
|
||||||
if (format != PixelFormat::AUTO && format != PixelFormat::RGB888)
|
if (format != PixelFormat::AUTO && format != PixelFormat::RGB888)
|
||||||
{
|
{
|
||||||
CCLOG("Can not convert image format PixelFormat::RGB888 to format ID:%d, we will use it's origin format PixelFormat::RGB888", format);
|
CCLOG("Can not convert image format PixelFormat::RGB888 to format ID:%d, we will use it's origin format PixelFormat::RGB888", static_cast<int>(format));
|
||||||
}
|
}
|
||||||
|
|
||||||
*outData = (unsigned char*)data;
|
*outData = (unsigned char*)data;
|
||||||
|
@ -1009,7 +1009,7 @@ Texture2D::PixelFormat Texture2D::convertRGBA8888ToFormat(const unsigned char* d
|
||||||
// unsupported conversion or don't need to convert
|
// unsupported conversion or don't need to convert
|
||||||
if (format != PixelFormat::AUTO && format != PixelFormat::RGBA8888)
|
if (format != PixelFormat::AUTO && format != PixelFormat::RGBA8888)
|
||||||
{
|
{
|
||||||
CCLOG("Can not convert image format PixelFormat::RGBA8888 to format ID:%d, we will use it's origin format PixelFormat::RGBA8888", format);
|
CCLOG("Can not convert image format PixelFormat::RGBA8888 to format ID:%d, we will use it's origin format PixelFormat::RGBA8888", static_cast<int>(format));
|
||||||
}
|
}
|
||||||
|
|
||||||
*outData = (unsigned char*)data;
|
*outData = (unsigned char*)data;
|
||||||
|
@ -1058,7 +1058,7 @@ Texture2D::PixelFormat Texture2D::convertDataToFormat(const unsigned char* data,
|
||||||
case PixelFormat::RGBA8888:
|
case PixelFormat::RGBA8888:
|
||||||
return convertRGBA8888ToFormat(data, dataLen, format, outData, outDataLen);
|
return convertRGBA8888ToFormat(data, dataLen, format, outData, outDataLen);
|
||||||
default:
|
default:
|
||||||
CCLOG("unsupported conversion from format %d to format %d", originFormat, format);
|
CCLOG("unsupported conversion from format %d to format %d", static_cast<int>(originFormat), static_cast<int>(format));
|
||||||
*outData = (unsigned char*)data;
|
*outData = (unsigned char*)data;
|
||||||
*outDataLen = dataLen;
|
*outDataLen = dataLen;
|
||||||
return originFormat;
|
return originFormat;
|
||||||
|
|
|
@ -823,7 +823,7 @@ const DownloadUnits& AssetsManagerEx::getFailedAssets() const
|
||||||
|
|
||||||
void AssetsManagerEx::downloadFailedAssets()
|
void AssetsManagerEx::downloadFailedAssets()
|
||||||
{
|
{
|
||||||
CCLOG("AssetsManagerEx : Start update %lu failed assets.\n", _failedUnits.size());
|
CCLOG("AssetsManagerEx : Start update %lu failed assets.\n", static_cast<unsigned long>(_failedUnits.size()));
|
||||||
updateAssets(_failedUnits);
|
updateAssets(_failedUnits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -212,12 +212,12 @@ void Box2DView::onTouchEnded(Touch* touch, Event* event)
|
||||||
|
|
||||||
void Box2DView::onKeyPressed(EventKeyboard::KeyCode code, Event* event)
|
void Box2DView::onKeyPressed(EventKeyboard::KeyCode code, Event* event)
|
||||||
{
|
{
|
||||||
log("Box2dView:onKeyPressed, keycode: %d", code);
|
log("Box2dView:onKeyPressed, keycode: %d", static_cast<int>(code));
|
||||||
m_test->Keyboard(static_cast<unsigned char>(code));
|
m_test->Keyboard(static_cast<unsigned char>(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Box2DView::onKeyReleased(EventKeyboard::KeyCode code, Event* event)
|
void Box2DView::onKeyReleased(EventKeyboard::KeyCode code, Event* event)
|
||||||
{
|
{
|
||||||
log("onKeyReleased, keycode: %d", code);
|
log("onKeyReleased, keycode: %d", static_cast<int>(code));
|
||||||
m_test->KeyboardUp(static_cast<unsigned char>(code));
|
m_test->KeyboardUp(static_cast<unsigned char>(code));
|
||||||
}
|
}
|
||||||
|
|
|
@ -892,7 +892,7 @@ void CameraCullingDemo::addSpriteCallback(Ref* sender)
|
||||||
|
|
||||||
// update sprite number
|
// update sprite number
|
||||||
char szText[16];
|
char szText[16];
|
||||||
sprintf(szText,"%ld sprits",_layer3D->getChildrenCount());
|
sprintf(szText,"%ld sprits", static_cast<long>(_layer3D->getChildrenCount()));
|
||||||
_labelSprite3DCount->setString(szText);
|
_labelSprite3DCount->setString(szText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -920,7 +920,7 @@ void CameraCullingDemo::delSpriteCallback(Ref* sender)
|
||||||
|
|
||||||
// update sprite number
|
// update sprite number
|
||||||
char szText[16];
|
char szText[16];
|
||||||
sprintf(szText,"%ld sprits",_layer3D->getChildrenCount());
|
sprintf(szText,"%ld sprits", static_cast<long>(_layer3D->getChildrenCount()));
|
||||||
_labelSprite3DCount->setString(szText);
|
_labelSprite3DCount->setString(szText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ bool ControlButtonTest_Event::init()
|
||||||
|
|
||||||
void ControlButtonTest_Event::touchBitmaskAction(Ref *senderz, Control::EventType controlEvent)
|
void ControlButtonTest_Event::touchBitmaskAction(Ref *senderz, Control::EventType controlEvent)
|
||||||
{
|
{
|
||||||
_displayBitmaskLabel->setString(StringUtils::format("using bitmask (%d)", controlEvent));
|
_displayBitmaskLabel->setString(StringUtils::format("using bitmask (%d)", static_cast<int>(controlEvent)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlButtonTest_Event::touchDownAction(Ref *senderz, Control::EventType controlEvent)
|
void ControlButtonTest_Event::touchDownAction(Ref *senderz, Control::EventType controlEvent)
|
||||||
|
|
|
@ -187,11 +187,11 @@ void WebSocketTest::onClose(network::WebSocket* ws)
|
||||||
|
|
||||||
void WebSocketTest::onError(network::WebSocket* ws, const network::WebSocket::ErrorCode& error)
|
void WebSocketTest::onError(network::WebSocket* ws, const network::WebSocket::ErrorCode& error)
|
||||||
{
|
{
|
||||||
log("Error was fired, error code: %d", error);
|
log("Error was fired, error code: %d", static_cast<int>(error));
|
||||||
if (ws == _wsiError)
|
if (ws == _wsiError)
|
||||||
{
|
{
|
||||||
char buf[100] = {0};
|
char buf[100] = {0};
|
||||||
sprintf(buf, "an error was fired, code: %d", error);
|
sprintf(buf, "an error was fired, code: %d", static_cast<int>(error));
|
||||||
_errorStatus->setString(buf);
|
_errorStatus->setString(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,6 +308,6 @@ void WebSocketCloseTest::onClose(network::WebSocket* ws)
|
||||||
|
|
||||||
void WebSocketCloseTest::onError(network::WebSocket* ws, const network::WebSocket::ErrorCode& error)
|
void WebSocketCloseTest::onError(network::WebSocket* ws, const network::WebSocket::ErrorCode& error)
|
||||||
{
|
{
|
||||||
log("Error was fired, error code: %d", error);
|
log("Error was fired, error code: %d", static_cast<int>(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ bool TableViewTest::init()
|
||||||
|
|
||||||
void TableViewTest::tableCellTouched(TableView* table, TableViewCell* cell)
|
void TableViewTest::tableCellTouched(TableView* table, TableViewCell* cell)
|
||||||
{
|
{
|
||||||
CCLOG("cell touched at index: %ld", cell->getIdx());
|
CCLOG("cell touched at index: %ld", static_cast<long>(cell->getIdx()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Size TableViewTest::tableCellSizeForIndex(TableView *table, ssize_t idx)
|
Size TableViewTest::tableCellSizeForIndex(TableView *table, ssize_t idx)
|
||||||
|
@ -60,7 +60,7 @@ Size TableViewTest::tableCellSizeForIndex(TableView *table, ssize_t idx)
|
||||||
|
|
||||||
TableViewCell* TableViewTest::tableCellAtIndex(TableView *table, ssize_t idx)
|
TableViewCell* TableViewTest::tableCellAtIndex(TableView *table, ssize_t idx)
|
||||||
{
|
{
|
||||||
auto string = StringUtils::format("%ld", idx);
|
auto string = StringUtils::format("%ld", static_cast<long>(idx));
|
||||||
TableViewCell *cell = table->dequeueCell();
|
TableViewCell *cell = table->dequeueCell();
|
||||||
if (!cell) {
|
if (!cell) {
|
||||||
cell = new (std::nothrow) CustomTableViewCell();
|
cell = new (std::nothrow) CustomTableViewCell();
|
||||||
|
|
|
@ -1490,7 +1490,7 @@ void Sprite3DWithOBBPerformanceTest::onTouchesMoved(const std::vector<Touch*>& t
|
||||||
void Sprite3DWithOBBPerformanceTest::update(float dt)
|
void Sprite3DWithOBBPerformanceTest::update(float dt)
|
||||||
{
|
{
|
||||||
char szText[16];
|
char szText[16];
|
||||||
sprintf(szText,"%lu cubes",_obb.size());
|
sprintf(szText,"%lu cubes", static_cast<unsigned long>(_obb.size()));
|
||||||
_labelCubeCount->setString(szText);
|
_labelCubeCount->setString(szText);
|
||||||
|
|
||||||
if (_drawDebug)
|
if (_drawDebug)
|
||||||
|
|
|
@ -263,7 +263,7 @@ void TextureWEBP::onEnter()
|
||||||
addChild(img);
|
addChild(img);
|
||||||
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
||||||
Texture2D* texture = Director::getInstance()->getTextureCache()->getTextureForKey("Images/test_image.webp");
|
Texture2D* texture = Director::getInstance()->getTextureCache()->getTextureForKey("Images/test_image.webp");
|
||||||
log("pixel format:%d, premultiplied alpha:%d\n", texture->getPixelFormat(), texture->hasPremultipliedAlpha());
|
log("pixel format:%d, premultiplied alpha:%d\n", static_cast<int>(texture->getPixelFormat()), texture->hasPremultipliedAlpha());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TextureWEBP::title() const
|
std::string TextureWEBP::title() const
|
||||||
|
@ -286,7 +286,7 @@ void TextureWEBPNoAlpha::onEnter()
|
||||||
addChild(img);
|
addChild(img);
|
||||||
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
log("%s\n", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
||||||
Texture2D* texture = Director::getInstance()->getTextureCache()->getTextureForKey("Images/test_image_no_alpha.webp");
|
Texture2D* texture = Director::getInstance()->getTextureCache()->getTextureForKey("Images/test_image_no_alpha.webp");
|
||||||
log("pixel format:%d, premultiplied alpha:%d\n", texture->getPixelFormat(), texture->hasPremultipliedAlpha());
|
log("pixel format:%d, premultiplied alpha:%d\n", static_cast<int>(texture->getPixelFormat()), texture->hasPremultipliedAlpha());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TextureWEBPNoAlpha::title() const
|
std::string TextureWEBPNoAlpha::title() const
|
||||||
|
|
|
@ -100,7 +100,7 @@ void UIPageViewTest::pageViewEvent(Ref *pSender, PageView::EventType type)
|
||||||
{
|
{
|
||||||
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
||||||
|
|
||||||
_displayValueLabel->setString(StringUtils::format("page = %ld", pageView->getCurrentPageIndex() + 1));
|
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<long>(pageView->getCurrentPageIndex() + 1)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ void UIPageViewButtonTest::pageViewEvent(Ref *pSender, PageView::EventType type)
|
||||||
{
|
{
|
||||||
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
||||||
|
|
||||||
_displayValueLabel->setString(StringUtils::format("page = %ld", pageView->getCurrentPageIndex() + 1));
|
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<long>(pageView->getCurrentPageIndex() + 1)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ void UIPageViewTouchPropagationTest::pageViewEvent(Ref *pSender, PageView::Event
|
||||||
{
|
{
|
||||||
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
||||||
|
|
||||||
_displayValueLabel->setString(StringUtils::format("page = %ld", pageView->getCurrentPageIndex() + 1));
|
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<long>(pageView->getCurrentPageIndex() + 1)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -527,7 +527,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init()
|
||||||
}
|
}
|
||||||
|
|
||||||
pageView->pushBackCustomItem(outerBox);
|
pageView->pushBackCustomItem(outerBox);
|
||||||
_displayValueLabel->setString(StringUtils::format("page count = %ld", pageView->getItems().size()));
|
_displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast<long>(pageView->getItems().size())));
|
||||||
CCLOG("current page index = %zd", pageView->getCurrentPageIndex());
|
CCLOG("current page index = %zd", pageView->getCurrentPageIndex());
|
||||||
});
|
});
|
||||||
_uiLayer->addChild(button);
|
_uiLayer->addChild(button);
|
||||||
|
@ -548,7 +548,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init()
|
||||||
{
|
{
|
||||||
CCLOG("There is no page to remove!");
|
CCLOG("There is no page to remove!");
|
||||||
}
|
}
|
||||||
_displayValueLabel->setString(StringUtils::format("page count = %ld", pageView->getItems().size()));
|
_displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast<long>(pageView->getItems().size())));
|
||||||
CCLOG("current page index = %zd", pageView->getCurrentPageIndex());
|
CCLOG("current page index = %zd", pageView->getCurrentPageIndex());
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -563,7 +563,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init()
|
||||||
button3->addClickEventListener([=](Ref* sender)
|
button3->addClickEventListener([=](Ref* sender)
|
||||||
{
|
{
|
||||||
pageView->removeAllItems();
|
pageView->removeAllItems();
|
||||||
_displayValueLabel->setString(StringUtils::format("page count = %ld", pageView->getItems().size()));
|
_displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast<long>(pageView->getItems().size())));
|
||||||
CCLOG("current page index = %zd", pageView->getCurrentPageIndex());
|
CCLOG("current page index = %zd", pageView->getCurrentPageIndex());
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -592,7 +592,7 @@ void UIPageViewDynamicAddAndRemoveTest::pageViewEvent(Ref *pSender, PageView::Ev
|
||||||
{
|
{
|
||||||
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
||||||
|
|
||||||
_displayValueLabel->setString(StringUtils::format("page = %ld", pageView->getCurrentPageIndex() + 1));
|
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<long>((pageView->getCurrentPageIndex() + 1))));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -794,7 +794,7 @@ void UIPageViewVerticalTest::pageViewEvent(Ref *pSender, PageView::EventType typ
|
||||||
{
|
{
|
||||||
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
||||||
|
|
||||||
_displayValueLabel->setString(StringUtils::format("page = %ld", pageView->getCurrentPageIndex() + 1));
|
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<long>(pageView->getCurrentPageIndex() + 1)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -953,7 +953,7 @@ void UIPageViewChildSizeTest::pageViewEvent(Ref *pSender, PageView::EventType ty
|
||||||
{
|
{
|
||||||
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
PageView* pageView = dynamic_cast<PageView*>(pSender);
|
||||||
|
|
||||||
_displayValueLabel->setString(StringUtils::format("page = %ld", pageView->getCurrentPageIndex() + 1));
|
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<long>(pageView->getCurrentPageIndex() + 1)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -39,12 +39,12 @@ bool UIRichTextTest::init()
|
||||||
std::string str2 = config->getValue("Japanese").asString();
|
std::string str2 = config->getValue("Japanese").asString();
|
||||||
CCLOG("str1:%s ascii length = %ld, utf8 length = %ld, substr = %s",
|
CCLOG("str1:%s ascii length = %ld, utf8 length = %ld, substr = %s",
|
||||||
str1.c_str(),
|
str1.c_str(),
|
||||||
str1.length(),
|
static_cast<long>(str1.length()),
|
||||||
StringUtils::getCharacterCountInUTF8String(str1),
|
StringUtils::getCharacterCountInUTF8String(str1),
|
||||||
Helper::getSubStringOfUTF8String(str1, 0, 5).c_str());
|
Helper::getSubStringOfUTF8String(str1, 0, 5).c_str());
|
||||||
CCLOG("str2:%s ascii length = %ld, utf8 length = %ld, substr = %s",
|
CCLOG("str2:%s ascii length = %ld, utf8 length = %ld, substr = %s",
|
||||||
str2.c_str(),
|
str2.c_str(),
|
||||||
str2.length(),
|
static_cast<long>(str2.length()),
|
||||||
StringUtils::getCharacterCountInUTF8String(str2),
|
StringUtils::getCharacterCountInUTF8String(str2),
|
||||||
Helper::getSubStringOfUTF8String(str2, 0, 2).c_str());
|
Helper::getSubStringOfUTF8String(str2, 0, 2).c_str());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue