summaryrefslogtreecommitdiff
path: root/ext/fileinfo/libmagic/apprentice.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fileinfo/libmagic/apprentice.c')
-rw-r--r--ext/fileinfo/libmagic/apprentice.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c
index dcea282038..030961aa61 100644
--- a/ext/fileinfo/libmagic/apprentice.c
+++ b/ext/fileinfo/libmagic/apprentice.c
@@ -34,7 +34,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.132 2008/03/28 18:19:30 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.151 2009/03/18 15:19:23 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -611,7 +611,11 @@ load_1(struct magic_set *ms, int action, const char *fn, int *errs,
} else {
/* read and parse this file */
+#if (PHP_MAJOR_VERSION < 6)
+ for (ms->line = 1; (line = php_stream_get_line(stream, buffer , BUFSIZ, &line_len)) != NULL; ms->line++) {
+#else
for (ms->line = 1; (line = php_stream_get_line(stream, ZSTR(buffer), BUFSIZ, &line_len)) != NULL; ms->line++) {
+#endif
if (line_len == 0) /* null line, garbage, etc */
continue;
@@ -853,9 +857,9 @@ file_signextend(struct magic_set *ms, struct magic *m, uint64_t v)
case FILE_INDIRECT:
break;
default:
- if (ms->flags & MAGIC_CHECK) {
- file_magwarn(ms, "cannot happen: m->type=%d\n", m->type);
- }
+ if (ms->flags & MAGIC_CHECK)
+ file_magwarn(ms, "cannot happen: m->type=%d\n",
+ m->type);
return ~0U;
}
}
@@ -1671,7 +1675,7 @@ check_format(struct magic_set *ms, struct magic *m)
*/
file_magwarn(ms, "Printf format `%c' is not valid for type "
"`%s' in description `%s'", *ptr ? *ptr : '?',
- file_names[m->type], m->desc);
+ file_names[m->type], m->desc);
return -1;
}