From 9f47018aa4fcac3c2bfd92012576be76e2c56b20 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Wed, 27 Nov 2013 21:33:34 +0100 Subject: [PATCH] [DEV] add extra compilation flags & correct warning --- etk/Buffer.h | 4 ++-- etk/Color.cpp | 8 ++++---- etk/Hash.h | 2 +- etk/RegExp.cpp | 20 ++++++++++---------- etk/UString.cpp | 14 +++++++------- etk/archive/Archive.cpp | 6 +++--- etk/archive/Archive.h | 14 +++++++------- etk/archive/Zip.cpp | 4 ++-- etk/os/FSNode.cpp | 14 +++++++------- etk/os/FSNode.h | 2 +- etk/tool.cpp | 6 +++--- etk/types.h | 7 ------- etk/unicode.cpp | 14 ++++++++------ lutin_etk.py | 7 ++----- 14 files changed, 57 insertions(+), 65 deletions(-) diff --git a/etk/Buffer.h b/etk/Buffer.h index 1c82ae6..bbdb59c 100644 --- a/etk/Buffer.h +++ b/etk/Buffer.h @@ -194,7 +194,7 @@ namespace etk { * @param[in] _pos Desired position read * @return Reference on the Element */ - esize_t get(esize_t _pos, UChar& _value, charset_te _charset) const + int32_t get(int32_t _pos, UChar& _value, charset_te _charset) const { TK_ASSERT(0 <= pos || pos < size(), "try to read an element non existing"); if (pos < m_gapStart) { @@ -300,7 +300,7 @@ namespace etk { return; } } - for(esize_t iii=0; iii<_nbElement; iii++) { + for(int32_t iii=0; iii<_nbElement; iii++) { m_data[m_gapStart+iii] = _items[iii]; } m_gapStart += _nbElement; diff --git a/etk/Color.cpp b/etk/Color.cpp index 88619af..34257d4 100644 --- a/etk/Color.cpp +++ b/etk/Color.cpp @@ -42,7 +42,7 @@ typedef struct { etk::Color<> color; } colorList_ts; -static esize_t getColorSize(void); +static int32_t getColorSize(void); static const colorList_ts* getColorList(void); namespace etk { @@ -173,7 +173,7 @@ namespace etk { } else { bool findIt = false; // direct named color ... - for (esize_t iii=0; iii& _data, int64_t _start, int64_t _stop) { etk::cout<< ETK_BASH_COLOR_NORMAL; - for (int64_t iii=_start; iii<_data.size() && iii<_stop ; iii++) { + for (int64_t iii=_start; iii<(int64_t)_data.size() && iii<_stop ; iii++) { switch(_data[iii]) { case REGEXP_OPCODE_PTHESE_IN: etk::cout<& _data, int64_t _startPos) { - if (_startPos>=_data.size()){ + if (_startPos>=(int64_t)_data.size()){ return 0; } int64_t pos = _startPos; @@ -136,7 +136,7 @@ int64_t etk::getLenOfPTheseElem(const std::vector& _data, int64_t _sta return 0; } // find size ... - while (pos < _data.size() ) { + while (pos < (int64_t)_data.size() ) { if(_data[pos] == REGEXP_OPCODE_PTHESE_IN) { // find a sub section : nbOpen++; @@ -177,7 +177,7 @@ int64_t etk::getLenOfPThese(const std::vector& _data, int64_t _startPo } pos++; // find size ... - while (pos < _data.size() ) { + while (pos < (int64_t)_data.size() ) { if(_data[pos]==REGEXP_OPCODE_PTHESE_IN) { // find a sub section : nbOpen++; @@ -217,7 +217,7 @@ int64_t etk::getLenOfBracket(const std::vector& _data, int64_t _startP } pos++; // find size ... - while (pos < _data.size() ) { + while (pos < (int64_t)_data.size() ) { if(_data[pos]==REGEXP_OPCODE_BRACKET_OUT) { // Find the end of the [...] // just return the size inside @@ -250,7 +250,7 @@ int64_t etk::getLenOfBrace(const std::vector& _data, int64_t _startPos } pos++; // find size ... - while (pos < _data.size() ) { + while (pos < (int64_t)_data.size() ) { if(_data[pos]==REGEXP_OPCODE_BRACE_OUT) { // Find the end of the [...] // just return the size inside @@ -275,7 +275,7 @@ int64_t etk::getLenOfBrace(const std::vector& _data, int64_t _startPos int64_t etk::getLenOfNormal(const std::vector& _data, int64_t _startPos) { int64_t pos = _startPos; // find size ... - while (pos < _data.size() ) { + while (pos < (int64_t)_data.size() ) { switch(_data[pos]) { case REGEXP_OPCODE_PTHESE_IN: case REGEXP_OPCODE_PTHESE_OUT: @@ -329,7 +329,7 @@ bool etk::parseBrace(const std::vector& _data, uint32_t& _min, uint32_ int32_t firstElement = 0; int32_t SecondElement = 0; - while(k < _data.size()) { + while(k < (int64_t)_data.size()) { if (_data[k] == ',') { k++; break; @@ -345,10 +345,10 @@ bool etk::parseBrace(const std::vector& _data, uint32_t& _min, uint32_ } k++; } - if (k == _data.size()) { + if (k == (int64_t)_data.size()) { SecondElement = firstElement; } - while(k < _data.size()) { + while(k < (int64_t)_data.size()) { if (_data[k] == ',') { TK_ERROR("Can not find a second , in {} at pos " << k); return false; diff --git a/etk/UString.cpp b/etk/UString.cpp index 6f4686f..ad722e0 100644 --- a/etk/UString.cpp +++ b/etk/UString.cpp @@ -20,7 +20,7 @@ etk::CCout& etk::operator <<(etk::CCout& _os, const std::string& _obj) { etk::CCout& etk::operator <<(etk::CCout& _os, const std::vector& _obj) { _os << "{"; - for (int32_t iii=0; iii< _obj.size(); iii++) { + for (size_t iii=0; iii< _obj.size(); iii++) { if (iii>0) { _os << " ~ "; } @@ -37,7 +37,7 @@ etk::CCout& etk::operator <<(etk::CCout& _os, const std::u32string& _obj) { etk::CCout& etk::operator <<(etk::CCout& _os, const std::vector& _obj) { _os << "{"; - for (int32_t iii=0; iii< _obj.size(); iii++) { + for (size_t iii=0; iii< _obj.size(); iii++) { if (iii>0) { _os << " ~ "; } @@ -49,7 +49,7 @@ etk::CCout& etk::operator <<(etk::CCout& _os, const std::vector& std::string to_u8string(const std::u32string& _input) { std::string out; - for (int32_t iii=0; iii<_input.size(); ++iii) { + for (size_t iii=0; iii<_input.size(); ++iii) { char output[10]; etk::getUtf8(_input[iii], output); out += output; @@ -460,7 +460,7 @@ std::string replace(const std::string& _obj, char _val, char _replace) { std::string extract_line(const std::string& _obj, int32_t _pos) { // search back : '\n' size_t startPos = _obj.rfind('\n', _pos); - if (startPos == _pos) { + if ((int64_t)startPos == (int64_t)_pos) { startPos = 0; } else { startPos++; @@ -469,7 +469,7 @@ std::string extract_line(const std::string& _obj, int32_t _pos) { size_t stopPos = _pos; if (_obj[_pos] != '\n') { stopPos = _obj.find('\n', _pos); - if (stopPos == _pos) { + if ((int64_t)stopPos == _pos) { stopPos = _obj.size(); } } @@ -489,7 +489,7 @@ std::string extract_line(const std::string& _obj, int32_t _pos) { std::u32string extract_line(const std::u32string& _obj, int32_t _pos) { // search back : '\n' size_t startPos = _obj.rfind('\n', _pos); - if (startPos == _pos) { + if ((int64_t)startPos == _pos) { startPos = 0; } else { startPos++; @@ -498,7 +498,7 @@ std::u32string extract_line(const std::u32string& _obj, int32_t _pos) { size_t stopPos = _pos; if (_obj[_pos] != '\n') { stopPos = _obj.find('\n', _pos); - if (stopPos == _pos) { + if ((int64_t)stopPos == _pos) { stopPos = _obj.size(); } } diff --git a/etk/archive/Archive.cpp b/etk/archive/Archive.cpp index 1db0ce8..3a5e4ed 100644 --- a/etk/archive/Archive.cpp +++ b/etk/archive/Archive.cpp @@ -21,9 +21,9 @@ const etk::Archive::Content& etk::Archive::getContent(const std::string& _key) c void etk::Archive::display(void) { - for (esize_t iii=0; iiigetNameFile() > _list[jjj]->getNameFile()) { @@ -1618,7 +1618,7 @@ static std::vector g_listTheme; // set the Folder of a subset of a theme ... void etk::theme::setName(const std::string& _refName, const std::string& _folderName) { - for(int32_t iii=0; iiirefName==_refName) { g_listTheme[iii]->folderName = _folderName; @@ -1643,7 +1643,7 @@ void etk::theme::setName(const std::u32string& _refName, const std::u32string& _ // get the folder from a Reference theme std::string etk::theme::getName(const std::string& _refName) { - for(int32_t iii=0; iiirefName==_refName) { return g_listTheme[iii]->folderName; @@ -1788,7 +1788,7 @@ bool etk::FSNodeEcho(const std::string& _path, const std::string& _dataTowrite) return false; } // convert in UTF8 : - if (_dataTowrite.size() != tmpNode.fileWrite((char*)_dataTowrite.c_str(), 1, _dataTowrite.size())) { + if ((int64_t)_dataTowrite.size() != tmpNode.fileWrite((char*)_dataTowrite.c_str(), 1, _dataTowrite.size())) { tmpNode.fileClose(); return false; } @@ -1810,7 +1810,7 @@ bool etk::FSNodeEchoAdd(const std::string& _path, const std::string& _dataTowrit return false; } // convert in UTF8 : - if (_dataTowrite.size() != tmpNode.fileWrite((char*)_dataTowrite.c_str(), 1, _dataTowrite.size())) { + if ((int64_t)_dataTowrite.size() != tmpNode.fileWrite((char*)_dataTowrite.c_str(), 1, _dataTowrite.size())) { tmpNode.fileClose(); return false; } diff --git a/etk/os/FSNode.h b/etk/os/FSNode.h index 50bca03..5d7f198 100644 --- a/etk/os/FSNode.h +++ b/etk/os/FSNode.h @@ -232,7 +232,7 @@ namespace etk { std::string getName(void) const; std::u32string getUName(void) const; /** - * @brief Get the file or current folder name (if it was a folder) + * @brief Get the file or current file name (if it was a file) * @return the name of the node (like myFile.kkk) */ std::string getNameFile(void) const; diff --git a/etk/tool.cpp b/etk/tool.cpp index aee896c..5989c25 100644 --- a/etk/tool.cpp +++ b/etk/tool.cpp @@ -29,10 +29,10 @@ void etk::tool::sortList(std::vector &_list) { std::vector tmpList = _list; _list.clear(); - for(int32_t iii=0; iii *_list[jjj]) { findPos = jjj+1; diff --git a/etk/types.h b/etk/types.h index 4d3bb40..5bf49cf 100644 --- a/etk/types.h +++ b/etk/types.h @@ -57,13 +57,6 @@ #define etk_avg(minimim,elem,maximum) (((minimim)>(elem)) ? (minimim) : ((maximum)<(elem)) ? (maximum) : (elem)) #include -#if 0 - typedef size_t esize_t; - #define ESIZE_T_IS_UNSIGNED -#else - typedef int32_t esize_t; - #define ESIZE_T_IS_SIGNED -#endif typedef float float_t; #endif diff --git a/etk/unicode.cpp b/etk/unicode.cpp index fb8db8c..7643758 100644 --- a/etk/unicode.cpp +++ b/etk/unicode.cpp @@ -79,7 +79,7 @@ int32_t unicode::convertIsoToUnicode(enum charset _inputCharset, const std::vect { _output_Unicode.clear(); char32_t output; - for(int32_t iii=0; iii<_input_ISO.size(); iii++) { + for(size_t iii=0; iii<_input_ISO.size(); iii++) { convertIsoToUnicode(_inputCharset, (char)_input_ISO[iii], output); _output_Unicode.push_back(output); } @@ -95,7 +95,7 @@ int32_t unicode::convertIsoToUnicode(enum charset _inputCharset, const std::vect { _output_Unicode.clear(); char32_t output; - for(int32_t iii=0; iii<_input_ISO.size(); iii++) { + for(size_t iii=0; iii<_input_ISO.size(); iii++) { convertIsoToUnicode(_inputCharset, (char)_input_ISO[iii], output); _output_Unicode.push_back(output); } @@ -124,6 +124,7 @@ int32_t unicode::convertUnicodeToIso(enum charset _inputCharset, const std::vect _output_ISO.push_back(0); return _output_ISO.size(); */ + return 0; } int32_t unicode::convertUnicodeToIso(enum charset _inputCharset, const std::vector& _input_Unicode, std::vector& _output_ISO) @@ -142,6 +143,7 @@ int32_t unicode::convertUnicodeToIso(enum charset _inputCharset, const std::vect _output_ISO.push_back(0); return _output_ISO.size(); */ + return 0; } @@ -150,7 +152,7 @@ int32_t unicode::convertUnicodeToUtf8(const std::vector& _input_Unicod { char output[10]; - for (int32_t iii=0; iii<_input_Unicode.size(); iii++) { + for (size_t iii=0; iii<_input_Unicode.size(); iii++) { etk::getUtf8(_input_Unicode[iii], output); char * tmp = output ; while (*tmp != '\0') { @@ -166,7 +168,7 @@ int32_t unicode::convertUnicodeToUtf8(const std::vector& _input_Unicod { char output[10]; - for (int32_t iii=0; iii<_input_Unicode.size(); iii++) { + for (size_t iii=0; iii<_input_Unicode.size(); iii++) { etk::getUtf8(_input_Unicode[iii], output); char * tmp = output ; while (*tmp != '\0') { @@ -182,7 +184,7 @@ int32_t unicode::convertUnicodeToUtf8(const std::vector& _input_Unicod int32_t unicode::convertUtf8ToUnicode(const std::vector& _input_UTF8, std::vector& _output_Unicode) { char tmpData[20]; - int32_t pos = 0; + size_t pos = 0; while (pos < _input_UTF8.size()) { int32_t lenMax = _input_UTF8.size() - pos; //4 case @@ -231,7 +233,7 @@ int32_t unicode::convertUtf8ToUnicode(const std::vector& _input_UTF8, std: int32_t unicode::convertUtf8ToUnicode(const std::vector& _input_UTF8, std::vector& _output_Unicode) { char tmpData[20]; - int32_t pos = 0; + size_t pos = 0; while (pos < _input_UTF8.size()) { int32_t lenMax = _input_UTF8.size() - pos; //4 case diff --git a/lutin_etk.py b/lutin_etk.py index cd66044..552c0fa 100644 --- a/lutin_etk.py +++ b/lutin_etk.py @@ -5,8 +5,9 @@ import lutinTools def Create(target): # module name is 'edn' and type binary. myModule = lutinModule.module(__file__, 'etk', 'LIBRARY') + # add extra compilation flags : + myModule.add_extra_compile_flags() # add the file to compile: - myModule.AddSrcFile([ 'etk/debugGeneric.cpp', 'etk/debug.cpp', @@ -40,10 +41,6 @@ def Create(target): myModule.AddModuleDepend('linearmath') myModule.AddModuleDepend('minizip') - myModule.CompileFlags_CC([ - '-Wno-write-strings', - '-Wall']) - if target.buildMode == "release": # TODO : The other way is to remove this ... # TODO : Fore release mode : the etk folder are absolutly not at the same position in the tree ...