From c20125c941d6d8c8c2b5016a0de4ec486512e157 Mon Sep 17 00:00:00 2001 From: Scott Graham Date: Thu, 19 Jun 2014 17:34:10 -0700 Subject: [PATCH] second attempt at avoiding warnings at /W4 on vs2013 --- src/nanovg.c | 8 +++++++- src/nanovg.h | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/nanovg.c b/src/nanovg.c index 939d801..9426402 100644 --- a/src/nanovg.c +++ b/src/nanovg.c @@ -24,6 +24,12 @@ #define STBI_HEADER_FILE_ONLY #include "stb_image.c" +#ifdef _MSC_VER +#pragma warning(disable: 4100) // unreferenced formal parameter +#pragma warning(disable: 4127) // conditional expression is constant +#pragma warning(disable: 4204) // nonstandard extension used : non-constant aggregate initializer +#pragma warning(disable: 4706) // assignment within conditional expression +#endif #define NVG_INIT_COMMANDS_SIZE 256 #define NVG_INIT_POINTS_SIZE 128 @@ -977,7 +983,7 @@ static void nvg__addPoint(struct NVGcontext* ctx, float x, float y, int flags) memset(pt, 0, sizeof(*pt)); pt->x = x; pt->y = y; - pt->flags = flags; + pt->flags = (unsigned char)flags; ctx->cache->npoints++; path->count++; diff --git a/src/nanovg.h b/src/nanovg.h index 6d9dcf2..51537d3 100644 --- a/src/nanovg.h +++ b/src/nanovg.h @@ -25,6 +25,11 @@ extern "C" { #define NVG_PI 3.14159265358979323846264338327f +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union +#endif + struct NVGcontext; struct NVGcolor { @@ -584,6 +589,10 @@ struct NVGparams* nvgInternalParams(struct NVGcontext* ctx); // Debug function to dump cached path data. void nvgDebugDumpPathCache(struct NVGcontext* ctx); +#ifdef _MSC_VER +#pragma warning(pop) +#endif + #define NVG_NOTUSED(v) for (;;) { (void)(1 ? (void)0 : ( (void)(v) ) ); break; } #ifdef __cplusplus