From d634336e1f97f22bd26b19c0c6ccf168121497f6 Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Wed, 26 Jul 2017 19:43:22 +0300 Subject: [PATCH] mdbx-test: fix snprintf/vsnprintf redefinition for MSVC. Change-Id: I4be3a4f71782d395035ff4d5b9e3a1af9ee70bb9 --- test/base.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/base.h b/test/base.h index e882c191..ffcf61ad 100644 --- a/test/base.h +++ b/test/base.h @@ -1,4 +1,4 @@ -/* +/* * Copyright 2017 Leonid Yuriev * and other libmdbx authors: please see AUTHORS file. * All rights reserved. @@ -99,7 +99,14 @@ #pragma warning(disable : 4512) /* assignment operator could \ not be generated */ #pragma warning(disable : 4610) /* user-defined constructor required */ -#define snprintf _snprintf +#ifndef snprintf +#define snprintf(buffer, buffer_size, format, ...) \ + _snprintf_s(buffer, buffer_size, _TRUNCATE, format, __VA_ARGS__) +#endif +#ifndef vsnprintf +#define vsnprintf(buffer, buffer_size, format, args) \ + _vsnprintf_s(buffer, buffer_size, _TRUNCATE, format, args) +#endif #pragma warning(disable : 4996) /* 'vsnprintf': This function or variable \ may be unsafe */ #endif