Bug 1119776, Part 7: Avoid defining snprintf when MSVC provides it (other), r=bsmedberg

--HG--
extra : rebase_source : 3fc7e4e83f57252e15cf32846f23e497f8532ea5
This commit is contained in:
Brian Smith 2015-01-08 22:35:33 -08:00
parent 29950a47ae
commit 1a3d2e92d2
23 changed files with 37 additions and 17 deletions

View File

@ -27,7 +27,9 @@
// we want a wmain entry point
#define XRE_DONT_SUPPORT_XPSP2 // See https://bugzil.la/1023941#c32
#include "nsWindowsWMain.cpp"
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define snprintf _snprintf
#endif
#define strcasecmp _stricmp
#endif

View File

@ -43,7 +43,9 @@
#define XRE_DONT_SUPPORT_XPSP2
#endif
#include "nsWindowsWMain.cpp"
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define snprintf _snprintf
#endif
#define strcasecmp _stricmp
#endif
#include "BinaryPath.h"

View File

@ -70,8 +70,10 @@
#ifdef WIN32
#define spawnvp _spawnvp
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#endif
//NOTE: this is for the stat *call* and the stat *struct*
#define stat _stat
#endif

View File

@ -21,9 +21,10 @@
/* Windows configuration */
#elif defined(_MSC_VER)
#define inline __inline
#define strncasecmp strnicmp
#if _MSC_VER < 1900
#define snprintf _snprintf
#endif
#define va_copy(a,b) ((a)=(b))
#endif

View File

@ -3,7 +3,7 @@
#include "jsctypes-test.h"
#include "jsctypes-test-finalizer.h"
#if defined(XP_WIN)
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif // defined(XP_WIN)

View File

@ -9,9 +9,9 @@
#include <stdio.h>
#include "typedefs.h"
#if defined(XP_WIN)
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif // defined(XP_WIN)
#endif
template <typename T> struct ValueTraits {
static T literal() { return static_cast<T>(109.25); }

View File

@ -39,7 +39,9 @@
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN // We only need minimal includes
#include <windows.h>
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf // see comment in strutil.cc
#endif
#else
#include <pthread.h>
#endif

View File

@ -45,7 +45,7 @@
#include "common/logging.h"
#include "common/pathname_stripper.h"
#ifdef _WIN32
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif

View File

@ -46,7 +46,9 @@
#include <io.h>
#define PRIx64 "llx"
#define PRIx32 "lx"
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif
#else // _WIN32
#include <unistd.h>
#define O_BINARY 0

View File

@ -8,7 +8,7 @@
#include "x86_operand_list.h"
#ifdef _MSC_VER
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#define inline __inline
#endif

View File

@ -5,7 +5,7 @@
#include "libdis.h"
#include <inttypes.h>
#ifdef _MSC_VER
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#define inline __inline
#endif

View File

@ -3,7 +3,7 @@
#include "libdis.h"
#ifdef _MSC_VER
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#define inline __inline
#endif

View File

@ -8,7 +8,7 @@
#include "ia32_settings.h"
extern ia32_settings_t ia32_settings;
#ifdef _MSC_VER
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#define inline __inline
#endif

View File

@ -45,6 +45,8 @@
# define LOG_S "%S"
# define NS_T(str) L ## str
# define NS_SLASH NS_T('\\')
#if defined(_MSC_VER) && _MSC_VER < 1900
// On Windows, _snprintf and _snwprintf don't guarantee null termination. These
// macros always leave room in the buffer for null termination and set the end
// of the buffer to null in case the string is larger than the buffer. Having
@ -62,6 +64,7 @@ static inline int mysnprintf(char* dest, size_t count, const char* fmt, ...)
return result;
}
#define snprintf mysnprintf
#endif
static inline int mywcsprintf(WCHAR* dest, size_t count, const WCHAR* fmt, ...)
{
size_t _count = count - 1;

View File

@ -53,7 +53,7 @@ int sProfileEntries = 0;
using std::string;
using namespace mozilla;
#if _MSC_VER
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif

View File

@ -11,7 +11,7 @@
#include "nsTArray.h"
#include "nsUTF8Utils.h"
#if _MSC_VER
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif

View File

@ -16,7 +16,7 @@
// Self
#include "ProfileEntry.h"
#if _MSC_VER
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif

View File

@ -15,7 +15,7 @@
#include "nsStackWalk.h"
#ifdef XP_WIN
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif

View File

@ -13,7 +13,7 @@
#include "nsStackWalk.h"
#ifdef XP_WIN
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif

View File

@ -13,7 +13,7 @@
#include <stdio.h>
#ifdef XP_WIN
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif

View File

@ -40,7 +40,9 @@ static bool do_preload = false;
#if defined(XP_WIN)
#include <windows.h>
#include <mbstring.h>
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif
typedef HINSTANCE LibHandleType;

View File

@ -8,7 +8,9 @@
#include <stdlib.h>
#ifdef XP_WIN
#include <windows.h>
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif
#define strcasecmp _stricmp
#endif

View File

@ -13,8 +13,10 @@
#ifdef XP_WIN
#include <windows.h>
#include <io.h>
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#endif
#define strcasecmp _stricmp
#define PATH_SEPARATOR_CHAR '\\'
#define R_OK 04