-
-
Save weltling/e2c295a1c2efed62890e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ext/date/lib/timelib.c b/ext/date/lib/timelib.c | |
index ad25f8b..0d7fdd1 100644 | |
--- a/ext/date/lib/timelib.c | |
+++ b/ext/date/lib/timelib.c | |
@@ -176,13 +176,19 @@ void timelib_error_container_dtor(timelib_error_container *errors) | |
free(errors); | |
} | |
-php_int_t timelib_date_to_int(timelib_time *d, int *error) | |
+timelib_sll timelib_date_to_int(timelib_time *d, int *error) | |
{ | |
timelib_sll ts; | |
ts = d->sse; | |
- if (ts < PHP_INT_MIN || ts > PHP_INT_MAX) { | |
+#if defined(_WIN64) | |
+ if (ts < _I64_MIN || ts > _I64_MAX) { | |
+#elif defined(__X86_64__) || defined(__LP64__) || defined(_LP64) | |
+ if (ts < INT64_MIN || ts > INT64_MAX) { | |
+#else | |
+ if (ts < LONG_MIN || ts > LONG_MAX) { | |
+#endif | |
if (error) { | |
*error = 1; | |
} | |
@@ -191,7 +197,7 @@ php_int_t timelib_date_to_int(timelib_time *d, int *error) | |
if (error) { | |
*error = 0; | |
} | |
- return (php_int_t) d->sse; | |
+ return (timelib_sll) d->sse; | |
} | |
void timelib_decimal_hour_to_hms(double h, int *hour, int *min, int *sec) | |
diff --git a/ext/date/lib/timelib.h b/ext/date/lib/timelib.h | |
index 45160ae..33816f7 100644 | |
--- a/ext/date/lib/timelib.h | |
+++ b/ext/date/lib/timelib.h | |
@@ -21,7 +21,6 @@ | |
#ifndef __TIMELIB_H__ | |
#define __TIMELIB_H__ | |
-#include "php.h" /* for php_int_t */ | |
#include "timelib_structs.h" | |
#if HAVE_LIMITS_H | |
#include <limits.h> | |
@@ -129,7 +128,7 @@ void timelib_time_offset_dtor(timelib_time_offset* t); | |
void timelib_error_container_dtor(timelib_error_container *errors); | |
-php_int_t timelib_date_to_int(timelib_time *d, int *error); | |
+timelib_sll timelib_date_to_int(timelib_time *d, int *error); | |
void timelib_dump_date(timelib_time *d, int options); | |
void timelib_dump_rel_time(timelib_rel_time *d); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment