mirror of
https://github.com/php/php-src.git
synced 2025-01-19 18:24:15 +08:00
- 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
This commit is contained in:
parent
122232aa54
commit
8e202b40a0
@ -1,2 +1,2 @@
|
||||
fileinfo
|
||||
Ilia Alshanetsky, Scott MacVicar, Derick Rethans
|
||||
Ilia Alshanetsky, Pierre Alain Joye, Scott MacVicar, Derick Rethans
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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;}
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user