[PHP-CVS] cvs: php-src /ext/date/lib parse_tz.c
nlopess Sat Apr 25 16:42:24 2009 UTC Modified files: /php-src/ext/date/lib parse_tz.c Log: MFB: fix strict aliasing issues http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_tz.c?r1=1.40r2=1.41diff_format=u Index: php-src/ext/date/lib/parse_tz.c diff -u php-src/ext/date/lib/parse_tz.c:1.40 php-src/ext/date/lib/parse_tz.c:1.41 --- php-src/ext/date/lib/parse_tz.c:1.40Tue Mar 10 23:39:12 2009 +++ php-src/ext/date/lib/parse_tz.c Sat Apr 25 16:42:24 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: parse_tz.c,v 1.40 2009/03/10 23:39:12 helly Exp $ */ +/* $Id: parse_tz.c,v 1.41 2009/04/25 16:42:24 nlopess Exp $ */ #include timelib.h @@ -45,7 +45,7 @@ #define timelib_conv_int(l) ((l 0x00ff) 24) + ((l 0xff00) 8) + ((l 0x00ff) 8) + ((l 0xff00) 24) #endif -static void read_preamble(char **tzf, timelib_tzinfo *tz) +static void read_preamble(const unsigned char **tzf, timelib_tzinfo *tz) { /* skip ID */ *tzf += 4; @@ -63,7 +63,7 @@ *tzf += 13; } -static void read_header(char **tzf, timelib_tzinfo *tz) +static void read_header(const unsigned char **tzf, timelib_tzinfo *tz) { uint32_t buffer[6]; @@ -77,7 +77,7 @@ *tzf += sizeof(buffer); } -static void read_transistions(char **tzf, timelib_tzinfo *tz) +static void read_transistions(const unsigned char **tzf, timelib_tzinfo *tz) { int32_t *buffer = NULL; uint32_t i; @@ -106,7 +106,7 @@ tz-trans_idx = cbuffer; } -static void read_types(char **tzf, timelib_tzinfo *tz) +static void read_types(const unsigned char **tzf, timelib_tzinfo *tz) { unsigned char *buffer; int32_t *leap_buffer; @@ -187,7 +187,7 @@ } } -static void read_location(char **tzf, timelib_tzinfo *tz) +static void read_location(const unsigned char **tzf, timelib_tzinfo *tz) { uint32_t buffer[3]; uint32_t comments_len; @@ -296,11 +296,11 @@ if (seek_to_tz_position(tzf, timezone, tzdb)) { tmp = timelib_tzinfo_ctor(timezone); - read_preamble((char**) tzf, tmp); - read_header((char**) tzf, tmp); - read_transistions((char**) tzf, tmp); - read_types((char**) tzf, tmp); - read_location((char**) tzf, tmp); + read_preamble(tzf, tmp); + read_header(tzf, tmp); + read_transistions(tzf, tmp); + read_types(tzf, tmp); + read_location(tzf, tmp); } else { tmp = NULL; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date/lib parse_tz.c
tony2001Sat Aug 9 22:00:51 2008 UTC Modified files: /php-src/ext/date/lib parse_tz.c Log: do not fail segfault if malloc(0) returns NULL, that's expected (reproducible on AIX with simple date() and UTC timezone) http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_tz.c?r1=1.37r2=1.38diff_format=u Index: php-src/ext/date/lib/parse_tz.c diff -u php-src/ext/date/lib/parse_tz.c:1.37 php-src/ext/date/lib/parse_tz.c:1.38 --- php-src/ext/date/lib/parse_tz.c:1.37Fri Jul 18 14:33:27 2008 +++ php-src/ext/date/lib/parse_tz.c Sat Aug 9 22:00:51 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: parse_tz.c,v 1.37 2008/07/18 14:33:27 derick Exp $ */ +/* $Id: parse_tz.c,v 1.38 2008/08/09 22:00:51 tony2001 Exp $ */ #include timelib.h @@ -139,46 +139,52 @@ memcpy(tz-timezone_abbr, *tzf, sizeof(char) * tz-charcnt); *tzf += sizeof(char) * tz-charcnt; - leap_buffer = (int32_t *) malloc(tz-leapcnt * 2 * sizeof(int32_t)); - if (!leap_buffer) { - return; - } - memcpy(leap_buffer, *tzf, sizeof(int32_t) * tz-leapcnt * 2); - *tzf += sizeof(int32_t) * tz-leapcnt * 2; + if (tz-leapcnt) { + leap_buffer = (int32_t *) malloc(tz-leapcnt * 2 * sizeof(int32_t)); + if (!leap_buffer) { + return; + } + memcpy(leap_buffer, *tzf, sizeof(int32_t) * tz-leapcnt * 2); + *tzf += sizeof(int32_t) * tz-leapcnt * 2; - tz-leap_times = (tlinfo*) malloc(tz-leapcnt * sizeof(tlinfo)); - if (!tz-leap_times) { - return; - } - for (i = 0; i tz-leapcnt; i++) { - tz-leap_times[i].trans = timelib_conv_int(leap_buffer[i * 2]); - tz-leap_times[i].offset = timelib_conv_int(leap_buffer[i * 2 + 1]); - } - free(leap_buffer); - - buffer = (unsigned char*) malloc(tz-ttisstdcnt * sizeof(unsigned char)); - if (!buffer) { - return; + tz-leap_times = (tlinfo*) malloc(tz-leapcnt * sizeof(tlinfo)); + if (!tz-leap_times) { + return; + } + for (i = 0; i tz-leapcnt; i++) { + tz-leap_times[i].trans = timelib_conv_int(leap_buffer[i * 2]); + tz-leap_times[i].offset = timelib_conv_int(leap_buffer[i * 2 + 1]); + } + free(leap_buffer); } - memcpy(buffer, *tzf, sizeof(unsigned char) * tz-ttisstdcnt); - *tzf += sizeof(unsigned char) * tz-ttisstdcnt; - for (i = 0; i tz-ttisstdcnt; i++) { - tz-type[i].isstdcnt = buffer[i]; - } - free(buffer); + if (tz-ttisstdcnt) { + buffer = (unsigned char*) malloc(tz-ttisstdcnt * sizeof(unsigned char)); + if (!buffer) { + return; + } + memcpy(buffer, *tzf, sizeof(unsigned char) * tz-ttisstdcnt); + *tzf += sizeof(unsigned char) * tz-ttisstdcnt; - buffer = (unsigned char*) malloc(tz-ttisgmtcnt * sizeof(unsigned char)); - if (!buffer) { - return; + for (i = 0; i tz-ttisstdcnt; i++) { + tz-type[i].isstdcnt = buffer[i]; + } + free(buffer); } - memcpy(buffer, *tzf, sizeof(unsigned char) * tz-ttisgmtcnt); - *tzf += sizeof(unsigned char) * tz-ttisgmtcnt; - for (i = 0; i tz-ttisgmtcnt; i++) { - tz-type[i].isgmtcnt = buffer[i]; + if (tz-ttisgmtcnt) { + buffer = (unsigned char*) malloc(tz-ttisgmtcnt * sizeof(unsigned char)); + if (!buffer) { + return; + } + memcpy(buffer, *tzf, sizeof(unsigned char) * tz-ttisgmtcnt); + *tzf += sizeof(unsigned char) * tz-ttisgmtcnt; + + for (i = 0; i tz-ttisgmtcnt; i++) { + tz-type[i].isgmtcnt = buffer[i]; + } + free(buffer); } - free(buffer); } static void read_location(char **tzf, timelib_tzinfo *tz) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date/lib parse_tz.c unixtime2tm.c
derick Mon Apr 7 17:43:49 2008 UTC Modified files: /php-src/ext/date/lib parse_tz.c unixtime2tm.c Log: - Fixing returned offset. - Algorithm optimization. http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_tz.c?r1=1.35r2=1.36diff_format=u Index: php-src/ext/date/lib/parse_tz.c diff -u php-src/ext/date/lib/parse_tz.c:1.35 php-src/ext/date/lib/parse_tz.c:1.36 --- php-src/ext/date/lib/parse_tz.c:1.35Mon Dec 31 07:12:08 2007 +++ php-src/ext/date/lib/parse_tz.c Mon Apr 7 17:43:49 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: parse_tz.c,v 1.35 2007/12/31 07:12:08 sebastian Exp $ */ +/* $Id: parse_tz.c,v 1.36 2008/04/07 17:43:49 derick Exp $ */ #include timelib.h @@ -370,7 +370,7 @@ switch (t-zone_type) { case TIMELIB_ZONETYPE_ABBR: case TIMELIB_ZONETYPE_OFFSET: - return t-z * 60; + return (t-z + t-dst) * -60; case TIMELIB_ZONETYPE_ID: gmt_offset = timelib_get_time_zone_info(t-sse, t-tz_info); http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/unixtime2tm.c?r1=1.20r2=1.21diff_format=u Index: php-src/ext/date/lib/unixtime2tm.c diff -u php-src/ext/date/lib/unixtime2tm.c:1.20 php-src/ext/date/lib/unixtime2tm.c:1.21 --- php-src/ext/date/lib/unixtime2tm.c:1.20 Mon Dec 31 07:12:08 2007 +++ php-src/ext/date/lib/unixtime2tm.c Mon Apr 7 17:43:49 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: unixtime2tm.c,v 1.20 2007/12/31 07:12:08 sebastian Exp $ */ +/* $Id: unixtime2tm.c,v 1.21 2008/04/07 17:43:49 derick Exp $ */ #include timelib.h @@ -76,12 +76,18 @@ */ while (tmp_days = 0) { - cur_year--; - DEBUG(printf(tmp_days=%lld, year=%lld\n, tmp_days, cur_year);); - if (timelib_is_leap(cur_year)) { - tmp_days += DAYS_PER_LYEAR; + if (tmp_days -1460970) { + cur_year -= 4000; + DEBUG(printf(tmp_days=%lld, year=%lld\n, tmp_days, cur_year);); + tmp_days += 1460970; } else { - tmp_days += DAYS_PER_YEAR; + cur_year--; + DEBUG(printf(tmp_days=%lld, year=%lld\n, tmp_days, cur_year);); + if (timelib_is_leap(cur_year)) { + tmp_days += DAYS_PER_LYEAR; + } else { + tmp_days += DAYS_PER_YEAR; + } } } remainder += SECS_PER_DAY; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date/lib parse_tz.c /ext/hash hash_tiger.c ZendEngine2 zend_strtod.c
tony2001Tue Sep 4 18:46:08 2007 UTC Modified files: /ZendEngine2zend_strtod.c /php-src/ext/hash hash_tiger.c /php-src/ext/date/lib parse_tz.c Log: detect endianness in compile time when using Apple's GCC (fixes universal binary build) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_strtod.c?r1=1.34r2=1.35diff_format=u Index: ZendEngine2/zend_strtod.c diff -u ZendEngine2/zend_strtod.c:1.34 ZendEngine2/zend_strtod.c:1.35 --- ZendEngine2/zend_strtod.c:1.34 Wed Jul 11 11:19:58 2007 +++ ZendEngine2/zend_strtod.c Tue Sep 4 18:46:07 2007 @@ -89,7 +89,7 @@ * directly -- and assumed always to succeed. */ -/* $Id: zend_strtod.c,v 1.34 2007/07/11 11:19:58 tony2001 Exp $ */ +/* $Id: zend_strtod.c,v 1.35 2007/09/04 18:46:07 tony2001 Exp $ */ #include zend.h #include unicode/utypes.h @@ -138,6 +138,16 @@ # endif #endif +#if (defined(__APPLE__) || defined(__APPLE_CC__)) (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) +# if defined(__LITTLE_ENDIAN__) +# undef WORDS_BIGENDIAN +# else +# if defined(__BIG_ENDIAN__) +# define WORDS_BIGENDIAN +# endif +# endif +#endif + #ifdef WORDS_BIGENDIAN #define IEEE_BIG_ENDIAN #else http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash_tiger.c?r1=1.8r2=1.9diff_format=u Index: php-src/ext/hash/hash_tiger.c diff -u php-src/ext/hash/hash_tiger.c:1.8 php-src/ext/hash/hash_tiger.c:1.9 --- php-src/ext/hash/hash_tiger.c:1.8 Mon Jan 8 22:29:52 2007 +++ php-src/ext/hash/hash_tiger.c Tue Sep 4 18:46:08 2007 @@ -17,12 +17,22 @@ +--+ */ -/* $Id: hash_tiger.c,v 1.8 2007/01/08 22:29:52 nlopess Exp $ */ +/* $Id: hash_tiger.c,v 1.9 2007/09/04 18:46:08 tony2001 Exp $ */ #include php_hash.h #include php_hash_tiger.h #include php_hash_tiger_tables.h +#if (defined(__APPLE__) || defined(__APPLE_CC__)) (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) +# if defined(__LITTLE_ENDIAN__) +# undef WORDS_BIGENDIAN +# else +# if defined(__BIG_ENDIAN__) +# define WORDS_BIGENDIAN +# endif +# endif +#endif + /* {{{ */ #define save_abc \ aa = a; \ http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_tz.c?r1=1.33r2=1.34diff_format=u Index: php-src/ext/date/lib/parse_tz.c diff -u php-src/ext/date/lib/parse_tz.c:1.33 php-src/ext/date/lib/parse_tz.c:1.34 --- php-src/ext/date/lib/parse_tz.c:1.33Mon Jan 1 09:29:22 2007 +++ php-src/ext/date/lib/parse_tz.c Tue Sep 4 18:46:08 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: parse_tz.c,v 1.33 2007/01/01 09:29:22 sebastian Exp $ */ +/* $Id: parse_tz.c,v 1.34 2007/09/04 18:46:08 tony2001 Exp $ */ #include timelib.h @@ -29,6 +29,16 @@ #endif #include timezonedb.h +#if (defined(__APPLE__) || defined(__APPLE_CC__)) (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) +# if defined(__LITTLE_ENDIAN__) +# undef WORDS_BIGENDIAN +# else +# if defined(__BIG_ENDIAN__) +# define WORDS_BIGENDIAN +# endif +# endif +#endif + #ifdef WORDS_BIGENDIAN #define timelib_conv_int(l) (l) #else -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date/lib parse_tz.c
nlopess Fri Nov 10 17:32:42 2006 UTC Modified files: /php-src/ext/date/lib parse_tz.c Log: MFB http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_tz.c?r1=1.30r2=1.31diff_format=u Index: php-src/ext/date/lib/parse_tz.c diff -u php-src/ext/date/lib/parse_tz.c:1.30 php-src/ext/date/lib/parse_tz.c:1.31 --- php-src/ext/date/lib/parse_tz.c:1.30Fri Sep 1 23:33:13 2006 +++ php-src/ext/date/lib/parse_tz.c Fri Nov 10 17:32:42 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: parse_tz.c,v 1.30 2006/09/01 23:33:13 nlopess Exp $ */ +/* $Id: parse_tz.c,v 1.31 2006/11/10 17:32:42 nlopess Exp $ */ #include timelib.h @@ -192,7 +192,7 @@ } } -static int tz_search(char *timezone, int left, int right, const timelib_tzdb *tzdb) +static int tz_search(char *timezone, unsigned int left, unsigned int right, const timelib_tzdb *tzdb) { int mid, cmp; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date/lib parse_tz.c
nlopess Fri Nov 10 23:27:31 2006 UTC Modified files: /php-src/ext/date/lib parse_tz.c Log: MFB http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_tz.c?r1=1.31r2=1.32diff_format=u Index: php-src/ext/date/lib/parse_tz.c diff -u php-src/ext/date/lib/parse_tz.c:1.31 php-src/ext/date/lib/parse_tz.c:1.32 --- php-src/ext/date/lib/parse_tz.c:1.31Fri Nov 10 17:32:42 2006 +++ php-src/ext/date/lib/parse_tz.c Fri Nov 10 23:27:31 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: parse_tz.c,v 1.31 2006/11/10 17:32:42 nlopess Exp $ */ +/* $Id: parse_tz.c,v 1.32 2006/11/10 23:27:31 nlopess Exp $ */ #include timelib.h @@ -192,39 +192,26 @@ } } -static int tz_search(char *timezone, unsigned int left, unsigned int right, const timelib_tzdb *tzdb) -{ - int mid, cmp; - - if (left right) { - return -1; /* not found */ - } - - mid = (left + right) / 2; - - cmp = strcasecmp(timezone, tzdb-index[mid].id); - if (cmp 0) { - return tz_search(timezone, left, mid - 1, tzdb); - } else if (cmp 0) { - return tz_search(timezone, mid + 1, right, tzdb); - } else { /* (cmp == 0) */ - return tzdb-index[mid].pos; - } -} - - static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb) { - int pos; - - pos = tz_search(timezone, 0, tzdb-index_size - 1, tzdb); + int left = 0, right = tzdb-index_size - 1; - if (pos == -1) { - return 0; - } + do { + int mid = ((unsigned)left + right) 1; + int cmp = strcasecmp(timezone, tzdb-index[mid].id); + + if (cmp 0) { + right = mid - 1; + } else if (cmp 0) { + left = mid + 1; + } else { /* (cmp == 0) */ + (*tzf) = (tzdb-data[tzdb-index[mid].pos + 20]); + return 1; + } + + } while (left = right); - (*tzf) = (tzdb-data[pos + 20]); - return 1; + return 0; } const timelib_tzdb *timelib_builtin_db(void) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date/lib parse_tz.c
nlopess Fri Sep 1 23:19:56 2006 UTC Modified files: /php-src/ext/date/lib parse_tz.c Log: MFB: fix possible crash http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_tz.c?r1=1.28r2=1.29diff_format=u Index: php-src/ext/date/lib/parse_tz.c diff -u php-src/ext/date/lib/parse_tz.c:1.28 php-src/ext/date/lib/parse_tz.c:1.29 --- php-src/ext/date/lib/parse_tz.c:1.28Tue Jul 11 12:37:26 2006 +++ php-src/ext/date/lib/parse_tz.c Fri Sep 1 23:19:56 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: parse_tz.c,v 1.28 2006/07/11 12:37:26 tony2001 Exp $ */ +/* $Id: parse_tz.c,v 1.29 2006/09/01 23:19:56 nlopess Exp $ */ #include timelib.h @@ -196,7 +196,7 @@ { int mid, cmp; - if (left right) { + if (left = right) { return -1; /* not found */ } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date/lib parse_tz.c /ext/date/tests timezones.phpt
nlopess Fri Sep 1 23:33:13 2006 UTC Modified files: /php-src/ext/date/lib parse_tz.c /php-src/ext/date/tests timezones.phpt Log: MFH http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_tz.c?r1=1.29r2=1.30diff_format=u Index: php-src/ext/date/lib/parse_tz.c diff -u php-src/ext/date/lib/parse_tz.c:1.29 php-src/ext/date/lib/parse_tz.c:1.30 --- php-src/ext/date/lib/parse_tz.c:1.29Fri Sep 1 23:19:56 2006 +++ php-src/ext/date/lib/parse_tz.c Fri Sep 1 23:33:13 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: parse_tz.c,v 1.29 2006/09/01 23:19:56 nlopess Exp $ */ +/* $Id: parse_tz.c,v 1.30 2006/09/01 23:33:13 nlopess Exp $ */ #include timelib.h @@ -196,7 +196,7 @@ { int mid, cmp; - if (left = right) { + if (left right) { return -1; /* not found */ } @@ -217,7 +217,7 @@ { int pos; - pos = tz_search(timezone, 0, tzdb-index_size, tzdb); + pos = tz_search(timezone, 0, tzdb-index_size - 1, tzdb); if (pos == -1) { return 0; http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/timezones.phpt?r1=1.1r2=1.2diff_format=u Index: php-src/ext/date/tests/timezones.phpt diff -u /dev/null php-src/ext/date/tests/timezones.phpt:1.2 --- /dev/null Fri Sep 1 23:33:13 2006 +++ php-src/ext/date/tests/timezones.phpt Fri Sep 1 23:33:13 2006 @@ -0,0 +1,26 @@ +--TEST-- +setting bogus timezones +--FILE-- +?php + +//bogus +var_dump(date_default_timezone_set('AAA')); +var_dump(date_default_timezone_set('ZZZ')); + + +//now the first and the last one +var_dump(date_default_timezone_set(Africa/Abidjan)); +var_dump(date_default_timezone_set(Zulu)); + +echo done\n; + +? +--EXPECTF-- +Notice: date_default_timezone_set(): Timezone ID 'AAA' is invalid in %stimezones.php on line 4 +bool(false) + +Notice: date_default_timezone_set(): Timezone ID 'ZZZ' is invalid in %stimezones.php on line 5 +bool(false) +bool(true) +bool(true) +done -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date/lib parse_tz.c
tony2001Tue Jul 11 12:37:26 2006 UTC Modified files: /php-src/ext/date/lib parse_tz.c Log: MFB: eliminate compile warnings http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_tz.c?r1=1.27r2=1.28diff_format=u Index: php-src/ext/date/lib/parse_tz.c diff -u php-src/ext/date/lib/parse_tz.c:1.27 php-src/ext/date/lib/parse_tz.c:1.28 --- php-src/ext/date/lib/parse_tz.c:1.27Sun May 14 17:30:26 2006 +++ php-src/ext/date/lib/parse_tz.c Tue Jul 11 12:37:26 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: parse_tz.c,v 1.27 2006/05/14 17:30:26 derick Exp $ */ +/* $Id: parse_tz.c,v 1.28 2006/07/11 12:37:26 tony2001 Exp $ */ #include timelib.h @@ -240,8 +240,8 @@ int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb) { - unsigned char *tzf; - return (seek_to_tz_position((unsigned char**) tzf, timezone, tzdb)); + const unsigned char *tzf; + return (seek_to_tz_position(tzf, timezone, tzdb)); } timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb) @@ -249,7 +249,7 @@ const unsigned char *tzf; timelib_tzinfo *tmp; - if (seek_to_tz_position((unsigned char**) tzf, timezone, tzdb)) { + if (seek_to_tz_position(tzf, timezone, tzdb)) { tmp = timelib_tzinfo_ctor(timezone); read_header((char**) tzf, tmp); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date/lib parse_tz.c /ext/date/tests bug33414-2.phpt
derick Thu Sep 1 08:41:44 2005 EDT Modified files: /php-src/ext/date/lib parse_tz.c /php-src/ext/date/tests bug33414-2.phpt Log: - Fixed bug #33414 (Comprehensive list of incorrect days returned after strtotime() / date() tests). http://cvs.php.net/diff.php/php-src/ext/date/lib/parse_tz.c?r1=1.20r2=1.21ty=u Index: php-src/ext/date/lib/parse_tz.c diff -u php-src/ext/date/lib/parse_tz.c:1.20 php-src/ext/date/lib/parse_tz.c:1.21 --- php-src/ext/date/lib/parse_tz.c:1.20Wed Aug 3 10:06:49 2005 +++ php-src/ext/date/lib/parse_tz.c Thu Sep 1 08:41:43 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: parse_tz.c,v 1.20 2005/08/03 14:06:49 sniper Exp $ */ +/* $Id: parse_tz.c,v 1.21 2005/09/01 12:41:43 derick Exp $ */ #include timelib.h @@ -164,6 +164,15 @@ printf(Local types count: %lu\n, (unsigned long) tz-typecnt); printf(Zone Abbr. count: %lu\n, (unsigned long) tz-charcnt); + printf (%8s (%12s) = %3d [%5ld %1d %3d '%s' (%d,%d)]\n, + , , 0, + (long int) tz-type[0].offset, + tz-type[0].isdst, + tz-type[0].abbr_idx, + tz-timezone_abbr[tz-type[0].abbr_idx], + tz-type[0].isstdcnt, + tz-type[0].isgmtcnt + ); for (i = 0; i tz-timecnt; i++) { printf (%08X (%12d) = %3d [%5ld %1d %3d '%s' (%d,%d)]\n, tz-trans[i], tz-trans[i], tz-trans_idx[i], @@ -244,6 +253,8 @@ { uint32_t i; + /* If there is no transistion time, we pick the first one, if that doesn't +* exist we return NULL */ if (!tz-timecnt || !tz-trans) { *transition_time = 0; if (tz-typecnt == 1) { @@ -252,10 +263,26 @@ return NULL; } + /* If the TS is lower than the first transistion time, then we scan over +* all the transistion times to find the first non-DST one, or the first +* one in case there are only DST entries. Not sure which smartass came up +* with this idea in the first though :) */ if (ts tz-trans[0]) { + uint32_t j; + *transition_time = 0; - return (tz-type[tz-trans_idx[tz-timecnt - 1]]); + j = 0; + while (j tz-timecnt tz-type[j].isdst) { + ++j; + } + if (j == tz-timecnt) { + j = 0; + } + return (tz-type[j]); } + + /* In all other cases we loop through the available transtion times to find +* the correct entry */ for (i = 0; i tz-timecnt; i++) { if (ts tz-trans[i]) { *transition_time = tz-trans[i - 1]; http://cvs.php.net/diff.php/php-src/ext/date/tests/bug33414-2.phpt?r1=1.3r2=1.4ty=u Index: php-src/ext/date/tests/bug33414-2.phpt diff -u php-src/ext/date/tests/bug33414-2.phpt:1.3 php-src/ext/date/tests/bug33414-2.phpt:1.4 --- php-src/ext/date/tests/bug33414-2.phpt:1.3 Tue Aug 9 17:07:54 2005 +++ php-src/ext/date/tests/bug33414-2.phpt Thu Sep 1 08:41:43 2005 @@ -106,8 +106,8 @@ wanted=Tuesday00:00:00 TZ=Pacific/Pitcairn - wrong day. -tStamp=Thursday 1970-01-01 17:17:17 PST 0 -result=Wednesday 1970-01-06 00:00:00 PST 0 +tStamp=Thursday 1970-01-01 17:17:17 PNT 0 +result=Wednesday 1970-01-07 00:00:00 PNT 0 wanted=Wednesday00:00:00 TZ=Pacific/Fakaofo - wrong day. -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date/lib parse_tz.c
derick Sun Jul 3 14:49:07 2005 EDT Modified files: /php-src/ext/date/lib parse_tz.c Log: - Fixed unintialized variable issue. http://cvs.php.net/diff.php/php-src/ext/date/lib/parse_tz.c?r1=1.17r2=1.18ty=u Index: php-src/ext/date/lib/parse_tz.c diff -u php-src/ext/date/lib/parse_tz.c:1.17 php-src/ext/date/lib/parse_tz.c:1.18 --- php-src/ext/date/lib/parse_tz.c:1.17Thu Jun 30 17:38:06 2005 +++ php-src/ext/date/lib/parse_tz.c Sun Jul 3 14:49:07 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: parse_tz.c,v 1.17 2005/06/30 21:38:06 derick Exp $ */ +/* $Id: parse_tz.c,v 1.18 2005/07/03 18:49:07 derick Exp $ */ #include timelib.h @@ -239,6 +239,7 @@ uint32_t i; if (!tz-timecnt || !tz-trans) { + *transition_time = 0; if (tz-typecnt == 1) { return (tz-type[0]); } @@ -301,6 +302,7 @@ tmp-is_dst = to-isdst; tmp-transistion_time = transistion_time; } else { + offset = 0; abbr = tz-timezone_abbr; tmp-is_dst = 0; tmp-transistion_time = 0; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date/lib parse_tz.c
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.12r2=1.13ty=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.12Sat 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 0x00ff) 24) + ((l 0xff00) 8) + ((l 0x00ff) 8) + ((l 0xff00) 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
[PHP-CVS] cvs: php-src /ext/date/lib parse_tz.c
derick Sat Jun 18 07:58:20 2005 EDT Modified files: /php-src/ext/date/lib parse_tz.c Log: - If the ts is smaller than the first transition time, use the last one in the list. #- This seems consistent with how zdump works, although I'm not 100% sure if # it's correct. http://cvs.php.net/diff.php/php-src/ext/date/lib/parse_tz.c?r1=1.10r2=1.11ty=u Index: php-src/ext/date/lib/parse_tz.c diff -u php-src/ext/date/lib/parse_tz.c:1.10 php-src/ext/date/lib/parse_tz.c:1.11 --- php-src/ext/date/lib/parse_tz.c:1.10Sat Jun 18 07:15:29 2005 +++ php-src/ext/date/lib/parse_tz.c Sat Jun 18 07:58:18 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: parse_tz.c,v 1.10 2005/06/18 11:15:29 derick Exp $ */ +/* $Id: parse_tz.c,v 1.11 2005/06/18 11:58:18 derick Exp $ */ #include timelib_config.h @@ -228,6 +228,9 @@ return NULL; } + if (ts tz-trans[0]) { + return (tz-type[tz-trans_idx[tz-timecnt - 1]]); + } for (i = 0; i tz-timecnt; i++) { if (ts tz-trans[i]) { return (tz-type[tz-trans_idx[i - 1]]); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/date/lib parse_tz.c timelib_structs.h tm2unixtime.c
derick Sat Jun 18 15:23:59 2005 EDT Modified files: /php-src/ext/date/lib parse_tz.c timelib_structs.h tm2unixtime.c Log: - Fixed bug in tm2unixtime where the wanted date was in the transition time between two zones. #- In this case the wanted date actually didn't exist, and that wasn't # handled correctly. http://cvs.php.net/diff.php/php-src/ext/date/lib/parse_tz.c?r1=1.11r2=1.12ty=u Index: php-src/ext/date/lib/parse_tz.c diff -u php-src/ext/date/lib/parse_tz.c:1.11 php-src/ext/date/lib/parse_tz.c:1.12 --- php-src/ext/date/lib/parse_tz.c:1.11Sat Jun 18 07:58:18 2005 +++ php-src/ext/date/lib/parse_tz.c Sat Jun 18 15:23:58 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: parse_tz.c,v 1.11 2005/06/18 11:58:18 derick Exp $ */ +/* $Id: parse_tz.c,v 1.12 2005/06/18 19:23:58 derick Exp $ */ #include timelib_config.h @@ -220,7 +220,7 @@ return tmp; } -static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts) +static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib_sll *transition_time) { uint32_t i; @@ -229,13 +229,16 @@ } if (ts tz-trans[0]) { + *transition_time = 0; return (tz-type[tz-trans_idx[tz-timecnt - 1]]); } for (i = 0; i tz-timecnt; i++) { if (ts tz-trans[i]) { + *transition_time = tz-trans[i - 1]; return (tz-type[tz-trans_idx[i - 1]]); } } + *transition_time = tz-trans[tz-timecnt - 1]; return (tz-type[tz-trans_idx[tz-timecnt - 1]]); } @@ -258,7 +261,9 @@ int timelib_timestamp_is_in_dst(timelib_sll ts, timelib_tzinfo *tz) { ttinfo *to; - if ((to = fetch_timezone_offset(tz, ts))) { + timelib_sll dummy; + + if ((to = fetch_timezone_offset(tz, ts, dummy))) { return to-isdst; } return -1; @@ -271,14 +276,17 @@ int32_t offset = 0, leap_secs = 0; char *abbr; timelib_time_offset *tmp = timelib_time_offset_ctor(); + timelib_slltransistion_time; - if ((to = fetch_timezone_offset(tz, ts))) { + if ((to = fetch_timezone_offset(tz, ts, transistion_time))) { offset = to-offset; abbr = (tz-timezone_abbr[to-abbr_idx]); tmp-is_dst = to-isdst; + tmp-transistion_time = transistion_time; } else { abbr = tz-timezone_abbr; tmp-is_dst = 0; + tmp-transistion_time = 0; } if ((tl = fetch_leaptime_offset(tz, ts))) { http://cvs.php.net/diff.php/php-src/ext/date/lib/timelib_structs.h?r1=1.8r2=1.9ty=u Index: php-src/ext/date/lib/timelib_structs.h diff -u php-src/ext/date/lib/timelib_structs.h:1.8 php-src/ext/date/lib/timelib_structs.h:1.9 --- php-src/ext/date/lib/timelib_structs.h:1.8 Fri Jun 17 10:54:00 2005 +++ php-src/ext/date/lib/timelib_structs.h Sat Jun 18 15:23:58 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: timelib_structs.h,v 1.8 2005/06/17 14:54:00 derick Exp $ */ +/* $Id: timelib_structs.h,v 1.9 2005/06/18 19:23:58 derick Exp $ */ #ifndef __TIMELIB_STRUCTS_H__ #define __TIMELIB_STRUCTS_H__ @@ -119,6 +119,7 @@ unsigned int leap_secs; unsigned int is_dst; char*abbr; + timelib_sll transistion_time; } timelib_time_offset; typedef struct timelib_time { http://cvs.php.net/diff.php/php-src/ext/date/lib/tm2unixtime.c?r1=1.9r2=1.10ty=u Index: php-src/ext/date/lib/tm2unixtime.c diff -u php-src/ext/date/lib/tm2unixtime.c:1.9 php-src/ext/date/lib/tm2unixtime.c:1.10 --- php-src/ext/date/lib/tm2unixtime.c:1.9 Fri Jun 17 10:54:00 2005 +++ php-src/ext/date/lib/tm2unixtime.c Sat Jun 18 15:23:58 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: tm2unixtime.c,v 1.9 2005/06/17 14:54:00 derick Exp $ */ +/* $Id: tm2unixtime.c,v 1.10 2005/06/18 19:23:58 derick Exp $ */ #include timelib_config.h #include timelib.h @@ -209,14 +209,21 @@ /* No timezone in struct, fallback to reference if possible */ if (tzi) { timelib_time_offset *before, *after; - timelib_sll tmp; + timelib_sll tmp; + int in_transistion; tz-is_localtime = 1; before = timelib_get_time_zone_info(tz-sse, tzi); after = timelib_get_time_zone_info(tz-sse - before-offset, tzi); timelib_set_timezone(tz, tzi); -
[PHP-CVS] cvs: php-src /ext/date/lib parse_tz.c timelib.h timelib_structs.h
derick Thu Jun 16 14:34:43 2005 EDT Modified files: /php-src/ext/date/lib parse_tz.c timelib.h timelib_structs.h Log: - Fixed headers for FreeBSD - Moved from ntohl to own macro - Export timelib_dump_tzinfo http://cvs.php.net/diff.php/php-src/ext/date/lib/parse_tz.c?r1=1.5r2=1.6ty=u Index: php-src/ext/date/lib/parse_tz.c diff -u php-src/ext/date/lib/parse_tz.c:1.5 php-src/ext/date/lib/parse_tz.c:1.6 --- php-src/ext/date/lib/parse_tz.c:1.5 Thu Jun 16 13:12:41 2005 +++ php-src/ext/date/lib/parse_tz.c Thu Jun 16 14:34:42 2005 @@ -16,30 +16,32 @@ +--+ */ -/* $Id: parse_tz.c,v 1.5 2005/06/16 17:12:41 derick Exp $ */ +/* $Id: parse_tz.c,v 1.6 2005/06/16 18:34:42 derick Exp $ */ #include stdio.h #ifdef WIN32 #include winsock2.h #else -#include netinet/in.h +#include inttypes.h #endif #include string.h #include timelib.h #include timezonedb.h +#define timelib_conv_int(l) ((l 0x00ff) 24) + ((l 0xff00) 8) + ((l 0x00ff) 8) + ((l 0xff00) 24) + static void read_header(char **tzf, timelib_tzinfo *tz) { uint32_t buffer[6]; memcpy(buffer, *tzf, sizeof(buffer)); - tz-ttisgmtcnt = htonl(buffer[0]); - tz-ttisstdcnt = htonl(buffer[1]); - tz-leapcnt= htonl(buffer[2]); - tz-timecnt= htonl(buffer[3]); - tz-typecnt= htonl(buffer[4]); - tz-charcnt= htonl(buffer[5]); + tz-ttisgmtcnt = timelib_conv_int(buffer[0]); + tz-ttisstdcnt = timelib_conv_int(buffer[1]); + tz-leapcnt= timelib_conv_int(buffer[2]); + tz-timecnt= timelib_conv_int(buffer[3]); + tz-typecnt= timelib_conv_int(buffer[4]); + tz-charcnt= timelib_conv_int(buffer[5]); *tzf += sizeof(buffer); } @@ -57,7 +59,7 @@ memcpy(buffer, *tzf, sizeof(int32_t) * tz-timecnt); *tzf += (sizeof(int32_t) * tz-timecnt); for (i = 0; i tz-timecnt; i++) { - buffer[i] = htonl(buffer[i]); + buffer[i] = timelib_conv_int(buffer[i]); } cbuffer = (unsigned char*) malloc(tz-timecnt * sizeof(unsigned char)); @@ -114,8 +116,8 @@ return; } for (i = 0; i tz-leapcnt; i++) { - tz-leap_times[i].trans = htonl(leap_buffer[i * 2]); - tz-leap_times[i].offset = htonl(leap_buffer[i * 2 + 1]); + tz-leap_times[i].trans = timelib_conv_int(leap_buffer[i * 2]); + tz-leap_times[i].offset = timelib_conv_int(leap_buffer[i * 2 + 1]); } free(leap_buffer); @@ -144,8 +146,7 @@ free(buffer); } -#if 0 -static void dumpinfo(timelib_tzinfo *tz) +void timelib_dump_tzinfo(timelib_tzinfo *tz) { uint32_t i; @@ -159,7 +160,7 @@ for (i = 0; i tz-timecnt; i++) { printf (%08X (%12d) = %3d [%5ld %1d %3d '%s' (%d,%d)]\n, tz-trans[i], tz-trans[i], tz-trans_idx[i], - tz-type[tz-trans_idx[i]].offset, + (long int) tz-type[tz-trans_idx[i]].offset, tz-type[tz-trans_idx[i]].isdst, tz-type[tz-trans_idx[i]].abbr_idx, tz-timezone_abbr[tz-type[tz-trans_idx[i]].abbr_idx], @@ -174,7 +175,6 @@ tz-leap_times[i].offset); } } -#endif static int seek_to_tz_position(char **tzf, char *timezone) { http://cvs.php.net/diff.php/php-src/ext/date/lib/timelib.h?r1=1.1r2=1.2ty=u Index: php-src/ext/date/lib/timelib.h diff -u php-src/ext/date/lib/timelib.h:1.1 php-src/ext/date/lib/timelib.h:1.2 --- php-src/ext/date/lib/timelib.h:1.1 Thu Jun 16 13:12:41 2005 +++ php-src/ext/date/lib/timelib.h Thu Jun 16 14:34:42 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: timelib.h,v 1.1 2005/06/16 17:12:41 derick Exp $ */ +/* $Id: timelib.h,v 1.2 2005/06/16 18:34:42 derick Exp $ */ #include timelib_structs.h @@ -53,6 +53,7 @@ timelib_tzinfo *timelib_parse_tzfile(char *timezone); int timelib_timestamp_is_in_dst(timelib_sll ts, timelib_tzinfo *tz); timelib_time_offset *timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo *tz); +void timelib_dump_tzinfo(timelib_tzinfo *tz); /* From timelib.c */ timelib_tzinfo* timelib_tzinfo_ctor(); http://cvs.php.net/diff.php/php-src/ext/date/lib/timelib_structs.h?r1=1.5r2=1.6ty=u Index: php-src/ext/date/lib/timelib_structs.h diff -u php-src/ext/date/lib/timelib_structs.h:1.5 php-src/ext/date/lib/timelib_structs.h:1.6 --- php-src/ext/date/lib/timelib_structs.h:1.5 Wed Jun 15 07:01:05 2005 +++ php-src/ext/date/lib/timelib_structs.h Thu Jun 16 14:34:42 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: timelib_structs.h,v 1.5
[PHP-CVS] cvs: php-src /ext/date/lib parse_tz.c timelib_structs.h unixtime2tm.c /ext/date/lib/resource parse_date.re
edink Wed Jun 15 05:02:28 2005 EDT Modified files: /php-src/ext/date/lib parse_tz.c timelib_structs.h unixtime2tm.c /php-src/ext/date/lib/resource parse_date.re Log: Nuke PHP_ prefix from timelib http://cvs.php.net/diff.php/php-src/ext/date/lib/parse_tz.c?r1=1.2r2=1.3ty=u Index: php-src/ext/date/lib/parse_tz.c diff -u php-src/ext/date/lib/parse_tz.c:1.2 php-src/ext/date/lib/parse_tz.c:1.3 --- php-src/ext/date/lib/parse_tz.c:1.2 Tue Jun 14 20:11:29 2005 +++ php-src/ext/date/lib/parse_tz.c Wed Jun 15 05:02:28 2005 @@ -16,10 +16,10 @@ +--+ */ -/* $Id: parse_tz.c,v 1.2 2005/06/15 00:11:29 edink Exp $ */ +/* $Id: parse_tz.c,v 1.3 2005/06/15 09:02:28 edink Exp $ */ #include stdio.h -#ifdef PHP_WIN32 +#ifdef WIN32 #include winsock2.h #else #include netinet/in.h http://cvs.php.net/diff.php/php-src/ext/date/lib/timelib_structs.h?r1=1.3r2=1.4ty=u Index: php-src/ext/date/lib/timelib_structs.h diff -u php-src/ext/date/lib/timelib_structs.h:1.3 php-src/ext/date/lib/timelib_structs.h:1.4 --- php-src/ext/date/lib/timelib_structs.h:1.3 Wed Jun 15 03:23:27 2005 +++ php-src/ext/date/lib/timelib_structs.h Wed Jun 15 05:02:28 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: timelib_structs.h,v 1.3 2005/06/15 07:23:27 derick Exp $ */ +/* $Id: timelib_structs.h,v 1.4 2005/06/15 09:02:28 edink Exp $ */ #ifndef __TIMELIB_STRUCTS_H__ #define __TIMELIB_STRUCTS_H__ @@ -24,13 +24,13 @@ #include stdlib.h #include stdio.h #include string.h -#ifdef PHP_WIN32 +#ifdef WIN32 #include winsock2.h #else #include netinet/in.h #endif -#if defined(PHP_WIN32) _MSC_VER 1300 +#if defined(_MSC_VER) _MSC_VER 1300 typedef unsigned __int64 timelib_ull; typedef __int64 timelib_sll; #else http://cvs.php.net/diff.php/php-src/ext/date/lib/unixtime2tm.c?r1=1.2r2=1.3ty=u Index: php-src/ext/date/lib/unixtime2tm.c diff -u php-src/ext/date/lib/unixtime2tm.c:1.2 php-src/ext/date/lib/unixtime2tm.c:1.3 --- php-src/ext/date/lib/unixtime2tm.c:1.2 Tue Jun 14 20:11:29 2005 +++ php-src/ext/date/lib/unixtime2tm.c Wed Jun 15 05:02:28 2005 @@ -16,16 +16,16 @@ +--+ */ -/* $Id: unixtime2tm.c,v 1.2 2005/06/15 00:11:29 edink Exp $ */ +/* $Id: unixtime2tm.c,v 1.3 2005/06/15 09:02:28 edink Exp $ */ #include stdlib.h #include stdio.h #include string.h #if defined(_MSC_VER) -#define PHP_LL_CONST(n) n ## i64 +#define TIMELIB_LL_CONST(n) n ## i64 #else -#define PHP_LL_CONST(n) n ## ll +#define TIMELIB_LL_CONST(n) n ## ll #endif #include datetime.h @@ -67,7 +67,7 @@ /* Guess why this might be for, it has to do with a pope ;-). It's also * only valid for Great Brittain and it's colonies. It needs fixing for * other locales. *sigh*, why is this crap so complex! */ - if (ts = PHP_LL_CONST(-6857352000)) { + if (ts = TIMELIB_LL_CONST(-6857352000)) { tmp_days -= 11; } http://cvs.php.net/diff.php/php-src/ext/date/lib/resource/parse_date.re?r1=1.4r2=1.5ty=u Index: php-src/ext/date/lib/resource/parse_date.re diff -u php-src/ext/date/lib/resource/parse_date.re:1.4 php-src/ext/date/lib/resource/parse_date.re:1.5 --- php-src/ext/date/lib/resource/parse_date.re:1.4 Wed Jun 15 03:58:21 2005 +++ php-src/ext/date/lib/resource/parse_date.re Wed Jun 15 05:02:28 2005 @@ -16,14 +16,14 @@ +--+ */ -/* $Id: parse_date.re,v 1.4 2005/06/15 07:58:21 derick Exp $ */ +/* $Id: parse_date.re,v 1.5 2005/06/15 09:02:28 edink Exp $ */ #include stdlib.h #include stdio.h #include string.h #include datetime.h -#ifdef PHP_WIN32 +#if defined(_MSC_VER) #define strcasecmp stricmp #define strtoll(s, f, b) _atoi64(s) #endif -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php