[DEV] update nullptr in null (specific etk)
This commit is contained in:
parent
3be47493d3
commit
4403e38ab9
@ -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);
|
||||
|
@ -78,7 +78,7 @@ namespace etest {
|
||||
template<class ETEST_TYPE,
|
||||
typename etk::EnableIf<etk::IsSame<ETEST_TYPE,etk::NullPtr>::value, int>::type = 0 >
|
||||
etk::String exportResultToString(const ETEST_TYPE& _element) {
|
||||
return "nullptr";
|
||||
return "null";
|
||||
}
|
||||
template<class ETEST_TYPE,
|
||||
typename etk::EnableIf< !etk::IsSame<ETEST_TYPE,etk::NullPtr>::value
|
||||
@ -161,7 +161,7 @@ namespace etest {
|
||||
}; \
|
||||
\
|
||||
uint32_t TEST_CLASS_NAME(groupName, localName)::registerElement = etest::registerTest(\
|
||||
etk::memory::allocatorNewFull<TEST_CLASS_NAME(groupName, localName)>("etest_test_class", nullptr, __LINE__, __FILE__)); \
|
||||
etk::memory::allocatorNewFull<TEST_CLASS_NAME(groupName, localName)>("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, \
|
||||
|
@ -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<m_memListElementSize; ++iii) {
|
||||
@ -239,7 +239,7 @@ class memoryAllocatorHandle {
|
||||
|
||||
/**
|
||||
* @brief Get a current free element of the structure
|
||||
* @return the free Element find or nullptr
|
||||
* @return the free Element find or null
|
||||
*/
|
||||
MemoryElementSystem* getFreeElement() {
|
||||
for (size_t iii=0; iii<m_memListElementSize; ++iii) {
|
||||
@ -251,9 +251,9 @@ class memoryAllocatorHandle {
|
||||
m_memListElementSize *= 2;
|
||||
ETK_MEMORY_DEBUG("Realloate the allocator memory system: %ld", uint64_t(m_memListElementSize));
|
||||
MemoryElementSystem* tmp = new MemoryElementSystem[m_memListElementSize];
|
||||
if (tmp == nullptr) {
|
||||
if (tmp == null) {
|
||||
m_memListElementSize /= 2;
|
||||
return nullptr;
|
||||
return null;
|
||||
}
|
||||
for (size_t iii=0; iii<m_memListElementSize; ++iii) {
|
||||
tmp[iii].used = false;
|
||||
@ -268,7 +268,7 @@ class memoryAllocatorHandle {
|
||||
return &(m_memListElements[iii]);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* @brief Get the element structure reference if it existed
|
||||
@ -283,7 +283,7 @@ class memoryAllocatorHandle {
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
return null;
|
||||
}
|
||||
|
||||
#if ETK_MEMORY_CHECKER > 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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<m_size; iii++) {
|
||||
@ -792,8 +792,8 @@ namespace etk {
|
||||
if (m_size != _obj.m_size) {
|
||||
return true;
|
||||
}
|
||||
if( m_data == nullptr
|
||||
|| _obj.m_data == nullptr) {
|
||||
if( m_data == null
|
||||
|| _obj.m_data == null) {
|
||||
return false;
|
||||
}
|
||||
for (size_t iii=0; iii<m_size; iii++) {
|
||||
|
@ -9,7 +9,7 @@
|
||||
etk::Exception::Exception():
|
||||
m_type("UNKNOW"),
|
||||
m_what("? ? ?"),
|
||||
m_function(nullptr) {
|
||||
m_function(null) {
|
||||
|
||||
}
|
||||
etk::Exception::Exception(const char* _type, const etk::String& _what, const char* _function):
|
||||
@ -36,7 +36,7 @@ etk::String etk::Exception::toString() const {
|
||||
out += m_type;
|
||||
out += ":";
|
||||
out += m_what;
|
||||
if (m_function != nullptr) {
|
||||
if (m_function != null) {
|
||||
out += " in ";
|
||||
out += m_function;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace etk {
|
||||
* @param[in] _what The explanation of the problem.
|
||||
* @param[in] _function Function name to find faster the source od the problem.
|
||||
*/
|
||||
Exception(const char* _type, const etk::String& _what, const char* _function = nullptr);
|
||||
Exception(const char* _type, const etk::String& _what, const char* _function = null);
|
||||
/**
|
||||
* @brief virtualize destructor.
|
||||
*/
|
||||
@ -45,7 +45,7 @@ namespace etk {
|
||||
const etk::String what() const;
|
||||
/**
|
||||
* @brief Get the Name of the fuction where the exception is generated.
|
||||
* @return Function string or nullptr
|
||||
* @return Function string or null
|
||||
*/
|
||||
const char* where() const;
|
||||
/**
|
||||
@ -63,7 +63,7 @@ namespace etk {
|
||||
* @param[in] _what The explanation of the problem.
|
||||
* @param[in] _function Function name to find faster the source od the problem.
|
||||
*/
|
||||
InvalidArgument(const etk::String& _what, const char* _function = nullptr):
|
||||
InvalidArgument(const etk::String& _what, const char* _function = null):
|
||||
etk::Exception("INVALID-ARGUMENT", _what, _function) {
|
||||
|
||||
}
|
||||
@ -75,7 +75,7 @@ namespace etk {
|
||||
* @param[in] _what The explanation of the problem.
|
||||
* @param[in] _function Function name to find faster the source od the problem.
|
||||
*/
|
||||
DomainError(const etk::String& _what, const char* _function = nullptr):
|
||||
DomainError(const etk::String& _what, const char* _function = null):
|
||||
etk::Exception("DOMAIN-ERROR", _what, _function) {
|
||||
|
||||
}
|
||||
@ -87,7 +87,7 @@ namespace etk {
|
||||
* @param[in] _what The explanation of the problem.
|
||||
* @param[in] _function Function name to find faster the source od the problem.
|
||||
*/
|
||||
LengthError(const etk::String& _what, const char* _function = nullptr):
|
||||
LengthError(const etk::String& _what, const char* _function = null):
|
||||
etk::Exception("LENGTH-ERROR", _what, _function) {
|
||||
|
||||
}
|
||||
@ -99,7 +99,7 @@ namespace etk {
|
||||
* @param[in] _what The explanation of the problem.
|
||||
* @param[in] _function Function name to find faster the source od the problem.
|
||||
*/
|
||||
OutOfRange(const etk::String& _what, const char* _function = nullptr):
|
||||
OutOfRange(const etk::String& _what, const char* _function = null):
|
||||
etk::Exception("OUT-OF-RANGE", _what, _function) {
|
||||
|
||||
}
|
||||
@ -111,7 +111,7 @@ namespace etk {
|
||||
* @param[in] _what The explanation of the problem.
|
||||
* @param[in] _function Function name to find faster the source od the problem.
|
||||
*/
|
||||
RangeError(const etk::String& _what, const char* _function = nullptr):
|
||||
RangeError(const etk::String& _what, const char* _function = null):
|
||||
etk::Exception("RANGE-ERROR", _what, _function) {
|
||||
|
||||
}
|
||||
@ -123,7 +123,7 @@ namespace etk {
|
||||
* @param[in] _what The explanation of the problem.
|
||||
* @param[in] _function Function name to find faster the source od the problem.
|
||||
*/
|
||||
OverflowError(const etk::String& _what, const char* _function = nullptr):
|
||||
OverflowError(const etk::String& _what, const char* _function = null):
|
||||
etk::Exception("OVERFLOW-ERROR", _what, _function) {
|
||||
|
||||
}
|
||||
@ -135,7 +135,7 @@ namespace etk {
|
||||
* @param[in] _what The explanation of the problem.
|
||||
* @param[in] _function Function name to find faster the source od the problem.
|
||||
*/
|
||||
UnderflowError(const etk::String& _what, const char* _function = nullptr):
|
||||
UnderflowError(const etk::String& _what, const char* _function = null):
|
||||
etk::Exception("UNDERFLOW-ERROR", _what, _function) {
|
||||
|
||||
}
|
||||
@ -147,7 +147,7 @@ namespace etk {
|
||||
* @param[in] _what The explanation of the problem.
|
||||
* @param[in] _function Function name to find faster the source od the problem.
|
||||
*/
|
||||
CastError(const etk::String& _what, const char* _function = nullptr):
|
||||
CastError(const etk::String& _what, const char* _function = null):
|
||||
etk::Exception("CAST-ERROR", _what, _function) {
|
||||
|
||||
}
|
||||
@ -159,7 +159,7 @@ namespace etk {
|
||||
* @param[in] _what The explanation of the problem.
|
||||
* @param[in] _function Function name to find faster the source od the problem.
|
||||
*/
|
||||
AllocationError(const etk::String& _what, const char* _function = nullptr):
|
||||
AllocationError(const etk::String& _what, const char* _function = null):
|
||||
etk::Exception("ALLOCATION-ERROR", _what, _function) {
|
||||
|
||||
}
|
||||
@ -171,7 +171,7 @@ namespace etk {
|
||||
* @param[in] _what The explanation of the problem.
|
||||
* @param[in] _function Function name to find faster the source od the problem.
|
||||
*/
|
||||
RuntimeError(const etk::String& _what, const char* _function = nullptr):
|
||||
RuntimeError(const etk::String& _what, const char* _function = null):
|
||||
etk::Exception("RUNTIME-ERROR", _what, _function) {
|
||||
|
||||
}
|
||||
@ -183,7 +183,7 @@ namespace etk {
|
||||
* @param[in] _what The explanation of the problem.
|
||||
* @param[in] _function Function name to find faster the source od the problem.
|
||||
*/
|
||||
NullPointerError(const etk::String& _what, const char* _function = nullptr):
|
||||
NullPointerError(const etk::String& _what, const char* _function = null):
|
||||
etk::Exception("NULL-POINTER-ERROR", _what, _function) {
|
||||
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace etk {
|
||||
virtual ETK_TYPE_FUNCTION_RETURN operator()(ETK_TYPE_FUNCTION_ARGS... _args) const = 0;
|
||||
virtual FunctionPrivate<ETK_TYPE_FUNCTION_RETURN(ETK_TYPE_FUNCTION_ARGS...)>* 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 {
|
||||
|
34
etk/Map.hpp
34
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<ETK_MAP_TYPE_KEY, ETK_MAP_TYPE_DATA>* 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; iii<m_data.size(); iii++) {
|
||||
if (m_data[iii] != nullptr) {
|
||||
if (m_data[iii] != null) {
|
||||
if (m_data[iii]->first == _key) {
|
||||
return iii;
|
||||
}
|
||||
@ -437,7 +437,7 @@ namespace etk {
|
||||
int64_t elementId = getId(_key);
|
||||
if (elementId <0) {
|
||||
etk::Pair<ETK_MAP_TYPE_KEY, ETK_MAP_TYPE_DATA>* 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<ETK_MAP_TYPE_KEY, ETK_MAP_TYPE_DATA>* 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<ETK_MAP_TYPE_KEY> getKeys() const {
|
||||
etk::Vector<ETK_MAP_TYPE_KEY> 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; iii<m_data.size(); iii++) {
|
||||
if (m_data[iii] == nullptr) {
|
||||
if (m_data[iii] == null) {
|
||||
continue;
|
||||
}
|
||||
if (m_data[iii]->first == _key) {
|
||||
|
@ -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
|
||||
|
||||
|
@ -1027,7 +1027,7 @@ template<class CLASS_TYPE> class NodePTheseElement : public Node<CLASS_TYPE> {
|
||||
// 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 CLASS_TYPE> class NodePTheseElement : public Node<CLASS_TYPE> {
|
||||
Node<CLASS_TYPE>::copyData(&_obj);
|
||||
for (auto it : m_subNode) {
|
||||
ETK_DELETE(Node<CLASS_TYPE>, 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 CLASS_TYPE> class NodePTheseElement : public Node<CLASS_TYPE> {
|
||||
~NodePTheseElement() {
|
||||
for (auto it : m_subNode) {
|
||||
ETK_DELETE(Node<CLASS_TYPE>, it);
|
||||
it = nullptr;
|
||||
it = null;
|
||||
}
|
||||
m_subNode.clear();
|
||||
};
|
||||
@ -1419,7 +1419,7 @@ template<class CLASS_TYPE> class NodePThese : public Node<CLASS_TYPE> {
|
||||
~NodePThese() {
|
||||
for (auto it : m_subNode) {
|
||||
ETK_DELETE(Node<CLASS_TYPE>, it);
|
||||
it = nullptr;
|
||||
it = null;
|
||||
}
|
||||
m_subNode.clear();
|
||||
}
|
||||
@ -1436,7 +1436,7 @@ template<class CLASS_TYPE> class NodePThese : public Node<CLASS_TYPE> {
|
||||
// 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 CLASS_TYPE> class NodePThese : public Node<CLASS_TYPE> {
|
||||
Node<CLASS_TYPE>::copyData(&_obj);
|
||||
for (auto it : m_subNode) {
|
||||
ETK_DELETE(Node<CLASS_TYPE>, 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 CLASS_TYPE> 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 CLASS_TYPE> class RegEx {
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
if (find != nullptr) {
|
||||
if (find != null) {
|
||||
(void)input;
|
||||
TK_ERROR("can not have : '" << find << "' inside " << input << " element");
|
||||
return false;
|
||||
|
16
etk/Set.hpp
16
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<typename... ETK_SET_TYPE_2>
|
||||
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; iii<m_data.size(); ++iii) {
|
||||
if (_key == m_data[iii]) {
|
||||
return;
|
||||
|
@ -14,7 +14,7 @@ etk::Stream::Stream(size_t _basicSize) :
|
||||
|
||||
etk::Stream::~Stream() {
|
||||
ETK_DELETE(etk::String, m_data);
|
||||
m_data = nullptr;
|
||||
m_data = null;
|
||||
}
|
||||
|
||||
etk::Stream& etk::Stream::operator<< (const char* _data) {
|
||||
@ -73,7 +73,7 @@ etk::Stream& etk::Stream::operator<< (const double& _data) {
|
||||
return *this;
|
||||
}
|
||||
etk::Stream& etk::Stream::operator<< (const etk::NullPtr& _data) {
|
||||
*m_data += "nullptr";
|
||||
*m_data += "null";
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ etk::String::String(const etk::String& _obj, size_t _pos, size_t _size) {
|
||||
}
|
||||
|
||||
etk::String::String(const char* _obj) {
|
||||
if (_obj == nullptr) {
|
||||
if (_obj == null) {
|
||||
resize(0);
|
||||
return;
|
||||
}
|
||||
@ -102,7 +102,7 @@ etk::String::String(const etk::String _obj) {
|
||||
*/
|
||||
|
||||
etk::String::String(const char* _obj, size_t _size) {
|
||||
if ( _obj == nullptr
|
||||
if ( _obj == null
|
||||
|| _size == 0) {
|
||||
resize(0);
|
||||
return;
|
||||
@ -164,7 +164,7 @@ etk::String& etk::String::operator=(const etk::String& _obj) {
|
||||
|
||||
etk::String& etk::String::operator=(const char* _obj) {
|
||||
clear();
|
||||
if (_obj == nullptr) {
|
||||
if (_obj == null) {
|
||||
return *this;
|
||||
}
|
||||
size_t numberElement = strlen(_obj);
|
||||
@ -195,7 +195,7 @@ etk::String& etk::String::operator+= (const etk::String& _obj) {
|
||||
}
|
||||
|
||||
etk::String& etk::String::operator+= (const char* _obj) {
|
||||
if (_obj == nullptr) {
|
||||
if (_obj == null) {
|
||||
return *this;
|
||||
}
|
||||
size_t numberElement = strlen(_obj);
|
||||
@ -240,7 +240,7 @@ void etk::String::pushBack(const char _item) {
|
||||
}
|
||||
|
||||
void etk::String::pushBack(const char* _item, size_t _nbElement) {
|
||||
if (_item == nullptr) {
|
||||
if (_item == null) {
|
||||
return;
|
||||
}
|
||||
size_t idElement = size();
|
||||
|
@ -31,7 +31,7 @@ namespace etk {
|
||||
*/
|
||||
Iterator():
|
||||
m_current(0),
|
||||
m_string(nullptr) {
|
||||
m_string(null) {
|
||||
// nothing to do ...
|
||||
}
|
||||
/**
|
||||
@ -58,7 +58,7 @@ namespace etk {
|
||||
*/
|
||||
~Iterator() {
|
||||
m_current = 0;
|
||||
m_string = nullptr;
|
||||
m_string = null;
|
||||
}
|
||||
/**
|
||||
* @brief basic boolean cast
|
||||
@ -72,7 +72,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++;
|
||||
@ -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--;
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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--;
|
||||
}
|
||||
|
@ -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<typename... ETK_VECTOR_TYPE_2>
|
||||
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<ETK_VECTOR_TYPE>& _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<m_size; iii++) {
|
||||
m_data[iii].~ETK_VECTOR_TYPE();
|
||||
#ifdef DEBUG
|
||||
@ -324,7 +324,7 @@ namespace etk {
|
||||
#endif
|
||||
}
|
||||
ETK_FREE(char, m_data);
|
||||
m_data = nullptr;
|
||||
m_data = null;
|
||||
}
|
||||
m_allocated = 0;
|
||||
m_size = 0;
|
||||
@ -491,7 +491,7 @@ namespace etk {
|
||||
* @param[in] _nbElement Number of element to add.
|
||||
*/
|
||||
void pushBack(const ETK_VECTOR_TYPE * _item, size_t _nbElement) {
|
||||
if (_item == nullptr) {
|
||||
if (_item == null) {
|
||||
return;
|
||||
}
|
||||
reserve(m_size+_nbElement);
|
||||
@ -847,10 +847,10 @@ namespace etk {
|
||||
}
|
||||
//TK_INFO("Change vector allocation : " << m_allocated << "==>" << 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<m_size; iii++) {
|
||||
@ -939,8 +939,8 @@ namespace etk {
|
||||
if (m_size != _obj.m_size) {
|
||||
return true;
|
||||
}
|
||||
if( m_data == nullptr
|
||||
|| _obj.m_data == nullptr) {
|
||||
if( m_data == null
|
||||
|| _obj.m_data == null) {
|
||||
return false;
|
||||
}
|
||||
for (size_t iii=0; iii<m_size; iii++) {
|
||||
|
@ -63,13 +63,13 @@ void etk::Archive::display() {
|
||||
}
|
||||
|
||||
etk::Archive* etk::Archive::load(const etk::String& _fileName) {
|
||||
etk::Archive* output=nullptr;
|
||||
etk::Archive* output=null;
|
||||
etk::String tmpName = _fileName.toLower();
|
||||
// select the corect Loader :
|
||||
if( tmpName.endWith(".zip") == true
|
||||
|| tmpName.endWith(".apk") == true ) {
|
||||
output = ETK_NEW(etk::archive::Zip, _fileName);
|
||||
if (output == nullptr) {
|
||||
if (output == null) {
|
||||
TK_ERROR("An error occured when load archive : " << _fileName);
|
||||
}
|
||||
} else {
|
||||
@ -79,11 +79,11 @@ etk::Archive* etk::Archive::load(const etk::String& _fileName) {
|
||||
}
|
||||
|
||||
etk::Archive* etk::Archive::loadPackage(const etk::String& _fileName) {
|
||||
etk::Archive* output=nullptr;
|
||||
etk::Archive* output=null;
|
||||
FILE* file = fopen(_fileName.c_str(), "rb");
|
||||
if (file == nullptr) {
|
||||
if (file == null) {
|
||||
TK_ERROR("Can not open file : '" << _fileName);
|
||||
return nullptr;
|
||||
return null;
|
||||
}
|
||||
// move to end - 16 bytes:
|
||||
fseek(file, -8, SEEK_END);
|
||||
@ -100,12 +100,12 @@ etk::Archive* etk::Archive::loadPackage(const etk::String& _fileName) {
|
||||
if (etk::String(plop) != "***START DATA***") {
|
||||
TK_ERROR("Error in the tag file : '" << plop << "'");
|
||||
fclose(file);
|
||||
return nullptr;
|
||||
return null;
|
||||
}
|
||||
fclose(file);
|
||||
file = nullptr;
|
||||
file = null;
|
||||
output = ETK_NEW(etk::archive::Zip, _fileName, position);
|
||||
if (nullptr==output) {
|
||||
if (null==output) {
|
||||
TK_ERROR("An error occured when load archive : " << _fileName);
|
||||
}
|
||||
return output;
|
||||
|
@ -15,7 +15,7 @@ ETK_DECLARE_TYPE(etk::archive::Zip);
|
||||
|
||||
etk::archive::Zip::Zip(const etk::String& _fileName, uint64_t _offset) :
|
||||
etk::Archive(_fileName),
|
||||
m_ctx(nullptr) {
|
||||
m_ctx(null) {
|
||||
/* Open the zip file */
|
||||
m_ctx = unzOpenOffset(m_fileName.c_str(), _offset);
|
||||
if(!m_ctx) {
|
||||
@ -33,7 +33,7 @@ etk::archive::Zip::Zip(const etk::String& _fileName, uint64_t _offset) :
|
||||
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;
|
||||
}
|
||||
@ -54,9 +54,9 @@ etk::archive::Zip::Zip(const etk::String& _fileName, uint64_t _offset) :
|
||||
}
|
||||
|
||||
etk::archive::Zip::~Zip() {
|
||||
if (m_ctx!= nullptr) {
|
||||
if (m_ctx!= null) {
|
||||
unzClose(m_ctx);
|
||||
m_ctx = nullptr;
|
||||
m_ctx = null;
|
||||
};
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ void etk::archive::Zip::loadFile(const etk::Map<etk::String, ArchiveContent>::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<etk::String, ArchiveContent>::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;
|
||||
}
|
||||
|
@ -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<T>(_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<T>(_width*_heigh) {
|
||||
if (_defaultVal == nullptr) {
|
||||
if (_defaultVal == null) {
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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<etk::FSNode *>& _list) {
|
||||
etk::Vector<etk::FSNode *> tmpList = _list;
|
||||
_list.clear();
|
||||
for(size_t iii=0; iii<tmpList.size(); iii++) {
|
||||
if (nullptr != tmpList[iii]) {
|
||||
if (null != tmpList[iii]) {
|
||||
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]!=nullptr) {
|
||||
if (_list[jjj]!=null) {
|
||||
// TODO : Do something better : this methode is a litthe hard!!!
|
||||
if (etk::toUpper(tmpList[iii]->getNameFile()) > etk::toUpper(_list[jjj]->getNameFile())) {
|
||||
findPos = jjj+1;
|
||||
@ -742,15 +742,15 @@ void etk::FSNode::sortElementList(etk::Vector<etk::FSNode *>& _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 *> 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 *> etk::FSNode::folderGetSubList(bool _showHidenFile, bo
|
||||
etk::Vector<etk::String> 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 *> 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 *> 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 *> 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::String> etk::FSNode::folderGetSub(bool _getFolder, bool _getFil
|
||||
#endif
|
||||
etk::Vector<etk::String> 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::String> etk::FSNode::folderGetSub(bool _getFolder, bool _getFil
|
||||
etk::Vector<etk::String> 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::String> 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<etk::String>& _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; iii<s_APKArchive->size(); iii++) {
|
||||
@ -1789,13 +1789,13 @@ void etk::FSNode::folderGetRecursiveFiles(etk::Vector<etk::String>& _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<etk::String>& _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<etk::String>& _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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
16
etk/utf8.hpp
16
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) {
|
||||
|
@ -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();
|
||||
}
|
||||
*/
|
||||
|
@ -27,15 +27,15 @@ void print_num(int32_t iii) {
|
||||
TEST(TestFunction, NullFunction) {
|
||||
globalValue = 0;
|
||||
// Test contructor value
|
||||
etk::Function<void(int)> f_display = nullptr;
|
||||
EXPECT_EQ(f_display, nullptr);
|
||||
etk::Function<void(int)> f_display = null;
|
||||
EXPECT_EQ(f_display, null);
|
||||
}
|
||||
|
||||
TEST(TestFunction, setAFreeFunction) {
|
||||
globalValue = 0;
|
||||
// Test contructor value
|
||||
etk::Function<void(int32_t)> 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<void()> 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<void(int32_t)> f_display = tmp;
|
||||
EXPECT_NE(f_display, nullptr);
|
||||
EXPECT_NE(f_display, null);
|
||||
}
|
||||
|
||||
TEST(TestFunction, callCallableObject) {
|
||||
@ -101,7 +101,7 @@ etk::Function<void(int32_t)> createTmpFunction(uint32_t _value) {
|
||||
TEST(TestFunction, setLambdaOnStack) {
|
||||
globalValue = 0;
|
||||
etk::Function<void(int32_t)> 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<void(const Foo&, int)> 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<void(const Foo&, int)> 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);
|
||||
|
@ -72,15 +72,15 @@ TEST(typeTrait, IsBaseOf_4) {
|
||||
|
||||
|
||||
|
||||
TEST(typeTrait, isSame_nullptr) {
|
||||
TEST(typeTrait, isSame_null) {
|
||||
typedef etk::NullPtr type1;
|
||||
auto ret = etk::IsSame<etk::NullPtr, type1>::value;
|
||||
EXPECT_EQ(ret, true);
|
||||
}
|
||||
/*
|
||||
TEST(typeTrait, isSame_nullptr2) {
|
||||
TEST(typeTrait, isSame_null2) {
|
||||
typedef etk::NullPtr type1;
|
||||
auto ret = etk::IsSame<nullptr, type1>::value;
|
||||
auto ret = etk::IsSame<null, type1>::value;
|
||||
EXPECT_EQ(ret, true);
|
||||
}
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user