]> granicus.if.org Git - php/commitdiff
- support for VC6 and some other platforms (before some other cleanup)
authorPierre Joye <pajoye@php.net>
Mon, 20 Oct 2008 14:45:59 +0000 (14:45 +0000)
committerPierre Joye <pajoye@php.net>
Mon, 20 Oct 2008 14:45:59 +0000 (14:45 +0000)
ext/fileinfo/config.w32
ext/fileinfo/libmagic/apprentice.c
ext/fileinfo/libmagic/softmagic.c

index f94929c81ffeea735215e474168e252f90e1dada..085f9b2c3e65200ade041eab319e5a81bff15bb6 100644 (file)
@@ -13,6 +13,10 @@ if (PHP_FILEINFO != 'no') {
                        magic.c print.c \
                        readelf.c softmagic.c";
 
+               if (VCVERS <1500) {
+                       ADD_FLAG('CFLAGS', '/Zm1000');
+               }
+
                EXTENSION('fileinfo', 'fileinfo.c', true, "/I" + configure_module_dirname + "/libmagic /I" + configure_module_dirname);
                ADD_SOURCES(configure_module_dirname + '\\libmagic', LIBMAGIC_SOURCES, "fileinfo");
        } else {
index d06875bfbeb41a8e1565a03599ef9be26bb1d06c..d4e0e889d5601ed711a2048b5d2c0322ad17b623 100644 (file)
 
 #ifdef PHP_WIN32
 #include "win32/unistd.h"
+#if _MSC_VER <= 1300
+#include "win32/php_strtoi64.h"
+#endif
 #define strtoull _strtoui64
 #else
 #include <unistd.h>
 #endif
 
+
+
+
 #include <string.h>
 #include <assert.h>
 #include <ctype.h>
index ad64d97f1d0c167295ecc37254d0ed653b73783f..3afc0c6d1f5e28e39a0de95a1864536abf22b60b 100644 (file)
@@ -582,16 +582,16 @@ cvt_64(union VALUETYPE *p, const struct magic *m)
        if (m->num_mask) \
                switch (m->mask_op & FILE_OPS_MASK) { \
                case FILE_OPADD: \
-                       p->fld += cast m->num_mask; \
+                       p->fld += cast (int64_t)m->num_mask; \
                        break; \
                case FILE_OPMINUS: \
-                       p->fld -= cast m->num_mask; \
+                       p->fld -= cast (int64_t)m->num_mask; \
                        break; \
                case FILE_OPMULTIPLY: \
-                       p->fld *= cast m->num_mask; \
+                       p->fld *= cast (int64_t)m->num_mask; \
                        break; \
                case FILE_OPDIVIDE: \
-                       p->fld /= cast m->num_mask; \
+                       p->fld /= cast (int64_t)m->num_mask; \
                        break; \
                } \
 
@@ -1860,7 +1860,7 @@ magiccheck(struct magic_set *ms, struct magic *m)
        case 'x':
                if ((ms->flags & MAGIC_DEBUG) != 0)
                        (void) fprintf(stderr, "%llu == *any* = 1\n",
-                           (unsigned long long)v);
+                           (uint64_t)v);
                matched = 1;
                break;
 
@@ -1868,7 +1868,7 @@ magiccheck(struct magic_set *ms, struct magic *m)
                matched = v != l;
                if ((ms->flags & MAGIC_DEBUG) != 0)
                        (void) fprintf(stderr, "%llu != %llu = %d\n",
-                           (unsigned long long)v, (unsigned long long)l,
+                           (uint64_t)v, (uint64_t)l,
                            matched);
                break;
 
@@ -1876,7 +1876,7 @@ magiccheck(struct magic_set *ms, struct magic *m)
                matched = v == l;
                if ((ms->flags & MAGIC_DEBUG) != 0)
                        (void) fprintf(stderr, "%llu == %llu = %d\n",
-                           (unsigned long long)v, (unsigned long long)l,
+                           (uint64_t)v, (uint64_t)l,
                            matched);
                break;
 
@@ -1885,14 +1885,14 @@ magiccheck(struct magic_set *ms, struct magic *m)
                        matched = v > l;
                        if ((ms->flags & MAGIC_DEBUG) != 0)
                                (void) fprintf(stderr, "%llu > %llu = %d\n",
-                                   (unsigned long long)v,
-                                   (unsigned long long)l, matched);
+                                   (uint64_t)v,
+                                   (uint64_t)l, matched);
                }
                else {
                        matched = (int64_t) v > (int64_t) l;
                        if ((ms->flags & MAGIC_DEBUG) != 0)
                                (void) fprintf(stderr, "%lld > %lld = %d\n",
-                                   (long long)v, (long long)l, matched);
+                                   (uint64_t)v, (uint64_t)l, matched);
                }
                break;
 
@@ -1901,14 +1901,14 @@ magiccheck(struct magic_set *ms, struct magic *m)
                        matched = v < l;
                        if ((ms->flags & MAGIC_DEBUG) != 0)
                                (void) fprintf(stderr, "%llu < %llu = %d\n",
-                                   (unsigned long long)v,
-                                   (unsigned long long)l, matched);
+                                   (uint64_t)v,
+                                   (uint64_t)l, matched);
                }
                else {
                        matched = (int64_t) v < (int64_t) l;
                        if ((ms->flags & MAGIC_DEBUG) != 0)
                                (void) fprintf(stderr, "%lld < %lld = %d\n",
-                                      (long long)v, (long long)l, matched);
+                                      (int64_t)v, (int64_t)l, matched);
                }
                break;
 
@@ -1916,16 +1916,16 @@ magiccheck(struct magic_set *ms, struct magic *m)
                matched = (v & l) == l;
                if ((ms->flags & MAGIC_DEBUG) != 0)
                        (void) fprintf(stderr, "((%llx & %llx) == %llx) = %d\n",
-                           (unsigned long long)v, (unsigned long long)l,
-                           (unsigned long long)l, matched);
+                           (uint64_t)v, (uint64_t)l,
+                           (uint64_t)l, matched);
                break;
 
        case '^':
                matched = (v & l) != l;
                if ((ms->flags & MAGIC_DEBUG) != 0)
                        (void) fprintf(stderr, "((%llx & %llx) != %llx) = %d\n",
-                           (unsigned long long)v, (unsigned long long)l,
-                           (unsigned long long)l, matched);
+                           (uint64_t)v, (uint64_t)l,
+                           (uint64_t)l, matched);
                break;
 
        default: