From cdc1a63790dc0d91189f93489d6f3d68a57acd9c Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sat, 27 Apr 2013 13:49:50 +0200 Subject: [PATCH] Fixed bug bug #64713 Compilation warnings in finfo --- ext/fileinfo/libmagic/apprentice.c | 10 +++++----- ext/fileinfo/libmagic/magic.c | 3 ++- ext/fileinfo/libmagic/print.c | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c index 8ae572973d..11920e6589 100644 --- a/ext/fileinfo/libmagic/apprentice.c +++ b/ext/fileinfo/libmagic/apprentice.c @@ -1133,7 +1133,7 @@ apprentice_load(struct magic_set *ms, const char *fn, int action) uint32_t mentrycount[MAGIC_SETS] = { 0 }; uint32_t i, j; size_t files = 0, maxfiles = 0; - char **filearr = NULL, *mfn; + char **filearr = NULL; struct stat st; struct magic_map *map; php_stream *dir; @@ -1169,7 +1169,7 @@ apprentice_load(struct magic_set *ms, const char *fn, int action) int mflen; char mfn[MAXPATHLEN]; - dir = php_stream_opendir(fn, REPORT_ERRORS, NULL); + dir = php_stream_opendir((char *)fn, REPORT_ERRORS, NULL); if (!dir) { errs++; goto out; @@ -2613,7 +2613,7 @@ apprentice_map(struct magic_set *ms, const char *fn) #ifdef PHP_WIN32 /* Don't bother on windows with php_stream_open_wrapper, return to give apprentice_load() a chance. */ - if (php_stream_stat_path_ex(fn, 0, &st, NULL) == SUCCESS) { + if (php_stream_stat_path_ex((char *)fn, 0, &st, NULL) == SUCCESS) { if (st.sb.st_mode & S_IFDIR) { goto error; } @@ -2778,7 +2778,7 @@ apprentice_compile(struct magic_set *ms, struct magic_map *map, const char *fn) goto out; } - if (php_stream_write(stream, map->nmagic, nm) != (ssize_t)nm) { + if (php_stream_write(stream, (const char *)map->nmagic, nm) != (ssize_t)nm) { file_error(ms, errno, "error writing `%s'", dbname); goto out; } @@ -2792,7 +2792,7 @@ apprentice_compile(struct magic_set *ms, struct magic_map *map, const char *fn) for (i = 0; i < MAGIC_SETS; i++) { len = m * map->nmagic[i]; - if (php_stream_write(stream, map->magic[i], len) != (ssize_t)len) { + if (php_stream_write(stream, (const char *)map->magic[i], len) != (ssize_t)len) { file_error(ms, errno, "error writing `%s'", dbname); goto out; } diff --git a/ext/fileinfo/libmagic/magic.c b/ext/fileinfo/libmagic/magic.c index 15fd6be77f..4bcc49eb80 100644 --- a/ext/fileinfo/libmagic/magic.c +++ b/ext/fileinfo/libmagic/magic.c @@ -80,11 +80,12 @@ FILE_RCSID("@(#)$File: magic.c,v 1.78 2013/01/07 18:20:19 christos Exp $") # undef S_IFIFO #endif -private void free_mlist(struct mlist *); private void close_and_restore(const struct magic_set *, const char *, int, const struct stat *); private int unreadable_info(struct magic_set *, mode_t, const char *); +#if 0 private const char* get_default_magic(void); +#endif private const char *file_or_stream(struct magic_set *, const char *, php_stream *); #ifndef STDIN_FILENO diff --git a/ext/fileinfo/libmagic/print.c b/ext/fileinfo/libmagic/print.c index fff258b7ee..63e34bee0e 100644 --- a/ext/fileinfo/libmagic/print.c +++ b/ext/fileinfo/libmagic/print.c @@ -33,6 +33,7 @@ #include "php.h" #include "file.h" +#include "cdf.h" #ifndef lint FILE_RCSID("@(#)$File: print.c,v 1.76 2013/02/26 18:25:00 christos Exp $") @@ -63,7 +64,7 @@ file_magwarn(struct magic_set *ms, const char *f, ...) TSRMLS_FETCH(); va_start(va, f); - vasprintf(&expanded_format, f, va); + if (vasprintf(&expanded_format, f, va)); /* silence */ va_end(va); php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Warning: %s", expanded_format); -- 2.50.0