Skip to content

Commit

Permalink
mxmlElementSetAttrf did not work with some versions of Visual Studio
Browse files Browse the repository at this point in the history
(Issue #184)
  • Loading branch information
michaelrsweet committed Mar 30, 2017
1 parent 6827e84 commit 876e6a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.md
@@ -1,6 +1,8 @@
# Changes in Mini-XML 2.11

- Fixed a memory leak in mxmlDelete (Issue #183)
- mxmlElementSetAttrf did not work with some versions of Visual Studio
(Issue #184)
- The configure script now properly supports cross-compilation (Issue #188)


Expand Down
8 changes: 7 additions & 1 deletion mxml-string.c
Expand Up @@ -474,16 +474,22 @@ _mxml_vstrdupf(const char *format, /* I - Printf-style format string */
int bytes; /* Number of bytes required */
char *buffer, /* String buffer */
temp[256]; /* Small buffer for first vsnprintf */
va_list apcopy; /* Copy of argument list */


/*
* First format with a tiny buffer; this will tell us how many bytes are
* needed...
*/

# ifdef WIN32
bytes = _vscprintf(format, ap);

# else
va_list apcopy; /* Copy of argument list */

va_copy(apcopy, ap);
bytes = vsnprintf(temp, sizeof(temp), format, apcopy);
# endif /* WIN32 */

if (bytes < sizeof(temp))
{
Expand Down

0 comments on commit 876e6a9

Please sign in to comment.