fileinfo
-Ilia Alshanetsky, Scott MacVicar, Derick Rethans
+Ilia Alshanetsky, Pierre Alain Joye, Scott MacVicar, Derick Rethans
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 \
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";
+ }
}
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 {
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;
#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;
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;
#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
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);