Skip to content

Commit acea91b

Browse files
committed
Fixes to unified stdint usage
This recalls 14caf17
1 parent 52dac3e commit acea91b

File tree

2 files changed

+13
-29
lines changed

2 files changed

+13
-29
lines changed

ext/date/lib/timelib_structs.h

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,7 @@
2323

2424
#include "timelib_config.h"
2525

26-
#ifdef HAVE_SYS_TYPES_H
27-
#include <sys/types.h>
28-
#endif
29-
30-
#if defined(HAVE_INTTYPES_H)
31-
#include <inttypes.h>
32-
#elif defined(HAVE_STDINT_H)
33-
#include <stdint.h>
34-
#endif
35-
36-
# ifndef HAVE_INT32_T
37-
# if SIZEOF_INT == 4
38-
typedef int int32_t;
39-
# elif SIZEOF_LONG == 4
40-
typedef long int int32_t;
41-
# endif
42-
# endif
43-
44-
# ifndef HAVE_UINT32_T
45-
# if SIZEOF_INT == 4
46-
typedef unsigned int uint32_t;
47-
# elif SIZEOF_LONG == 4
48-
typedef unsigned long int uint32_t;
49-
# endif
50-
# endif
26+
#include "php_stdint.h"
5127

5228
#include <stdio.h>
5329

@@ -62,8 +38,8 @@ typedef unsigned long int uint32_t;
6238
#endif
6339

6440
#if defined(_MSC_VER)
65-
typedef __uint64 timelib_ull;
66-
typedef __int64 timelib_sll;
41+
typedef uint64_t timelib_ull;
42+
typedef int64_t timelib_sll;
6743
# define TIMELIB_LL_CONST(n) n ## i64
6844
#else
6945
typedef unsigned long long timelib_ull;

main/php_stdint.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,16 @@
1919
#ifndef PHP_STDINT_H
2020
#define PHP_STDINT_H
2121

22-
#if PHP_WIN32
23-
# include "win32/php_stdint.h"
22+
#if defined(_MSC_VER)
23+
/* Make sure the regular stdint.h wasn't included already and prevent it to be
24+
included afterwards. Though if some other library needs some stuff from
25+
stdint.h included afterwards and misses it, we'd have to extend ours. On
26+
the other hand, if stdint.h was included before, some conflicts might
27+
happen so we'd likewise have to fix ours. */
28+
# if !defined(_STDINT)
29+
# define _STDINT
30+
# include "win32/php_stdint.h"
31+
# endif
2432
# define HAVE_INT8_T 1
2533
# define HAVE_UINT8_T 1
2634
# define HAVE_INT16_T 1

0 commit comments

Comments
 (0)