From 39340b187428922537dbe2a98c12cc249e86b5ae Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Thu, 12 May 2016 19:46:43 +0000 Subject: Haiku patch diff --git a/configure.ac b/configure.ac index 8d0c581..3db6602 100644 --- a/configure.ac +++ b/configure.ac @@ -135,14 +135,14 @@ else WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \ -Wmissing-declarations -Wredundant-decls -Wnested-externs \ -Wsign-compare -Wreturn-type -Wswitch -Wshadow \ - -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2" + -Wcast-qual -Wwrite-strings -Wformat=2" fi], [ if test "$GCC" = yes; then AC_MSG_RESULT(yes) WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \ -Wmissing-declarations -Wredundant-decls -Wnested-externs \ -Wsign-compare -Wreturn-type -Wswitch -Wshadow \ - -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2" + -Wcast-qual -Wwrite-strings -Wformat=2" else WARNINGS= AC_MSG_RESULT(no) diff --git a/src/der.c b/src/der.c index 4e22caf..1704092 100644 --- a/src/der.c +++ b/src/der.c @@ -219,6 +219,7 @@ static int der_data(char *buf, size_t blen, uint32_t tag, const void *q, uint32_t len) { const uint8_t *d = CAST(const uint8_t *, q); + uint32_t i; switch (tag) { case DER_TAG_PRINTABLE_STRING: case DER_TAG_UTF8_STRING: @@ -229,7 +230,7 @@ der_data(char *buf, size_t blen, uint32_t tag, const void *q, uint32_t len) break; } - for (uint32_t i = 0; i < len; i++) { + for (i = 0; i < len; i++) { uint32_t z = i << 1; if (z < blen - 2) snprintf(buf + z, blen - z, "%.2x", d[i]); @@ -242,12 +243,13 @@ der_offs(struct magic_set *ms, struct magic *m, size_t nbytes) { const uint8_t *b = RCAST(const uint8_t *, ms->search.s); size_t offs = 0, len = ms->search.s_len ? ms->search.s_len : nbytes; + uint32_t tlen; if (gettag(b, &offs, len) == DER_BAD) return -1; DPRINTF(("%s1: %d %zu %u\n", __func__, ms->offset, offs, m->offset)); - uint32_t tlen = getlength(b, &offs, len); + tlen = getlength(b, &offs, len); if (tlen == DER_BAD) return -1; DPRINTF(("%s2: %d %zu %u\n", __func__, ms->offset, offs, tlen)); @@ -276,6 +278,7 @@ der_cmp(struct magic_set *ms, struct magic *m) size_t offs = 0, len = ms->search.s_len; uint32_t tag, tlen; char buf[128]; + size_t slen; tag = gettag(b, &offs, len); if (tag == DER_BAD) @@ -289,7 +292,7 @@ der_cmp(struct magic_set *ms, struct magic *m) if ((ms->flags & MAGIC_DEBUG) != 0) fprintf(stderr, "%s: tag %p got=%s exp=%s\n", __func__, b, buf, s); - size_t slen = strlen(buf); + slen = strlen(buf); if (strncmp(buf, s, slen) != 0) return 0; diff --git a/src/readelf.c b/src/readelf.c index c6b10f9..287e911 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -923,6 +923,7 @@ do_auxv_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type, const char *tag; int is_string; size_t nval; + size_t off; if ((*flags & (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE)) != (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE)) @@ -950,7 +951,7 @@ do_auxv_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type, *flags |= FLAGS_DID_AUXV; nval = 0; - for (size_t off = 0; off + elsize <= descsz; off += elsize) { + for (off = 0; off + elsize <= descsz; off += elsize) { (void)memcpy(xauxv_addr, &nbuf[doff + off], xauxv_sizeof); /* Limit processing to 50 vector entries to prevent DoS */ if (nval++ >= 50) { -- 2.12.2