Skip to content

Commit

Permalink
fix: rand_s(): MSVC requires the _CRT_RAND_S define before stdlib.h a…
Browse files Browse the repository at this point in the history
…nd it came in too late.
  • Loading branch information
GerHobbelt committed Aug 4, 2024
1 parent 584d13e commit f3b65fe
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions expat/lib/xmlparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@

#include "expat_config.h"

#ifdef _WIN32
/* force stdlib to define rand_s() */
# if ! defined(_CRT_RAND_S)
# define _CRT_RAND_S
# endif
#endif

#include "expat.h"
#include "internal.h"

#if ! defined(XML_GE) || (1 - XML_GE - 1 == 2) || (XML_GE < 0) || (XML_GE > 1)
# error XML_GE (for general entities) must be defined, non-empty, either 1 or 0 (0 to disable, 1 to enable; 1 is a common default)
#endif
Expand All @@ -84,13 +94,6 @@
# endif
#endif

#ifdef _WIN32
/* force stdlib to define rand_s() */
# if ! defined(_CRT_RAND_S)
# define _CRT_RAND_S
# endif
#endif

#include <stdbool.h>
#include <stddef.h>
#include <string.h> /* memset(), memcpy() */
Expand Down Expand Up @@ -631,7 +634,7 @@ static unsigned long getDebugLevel(const char *variableName,
: ((*((pool)->ptr)++ = c), 1))

#if ! defined(XML_TESTING)
const
//const
#endif
XML_Bool g_reparseDeferralEnabledDefault
= XML_TRUE; // write ONLY in runtests.c
Expand Down

0 comments on commit f3b65fe

Please sign in to comment.