summaryrefslogtreecommitdiff
path: root/plugins/Ping/src/rawping.cpp
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-10-18 17:09:17 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-10-18 17:09:17 +0000
commit89cedbefd3197060e630a9751a7720f2a0d78bf5 (patch)
tree855d006c2d39a205ea74a1b89b21daeb3d1524f3 /plugins/Ping/src/rawping.cpp
parent6f9167b69872efc9c6d14daa8987d0ab51a5408e (diff)
Ping:
- Fixed minor compiler warnings git-svn-id: http://svn.miranda-ng.org/main/trunk@15569 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Ping/src/rawping.cpp')
-rw-r--r--plugins/Ping/src/rawping.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/plugins/Ping/src/rawping.cpp b/plugins/Ping/src/rawping.cpp
index 2382aa9030..8b7918280a 100644
--- a/plugins/Ping/src/rawping.cpp
+++ b/plugins/Ping/src/rawping.cpp
@@ -106,11 +106,12 @@ extern int raw_ping(char *host, int timeout)
header->checksum = ip_checksum((USHORT*)header, sizeof(ICMPHeader));
bool use_hi_res = false;
- LARGE_INTEGER hr_freq, hr_send_time;
+ LARGE_INTEGER hr_freq = { 0 }, hr_send_time = { 0 };
DWORD send_time;
if (QueryPerformanceFrequency(&hr_freq)) {
use_hi_res = true;
QueryPerformanceCounter(&hr_send_time);
+ send_time = 0;
}
else
send_time = GetTickCount();
@@ -128,19 +129,17 @@ extern int raw_ping(char *host, int timeout)
IPHeader *reply_header = (IPHeader *)recv_buff;
ICMPHeader *reply;
DWORD start, current_time;
- LARGE_INTEGER hr_start, hr_current_time, hr_timeout;
+ LARGE_INTEGER hr_start = { 0 }, hr_current_time = { 0 }, hr_timeout = { 0 };
if (use_hi_res) {
- hr_timeout.QuadPart = (timeout * hr_freq.QuadPart / 1000);
+ hr_timeout.QuadPart = (timeout * hr_freq.QuadPart / 1000LL);
QueryPerformanceCounter(&hr_start);
hr_current_time = hr_start;
+ current_time = start = 0;
}
- else {
- start = GetTickCount();
- current_time = start;
- }
+ else
+ current_time = start = GetTickCount();
- while (((use_hi_res && (hr_current_time.QuadPart < hr_start.QuadPart + hr_timeout.QuadPart))
- || (!use_hi_res && current_time < start + timeout)))
+ while (use_hi_res ? (hr_current_time.QuadPart < hr_start.QuadPart + hr_timeout.QuadPart) : (current_time < start + timeout))
{
int bread = recvfrom(sd, recv_buff, 1024, 0, (sockaddr*)&source, &fromlen);