mirror of https://github.com/axmolengine/axmol.git
Added CC_FORMAT_PRINTF to CCString
Added for CCString::initWithFormat() and CCString::createWithFormat(). Fixed warnings.
This commit is contained in:
parent
e5b2f300f9
commit
3ae98978d4
|
@ -54,7 +54,7 @@ public:
|
|||
CCString& operator= (const CCString& other);
|
||||
|
||||
/** init a string with format, it's similar with the c function 'sprintf' */
|
||||
bool initWithFormat(const char* format, ...);
|
||||
bool initWithFormat(const char* format, ...) CC_FORMAT_PRINTF(2, 3);
|
||||
|
||||
/** convert to int value */
|
||||
int intValue() const;
|
||||
|
@ -95,7 +95,7 @@ public:
|
|||
* @return A CCString pointer which is an autorelease object pointer,
|
||||
* it means that you needn't do a release operation unless you retain it.
|
||||
*/
|
||||
static CCString* createWithFormat(const char* format, ...);
|
||||
static CCString* createWithFormat(const char* format, ...) CC_FORMAT_PRINTF(1, 2);
|
||||
|
||||
/** create a string with binary data
|
||||
* @return A CCString pointer which is an autorelease object pointer,
|
||||
|
|
|
@ -45,7 +45,6 @@ http://www.angelcode.com/products/bmfont/ (Free, Windows only)
|
|||
|
||||
using namespace std;
|
||||
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
// The return value needs to be deleted by CC_SAFE_DELETE_ARRAY.
|
||||
|
@ -153,8 +152,8 @@ CCBMFontConfiguration::~CCBMFontConfiguration()
|
|||
const char* CCBMFontConfiguration::description(void)
|
||||
{
|
||||
return CCString::createWithFormat(
|
||||
"<CCBMFontConfiguration = %08X | Glphys:%d Kernings:%d | Image = %s>",
|
||||
this,
|
||||
"<CCBMFontConfiguration = " CC_FORMAT_PRINTF_SIZE_T " | Glphys:%d Kernings:%d | Image = %s>",
|
||||
(size_t)this,
|
||||
HASH_COUNT(m_pFontDefDictionary),
|
||||
HASH_COUNT(m_pKerningDictionary),
|
||||
m_sAtlasName.c_str()
|
||||
|
|
|
@ -259,6 +259,12 @@ public: virtual void set##funName(varType var) \
|
|||
#define CC_FORMAT_PRINTF(formatPos, argPos)
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define CC_FORMAT_PRINTF_SIZE_T "%08lX"
|
||||
#else
|
||||
#define CC_FORMAT_PRINTF_SIZE_T "%08zX"
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define CC_UNUSED __attribute__ ((unused))
|
||||
#else
|
||||
|
|
|
@ -130,7 +130,10 @@ bool CCGLProgram::initWithVertexShaderFilename(const char* vShaderFilename, cons
|
|||
|
||||
const char* CCGLProgram::description()
|
||||
{
|
||||
return CCString::createWithFormat("<CCGLProgram = %08X | Program = %i, VertexShader = %i, FragmentShader = %i>", this, m_uProgram, m_uVertShader, m_uFragShader)->getCString();
|
||||
return CCString::createWithFormat("<CCGLProgram = "
|
||||
CC_FORMAT_PRINTF_SIZE_T
|
||||
" | Program = %i, VertexShader = %i, FragmentShader = %i>",
|
||||
(size_t)this, m_uProgram, m_uVertShader, m_uFragShader)->getCString();
|
||||
}
|
||||
|
||||
bool CCGLProgram::compileShader(GLuint * shader, GLenum type, const GLchar* source)
|
||||
|
|
Loading…
Reference in New Issue