derick          Mon Jun 20 07:07:54 2005 EDT

  Modified files:              
    /php-src/ext/date/lib       parse_tz.c 
  Log:
  - Make this work on big endian systems too.
  - Added an additional malloc() check.
  
  
http://cvs.php.net/diff.php/php-src/ext/date/lib/parse_tz.c?r1=1.12&r2=1.13&ty=u
Index: php-src/ext/date/lib/parse_tz.c
diff -u php-src/ext/date/lib/parse_tz.c:1.12 
php-src/ext/date/lib/parse_tz.c:1.13
--- php-src/ext/date/lib/parse_tz.c:1.12        Sat Jun 18 15:23:58 2005
+++ php-src/ext/date/lib/parse_tz.c     Mon Jun 20 07:07:53 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: parse_tz.c,v 1.12 2005/06/18 19:23:58 derick Exp $ */
+/* $Id: parse_tz.c,v 1.13 2005/06/20 11:07:53 derick Exp $ */
 
 #include <timelib_config.h>
 
@@ -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 @@
        *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;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to