VC++ fix - use non-standard names for POSIX functions to avoid heap corruption.

pull/193/head
Michael R Sweet 17 years ago
parent 7ac92e8bf8
commit 5115ffdbd1
  1. 24
      vcnet/config.h
  2. 2
      vcnet/mxml1.def

@ -26,6 +26,24 @@
#define _CRT_SECURE_NO_DEPRECATE
/*
* Microsoft also renames the POSIX functions to _name, and introduces
* a broken compatibility layer using the original names. As a result,
* random crashes can occur when, for example, strdup() allocates memory
* from a different heap than used by malloc() and free().
*
* To avoid moronic problems like this, we #define the POSIX function
* names to the corresponding non-standard Microsoft names.
*/
#define close _close
#define open _open
#define read _read
#define snprintf _snprintf
#define strdup _strdup
#define vsnprintf _vsnprintf
#define write _write
/*
* Include necessary headers...
@ -42,7 +60,7 @@
* Version number...
*/
#define MXML_VERSION "Mini-XML v2.4"
#define MXML_VERSION "Mini-XML v2.4.1"
/*
@ -56,8 +74,8 @@
* Do we have the snprintf() and vsnprintf() functions?
*/
/*#undef HAVE_SNPRINTF */
/*#undef HAVE_VSNPRINTF */
#define HAVE_SNPRINTF 1
#define HAVE_VSNPRINTF 1
/*

@ -1,8 +1,6 @@
LIBRARY "MXML1"
EXPORTS
_mxml_snprintf
_mxml_strdupf
_mxml_vsnprintf
_mxml_vstrdupf
mxml_ignore_cb
mxml_integer_cb

Loading…
Cancel
Save