From 0d810d52f1061e91d423445039d7371d07d18733 Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Mon, 9 Dec 2013 16:15:15 -0600 Subject: [PATCH] For GLEW Patch #42 - Patch for _CRT_SECURE_NO_WARNINGS --- auto/src/glewinfo_tail.c | 5 +++++ src/visualinfo.c | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/auto/src/glewinfo_tail.c b/auto/src/glewinfo_tail.c index ab87ed1..84e7a2a 100644 --- a/auto/src/glewinfo_tail.c +++ b/auto/src/glewinfo_tail.c @@ -58,7 +58,12 @@ int main (void) return 1; } #if defined(_WIN32) +#if defined(_MSC_VER) && (_MSC_VER >= 1400) + if (fopen_s(&f, "glewinfo.txt", "w") != 0) + f = stdout; +#else f = fopen("glewinfo.txt", "w"); +#endif if (f == NULL) f = stdout; #else f = stdout; diff --git a/src/visualinfo.c b/src/visualinfo.c index ed94cd2..ca2c585 100644 --- a/src/visualinfo.c +++ b/src/visualinfo.c @@ -146,8 +146,15 @@ main (int argc, char** argv) /* ---------------------------------------------------------------------- */ /* open file */ #if defined(_WIN32) - if (!displaystdout) + if (!displaystdout) + { +#if defined(_MSC_VER) && (_MSC_VER >= 1400) + if (fopen_s(&file, "visualinfo.txt", "w") != 0) + file = stdout; +#else file = fopen("visualinfo.txt", "w"); +#endif + } if (file == NULL) file = stdout; #else @@ -236,7 +243,11 @@ void PrintExtensions (const char* s) fprintf(file, " %s\n", t); p++; i = (int)strlen(p); +#if defined(_MSC_VER) && (_MSC_VER >= 1400) + strcpy_s(t, sizeof(t), p); +#else strcpy(t, p); +#endif } s++; }