]> granicus.if.org Git - php/commitdiff
- MFH: Some more cleanups, and fixed some warnings.
authorDerick Rethans <derick@php.net>
Fri, 29 Aug 2008 12:05:46 +0000 (12:05 +0000)
committerDerick Rethans <derick@php.net>
Fri, 29 Aug 2008 12:05:46 +0000 (12:05 +0000)
ext/fileinfo/libmagic/apprentice.c
ext/fileinfo/libmagic/file.h
ext/fileinfo/libmagic/funcs.c
ext/fileinfo/libmagic/magic.c
ext/fileinfo/libmagic/print.c

index 9d3d3fab3f37748838abe9bcae95cb4b3d5c7f47..98f7729f06de94f4b8ccf4a38e304ba1c5e027c6 100644 (file)
@@ -235,7 +235,6 @@ apprentice_1(struct magic_set *ms, const char *fn, int action,
                return rv;
        }
 
-#ifndef COMPILE_ONLY
        if ((rv = apprentice_map(ms, &magic, &nmagic, fn)) == -1) {
                if (ms->flags & MAGIC_CHECK)
                        file_magwarn(ms, "using regular magic file `%s'", fn);
@@ -263,7 +262,6 @@ apprentice_1(struct magic_set *ms, const char *fn, int action,
        mlist->prev = ml;
 
        return 0;
-#endif /* COMPILE_ONLY */
 }
 
 protected void
@@ -464,7 +462,7 @@ apprentice_sort(const void *a, const void *b)
                return 1;
 }
 
-private int
+private void
 set_test_type(struct magic *mstart, struct magic *m)
 {
        switch (m->type) {
@@ -599,7 +597,7 @@ apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
        if (stat(fn, &st) == 0 && S_ISDIR(st.st_mode)) {
                dir = opendir(fn);
                if (dir) {
-                       while (d = readdir(dir)) {
+                       while ((d = readdir(dir))) {
                                snprintf(subfn, sizeof(subfn), "%s/%s",
                                    fn, d->d_name);
                                if (stat(subfn, &st) == 0 && S_ISREG(st.st_mode)) {
@@ -1266,11 +1264,9 @@ parse(struct magic_set *ms, struct magic_entry **mentryp, uint32_t *nmentryp,
                if (check_format(ms, m) == -1)
                        return -1;
        }
-#ifndef COMPILE_ONLY
        if (action == FILE_CHECK) {
                file_mdump(m);
        }
-#endif
        m->mimetype[0] = '\0';          /* initialise MIME type to none */
        if (m->cont_level == 0)
                ++(*nmentryp);          /* make room for next */
@@ -1862,7 +1858,6 @@ apprentice_map(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
        fd = -1;
 
 internal_loaded:
-
        *magicp = mm;
        ptr = (uint32_t *)(void *)*magicp;
        if (*ptr != MAGICNO) {
index b28631c97cbdf34d4cf8451c25e0918155812f11..125a648082c0fd9c74e0371f64073a663753c6d0 100644 (file)
@@ -354,10 +354,8 @@ protected ssize_t sread(int, void *, size_t, int);
 protected int file_check_mem(struct magic_set *, unsigned int);
 protected int file_looks_utf8(const unsigned char *, size_t, unichar *, size_t *);
 
-#ifndef COMPILE_ONLY
 extern const char *file_names[];
 extern const size_t file_nnames;
-#endif
 
 #ifndef HAVE_STRERROR
 extern int sys_nerr;
index b891679510ac66cc74fe6a5454c05e3ff696f9cc..782f8dbc2e825f54962d2dcb57af73d490b2d047 100644 (file)
@@ -145,7 +145,6 @@ file_badread(struct magic_set *ms)
        file_error(ms, errno, "error reading");
 }
 
-#ifndef COMPILE_ONLY
 protected int
 file_buffer(struct magic_set *ms, int fd, const char *inname, const void *buf,
     size_t nb)
@@ -218,7 +217,6 @@ file_buffer(struct magic_set *ms, int fd, const char *inname, const void *buf,
 #endif
        return m;
 }
-#endif
 
 protected int
 file_reset(struct magic_set *ms)
index 9d799428f649ff1df233006eeb5c5c35ae462396..cf695ece75b2aa729c78e5e6ec71923fb5a7c70d 100644 (file)
@@ -82,9 +82,7 @@ private void free_mlist(struct mlist *);
 private void close_and_restore(const struct magic_set *, const char *, int,
     const struct stat *);
 private int info_from_stat(struct magic_set *, mode_t);
-#ifndef COMPILE_ONLY
 private const char *file_or_fd(struct magic_set *, const char *, int);
-#endif
 
 #ifndef        STDIN_FILENO
 #define        STDIN_FILENO    0
@@ -235,7 +233,6 @@ close_and_restore(const struct magic_set *ms, const char *name, int fd,
        }
 }
 
-#ifndef COMPILE_ONLY
 
 /*
  * find type of descriptor
@@ -372,7 +369,6 @@ magic_buffer(struct magic_set *ms, const void *buf, size_t nb)
        }
        return file_getbuffer(ms);
 }
-#endif
 
 public const char *
 magic_error(struct magic_set *ms)
index a6d186135d4b1d17752467ffc1cc1efdf4c20c96..e7ee460bedd253166067bd17bff7274f274787c9 100644 (file)
@@ -46,7 +46,6 @@ FILE_RCSID("@(#)$File: print.c,v 1.63 2008/02/17 19:28:54 rrt Exp $")
 
 #define SZOF(a)        (sizeof(a) / sizeof(a[0]))
 
-#ifndef COMPILE_ONLY
 protected void
 file_mdump(struct magic *m)
 {
@@ -177,7 +176,6 @@ file_mdump(struct magic *m)
        }
        (void) fprintf(stderr, ",\"%s\"]\n", m->desc);
 }
-#endif
 
 /*VARARGS*/
 protected void