newer gcc does not like when you use out of bounds array indexes to access other elements in a struct (at least at -O2)
This commit is contained in:
parent
55b82c2a08
commit
adf61e4bf5
|
@ -2470,8 +2470,6 @@ int msg_header_prepend(msg_t *msg,
|
||||||
msg_header_t **
|
msg_header_t **
|
||||||
msg_hclass_offset(msg_mclass_t const *mc, msg_pub_t const *mo, msg_hclass_t *hc)
|
msg_hclass_offset(msg_mclass_t const *mc, msg_pub_t const *mo, msg_hclass_t *hc)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
assert(mc && hc);
|
assert(mc && hc);
|
||||||
|
|
||||||
if (mc == NULL || hc == NULL)
|
if (mc == NULL || hc == NULL)
|
||||||
|
@ -2486,9 +2484,13 @@ msg_hclass_offset(msg_mclass_t const *mc, msg_pub_t const *mo, msg_hclass_t *hc)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* Header has no name. */
|
/* Header has no name. */
|
||||||
for (i = 0; i <= 6; i++)
|
if (hc->hc_hash == mc->mc_request[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_request[0].hr_offset);
|
||||||
if (hc->hc_hash == mc->mc_request[i].hr_class->hc_hash)
|
if (hc->hc_hash == mc->mc_status[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_status[0].hr_offset);
|
||||||
return (msg_header_t **)((char *)mo + mc->mc_request[i].hr_offset);
|
if (hc->hc_hash == mc->mc_separator[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_separator[0].hr_offset);
|
||||||
|
if (hc->hc_hash == mc->mc_payload[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_payload[0].hr_offset);
|
||||||
|
if (hc->hc_hash == mc->mc_unknown[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_unknown[0].hr_offset);
|
||||||
|
if (hc->hc_hash == mc->mc_error[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_error[0].hr_offset);
|
||||||
|
if (hc->hc_hash == mc->mc_multipart[0].hr_class->hc_hash) return (msg_header_t **)((char *)mo + mc->mc_multipart[0].hr_offset);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue