mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
Merge pull request #640 from TsudaKageyu/cmake-vsprintf
CMake check for vsprintf_s/vsnprintf rather than sprintf_s/snprintf.
This commit is contained in:
commit
49563a9cd0
@ -201,26 +201,30 @@ if(NOT HAVE_GCC_BYTESWAP_16 OR NOT HAVE_GCC_BYTESWAP_32 OR NOT HAVE_GCC_BYTESWAP
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Determine whether your compiler supports some safer version of sprintf.
|
||||
# Determine whether your compiler supports some safer version of vsprintf.
|
||||
|
||||
check_cxx_source_compiles("
|
||||
#include <cstdio>
|
||||
#include <cstdarg>
|
||||
int main() {
|
||||
char buf[20];
|
||||
snprintf(buf, 20, \"%d\", 1);
|
||||
va_list args;
|
||||
vsnprintf(buf, 20, \"%d\", args);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_SNPRINTF)
|
||||
" HAVE_VSNPRINTF)
|
||||
|
||||
if(NOT HAVE_SNPRINTF)
|
||||
if(NOT HAVE_VSNPRINTF)
|
||||
check_cxx_source_compiles("
|
||||
#include <cstdio>
|
||||
#include <cstdarg>
|
||||
int main() {
|
||||
char buf[20];
|
||||
sprintf_s(buf, \"%d\", 1);
|
||||
va_list args;
|
||||
vsprintf_s(buf, \"%d\", args);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_SPRINTF_S)
|
||||
" HAVE_VSPRINTF_S)
|
||||
endif()
|
||||
|
||||
# Check for libz using the cmake supplied FindZLIB.cmake
|
||||
|
@ -25,9 +25,9 @@
|
||||
#cmakedefine HAVE_WIN_ATOMIC 1
|
||||
#cmakedefine HAVE_IA64_ATOMIC 1
|
||||
|
||||
/* Defined if your compiler supports some safer version of sprintf */
|
||||
#cmakedefine HAVE_SNPRINTF 1
|
||||
#cmakedefine HAVE_SPRINTF_S 1
|
||||
/* Defined if your compiler supports some safer version of vsprintf */
|
||||
#cmakedefine HAVE_VSNPRINTF 1
|
||||
#cmakedefine HAVE_VSPRINTF_S 1
|
||||
|
||||
/* Defined if you have libz */
|
||||
#cmakedefine HAVE_ZLIB 1
|
||||
|
@ -177,11 +177,11 @@ namespace TagLib
|
||||
char buf[BufferSize];
|
||||
int length;
|
||||
|
||||
#if defined(HAVE_SNPRINTF)
|
||||
#if defined(HAVE_VSNPRINTF)
|
||||
|
||||
length = vsnprintf(buf, BufferSize, format, args);
|
||||
|
||||
#elif defined(HAVE_SPRINTF_S)
|
||||
#elif defined(HAVE_VSPRINTF_S)
|
||||
|
||||
length = vsprintf_s(buf, format, args);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user