[DEV] add extra compilation flags & correct warning

This commit is contained in:
Edouard DUPIN 2013-11-27 21:33:34 +01:00
parent c24b20b9d2
commit 0cfb9c2130
11 changed files with 54 additions and 51 deletions

View File

@ -35,8 +35,8 @@ bool exml::Attribute::iParse(const std::string& _data, int32_t& _pos, bool _case
EXML_VERBOSE("start parse : 'attribute'");
m_pos = _filePos;
// search end of the comment :
int32_t lastElementName = _pos;
for (int32_t iii=_pos; iii<_data.size(); iii++) {
size_t lastElementName = _pos;
for (size_t iii=_pos; iii<_data.size(); iii++) {
_filePos.check(_data[iii]);
#ifdef ENABLE_DISPLAY_PARSED_ELEMENT
drawElementParsed(_data[iii], _filePos);
@ -73,8 +73,8 @@ bool exml::Attribute::iParse(const std::string& _data, int32_t& _pos, bool _case
if (_data[lastElementName+white+2] != '"') {
// parse with no element " == > direct value separate with space ...
++_filePos;
int32_t lastAttributePos = lastElementName+white+2;
for (int32_t iii=lastElementName+white+2; iii<_data.size(); iii++) {
size_t lastAttributePos = lastElementName+white+2;
for (size_t iii=lastElementName+white+2; iii<_data.size(); iii++) {
#ifdef ENABLE_DISPLAY_PARSED_ELEMENT
drawElementParsed(_data[iii], _filePos);
#endif
@ -98,8 +98,8 @@ bool exml::Attribute::iParse(const std::string& _data, int32_t& _pos, bool _case
_pos = lastAttributePos-1;
return true;
}
int32_t lastAttributePos = lastElementName+white+3;
for (int32_t iii=lastElementName+white+3; iii<_data.size(); iii++) {
size_t lastAttributePos = lastElementName+white+3;
for (size_t iii=lastElementName+white+3; iii<_data.size(); iii++) {
#ifdef ENABLE_DISPLAY_PARSED_ELEMENT
drawElementParsed(_data[iii], _filePos);
#endif

View File

@ -13,7 +13,7 @@
#define __class__ "AttributeList"
exml::AttributeList::~AttributeList(void) {
for (int32_t iii=0; iii<m_listAttribute.size(); iii++) {
for (size_t iii=0; iii<m_listAttribute.size(); iii++) {
if (NULL!=m_listAttribute[iii]) {
delete(m_listAttribute[iii]);
m_listAttribute[iii]=NULL;
@ -23,14 +23,14 @@ exml::AttributeList::~AttributeList(void) {
}
exml::Attribute* exml::AttributeList::getAttr(int32_t _id) {
if (_id <0 || _id>m_listAttribute.size()) {
if (_id <0 || (size_t)_id>m_listAttribute.size()) {
return NULL;
}
return m_listAttribute[_id];
}
const exml::Attribute* exml::AttributeList::getAttr(int32_t _id) const {
if (_id <0 || _id>m_listAttribute.size()) {
if (_id <0 || (size_t)_id>m_listAttribute.size()) {
return NULL;
}
return m_listAttribute[_id];
@ -41,7 +41,7 @@ void exml::AttributeList::appendAttribute(exml::Attribute* _attr) {
EXML_ERROR("Try to set an empty node");
return;
}
for (int32_t iii=0; iii<m_listAttribute.size(); iii++) {
for (size_t iii=0; iii<m_listAttribute.size(); iii++) {
if (m_listAttribute[iii] == _attr) {
EXML_ERROR("Try to add a node that is already added befor !!!");
return;
@ -55,7 +55,7 @@ const std::string& exml::AttributeList::getAttribute(const std::string& _name) c
if (_name.size() == 0) {
return errorReturn;
}
for (int32_t iii=0; iii<m_listAttribute.size(); iii++) {
for (size_t iii=0; iii<m_listAttribute.size(); iii++) {
if( NULL != m_listAttribute[iii]
&& m_listAttribute[iii]->getName() == _name) {
return m_listAttribute[iii]->getValue();
@ -69,7 +69,7 @@ std::u32string exml::AttributeList::getAttribute(const std::u32string& _name) co
if (_name.size() == 0) {
return errorReturn;
}
for (int32_t iii=0; iii<m_listAttribute.size(); iii++) {
for (size_t iii=0; iii<m_listAttribute.size(); iii++) {
if( NULL != m_listAttribute[iii]
&& m_listAttribute[iii]->getUName() == _name) {
return m_listAttribute[iii]->getUValue();
@ -82,7 +82,7 @@ bool exml::AttributeList::existAttribute(const std::string& _name) const {
if (_name.size() == 0) {
return false;
}
for (int32_t iii=0; iii<m_listAttribute.size(); iii++) {
for (size_t iii=0; iii<m_listAttribute.size(); iii++) {
if( NULL != m_listAttribute[iii]
&& m_listAttribute[iii]->getName() == _name) {
return true;
@ -95,7 +95,7 @@ bool exml::AttributeList::existAttribute(const std::u32string& _name) const {
if (_name.size() == 0) {
return false;
}
for (int32_t iii=0; iii<m_listAttribute.size(); iii++) {
for (size_t iii=0; iii<m_listAttribute.size(); iii++) {
if( NULL != m_listAttribute[iii]
&& m_listAttribute[iii]->getUName() == _name) {
return true;
@ -106,7 +106,7 @@ bool exml::AttributeList::existAttribute(const std::u32string& _name) const {
void exml::AttributeList::setAttribute(const std::string& _name, const std::string& _value) {
// check if attribute already det :
for (int32_t iii=0; iii<m_listAttribute.size(); iii++) {
for (size_t iii=0; iii<m_listAttribute.size(); iii++) {
if( NULL != m_listAttribute[iii]
&& m_listAttribute[iii]->getName() == _name) {
// update the value :
@ -123,7 +123,7 @@ void exml::AttributeList::setAttribute(const std::string& _name, const std::stri
void exml::AttributeList::setAttribute(const std::u32string& _name, const std::u32string& _value) {
// check if attribute already det :
for (int32_t iii=0; iii<m_listAttribute.size(); iii++) {
for (size_t iii=0; iii<m_listAttribute.size(); iii++) {
if( NULL != m_listAttribute[iii]
&& m_listAttribute[iii]->getUName() == _name) {
// update the value :
@ -139,7 +139,7 @@ void exml::AttributeList::setAttribute(const std::u32string& _name, const std::u
}
bool exml::AttributeList::iGenerate(std::string& _data, int32_t _indent) const {
for (int32_t iii=0; iii<m_listAttribute.size(); iii++) {
for (size_t iii=0; iii<m_listAttribute.size(); iii++) {
if (NULL!=m_listAttribute[iii]) {
m_listAttribute[iii]->iGenerate(_data, _indent);
}
@ -149,7 +149,7 @@ bool exml::AttributeList::iGenerate(std::string& _data, int32_t _indent) const {
void exml::AttributeList::clear(void) {
exml::Node::clear();
for (int32_t iii=0; iii<m_listAttribute.size(); iii++) {
for (size_t iii=0; iii<m_listAttribute.size(); iii++) {
if (NULL!=m_listAttribute[iii]) {
delete(m_listAttribute[iii]);
m_listAttribute[iii]=NULL;

View File

@ -43,7 +43,7 @@ namespace exml {
* @brief get the number of attribute in the Node
* @return Nulber of attribute >=0
*/
int32_t sizeAttribute(void) const {
size_t sizeAttribute(void) const {
return m_listAttribute.size();
};
/**

View File

@ -20,7 +20,7 @@ bool exml::Comment::iParse(const std::string& _data, int32_t& _pos, bool _caseSe
int32_t white = countWhiteChar(_data, _pos, tmpPos);
_filePos += tmpPos;
// search end of the comment :
for (int32_t iii=_pos+white; iii+2<_data.size(); iii++) {
for (size_t iii=_pos+white; iii+2<_data.size(); iii++) {
#ifdef ENABLE_DISPLAY_PARSED_ELEMENT
drawElementParsed(_data[iii], _filePos);
#endif

View File

@ -69,7 +69,7 @@ bool exml::Declaration::iParse(const std::string& _data, int32_t& _pos, bool _ca
EXML_VERBOSE("start parse : 'declaration' : '" << m_value << "'");
m_pos = _filePos;
// search end of the comment :
for (int32_t iii=_pos; iii+1<_data.size(); iii++) {
for (size_t iii=_pos; iii+1<_data.size(); iii++) {
#ifdef ENABLE_DISPLAY_PARSED_ELEMENT
drawElementParsed(_data[iii], _filePos);
#endif

View File

@ -25,7 +25,7 @@ exml::Document::Document(void) :
bool exml::Document::iGenerate(std::string& _data, int32_t _indent) const {
for (int32_t iii=0; iii<m_listSub.size(); iii++) {
for (size_t iii=0; iii<m_listSub.size(); iii++) {
if (NULL!=m_listSub[iii]) {
m_listSub[iii]->iGenerate(_data, _indent);
}
@ -116,7 +116,7 @@ bool exml::Document::store(const std::string& _file) {
EXML_ERROR("Can not open (w) the file : " << _file);
return false;
}
if (tmpFile.fileWrite((char*)createData.c_str(), sizeof(char), createData.size()) != createData.size()) {
if (tmpFile.fileWrite((char*)createData.c_str(), sizeof(char), createData.size()) != (int64_t)createData.size()) {
EXML_ERROR("Error while writing output XML file : " << _file);
tmpFile.fileClose();
return false;
@ -133,15 +133,15 @@ void exml::Document::display(void) {
std::string createPosPointer(const std::string& _line, int32_t _pos) {
std::string out;
int32_t iii;
for (iii=0; iii<_pos && iii<_line.size(); iii++) {
size_t iii;
for (iii=0; (int64_t)iii<_pos && iii<_line.size(); iii++) {
if (_line[iii] == '\t') {
out += "\t";
} else {
out += " ";
}
}
for (; iii<_pos; iii++) {
for (; (int64_t)iii<_pos; iii++) {
out += " ";
}
out += "^";

View File

@ -19,7 +19,7 @@
exml::Element::~Element(void) {
for (int32_t iii=0; iii<m_listSub.size(); iii++) {
for (size_t iii=0; iii<m_listSub.size(); iii++) {
if (NULL!=m_listSub[iii]) {
delete(m_listSub[iii]);
m_listSub[iii]=NULL;
@ -44,14 +44,14 @@ const enum exml::nodeType exml::Element::getType(int32_t _id) const {
}
exml::Node* exml::Element::getNode(int32_t _id) {
if (_id <0 || _id>m_listSub.size()) {
if (_id <0 || (size_t)_id>m_listSub.size()) {
return NULL;
}
return m_listSub[_id];
}
const exml::Node* exml::Element::getNode(int32_t _id) const {
if (_id <0 || _id>m_listSub.size()) {
if (_id <0 || (size_t)_id>m_listSub.size()) {
return NULL;
}
return m_listSub[_id];
@ -78,7 +78,7 @@ exml::Element* exml::Element::getNamed(const std::string& _name) {
if (_name.size() == 0) {
return NULL;
}
for (int32_t iii=0; iii<m_listSub.size(); iii++) {
for (size_t iii=0; iii<m_listSub.size(); iii++) {
if( NULL != m_listSub[iii]
&& m_listSub[iii]->getType() == exml::typeElement
&& m_listSub[iii]->getValue() == _name) {
@ -98,7 +98,7 @@ const exml::Element* exml::Element::getNamed(const std::string& _name) const {
if (_name.size() == 0) {
return NULL;
}
for (int32_t iii=0; iii<m_listSub.size(); iii++) {
for (size_t iii=0; iii<m_listSub.size(); iii++) {
if( NULL != m_listSub[iii]
&& m_listSub[iii]->getType() == exml::typeElement
&& m_listSub[iii]->getValue() == _name) {
@ -123,7 +123,7 @@ void exml::Element::append(exml::Node* _node) {
appendAttribute(_node->toAttribute());
return;
}
for (int32_t iii=0; iii<m_listSub.size(); iii++) {
for (size_t iii=0; iii<m_listSub.size(); iii++) {
if (m_listSub[iii] == _node) {
EXML_ERROR("Try to add a node that is already added before !!!");
return;
@ -135,7 +135,7 @@ void exml::Element::append(exml::Node* _node) {
std::string exml::Element::getText(void) {
// TODO : add more capabilities ...
std::string res;
for (int32_t iii=0; iii<m_listSub.size(); iii++) {
for (size_t iii=0; iii<m_listSub.size(); iii++) {
if (NULL!=m_listSub[iii]) {
m_listSub[iii]->iGenerate(res, 0);
}
@ -159,7 +159,7 @@ bool exml::Element::iGenerate(std::string& _data, int32_t _indent) const {
} else {
_data += ">\n";
for (int32_t iii=0; iii<m_listSub.size(); iii++) {
for (size_t iii=0; iii<m_listSub.size(); iii++) {
if (NULL!=m_listSub[iii]) {
m_listSub[iii]->iGenerate(_data, _indent+1);
}
@ -178,7 +178,7 @@ bool exml::Element::iGenerate(std::string& _data, int32_t _indent) const {
bool exml::Element::subParse(const std::string& _data, int32_t& _pos, bool _caseSensitive, exml::filePos& _filePos, exml::Document& _doc, bool _mainNode) {
EXML_PARSE_ELEMENT(" start subParse ... " << _pos << " " << _filePos);
for (int32_t iii=_pos; iii<_data.size(); iii++) {
for (size_t iii=_pos; iii<_data.size(); iii++) {
_filePos.check(_data[iii]);
#ifdef ENABLE_DISPLAY_PARSED_ELEMENT
drawElementParsed(_data[iii], _filePos);
@ -208,9 +208,9 @@ bool exml::Element::subParse(const std::string& _data, int32_t& _pos, bool _case
return false;
}
//EXML_DEBUG("Generate node name : '" << _data[iii+1] << "'");
int32_t endPosName = iii+white+1;
size_t endPosName = iii+white+1;
// generate element name ...
for (int32_t jjj=iii+white+2; jjj<_data.size(); jjj++) {
for (size_t jjj=iii+white+2; jjj<_data.size(); jjj++) {
if(true == checkAvaillable(_data[jjj], false) ) {
// we find the end ...
endPosName = jjj;
@ -311,9 +311,9 @@ bool exml::Element::subParse(const std::string& _data, int32_t& _pos, bool _case
if(_data[iii+white+1] == '/') {
++tmpPos;
//EXML_DEBUG("Generate node name : '" << _data[iii+1] << "'");
int32_t endPosName = iii+white+1;
size_t endPosName = iii+white+1;
// generate element name ...
for (int32_t jjj=iii+white+2; jjj<_data.size(); jjj++) {
for (size_t jjj=iii+white+2; jjj<_data.size(); jjj++) {
if(true == checkAvaillable(_data[jjj], false) ) {
// we find the end ...
endPosName = jjj;
@ -329,7 +329,7 @@ bool exml::Element::subParse(const std::string& _data, int32_t& _pos, bool _case
if( tmpname == m_value) {
// find end of node :
// find > element ...
for (int32_t jjj=endPosName+1; jjj<_data.size(); jjj++) {
for (size_t jjj=endPosName+1; jjj<_data.size(); jjj++) {
#ifdef ENABLE_DISPLAY_PARSED_ELEMENT
drawElementParsed(_data[jjj], _filePos);
#endif
@ -362,9 +362,9 @@ bool exml::Element::subParse(const std::string& _data, int32_t& _pos, bool _case
if (checkAvaillable(_data[iii+white+1], true) == true) {
++tmpPos;
//EXML_DEBUG("Generate node name : '" << _data[iii+1] << "'");
int32_t endPosName = iii+white+1;
size_t endPosName = iii+white+1;
// generate element name ...
for (int32_t jjj=iii+white+2; jjj<_data.size(); jjj++) {
for (size_t jjj=iii+white+2; jjj<_data.size(); jjj++) {
if(checkAvaillable(_data[jjj], false) == true) {
// we find the end ...
endPosName = jjj;
@ -439,7 +439,7 @@ bool exml::Element::iParse(const std::string& _data, int32_t& _pos, bool _caseSe
// note : When start parsing the upper element must have set the value of the element and set the position after this one
m_pos=_filePos;
// find a normal node ...
for (int32_t iii=_pos; iii<_data.size(); iii++) {
for (size_t iii=_pos; iii<_data.size(); iii++) {
_filePos.check(_data[iii]);
#ifdef ENABLE_DISPLAY_PARSED_ELEMENT
drawElementParsed(_data[iii], _filePos);
@ -491,7 +491,7 @@ bool exml::Element::iParse(const std::string& _data, int32_t& _pos, bool _caseSe
void exml::Element::clear(void) {
exml::AttributeList::clear();
for (int32_t iii=0; iii<m_listSub.size(); iii++) {
for (size_t iii=0; iii<m_listSub.size(); iii++) {
if (NULL!=m_listSub[iii]) {
delete(m_listSub[iii]);
m_listSub[iii]=NULL;

View File

@ -43,7 +43,7 @@ namespace exml {
* @brief get the number of sub element in the node (can be exml::Comment ; exml::Element ; exml::Text :exml::Declaration).
* @return a number >=0.
*/
int32_t size(void) const {
size_t size(void) const {
return m_listSub.size();
};
/**

View File

@ -99,7 +99,7 @@ bool exml::Node::checkAvaillable(char32_t _val, bool _firstChar) const {
int32_t exml::Node::countWhiteChar(const std::string& _data, int32_t _pos, exml::filePos& _filePos) const {
_filePos.clear();
int32_t white=0;
for (int32_t iii=_pos; iii<_data.size(); iii++) {
for (size_t iii=_pos; iii<_data.size(); iii++) {
_filePos.check(_data[iii]);
if(true == etk::isWhiteChar(_data[iii])) {
white++;

View File

@ -20,7 +20,7 @@ bool exml::Text::iGenerate(std::string& _data, int32_t _indent) const {
int32_t exml::Text::countLines(void) const {
int32_t count = 1;
for (int32_t iii=0; iii<m_value.size(); iii++) {
for (size_t iii=0; iii<m_value.size(); iii++) {
if(m_value[iii] == '\n') {
count++;
}
@ -32,7 +32,7 @@ bool exml::Text::iParse(const std::string& _data, int32_t& _pos, bool _caseSensi
EXML_VERBOSE("start parse : 'text'");
m_pos = _filePos;
// search end of the comment :
for (int32_t iii=_pos; iii<_data.size(); iii++) {
for (size_t iii=_pos; iii<_data.size(); iii++) {
#ifdef ENABLE_DISPLAY_PARSED_ELEMENT
drawElementParsed(_data[iii], _filePos);
#endif
@ -42,8 +42,8 @@ bool exml::Text::iParse(const std::string& _data, int32_t& _pos, bool _caseSensi
if( _data[iii] == '>'
|| _data[iii] == '<') {
// search whitespace :
int32_t newEnd=iii;
for( int32_t jjj=iii-1; jjj>_pos; jjj--) {
size_t newEnd=iii;
for (int64_t jjj=(int64_t)iii-1; jjj>(int64_t)_pos; --jjj) {
if(true == etk::isWhiteChar(_data[jjj])) {
newEnd = jjj;
} else {
@ -66,7 +66,7 @@ bool exml::TextCDATA::iParse(const std::string& _data, int32_t& _pos, bool _case
EXML_VERBOSE("start parse : 'text::CDATA'");
m_pos = _filePos;
// search end of the comment :
for (int32_t iii=_pos; iii+2<_data.size(); iii++) {
for (size_t iii=_pos; iii+2<_data.size(); iii++) {
#ifdef ENABLE_DISPLAY_PARSED_ELEMENT
drawElementParsed(_data[iii], _filePos);
#endif

View File

@ -7,6 +7,9 @@ def Create(target):
myModule.AddModuleDepend(['etk'])
# add extra compilation flags :
myModule.add_extra_compile_flags()
# add sources files
myModule.AddSrcFile([
'exml/debug.cpp',
'exml/Attribute.cpp',