[DEV] update nullptr in null (specific etk)

This commit is contained in:
Edouard DUPIN 2018-06-19 22:15:52 +02:00
parent 8779e2011a
commit 8ef121b698
5 changed files with 95 additions and 95 deletions

View File

@ -81,7 +81,7 @@ int32_t egami::getFormatColorSize(enum colorType _type) {
}
egami::Image::Image() :
m_data(nullptr) {
m_data(null) {
}
@ -102,9 +102,9 @@ egami::Image::~Image() {
egami::Image::Image(const ivec2& _size,
enum colorType _type,
const void* _dataToCopy) :
m_data(nullptr) {
m_data(null) {
configure(_size, _type);
if (_dataToCopy != nullptr) {
if (_dataToCopy != null) {
memcpy(getTextureDataPointer(), _dataToCopy, getSize().x()*getSize().y()*egami::getFormatColorSize(getType()));
}
}
@ -118,7 +118,7 @@ void egami::Image::swap(egami::Image& _obj) {
void egami::Image::configure(const ivec2& _size, enum colorType _type) {
switch (_type) {
case egami::colorType::undefined:
m_data = nullptr;
m_data = null;
break;
case egami::colorType::RGBA8:
m_data = ememory::makeShared<egami::ImageTemplate<etk::Color<uint8_t, 4>>>(_size);
@ -148,75 +148,75 @@ void egami::Image::configure(const ivec2& _size, enum colorType _type) {
}
enum egami::colorType egami::Image::getType() const {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return egami::colorType::undefined;
}
return m_data->getType();
}
void* egami::Image::getTextureDataPointer() const{
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
return nullptr;
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return null;
}
return (void*)m_data->getTextureDataPointer();
}
void egami::Image::resize(const ivec2& _size, const ivec2& _startPos) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
m_data->resize2(_size, _startPos);
}
void egami::Image::resize(const ivec2& _size, const etk::Color<>& _color, const ivec2& _startPos) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
m_data->resize(_size, _color, _startPos);
}
void egami::Image::resize(const ivec2& _size, const etk::Color<float>& _color, const ivec2& _startPos) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
m_data->resize(_size, _color, _startPos);
}
void egami::Image::resize(const ivec2& _size, const etk::Color<uint16_t, 1>& _color, const ivec2& _startPos) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
m_data->resize(_size, _color, _startPos);
}
void egami::Image::resize(const ivec2& _size, const etk::Color<uint32_t, 1>& _color, const ivec2& _startPos) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
m_data->resize(_size, _color, _startPos);
}
void egami::Image::resize(const ivec2& _size, const etk::Color<float, 1>& _color, const ivec2& _startPos) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
m_data->resize(_size, _color, _startPos);
}
void egami::Image::resize(const ivec2& _size, const etk::Color<double, 1>& _color, const ivec2& _startPos) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
m_data->resize(_size, _color, _startPos);
}
const ivec2& egami::Image::getSize() const {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
static const ivec2 error(0,0);
return error;
}
@ -244,8 +244,8 @@ const ivec2& egami::Image::getSize() const {
#endif
ivec2 egami::Image::getGPUSize() const {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
static const ivec2 error(0,0);
return error;
}
@ -259,16 +259,16 @@ ivec2 egami::Image::getGPUSize() const {
}
int32_t egami::Image::getWidth() const {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return 0;
}
return m_data->getWidth();
}
int32_t egami::Image::getHeight() const {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return 0;
}
return m_data->getHeight();
@ -276,70 +276,70 @@ int32_t egami::Image::getHeight() const {
void egami::Image::scale(const ivec2& _size) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
resize(_size);
}
void egami::Image::clear(const etk::Color<>& _color) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
m_data->clear();
};
void egami::Image::clear(const etk::Color<float>& _color) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
m_data->clear();
};
void egami::Image::clear(const etk::Color<uint16_t, 1>& _color) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
m_data->clear();
};
void egami::Image::clear(const etk::Color<uint32_t, 1>& _color) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
m_data->clear();
};
void egami::Image::clear(const etk::Color<float, 1>& _color) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
m_data->clear();
};
void egami::Image::clear(const etk::Color<double, 1>& _color) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
m_data->clear();
};
etk::Color<> egami::Image::get(const ivec2& _pos) const {
if (m_data == nullptr) {
if (m_data == null) {
return etk::Color<>(0,0,0,0);
}
return m_data->get(_pos);;
}
void egami::Image::insert(const ivec2& _pos, const egami::Image& _input) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
if (_input.m_data == nullptr) {
EGAMI_DEBUG("No input data for image (nullptr)");
if (_input.m_data == null) {
EGAMI_DEBUG("No input data for image (null)");
return;
}
enum colorType destType = m_data->getType();
@ -357,64 +357,64 @@ void egami::Image::insert(const ivec2& _pos, const egami::Image& _input) {
}
void egami::Image::set(const ivec2& _pos, const etk::Color<>& _newColor) {
if (m_data == nullptr) {
EGAMI_WARNING("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_WARNING("No internal data for image (null)");
return;
}
m_data->set(_pos, _newColor);
}
void egami::Image::set(const ivec2& _pos, const etk::Color<float>& _newColor) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
m_data->set(_pos, _newColor);
}
void egami::Image::set(const ivec2& _pos, const etk::Color<uint16_t, 1>& _newColor) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
m_data->set(_pos, _newColor);
}
void egami::Image::set(const ivec2& _pos, const etk::Color<uint32_t, 1>& _newColor) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
m_data->set(_pos, _newColor);
}
void egami::Image::set(const ivec2& _pos, const etk::Color<float, 1>& _newColor) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
m_data->set(_pos, _newColor);
}
void egami::Image::set(const ivec2& _pos, const etk::Color<double, 1>& _newColor) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
m_data->set(_pos, _newColor);
}
void egami::Image::set(const etk::Vector<etk::Color<float,4>>& _data, const ivec2& _size) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
m_data->set(_data, _size);
}
void egami::Image::set(const etk::Vector<etk::Color<uint8_t,4>>& _data, const ivec2& _size) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
if (m_data == null) {
EGAMI_DEBUG("No internal data for image (null)");
return;
}
m_data->set(_data, _size);

View File

@ -38,7 +38,7 @@ namespace egami {
ImagePrivate() {};
virtual ~ImagePrivate() {};
virtual void* getTextureDataPointer() const {
return nullptr;
return null;
};
virtual const ivec2& getSize() const = 0;
virtual int32_t getWidth() const {
@ -83,7 +83,7 @@ namespace egami {
Image& operator=(const egami::Image& _image);
Image(const ivec2& _size,
enum colorType _type = egami::colorType::undefined,
const void* _dataToCopy = nullptr);
const void* _dataToCopy = null);
~Image();
// TODO : IMplement move operator ... and copy operator...
public:
@ -92,7 +92,7 @@ namespace egami {
void* getTextureDataPointer() const;
enum colorType getType() const;
bool exist() {
return m_data != nullptr;
return m_data != null;
}
void swap(egami::Image& _obj);
// -----------------------------------------------

View File

@ -224,7 +224,7 @@ bool egami::storeJPG(etk::Vector<uint8_t>& _buffer, const egami::Image& _inputIm
jpeg_stdio_dest(&cinfo, outfile);
#else
/*
uint8_t* rgba = nullptr;
uint8_t* rgba = null;
unsigned long size = 0;
etk::Vector<uint8_t> buffer.
jpeg_mem_dest(jpegdata, &rgba, &size);
@ -234,11 +234,11 @@ bool egami::storeJPG(etk::Vector<uint8_t>& _buffer, const egami::Image& _inputIm
buffer[iii] = rgba[iii];
}
free(rgba);
rgba = nullptr;
rgba = null;
}
*/
jpeg_stdio_dest(&cinfo, nullptr);
if (cinfo.dest == nullptr) {
jpeg_stdio_dest(&cinfo, null);
if (cinfo.dest == null) {
EGAMI_ERROR("Can not write the destination property callback");
return false;
}

View File

@ -71,21 +71,21 @@ namespace egami {
// we must change the access of the IO of the png lib :
static void local_ReadData(png_structp _pngPtr, png_bytep _data, png_size_t _length) {
egami::ReaderInstance* instance = static_cast<egami::ReaderInstance*>(png_get_io_ptr(_pngPtr));
if (instance != nullptr) {
if (instance != null) {
instance->read(_data, _length);
}
}
static void Local_WriteData(png_structp _pngPtr, png_bytep _data, png_size_t _length) {
egami::ReaderInstance* instance = static_cast<egami::ReaderInstance*>(png_get_io_ptr(_pngPtr));
if (instance != nullptr) {
if (instance != null) {
instance->write(_data, _length);
}
}
static void local_FlushData(png_structp _pngPtr) {
egami::ReaderInstance* instance = static_cast<egami::ReaderInstance*>(png_get_io_ptr(_pngPtr));
if (instance != nullptr) {
if (instance != null) {
instance->flush();
}
}
@ -110,7 +110,7 @@ static egami::Image genericLoader(png_structp _pngPtr, png_infop _infoPtr) {
int bit_depth = 0;
int colorType = 0;
int interlace_type = 0;
png_get_IHDR(_pngPtr, _infoPtr, &width, &height, &bit_depth, &colorType, &interlace_type, nullptr, nullptr);
png_get_IHDR(_pngPtr, _infoPtr, &width, &height, &bit_depth, &colorType, &interlace_type, null, null);
// reallocate the image
EGAMI_ERROR("Load PNG image : (" << width << "," << height << ") bitDepth=" << bit_depth << " colorType=" << colorType);
switch (colorType) {
@ -187,7 +187,7 @@ static egami::Image genericLoader(png_structp _pngPtr, png_infop _infoPtr) {
png_bytep row_pointers[height];
/* Clear the pointer array */
for (png_uint_32 row = 0; row < height; row++) {
row_pointers[row] = nullptr;
row_pointers[row] = null;
}
for (png_uint_32 row = 0; row < height; row++) {
row_pointers[row] = (png_bytep)png_malloc(_pngPtr, png_get_rowbytes(_pngPtr, _infoPtr));
@ -262,7 +262,7 @@ static egami::Image genericLoader(png_structp _pngPtr, png_infop _infoPtr) {
return egami::Image();
}
// Clean up after the read, and free any memory allocated - REQUIRED
png_destroy_read_struct(&_pngPtr, &_infoPtr, nullptr);
png_destroy_read_struct(&_pngPtr, &_infoPtr, null);
return out;
}
@ -292,15 +292,15 @@ egami::Image egami::loadPNG(const etk::String& _inputFile) {
// PNG read setup
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, userErrorFunction, userWarningFunction);
if (png_ptr == nullptr) {
if (png_ptr == null) {
EGAMI_ERROR("Can not Allocate PNG structure");
fileName.fileClose();
return out;
}
png_infop info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == nullptr) {
if (info_ptr == null) {
EGAMI_ERROR("Can not Allocate PNG info structure");
png_destroy_read_struct(&png_ptr, nullptr, nullptr);
png_destroy_read_struct(&png_ptr, null, null);
fileName.fileClose();
return out;
}
@ -308,7 +308,7 @@ egami::Image egami::loadPNG(const etk::String& _inputFile) {
if (setjmp(png_jmpbuf(png_ptr))) {
EGAMI_ERROR(" Can not set the JUMP buffer adresses");
// Free all of the memory associated with the png_ptr and info_ptr
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
png_destroy_read_struct(&png_ptr, &info_ptr, null);
fileName.fileClose();
return false;
}
@ -334,15 +334,15 @@ egami::Image egami::loadPNG(const etk::Vector<uint8_t>& _buffer) {
}
// PNG read setup
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, userErrorFunction, userWarningFunction);
if (png_ptr == nullptr) {
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, null, userErrorFunction, userWarningFunction);
if (png_ptr == null) {
EGAMI_ERROR("Can not Allocate PNG structure");
return out;
}
png_infop info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == nullptr) {
if (info_ptr == null) {
EGAMI_ERROR("Can not Allocate PNG info structure");
png_destroy_read_struct(&png_ptr, nullptr, nullptr);
png_destroy_read_struct(&png_ptr, null, null);
return out;
}
egami::ReaderInstanceBuffer tmpNode(_buffer, 8);
@ -417,14 +417,14 @@ bool genericWriter(png_structp png_ptr, png_infop info_ptr, const egami::Image&
bool egami::storePNG(etk::Vector<uint8_t>& _buffer, const egami::Image& _inputImage) {
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, userErrorFunction, userWarningFunction);
if (png_ptr == nullptr) {
if (png_ptr == null) {
EGAMI_ERROR("Can not Allocate PNG structure");
return false;
}
png_infop info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == nullptr) {
if (info_ptr == null) {
EGAMI_ERROR("Can not Allocate PNG info structure");
png_destroy_write_struct(&png_ptr, nullptr);
png_destroy_write_struct(&png_ptr, null);
return false;
}
if (setjmp(png_jmpbuf(png_ptr))) {
@ -451,14 +451,14 @@ bool egami::storePNG(const etk::String& _fileName, const egami::Image& _inputIma
return false;
}
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, userErrorFunction, userWarningFunction);
if (png_ptr == nullptr) {
if (png_ptr == null) {
EGAMI_ERROR("Can not Allocate PNG structure");
return false;
}
png_infop info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == nullptr) {
if (info_ptr == null) {
EGAMI_ERROR("Can not Allocate PNG info structure");
png_destroy_write_struct(&png_ptr, nullptr);
png_destroy_write_struct(&png_ptr, null);
fileName.fileClose();
return false;
}

View File

@ -76,14 +76,14 @@ namespace appl {
APPL_INFO("==> START ... (BEGIN)");
ememory::SharedPtr<appl::MainWindows> basicWindows = appl::MainWindows::create();
if (basicWindows == nullptr) {
if (basicWindows == null) {
APPL_ERROR("Can not allocate the basic windows");
return;
}
basicWindows->setListOfFiles(m_listFiles);
// create the specific windows
_context.setWindows(basicWindows);
if (basicWindows == nullptr) {
if (basicWindows == null) {
APPL_ERROR("Can not allocate the basic windows");
_context.exit(-1);
return;