From ec9ba5d15ba3ddc59373ec2b67431a7cfaf4d5e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Mon, 30 Mar 2015 19:29:52 -0700 Subject: [PATCH] Fixed VS2015 warnings. --- 3rdparty/stb/stb_image.c | 13 +++++++++---- examples/20-nanovg/blendish.h | 1 + examples/20-nanovg/nanovg.cpp | 6 +++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/3rdparty/stb/stb_image.c b/3rdparty/stb/stb_image.c index 1eadb99b1..faa463732 100644 --- a/3rdparty/stb/stb_image.c +++ b/3rdparty/stb/stb_image.c @@ -187,10 +187,15 @@ #ifndef STBI_NO_STDIO -#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(_CRT_SECURE_NO_WARNINGS) -#define _CRT_SECURE_NO_WARNINGS // suppress warnings about fopen() -#pragma warning(push) -#pragma warning(disable:4996) // suppress even more warnings about fopen() +#if defined(_MSC_VER) && _MSC_VER >= 1400 +# if !defined(_CRT_SECURE_NO_WARNINGS) +# define _CRT_SECURE_NO_WARNINGS // suppress warnings about fopen() +# endif +# pragma warning(push) +# pragma warning(disable:4996) // suppress even more warnings about fopen() +# pragma warning(disable:4312) // warning C4312: 'type cast': conversion from 'int' to 'unsigned char *' of greater size +# pragma warning(disable:4456) // warning C4456: declaration of 'k' hides previous local declaration +# pragma warning(disable:4457) // warning C4457: declaration of 'y' hides function parameter #endif #include #endif // STBI_NO_STDIO diff --git a/examples/20-nanovg/blendish.h b/examples/20-nanovg/blendish.h index 43258e040..1afb1f5d0 100644 --- a/examples/20-nanovg/blendish.h +++ b/examples/20-nanovg/blendish.h @@ -1109,6 +1109,7 @@ BND_EXPORT NVGcolor bndNodeWireColor(const BNDnodeTheme *theme, BNDwidgetState s #pragma warning (disable: 4100) // Switch off unreferenced formal parameter warnings #pragma warning (disable: 4244) #pragma warning (disable: 4305) + #pragma warning (disable: 4838) // warning C4838: conversion from 'double' to 'float' requires a narrowing conversion #ifdef __cplusplus #define BND_INLINE inline #else diff --git a/examples/20-nanovg/nanovg.cpp b/examples/20-nanovg/nanovg.cpp index 14cd6fbd9..2b30ef39e 100644 --- a/examples/20-nanovg/nanovg.cpp +++ b/examples/20-nanovg/nanovg.cpp @@ -1042,10 +1042,10 @@ void drawParagraph(struct NVGcontext* vg, float x, float y, float width, float h for (j = 0; j < nglyphs; j++) { float x0 = glyphs[j].x; float x1 = (j+1 < nglyphs) ? glyphs[j+1].x : x+row->width; - float gx = x0 * 0.3f + x1 * 0.7f; - if (mx >= px && mx < gx) + float tgx = x0 * 0.3f + x1 * 0.7f; + if (mx >= px && mx < tgx) caretx = glyphs[j].x; - px = gx; + px = tgx; } nvgBeginPath(vg); nvgFillColor(vg, nvgRGBA(255,192,0,255));