Change %ld to %d for 32bit data types

Regenerate LUA bindings
This commit is contained in:
rh101 2021-09-02 17:46:22 +10:00
parent 1f668eb783
commit eba8696d65
14 changed files with 2445 additions and 2243 deletions

View File

@ -115,7 +115,7 @@ std::string ProfilingTimer::getDescription() const
{
static char s_description[512] = {0};
sprintf(s_description, "%s ::\tavg1: %ldu,\tavg2: %ldu,\tmin: %ldu,\tmax: %ldu,\ttotal: %.2fs,\tnr calls: %ld", _nameStr.c_str(), _averageTime1, _averageTime2, minTime, maxTime, totalTime/1000000., numberOfCalls);
sprintf(s_description, "%s ::\tavg1: %du,\tavg2: %du,\tmin: %du,\tmax: %du,\ttotal: %.2fs,\tnr calls: %d", _nameStr.c_str(), _averageTime1, _averageTime2, minTime, maxTime, totalTime/1000000., numberOfCalls);
return s_description;
}

View File

@ -902,7 +902,7 @@ int32_t Properties::getLong(const char* name) const
{
int32_t value;
int scanned;
scanned = sscanf(valueString, "%ld", &value);
scanned = sscanf(valueString, "%d", &value);
if (scanned != 1)
{
CCLOGERROR("Error attempting to parse property '%s' as a long integer.", name);

View File

@ -380,7 +380,7 @@ void GLView::handleTouchesMove(int num, intptr_t ids[], float xs[], float ys[],
else
{
// It is error, should return.
CCLOG("Moving touches with id: %ld error", (int32_t)id);
CCLOG("Moving touches with id: %d error", static_cast<int32_t>(id));
return;
}
}
@ -433,7 +433,7 @@ void GLView::handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, int num
}
else
{
CCLOG("Ending touches with id: %ld error", static_cast<int32_t>(id));
CCLOG("Ending touches with id: %d error", static_cast<int32_t>(id));
return;
}

View File

@ -652,7 +652,7 @@ std::string TextureCache::getCachedTextureInfo() const
auto bytes = tex->getPixelsWide() * tex->getPixelsHigh() * bpp / 8;
totalBytes += bytes;
count++;
snprintf(buftmp, sizeof(buftmp) - 1, "\"%s\" rc=%lu id=%p %lu x %lu @ %ld bpp => %lu KB\n",
snprintf(buftmp, sizeof(buftmp) - 1, "\"%s\" rc=%lu id=%p %lu x %lu @ %d bpp => %lu KB\n",
texture.first.c_str(),
(int32_t)tex->getReferenceCount(),
tex->getBackendTexture(),

View File

@ -123,7 +123,7 @@ std::string Helper::getSubStringOfUTF8String(const std::string& str, std::string
return "";
}
if (utf32.size() < start) {
CCLOGERROR("'start' is out of range: %ld, %s", static_cast<int32_t>(start), str.c_str());
CCLOGERROR("'start' is out of range: %d, %s", static_cast<int32_t>(start), str.c_str());
return "";
}
std::string result;

File diff suppressed because it is too large Load Diff

View File

@ -2325,6 +2325,10 @@ int register_all_cocos2dx(lua_State* tolua_S);

View File

@ -957,7 +957,7 @@ void ActionCallFunction::callback3(Node* sender, int32_t data)
label->setPosition(s.width/4*3,s.height/2);
addChild(label);
CCLOG("target is: %p, data is: %ld", sender, data);
CCLOG("target is: %p, data is: %d", sender, data);
}
std::string ActionCallFunction::subtitle() const

View File

@ -900,7 +900,7 @@ void CameraCullingDemo::addSpriteCallback(Ref* sender)
// update sprite number
char szText[16];
sprintf(szText,"%ld sprits", static_cast<int32_t>(_layer3D->getChildrenCount()));
sprintf(szText,"%d sprits", static_cast<int32_t>(_layer3D->getChildrenCount()));
_labelSprite3DCount->setString(szText);
}
@ -928,7 +928,7 @@ void CameraCullingDemo::delSpriteCallback(Ref* sender)
// update sprite number
char szText[16];
sprintf(szText,"%ld sprits", static_cast<int32_t>(_layer3D->getChildrenCount()));
sprintf(szText,"%l sprits", static_cast<int32_t>(_layer3D->getChildrenCount()));
_labelSprite3DCount->setString(szText);
}

View File

@ -71,7 +71,7 @@ bool TableViewTest::init()
void TableViewTest::tableCellTouched(TableView* table, TableViewCell* cell)
{
CCLOG("cell touched at index: %ld", static_cast<int32_t>(cell->getIdx()));
CCLOG("cell touched at index: %d", static_cast<int32_t>(cell->getIdx()));
}
Size TableViewTest::tableCellSizeForIndex(TableView *table, ssize_t idx)
@ -84,7 +84,7 @@ Size TableViewTest::tableCellSizeForIndex(TableView *table, ssize_t idx)
TableViewCell* TableViewTest::tableCellAtIndex(TableView *table, ssize_t idx)
{
auto string = StringUtils::format("%ld", static_cast<int32_t>(idx));
auto string = StringUtils::format("%d", static_cast<int32_t>(idx));
TableViewCell *cell = table->dequeueCell();
if (!cell) {
cell = new (std::nothrow) CustomTableViewCell();

View File

@ -374,7 +374,7 @@ void TestFileFuncs::onEnter()
// getFileSize Test
int32_t size = sharedFileUtils->getFileSize(filepath);
msg = StringUtils::format("getFileSize: Test file size equals %ld", size);
msg = StringUtils::format("getFileSize: Test file size equals %d", size);
label = Label::createWithSystemFont(msg, "", 20);
label->setPosition(x, y * 3);
this->addChild(label);
@ -1161,7 +1161,7 @@ void TestFileFuncsAsync::onEnter()
this->addChild(label);
sharedFileUtils->getFileSize(filepath, [=](int32_t size) {
auto msg = StringUtils::format("getFileSize: Test file size equals %ld", size);
auto msg = StringUtils::format("getFileSize: Test file size equals %d", size);
auto label = Label::createWithSystemFont(msg, "", 20);
label->setPosition(x, y * 3);
this->addChild(label);

View File

@ -313,9 +313,9 @@ void HttpClientTest::onHttpRequestCompleted(HttpClient *sender, HttpResponse *re
int32_t statusCode = response->getResponseCode();
char statusString[64] = {};
sprintf(statusString, "HTTP Status Code: %ld, tag = %s", statusCode, response->getHttpRequest()->getTag());
sprintf(statusString, "HTTP Status Code: %d, tag = %s", statusCode, response->getHttpRequest()->getTag());
_labelStatusCode->setString(statusString);
log("response code: %ld", statusCode);
log("response code: %d", statusCode);
if (response->getResponseCode() != 200)
{
@ -462,9 +462,9 @@ void HttpClientClearRequestsTest::onHttpRequestCompleted(HttpClient *sender, Htt
int32_t statusCode = response->getResponseCode();
char statusString[64] = {};
sprintf(statusString, "HTTP Status Code: %ld, tag = %s", statusCode, response->getHttpRequest()->getTag());
sprintf(statusString, "HTTP Status Code: %d, tag = %s", statusCode, response->getHttpRequest()->getTag());
_labelStatusCode->setString(statusString);
log("response code: %ld", statusCode);
log("response code: %d", statusCode);
_totalProcessedRequests++;
sprintf(statusString, "Got %d of %d expected http requests", _totalProcessedRequests, _totalExpectedRequests);

View File

@ -129,7 +129,7 @@ void UIPageViewTest::pageViewEvent(Ref *pSender, PageView::EventType type)
{
PageView* pageView = dynamic_cast<PageView*>(pSender);
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<int32_t>(pageView->getCurrentPageIndex() + 1)));
_displayValueLabel->setString(StringUtils::format("page = %d", static_cast<int32_t>(pageView->getCurrentPageIndex() + 1)));
}
break;
@ -241,7 +241,7 @@ void UIPageViewButtonTest::pageViewEvent(Ref *pSender, PageView::EventType type)
{
PageView* pageView = dynamic_cast<PageView*>(pSender);
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<int32_t>(pageView->getCurrentPageIndex() + 1)));
_displayValueLabel->setString(StringUtils::format("page = %d", static_cast<int32_t>(pageView->getCurrentPageIndex() + 1)));
}
break;
@ -438,7 +438,7 @@ void UIPageViewTouchPropagationTest::pageViewEvent(Ref *pSender, PageView::Event
{
PageView* pageView = dynamic_cast<PageView*>(pSender);
_displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<int32_t>(pageView->getCurrentPageIndex() + 1)));
_displayValueLabel->setString(StringUtils::format("page = %d", static_cast<int32_t>(pageView->getCurrentPageIndex() + 1)));
}
break;

View File

@ -67,12 +67,12 @@ bool UIRichTextTest::init()
std::string str1 = config->getValue("Chinese").asString();
std::string str2 = config->getValue("Japanese").asString();
CCLOG("str1:%s ascii length = %ld, utf8 length = %ld, substr = %s",
CCLOG("str1:%s ascii length = %d, utf8 length = %d, substr = %s",
str1.c_str(),
static_cast<int32_t>(str1.length()),
StringUtils::getCharacterCountInUTF8String(str1),
Helper::getSubStringOfUTF8String(str1, 0, 5).c_str());
CCLOG("str2:%s ascii length = %ld, utf8 length = %ld, substr = %s",
CCLOG("str2:%s ascii length = %d, utf8 length = %d, substr = %s",
str2.c_str(),
static_cast<int32_t>(str2.length()),
StringUtils::getCharacterCountInUTF8String(str2),