use stdbool.h and inttypes.h in MSVC 2013 and later, and use more C99-compatible definitions of false and true earlier (fix #90)
This commit is contained in:
parent
e46d213241
commit
59334e4499
10
utf8proc.h
10
utf8proc.h
@ -78,7 +78,8 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER) && _MSC_VER < 1800
|
||||||
|
// MSVC prior to 2013 lacked stdbool.h and inttypes.h
|
||||||
typedef signed char utf8proc_int8_t;
|
typedef signed char utf8proc_int8_t;
|
||||||
typedef unsigned char utf8proc_uint8_t;
|
typedef unsigned char utf8proc_uint8_t;
|
||||||
typedef short utf8proc_int16_t;
|
typedef short utf8proc_int16_t;
|
||||||
@ -93,8 +94,13 @@ typedef int utf8proc_ssize_t;
|
|||||||
typedef unsigned int utf8proc_size_t;
|
typedef unsigned int utf8proc_size_t;
|
||||||
# endif
|
# endif
|
||||||
# ifndef __cplusplus
|
# ifndef __cplusplus
|
||||||
|
// emulate C99 bool
|
||||||
typedef unsigned char utf8proc_bool;
|
typedef unsigned char utf8proc_bool;
|
||||||
enum {false, true};
|
# ifndef __bool_true_false_are_defined
|
||||||
|
# define false 0
|
||||||
|
# define true 1
|
||||||
|
# define __bool_true_false_are_defined 1
|
||||||
|
# endif
|
||||||
# else
|
# else
|
||||||
typedef bool utf8proc_bool;
|
typedef bool utf8proc_bool;
|
||||||
# endif
|
# endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user