From 9debedfc33191e06335dbeec1d3bd146d39a29b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gunter=20K=C3=B6nigsmann?= Date: Mon, 23 Dec 2019 22:26:25 +0100 Subject: [PATCH] Made the nanosvgrast example compatible with c++ using gcc If compiling C++ the gcc complains if the result of malloc (which returns void *) is assigned to a pointer of a different type without casting. The example that comes with the comments in nanosvgrast.h therefore could cause the compiler to complain. --- src/nanosvgrast.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nanosvgrast.h b/src/nanosvgrast.h index b740c316..f445226e 100644 --- a/src/nanosvgrast.h +++ b/src/nanosvgrast.h @@ -41,7 +41,7 @@ typedef struct NSVGrasterizer NSVGrasterizer; // Create rasterizer (can be used to render multiple images). struct NSVGrasterizer* rast = nsvgCreateRasterizer(); // Allocate memory for image - unsigned char* img = malloc(w*h*4); + unsigned char* img = (unsigned char*) malloc(w*h*4); // Rasterize nsvgRasterize(rast, image, 0,0,1, img, w, h, w*4); */