mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-16 16:50:06 +02:00
106 lines
3.5 KiB
Plaintext
106 lines
3.5 KiB
Plaintext
From 39340b187428922537dbe2a98c12cc249e86b5ae Mon Sep 17 00:00:00 2001
|
|
From: Jerome Duval <jerome.duval@gmail.com>
|
|
Date: Thu, 12 May 2016 19:46:43 +0000
|
|
Subject: Haiku patch
|
|
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 17505e3..0b7f09a 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -137,14 +137,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 cc27769..e77243b 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,13 +243,14 @@ 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 %" SIZE_T_FORMAT "u %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 %" SIZE_T_FORMAT "u %u\n", __func__, ms->offset,
|
|
@@ -279,6 +281,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)
|
|
@@ -292,7 +295,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 909e414..0bf4904 100644
|
|
--- a/src/readelf.c
|
|
+++ b/src/readelf.c
|
|
@@ -980,6 +980,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))
|
|
@@ -1007,7 +1008,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) {
|
|
memcpy(xauxv_addr, &nbuf[doff + off], xauxv_sizeof);
|
|
/* Limit processing to 50 vector entries to prevent DoS */
|
|
if (nval++ >= 50) {
|
|
--
|
|
2.17.0
|
|
|