com php-src: Fixed bug bug #64713 Compilation warnings in finfo: ext/fileinfo/libmagic/apprentice.c ext/fileinfo/libmagic/magic.c
ext/fileinfo/libmagic/print.c
| From: | Anatol Belski | Date: | Sat, 27 Apr 2013 11:49:50 +0000 |
| Subject: | com php-src: Fixed bug bug #64713 Compilation warnings in finfo: ext/fileinfo/libmagic/apprentice.c ext/fileinfo/libmagic/magic.c ext/fileinfo/libmagic/print.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-72045@lists.php.net to get a copy of this message | ||
Commit: cdc1a63790dc0d91189f93489d6f3d68a57acd9c
Author: Anatol Belski <ab@php.net> Sat, 27 Apr 2013 13:49:50 +0200
Parents: 5adf1be45d918264279ff68745bfe4a3eedbd887
Branches: PHP-5.4 PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=cdc1a63790dc0d91189f93489d6f3d68a57acd9c
Log:
Fixed bug bug #64713 Compilation warnings in finfo
Bugs:
https://bugs.php.net/64713
Changed paths:
M ext/fileinfo/libmagic/apprentice.c
M ext/fileinfo/libmagic/magic.c
M ext/fileinfo/libmagic/print.c
Diff:
diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c
index 8ae5729..11920e6 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 15fd6be..4bcc49e 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 fff258b..63e34be 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);