From 9c85c887b7a3f273db65cb79fb2ae597c21918ac Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Mon, 17 Nov 2025 22:25:24 +0300
Subject: [PATCH] fixed several -Wzero-as-null-pointer-constant warnings from
gcc-15
---
src/nanosvg.h | 28 ++++++++++++++--------------
src/nanosvgrast.h | 2 +-
src/stb_image.h | 8 ++++----
3 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/nanosvg.h b/src/nanosvg.h
index 1049fe4e6..63b1c5efc 100644
--- a/src/nanosvg.h
+++ b/src/nanosvg.h
@@ -229,7 +229,7 @@ NSVG_EXPORT void nsvgDelete(NSVGimage* image);
static int nsvg__isspace(char c)
{
- return strchr(" \t\n\v\f\r", c) != 0;
+ return strchr(" \t\n\v\f\r", c) != NULL;
}
static int nsvg__isdigit(char c)
@@ -325,8 +325,8 @@ static void nsvg__parseElement(char* s,
}
// List terminator
- attr[nattr++] = 0;
- attr[nattr++] = 0;
+ attr[nattr++] = NULL;
+ attr[nattr++] = NULL;
// Call callbacks.
if (start && startelCb)
@@ -2313,8 +2313,8 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr)
} else {
tmp[0] = attr[i];
tmp[1] = attr[i + 1];
- tmp[2] = 0;
- tmp[3] = 0;
+ tmp[2] = NULL;
+ tmp[3] = NULL;
nsvg__parseAttribs(p, tmp);
}
}
@@ -2649,27 +2649,27 @@ static void nsvg__parseSVG(NSVGparser* p, const char** attr)
s = nsvg__parseNumber(s, buf, 64);
p->viewHeight = nsvg__atof(buf);
} else if (strcmp(attr[i], "preserveAspectRatio") == 0) {
- if (strstr(attr[i + 1], "none") != 0) {
+ if (strstr(attr[i + 1], "none") != NULL) {
// No uniform scaling
p->alignType = NSVG_ALIGN_NONE;
} else {
// Parse X align
- if (strstr(attr[i + 1], "xMin") != 0)
+ if (strstr(attr[i + 1], "xMin") != NULL)
p->alignX = NSVG_ALIGN_MIN;
- else if (strstr(attr[i + 1], "xMid") != 0)
+ else if (strstr(attr[i + 1], "xMid") != NULL)
p->alignX = NSVG_ALIGN_MID;
- else if (strstr(attr[i + 1], "xMax") != 0)
+ else if (strstr(attr[i + 1], "xMax") != NULL)
p->alignX = NSVG_ALIGN_MAX;
// Parse X align
- if (strstr(attr[i + 1], "yMin") != 0)
+ if (strstr(attr[i + 1], "yMin") != NULL)
p->alignY = NSVG_ALIGN_MIN;
- else if (strstr(attr[i + 1], "yMid") != 0)
+ else if (strstr(attr[i + 1], "yMid") != NULL)
p->alignY = NSVG_ALIGN_MID;
- else if (strstr(attr[i + 1], "yMax") != 0)
+ else if (strstr(attr[i + 1], "yMax") != NULL)
p->alignY = NSVG_ALIGN_MAX;
// Parse meet/slice
p->alignType = NSVG_ALIGN_MEET;
- if (strstr(attr[i + 1], "slice") != 0)
+ if (strstr(attr[i + 1], "slice") != NULL)
p->alignType = NSVG_ALIGN_SLICE;
}
}
@@ -3094,7 +3094,7 @@ static void nsvg__createGradients(NSVGparser* p)
NSVG_EXPORT NSVGimage* nsvgParse(char* input, const char* units, float dpi)
{
NSVGparser* p;
- NSVGimage* ret = 0;
+ NSVGimage* ret = NULL;
p = nsvg__createParser();
if (p == NULL) {
diff --git a/src/nanosvgrast.h b/src/nanosvgrast.h
index b0368e753..9dca93fca 100644
--- a/src/nanosvgrast.h
+++ b/src/nanosvgrast.h
@@ -886,7 +886,7 @@ static NSVGactiveEdge* nsvg__addActive(NSVGrasterizer* r, NSVGedge* e, float sta
z->x = (int)nsvg__roundf(NSVG__FIX * (e->x0 + dxdy * (startPoint - e->y0)));
// z->x -= off_x * FIX;
z->ey = e->y1;
- z->next = 0;
+ z->next = NULL;
z->dir = e->dir;
return z;
diff --git a/src/stb_image.h b/src/stb_image.h
index 3999e1665..99115a67b 100644
--- a/src/stb_image.h
+++ b/src/stb_image.h
@@ -3389,8 +3389,8 @@ static int stbi__free_jpeg_components(stbi__jpeg *z, int ncomp, int why)
}
if (z->img_comp[i].raw_coeff) {
STBI_FREE(z->img_comp[i].raw_coeff);
- z->img_comp[i].raw_coeff = 0;
- z->img_comp[i].coeff = 0;
+ z->img_comp[i].raw_coeff = NULL;
+ z->img_comp[i].coeff = NULL;
}
if (z->img_comp[i].linebuf) {
STBI_FREE(z->img_comp[i].linebuf);
@@ -3470,8 +3470,8 @@ static int stbi__process_frame_header(stbi__jpeg *z, int scan)
// so these muls can't overflow with 32-bit ints (which we require)
z->img_comp[i].w2 = z->img_mcu_x * z->img_comp[i].h * 8;
z->img_comp[i].h2 = z->img_mcu_y * z->img_comp[i].v * 8;
- z->img_comp[i].coeff = 0;
- z->img_comp[i].raw_coeff = 0;
+ z->img_comp[i].coeff = NULL;
+ z->img_comp[i].raw_coeff = NULL;
z->img_comp[i].linebuf = NULL;
z->img_comp[i].raw_data = stbi__malloc_mad2(z->img_comp[i].w2, z->img_comp[i].h2, 15);
if (z->img_comp[i].raw_data == NULL)