Fixed compiler warnings

This commit is contained in:
Xinchen Hui 2016-01-25 11:42:36 +08:00
parent da7f42de38
commit 4cb47bd3bd
3 changed files with 4 additions and 4 deletions

View 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 nm = sizeof(*map->nmagic) * MAGIC_SETS;
static const size_t m = sizeof(**map->magic); static const size_t m = sizeof(**map->magic);
int fd = -1;
size_t len; size_t len;
char *dbname; char *dbname;
int rv = -1; int rv = -1;

View File

@ -61,7 +61,6 @@ extern public void convert_libmagic_pattern(zval *pattern, char *val, int len, i
protected int protected int
file_printf(struct magic_set *ms, const char *fmt, ...) file_printf(struct magic_set *ms, const char *fmt, ...)
{ {
int rv;
va_list ap; va_list ap;
int len; int len;
char *buf = NULL, *newstr; char *buf = NULL, *newstr;
@ -283,7 +282,9 @@ simple:
if (file_printf(ms, "%s", code_mime) == -1) if (file_printf(ms, "%s", code_mime) == -1)
rv = -1; rv = -1;
} }
#if PHP_FILEINFO_UNCOMPRESS
done_encoding: done_encoding:
#endif
free(u8buf); free(u8buf);
if (rv) if (rv)
return rv; return rv;
@ -438,7 +439,7 @@ file_replace(struct magic_set *ms, const char *pat, const char *rep)
(void)setlocale(LC_CTYPE, "C"); (void)setlocale(LC_CTYPE, "C");
opts |= PCRE_MULTILINE; 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) { if ((pce = pcre_get_compiled_regex_cache(Z_STR(patt))) == NULL) {
zval_ptr_dtor(&patt); zval_ptr_dtor(&patt);
rep_cnt = -1; rep_cnt = -1;

View File

@ -2040,7 +2040,7 @@ magiccheck(struct magic_set *ms, struct magic *m)
/* Need to fetch global match which equals pmatch[0] */ /* Need to fetch global match which equals pmatch[0] */
zval *pzval; zval *pzval;
HashTable *ht = Z_ARRVAL(subpats); 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 /* If everything goes according to the master plan
tmpcopy now contains two elements: tmpcopy now contains two elements:
0 = the match 0 = the match