]> granicus.if.org Git - php/commitdiff
Fixed bug bug #64713 Compilation warnings in finfo
authorAnatol Belski <ab@php.net>
Sat, 27 Apr 2013 11:49:50 +0000 (13:49 +0200)
committerAnatol Belski <ab@php.net>
Sat, 27 Apr 2013 11:49:50 +0000 (13:49 +0200)
ext/fileinfo/libmagic/apprentice.c
ext/fileinfo/libmagic/magic.c
ext/fileinfo/libmagic/print.c

index 8ae572973db184c3f585df0c3690059b44b9903b..11920e658917533c1a43045969310882c5636a4c 100644 (file)
@@ -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;
                }
index 15fd6be77fb44d433cdf16fdc53fb2459e7d5afd..4bcc49eb80628071a792c9ca422a8b881cd7637a 100644 (file)
@@ -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
index fff258b7eebdaf36110aaf4b46869094695e19f1..63e34bee0e5bc55ac4ddef6acfc99fff64171120 100644 (file)
@@ -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);