From: Wez Furlong Date: Sat, 13 Aug 2005 02:23:29 +0000 (+0000) Subject: vs.net 2005 introduces 64-bit time_t. X-Git-Tag: PRE_NEW_OCI8_EXTENSION~284 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c2909b377bcbc55b57a5b1d225ef60fceaaaaeec;p=php vs.net 2005 introduces 64-bit time_t. I can't say that I think this is a great idea, but it does highlight a couple of dodgy areas where we assume that ints and longs are the same thing as time_t's. Let's try to ensure that we declare structure fields and function parameters with the correct type when we're talkingabout time_t's, to avoid possibly nasty problems with passing the wrong sized thing around. --- diff --git a/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c index 8372a6d931..6030ae915a 100644 --- a/ext/com_dotnet/com_variant.c +++ b/ext/com_dotnet/com_variant.c @@ -789,6 +789,7 @@ PHP_FUNCTION(variant_date_to_timestamp) PHP_FUNCTION(variant_date_from_timestamp) { long timestamp; + time_t ttstamp; SYSTEMTIME systime; struct tm *tmv; VARIANT res; @@ -800,7 +801,8 @@ PHP_FUNCTION(variant_date_from_timestamp) VariantInit(&res); tzset(); - tmv = localtime(×tamp); + ttstamp = timestamp; + tmv = localtime(&ttstamp); memset(&systime, 0, sizeof(systime)); systime.wDay = tmv->tm_mday; diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h index a4ef3005d0..bfedc992cd 100644 --- a/ext/standard/basic_functions.h +++ b/ext/standard/basic_functions.h @@ -173,7 +173,7 @@ typedef struct _php_basic_globals { long page_uid; long page_gid; long page_inode; - long page_mtime; + time_t page_mtime; /* filestat.c && main/streams/streams.c */ char *CurrentStatFile, *CurrentLStatFile; diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index 8f4c541099..93b58959ff 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -71,7 +71,7 @@ static int phpday_tab[2][12] = { /* {{{ php_idate */ -PHPAPI int php_idate(char format, int timestamp, int gm) +PHPAPI int php_idate(char format, time_t timestamp, int gm) { time_t the_time; struct tm *ta, tmbuf; @@ -178,7 +178,8 @@ PHPAPI int php_idate(char format, int timestamp, int gm) PHP_FUNCTION(idate) { zval **format, **timestamp; - int t, ret; + int ret; + time_t t; switch (ZEND_NUM_ARGS()) { case 1: diff --git a/ext/standard/pageinfo.c b/ext/standard/pageinfo.c index 7fc6d95490..fd99ed41ae 100644 --- a/ext/standard/pageinfo.c +++ b/ext/standard/pageinfo.c @@ -158,7 +158,7 @@ PHP_FUNCTION(getmyinode) } /* }}} */ -PHPAPI long php_getlastmod(TSRMLS_D) +PHPAPI time_t php_getlastmod(TSRMLS_D) { php_statpage(TSRMLS_C); return BG(page_mtime); diff --git a/ext/standard/pageinfo.h b/ext/standard/pageinfo.h index 1239d880da..7adf343af5 100644 --- a/ext/standard/pageinfo.h +++ b/ext/standard/pageinfo.h @@ -28,7 +28,7 @@ PHP_FUNCTION(getmyinode); PHP_FUNCTION(getlastmod); PHPAPI void php_statpage(TSRMLS_D); -PHPAPI long php_getlastmod(TSRMLS_D); +PHPAPI time_t php_getlastmod(TSRMLS_D); extern long php_getuid(void); extern long php_getgid(void);