-/* $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>
{
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;
}
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)) {
-/* $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
};
#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
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);
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);
#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;