From 568e3612bdafd6f508e8a7aa589b5f29143ad56f Mon Sep 17 00:00:00 2001 From: rh101 Date: Thu, 2 Sep 2021 20:30:20 +1000 Subject: [PATCH] Remove getLong() method Change %du to %u, and %lx to %x Use "stdint.h" instead of for TGAlib.h --- cocos/base/CCProfiling.cpp | 2 +- cocos/base/CCProperties.cpp | 19 ------------------- cocos/base/CCProperties.h | 12 ------------ cocos/base/TGAlib.h | 2 +- cocos/renderer/CCTexture2D.cpp | 2 +- 5 files changed, 3 insertions(+), 34 deletions(-) diff --git a/cocos/base/CCProfiling.cpp b/cocos/base/CCProfiling.cpp index de7e90fd8f..2092be2dae 100644 --- a/cocos/base/CCProfiling.cpp +++ b/cocos/base/CCProfiling.cpp @@ -115,7 +115,7 @@ std::string ProfilingTimer::getDescription() const { static char s_description[512] = {0}; - 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); + sprintf(s_description, "%s ::\tavg1: %u,\tavg2: %u,\tmin: %u,\tmax: %u,\ttotal: %.2fs,\tnr calls: %d", _nameStr.c_str(), _averageTime1, _averageTime2, minTime, maxTime, totalTime/1000000., numberOfCalls); return s_description; } diff --git a/cocos/base/CCProperties.cpp b/cocos/base/CCProperties.cpp index 6a5d8f4a26..6c81237b44 100644 --- a/cocos/base/CCProperties.cpp +++ b/cocos/base/CCProperties.cpp @@ -895,25 +895,6 @@ float Properties::getFloat(const char* name) const return 0.0f; } -int32_t Properties::getLong(const char* name) const -{ - const char* valueString = getString(name); - if (valueString) - { - int32_t value; - int scanned; - scanned = sscanf(valueString, "%d", &value); - if (scanned != 1) - { - CCLOGERROR("Error attempting to parse property '%s' as a long integer.", name); - return 0L; - } - return value; - } - - return 0L; -} - bool Properties::getMat4(const char* name, Mat4* out) const { CCASSERT(out, "Invalid out"); diff --git a/cocos/base/CCProperties.h b/cocos/base/CCProperties.h index ccbe5c3959..6994beed0e 100644 --- a/cocos/base/CCProperties.h +++ b/cocos/base/CCProperties.h @@ -327,18 +327,6 @@ public: */ float getFloat(const char* name = NULL) const; - /** - * Interpret the value of the given property as a long integer. - * If the property does not exist, zero will be returned. - * If the property exists but could not be scanned, an error will be logged and zero will be returned. - * - * @param name The name of the property to interpret, or NULL to return the current property's value. - * - * @return The value of the given property interpreted as a long. - * Zero if the property does not exist or could not be scanned. - */ - int32_t getLong(const char* name = NULL) const; - /** * Interpret the value of the given property as a Matrix. * If the property does not exist, out will be set to the identity matrix. diff --git a/cocos/base/TGAlib.h b/cocos/base/TGAlib.h index 2471802e18..294f5b307e 100644 --- a/cocos/base/TGAlib.h +++ b/cocos/base/TGAlib.h @@ -28,7 +28,7 @@ THE SOFTWARE. #define __SUPPORT_DATA_SUPPORT_TGALIB_H__ /// @cond DO_NOT_SHOW -#include +#include "stdint.h" namespace cocos2d { diff --git a/cocos/renderer/CCTexture2D.cpp b/cocos/renderer/CCTexture2D.cpp index 1a0088eb8c..eee94c8b2f 100644 --- a/cocos/renderer/CCTexture2D.cpp +++ b/cocos/renderer/CCTexture2D.cpp @@ -284,7 +284,7 @@ bool Texture2D::updateWithMipmaps(MipmapInfo* mipmaps, int mipmapsNum, backend:: auto& pfd = backend::PixelFormatUtils::getFormatDescriptor(pixelFormat); if (!pfd.bpp) { - CCLOG("cocos2d: WARNING: unsupported pixelformat: %lx", (uint32_t)pixelFormat); + CCLOG("cocos2d: WARNING: unsupported pixelformat: %x", (uint32_t)pixelFormat); #ifdef CC_USE_METAL CCASSERT(false, "pixeformat not found in _pixelFormatInfoTables, register required!"); #endif