diff --git a/etest/etest.cpp b/etest/etest.cpp index 1759979..8bba03c 100644 --- a/etest/etest.cpp +++ b/etest/etest.cpp @@ -206,7 +206,7 @@ void etest::GenericTest::clearLocal() { m_numberCheck = 0; m_numberCheckFail = 0; } -etest::GenericTest* etest::g_currentTest = nullptr; +etest::GenericTest* etest::g_currentTest = null; int32_t etest::runAllTest() { int32_t errorCount = 0; @@ -242,7 +242,7 @@ int32_t etest::runAllTest() { echrono::Steady ticTest = echrono::Steady::now(); it->run(); echrono::Steady tocTest = echrono::Steady::now(); - g_currentTest = nullptr; + g_currentTest = null; if (it->getError() == true) { ETEST_PRINT("[ FAIL ] " << itGroup << "." << it->getTestName() << " (" << (tocTest - ticTest) << ") " << it->getNumberCheckError() << " fails"); errorCount++; @@ -257,7 +257,7 @@ int32_t etest::runAllTest() { ETEST_DEBUG("[ MEM ] CHECK memory properties"); bool ret = etk::memory::checkSnapshoot(memorySnapShoot); etk::memory::clearSnapshoot(memorySnapShoot); - memorySnapShoot = nullptr; + memorySnapShoot = null; ETEST_DEBUG("[ MEM ] CHECK memory properties (done)"); nbCheck++; if (ret == false) { @@ -284,7 +284,7 @@ int32_t etest::runAllTest() { } uint32_t etest::registerTest(etest::GenericTest* _element) { - if (_element == nullptr) { + if (_element == null) { return -1; } getListOfTest().pushBack(_element); diff --git a/etest/etest.hpp b/etest/etest.hpp index f85f47f..54f30ea 100644 --- a/etest/etest.hpp +++ b/etest/etest.hpp @@ -78,7 +78,7 @@ namespace etest { template::value, int>::type = 0 > etk::String exportResultToString(const ETEST_TYPE& _element) { - return "nullptr"; + return "null"; } template::value @@ -161,7 +161,7 @@ namespace etest { }; \ \ uint32_t TEST_CLASS_NAME(groupName, localName)::registerElement = etest::registerTest(\ - etk::memory::allocatorNewFull("etest_test_class", nullptr, __LINE__, __FILE__)); \ + etk::memory::allocatorNewFull("etest_test_class", null, __LINE__, __FILE__)); \ \ void TEST_CLASS_NAME(groupName, localName)::run() @@ -175,7 +175,7 @@ namespace etest { etest::g_currentTest->addCheck(); \ ETEST_DEBUG(" [ SUB-RUN ] EXPECT_EQ(" << #element << ", " << #result << ");"); \ bool ETEST_VARIABLE_TMP_res = ((element) == (result)); \ - if (etest::g_currentTest == nullptr) { \ + if (etest::g_currentTest == null) { \ ETEST_CRITICAL("Not in a test"); \ } else { \ etest::g_currentTest->testResult(ETEST_VARIABLE_TMP_res, \ @@ -193,7 +193,7 @@ namespace etest { etest::g_currentTest->addCheck(); \ ETEST_DEBUG(" [ SUB-RUN ] EXPECT_NE(" << #element << ", " << #result << ");"); \ bool ETEST_VARIABLE_TMP_res = ((element) != (result)); \ - if (etest::g_currentTest == nullptr) { \ + if (etest::g_currentTest == null) { \ ETEST_CRITICAL("Not in a test"); \ } else { \ etest::g_currentTest->testResult(ETEST_VARIABLE_TMP_res, \ @@ -211,7 +211,7 @@ namespace etest { etest::g_currentTest->addCheck(); \ ETEST_DEBUG(" [ SUB-RUN ] ASSERT_NE(" << #element << ", " << #result << ");"); \ bool ETEST_VARIABLE_TMP_res = ((element) != (result)); \ - if (etest::g_currentTest == nullptr) { \ + if (etest::g_currentTest == null) { \ ETEST_CRITICAL("Not in a test"); \ } else { \ etest::g_currentTest->testResult(ETEST_VARIABLE_TMP_res, \ @@ -236,7 +236,7 @@ namespace etest { if (ETEST_VARIABLE_TMP_res2 < delta && ETEST_VARIABLE_TMP_res2 > -delta) { \ ETEST_VARIABLE_TMP_res = true; \ } \ - if (etest::g_currentTest == nullptr) { \ + if (etest::g_currentTest == null) { \ ETEST_CRITICAL("Not in a test"); \ } else { \ etest::g_currentTest->testResult(ETEST_VARIABLE_TMP_res, \ diff --git a/etk/Allocator.cpp b/etk/Allocator.cpp index 717e58a..8b5885b 100644 --- a/etk/Allocator.cpp +++ b/etk/Allocator.cpp @@ -150,7 +150,7 @@ class memoryAllocatorHandle { m_mutex(PTHREAD_MUTEX_INITIALIZER), #if ETK_MEMORY_CHECKER > 1 // Basic header to check the memory everflow (abstract element) - m_blockCheckMemory(nullptr), + m_blockCheckMemory(null), m_checkBorneSize(10*8), #endif m_totalMemAllocated(0), @@ -160,7 +160,7 @@ class memoryAllocatorHandle { m_dynamicID(0), m_memSystemInitialize(false), m_memListElementSize(1024), - m_memListElements(nullptr) { + m_memListElements(null) { #if ETK_MEMORY_CHECKER > 1 static const uint8_t blockCheckMemory[] = { 0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA, 0x99, 0x88, @@ -183,7 +183,7 @@ class memoryAllocatorHandle { return; } int systemRet; - if (m_memListElements == nullptr) { + if (m_memListElements == null) { m_memListElements = new MemoryElementSystem[m_memListElementSize]; } for (size_t iii=0; iii 1 @@ -340,9 +340,9 @@ class memoryAllocatorHandle { const char *element_2 = _fileLink; const char *element_1 = _fileLink; const char *element_0 = _fileLink; - const char * pch = nullptr; + const char * pch = null; pch = _fileLink; - while (pch != nullptr) { + while (pch != null) { element_2 = element_1; element_1 = element_0; element_0 = pch; @@ -358,16 +358,16 @@ class memoryAllocatorHandle { _element.pointerAllocated, _element.pointerGiveToUser, _element.sizeUser, - (_element.variableName==nullptr?"---":_element.variableName), + (_element.variableName==null?"---":_element.variableName), _element.id); ETK_MEMORY_WARNING("%8d : %s() line=%ld file=%s", (uint32_t)_element.id, - (_element.functionName==nullptr?"---":_element.functionName), + (_element.functionName==null?"---":_element.functionName), _element.functionLine, - (_element.fileName==nullptr?"---":_element.fileName)); + (_element.fileName==null?"---":_element.fileName)); if (checkMem(_element.pointerAllocated) == true) { ETK_MEMORY_ERROR("MEM LOG (L): %s : %ld Bytes @ %p ==> user @ %p (depassement pre)", - (_element.variableName==nullptr?"---":_element.variableName), + (_element.variableName==null?"---":_element.variableName), _element.sizeUser, _element.pointerAllocated, _element.pointerGiveToUser); @@ -375,7 +375,7 @@ class memoryAllocatorHandle { } if (checkMem(_element.pointerAllocated + _element.sizeUser + m_checkBorneSize) == true) { ETK_MEMORY_ERROR("MEM LOG (L): %s : %ld Bytes @ %p ==> user @ %p (depassement post)", - (_element.variableName==nullptr?"---":_element.variableName), + (_element.variableName==null?"---":_element.variableName), _element.sizeUser, _element.pointerAllocated, _element.pointerGiveToUser); @@ -404,7 +404,7 @@ class memoryAllocatorHandle { } if (countElement == 0) { unLock(); - return nullptr; + return null; } ETK_MEMORY_VERBOSE("find %ld element in memory", (uint64_t)countElement); uint64_t* out = new uint64_t[countElement+10]; @@ -420,7 +420,7 @@ class memoryAllocatorHandle { } bool checkSnapshoot(uint64_t* _handle) { - if (_handle == nullptr) { + if (_handle == null) { return false; } lock(); @@ -451,8 +451,8 @@ class memoryAllocatorHandle { void flipID(void* _pointer1, void* _pointer2) { MemoryElementSystem* handle1 = getAdressedElement((char*)_pointer1); MemoryElementSystem* handle2 = getAdressedElement((char*)_pointer2); - if ( handle1 == nullptr - || handle2 == nullptr) { + if ( handle1 == null + || handle2 == null) { ETK_MEMORY_WARNING("MEM flip error %p %p", _pointer1, _pointer2); return; } @@ -460,7 +460,7 @@ class memoryAllocatorHandle { } void clearSnapshoot(uint64_t* _handle) { - if (_handle == nullptr) { + if (_handle == null) { return; } delete[] (uint64_t*)_handle; @@ -477,9 +477,9 @@ class memoryAllocatorHandle { m_dynamicID++; myElement = getFreeElement(); // check free handle - if (myElement != nullptr) { + if (myElement != null) { #if ETK_MEMORY_CHECKER > 1 - const char *fileNameShort = nullptr; + const char *fileNameShort = null; #endif myElement->id = m_dynamicID; // if an element is free : @@ -495,11 +495,11 @@ class memoryAllocatorHandle { #else myElement->sizeAllocate = myElement->sizeUser; #endif - myElement->pointerAllocated = nullptr; - myElement->pointerGiveToUser = nullptr; + myElement->pointerAllocated = null; + myElement->pointerGiveToUser = null; // real allocation : myElement->pointerAllocated = new char[myElement->sizeAllocate]; - if (myElement->pointerAllocated != nullptr) { + if (myElement->pointerAllocated != null) { // set edded memory addMemory(myElement->sizeUser); // save curent pointer @@ -526,10 +526,10 @@ class memoryAllocatorHandle { return myElement->pointerGiveToUser; } else { // if no free handle: - void * localPointer = nullptr; + void * localPointer = null; localPointer = new char[_num * _size]; - if (localPointer != nullptr) { - if (_variableName == nullptr) { + if (localPointer != null) { + if (_variableName == null) { ETK_MEMORY_VERBOSE("MEM allocate (-): --- : %lu Bytes @ %p (No log...)", _num*_size, localPointer); } else { ETK_MEMORY_VERBOSE("MEM allocate (-): %s : %lu Bytes @ %p (No log...)", _variableName, _num*_size, localPointer); @@ -538,7 +538,7 @@ class memoryAllocatorHandle { //addMemory(_num * _size); // not availlable can not un add memory m_totalMemAllocated += _num * _size; } else { - if (_variableName == nullptr) { + if (_variableName == null) { ETK_MEMORY_VERBOSE("MEM allocate (-): --- : %lu Bytes @ (ERROR)", _num*_size); } else { ETK_MEMORY_VERBOSE("MEM allocate (-): %s : %lu Bytes @ (ERROR)", _variableName, _num*_size); @@ -552,16 +552,16 @@ class memoryAllocatorHandle { void remove(void* _pointerData, const char* _variableName, const char* _functionName, int32_t _line, const char* _fileName) { MemoryElementSystem * myElement; lock(); - char* asyncFree = nullptr; + char* asyncFree = null; myElement = getAdressedElement((char*)_pointerData); // check free handle - if (myElement != nullptr) { + if (myElement != null) { bool errorOccured = false; // We know this element : #if ETK_MEMORY_CHECKER > 1 // check end and Start : if (checkMem(myElement->pointerAllocated) == true) { - if (_variableName == nullptr) { + if (_variableName == null) { ETK_MEMORY_ERROR("MEM free (L): --- : %ld Bytes @ %p ==> user @ %p (depassement pre)", uint64_t(myElement->sizeUser), myElement->pointerAllocated, myElement->pointerGiveToUser); } else { ETK_MEMORY_ERROR("MEM free (L): %s : %ld Bytes @ %p ==> user @ %p (depassement pre)", _variableName, uint64_t(myElement->sizeUser), myElement->pointerAllocated, myElement->pointerGiveToUser); @@ -569,7 +569,7 @@ class memoryAllocatorHandle { errorOccured = true; } if (checkMem(myElement->pointerAllocated + myElement->sizeUser + m_checkBorneSize) == true) { - if (_variableName == nullptr) { + if (_variableName == null) { ETK_MEMORY_ERROR("MEM free (L): --- : %ld Bytes @ %p ==> user @ %p (depassement post)", uint64_t(myElement->sizeUser), myElement->pointerAllocated, myElement->pointerGiveToUser); } else { ETK_MEMORY_ERROR("MEM free (L): %s : %ld Bytes @ %p ==> user @ %p (depassement post)", _variableName, uint64_t(myElement->sizeUser), myElement->pointerAllocated, myElement->pointerGiveToUser); @@ -577,7 +577,7 @@ class memoryAllocatorHandle { errorOccured = true; } if (errorOccured == false) { - if (_variableName == nullptr) { + if (_variableName == null) { ETK_MEMORY_VERBOSE("MEM free (L): --- : %ld Bytes @ %p ==> user @ %p", uint64_t(myElement->sizeUser), myElement->pointerAllocated, myElement->pointerGiveToUser); } else { ETK_MEMORY_VERBOSE("MEM free (L): %s : %ld Bytes @ %p ==> user @ %p", _variableName, uint64_t(myElement->sizeUser), myElement->pointerAllocated, myElement->pointerGiveToUser); @@ -587,25 +587,25 @@ class memoryAllocatorHandle { //ETK_ASSERT(1 == 0, "Memory error detected"); } #else - if (_variableName == nullptr) { + if (_variableName == null) { ETK_MEMORY_VERBOSE("MEM free (L): --- : %ld Bytes @ %p ==> user @ %p", uint64_t(myElement->sizeUser), myElement->pointerAllocated, myElement->pointerGiveToUser); } else { ETK_MEMORY_VERBOSE("MEM free (L): %s : %ld Bytes @ %p ==> user @ %p", _variableName, uint64_t(myElement->sizeUser), myElement->pointerAllocated, myElement->pointerGiveToUser); } #endif asyncFree = myElement->pointerAllocated; - myElement->pointerAllocated = nullptr; + myElement->pointerAllocated = null; removeMemory(myElement->sizeUser); myElement->used = false; } unLock(); - if (asyncFree != nullptr) { + if (asyncFree != null) { // free Buffer: delete[] asyncFree; return; } //Unknown element - if (_variableName == nullptr) { + if (_variableName == null) { ETK_MEMORY_WARNING("MEM free (-): --- : ?? Bytes @ %p ==> unsaved element", _pointerData); } else { ETK_MEMORY_WARNING("MEM free (-): %s : ?? Bytes @ %p ==> unsaved element", _variableName, _pointerData); @@ -688,7 +688,7 @@ class memoryAllocatorHandle { bool errorOccured = false; if (checkMem(m_memListElements[iii].pointerAllocated) == true) { const char* tmp = m_memListElements[iii].variableName; - if (tmp == nullptr) { + if (tmp == null) { tmp = "---"; } ETK_MEMORY_ERROR("MEM CHECK (L): %s : %ld Bytes @ %p ==> user @ %p (depassement pre)", tmp, uint64_t(m_memListElements[iii].sizeUser), m_memListElements[iii].pointerAllocated, m_memListElements[iii].pointerGiveToUser); @@ -696,7 +696,7 @@ class memoryAllocatorHandle { } if (checkMem(m_memListElements[iii].pointerAllocated + m_memListElements[iii].sizeUser + m_checkBorneSize) == true) { const char* tmp = m_memListElements[iii].variableName; - if (tmp == nullptr) { + if (tmp == null) { tmp = "---"; } ETK_MEMORY_ERROR("MEM CHECK (L): %s : %ld Bytes @ %p ==> user @ %p (depassement post)", tmp, uint64_t(m_memListElements[iii].sizeUser), m_memListElements[iii].pointerAllocated, m_memListElements[iii].pointerGiveToUser); diff --git a/etk/Allocator.hpp b/etk/Allocator.hpp index 74b6d39..5152cd2 100644 --- a/etk/Allocator.hpp +++ b/etk/Allocator.hpp @@ -113,12 +113,12 @@ const char* _functionName = "", int32_t _line = __LINE__, const char* _fileName = __FILE__) { - if (_element == nullptr) { + if (_element == null) { return; } _element->~ETK_TYPE(); etk::memory::remove((void*)_element, _variableName, _functionName, _line, _fileName); - _element = nullptr; + _element = null; } } } diff --git a/etk/Array.hpp b/etk/Array.hpp index b9206ea..311e8f4 100644 --- a/etk/Array.hpp +++ b/etk/Array.hpp @@ -60,7 +60,7 @@ namespace etk { */ Iterator(): m_current(0), - m_array(nullptr) { + m_array(null) { // nothing to do ... } /** @@ -87,7 +87,7 @@ namespace etk { */ ~Iterator() { m_current = 0; - m_array = nullptr; + m_array = null; } /** * @brief basic boolean cast @@ -125,7 +125,7 @@ namespace etk { * @return Reference on the current iterator increment */ Iterator& operator++ () { - if ( m_array != nullptr + if ( m_array != null && m_current < m_array->size() ) { m_current++; @@ -137,7 +137,7 @@ namespace etk { * @return Reference on the current iterator decrement */ Iterator& operator-- () { - if ( m_array != nullptr + if ( m_array != null && m_current > 0) { m_current--; } @@ -464,7 +464,7 @@ namespace etk { * @param[in] _nbElement Number of element to add. */ void pushBack(const ETK_ARRAY_TYPE * _item, size_t _nbElement) { - if (_item == nullptr) { + if (_item == null) { return; } if (m_size+_nbElement > ETK_ARRAY_SIZE) { @@ -769,8 +769,8 @@ namespace etk { if (m_size != _obj.m_size) { return false; } - if( m_data == nullptr - || _obj.m_data == nullptr) { + if( m_data == null + || _obj.m_data == null) { return false; } for (size_t iii=0; iii* copy() { ETK_FUNCTION_DEBUG(" COPY NULLPTR \n"); - return nullptr; + return null; } virtual void copyIn(char* _buffer) { ETK_FUNCTION_DEBUG(" COPY NULLPTR \n"); @@ -84,21 +84,21 @@ namespace etk { uint32_t m_pppppp; public: Function(): - m_pointerPrivate(nullptr), + m_pointerPrivate(null), m_local(false) { memset(m_buffer, 0, sizeof(m_buffer)); m_pppppp = MM___pppppp++; ETK_FUNCTION_DEBUG("[%d=0X%lx] create Function 1 \n", m_pppppp, (uint64_t)this); } Function(const etk::NullPtr&): - m_pointerPrivate(nullptr), + m_pointerPrivate(null), m_local(false) { memset(m_buffer, 0, sizeof(m_buffer)); m_pppppp = MM___pppppp++; ETK_FUNCTION_DEBUG("[%d=0X%lx] create Function 2\n", m_pppppp, (uint64_t)this); } Function(const Function& _obj): - m_pointerPrivate(nullptr), + m_pointerPrivate(null), m_local(false) { memset(m_buffer, 0, sizeof(m_buffer)); m_pppppp = MM___pppppp++; @@ -106,13 +106,13 @@ namespace etk { if (_obj.m_local == true) { ((FunctionPrivateTypedef*)_obj.m_buffer)->copyIn(m_buffer); m_local = true; - } else if (_obj.m_pointerPrivate != nullptr) { + } else if (_obj.m_pointerPrivate != null) { m_pointerPrivate = _obj.m_pointerPrivate->copy(); } ETK_FUNCTION_DEBUG("[%d=0X%lx] create Function (copy constructor) ------- (done) ------- [%d=0X%lx]\n", m_pppppp, (uint64_t)this, _obj.m_pppppp, (uint64_t)&_obj); } Function(Function&& _obj): - m_pointerPrivate(nullptr), + m_pointerPrivate(null), m_local(false) { memset(m_buffer, 0, sizeof(m_buffer)); m_pppppp = MM___pppppp++; @@ -126,7 +126,7 @@ namespace etk { >::type = 0 > Function(ETK_TYPE_FUNCTION_FUNCTOR _functor): - m_pointerPrivate(nullptr), + m_pointerPrivate(null), m_local(false) { memset(m_buffer, 0, sizeof(m_buffer)); m_pppppp = MM___pppppp++; @@ -143,7 +143,7 @@ namespace etk { ~Function() { ETK_FUNCTION_DEBUG("[%d=0X%lx] DELETE Function \n", m_pppppp, (uint64_t)this); ETK_DELETE(FunctionPrivateTypedef, m_pointerPrivate); - m_pointerPrivate = nullptr; + m_pointerPrivate = null; if (m_local == true) { // force the cast: FunctionPrivateTypedef* tmp = (FunctionPrivateTypedef*)m_buffer; @@ -153,9 +153,9 @@ namespace etk { } } ETK_TYPE_FUNCTION_RETURN operator()(ETK_TYPE_FUNCTION_ARGS... _args) const { - if ( m_pointerPrivate == nullptr + if ( m_pointerPrivate == null && m_local == false) { - ETK_FUNCTION_DEBUG("[%d=0X%lx] call Function (With nullptr !!! ==> must assert ...)\n", m_pppppp, (uint64_t)this); + ETK_FUNCTION_DEBUG("[%d=0X%lx] call Function (With null !!! ==> must assert ...)\n", m_pppppp, (uint64_t)this); throw etk::exception::NullPointerError("etk::Function call empty pointer"); } ETK_FUNCTION_DEBUG("[%d=0X%lx] call Function \n", m_pppppp, (uint64_t)this); @@ -178,7 +178,7 @@ namespace etk { } Function& operator= (etk::NullPtr _obj) { ETK_DELETE(FunctionPrivateTypedef, m_pointerPrivate); - m_pointerPrivate = nullptr; + m_pointerPrivate = null; if (m_local == true) { // force the cast: FunctionPrivateTypedef* tmp = (FunctionPrivateTypedef*)m_buffer; @@ -186,7 +186,7 @@ namespace etk { m_local = false; memset(m_buffer, 0, sizeof(m_buffer)); } - ETK_FUNCTION_DEBUG("[%d=0X%lx] operator = nullptr 0X%lx\n", m_pppppp, (uint64_t)this, (uint64_t)m_pointerPrivate); + ETK_FUNCTION_DEBUG("[%d=0X%lx] operator = null 0X%lx\n", m_pppppp, (uint64_t)this, (uint64_t)m_pointerPrivate); return *this; } @@ -226,17 +226,17 @@ namespace etk { return *this; } operator bool() const { - return m_pointerPrivate != nullptr + return m_pointerPrivate != null || m_local == true ; } bool operator!= (etk::NullPtr) const { - ETK_FUNCTION_DEBUG("[%d=0X%lx] operator != nullptr ==> 0X%lx %s\n", m_pppppp, (uint64_t)this, (uint64_t)m_pointerPrivate, (m_pointerPrivate != nullptr)?"true":"false"); - return m_pointerPrivate != nullptr + ETK_FUNCTION_DEBUG("[%d=0X%lx] operator != null ==> 0X%lx %s\n", m_pppppp, (uint64_t)this, (uint64_t)m_pointerPrivate, (m_pointerPrivate != null)?"true":"false"); + return m_pointerPrivate != null || m_local == true; } bool operator== (etk::NullPtr) const { - ETK_FUNCTION_DEBUG("[%d=0X%lx] operator == nullptr ==> 0X%lx %s\n", m_pppppp, (uint64_t)this, (uint64_t)m_pointerPrivate, (m_pointerPrivate == nullptr)?"true":"false"); - return m_pointerPrivate == nullptr + ETK_FUNCTION_DEBUG("[%d=0X%lx] operator == null ==> 0X%lx %s\n", m_pppppp, (uint64_t)this, (uint64_t)m_pointerPrivate, (m_pointerPrivate == null)?"true":"false"); + return m_pointerPrivate == null && m_local == false; } etk::String toString() const { diff --git a/etk/Map.hpp b/etk/Map.hpp index f803752..dea008f 100644 --- a/etk/Map.hpp +++ b/etk/Map.hpp @@ -51,7 +51,7 @@ namespace etk { */ Iterator(): m_current(0), - m_map(nullptr) { + m_map(null) { // nothing to do ... } /** @@ -78,7 +78,7 @@ namespace etk { */ ~Iterator() { m_current = 0; - m_map = nullptr; + m_map = null; } /** * @brief basic boolean cast @@ -92,7 +92,7 @@ namespace etk { * @return Reference on the current iterator increment */ Iterator& operator++ () { - if ( m_map != nullptr + if ( m_map != null && m_current < m_map->size() ) { m_current++; @@ -104,7 +104,7 @@ namespace etk { * @return Reference on the current iterator decrement */ Iterator& operator-- () { - if ( m_map != nullptr + if ( m_map != null && m_current > 0) { m_current--; } @@ -272,7 +272,7 @@ namespace etk { if (m_ordered == false) { return; } - if (m_comparator != nullptr) { + if (m_comparator != null) { m_data.sort(0, m_data.size(), m_comparator); } else { m_data.sort(0, m_data.size(), [](etk::Pair* const & _key1, @@ -290,7 +290,7 @@ namespace etk { */ Map(size_t _count = 0, bool _ordered = true, - sortFunction _comparator = nullptr) : + sortFunction _comparator = null) : m_data(), m_comparator(etk::move(_comparator)), m_ordered(_ordered) { @@ -302,7 +302,7 @@ namespace etk { */ Map(Map&& _obj): m_data(), - m_comparator(nullptr), + m_comparator(null), m_ordered(true) { _obj.swap(*this); } @@ -316,7 +316,7 @@ namespace etk { m_ordered(_obj.m_ordered) { m_data.reserve(_obj.m_data.size()); for (auto &it : _obj.m_data) { - if (it == nullptr) { + if (it == null) { continue; } m_data.pushBack(ETK_NEW(pairType, it->first, it->second)); @@ -360,9 +360,9 @@ namespace etk { */ void clear() { for (auto &it : m_data) { - if (it != nullptr) { + if (it != null) { ETK_DELETE(pairType, it); - it=nullptr; + it=null; } } m_data.clear(); @@ -377,7 +377,7 @@ namespace etk { // TODO: search in a dichotomic way. } for (size_t iii=0; iiifirst == _key) { return iii; } @@ -437,7 +437,7 @@ namespace etk { int64_t elementId = getId(_key); if (elementId <0) { etk::Pair* tmp = ETK_NEW(pairType, etk::move(_key), etk::move(_value)); - if (tmp == nullptr) { + if (tmp == null) { return; } m_data.pushBack(tmp); @@ -452,7 +452,7 @@ namespace etk { int64_t elementId = getId(_key); if (elementId <0) { etk::Pair* tmp = ETK_NEW(pairType, etk::move(_key), etk::move(_value)); - if (tmp == nullptr) { + if (tmp == null) { return; } m_data.pushBack(tmp); @@ -486,7 +486,7 @@ namespace etk { return; } ETK_DELETE(pairType, m_data[elementId]); - m_data[elementId] = nullptr; + m_data[elementId] = null; m_data.erase(m_data.begin()+elementId); } /** @@ -496,7 +496,7 @@ namespace etk { Iterator erase(const Iterator& _it) { int64_t elementId = _it.m_current; ETK_DELETE(pairType, m_data[elementId]); - m_data[elementId] = nullptr; + m_data[elementId] = null; m_data.erase(m_data.begin()+elementId); return position(elementId); } @@ -528,7 +528,7 @@ namespace etk { etk::Vector getKeys() const { etk::Vector keys; for (auto &it : m_data) { - if (it != nullptr) { + if (it != null) { keys.pushBack(it->first); } } @@ -620,7 +620,7 @@ namespace etk { size_t count(const ETK_MAP_TYPE_KEY& _key) const { // TODO: search in a dichotomic way. for (size_t iii=0; iiifirst == _key) { diff --git a/etk/NullPtr.hpp b/etk/NullPtr.hpp index 9d9e02f..cc35b52 100644 --- a/etk/NullPtr.hpp +++ b/etk/NullPtr.hpp @@ -28,12 +28,8 @@ namespace etk { return n; } } -// If somebody hasn't already defined nullptr in a custom way... -#if !defined(nullptr) - #define nullptr etk::getNullPointer() -#endif - -#if !defined(nullptr) +// We does not use nullptr ==> specific STD, can not be overload, and this permit to have a compatibility with STD +#if !defined(null) #define null etk::getNullPointer() #endif diff --git a/etk/RegEx.hpp b/etk/RegEx.hpp index e0d6eb6..cda47ca 100644 --- a/etk/RegEx.hpp +++ b/etk/RegEx.hpp @@ -1027,7 +1027,7 @@ template class NodePTheseElement : public Node { // Force a specicfic size m_subNode.reserve(_obj.m_subNode.size()); for(size_t iii=0; iii<_obj.m_subNode.size(); iii++) { - if (_obj.m_subNode[iii] != nullptr) { + if (_obj.m_subNode[iii] != null) { m_subNode.pushBack(_obj.m_subNode[iii]->clone()); } } @@ -1043,13 +1043,13 @@ template class NodePTheseElement : public Node { Node::copyData(&_obj); for (auto it : m_subNode) { ETK_DELETE(Node, it); - it = nullptr; + it = null; } m_subNode.clear(); // Force a specicfic size m_subNode.reserve(_obj.m_subNode.size()); for(size_t iii=0; iii<_obj.m_subNode.size(); iii++) { - if (_obj.m_subNode[iii] != nullptr) { + if (_obj.m_subNode[iii] != null) { m_subNode.pushBack(_obj.m_subNode[iii]->clone()); } } @@ -1068,7 +1068,7 @@ template class NodePTheseElement : public Node { ~NodePTheseElement() { for (auto it : m_subNode) { ETK_DELETE(Node, it); - it = nullptr; + it = null; } m_subNode.clear(); }; @@ -1419,7 +1419,7 @@ template class NodePThese : public Node { ~NodePThese() { for (auto it : m_subNode) { ETK_DELETE(Node, it); - it = nullptr; + it = null; } m_subNode.clear(); } @@ -1436,7 +1436,7 @@ template class NodePThese : public Node { // Force a specicfic size m_subNode.reserve(_obj.m_subNode.size()); for(size_t iii=0; iii<_obj.m_subNode.size(); iii++) { - if (_obj.m_subNode[iii] != nullptr) { + if (_obj.m_subNode[iii] != null) { m_subNode.pushBack(_obj.m_subNode[iii]->clone()); } } @@ -1452,13 +1452,13 @@ template class NodePThese : public Node { Node::copyData(&_obj); for (auto it : m_subNode) { ETK_DELETE(Node, it); - it = nullptr; + it = null; } m_subNode.clear(); // Force a specicfic size m_subNode.reserve(_obj.m_subNode.size()); for(size_t iii=0; iii<_obj.m_subNode.size(); iii++) { - if (_obj.m_subNode[iii] != nullptr) { + if (_obj.m_subNode[iii] != null) { m_subNode.pushBack(_obj.m_subNode[iii]->clone()); } } @@ -2240,7 +2240,7 @@ template class RegEx { return true; } else { // otherwise, we check the error in the element ... - char *find = nullptr; + char *find = null; switch (_tmpExpression[_pos]) { case regexOpcodePTheseIn: find = (char*)"("; break; case regexOpcodeBracketIn: find = (char*)"["; break; @@ -2276,7 +2276,7 @@ template class RegEx { default: break; } } - if (find != nullptr) { + if (find != null) { (void)input; TK_ERROR("can not have : '" << find << "' inside " << input << " element"); return false; diff --git a/etk/Set.hpp b/etk/Set.hpp index 5717737..03d7001 100644 --- a/etk/Set.hpp +++ b/etk/Set.hpp @@ -48,7 +48,7 @@ namespace etk { */ Iterator(): m_current(0), - m_set(nullptr) { + m_set(null) { // nothing to do ... } /** @@ -75,7 +75,7 @@ namespace etk { */ ~Iterator() { m_current = 0; - m_set = nullptr; + m_set = null; } /** * @brief basic boolean cast @@ -89,7 +89,7 @@ namespace etk { * @return Reference on the current iterator increment */ Iterator& operator++ () { - if ( m_set != nullptr + if ( m_set != null && m_current < m_set->size() ) { m_current++; @@ -101,7 +101,7 @@ namespace etk { * @return Reference on the current iterator decrement */ Iterator& operator-- () { - if ( m_set != nullptr + if ( m_set != null && m_current > 0) { m_current--; } @@ -240,7 +240,7 @@ namespace etk { * @brief Order the Set with the corect functor */ void sort() { - if (m_comparator != nullptr) { + if (m_comparator != null) { m_data.sort(0, m_data.size(), m_comparator); } else { m_data.sort(0, m_data.size(), [](const ETK_SET_TYPE& _key1, const ETK_SET_TYPE& _key2) { return _key1 < _key2; }); @@ -253,7 +253,7 @@ namespace etk { */ Set(int32_t _count = 0) : m_data(), - m_comparator(nullptr) { + m_comparator(null) { m_data.reserve(_count); // nothing to do } @@ -265,7 +265,7 @@ namespace etk { template Set(const ETK_SET_TYPE_2& ... _args): m_data(), - m_comparator(nullptr) { + m_comparator(null) { add(_args...); } @@ -336,7 +336,7 @@ namespace etk { * @param[in] _value Value to set in the Set table. */ void add(const ETK_SET_TYPE& _key) { - if (m_comparator != nullptr) { + if (m_comparator != null) { for (size_t iii=0; iiisize() ) { m_current++; @@ -84,7 +84,7 @@ namespace etk { * @return Reference on the current iterator decrement */ Iterator& operator-- () { - if ( m_string != nullptr + if ( m_string != null && m_current > 0) { m_current--; } diff --git a/etk/UString.cpp b/etk/UString.cpp index e898412..0939d37 100644 --- a/etk/UString.cpp +++ b/etk/UString.cpp @@ -30,7 +30,7 @@ etk::UString::UString(const etk::UString& _obj, size_t _pos, size_t _size) { } etk::UString::UString(const char32_t* _obj) { - if (_obj == nullptr) { + if (_obj == null) { resize(0); return; } @@ -42,7 +42,7 @@ etk::UString::UString(const char32_t* _obj) { } etk::UString::UString(const char32_t* _obj, size_t _size) { - if ( _obj == nullptr + if ( _obj == null || _size == 0) { resize(0); return; @@ -104,7 +104,7 @@ etk::UString& etk::UString::operator=(const etk::UString& _obj) { etk::UString& etk::UString::operator=(const char32_t* _obj) { clear(); - if (_obj == nullptr) { + if (_obj == null) { return *this; } size_t numberElement = u32char::strlen(_obj); @@ -135,7 +135,7 @@ etk::UString& etk::UString::operator+= (const etk::UString& _obj) { } etk::UString& etk::UString::operator+= (const char32_t* _obj) { - if (_obj == nullptr) { + if (_obj == null) { return *this; } size_t numberElement = u32char::strlen(_obj); @@ -176,7 +176,7 @@ void etk::UString::pushBack(const char32_t _item) { } void etk::UString::pushBack(const char32_t* _item, size_t _nbElement) { - if (_item == nullptr) { + if (_item == null) { return; } size_t idElement = size(); diff --git a/etk/UString.hpp b/etk/UString.hpp index 8ac33ce..46102a5 100644 --- a/etk/UString.hpp +++ b/etk/UString.hpp @@ -27,7 +27,7 @@ namespace etk { */ Iterator(): m_current(0), - m_string(nullptr) { + m_string(null) { // nothing to do ... } /** @@ -54,7 +54,7 @@ namespace etk { */ ~Iterator() { m_current = 0; - m_string = nullptr; + m_string = null; } /** * @brief basic boolean cast @@ -68,7 +68,7 @@ namespace etk { * @return Reference on the current iterator increment */ Iterator& operator++ () { - if ( m_string != nullptr + if ( m_string != null && m_current < m_string->size() ) { m_current++; @@ -80,7 +80,7 @@ namespace etk { * @return Reference on the current iterator decrement */ Iterator& operator-- () { - if ( m_string != nullptr + if ( m_string != null && m_current > 0) { m_current--; } diff --git a/etk/Vector.hpp b/etk/Vector.hpp index 41588eb..6c48f57 100644 --- a/etk/Vector.hpp +++ b/etk/Vector.hpp @@ -59,7 +59,7 @@ namespace etk { */ Iterator(): m_current(0), - m_vector(nullptr) { + m_vector(null) { // nothing to do ... } /** @@ -86,7 +86,7 @@ namespace etk { */ ~Iterator() { m_current = 0; - m_vector = nullptr; + m_vector = null; } /** * @brief basic boolean cast @@ -124,7 +124,7 @@ namespace etk { * @return Reference on the current iterator increment */ Iterator& operator++ () { - if ( m_vector != nullptr + if ( m_vector != null && m_current < m_vector->size() ) { m_current++; @@ -136,7 +136,7 @@ namespace etk { * @return Reference on the current iterator decrement */ Iterator& operator-- () { - if ( m_vector != nullptr + if ( m_vector != null && m_current > 0) { m_current--; } @@ -248,7 +248,7 @@ namespace etk { * @brief Create an empty vector */ Vector(): - m_data(nullptr), + m_data(null), m_size(0), m_allocated(0) { @@ -259,7 +259,7 @@ namespace etk { * @param[in] _count Minimum request size of the Buffer */ Vector(size_t _count): - m_data(nullptr), + m_data(null), m_size(0), m_allocated(0) { changeAllocation(_count); @@ -276,7 +276,7 @@ namespace etk { */ template Vector(const ETK_VECTOR_TYPE_2& ... _args): - m_data(nullptr), + m_data(null), m_size(0), m_allocated(0) { changeAllocation(int32_t(sizeof...(ETK_VECTOR_TYPE_2))); @@ -287,7 +287,7 @@ namespace etk { * @param[in] _obj Vector that might be copy */ Vector(const etk::Vector& _obj): - m_data(nullptr), + m_data(null), m_size(0), m_allocated(0) { reserve(_obj.m_size); @@ -304,7 +304,7 @@ namespace etk { m_data(_obj.m_data), m_size(_obj.m_size), m_allocated(_obj.m_allocated) { - _obj.m_data = nullptr; + _obj.m_data = null; _obj.m_size = 0; _obj.m_allocated = 0; } @@ -312,7 +312,7 @@ namespace etk { * @brief Destructor of the current class */ ~Vector() { - if (m_data != nullptr) { + if (m_data != null) { for(size_t iii=0; iii" << requestSize); // check if something is allocated : - if (m_data == nullptr) { + if (m_data == null) { // no data allocated ==> request an allocation (might be the first) m_data = (ETK_VECTOR_TYPE*)ETK_MALLOC(char, sizeof(ETK_VECTOR_TYPE)*requestSize); - if (m_data == nullptr) { + if (m_data == null) { //TK_CRITICAL("Vector : Error in data allocation request allocation:" << requestSize << "*" << (int32_t)(sizeof(ETK_VECTOR_TYPE)) << "bytes" ); m_allocated = 0; return; @@ -865,7 +865,7 @@ namespace etk { } else { // allocate a new pool of data: ETK_VECTOR_TYPE* dataTmp = (ETK_VECTOR_TYPE*)ETK_MALLOC(char, sizeof(ETK_VECTOR_TYPE)*requestSize);; - if (dataTmp == nullptr) { + if (dataTmp == null) { //TK_CRITICAL("Vector : Error in data allocation request allocation:" << requestSize << "*" << (int32_t)(sizeof(ETK_VECTOR_TYPE)) << "bytes" ); return; } @@ -896,7 +896,7 @@ namespace etk { ETK_VECTOR_TYPE* dataTmp2 = m_data; m_data = dataTmp; // remove old pool - if (dataTmp2 != nullptr) { + if (dataTmp2 != null) { ETK_FREE(char, dataTmp2); } } @@ -916,8 +916,8 @@ namespace etk { if (m_size != _obj.m_size) { return false; } - if( m_data == nullptr - || _obj.m_data == nullptr) { + if( m_data == null + || _obj.m_data == null) { return false; } for (size_t iii=0; iii::It char tmpFileName[FILENAME_MAX]; unz_file_info tmpFileInfo; /* Get info about current file. */ - if(unzGetCurrentFileInfo(m_ctx, &tmpFileInfo, tmpFileName, FILENAME_MAX, nullptr, 0, nullptr, 0) != UNZ_OK) { + if(unzGetCurrentFileInfo(m_ctx, &tmpFileInfo, tmpFileName, FILENAME_MAX, null, 0, null, 0) != UNZ_OK) { TK_ERROR("Could not read file info from the zip file '" << m_fileName << "'"); return; } @@ -84,7 +84,7 @@ void etk::archive::Zip::loadFile(const etk::Map::It // request the resize of the data : it->second.getDataVector().resize(it->second.getTheoricSize(), 0); void* data = it->second.data(); - if(data == nullptr) { + if(data == null) { TK_ERROR("Allocation error..."); return; } diff --git a/etk/math/Matrix.hpp b/etk/math/Matrix.hpp index 17e9254..c2a87f1 100644 --- a/etk/math/Matrix.hpp +++ b/etk/math/Matrix.hpp @@ -24,10 +24,10 @@ namespace etk { * @param[in] _size Dimention of the matrix * @param[in] _defaultVal Default list of element that might be set in the matrix */ - Matrix(const ivec2& _size, T* _defaultVal=nullptr) : + Matrix(const ivec2& _size, T* _defaultVal=null) : m_size(_size), etk::Vector2D(_size.x()* _size.y()) { - if (defaultVal == nullptr) { + if (defaultVal == null) { clear(); return; } @@ -45,10 +45,10 @@ namespace etk { * @param[in] _heigh Dimention heigh of the matrix * @param[in] _defaultVal Default list of element that might be set in the matrix */ - Matrix(int32_t _width=0, int32_t _heigh=0, T* _defaultVal=nullptr) : + Matrix(int32_t _width=0, int32_t _heigh=0, T* _defaultVal=null) : m_size(_width, _heigh), etk::Vector2D(_width*_heigh) { - if (_defaultVal == nullptr) { + if (_defaultVal == null) { clear(); return; } diff --git a/etk/math/Matrix2x3.cpp b/etk/math/Matrix2x3.cpp index 5880b9d..88acc89 100644 --- a/etk/math/Matrix2x3.cpp +++ b/etk/math/Matrix2x3.cpp @@ -54,7 +54,7 @@ etk::Matrix2x3::Matrix2x3(float _sx, } etk::Matrix2x3::Matrix2x3(const float* _values) { - if (_values == nullptr) { + if (_values == null) { identity(); return; } @@ -67,7 +67,7 @@ etk::Matrix2x3::Matrix2x3(const float* _values) { } etk::Matrix2x3::Matrix2x3(const double* _values) { - if (_values == nullptr) { + if (_values == null) { identity(); return; } diff --git a/etk/math/Matrix4x4.cpp b/etk/math/Matrix4x4.cpp index d1618e7..0db4476 100644 --- a/etk/math/Matrix4x4.cpp +++ b/etk/math/Matrix4x4.cpp @@ -55,7 +55,7 @@ etk::Matrix4x4::Matrix4x4(float _a1, float _b1, float _c1, float _d1, } etk::Matrix4x4::Matrix4x4(float* _obj) { - if (_obj == nullptr) { + if (_obj == null) { identity(); return; } diff --git a/etk/os/FSNode.cpp b/etk/os/FSNode.cpp index 53d3c19..c1f8c63 100644 --- a/etk/os/FSNode.cpp +++ b/etk/os/FSNode.cpp @@ -214,7 +214,7 @@ static int32_t FSNODE_LOCAL_mkPath(const char* _path, mode_t _mode) { char *sp; int status; char *copypath = strdup(_path); - if (copypath == nullptr) { + if (copypath == null) { return -1; } status = 0; @@ -321,26 +321,26 @@ etk::String etk::FSNodeGetHomePath() { } #ifdef HAVE_ZIP_DATA - static etk::Archive* s_APKArchive = nullptr; + static etk::Archive* s_APKArchive = null; static void loadAPK(const etk::String& _apkPath) { #ifdef __TARGET_OS__Android ethread::UniqueLock lock(getNodeMutex()); TK_INFO("Loading APK '" << _apkPath << "'"); s_APKArchive = etk::Archive::load(_apkPath); - TK_ASSERT(s_APKArchive != nullptr, "Error loading APK ... '" << _apkPath << "'"); + TK_ASSERT(s_APKArchive != null, "Error loading APK ... '" << _apkPath << "'"); #else TK_INFO("Loading Intarnal data '" << _apkPath << "'"); //s_APKArchive = etk::Archive::loadPackage(_apkPath); s_APKArchive = etk::Archive::load(_apkPath); /* FILE* tmp = fopen(_apkPath.c_str(), "r"); - if (tmp == nullptr) { + if (tmp == null) { TK_ERROR("File does not exist ..."); } else { TK_ERROR("File open OK ..."); } */ - TK_ASSERT(s_APKArchive != nullptr, "Error loading PKG ... '" << _apkPath << "'"); + TK_ASSERT(s_APKArchive != null, "Error loading PKG ... '" << _apkPath << "'"); #endif #ifdef DEBUG //Just for debug, print APK contents @@ -351,7 +351,7 @@ etk::String etk::FSNodeGetHomePath() { static void loadAPKBin(const etk::String& _apkPath) { TK_ERROR("Loading Intarnal data '" << _apkPath << "'"); s_APKArchive = etk::Archive::loadPackage(_apkPath); - TK_ASSERT(s_APKArchive != nullptr, "Error loading PKG ... '" << _apkPath << "'"); + TK_ASSERT(s_APKArchive != null, "Error loading PKG ... '" << _apkPath << "'"); #ifdef DEBUG //Just for debug, print APK contents s_APKArchive->display(); @@ -366,7 +366,7 @@ void etk::setBaseFolderData(const char* _folder, const char* _applName) { { ethread::UniqueLock lock(getNodeMutex()); baseFolderData = "assets/"; - if (_applName != nullptr) { + if (_applName != null) { baseFolderData += _applName; baseFolderData += "/"; } @@ -431,14 +431,14 @@ void etk::forcePathUserData(const etk::String& _val) { Afterwards it may be reasonable to check whether the executable isn't actually a symlink. If it is resolve it relative to the symlink directory. This step is not necessary in /proc method (at least for Linux). There the proc symlink points directly to executable. Note that it is up to the calling process to set argv[0] correctly. It is right most of the times however there are occasions when the calling process cannot be trusted (ex. setuid executable). - On Windows: use GetModuleFileName(nullptr, buf, bufsize) + On Windows: use GetModuleFileName(null, buf, bufsize) */ etk::String getApplicationPath() { etk::String binaryName = "no-name"; char binaryCompleatePath[FILENAME_MAX]; memset(binaryCompleatePath, 0, FILENAME_MAX); #ifdef __TARGET_OS__Windows - GetModuleFileName(nullptr, binaryCompleatePath, FILENAME_MAX); + GetModuleFileName(null, binaryCompleatePath, FILENAME_MAX); if (strlen(binaryCompleatePath) == 0) { TK_CRITICAL("Can not get the binary position in the tree ==> this is really bad ..."); } else { @@ -478,7 +478,7 @@ etk::String getApplicationPath() { } TK_VERBOSE("Parse arg0 = '" << l_argZero << "' try add PWD"); char * basicPathPWD = getenv("PWD"); - if (nullptr != basicPathPWD) { + if (null != basicPathPWD) { etk::String testCompleatePath = basicPathPWD; testCompleatePath += "/"; testCompleatePath += l_argZero; @@ -494,7 +494,7 @@ etk::String getApplicationPath() { } } //char * basicPathPATH = getenv("PATH"); - //if (nullptr != basicPathPWD) { + //if (null != basicPathPWD) { // TODO : bad case ... //} // and now we will really in a bad mood ... @@ -507,7 +507,7 @@ void etk::initDefaultFolder(const char* _applName) { baseApplName = _applName; char cCurrentPath[FILENAME_MAX]; char * basicPath = getenv("HOME"); - if (nullptr == basicPath) { + if (null == basicPath) { TK_WARNING("ERROR while trying to get the path of the home folder"); #if defined(__TARGET_OS__Windows) baseFolderHome = "c:/"; @@ -673,17 +673,17 @@ etk::String etk::getUserRunFolder() { #ifdef HAVE_ZIP_DATA bool etk::FSNode::loadDataZip() { ethread::UniqueLock lock(getNodeMutex()); - if (s_APKArchive == nullptr) { + if (s_APKArchive == null) { return false; } - if (m_zipContent != nullptr) { + if (m_zipContent != null) { return true; } if (false == s_APKArchive->exist(m_systemFileName)) { return false; } m_zipContent = &s_APKArchive->getContent(m_systemFileName); - if (m_zipContent != nullptr) { + if (m_zipContent != null) { return true; } return false; @@ -695,12 +695,12 @@ etk::FSNode::FSNode(const etk::String& _nodeName) : m_userFileName(""), m_type(etk::FSNType_unknow), m_typeNode(etk::typeNode_unknow), - m_PointerFile(nullptr), + m_PointerFile(null), m_timeCreate(0), m_timeModify(0), m_timeAccess(0) #ifdef HAVE_ZIP_DATA - , m_zipContent(nullptr), + , m_zipContent(null), m_zipReadingOffset(-1) #endif { @@ -709,9 +709,9 @@ etk::FSNode::FSNode(const etk::String& _nodeName) : etk::FSNode::~FSNode() { - if( nullptr != m_PointerFile + if( null != m_PointerFile #ifdef HAVE_ZIP_DATA - || nullptr != m_zipContent + || null != m_zipContent #endif ) { TK_ERROR("Missing to close the file : \"" << *this << "\""); @@ -724,11 +724,11 @@ void etk::FSNode::sortElementList(etk::Vector& _list) { etk::Vector tmpList = _list; _list.clear(); for(size_t iii=0; iiigetNameFile()) > etk::toUpper(_list[jjj]->getNameFile())) { findPos = jjj+1; @@ -742,15 +742,15 @@ void etk::FSNode::sortElementList(etk::Vector& _list) { } void etk::FSNode::privateSetName(etk::String _newName) { - if( nullptr != m_PointerFile + if( null != m_PointerFile #ifdef HAVE_ZIP_DATA - || nullptr != m_zipContent + || null != m_zipContent #endif ) { TK_ERROR("Missing to close the file : '" << *this << "'"); fileClose(); } - // set right at nullptr ... + // set right at null ... m_rights = 0; m_libSearch = ""; @@ -770,7 +770,7 @@ void etk::FSNode::privateSetName(etk::String _newName) { } #ifdef HAVE_ZIP_DATA - m_zipContent = nullptr; + m_zipContent = null; m_zipReadingOffset = 0; #endif // Reset ALL DATA : @@ -928,7 +928,7 @@ void etk::FSNode::privateSetName(etk::String _newName) { bool directCheckFile(etk::String _tmpFileNameDirect, bool _checkInAPKIfNeeded = false) { #ifdef HAVE_ZIP_DATA if (true == _checkInAPKIfNeeded) { - if( nullptr != s_APKArchive + if( null != s_APKArchive && true == s_APKArchive->exist(_tmpFileNameDirect) ) { return true; } @@ -1115,7 +1115,7 @@ void etk::FSNode::updateFileSystemProperty() { folderName = m_systemFileName + "/"; } // note : Zip does not support other think than file ... - if (s_APKArchive == nullptr) { + if (s_APKArchive == null) { TK_ERROR("NOT Find the File in APK : '" << m_systemFileName << "'"); return; } @@ -1399,17 +1399,17 @@ const etk::FSNode& etk::FSNode::operator= (const etk::FSNode &_obj ) { if( this == &_obj ) { return *this; } - if( nullptr != m_PointerFile + if( null != m_PointerFile #ifdef HAVE_ZIP_DATA - || nullptr != m_zipContent + || null != m_zipContent #endif ) { TK_ERROR("Missing close the file : " << *this); fileClose(); - m_PointerFile = nullptr; + m_PointerFile = null; } #ifdef HAVE_ZIP_DATA - m_zipContent = nullptr; + m_zipContent = null; m_zipReadingOffset = 0; #endif etk::String tmppp = _obj.getName(); @@ -1524,12 +1524,12 @@ int64_t etk::FSNode::folderCount() { */ #endif int64_t counter=0; - DIR *dir = nullptr; - struct dirent *ent = nullptr; + DIR *dir = null; + struct dirent *ent = null; dir = opendir(m_systemFileName.c_str()); - if (dir != nullptr) { + if (dir != null) { // for each element in the drectory... - while ((ent = readdir(dir)) != nullptr) { + while ((ent = readdir(dir)) != null) { etk::String tmpName(ent->d_name); if( tmpName == "." || tmpName == ".." ) { @@ -1569,7 +1569,7 @@ etk::Vector etk::FSNode::folderGetSubList(bool _showHidenFile, bo */ #endif // regenerate the next list : - etk::FSNode * tmpEmement = nullptr; + etk::FSNode * tmpEmement = null; if (m_typeNode != etk::typeNode_folder ) { return tmpp; } @@ -1579,7 +1579,7 @@ etk::Vector etk::FSNode::folderGetSubList(bool _showHidenFile, bo etk::Vector listAdded; etk::String assetsName = baseFolderData; etk::String FolderName = getNameFolder(); - if (s_APKArchive==nullptr) { + if (s_APKArchive==null) { return tmpp; } if (FolderName[FolderName.size()-1] != '/') { @@ -1608,25 +1608,25 @@ etk::Vector etk::FSNode::folderGetSubList(bool _showHidenFile, bo if (findIt == false) { listAdded.pushBack(tmpString); tmpEmement = ETK_NEW(etk::FSNode, tmpString); - if (tmpEmement == nullptr) { + if (tmpEmement == null) { TK_ERROR("allocation error ... of ewol::FSNode"); continue; } TK_VERBOSE("find element : '" << tmpString << "' --> " << *tmpEmement); tmpp.pushBack(tmpEmement); - tmpEmement = nullptr; + tmpEmement = null; } } } return tmpp; } #endif - DIR *dir = nullptr; - struct dirent *ent = nullptr; + DIR *dir = null; + struct dirent *ent = null; dir = opendir(m_systemFileName.c_str()); - if (dir != nullptr) { + if (dir != null) { // for each element in the drectory... - while ((ent = readdir(dir)) != nullptr) { + while ((ent = readdir(dir)) != null) { etk::String tmpName(ent->d_name); TK_VERBOSE(" search in folder\"" << tmpName << "\""); if( tmpName == "." @@ -1637,7 +1637,7 @@ etk::Vector etk::FSNode::folderGetSubList(bool _showHidenFile, bo if( start_with(tmpName, ".") == false || _showHidenFile == true) { tmpEmement = ETK_NEW(etk::FSNode, getRelativeFolder()+tmpName); - if (tmpEmement == nullptr) { + if (tmpEmement == null) { TK_ERROR("allocation error ... of ewol::FSNode"); continue; } @@ -1646,13 +1646,13 @@ etk::Vector etk::FSNode::folderGetSubList(bool _showHidenFile, bo tmpp.pushBack(tmpEmement); } else { ETK_DELETE(etk::FSNode, tmpEmement); - tmpEmement = nullptr; + tmpEmement = null; } } else if (_getFolderAndOther) { tmpp.pushBack(tmpEmement); } else { ETK_DELETE(etk::FSNode, tmpEmement); - tmpEmement = nullptr; + tmpEmement = null; } } } @@ -1678,7 +1678,7 @@ etk::Vector etk::FSNode::folderGetSub(bool _getFolder, bool _getFil #endif etk::Vector out; // regenerate the next list : - etk::FSNode * tmpEmement = nullptr; + etk::FSNode * tmpEmement = null; if (m_typeNode != etk::typeNode_folder ) { return out; } @@ -1688,7 +1688,7 @@ etk::Vector etk::FSNode::folderGetSub(bool _getFolder, bool _getFil etk::Vector listAdded; etk::String assetsName = baseFolderData; etk::String FolderName = getNameFolder(); - if (s_APKArchive == nullptr) { + if (s_APKArchive == null) { return out; } if (FolderName[FolderName.size()-1] != '/') { @@ -1723,12 +1723,12 @@ etk::Vector etk::FSNode::folderGetSub(bool _getFolder, bool _getFil return out; } #endif - DIR *dir = nullptr; - struct dirent *ent = nullptr; + DIR *dir = null; + struct dirent *ent = null; dir = opendir(m_systemFileName.c_str()); - if (dir != nullptr) { + if (dir != null) { // for each element in the drectory... - while ((ent = readdir(dir)) != nullptr) { + while ((ent = readdir(dir)) != null) { etk::String tmpName(ent->d_name); TK_VERBOSE(" search in folder\"" << tmpName << "\""); if( tmpName == "." @@ -1765,7 +1765,7 @@ void etk::FSNode::folderGetRecursiveFiles(etk::Vector& _output, boo || m_type == etk::FSNType_themeData) { etk::String assetsName = baseFolderData; etk::String FolderName = getNameFolder(); - if (s_APKArchive==nullptr) { + if (s_APKArchive==null) { return; } for (int iii=0; iiisize(); iii++) { @@ -1789,13 +1789,13 @@ void etk::FSNode::folderGetRecursiveFiles(etk::Vector& _output, boo #endif // regenerate the next list : etk::FSNode * tmpEmement; - DIR *dir = nullptr; - struct dirent *ent = nullptr; + DIR *dir = null; + struct dirent *ent = null; dir = opendir(m_systemFileName.c_str()); //TK_DEBUG(" ** open Folder : " << m_systemFileName ); - if (dir != nullptr) { + if (dir != null) { // for each element in the drectory... - while ((ent = readdir(dir)) != nullptr) { + while ((ent = readdir(dir)) != null) { etk::String tmpName(ent->d_name); if( tmpName == "." || tmpName == ".." ) { @@ -1804,7 +1804,7 @@ void etk::FSNode::folderGetRecursiveFiles(etk::Vector& _output, boo } //TK_DEBUG(" find : " << ent->d_name << " ==> " << (GetRelativeFolder()+tmpName)); tmpEmement = ETK_NEW(etk::FSNode, getRelativeFolder()+tmpName); - if (tmpEmement != nullptr) { + if (tmpEmement != null) { if(tmpEmement->getNodeType() == etk::typeNode_file) { etk::String tmpVal = tmpEmement->getName(); _output.pushBack(tmpVal); @@ -1815,7 +1815,7 @@ void etk::FSNode::folderGetRecursiveFiles(etk::Vector& _output, boo } } ETK_DELETE(etk::FSNode, tmpEmement); - tmpEmement = nullptr; + tmpEmement = null; } else { TK_ERROR("allocation error ... of ewol::FSNode"); continue; @@ -1893,13 +1893,13 @@ bool etk::FSNode::fileOpenRead() { return m_zipContent->getTheoricSize() == m_zipContent->size(); } #endif - if (m_PointerFile != nullptr) { + if (m_PointerFile != null) { TK_CRITICAL("File Already open : " << *this); return true; } TK_VERBOSE(" Read file : " << m_systemFileName); m_PointerFile = fopen(m_systemFileName.c_str(),"rb"); - if(m_PointerFile == nullptr) { + if(m_PointerFile == null) { TK_ERROR("Can not find the file " << *this ); return false; } @@ -1912,14 +1912,14 @@ bool etk::FSNode::fileOpenWrite() { return false; } #endif - if (m_PointerFile != nullptr) { + if (m_PointerFile != null) { TK_CRITICAL("File Already open : " << *this); return true; } FSNODE_LOCAL_mkPath(getNameFolder().c_str() , 0744); TK_VERBOSE("Write file : " << m_systemFileName); m_PointerFile = fopen(m_systemFileName.c_str(),"wb"); - if(m_PointerFile == nullptr) { + if(m_PointerFile == null) { TK_ERROR("Can not find the file " << *this); return false; } @@ -1933,7 +1933,7 @@ bool etk::FSNode::fileOpenAppend() { return false; } #endif - if (m_PointerFile != nullptr) { + if (m_PointerFile != null) { TK_CRITICAL("File Already open : " << *this); return true; } @@ -1942,7 +1942,7 @@ bool etk::FSNode::fileOpenAppend() { TK_VERBOSE("Append file : " << m_systemFileName); m_PointerFile = fopen(m_systemFileName.c_str(),"ab"); - if(m_PointerFile == nullptr) { + if(m_PointerFile == null) { TK_ERROR("Can not find the file " << *this); return false; } @@ -1953,13 +1953,13 @@ bool etk::FSNode::fileIsOpen() { #ifdef HAVE_ZIP_DATA if( etk::FSNType_data == m_type || etk::FSNType_themeData == m_type) { - if (m_zipContent == nullptr) { + if (m_zipContent == null) { return false; } return true; } #endif - if (m_PointerFile == nullptr) { + if (m_PointerFile == null) { return false; } return true; @@ -1968,22 +1968,22 @@ bool etk::FSNode::fileClose() { #ifdef HAVE_ZIP_DATA if( etk::FSNType_data == m_type || etk::FSNType_themeData == m_type) { - if (m_zipContent == nullptr) { + if (m_zipContent == null) { TK_CRITICAL("File Already closed : " << *this); return false; } s_APKArchive->close(m_systemFileName); - m_zipContent = nullptr; + m_zipContent = null; m_zipReadingOffset = 0; return true; } #endif - if (m_PointerFile == nullptr) { + if (m_PointerFile == null) { TK_CRITICAL("File Already closed : " << *this); return false; } fclose(m_PointerFile); - m_PointerFile = nullptr; + m_PointerFile = null; return true; } @@ -1994,13 +1994,13 @@ char* etk::FSNode::fileGets(char* _elementLine, int64_t _maxData) { int64_t outSize = 0; if( m_type == etk::FSNType_data || m_type == etk::FSNType_themeData) {//char * tmpData = internalDataFiles[iii].data + m_readingOffset; - if (m_zipContent == nullptr) { + if (m_zipContent == null) { element[0] = '\0'; - return nullptr; + return null; } if (m_zipReadingOffset >= m_zipContent->size()) { element[0] = '\0'; - return nullptr; + return null; } while (((char*)m_zipContent->data())[m_zipReadingOffset] != '\0') { if( ((char*)m_zipContent->data())[m_zipReadingOffset] == '\n' @@ -2026,7 +2026,7 @@ char* etk::FSNode::fileGets(char* _elementLine, int64_t _maxData) { outSize++; } if (outSize == 0) { - return nullptr; + return null; } else { // send last line return _elementLine; @@ -2062,7 +2062,7 @@ int64_t etk::FSNode::fileRead(void* _data, int64_t _blockSize, int64_t _nbBlock) #ifdef HAVE_ZIP_DATA if( m_type == etk::FSNType_data || m_type == etk::FSNType_themeData) { - if (m_zipContent == nullptr) { + if (m_zipContent == null) { ((char*)_data)[0] = '\0'; return 0; } @@ -2076,7 +2076,7 @@ int64_t etk::FSNode::fileRead(void* _data, int64_t _blockSize, int64_t _nbBlock) return _nbBlock; } #endif - if (m_PointerFile == nullptr) { + if (m_PointerFile == null) { TK_ERROR("Can not read in a file that is not open : " << *this); return 0; } @@ -2105,7 +2105,7 @@ int64_t etk::FSNode::fileWrite(const void * _data, int64_t _blockSize, int64_t _ return 0; } #endif - if (m_PointerFile == nullptr) { + if (m_PointerFile == null) { TK_ERROR("Can not write in a file that is not open : " << *this); return 0; } @@ -2150,7 +2150,7 @@ bool etk::FSNode::fileSeek(long int _offset, enum etk::seekNode _origin) #ifdef HAVE_ZIP_DATA if( m_type == etk::FSNType_data || m_type == etk::FSNType_themeData) { - if (nullptr == m_zipContent) { + if (null == m_zipContent) { return false; } int32_t positionEnd = 0; @@ -2198,7 +2198,7 @@ int64_t etk::FSNode::fileTell() { #ifdef HAVE_ZIP_DATA if( m_type == etk::FSNType_data || m_type == etk::FSNType_themeData) { - if (nullptr == m_zipContent) { + if (null == m_zipContent) { return false; } return m_zipReadingOffset; @@ -2215,7 +2215,7 @@ void etk::FSNode::fileFlush() { return; } #endif - if (m_PointerFile != nullptr) { + if (m_PointerFile != null) { fflush(m_PointerFile); } } diff --git a/etk/os/FSNode.hpp b/etk/os/FSNode.hpp index 54ded94..056be85 100644 --- a/etk/os/FSNode.hpp +++ b/etk/os/FSNode.hpp @@ -610,7 +610,7 @@ namespace etk { * @param[in] _folder folder path of the cathegorie * @param[in] _applName Base name of the application */ - void setBaseFolderData(const char* _folder, const char* _applName=nullptr); + void setBaseFolderData(const char* _folder, const char* _applName=null); /** * @brief Set the user data folder (like /home/machin/.local/applName/ for linux) * @param[in] _folder folder path of the cathegorie diff --git a/etk/utf8.cpp b/etk/utf8.cpp index 2d6106c..80244ef 100644 --- a/etk/utf8.cpp +++ b/etk/utf8.cpp @@ -229,7 +229,7 @@ static uint8_t sizeElement(const char* _data, int32_t _lenMax) { char32_t utf8::convertChar32(const char* _input) { char32_t value = 0; - if (nullptr == _input) { + if (null == _input) { return value; } int32_t len = strlen(_input); @@ -289,7 +289,7 @@ bool utf8::first(const char _input) { } etk::UString utf8::convertUnicode(const char* _input) { - if (_input == nullptr) { + if (_input == null) { return U""; } etk::UString out; diff --git a/etk/utf8.hpp b/etk/utf8.hpp index b466ccd..df87716 100644 --- a/etk/utf8.hpp +++ b/etk/utf8.hpp @@ -110,7 +110,7 @@ namespace utf8 { */ Iterator(): m_value(u32char::Null), - m_data(nullptr), + m_data(null), m_current(0) { // nothing to do ... }; @@ -133,7 +133,7 @@ namespace utf8 { m_value(u32char::Null), m_data(&_str), m_current(0) { - if (m_data != nullptr) { + if (m_data != null) { m_current = etk::distance(m_data->begin(), _pos); } }; @@ -146,7 +146,7 @@ namespace utf8 { m_value(u32char::Null), m_data(&_str), m_current(0) { - if (m_data != nullptr) { + if (m_data != null) { if (_pos > m_data->size()) { m_current = m_data->size(); } else { @@ -163,7 +163,7 @@ namespace utf8 { m_value(u32char::Null), m_data(_str), m_current(0) { - if (m_data != nullptr) { + if (m_data != null) { m_current = etk::distance(m_data->begin(), _pos); } }; @@ -176,7 +176,7 @@ namespace utf8 { m_value(u32char::Null), m_data(_str), m_current(0) { - if (m_data != nullptr) { + if (m_data != null) { if (_pos > m_data->size()) { m_current = m_data->size(); } else { @@ -210,7 +210,7 @@ namespace utf8 { */ virtual ~Iterator() { m_current = 0; - m_data = nullptr; + m_data = null; m_value = u32char::Null; }; /** @@ -218,7 +218,7 @@ namespace utf8 { * @return true if the element is present in buffer */ operator size_t () const { - if (m_data == nullptr) { + if (m_data == null) { return 0; } if (m_current < 0) { @@ -347,7 +347,7 @@ namespace utf8 { * @return The requested position. */ size_t getPos() const { - if (m_data == nullptr) { + if (m_data == null) { return 0; } if (m_current < 0) { diff --git a/test/testArchive.cpp b/test/testArchive.cpp index b580efe..f37fde0 100644 --- a/test/testArchive.cpp +++ b/test/testArchive.cpp @@ -15,13 +15,13 @@ TEST(TestEtkArchive, CreationWrong) { etk::Archive* tmpArchive = etk::Archive::load("nonExistantFile.zip"); - EXPECT_NE(tmpArchive, nullptr); + EXPECT_NE(tmpArchive, null); } /* TEST(TestEtkArchive, Display) { etk::Archive* tmpArchive = etk::Archive::load("nonExistantFile.zip"); - ASSERT_NEQ(tmpArchive, nullptr); + ASSERT_NEQ(tmpArchive, null); tmpArchive->display(); } */ diff --git a/test/testFunction.cpp b/test/testFunction.cpp index f27bd8d..c878013 100644 --- a/test/testFunction.cpp +++ b/test/testFunction.cpp @@ -27,15 +27,15 @@ void print_num(int32_t iii) { TEST(TestFunction, NullFunction) { globalValue = 0; // Test contructor value - etk::Function f_display = nullptr; - EXPECT_EQ(f_display, nullptr); + etk::Function f_display = null; + EXPECT_EQ(f_display, null); } TEST(TestFunction, setAFreeFunction) { globalValue = 0; // Test contructor value etk::Function f_display = print_num; - EXPECT_NE(f_display, nullptr); + EXPECT_NE(f_display, null); } TEST(TestFunction, callAFreeFunction) { globalValue = 0; @@ -49,7 +49,7 @@ TEST(TestFunction, setALambda) { globalValue = 0; // Test contructor value etk::Function f_display = []() { print_num(642); };; - EXPECT_NE(f_display, nullptr); + EXPECT_NE(f_display, null); } TEST(TestFunction, callAlLambda) { @@ -82,7 +82,7 @@ TEST(TestFunction, setCallableObject) { // Test contructor value testObject tmp(100000); etk::Function f_display = tmp; - EXPECT_NE(f_display, nullptr); + EXPECT_NE(f_display, null); } TEST(TestFunction, callCallableObject) { @@ -101,7 +101,7 @@ etk::Function createTmpFunction(uint32_t _value) { TEST(TestFunction, setLambdaOnStack) { globalValue = 0; etk::Function f_display = createTmpFunction(87000); - EXPECT_NE(f_display, nullptr); + EXPECT_NE(f_display, null); } TEST(TestFunction, callLambdaOnStack) { @@ -116,13 +116,13 @@ TEST(TestFunction, setAMemberFunction) { globalValue = 0; // Test contructor value etk::Function f_display = &Foo::print_add; - EXPECT_NE(f_display, nullptr); + EXPECT_NE(f_display, null); } TEST(TestFunction, callAMemberFunction) { globalValue = 0; // Test contructor value etk::Function f_display = &Foo::print_add; - EXPECT_NE(f_display, nullptr); + EXPECT_NE(f_display, null); Foo foo(70000); f_display(foo, 16); EXPECT_EQ(globalValue, 16 + 70000); diff --git a/test/testTrait.cpp b/test/testTrait.cpp index 6a578ea..2d6a002 100644 --- a/test/testTrait.cpp +++ b/test/testTrait.cpp @@ -72,15 +72,15 @@ TEST(typeTrait, IsBaseOf_4) { -TEST(typeTrait, isSame_nullptr) { +TEST(typeTrait, isSame_null) { typedef etk::NullPtr type1; auto ret = etk::IsSame::value; EXPECT_EQ(ret, true); } /* -TEST(typeTrait, isSame_nullptr2) { +TEST(typeTrait, isSame_null2) { typedef etk::NullPtr type1; - auto ret = etk::IsSame::value; + auto ret = etk::IsSame::value; EXPECT_EQ(ret, true); } */