Skip to content

Commit

Permalink
Fix compile error with Visual Studio 2012
Browse files Browse the repository at this point in the history
The standard header stdbool.h is not available
with old Visual Studio compilers
  • Loading branch information
pepone authored and hartwork committed Aug 23, 2017
1 parent e0b290e commit b4b89c2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
11 changes: 10 additions & 1 deletion expat/lib/xmltok.c
Expand Up @@ -31,9 +31,18 @@
*/

#include <stddef.h>
#include <stdbool.h>
#include <string.h> // memcpy

#if defined(_MSC_VER) && (_MSC_VER <= 1700)
/* for vs2012/11.0/1700 and earlier Visual Studio compilers */
# define bool int
# define false 0
# define true 1
#else
# include <stdbool.h>
#endif


#ifdef _WIN32
#include "winconfig.h"
#else
Expand Down
15 changes: 12 additions & 3 deletions expat/tests/runtests.c
Expand Up @@ -41,11 +41,20 @@
#include <stdint.h>
#include <stddef.h> /* ptrdiff_t */
#include <ctype.h>
#ifndef __cplusplus
# include <stdbool.h>
#endif
#include <limits.h>

#if ! defined(__cplusplus)
# if defined(_MSC_VER) && (_MSC_VER <= 1700)
/* for vs2012/11.0/1700 and earlier Visual Studio compilers */
# define bool int
# define false 0
# define true 1
# else
# include <stdbool.h>
# endif
#endif


#include "expat.h"
#include "chardata.h"
#include "internal.h" /* for UNUSED_P only */
Expand Down

0 comments on commit b4b89c2

Please sign in to comment.