diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2022-08-14 14:54:14 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2022-08-14 14:54:14 +0000 |
commit | b4caa42c1ed201e7f8dc1afe7062a185c5230b6b (patch) | |
tree | e8bd672ba982580e5ebedafbcaa5e254b5b96989 /usr.bin/ctfconv | |
parent | 9f8a33e2dd55b6c2f8cde69ee3c220c4d36eab8e (diff) |
Use size_t, not off_t, for length parameters.
This matches how the functions are called and eliminates a few casts.
OK tb@
Diffstat (limited to 'usr.bin/ctfconv')
-rw-r--r-- | usr.bin/ctfconv/elf.c | 7 | ||||
-rw-r--r-- | usr.bin/ctfconv/generate.c | 10 |
2 files changed, 9 insertions, 8 deletions
diff --git a/usr.bin/ctfconv/elf.c b/usr.bin/ctfconv/elf.c index ff71223d301..043939afb1a 100644 --- a/usr.bin/ctfconv/elf.c +++ b/usr.bin/ctfconv/elf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: elf.c,v 1.9 2017/11/14 09:14:50 mpi Exp $ */ +/* $OpenBSD: elf.c,v 1.10 2022/08/14 14:54:13 millert Exp $ */ /* * Copyright (c) 2016 Martin Pieuchot <mpi@openbsd.org> @@ -34,7 +34,7 @@ iself(const char *p, size_t filesize) { Elf_Ehdr *eh = (Elf_Ehdr *)p; - if (filesize < (off_t)sizeof(Elf_Ehdr)) { + if (filesize < sizeof(Elf_Ehdr)) { warnx("file too small to be ELF"); return 0; } @@ -55,7 +55,8 @@ iself(const char *p, size_t filesize) return 0; } if (eh->e_shoff > filesize) { - warnx("bogus section table offset 0x%llx", (off_t)eh->e_shoff); + warnx("bogus section table offset 0x%llx", + (unsigned long long)eh->e_shoff); return 0; } if (eh->e_shentsize < sizeof(Elf_Shdr)) { diff --git a/usr.bin/ctfconv/generate.c b/usr.bin/ctfconv/generate.c index e19094fe231..c2911f59c76 100644 --- a/usr.bin/ctfconv/generate.c +++ b/usr.bin/ctfconv/generate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: generate.c,v 1.4 2017/09/26 08:16:18 mpi Exp $ */ +/* $OpenBSD: generate.c,v 1.5 2022/08/14 14:54:13 millert Exp $ */ /* * Copyright (c) 2017 Martin Pieuchot @@ -67,7 +67,7 @@ struct strentry { }; #ifdef ZLIB -char *data_compress(const char *, size_t, off_t, size_t *); +char *data_compress(const char *, size_t, size_t, size_t *); #endif /* ZLIB */ void @@ -84,7 +84,7 @@ dbuf_realloc(struct dbuf *dbuf, size_t len) void dbuf_copy(struct dbuf *dbuf, void const *data, size_t len) { - off_t left; + size_t left; assert(dbuf->cptr != NULL); assert(dbuf->data != NULL); @@ -94,7 +94,7 @@ dbuf_copy(struct dbuf *dbuf, void const *data, size_t len) return; left = dbuf->size - dbuf->coff; - if (left < (off_t)len) + if (left < len) dbuf_realloc(dbuf, ROUNDUP((len - left), DBUF_CHUNKSZ)); memcpy(dbuf->cptr, data, len); @@ -413,7 +413,7 @@ generate(const char *path, const char *label, int compress) #ifdef ZLIB char * -data_compress(const char *buf, size_t size, off_t len, size_t *pclen) +data_compress(const char *buf, size_t size, size_t len, size_t *pclen) { z_stream stream; char *data; |