From fecf1e4e7a32c7ca66cf18730c9034b4448380e4 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Mon, 4 Apr 2011 22:13:27 +0300 Subject: [PATCH 1/1] Member field initialization added --- stglibs/pinger.lib/pinger.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/stglibs/pinger.lib/pinger.cpp b/stglibs/pinger.lib/pinger.cpp index fabc089e..a33f810b 100644 --- a/stglibs/pinger.lib/pinger.cpp +++ b/stglibs/pinger.lib/pinger.cpp @@ -33,6 +33,7 @@ STG_PINGER::STG_PINGER(time_t d) pid(0) { pthread_mutex_init(&mutex, NULL); + memset(&pmSend, 0, sizeof(pmSend)); } //----------------------------------------------------------------------------- STG_PINGER::~STG_PINGER() @@ -273,7 +274,7 @@ uint32_t STG_PINGER::RecvPing() //----------------------------------------------------------------------------- void * STG_PINGER::RunSendPing(void * d) { - STG_PINGER * pinger = (STG_PINGER*)d; + STG_PINGER * pinger = static_cast(d); pinger->isRunningSender = true; time_t lastPing = 0; @@ -317,23 +318,18 @@ void * STG_PINGER::RunSendPing(void * d) //----------------------------------------------------------------------------- void * STG_PINGER::RunRecvPing(void * d) { - STG_PINGER * pinger = (STG_PINGER*)d; + STG_PINGER * pinger = static_cast(d); pinger->isRunningRecver = true; - uint32_t ip; - std::multimap::iterator treeIterLower; - std::multimap::iterator treeIterUpper; - while (pinger->nonstop) { - ip = pinger->RecvPing(); + uint32_t ip = pinger->RecvPing(); if (ip) { - treeIterUpper = pinger->pingIP.upper_bound(ip); - treeIterLower = pinger->pingIP.lower_bound(ip); - int i = 0; + std::multimap::iterator treeIterUpper = pinger->pingIP.upper_bound(ip); + std::multimap::iterator treeIterLower = pinger->pingIP.lower_bound(ip); while (treeIterUpper != treeIterLower) { #ifdef STG_TIME @@ -342,7 +338,6 @@ void * STG_PINGER::RunRecvPing(void * d) treeIterLower->second = time(NULL); #endif ++treeIterLower; - i++; } } -- 2.44.2