diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id b/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id index 2d58de5e8e..fe3e81cb1f 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -ff9dbafe4906a945e984046cd9e9cafd445ab0fa \ No newline at end of file +3a1607c0385421e792026568502b207f3c7c679b \ No newline at end of file diff --git a/cocos/2d/CCFont.h b/cocos/2d/CCFont.h index c384ae752a..0d07078237 100644 --- a/cocos/2d/CCFont.h +++ b/cocos/2d/CCFont.h @@ -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; } diff --git a/cocos/2d/CCIMEDelegate.h b/cocos/2d/CCIMEDelegate.h index d232236ceb..bf230e01df 100644 --- a/cocos/2d/CCIMEDelegate.h +++ b/cocos/2d/CCIMEDelegate.h @@ -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. diff --git a/cocos/2d/CCIMEDispatcher.cpp b/cocos/2d/CCIMEDispatcher.cpp index c58f3d7d5e..8ba86f3350 100644 --- a/cocos/2d/CCIMEDispatcher.cpp +++ b/cocos/2d/CCIMEDispatcher.cpp @@ -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 { diff --git a/cocos/2d/CCIMEDispatcher.h b/cocos/2d/CCIMEDispatcher.h index 0f71c2fab6..698f033551 100644 --- a/cocos/2d/CCIMEDispatcher.h +++ b/cocos/2d/CCIMEDispatcher.h @@ -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. diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index 5147ba998d..f5817b676f 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -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(_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 diff --git a/cocos/2d/CCLabelTTF.cpp b/cocos/2d/CCLabelTTF.cpp index 7552edb0be..0ad1cb1cb3 100644 --- a/cocos/2d/CCLabelTTF.cpp +++ b/cocos/2d/CCLabelTTF.cpp @@ -120,7 +120,7 @@ const std::string& LabelTTF::getString() const std::string LabelTTF::getDescription() const { - return StringUtils::format("", _renderLabel->getFontName().c_str(), _renderLabel->getFontSize(), _renderLabel->getString().c_str()); + return StringUtils::format("", _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; diff --git a/cocos/2d/CCLabelTTF.h b/cocos/2d/CCLabelTTF.h index 5398c2cb77..45bed7196e 100644 --- a/cocos/2d/CCLabelTTF.h +++ b/cocos/2d/CCLabelTTF.h @@ -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); diff --git a/cocos/2d/CCTextFieldTTF.cpp b/cocos/2d/CCTextFieldTTF.cpp index 4911187604..d518919ca1 100644 --- a/cocos/2d/CCTextFieldTTF.cpp +++ b/cocos/2d/CCTextFieldTTF.cpp @@ -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); diff --git a/cocos/2d/CCTextFieldTTF.h b/cocos/2d/CCTextFieldTTF.h index 9019cf95ee..f086d0aa27 100644 --- a/cocos/2d/CCTextFieldTTF.h +++ b/cocos/2d/CCTextFieldTTF.h @@ -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: diff --git a/cocos/2d/platform/ios/Simulation/AccelerometerSimulation.h b/cocos/2d/platform/ios/Simulation/AccelerometerSimulation.h index 49ef7c1276..149099ade1 100644 --- a/cocos/2d/platform/ios/Simulation/AccelerometerSimulation.h +++ b/cocos/2d/platform/ios/Simulation/AccelerometerSimulation.h @@ -78,5 +78,4 @@ THE SOFTWARE. @end #endif // !TARGET_CPU_ARM - #endif // CC_PLATFORM_IOS diff --git a/cocos/base/CCConsole.cpp b/cocos/base/CCConsole.cpp index 3a2b5c76c7..b854c0911b 100644 --- a/cocos/base/CCConsole.cpp +++ b/cocos/base/CCConsole.cpp @@ -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; diff --git a/cocos/base/CCConsole.h b/cocos/base/CCConsole.h index 0d367a8d7c..301bf81b57 100644 --- a/cocos/base/CCConsole.h +++ b/cocos/base/CCConsole.h @@ -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(); diff --git a/cocos/ui/UIRichText.cpp b/cocos/ui/UIRichText.cpp index a9099ad291..216b4d6d0c 100644 --- a/cocos/ui/UIRichText.cpp +++ b/cocos/ui/UIRichText.cpp @@ -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* 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* 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* l = _elementRenders[i]; l->clear(); diff --git a/cocos/ui/UITextField.cpp b/cocos/ui/UITextField.cpp index 30f633503c..1a9cb28b7b 100644 --- a/cocos/ui/UITextField.cpp +++ b/cocos/ui/UITextField.cpp @@ -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; diff --git a/cocos/ui/UITextField.h b/cocos/ui/UITextField.h index 2c61d2724e..3a3caed343 100644 --- a/cocos/ui/UITextField.h +++ b/cocos/ui/UITextField.h @@ -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();