From 07af264afabb9cb4779507ae2fd50675c09d8bb6 Mon Sep 17 00:00:00 2001 From: Murai Takashi Date: Mon, 3 Dec 2018 06:21:46 +0900 Subject: [PATCH] ipv4: Fix PVS 2464 Fix using local variable within a loop with a same name as a variable controlling this loop. Change-Id: Ie920807a56e51b32844ac13ff1d8c564466d3a83 Reviewed-on: https://review.haiku-os.org/751 Reviewed-by: Adrien Destugues --- src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp b/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp index 2223ae846d..6c5f142606 100644 --- a/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp +++ b/src/add-ons/kernel/network/protocols/ipv4/ipv4.cpp @@ -497,10 +497,10 @@ dump_ipv4_header(ipv4_header &header) static int dump_ipv4_multicast(int argc, char** argv) { - MulticastState::Iterator it = sMulticastState->GetIterator(); + MulticastState::Iterator groupIterator = sMulticastState->GetIterator(); - while (it.HasNext()) { - IPv4GroupInterface* state = it.Next(); + while (groupIterator.HasNext()) { + IPv4GroupInterface* state = groupIterator.Next(); char addressBuffer[64]; @@ -511,10 +511,11 @@ dump_ipv4_multicast(int argc, char** argv) ? "Exclude" : "Include"); int count = 0; - IPv4GroupInterface::AddressSet::Iterator it + IPv4GroupInterface::AddressSet::Iterator addressIterator = state->Sources().GetIterator(); - while (it.HasNext()) { - kprintf("%s%s", count > 0 ? ", " : "", print_address(&it.Next(), + while (addressIterator.HasNext()) { + kprintf("%s%s", count > 0 ? ", " : "", + print_address(&addressIterator.Next(), addressBuffer, sizeof(addressBuffer))); count++; }