edink           Tue Jun 14 20:11:29 2005 EDT

  Modified files:              
    /php-src/ext/date   php_date.c 
    /php-src/ext/date/lib       datetime.h parse_tz.c timelib_structs.h 
                                tm2unixtime.c unixtime2tm.c 
    /php-src/ext/date/lib/resource      parse_date.re 
  Log:
  Make it compile on windows
  
http://cvs.php.net/diff.php/php-src/ext/date/php_date.c?r1=1.2&r2=1.3&ty=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.2 php-src/ext/date/php_date.c:1.3
--- php-src/ext/date/php_date.c:1.2     Tue Jun 14 19:40:56 2005
+++ php-src/ext/date/php_date.c Tue Jun 14 20:11:28 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_date.c,v 1.2 2005/06/14 23:40:56 iliaa Exp $ */
+/* $Id: php_date.c,v 1.3 2005/06/15 00:11:28 edink Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -126,7 +126,7 @@
        } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 
ZEND_NUM_ARGS() TSRMLS_CC, "s", &times, &time_len) != FAILURE) {
                /* We have no initial timestamp */
                now = timelib_time_ctor();
-               timelib_unixtime2local(now, (signed long long) time(NULL), tzi);
+               timelib_unixtime2local(now, (timelib_sll) time(NULL), tzi);
        } else {
                timelib_tzinfo_ctor(tzi);
                RETURN_FALSE;
http://cvs.php.net/diff.php/php-src/ext/date/lib/datetime.h?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/date/lib/datetime.h
diff -u php-src/ext/date/lib/datetime.h:1.1 php-src/ext/date/lib/datetime.h:1.2
--- php-src/ext/date/lib/datetime.h:1.1 Tue Jun 14 17:32:27 2005
+++ php-src/ext/date/lib/datetime.h     Tue Jun 14 20:11:29 2005
@@ -16,13 +16,22 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: datetime.h,v 1.1 2005/06/14 21:32:27 derick Exp $ */
+/* $Id: datetime.h,v 1.2 2005/06/15 00:11:29 edink Exp $ */
 
 #include "timelib_structs.h"
 
 #define TIMELIB_NONE             0x00
 #define TIMELIB_OVERRIDE_TIME    0x01
 
+#ifndef LONG_MAX
+#define LONG_MAX 2147483647L
+#endif
+
+#ifndef LONG_MIN
+#define LONG_MIN (- LONG_MAX - 1)
+#endif
+
+
 /* From dow.c */
 int timelib_day_of_week(int y, int m, int d);
 int timelib_daynr_from_weeknr(int y, int w, int d);
@@ -35,7 +44,7 @@
 void timelib_update_ts(timelib_time* time, timelib_tzinfo* tzi);
 
 /* From unixtime2tm.c */
-int timelib_apply_localtime(timelib_time *t, uint localtime);
+int timelib_apply_localtime(timelib_time *t, unsigned int       localtime);
 void timelib_unixtime2gmt(timelib_time* tm, timelib_sll ts);
 void timelib_unixtime2local(timelib_time *tm, timelib_sll ts, timelib_tzinfo* 
tz);
 void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz);
http://cvs.php.net/diff.php/php-src/ext/date/lib/parse_tz.c?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/date/lib/parse_tz.c
diff -u php-src/ext/date/lib/parse_tz.c:1.1 php-src/ext/date/lib/parse_tz.c:1.2
--- php-src/ext/date/lib/parse_tz.c:1.1 Tue Jun 14 17:32:27 2005
+++ php-src/ext/date/lib/parse_tz.c     Tue Jun 14 20:11:29 2005
@@ -16,10 +16,14 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: parse_tz.c,v 1.1 2005/06/14 21:32:27 derick Exp $ */
+/* $Id: parse_tz.c,v 1.2 2005/06/15 00:11:29 edink Exp $ */
 
 #include <stdio.h>
+#ifdef PHP_WIN32
+#include <winsock2.h>
+#else
 #include <netinet/in.h>
+#endif
 #include <string.h>
 
 #include "datetime.h"
http://cvs.php.net/diff.php/php-src/ext/date/lib/timelib_structs.h?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/date/lib/timelib_structs.h
diff -u php-src/ext/date/lib/timelib_structs.h:1.1 
php-src/ext/date/lib/timelib_structs.h:1.2
--- php-src/ext/date/lib/timelib_structs.h:1.1  Tue Jun 14 17:32:27 2005
+++ php-src/ext/date/lib/timelib_structs.h      Tue Jun 14 20:11:29 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: timelib_structs.h,v 1.1 2005/06/14 21:32:27 derick Exp $ */
+/* $Id: timelib_structs.h,v 1.2 2005/06/15 00:11:29 edink Exp $ */
 
 #ifndef __TIMELIB_STRUCTS_H__
 #define __TIMELIB_STRUCTS_H__
@@ -24,9 +24,13 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#ifdef PHP_WIN32
+#include <winsock2.h>
+#else
 #include <netinet/in.h>
+#endif
 
-#if defined(WIN32) && _MSC_VER < 1300
+#if defined(PHP_WIN32) && _MSC_VER < 1300
 typedef unsigned __int64 timelib_ull;
 typedef __int64 timelib_sll;
 #else
@@ -34,6 +38,11 @@
 typedef signed long long timelib_sll;
 #endif
 
+#if defined(_MSC_VER)
+#define int32_t __int32
+#define uint32_t unsigned __int32
+#endif
+
 typedef struct ttinfo
 {
        int32_t      offset;
@@ -78,8 +87,8 @@
 
 typedef struct timelib_time_offset {
        int32_t offset;
-       uint leap_secs;
-       uint is_dst;
+       unsigned int leap_secs;
+       unsigned int is_dst;
        char *abbr;
 } timelib_time_offset;
 
@@ -90,17 +99,17 @@
        int z;           /* GMT offset in minutes */
        char *tz_abbr;   /* Timezone abbreviation (display only) */
        timelib_tzinfo  *tz_info;   /* Timezone structure */
-       uint dst;        /* Flag if we were parsing a DST zone */
+       unsigned int dst;        /* Flag if we were parsing a DST zone */
        timelib_rel_time relative;
 
        timelib_sll sse; /* Seconds since epoch */
 
-       uint   have_time, have_date, have_zone, have_relative, 
have_weekday_relative, have_weeknr_day;
+       unsigned int   have_time, have_date, have_zone, have_relative, 
have_weekday_relative, have_weeknr_day;
 
-       uint sse_uptodate; /* !0 if the sse member is up to date with the 
date/time members */
-       uint tim_uptodate; /* !0 if the date/time members are up to date with 
the sse member */
-       uint is_localtime; /*  1 if the current struct represents localtime, 0 
if it is in GMT */
-       uint zone_type;    /*  1 time offset,
+       unsigned int sse_uptodate; /* !0 if the sse member is up to date with 
the date/time members */
+       unsigned int tim_uptodate; /* !0 if the date/time members are up to 
date with the sse member */
+       unsigned int is_localtime; /*  1 if the current struct represents 
localtime, 0 if it is in GMT */
+       unsigned int zone_type;    /*  1 time offset,
                                                *  3 TimeZone identifier,
                                                *  2 TimeZone abbreviation */
 } timelib_time;
http://cvs.php.net/diff.php/php-src/ext/date/lib/tm2unixtime.c?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/date/lib/tm2unixtime.c
diff -u php-src/ext/date/lib/tm2unixtime.c:1.1 
php-src/ext/date/lib/tm2unixtime.c:1.2
--- php-src/ext/date/lib/tm2unixtime.c:1.1      Tue Jun 14 17:32:27 2005
+++ php-src/ext/date/lib/tm2unixtime.c  Tue Jun 14 20:11:29 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: tm2unixtime.c,v 1.1 2005/06/14 21:32:27 derick Exp $ */
+/* $Id: tm2unixtime.c,v 1.2 2005/06/15 00:11:29 edink Exp $ */
 
 #include "datetime.h"
 
@@ -133,7 +133,7 @@
 
 static timelib_sll do_years(int year)
 {
-       uint i;
+       unsigned int i;
        timelib_sll res = 0;
 
        if (year >= 1970) {
@@ -156,7 +156,7 @@
        return res;
 }
 
-static timelib_sll do_months(uint month, uint year)
+static timelib_sll do_months(unsigned int month, unsigned int year)
 {
        if (is_leap(year)) {
                return ((month_tab_leap[month - 1] + 1) * SECS_PER_DAY);
@@ -165,12 +165,12 @@
        }
 }
 
-static timelib_sll do_days(uint day)
+static timelib_sll do_days(unsigned int day)
 {
        return ((day - 1) * SECS_PER_DAY);
 }
 
-static timelib_sll do_time(uint hour, uint minute, uint second)
+static timelib_sll do_time(unsigned int hour, unsigned int minute, unsigned 
int second)
 {
        timelib_sll res = 0;
 
http://cvs.php.net/diff.php/php-src/ext/date/lib/unixtime2tm.c?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/date/lib/unixtime2tm.c
diff -u php-src/ext/date/lib/unixtime2tm.c:1.1 
php-src/ext/date/lib/unixtime2tm.c:1.2
--- php-src/ext/date/lib/unixtime2tm.c:1.1      Tue Jun 14 17:32:27 2005
+++ php-src/ext/date/lib/unixtime2tm.c  Tue Jun 14 20:11:29 2005
@@ -16,12 +16,18 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: unixtime2tm.c,v 1.1 2005/06/14 21:32:27 derick Exp $ */
+/* $Id: unixtime2tm.c,v 1.2 2005/06/15 00:11:29 edink Exp $ */
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 
+#if defined(_MSC_VER)
+#define PHP_LL_CONST(n) n ## i64
+#else
+#define PHP_LL_CONST(n) n ## ll
+#endif
+
 #include "datetime.h"
 
 static int month_tab_leap[12] = { -1, 30, 59, 90, 120, 151, 181, 212, 243, 
273, 304, 334 };
@@ -61,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 <= -6857352000ll) {
+               if (ts <= PHP_LL_CONST(-6857352000)) {
                        tmp_days -= 11;
                }
 
@@ -160,7 +166,7 @@
 /* Converts the time stored in the struct to localtime if localtime = true,
  * otherwise it converts it to gmttime. This is only done when necessary
  * ofcourse. */
-int timelib_apply_localtime(timelib_time *t, uint localtime)
+int timelib_apply_localtime(timelib_time *t, unsigned int localtime)
 {
        if (localtime) {
                /* Converting from GMT time to local time */
http://cvs.php.net/diff.php/php-src/ext/date/lib/resource/parse_date.re?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/date/lib/resource/parse_date.re
diff -u php-src/ext/date/lib/resource/parse_date.re:1.1 
php-src/ext/date/lib/resource/parse_date.re:1.2
--- php-src/ext/date/lib/resource/parse_date.re:1.1     Tue Jun 14 17:32:27 2005
+++ php-src/ext/date/lib/resource/parse_date.re Tue Jun 14 20:11:29 2005
@@ -16,13 +16,18 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: parse_date.re,v 1.1 2005/06/14 21:32:27 derick Exp $ */
+/* $Id: parse_date.re,v 1.2 2005/06/15 00:11:29 edink Exp $ */
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include "datetime.h"
 
+#ifdef PHP_WIN32
+#define strcasecmp stricmp
+#define strtoll(s, f, b) _atoi64(s)
+#endif
+
 #define TIMELIB_SECOND  1
 #define TIMELIB_MINUTE  2
 #define TIMELIB_HOUR    3
@@ -113,14 +118,14 @@
 #include "timelib_structs.h"
 
 typedef struct timelib_elems {
-       uint c;   /* Number of elements */
+       unsigned int c;   /* Number of elements */
        char **v; /* Values */
 } timelib_elems;
 
 typedef struct Scanner {
        int    fd;
        uchar  *lim, *str, *ptr, *cur, *tok, *pos;
-       uint   line, len;
+       unsigned int   line, len;
 
        struct timelib_time *time;
 } Scanner;
@@ -365,7 +370,7 @@
 #if 0
 uchar *fill(Scanner *s, uchar *cursor){
        if(!s->eof){
-               uint cnt = s->tok - s->bot;
+               unsigned int cnt = s->tok - s->bot;
                if(cnt){
                        memcpy(s->bot, s->tok, s->lim - s->tok);
                        s->tok = s->bot;

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

Reply via email to