From f4349fb3e45bd44cef0e2b69af4c9b4cf35dcf43 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 15 Jun 2018 12:46:15 +0200 Subject: =?UTF-8?q?Run=20clang-tidy=E2=80=99s=20modernize-use-nullptr=20pa?= =?UTF-8?q?ss.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This replaces all NULL or 0 with nullptr when assigned to or returned as a pointer. --- src/trace/imagemap.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/trace/imagemap.cpp') diff --git a/src/trace/imagemap.cpp b/src/trace/imagemap.cpp index a8d8a8c8f..e2e97d5ec 100644 --- a/src/trace/imagemap.cpp +++ b/src/trace/imagemap.cpp @@ -65,7 +65,7 @@ GrayMap *GrayMapCreate(int width, int height) GrayMap *me = (GrayMap *)malloc(sizeof(GrayMap)); if (!me) - return NULL; + return nullptr; /** methods **/ me->setPixel = gSetPixel; @@ -81,7 +81,7 @@ GrayMap *GrayMapCreate(int width, int height) if (!me->pixels) { free(me); - return NULL; + return nullptr; } me->rows = (unsigned long **) malloc(sizeof(unsigned long *) * height); @@ -89,7 +89,7 @@ GrayMap *GrayMapCreate(int width, int height) { free(me->pixels); free(me); - return NULL; + return nullptr; } unsigned long *row = me->pixels; @@ -179,7 +179,7 @@ PackedPixelMap *PackedPixelMapCreate(int width, int height) PackedPixelMap *me = (PackedPixelMap *)malloc(sizeof(PackedPixelMap)); if (!me) - return NULL; + return nullptr; /** methods **/ me->setPixel = ppSetPixel; @@ -195,13 +195,13 @@ PackedPixelMap *PackedPixelMapCreate(int width, int height) me->pixels = (unsigned long *) malloc(sizeof(unsigned long) * width * height); if (!me->pixels){ free(me); - return NULL; + return nullptr; } me->rows = (unsigned long **) malloc(sizeof(unsigned long *) * height); if (!me->rows){ free(me->pixels); //allocated as me->pixels is not NULL here: see previous check free(me); - return NULL; + return nullptr; } unsigned long *row = me->pixels; @@ -288,7 +288,7 @@ RgbMap *RgbMapCreate(int width, int height) RgbMap *me = (RgbMap *)malloc(sizeof(RgbMap)); if (!me){ - return NULL; + return nullptr; } /** methods **/ @@ -305,13 +305,13 @@ RgbMap *RgbMapCreate(int width, int height) me->pixels = (RGB *) malloc(sizeof(RGB) * width * height); if (!me->pixels){ free(me); - return NULL; + return nullptr; } me->rows = (RGB **) malloc(sizeof(RGB *) * height); if (!me->rows){ free(me->pixels); //allocated as me->pixels is not NULL here: see previous check free(me); - return NULL; + return nullptr; } RGB *row = me->pixels; @@ -398,7 +398,7 @@ IndexedMap *IndexedMapCreate(int width, int height) IndexedMap *me = (IndexedMap *)malloc(sizeof(IndexedMap)); if (!me) - return NULL; + return nullptr; /** methods **/ me->setPixel = iSetPixel; @@ -414,13 +414,13 @@ IndexedMap *IndexedMapCreate(int width, int height) me->pixels = (unsigned int *) malloc(sizeof(unsigned int) * width * height); if (!me->pixels){ free(me); - return NULL; + return nullptr; } me->rows = (unsigned int **) malloc(sizeof(unsigned int *) * height); if (!me->rows){ free(me->pixels); //allocated as me->pixels is not NULL here: see previous check free(me); - return NULL; + return nullptr; } unsigned int *row = me->pixels; -- cgit v1.2.3