]> granicus.if.org Git - php/commitdiff
- fix the build for win (vc6 or vc9)
authorPierre Joye <pajoye@php.net>
Mon, 16 Mar 2009 15:02:44 +0000 (15:02 +0000)
committerPierre Joye <pajoye@php.net>
Mon, 16 Mar 2009 15:02:44 +0000 (15:02 +0000)
- fix logic in time convertion
- force shared on windows, will fix the dirent issue later (no, it is not enough to simply remove the dep or header include)
- add myself before I forget again

ext/fileinfo/CREDITS
ext/fileinfo/config.w32
ext/fileinfo/libmagic/cdf.c
ext/fileinfo/libmagic/cdf.h
ext/fileinfo/libmagic/cdf_time.c
ext/fileinfo/libmagic/file.h
ext/fileinfo/libmagic/readcdf.c

index 0a001657de1d60e0a2934d3a934f8056e4431239..acd0e843d0f1453c457b7d2cafbb9a29fa7bd846 100644 (file)
@@ -1,2 +1,2 @@
 fileinfo
-Ilia Alshanetsky, Scott MacVicar, Derick Rethans
+Ilia Alshanetsky, Pierre Alain Joye, Scott MacVicar, Derick Rethans
index f70da0ec6526f15ae61aa5bae85e3f657ce75825..4e790695c107540758274bd571a57107cf3691d1 100644 (file)
@@ -4,7 +4,8 @@
 ARG_ENABLE("fileinfo", "fileinfo support", "no");
 
 if (PHP_FILEINFO != 'no') {
-
+       if (CHECK_HEADER_ADD_INCLUDE("dirent.h", "CFLAGS_FILEINFO") &&
+                       CHECK_LIB("dirent_a.lib", "fileinfo", PHP_FILEINFO)) { 
        LIBMAGIC_SOURCES=" apprentice.c apptype.c ascmagic.c \
                        cdf.c cdf_time.c compress.c \
                        encoding.c fsmagic.c funcs.c \
@@ -15,6 +16,10 @@ if (PHP_FILEINFO != 'no') {
                ADD_FLAG('CFLAGS', '/Zm1000');
        }
 
-       EXTENSION('fileinfo', 'fileinfo.c', null, "/I" + configure_module_dirname + "/libmagic /I" + configure_module_dirname);
+               EXTENSION('fileinfo', 'fileinfo.c', true, "/I" + configure_module_dirname + "/libmagic /I" + configure_module_dirname);
        ADD_SOURCES(configure_module_dirname + '\\libmagic', LIBMAGIC_SOURCES, "fileinfo");
+       } else {
+               WARNING("fileinfo not enabled; libraries and headers not found");
+               PHP_FILEINFO = "no";
+       } 
 }
index 152e6a5013b1cc54573ce3af3bbb3570b85bd1d8..db1d11f7fbf98fd906fae3a4c97a5b3449e55834 100644 (file)
@@ -1001,7 +1001,11 @@ cdf_dump_property_info(const cdf_property_info_t *info, size_t count)
                        break;
                case CDF_FILETIME:
                        tp = info[i].pi_tp;
+#if defined(PHP_WIN32 ) && _MSC_VER <= 1500
+               if (tp < 1000000000000000i64) {
+#else
                        if (tp < 1000000000000000LL) {
+#endif
                                cdf_print_elapsed_time(buf, sizeof(buf), tp);
                                printf("timestamp %s\n", buf);
                        } else {
index a4a0f6d152900b34a4f83c6e0aa6c144939cadec..f020942705993b8c4a447f5ebcdeb10ed34b7086 100644 (file)
@@ -42,7 +42,11 @@ typedef int32_t cdf_secid_t;
 
 typedef struct {
        uint64_t        h_magic;
-#define CDF_MAGIC      0xE11AB1A1E011CFD0LL
+#if defined(PHP_WIN32 ) && _MSC_VER <= 1500
+# define CDF_MAGIC     0xE11AB1A1E011CFD0i64
+#else
+# define CDF_MAGIC     0xE11AB1A1E011CFD0LL
+#endif
        uint64_t        h_uuid[2];
        uint16_t        h_revision;
        uint16_t        h_version;
index e06419c2dc65963ca349d46ba97f0557bc958b07..ac416ea2fe2a30af61fbd2cfeb855208183f496f 100644 (file)
@@ -104,8 +104,8 @@ cdf_timestamp_to_timespec(struct timeval *ts, cdf_timestamp_t t)
 #endif
        int rdays;
 
-       /* Unit is 100,000's of microseconds */
-       ts->tv_usec = (t % CDF_TIME_PREC) * 100000;
+       /* Time interval, in microseconds */
+       ts->tv_usec = (t % CDF_TIME_PREC) * CDF_TIME_PREC;
 
        t /= CDF_TIME_PREC;
        tm.tm_sec = t % 60;
@@ -153,7 +153,7 @@ cdf_timespec_to_timestamp(cdf_timestamp_t *t, const struct timeval *ts)
                errno = EINVAL;
                return -1;
        }
-       *t = (ts->ts_usec / 100000) * CDF_TIME_PREC;
+       *t = (ts->ts_usec / CDF_TIME_PREC) * CDF_TIME_PREC;
        *t = tm.tm_sec;
        *t += tm.tm_min * 60;
        *t += tm.tm_hour * 60 * 60;
index 503e852ea71bc40f2f3ce5f1b61178c03c13569e..d97343bddcbf38ef92c9f76dcd9bb9671552e339 100644 (file)
@@ -403,10 +403,10 @@ extern char *sys_errlist[];
 #define strtoul(a, b, c)       strtol(a, b, c)
 #endif
 
-#ifndef HAVE_STRLCPY
+#ifndef strlcpy
 size_t strlcpy(char *dst, const char *src, size_t siz);
 #endif
-#ifndef HAVE_STRLCAT
+#ifndef strlcat
 size_t strlcat(char *dst, const char *src, size_t siz);
 #endif
 
index 8ec44e5cd6ff27b2b2db16a1fe325241f38ce623..c9ac33b42c3ac2cb0edda26536bac7ed87b03181 100644 (file)
@@ -96,7 +96,11 @@ cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info,
                case CDF_FILETIME:
                        tp = info[i].pi_tp;
                        if (tp != 0) {
+#if defined(PHP_WIN32 ) && _MSC_VER <= 1500
+                               if (tp < 1000000000000000i64) {
+#else
                                if (tp < 1000000000000000LL) {
+#endif
                                        char tbuf[64];
                                        cdf_print_elapsed_time(tbuf,
                                            sizeof(tbuf), tp);