summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerick Rethans <derick@php.net>2005-06-20 11:07:53 +0000
committerDerick Rethans <derick@php.net>2005-06-20 11:07:53 +0000
commit610fd92ee705e53aac6e5f84b96b5825e051f9c9 (patch)
tree29d33ee79d2016637ea1bff664b7a1bb641f2aa9
parent4dfa3fc73176d7a86f5e13a13e5b600a82b8b4b6 (diff)
downloadphp-git-610fd92ee705e53aac6e5f84b96b5825e051f9c9.tar.gz
- Make this work on big endian systems too.
- Added an additional malloc() check.
-rw-r--r--ext/date/lib/parse_tz.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c
index 831ae73405..60aac4435d 100644
--- a/ext/date/lib/parse_tz.c
+++ b/ext/date/lib/parse_tz.c
@@ -31,7 +31,11 @@
#include "timelib.h"
#include "timezonedb.h"
+#ifdef WORDS_BIGENDIAN
+#define timelib_conv_int(l) (l)
+#else
#define timelib_conv_int(l) ((l & 0x000000ff) << 24) + ((l & 0x0000ff00) << 8) + ((l & 0x00ff0000) >> 8) + ((l & 0xff000000) >> 24)
+#endif
static void read_header(char **tzf, timelib_tzinfo *tz)
{
@@ -90,6 +94,9 @@ static void read_types(char **tzf, timelib_tzinfo *tz)
*tzf += sizeof(unsigned char) * 6 * tz->typecnt;
tz->type = (ttinfo*) malloc(tz->typecnt * sizeof(struct ttinfo));
+ if (!tz->type) {
+ return;
+ }
for (i = 0; i < tz->typecnt; i++) {
j = i * 6;