From e679741b188a29631aabd226f3653ed90552d78c Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Wed, 21 Dec 2016 13:47:11 +0100 Subject: [PATCH] _CRT_SECURE_NO_WARNINGS moved to util.h --- programs/bench.c | 2 -- programs/datagen.c | 8 -------- programs/dibio.c | 2 -- programs/fileio.c | 3 +-- programs/util.h | 2 ++ programs/zstdcli.c | 1 - tests/fuzzer.c | 1 - tests/zbufftest.c | 1 - tests/zstreamtest.c | 1 - 9 files changed, 3 insertions(+), 18 deletions(-) diff --git a/programs/bench.c b/programs/bench.c index 9b7f9888..5d142529 100644 --- a/programs/bench.c +++ b/programs/bench.c @@ -13,7 +13,6 @@ * Compiler Warnings ****************************************/ #ifdef _MSC_VER -# define _CRT_SECURE_NO_WARNINGS /* fopen */ # pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ #endif @@ -21,7 +20,6 @@ /* ************************************* * Includes ***************************************/ -#include "platform.h" /* Large Files support */ #include "util.h" /* UTIL_getFileSize, UTIL_sleep */ #include /* malloc, free */ #include /* memset */ diff --git a/programs/datagen.c b/programs/datagen.c index 06b5ab97..d0116b97 100644 --- a/programs/datagen.c +++ b/programs/datagen.c @@ -9,14 +9,6 @@ -/* ************************************* -* Compiler Options -***************************************/ -#if defined(_MSC_VER) -# define _CRT_SECURE_NO_WARNINGS /* removes Visual warning on strerror() */ -# define _CRT_SECURE_NO_DEPRECATE /* removes VS2005 warning on strerror() */ -#endif - /*-************************************ * Dependencies **************************************/ diff --git a/programs/dibio.c b/programs/dibio.c index b99e717c..743d3ef9 100644 --- a/programs/dibio.c +++ b/programs/dibio.c @@ -13,7 +13,6 @@ * Compiler Warnings ****************************************/ #ifdef _MSC_VER -# define _CRT_SECURE_NO_WARNINGS /* fopen */ # pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ #endif @@ -21,7 +20,6 @@ /*-************************************* * Includes ***************************************/ -#include "platform.h" /* Large Files support */ #include "util.h" /* UTIL_getFileSize, UTIL_getTotalFileSize */ #include /* malloc, free */ #include /* memset */ diff --git a/programs/fileio.c b/programs/fileio.c index e2a90a67..5544fe30 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -11,7 +11,7 @@ * Compiler Options ***************************************/ #ifdef _MSC_VER /* Visual */ -# define _CRT_SECURE_NO_WARNINGS /* removes Visual warning on strerror() */ +# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ # pragma warning(disable : 4204) /* non-constant aggregate initializer */ #endif #if defined(__MINGW32__) && !defined(_POSIX_SOURCE) @@ -22,7 +22,6 @@ /*-************************************* * Includes ***************************************/ -#include "platform.h" /* Large Files support, SET_BINARY_MODE */ #include "util.h" /* UTIL_getFileSize */ #include /* fprintf, fopen, fread, _fileno, stdin, stdout */ #include /* malloc, free */ diff --git a/programs/util.h b/programs/util.h index 8b480b22..5779fa77 100644 --- a/programs/util.h +++ b/programs/util.h @@ -29,6 +29,8 @@ extern "C" { * Compiler Options ****************************************/ #if defined(_MSC_VER) +# define _CRT_SECURE_NO_WARNINGS /* Disable Visual Studio warning messages for fopen, strncpy, strerror */ +# define _CRT_SECURE_NO_DEPRECATE /* VS2005 */ # if (_MSC_VER <= 1800) /* (1800 = Visual Studio 2013) */ # define snprintf sprintf_s /* snprintf unsupported by Visual <= 2013 */ # endif diff --git a/programs/zstdcli.c b/programs/zstdcli.c index 978ffcfe..20698c78 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -23,7 +23,6 @@ /*-************************************ * Dependencies **************************************/ -#include "platform.h" /* IS_CONSOLE, PLATFORM_POSIX_VERSION */ #include "util.h" /* UTIL_HAS_CREATEFILELIST, UTIL_createFileList */ #include /* strcmp, strlen */ #include /* errno */ diff --git a/tests/fuzzer.c b/tests/fuzzer.c index 86d4c6be..b9b0158e 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -12,7 +12,6 @@ * Compiler specific **************************************/ #ifdef _MSC_VER /* Visual Studio */ -# define _CRT_SECURE_NO_WARNINGS /* fgets */ # pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ # pragma warning(disable : 4204) /* disable: C4204: non-constant aggregate initializer */ #endif diff --git a/tests/zbufftest.c b/tests/zbufftest.c index 14b73923..0fda993f 100644 --- a/tests/zbufftest.c +++ b/tests/zbufftest.c @@ -12,7 +12,6 @@ * Compiler specific **************************************/ #ifdef _MSC_VER /* Visual Studio */ -# define _CRT_SECURE_NO_WARNINGS /* fgets */ # pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ # pragma warning(disable : 4146) /* disable: C4146: minus unsigned expression */ #endif diff --git a/tests/zstreamtest.c b/tests/zstreamtest.c index ce619308..b5284504 100644 --- a/tests/zstreamtest.c +++ b/tests/zstreamtest.c @@ -12,7 +12,6 @@ * Compiler specific **************************************/ #ifdef _MSC_VER /* Visual Studio */ -# define _CRT_SECURE_NO_WARNINGS /* fgets */ # pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ # pragma warning(disable : 4146) /* disable: C4146: minus unsigned expression */ #endif