From 1acb9f0c9b4910489ec1f38c781255ca53a6da5c Mon Sep 17 00:00:00 2001 From: Mikko Mononen Date: Thu, 12 Jun 2014 20:01:28 +0300 Subject: [PATCH] Fixed issue #11 - fixed compiler warnings - supper single and double quotes --- example/example1.c | 6 ++++-- src/nanosvg.h | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/example/example1.c b/example/example1.c index d8eeea3..2eba1a1 100644 --- a/example/example1.c +++ b/example/example1.c @@ -93,7 +93,7 @@ void drawPath(float* pts, int npts, char closed, float tol) glEnd(); } -void drawControlPts(float* pts, int npts, char closed) +void drawControlPts(float* pts, int npts) { int i; @@ -200,7 +200,7 @@ void drawframe(GLFWwindow* window) for (shape = g_image->shapes; shape != NULL; shape = shape->next) { for (path = shape->paths; path != NULL; path = path->next) { drawPath(path->pts, path->npts, path->closed, px * 1.5f); - drawControlPts(path->pts, path->npts, path->closed); + drawControlPts(path->pts, path->npts); } } @@ -210,6 +210,8 @@ void drawframe(GLFWwindow* window) void resizecb(GLFWwindow* window, int width, int height) { // Update and render + NSVG_NOTUSED(width); + NSVG_NOTUSED(height); drawframe(window); } diff --git a/src/nanosvg.h b/src/nanosvg.h index 272a01d..009a459 100644 --- a/src/nanosvg.h +++ b/src/nanosvg.h @@ -157,6 +157,7 @@ void nsvgDelete(struct NSVGimage* image); #define NSVG_ALIGN_MEET 1 #define NSVG_ALIGN_SLICE 2 +#define NSVG_NOTUSED(v) for(;;) { (void)(1 ? (void)0 : ( (void)(v) ) ); } #define NSVG_RGB(r, g, b) (((unsigned int)r) | ((unsigned int)g << 8) | ((unsigned int)b << 16)) #ifdef _MSC_VER @@ -219,6 +220,7 @@ static void nsvg__parseElement(char* s, char* name; int start = 0; int end = 0; + char quote; // Skip white space after the '<' while (*s && nsvg__isspace(*s)) s++; @@ -254,12 +256,13 @@ static void nsvg__parseElement(char* s, while (*s && !nsvg__isspace(*s) && *s != '=') s++; if (*s) { *s++ = '\0'; } // Skip until the beginning of the value. - while (*s && *s != '\"') s++; + while (*s && *s != '\"' && *s != '\'') s++; if (!*s) break; + quote = *s; s++; // Store value and find the end of it. attr[nattr++] = s; - while (*s && *s != '\"') s++; + while (*s && *s != quote) s++; if (*s) { *s++ = '\0'; } } @@ -686,6 +689,7 @@ static struct NSVGgradient* nsvg__createGradient(struct NSVGparser* p, const cha struct NSVGgradient* grad; float dx, dy, d; int nstops = 0; + NSVG_NOTUSED(bounds); data = nsvg__findGradientData(p, id); if (data == NULL) return NULL; @@ -2356,6 +2360,8 @@ static void nsvg__endElement(void* ud, const char* el) static void nsvg__content(void*, const char*) { + NSVG_NOTUSED(ud); + NSVG_NOTUSED(s); // empty }