Bug 1119776, Part 4: Avoid defining snprintf when MSVC provides it (MFBT), r=waldo

--HG--
extra : rebase_source : 22216031650057afade8cda274723574af5fee6c
This commit is contained in:
Brian Smith 2015-01-08 22:33:03 -08:00
parent 6685425c82
commit 9c3a50df68

View File

@ -93,9 +93,6 @@ public:
T* get() const { return mPtr; }
#ifdef MOZ_REFCOUNTED_LEAK_CHECKING
#ifdef XP_WIN
#define snprintf _snprintf
#endif
const char* typeName() const
{
static char nameBuffer[1024];
@ -106,15 +103,17 @@ public:
MOZ_ASSERT(strlen(innerType) + sizeof("WeakReference<>") <
ArrayLength(nameBuffer),
"Exceedingly large type name");
snprintf(nameBuffer, ArrayLength(nameBuffer), "WeakReference<%s>",
innerType);
#if defined(_MSC_VER) && _MSC_VER < 1900
_snprintf
#else
::snprintf
#endif
(nameBuffer, ArrayLength(nameBuffer), "WeakReference<%s>", innerType);
// This is usually not OK, but here we are returning a pointer to a static
// buffer which will immediately be used by the caller.
return nameBuffer;
}
size_t typeSize() const { return sizeof(*this); }
#undef snprintf
#endif
private: