snmp: hopefully fixed all alignment warnings introduced today. unfortunately, gcc does not warn about them when compiling for x86

This commit is contained in:
sg 2015-10-02 21:59:40 +02:00
parent e4abd4234d
commit 8891b277c6
3 changed files with 31 additions and 31 deletions

View File

@ -833,7 +833,7 @@ void mib2_add_arp_entry(struct netif *ni, ip4_addr_t *ip)
} }
else else
{ {
at_rn = (struct mib_list_rootnode*)at_node->nptr; at_rn = (struct mib_list_rootnode*)(void*)at_node->nptr;
} }
} }
} }
@ -884,13 +884,13 @@ void mib2_remove_arp_entry(struct netif *ni, ip4_addr_t *ip)
del_rn[del_cnt] = at_rn; del_rn[del_cnt] = at_rn;
del_n[del_cnt] = at_n; del_n[del_cnt] = at_n;
del_cnt++; del_cnt++;
at_rn = (struct mib_list_rootnode*)(at_n->nptr); at_rn = (struct mib_list_rootnode*)(void*)at_n->nptr;
} }
else if (fc == 2) else if (fc == 2)
{ {
/* reset delete (2 or more childs) */ /* reset delete (2 or more childs) */
del_cnt = 0; del_cnt = 0;
at_rn = (struct mib_list_rootnode*)(at_n->nptr); at_rn = (struct mib_list_rootnode*)(void*)at_n->nptr;
} }
level++; level++;
} }
@ -960,7 +960,7 @@ void mib2_add_ip4(struct netif *ni)
} }
else else
{ {
ipa_rn = (struct mib_list_rootnode*)ipa_node->nptr; ipa_rn = (struct mib_list_rootnode*)(void*)ipa_node->nptr;
} }
} }
level++; level++;
@ -1001,13 +1001,13 @@ void mib2_remove_ip4(struct netif *ni)
del_rn[del_cnt] = ipa_rn; del_rn[del_cnt] = ipa_rn;
del_n[del_cnt] = ipa_n; del_n[del_cnt] = ipa_n;
del_cnt++; del_cnt++;
ipa_rn = (struct mib_list_rootnode*)(ipa_n->nptr); ipa_rn = (struct mib_list_rootnode*)(void*)ipa_n->nptr;
} }
else if (fc == 2) else if (fc == 2)
{ {
/* reset delete (2 or more childs) */ /* reset delete (2 or more childs) */
del_cnt = 0; del_cnt = 0;
ipa_rn = (struct mib_list_rootnode*)(ipa_n->nptr); ipa_rn = (struct mib_list_rootnode*)(void*)ipa_n->nptr;
} }
level++; level++;
} }
@ -1099,7 +1099,7 @@ void mib2_add_route_ip4(u8_t dflt, struct netif *ni)
} }
else else
{ {
iprte_rn = (struct mib_list_rootnode*)iprte_node->nptr; iprte_rn = (struct mib_list_rootnode*)(void*)iprte_node->nptr;
} }
} }
level++; level++;
@ -1163,13 +1163,13 @@ void mib2_remove_route_ip4(u8_t dflt, struct netif *ni)
del_rn[del_cnt] = iprte_rn; del_rn[del_cnt] = iprte_rn;
del_n[del_cnt] = iprte_n; del_n[del_cnt] = iprte_n;
del_cnt++; del_cnt++;
iprte_rn = (struct mib_list_rootnode*)(iprte_n->nptr); iprte_rn = (struct mib_list_rootnode*)(void*)iprte_n->nptr;
} }
else if (fc == 2) else if (fc == 2)
{ {
/* reset delete (2 or more childs) */ /* reset delete (2 or more childs) */
del_cnt = 0; del_cnt = 0;
iprte_rn = (struct mib_list_rootnode*)(iprte_n->nptr); iprte_rn = (struct mib_list_rootnode*)(void*)iprte_n->nptr;
} }
level++; level++;
} }
@ -1243,7 +1243,7 @@ void mib2_udp_bind(struct udp_pcb *pcb)
} }
else else
{ {
udp_rn = (struct mib_list_rootnode*)udp_node->nptr; udp_rn = (struct mib_list_rootnode*)(void*)udp_node->nptr;
} }
} }
} }
@ -1304,13 +1304,13 @@ void mib2_udp_unbind(struct udp_pcb *pcb)
del_rn[del_cnt] = udp_rn; del_rn[del_cnt] = udp_rn;
del_n[del_cnt] = udp_n; del_n[del_cnt] = udp_n;
del_cnt++; del_cnt++;
udp_rn = (struct mib_list_rootnode*)(udp_n->nptr); udp_rn = (struct mib_list_rootnode*)(void*)udp_n->nptr;
} }
else if (fc == 2) else if (fc == 2)
{ {
/* reset delete (2 or more childs) */ /* reset delete (2 or more childs) */
del_cnt = 0; del_cnt = 0;
udp_rn = (struct mib_list_rootnode*)(udp_n->nptr); udp_rn = (struct mib_list_rootnode*)(void*)udp_n->nptr;
} }
level++; level++;
} }

View File

@ -361,7 +361,7 @@ snmp_mib_node_find(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_no
if (n->nptr->node_type == MIB_NODE_LR) if (n->nptr->node_type == MIB_NODE_LR)
{ {
r = (struct mib_list_rootnode *)n->nptr; r = (struct mib_list_rootnode*)(void*)n->nptr;
if (r->count > 1) if (r->count > 1)
{ {
/* can't delete node */ /* can't delete node */
@ -400,7 +400,7 @@ snmp_mib_node_delete(struct mib_list_rootnode *rn, struct mib_list_node *n)
LWIP_ASSERT("n != NULL",n != NULL); LWIP_ASSERT("n != NULL",n != NULL);
/* caller must remove this sub-tree */ /* caller must remove this sub-tree */
next = (struct mib_list_rootnode*)(n->nptr); next = (struct mib_list_rootnode*)(void*)n->nptr;
rn->count -= 1; rn->count -= 1;
if (n == rn->head) if (n == rn->head)
@ -466,7 +466,7 @@ snmp_search_tree(const struct mib_node *node, u8_t ident_len, s32_t *ident, stru
if (ident_len > 0) if (ident_len > 0)
{ {
/* array node (internal ROM or RAM, fixed length) */ /* array node (internal ROM or RAM, fixed length) */
an = (const struct mib_array_node *)node; an = (const struct mib_array_node*)(const void*)node;
i = 0; i = 0;
while ((i < an->maxlength) && (an->entries[i].objid != *ident)) while ((i < an->maxlength) && (an->entries[i].objid != *ident))
{ {
@ -514,7 +514,7 @@ snmp_search_tree(const struct mib_node *node, u8_t ident_len, s32_t *ident, stru
if (ident_len > 0) if (ident_len > 0)
{ {
/* list root node (internal 'RAM', variable length) */ /* list root node (internal 'RAM', variable length) */
lrn = (const struct mib_list_rootnode *)node; lrn = (const struct mib_list_rootnode*)(const void*)node;
ln = lrn->head; ln = lrn->head;
/* iterate over list, head to tail */ /* iterate over list, head to tail */
while ((ln != NULL) && (ln->objid != *ident)) while ((ln != NULL) && (ln->objid != *ident))
@ -561,7 +561,7 @@ snmp_search_tree(const struct mib_node *node, u8_t ident_len, s32_t *ident, stru
if (ident_len > 0) if (ident_len > 0)
{ {
/* external node (addressing and access via functions) */ /* external node (addressing and access via functions) */
en = (const struct mib_external_node *)node; en = (const struct mib_external_node*)(const void*)node;
i = 0; i = 0;
len = en->level_length(en->addr_inf,ext_level); len = en->level_length(en->addr_inf,ext_level);
@ -646,7 +646,7 @@ empty_table(const struct mib_node *node)
if (node_type == MIB_NODE_LR) if (node_type == MIB_NODE_LR)
{ {
const struct mib_list_rootnode *lrn; const struct mib_list_rootnode *lrn;
lrn = (const struct mib_list_rootnode *)node; lrn = (const struct mib_list_rootnode*)(const void*)node;
if ((lrn->count == 0) || (lrn->head == NULL)) if ((lrn->count == 0) || (lrn->head == NULL))
{ {
empty = 1; empty = 1;
@ -655,7 +655,7 @@ empty_table(const struct mib_node *node)
else if ((node_type == MIB_NODE_AR) || (node_type == MIB_NODE_RA)) else if ((node_type == MIB_NODE_AR) || (node_type == MIB_NODE_RA))
{ {
const struct mib_array_node *an; const struct mib_array_node *an;
an = (const struct mib_array_node *)node; an = (const struct mib_array_node*)(const void*)node;
if ((an->maxlength == 0) || (an->entries == NULL)) if ((an->maxlength == 0) || (an->entries == NULL))
{ {
empty = 1; empty = 1;
@ -664,7 +664,7 @@ empty_table(const struct mib_node *node)
else if (node_type == MIB_NODE_EX) else if (node_type == MIB_NODE_EX)
{ {
const struct mib_external_node *en; const struct mib_external_node *en;
en = (const struct mib_external_node *)node; en = (const struct mib_external_node*)(const void*)node;
if (en->tree_levels == 0) if (en->tree_levels == 0)
{ {
empty = 1; empty = 1;
@ -695,7 +695,7 @@ snmp_expand_tree(const struct mib_node *node, u8_t ident_len, s32_t *ident, stru
u16_t i; u16_t i;
/* array node (internal ROM or RAM, fixed length) */ /* array node (internal ROM or RAM, fixed length) */
an = (const struct mib_array_node *)node; an = (const struct mib_array_node*)(const void*)node;
if (ident_len > 0) if (ident_len > 0)
{ {
i = 0; i = 0;
@ -815,7 +815,7 @@ snmp_expand_tree(const struct mib_node *node, u8_t ident_len, s32_t *ident, stru
struct mib_list_node *ln; struct mib_list_node *ln;
/* list root node (internal 'RAM', variable length) */ /* list root node (internal 'RAM', variable length) */
lrn = (const struct mib_list_rootnode *)node; lrn = (const struct mib_list_rootnode*)(const void*)node;
if (ident_len > 0) if (ident_len > 0)
{ {
ln = lrn->head; ln = lrn->head;
@ -933,7 +933,7 @@ snmp_expand_tree(const struct mib_node *node, u8_t ident_len, s32_t *ident, stru
s32_t ex_id; s32_t ex_id;
/* external node (addressing and access via functions) */ /* external node (addressing and access via functions) */
en = (const struct mib_external_node *)node; en = (const struct mib_external_node*)(const void*)node;
if (ident_len > 0) if (ident_len > 0)
{ {
u16_t i, len; u16_t i, len;

View File

@ -351,7 +351,7 @@ snmp_msg_get_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
if (mn->node_type == MIB_NODE_EX) if (mn->node_type == MIB_NODE_EX)
{ {
/* external object */ /* external object */
const struct mib_external_node *en = (const struct mib_external_node*)mn; const struct mib_external_node *en = (const struct mib_external_node*)(const void*)mn;
msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF; msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF;
/* save en && args in msg_ps!! */ /* save en && args in msg_ps!! */
@ -364,7 +364,7 @@ snmp_msg_get_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
{ {
/* internal object */ /* internal object */
struct obj_def object_def; struct obj_def object_def;
const struct mib_scalar_node *msn = (const struct mib_scalar_node*)mn; const struct mib_scalar_node *msn = (const struct mib_scalar_node*)(const void*)mn;
msg_ps->state = SNMP_MSG_INTERNAL_GET_OBJDEF; msg_ps->state = SNMP_MSG_INTERNAL_GET_OBJDEF;
msn->get_object_def(np.ident_len, np.ident, &object_def); msn->get_object_def(np.ident_len, np.ident, &object_def);
@ -541,7 +541,7 @@ snmp_msg_getnext_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
if (mn->node_type == MIB_NODE_EX) if (mn->node_type == MIB_NODE_EX)
{ {
/* external object */ /* external object */
const struct mib_external_node *en = (const struct mib_external_node*)mn; const struct mib_external_node *en = (const struct mib_external_node*)(const void*)mn;
msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF; msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF;
/* save en && args in msg_ps!! */ /* save en && args in msg_ps!! */
@ -555,7 +555,7 @@ snmp_msg_getnext_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
/* internal object */ /* internal object */
struct obj_def object_def; struct obj_def object_def;
struct snmp_varbind *vb; struct snmp_varbind *vb;
const struct mib_scalar_node *msn = (const struct mib_scalar_node*)mn; const struct mib_scalar_node *msn = (const struct mib_scalar_node*)(const void*)mn;
msg_ps->state = SNMP_MSG_INTERNAL_GET_OBJDEF; msg_ps->state = SNMP_MSG_INTERNAL_GET_OBJDEF;
msn->get_object_def(1, &oid.id[oid.len - 1], &object_def); msn->get_object_def(1, &oid.id[oid.len - 1], &object_def);
@ -720,7 +720,7 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
if (mn->node_type == MIB_NODE_EX) if (mn->node_type == MIB_NODE_EX)
{ {
/* external object */ /* external object */
const struct mib_external_node *en = (const struct mib_external_node*)mn; const struct mib_external_node *en = (const struct mib_external_node*)(const void*)mn;
msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF; msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF;
/* save en && args in msg_ps!! */ /* save en && args in msg_ps!! */
@ -733,7 +733,7 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
{ {
/* internal object */ /* internal object */
struct obj_def object_def; struct obj_def object_def;
const struct mib_scalar_node *msn = (const struct mib_scalar_node*)mn; const struct mib_scalar_node *msn = (const struct mib_scalar_node*)(const void*)mn;
msg_ps->state = SNMP_MSG_INTERNAL_GET_OBJDEF; msg_ps->state = SNMP_MSG_INTERNAL_GET_OBJDEF;
msn->get_object_def(np.ident_len, np.ident, &object_def); msn->get_object_def(np.ident_len, np.ident, &object_def);
@ -816,7 +816,7 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
if (mn->node_type == MIB_NODE_EX) if (mn->node_type == MIB_NODE_EX)
{ {
/* external object */ /* external object */
const struct mib_external_node *en = (const struct mib_external_node*)mn; const struct mib_external_node *en = (const struct mib_external_node*)(const void*)mn;
msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF_S; msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF_S;
/* save en && args in msg_ps!! */ /* save en && args in msg_ps!! */
@ -829,7 +829,7 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
{ {
/* internal object */ /* internal object */
struct obj_def object_def; struct obj_def object_def;
const struct mib_scalar_node *msn = (const struct mib_scalar_node*)mn; const struct mib_scalar_node *msn = (const struct mib_scalar_node*)(const void*)mn;
msg_ps->state = SNMP_MSG_INTERNAL_GET_OBJDEF_S; msg_ps->state = SNMP_MSG_INTERNAL_GET_OBJDEF_S;
msn->get_object_def(np.ident_len, np.ident, &object_def); msn->get_object_def(np.ident_len, np.ident, &object_def);