mirror of https://github.com/axmolengine/axmol.git
Fix implicit conversion warning (#16598)
* Fix implicit conversion warning * Change SAXParser::textHandler parameter type from int to size_t
This commit is contained in:
parent
466053b740
commit
8b703a8d12
|
@ -786,7 +786,7 @@ void TMXMapInfo::endElement(void *ctx, const char *name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMXMapInfo::textHandler(void *ctx, const char *ch, int len)
|
void TMXMapInfo::textHandler(void *ctx, const char *ch, size_t len)
|
||||||
{
|
{
|
||||||
CC_UNUSED_PARAM(ctx);
|
CC_UNUSED_PARAM(ctx);
|
||||||
TMXMapInfo *tmxMapInfo = this;
|
TMXMapInfo *tmxMapInfo = this;
|
||||||
|
|
|
@ -279,17 +279,17 @@ public:
|
||||||
* @js NA
|
* @js NA
|
||||||
* @lua NA
|
* @lua NA
|
||||||
*/
|
*/
|
||||||
void startElement(void *ctx, const char *name, const char **atts);
|
void startElement(void *ctx, const char *name, const char **atts) override;
|
||||||
/**
|
/**
|
||||||
* @js NA
|
* @js NA
|
||||||
* @lua NA
|
* @lua NA
|
||||||
*/
|
*/
|
||||||
void endElement(void *ctx, const char *name);
|
void endElement(void *ctx, const char *name) override;
|
||||||
/**
|
/**
|
||||||
* @js NA
|
* @js NA
|
||||||
* @lua NA
|
* @lua NA
|
||||||
*/
|
*/
|
||||||
void textHandler(void *ctx, const char *ch, int len);
|
void textHandler(void *ctx, const char *ch, size_t len) override;
|
||||||
|
|
||||||
const std::string& getCurrentString() const { return _currentString; }
|
const std::string& getCurrentString() const { return _currentString; }
|
||||||
void setCurrentString(const std::string& currentString){ _currentString = currentString; }
|
void setCurrentString(const std::string& currentString){ _currentString = currentString; }
|
||||||
|
|
|
@ -292,7 +292,7 @@ public:
|
||||||
_state = SAX_NONE;
|
_state = SAX_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void textHandler(void *ctx, const char *ch, int len)
|
void textHandler(void *ctx, const char *ch, size_t len) override
|
||||||
{
|
{
|
||||||
CC_UNUSED_PARAM(ctx);
|
CC_UNUSED_PARAM(ctx);
|
||||||
if (_state == SAX_NONE)
|
if (_state == SAX_NONE)
|
||||||
|
|
|
@ -83,7 +83,7 @@ bool XmlSaxHander::VisitExit( const tinyxml2::XMLElement& element )
|
||||||
bool XmlSaxHander::Visit( const tinyxml2::XMLText& text )
|
bool XmlSaxHander::Visit( const tinyxml2::XMLText& text )
|
||||||
{
|
{
|
||||||
//log("Visit %s",text.Value());
|
//log("Visit %s",text.Value());
|
||||||
SAXParser::textHandler(_ccsaxParserImp, (const CC_XML_CHAR *)text.Value(), static_cast<int>(strlen(text.Value())));
|
SAXParser::textHandler(_ccsaxParserImp, (const CC_XML_CHAR *)text.Value(), strlen(text.Value()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ bool SAXParser::parseIntrusive(char* xmlData, size_t dataLength)
|
||||||
|
|
||||||
rapidxml::xml_sax3_parser<> parser(&printer);
|
rapidxml::xml_sax3_parser<> parser(&printer);
|
||||||
try {
|
try {
|
||||||
parser.parse<>(xmlData, dataLength);
|
parser.parse<>(xmlData, static_cast<int>(dataLength));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (rapidxml::parse_error& e)
|
catch (rapidxml::parse_error& e)
|
||||||
|
@ -184,7 +184,7 @@ void SAXParser::endElement(void *ctx, const CC_XML_CHAR *name)
|
||||||
{
|
{
|
||||||
((SAXParser*)(ctx))->_delegator->endElement(ctx, (char*)name);
|
((SAXParser*)(ctx))->_delegator->endElement(ctx, (char*)name);
|
||||||
}
|
}
|
||||||
void SAXParser::textHandler(void *ctx, const CC_XML_CHAR *name, int len)
|
void SAXParser::textHandler(void *ctx, const CC_XML_CHAR *name, size_t len)
|
||||||
{
|
{
|
||||||
((SAXParser*)(ctx))->_delegator->textHandler(ctx, (char*)name, len);
|
((SAXParser*)(ctx))->_delegator->textHandler(ctx, (char*)name, len);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
* @js NA
|
* @js NA
|
||||||
* @lua NA
|
* @lua NA
|
||||||
*/
|
*/
|
||||||
virtual void textHandler(void *ctx, const char *s, int len) = 0;
|
virtual void textHandler(void *ctx, const char *s, size_t len) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CC_DLL SAXParser
|
class CC_DLL SAXParser
|
||||||
|
@ -114,7 +114,7 @@ public:
|
||||||
* @js NA
|
* @js NA
|
||||||
* @lua NA
|
* @lua NA
|
||||||
*/
|
*/
|
||||||
static void textHandler(void *ctx, const CC_XML_CHAR *name, int len);
|
static void textHandler(void *ctx, const CC_XML_CHAR *name, size_t len);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of platform group
|
// end of platform group
|
||||||
|
|
|
@ -4719,7 +4719,7 @@ void __JSPlistDelegator::endElement(void *ctx, const char *name) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __JSPlistDelegator::textHandler(void *ctx, const char *ch, int len) {
|
void __JSPlistDelegator::textHandler(void *ctx, const char *ch, size_t len) {
|
||||||
CC_UNUSED_PARAM(ctx);
|
CC_UNUSED_PARAM(ctx);
|
||||||
std::string text((char*)ch, 0, len);
|
std::string text((char*)ch, 0, len);
|
||||||
|
|
||||||
|
|
|
@ -280,9 +280,9 @@ public:
|
||||||
std::string parseText(const std::string& text);
|
std::string parseText(const std::string& text);
|
||||||
|
|
||||||
// implement pure virtual methods of SAXDelegator
|
// implement pure virtual methods of SAXDelegator
|
||||||
void startElement(void *ctx, const char *name, const char **atts);
|
void startElement(void *ctx, const char *name, const char **atts) override;
|
||||||
void endElement(void *ctx, const char *name);
|
void endElement(void *ctx, const char *name) override;
|
||||||
void textHandler(void *ctx, const char *ch, int len);
|
void textHandler(void *ctx, const char *ch, size_t len) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cocos2d::SAXParser _parser;
|
cocos2d::SAXParser _parser;
|
||||||
|
|
|
@ -334,7 +334,7 @@ public:
|
||||||
|
|
||||||
void endElement(void *ctx, const char *name) override;
|
void endElement(void *ctx, const char *name) override;
|
||||||
|
|
||||||
void textHandler(void *ctx, const char *s, int len) override;
|
void textHandler(void *ctx, const char *s, size_t len) override;
|
||||||
|
|
||||||
|
|
||||||
void pushBackFontElement(const Attributes& attribs);
|
void pushBackFontElement(const Attributes& attribs);
|
||||||
|
@ -754,7 +754,7 @@ void MyXMLVisitor::endElement(void *ctx, const char *elementName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyXMLVisitor::textHandler(void *ctx, const char *str, int len)
|
void MyXMLVisitor::textHandler(void *ctx, const char *str, size_t len)
|
||||||
{
|
{
|
||||||
std::string text(str, len);
|
std::string text(str, len);
|
||||||
auto color = getColor();
|
auto color = getColor();
|
||||||
|
|
Loading…
Reference in New Issue