mirror of https://github.com/axmolengine/axmol.git
fix cocos2dx engine internal warnings
This commit is contained in:
parent
23c3fabeb2
commit
7ae77c9335
|
@ -1 +1 @@
|
|||
ff9dbafe4906a945e984046cd9e9cafd445ab0fa
|
||||
3a1607c0385421e792026568502b207f3c7c679b
|
|
@ -44,7 +44,6 @@ public:
|
|||
virtual int* getHorizontalKerningForTextUTF16(unsigned short *text, int &outNumLetters) const = 0;
|
||||
virtual const char* getCurrentGlyphCollection() const;
|
||||
|
||||
virtual unsigned char * getGlyphBitmap(unsigned short theChar, int &outWidth, int &outHeight) const { return 0; }
|
||||
|
||||
virtual int getFontMaxHeight() const { return 0; }
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ protected:
|
|||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void insertText(const char * text, int len) {CC_UNUSED_PARAM(text);CC_UNUSED_PARAM(len);}
|
||||
virtual void insertText(const char * text, size_t len) {CC_UNUSED_PARAM(text);CC_UNUSED_PARAM(len);}
|
||||
|
||||
/**
|
||||
@brief Called by IMEDispatcher after the user clicks the backward key.
|
||||
|
|
|
@ -214,7 +214,7 @@ void IMEDispatcher::removeDelegate(IMEDelegate* delegate)
|
|||
// dispatch text message
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void IMEDispatcher::dispatchInsertText(const char * text, int len)
|
||||
void IMEDispatcher::dispatchInsertText(const char * text, size_t len)
|
||||
{
|
||||
do
|
||||
{
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
void dispatchInsertText(const char * text, int len);
|
||||
void dispatchInsertText(const char * text, size_t len);
|
||||
|
||||
/**
|
||||
@brief Dispatches the delete-backward operation.
|
||||
|
|
|
@ -596,7 +596,7 @@ void Label::alignText()
|
|||
{
|
||||
for (auto index = _batchNodes.size(); index < textures.size(); ++index)
|
||||
{
|
||||
auto batchNode = SpriteBatchNode::createWithTexture(textures[index]);
|
||||
auto batchNode = SpriteBatchNode::createWithTexture(textures[(int)index]);
|
||||
batchNode->setAnchorPoint(Point::ANCHOR_TOP_LEFT);
|
||||
batchNode->setPosition(Point::ZERO);
|
||||
Node::addChild(batchNode,0,Node::INVALID_TAG);
|
||||
|
@ -711,7 +711,7 @@ void Label::updateQuads()
|
|||
_reusedLetter->setTextureRect(_reusedRect,false,_reusedRect.size);
|
||||
|
||||
_reusedLetter->setPosition(_lettersInfo[ctr].position);
|
||||
index = _batchNodes[letterDef.textureID]->getTextureAtlas()->getTotalQuads();
|
||||
index = static_cast<int>(_batchNodes[letterDef.textureID]->getTextureAtlas()->getTotalQuads());
|
||||
_lettersInfo[ctr].atlasIndex = index;
|
||||
_batchNodes[letterDef.textureID]->insertQuadFromSprite(_reusedLetter,index);
|
||||
}
|
||||
|
@ -1141,7 +1141,7 @@ void Label::computeStringNumLines()
|
|||
|
||||
int Label::getStringLength() const
|
||||
{
|
||||
return _currentUTF16String ? cc_wcslen(_currentUTF16String) : _originalUTF8String.length();
|
||||
return _currentUTF16String ? cc_wcslen(_currentUTF16String) : (int)_originalUTF8String.length();
|
||||
}
|
||||
|
||||
// RGBA protocol
|
||||
|
|
|
@ -120,7 +120,7 @@ const std::string& LabelTTF::getString() const
|
|||
|
||||
std::string LabelTTF::getDescription() const
|
||||
{
|
||||
return StringUtils::format("<LabelTTF | FontName = %s, FontSize = %.1f, Label = '%s'>", _renderLabel->getFontName().c_str(), _renderLabel->getFontSize(), _renderLabel->getString().c_str());
|
||||
return StringUtils::format("<LabelTTF | FontName = %s, FontSize = %d, Label = '%s'>", _renderLabel->getFontName().c_str(), _renderLabel->getFontSize(), _renderLabel->getString().c_str());
|
||||
}
|
||||
|
||||
TextHAlignment LabelTTF::getHorizontalAlignment() const
|
||||
|
@ -156,12 +156,12 @@ void LabelTTF::setDimensions(const Size &dim)
|
|||
_contentDirty = true;
|
||||
}
|
||||
|
||||
float LabelTTF::getFontSize() const
|
||||
int LabelTTF::getFontSize() const
|
||||
{
|
||||
return _renderLabel->getFontSize();
|
||||
}
|
||||
|
||||
void LabelTTF::setFontSize(float fontSize)
|
||||
void LabelTTF::setFontSize(int fontSize)
|
||||
{
|
||||
_renderLabel->setFontSize(fontSize);
|
||||
_contentDirty = true;
|
||||
|
|
|
@ -130,8 +130,8 @@ public:
|
|||
const Size& getDimensions() const;
|
||||
void setDimensions(const Size &dim);
|
||||
|
||||
float getFontSize() const;
|
||||
void setFontSize(float fontSize);
|
||||
int getFontSize() const;
|
||||
void setFontSize(int fontSize);
|
||||
|
||||
const std::string& getFontName() const;
|
||||
void setFontName(const std::string& fontName);
|
||||
|
|
|
@ -160,7 +160,7 @@ bool TextFieldTTF::canDetachWithIME()
|
|||
return (_delegate) ? (! _delegate->onTextFieldDetachWithIME(this)) : true;
|
||||
}
|
||||
|
||||
void TextFieldTTF::insertText(const char * text, int len)
|
||||
void TextFieldTTF::insertText(const char * text, size_t len)
|
||||
{
|
||||
std::string insert(text, len);
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
/**
|
||||
@brief If the sender doesn't want to insert the text, return true;
|
||||
*/
|
||||
virtual bool onTextFieldInsertText(TextFieldTTF * sender, const char * text, int nLen)
|
||||
virtual bool onTextFieldInsertText(TextFieldTTF * sender, const char * text, size_t nLen)
|
||||
{
|
||||
CC_UNUSED_PARAM(sender);
|
||||
CC_UNUSED_PARAM(text);
|
||||
|
@ -181,7 +181,7 @@ protected:
|
|||
|
||||
virtual bool canAttachWithIME() override;
|
||||
virtual bool canDetachWithIME() override;
|
||||
virtual void insertText(const char * text, int len) override;
|
||||
virtual void insertText(const char * text, size_t len) override;
|
||||
virtual void deleteBackward() override;
|
||||
virtual const std::string& getContentText() override;
|
||||
private:
|
||||
|
|
|
@ -78,5 +78,4 @@ THE SOFTWARE.
|
|||
@end
|
||||
|
||||
#endif // !TARGET_CPU_ARM
|
||||
|
||||
#endif // CC_PLATFORM_IOS
|
||||
|
|
|
@ -642,7 +642,7 @@ void Console::commandTouch(int fd, const std::string& args)
|
|||
float x = std::atof(argv[1].c_str());
|
||||
float y = std::atof(argv[2].c_str());
|
||||
|
||||
srand (time(NULL));
|
||||
srand ((unsigned)time(NULL));
|
||||
_touchId = rand();
|
||||
Scheduler *sched = Director::getInstance()->getScheduler();
|
||||
sched->performFunctionInCocosThread( [&](){
|
||||
|
@ -670,7 +670,7 @@ void Console::commandTouch(int fd, const std::string& args)
|
|||
float x2 = std::atof(argv[3].c_str());
|
||||
float y2 = std::atof(argv[4].c_str());
|
||||
|
||||
srand (time(NULL));
|
||||
srand ((unsigned)time(NULL));
|
||||
_touchId = rand();
|
||||
|
||||
Scheduler *sched = Director::getInstance()->getScheduler();
|
||||
|
@ -851,7 +851,7 @@ ssize_t Console::readline(int fd, char* ptr, int maxlen)
|
|||
return n;
|
||||
}
|
||||
|
||||
ssize_t Console::readfile(int fd, std::string& file_name, int file_size)
|
||||
ssize_t Console::readfile(int fd, std::string& file_name, ssize_t file_size)
|
||||
{
|
||||
ssize_t n, rc;
|
||||
char c;
|
||||
|
|
|
@ -100,7 +100,7 @@ public:
|
|||
protected:
|
||||
void loop();
|
||||
ssize_t readline(int fd, char *buf, int maxlen);
|
||||
ssize_t readfile(int fd, std::string &file_name, int file_size);
|
||||
ssize_t readfile(int fd, std::string &file_name, ssize_t file_size);
|
||||
bool parseCommand(int fd);
|
||||
|
||||
void addClient();
|
||||
|
|
|
@ -262,7 +262,7 @@ void RichText::handleTextRenderer(const char *text, const char *fontName, float
|
|||
{
|
||||
float overstepPercent = (-_leftSpaceWidth) / textRendererWidth;
|
||||
std::string curText = text;
|
||||
int stringLength = curText.length();
|
||||
size_t stringLength = curText.length();
|
||||
int leftLength = stringLength * (1.0f - overstepPercent);
|
||||
std::string leftWords = curText.substr(0, leftLength);
|
||||
std::string cutWords = curText.substr(leftLength, curText.length()-1);
|
||||
|
@ -340,7 +340,7 @@ void RichText::formarRenderers()
|
|||
float newContentSizeHeight = 0.0f;
|
||||
float *maxHeights = new float[_elementRenders.size()];
|
||||
|
||||
for (size_t i=0; i<_elementRenders.size(); i++)
|
||||
for (int i=0; i<_elementRenders.size(); i++)
|
||||
{
|
||||
Vector<Node*>* row = (_elementRenders[i]);
|
||||
float maxHeight = 0.0f;
|
||||
|
@ -355,7 +355,7 @@ void RichText::formarRenderers()
|
|||
|
||||
|
||||
float nextPosY = _customSize.height;
|
||||
for (size_t i=0; i<_elementRenders.size(); i++)
|
||||
for (int i=0; i<_elementRenders.size(); i++)
|
||||
{
|
||||
Vector<Node*>* row = (_elementRenders[i]);
|
||||
float nextPosX = 0.0f;
|
||||
|
@ -375,7 +375,7 @@ void RichText::formarRenderers()
|
|||
}
|
||||
|
||||
size_t length = _elementRenders.size();
|
||||
for (size_t i = 0; i<length; i++)
|
||||
for (int i = 0; i<length; i++)
|
||||
{
|
||||
Vector<Node*>* l = _elementRenders[i];
|
||||
l->clear();
|
||||
|
|
|
@ -91,7 +91,7 @@ bool UICCTextField::onTextFieldAttachWithIME(TextFieldTTF *pSender)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool UICCTextField::onTextFieldInsertText(TextFieldTTF *pSender, const char *text, int nLen)
|
||||
bool UICCTextField::onTextFieldInsertText(TextFieldTTF *pSender, const char *text, size_t nLen)
|
||||
{
|
||||
if (nLen == 1 && strcmp(text, "\n") == 0)
|
||||
{
|
||||
|
@ -121,7 +121,7 @@ bool UICCTextField::onTextFieldDetachWithIME(TextFieldTTF *pSender)
|
|||
return false;
|
||||
}
|
||||
|
||||
void UICCTextField::insertText(const char * text, int len)
|
||||
void UICCTextField::insertText(const char * text, size_t len)
|
||||
{
|
||||
std::string input_text = text;
|
||||
|
||||
|
|
|
@ -49,10 +49,10 @@ public:
|
|||
// CCTextFieldDelegate
|
||||
virtual bool onTextFieldAttachWithIME(TextFieldTTF *pSender) override;
|
||||
virtual bool onTextFieldDetachWithIME(TextFieldTTF * pSender) override;
|
||||
virtual bool onTextFieldInsertText(TextFieldTTF * pSender, const char * text, int nLen) override;
|
||||
virtual bool onTextFieldInsertText(TextFieldTTF * pSender, const char * text, size_t nLen) override;
|
||||
virtual bool onTextFieldDeleteBackward(TextFieldTTF * pSender, const char * delText, int nLen) override;
|
||||
|
||||
void insertText(const char* text, int len);
|
||||
void insertText(const char* text, size_t len);
|
||||
void deleteBackward();
|
||||
|
||||
void openIME();
|
||||
|
|
Loading…
Reference in New Issue