diff options
author | Pierre Joye <pajoye@php.net> | 2009-03-16 15:03:06 +0000 |
---|---|---|
committer | Pierre Joye <pajoye@php.net> | 2009-03-16 15:03:06 +0000 |
commit | 8e202b40a01f38203145e0445e34849fe031b0da (patch) | |
tree | e64b8626177e7b2145d8395dc010298fbfbdde79 /ext | |
parent | 122232aa54bffae413a2e617e8e6b424960da124 (diff) | |
download | php-git-8e202b40a01f38203145e0445e34849fe031b0da.tar.gz |
- fix the build for win (vc6 or vc9)
- 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
Diffstat (limited to 'ext')
-rw-r--r-- | ext/fileinfo/CREDITS | 2 | ||||
-rw-r--r-- | ext/fileinfo/config.w32 | 27 | ||||
-rw-r--r-- | ext/fileinfo/libmagic/apprentice.c | 7 | ||||
-rw-r--r-- | ext/fileinfo/libmagic/cdf.c | 4 | ||||
-rw-r--r-- | ext/fileinfo/libmagic/cdf.h | 6 | ||||
-rw-r--r-- | ext/fileinfo/libmagic/cdf_time.c | 6 | ||||
-rw-r--r-- | ext/fileinfo/libmagic/file.h | 4 | ||||
-rw-r--r-- | ext/fileinfo/libmagic/readcdf.c | 4 |
8 files changed, 36 insertions, 24 deletions
diff --git a/ext/fileinfo/CREDITS b/ext/fileinfo/CREDITS index 0a001657de..acd0e843d0 100644 --- a/ext/fileinfo/CREDITS +++ b/ext/fileinfo/CREDITS @@ -1,2 +1,2 @@ fileinfo -Ilia Alshanetsky, Scott MacVicar, Derick Rethans +Ilia Alshanetsky, Pierre Alain Joye, Scott MacVicar, Derick Rethans diff --git a/ext/fileinfo/config.w32 b/ext/fileinfo/config.w32 index f70da0ec65..46b87b56dc 100644 --- a/ext/fileinfo/config.w32 +++ b/ext/fileinfo/config.w32 @@ -4,17 +4,22 @@ 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 \ + is_tar.c magic.c print.c \ + readcdf.c readelf.c softmagic.c"; - LIBMAGIC_SOURCES=" apprentice.c apptype.c ascmagic.c \ - cdf.c cdf_time.c compress.c \ - encoding.c fsmagic.c funcs.c \ - is_tar.c magic.c print.c \ - readcdf.c readelf.c softmagic.c"; + if (VCVERS < 1500) { + ADD_FLAG('CFLAGS', '/Zm1000'); + } - if (VCVERS < 1500) { - ADD_FLAG('CFLAGS', '/Zm1000'); - } - - EXTENSION('fileinfo', 'fileinfo.c', null, "/I" + configure_module_dirname + "/libmagic /I" + configure_module_dirname); - ADD_SOURCES(configure_module_dirname + '\\libmagic', LIBMAGIC_SOURCES, "fileinfo"); + 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"; + } } diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c index c0eb6ab716..fdf3fdabde 100644 --- a/ext/fileinfo/libmagic/apprentice.c +++ b/ext/fileinfo/libmagic/apprentice.c @@ -51,16 +51,11 @@ FILE_RCSID("@(#)$File: apprentice.c,v 1.132 2008/03/28 18:19:30 christos Exp $") #include <unistd.h> #endif - - - #include <string.h> #include <assert.h> #include <ctype.h> #include <fcntl.h> -#ifndef PHP_WIN32 -#include <dirent.h> -#endif + #define EATAB {while (isascii((unsigned char) *l) && \ isspace((unsigned char) *l)) ++l;} diff --git a/ext/fileinfo/libmagic/cdf.c b/ext/fileinfo/libmagic/cdf.c index 152e6a5013..db1d11f7fb 100644 --- a/ext/fileinfo/libmagic/cdf.c +++ b/ext/fileinfo/libmagic/cdf.c @@ -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 { diff --git a/ext/fileinfo/libmagic/cdf.h b/ext/fileinfo/libmagic/cdf.h index a4a0f6d152..f020942705 100644 --- a/ext/fileinfo/libmagic/cdf.h +++ b/ext/fileinfo/libmagic/cdf.h @@ -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; diff --git a/ext/fileinfo/libmagic/cdf_time.c b/ext/fileinfo/libmagic/cdf_time.c index 3340594f03..ac416ea2fe 100644 --- a/ext/fileinfo/libmagic/cdf_time.c +++ b/ext/fileinfo/libmagic/cdf_time.c @@ -104,8 +104,8 @@ cdf_timestamp_to_timespec(struct timeval *ts, cdf_timestamp_t t) #endif int rdays; - /* Unit is 100's of nanoseconds */ - ts->tv_usec = (t % CDF_TIME_PREC) * 1000000; + /* 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 / 1000000) * 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; diff --git a/ext/fileinfo/libmagic/file.h b/ext/fileinfo/libmagic/file.h index 503e852ea7..d97343bddc 100644 --- a/ext/fileinfo/libmagic/file.h +++ b/ext/fileinfo/libmagic/file.h @@ -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 diff --git a/ext/fileinfo/libmagic/readcdf.c b/ext/fileinfo/libmagic/readcdf.c index 0b066491e7..359d09cf93 100644 --- a/ext/fileinfo/libmagic/readcdf.c +++ b/ext/fileinfo/libmagic/readcdf.c @@ -98,7 +98,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); |