diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2015-10-05 19:50:39 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2015-10-05 19:50:39 +0000 |
commit | 6bbd2f17cd9183606bb244bbb39a3c31cca15fc6 (patch) | |
tree | 4fc1bc0d773c9341c91cabef17a20e870ff44fb9 /usr.bin/file/magic-test.c | |
parent | 06158c5263773e7616cc1f4acad4eb541edac78b (diff) |
Offset into the file can be size_t and add some casts to remove warnings.
Diffstat (limited to 'usr.bin/file/magic-test.c')
-rw-r--r-- | usr.bin/file/magic-test.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/file/magic-test.c b/usr.bin/file/magic-test.c index f2c72ea90a5..9f239c15ecf 100644 --- a/usr.bin/file/magic-test.c +++ b/usr.bin/file/magic-test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: magic-test.c,v 1.13 2015/08/12 09:39:43 nicm Exp $ */ +/* $OpenBSD: magic-test.c,v 1.14 2015/10/05 19:50:38 nicm Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org> @@ -1135,7 +1135,7 @@ magic_test_line(struct magic_line *ml, struct magic_state *ms) else { wanted = ml->indirect_offset; if (ml->indirect_relative) { - if (wanted < 0 && -wanted > ms->offset) + if (wanted < 0 && (size_t)-wanted > ms->offset) return (0); if (wanted > 0 && ms->offset + wanted > ms->size) return (0); @@ -1186,14 +1186,14 @@ magic_test_line(struct magic_line *ml, struct magic_state *ms) } if (ml->offset_relative) { - if (wanted < 0 && -wanted > ms->offset) + if (wanted < 0 && (size_t)-wanted > ms->offset) return (0); if (wanted > 0 && ms->offset + wanted > ms->size) return (0); offset = ms->offset + wanted; } else offset = wanted; - if (offset < 0 || offset > ms->size) + if (offset < 0 || (size_t)offset > ms->size) return (0); ms->offset = offset; @@ -1213,7 +1213,7 @@ magic_test_line(struct magic_line *ml, struct magic_state *ms) if (ml->mimetype != NULL) ms->mimetype = ml->mimetype; - magic_warn(ml, "test %s/%c matched at offset %llu: '%s'", + magic_warn(ml, "test %s/%c matched at offset %zu: '%s'", ml->type_string, ml->test_operator, ms->offset, ml->result == NULL ? "" : ml->result); |