From d9d49f2dfc4eb4c22c8d9185348e67352e488f8b Mon Sep 17 00:00:00 2001 From: Pali Rohár Date: Thu, 25 Apr 2019 19:26:23 +0200 Subject: Remove ifdef hack for snprintf() Old version of MSVC does not support snprintf() function and sprintf_s() is not replacement for C99 snprintf(). As the only usage of snprintf() is to format void* pointer we can use sprintf() with enough long buffer. --- dlfcn.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dlfcn.c b/dlfcn.c index cd1ca83..475b069 100644 --- a/dlfcn.c +++ b/dlfcn.c @@ -46,10 +46,6 @@ #endif #include "dlfcn.h" -#if ((defined(_WIN32) || defined(WIN32)) && (defined(_MSC_VER)) ) -#define snprintf sprintf_s -#endif - /* Note: * MSDN says these functions are not thread-safe. We make no efforts to have * any kind of thread safety. @@ -191,7 +187,11 @@ static void save_err_ptr_str( const void *ptr ) { char ptr_buf[19]; /* 0x up to 64 bits. */ - snprintf( ptr_buf, 19, "0x%p", ptr ); +#ifdef _MSC_VER +/* Supress warning C4996: 'sprintf': This function or variable may be unsafe */ +#pragma warning( suppress: 4996 ) +#endif + sprintf( ptr_buf, "0x%p", ptr ); save_err_str( ptr_buf ); } -- cgit v1.2.3-55-g6feb