diff options
| author | Christos Zoulas <christos@zoulas.com> | 2008-10-20 15:14:17 +0000 |
|---|---|---|
| committer | Christos Zoulas <christos@zoulas.com> | 2008-10-20 15:14:17 +0000 |
| commit | 11c9590f84974c63fa91da14fdefe5a8b6eb9fe8 (patch) | |
| tree | aabef16ffb4ad542e206e71d76d2f56d4d827150 | |
| parent | 8512c716eaa946d3ebc50fec349a7f462630c05b (diff) | |
| download | file-git-11c9590f84974c63fa91da14fdefe5a8b6eb9fe8.tar.gz | |
cleanups for non BSD compilation.
| -rw-r--r-- | src/cdf.c | 15 | ||||
| -rw-r--r-- | src/cdf_time.c | 13 | ||||
| -rw-r--r-- | src/magic.h | 2 | ||||
| -rw-r--r-- | src/print.c | 7 |
4 files changed, 33 insertions, 4 deletions
@@ -23,10 +23,15 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif #include <assert.h> #include <stdio.h> +#ifdef CDF_DEBUG #include <err.h> +#endif #include <stdlib.h> #include <unistd.h> #include <errno.h> @@ -34,6 +39,16 @@ #include <string.h> #include <time.h> #include <ctype.h> +#ifdef HAVE_STDINT_H +#include <stdint.h> +#endif +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +#ifndef EFTYPE +#define EFTYPE EINVAL +#endif #include "cdf.h" diff --git a/src/cdf_time.c b/src/cdf_time.c index 96321fce..dbabae61 100644 --- a/src/cdf_time.c +++ b/src/cdf_time.c @@ -23,11 +23,24 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <sys/types.h> #include <stdio.h> #include <time.h> +#ifdef TEST #include <err.h> +#endif #include <string.h> #include <errno.h> +#ifdef HAVE_STDINT_H +#include <stdint.h> +#endif +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif #include "cdf.h" diff --git a/src/magic.h b/src/magic.h index 5ff78a29..5864f266 100644 --- a/src/magic.h +++ b/src/magic.h @@ -42,7 +42,7 @@ #define MAGIC_ERROR 0x000200 /* Handle ENOENT etc as real errors */ #define MAGIC_MIME_ENCODING 0x000400 /* Return only the MIME encoding */ #define MAGIC_MIME (MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING) -#define MAGIC_APPLE 0x000800 /* Return APPLE CREATOR/TYPE */ +#define MAGIC_APPLE 0x000800 /* Return the Apple creator and type */ #define MAGIC_NO_CHECK_COMPRESS 0x001000 /* Don't check for compressed files */ #define MAGIC_NO_CHECK_TAR 0x002000 /* Don't check for tar files */ #define MAGIC_NO_CHECK_SOFT 0x004000 /* Don't check magic entries */ diff --git a/src/print.c b/src/print.c index c41e71ea..cb382b0c 100644 --- a/src/print.c +++ b/src/print.c @@ -41,7 +41,7 @@ #include <time.h> #ifndef lint -FILE_RCSID("@(#)$File: print.c,v 1.63 2008/02/17 19:28:54 rrt Exp $") +FILE_RCSID("@(#)$File: print.c,v 1.64 2008/10/20 15:14:17 christos Exp $") #endif /* lint */ #define SZOF(a) (sizeof(a) / sizeof(a[0])) @@ -64,7 +64,8 @@ file_mdump(struct magic *m) if (m->in_op & FILE_OPINVERSE) (void) fputc('~', stderr); (void) fprintf(stderr, "%c%u),", - ((m->in_op & FILE_OPS_MASK) < SZOF(optyp)) ? + ((size_t)(m->in_op & FILE_OPS_MASK) < + SZOF(optyp)) ? optyp[m->in_op & FILE_OPS_MASK] : '?', m->in_offset); } @@ -93,7 +94,7 @@ file_mdump(struct magic *m) (void) fprintf(stderr, "/%u", m->str_range); } else { - if ((m->mask_op & FILE_OPS_MASK) < SZOF(optyp)) + if ((size_t)(m->mask_op & FILE_OPS_MASK) < SZOF(optyp)) (void) fputc(optyp[m->mask_op & FILE_OPS_MASK], stderr); else (void) fputc('?', stderr); |
