From: Oliver Kurth Date: Mon, 23 Oct 2017 21:21:19 +0000 (-0700) Subject: Disable lib/string wprintf functions for non-Windows builds X-Git-Tag: stable-10.3.0~266 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7367296bebe4eed2bc5555f49fbaeea197be94ef;p=thirdparty%2Fopen-vm-tools.git Disable lib/string wprintf functions for non-Windows builds The lib/string wprintf functions currently are enabled only for Windows and Linux builds, but Windows is the only platform that uses them. Disable them for Linux, too. This also means HAS_BSD_WPRINTF can be removed. --- diff --git a/open-vm-tools/lib/include/str.h b/open-vm-tools/lib/include/str.h index 89889406f..3f3d24f29 100644 --- a/open-vm-tools/lib/include/str.h +++ b/open-vm-tools/lib/include/str.h @@ -63,7 +63,11 @@ extern "C" { /* * These platforms use bsd_vsnprintf(). - * This does not mean it has bsd_vsnwprintf(). + * + * XXX: open-vm-tools does not use bsd_vsnprintf because bsd_vsnprintf uses + * convertutf.{h,c}, and the license for those files does not meet the + * redistribution requirements for Debian. + * */ #if !defined(OPEN_VM_TOOLS) #if (defined _WIN32 && !defined STR_NO_WIN32_LIBS) || \ @@ -73,17 +77,6 @@ extern "C" { #endif #endif -/* - * And these platforms/setups use bsd_vsnwprintf() - */ -#if !defined(OPEN_VM_TOOLS) -#if (defined _WIN32 && !defined STR_NO_WIN32_LIBS) || \ - (defined __GNUC__ && (__GNUC__ < 2 \ - || (__GNUC__ == 2 \ - && __GNUC_MINOR__ < 96))) -#define HAS_BSD_WPRINTF 1 -#endif -#endif /* * ASCII/UTF-8 versions @@ -146,7 +139,7 @@ char *Str_SafeVasprintf(size_t *length, // OUT/OPT: const char *format, // IN: va_list arguments); // IN: -#if defined(_WIN32) || defined(__linux__) // { +#if defined(_WIN32) // { /* * wchar_t versions @@ -202,7 +195,6 @@ wchar_t *Str_SafeVaswprintf(size_t *length, // OUT/OPT: * the _tcs functions, but with Str_Strcpy-style bounds checking. */ -#ifdef _WIN32 #ifdef UNICODE #define Str_Tcscpy(s1, s2, n) Str_Wcscpy(s1, s2, n) #define Str_Tcscat(s1, s2, n) Str_Wcscat(s1, s2, n) @@ -210,9 +202,8 @@ wchar_t *Str_SafeVaswprintf(size_t *length, // OUT/OPT: #define Str_Tcscpy(s1, s2, n) Str_Strcpy(s1, s2, n) #define Str_Tcscat(s1, s2, n) Str_Strcat(s1, s2, n) #endif -#endif -#endif // } defined(_WIN32) || defined(__linux__) +#endif // } defined(_WIN32) /* diff --git a/open-vm-tools/lib/string/str.c b/open-vm-tools/lib/string/str.c index a295ea2c2..c201bc6d7 100644 --- a/open-vm-tools/lib/string/str.c +++ b/open-vm-tools/lib/string/str.c @@ -685,7 +685,7 @@ Str_SafeVasprintf(size_t *length, // OUT/OPT return StrVasprintfInternal(length, format, arguments, TRUE); } -#if defined(_WIN32) || defined(__linux__) +#if defined(_WIN32) // { /* *---------------------------------------------------------------------- @@ -698,7 +698,7 @@ Str_SafeVasprintf(size_t *length, // OUT/OPT * Returns the number of wchar_ts stored in 'buf'. * * WARNING: - * Behavior of this function is guaranteed only if HAS_BSD_WPRINTF is + * Behavior of this function is guaranteed only if HAS_BSD_PRINTF is * enabled. * * Side effects: @@ -742,7 +742,7 @@ Str_Swprintf(wchar_t *buf, // OUT * NB: on overflow the buffer WILL be NUL terminated * * WARNING: - * Behavior of this function is guaranteed only if HAS_BSD_WPRINTF is + * Behavior of this function is guaranteed only if HAS_BSD_PRINTF is * enabled. * * See the warning at the top of this file for proper va_list usage. @@ -761,7 +761,7 @@ Str_Vsnwprintf(wchar_t *str, // OUT { int retval; -#if defined HAS_BSD_WPRINTF +#if defined HAS_BSD_PRINTF retval = bsd_vsnwprintf(&str, size, format, ap); #elif defined(_WIN32) /* @@ -1146,7 +1146,7 @@ Str_SafeVaswprintf(size_t *length, // OUT/OPT return StrVaswprintfInternal(length, format, arguments, TRUE); } -#endif // defined(_WIN32) || defined(__linux__) +#endif // } defined(_WIN32) #ifndef _WIN32 @@ -1269,7 +1269,7 @@ CheckWPrintf(const wchar_t *expected, // IN const wchar_t *fmt, // IN ...) // IN { -#if !defined HAS_BSD_WPRINTF +#if !defined HAS_BSD_PRINTF NOT_TESTED_ONCE(); #else wchar_t buf[1024] = L"";