[DEV] add extra compilation flags & correct warning

This commit is contained in:
Edouard DUPIN 2013-11-27 21:33:34 +01:00
parent b507f48e47
commit 9f47018aa4
14 changed files with 57 additions and 65 deletions

View File

@ -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;

View File

@ -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<getColorSize(); iii++) {
for (int32_t iii=0; iii<getColorSize(); iii++) {
if (strnCmpNoCase(getColorList()[iii].colorName, inputData, strlen(getColorList()[iii].colorName)) == true) {
findIt = true;
*this = getColorList()[iii].color;
@ -523,8 +523,8 @@ static const colorList_ts* getColorList(void)
return listOfColor;
}
static esize_t getColorSize(void)
static int32_t getColorSize(void)
{
static const esize_t tmpp = sizeof(listOfColor) / sizeof(colorList_ts);
static const int32_t tmpp = sizeof(listOfColor) / sizeof(colorList_ts);
return tmpp;
}

View File

@ -141,7 +141,7 @@ namespace etk {
* @brief Get the number of element in the hash table
* @return number of elements
*/
esize_t size(void) const {
int32_t size(void) const {
return m_data.size();
}
MY_TYPE& operator[] (size_t _pos) {

View File

@ -66,7 +66,7 @@ const int64_t etk::constConvertionTableSize = sizeof(etk::constConvertionTable)
void etk::displayElem(const std::vector<char32_t>& _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<<ETK_BASH_COLOR_RED << (char*)"(" << ETK_BASH_COLOR_NORMAL; break;
@ -125,7 +125,7 @@ char * etk::levelSpace(uint32_t _level) {
int64_t etk::getLenOfPTheseElem(const std::vector<char32_t>& _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<char32_t>& _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<char32_t>& _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<char32_t>& _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<char32_t>& _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<char32_t>& _data, int64_t _startPos
int64_t etk::getLenOfNormal(const std::vector<char32_t>& _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<char32_t>& _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<char32_t>& _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;

View File

@ -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<std::string>& _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<std::u32string>& _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::u32string>&
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();
}
}

View File

@ -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; iii<m_content.size(); iii++) {
esize_t size = m_content.getValue(iii).getTheoricSize();
esize_t sizeR = m_content.getValue(iii).size();
for (int32_t iii=0; iii<m_content.size(); iii++) {
int32_t size = m_content.getValue(iii).getTheoricSize();
int32_t sizeR = m_content.getValue(iii).size();
TK_INFO(" element : " << m_content.getKey(iii) << " size=" << size << " allocated=" << sizeR);
}
}

View File

@ -24,14 +24,14 @@ namespace etk {
void decreaseRef(void) { m_link--; };
int32_t getNumberOfRef(void) const { return m_link; };
private:
esize_t m_theoricSize; //!< number of element open on this file
int32_t m_theoricSize; //!< number of element open on this file
public:
esize_t getTheoricSize(void) const { return m_theoricSize; };
int32_t getTheoricSize(void) const { return m_theoricSize; };
private:
std::vector<char> m_data;
public:
Content(esize_t _basicSize=0) : m_link(-1), m_theoricSize(_basicSize) { };
esize_t size(void) const { return m_data.size(); };
Content(int32_t _basicSize=0) : m_link(-1), m_theoricSize(_basicSize) { };
int32_t size(void) const { return m_data.size(); };
void* data(void) const { return (void*)&m_data[0]; };
std::vector<char>& getDataVector(void) { return m_data; };
};
@ -58,7 +58,7 @@ namespace etk {
* @brief Get the number of elements
* @return nb files in the archive
*/
esize_t size(void) const {
int32_t size(void) const {
return m_content.size();
};
/**
@ -66,7 +66,7 @@ namespace etk {
* @param[in] _id id of the element (must be < Size())
* @return FileName of the requested id
*/
const std::string& getName(esize_t _id) const {
const std::string& getName(int32_t _id) const {
return m_content.getKey(_id);
};
/**
@ -74,7 +74,7 @@ namespace etk {
* @param[in] _id id of the element (must be < Size())
* @return the archive content
*/
const Content& getContent(esize_t _id) const {
const Content& getContent(int32_t _id) const {
return m_content.getValue(_id);
};
/**

View File

@ -27,7 +27,7 @@ etk::archive::Zip::Zip(const std::string& _fileName) :
}
// Store all the file in the standard structure
for(int32_t iii=0; iii<m_info.number_entry; iii++) {
for(uint32_t iii=0; iii<m_info.number_entry; iii++) {
char tmpFileName[FILENAME_MAX];
unz_file_info tmpFileInfo;
/* Get info about current file. */
@ -66,7 +66,7 @@ void etk::archive::Zip::loadFile(int32_t _id)
unzGoToFirstFile(m_ctx);
// Store all the file in the standard structure
for(int32_t iii=0; iii<m_info.number_entry; iii++) {
for(uint32_t iii=0; iii<m_info.number_entry; iii++) {
char tmpFileName[FILENAME_MAX];
unz_file_info tmpFileInfo;
/* Get info about current file. */

View File

@ -473,10 +473,10 @@ etk::FSNode::~FSNode(void) {
void etk::FSNode::sortElementList(std::vector<etk::FSNode *>& _list) {
std::vector<etk::FSNode *> tmpList = _list;
_list.clear();
for(int32_t iii=0; iii<tmpList.size(); iii++) {
for(size_t iii=0; iii<tmpList.size(); iii++) {
if (NULL != tmpList[iii]) {
int32_t findPos = 0;
for(int32_t jjj=0; jjj<_list.size(); jjj++) {
size_t findPos = 0;
for(size_t jjj=0; jjj<_list.size(); jjj++) {
//EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\"");
if (_list[jjj]!=NULL) {
if (tmpList[iii]->getNameFile() > _list[jjj]->getNameFile()) {
@ -1618,7 +1618,7 @@ static std::vector<tmpThemeElement*> 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; iii<g_listTheme.size(); iii++) {
for(size_t iii=0; iii<g_listTheme.size(); iii++) {
if (NULL != g_listTheme[iii]) {
if (g_listTheme[iii]->refName==_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; iii<g_listTheme.size(); iii++) {
for(size_t iii=0; iii<g_listTheme.size(); iii++) {
if (NULL != g_listTheme[iii]) {
if (g_listTheme[iii]->refName==_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;
}

View File

@ -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;

View File

@ -29,10 +29,10 @@ void etk::tool::sortList(std::vector<std::u32string *> &_list)
{
std::vector<std::u32string *> tmpList = _list;
_list.clear();
for(int32_t iii=0; iii<tmpList.size(); iii++) {
for(size_t iii=0; iii<tmpList.size(); iii++) {
int32_t findPos = 0;
for(int32_t jjj=0; jjj<_list.size(); jjj++) {
size_t findPos = 0;
for(size_t jjj=0; jjj<_list.size(); jjj++) {
//EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\"");
if (*tmpList[iii] > *_list[jjj]) {
findPos = jjj+1;

View File

@ -57,13 +57,6 @@
#define etk_avg(minimim,elem,maximum) (((minimim)>(elem)) ? (minimim) : ((maximum)<(elem)) ? (maximum) : (elem))
#include <etk/UChar.h>
#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

View File

@ -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<char32_t>& _input_Unicode, std::vector<int8_t>& _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<char32_t>& _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<char32_t>& _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<char32_t>& _input_Unicod
int32_t unicode::convertUtf8ToUnicode(const std::vector<char>& _input_UTF8, std::vector<char32_t>& _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<char>& _input_UTF8, std:
int32_t unicode::convertUtf8ToUnicode(const std::vector<int8_t>& _input_UTF8, std::vector<char32_t>& _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

View File

@ -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 ...