]> granicus.if.org Git - php/commitdiff
Fixed compiler warnings
authorXinchen Hui <laruence@gmail.com>
Mon, 25 Jan 2016 03:42:36 +0000 (11:42 +0800)
committerXinchen Hui <laruence@gmail.com>
Mon, 25 Jan 2016 03:45:14 +0000 (11:45 +0800)
ext/fileinfo/libmagic/apprentice.c
ext/fileinfo/libmagic/funcs.c
ext/fileinfo/libmagic/softmagic.c

index f1de79bad8828fb3f172a175069aea60272767bb..8347afdeb7b2cf629d40bdf14376c2cbb18616ee 100644 (file)
@@ -3005,7 +3005,6 @@ apprentice_compile(struct magic_set *ms, struct magic_map *map, const char *fn)
 {
        static const size_t nm = sizeof(*map->nmagic) * MAGIC_SETS;
        static const size_t m = sizeof(**map->magic);
-       int fd = -1;
        size_t len;
        char *dbname;
        int rv = -1;
index 91e9906dcdce30373d9bc0d2f3b82cde51a3bbbe..c6699d5147e2a786f6b332db019d04cda90df87c 100644 (file)
@@ -61,7 +61,6 @@ extern public void convert_libmagic_pattern(zval *pattern, char *val, int len, i
 protected int
 file_printf(struct magic_set *ms, const char *fmt, ...)
 {
-       int rv;
        va_list ap;
        int len;
        char *buf = NULL, *newstr;
@@ -283,7 +282,9 @@ simple:
                if (file_printf(ms, "%s", code_mime) == -1)
                        rv = -1;
        }
+#if PHP_FILEINFO_UNCOMPRESS
  done_encoding:
+#endif
        free(u8buf);
        if (rv)
                return rv;
@@ -438,7 +439,7 @@ file_replace(struct magic_set *ms, const char *pat, const char *rep)
        (void)setlocale(LC_CTYPE, "C");
 
        opts |= PCRE_MULTILINE;
-       convert_libmagic_pattern(&patt, pat, strlen(pat), opts);
+       convert_libmagic_pattern(&patt, (char*)pat, strlen(pat), opts);
        if ((pce = pcre_get_compiled_regex_cache(Z_STR(patt))) == NULL) {
                zval_ptr_dtor(&patt);
                rep_cnt = -1;
index 9e876d39b3bb0a43ab23f791c890bcae0780b3de..41c4aa17d7747ff2126424c4c2427a6131a84d59 100644 (file)
@@ -2040,7 +2040,7 @@ magiccheck(struct magic_set *ms, struct magic *m)
                                /* Need to fetch global match which equals pmatch[0] */
                                zval *pzval;
                                HashTable *ht = Z_ARRVAL(subpats);
-                               if ((pzval = zend_hash_index_find(ht, 0)) != NULL) {
+                               if ((pzval = zend_hash_index_find(ht, 0)) != NULL && Z_TYPE_P(pzval) == IS_ARRAY) {
                                        /* If everything goes according to the master plan
                                           tmpcopy now contains two elements:
                                           0 = the match