Host library for controlling a WiConnect enabled Wi-Fi module.
Dependents: wiconnect-ota_example wiconnect-web_setup_example wiconnect-test-console wiconnect-tcp_server_example ... more
Diff: internal/types/File.cpp
- Revision:
- 6:8a87a59d0d21
- Parent:
- 1:6ec9998427ad
- Child:
- 16:7f1d6d359787
--- a/internal/types/File.cpp Mon Aug 11 04:00:39 2014 -0700 +++ b/internal/types/File.cpp Mon Aug 11 13:55:07 2014 -0700 @@ -9,7 +9,6 @@ */ -#include <assert.h> #include "Wiconnect.h" #include "internal/common.h" @@ -33,12 +32,12 @@ if(rxBuffer_ == NULL) { #ifdef WICONNECT_ENABLE_MALLOC - assert(wiconnect->_malloc != NULL); + wiconnect_assert(wiconnect, "File(), malloc not defined", wiconnect->_malloc != NULL); rxBuffer.buffer = (uint8_t*)wiconnect->_malloc(rxBufferLen); - assert(rxBuffer.buffer != NULL); + wiconnect_assert(wiconnect, "File(), failed to malloc buffer", rxBuffer.buffer != NULL); rxBuffer.allocated = true; #else - assert(0); + wiconnect_assert(0); #endif } } @@ -63,7 +62,7 @@ #ifdef WICONNECT_ENABLE_MALLOC if(rxBuffer.allocated && rxBuffer.size > 0) { - assert(wiconnect->_free != NULL); + wiconnect_assert(wiconnect, "~File(), free not defined", wiconnect->_free != NULL); wiconnect->_free(rxBuffer.buffer); } #endif @@ -115,14 +114,16 @@ /*************************************************************************************************/ void* File::operator new(size_t size) { - assert(Wiconnect::getInstance()->_malloc != NULL); + Wiconnect *wiconnect = Wiconnect::getInstance(); + wiconnect_assert(wiconnect, "File:new, malloc not defined", wiconnect->_malloc != NULL); return Wiconnect::getInstance()->_malloc(size); } /*************************************************************************************************/ void File::operator delete(void* ptr) { - assert(Wiconnect::getInstance()->_free != NULL); + Wiconnect *wiconnect = Wiconnect::getInstance(); + wiconnect_assert(wiconnect, "File:delete, free not defined", wiconnect->_free != NULL); Wiconnect::getInstance()->_free(ptr); }