From: Francois-Xavier Le Bail Date: Sun, 12 Jul 2015 18:32:35 +0000 (+0200) Subject: Fix warnings as "declaration of 'x' shadows a previous local" X-Git-Tag: tcpdump-4.8.0~216 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/b1c65c20a77b02a8aefab6744f8947000629d1ea Fix warnings as "declaration of 'x' shadows a previous local" --- diff --git a/print-isakmp.c b/print-isakmp.c index d3f0eb77..b1abcc6d 100644 --- a/print-isakmp.c +++ b/print-isakmp.c @@ -1354,27 +1354,27 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_, #endif case 2: { - const struct ipsecdoi_id *p; - struct ipsecdoi_id id; + const struct ipsecdoi_id *doi_p; + struct ipsecdoi_id doi_id; struct protoent *pe; - p = (const struct ipsecdoi_id *)ext; - ND_TCHECK(*p); - UNALIGNED_MEMCPY(&id, ext, sizeof(id)); - ND_PRINT((ndo," idtype=%s", STR_OR_ID(id.type, ipsecidtypestr))); + doi_p = (const struct ipsecdoi_id *)ext; + ND_TCHECK(*doi_p); + UNALIGNED_MEMCPY(&doi_id, ext, sizeof(doi_id)); + ND_PRINT((ndo," idtype=%s", STR_OR_ID(doi_id.type, ipsecidtypestr))); /* A protocol ID of 0 DOES NOT mean IPPROTO_IP! */ - pe = id.proto_id ? getprotobynumber(id.proto_id) : NULL; + pe = doi_id.proto_id ? getprotobynumber(doi_id.proto_id) : NULL; if (pe) ND_PRINT((ndo," protoid=%s", pe->p_name)); else - ND_PRINT((ndo," protoid=%u", id.proto_id)); - ND_PRINT((ndo," port=%d", ntohs(id.port))); + ND_PRINT((ndo," protoid=%u", doi_id.proto_id)); + ND_PRINT((ndo," port=%d", ntohs(doi_id.port))); if (!len) break; if (data == NULL) goto trunc; ND_TCHECK2(*data, len); - switch (id.type) { + switch (doi_id.type) { case IPSECDOI_ID_IPV4_ADDR: if (len < 4) ND_PRINT((ndo," len=%d [bad: < 4]", len)); diff --git a/print-pim.c b/print-pim.c index a0bf905a..1c1050b1 100644 --- a/print-pim.c +++ b/print-pim.c @@ -787,8 +787,6 @@ pimv2_print(netdissect_options *ndo, if (ndo->ndo_vflag > 1) { const u_char *ptr = bp; while (ptr < (bp+olen)) { - int advance; - ND_PRINT((ndo, "\n\t ")); advance = pimv2_addr_print(ndo, ptr, pimv2_unicast, 0); if (advance < 0) { diff --git a/print-snmp.c b/print-snmp.c index b9372644..0636a1f9 100644 --- a/print-snmp.c +++ b/print-snmp.c @@ -676,8 +676,9 @@ asn1_print(netdissect_options *ndo, break; case BE_OID: { - int o = 0, first = -1, i = asnlen; + int o = 0, first = -1; + i = asnlen; if (!ndo->ndo_sflag && !ndo->ndo_nflag && asnlen > 2) { const struct obj_abrev *a = &obj_abrev_list[0]; size_t a_len = strlen(a->oid); @@ -774,7 +775,8 @@ asn1_print(netdissect_options *ndo, case BE_STR: { register int printable = 1, first = 1; - const u_char *p = elem->data.str; + + p = elem->data.str; ND_TCHECK2(*p, asnlen); for (i = asnlen; printable && i-- > 0; p++) printable = ND_ISPRINT(*p);