diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-10-18 17:09:17 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-10-18 17:09:17 +0000 |
commit | 89cedbefd3197060e630a9751a7720f2a0d78bf5 (patch) | |
tree | 855d006c2d39a205ea74a1b89b21daeb3d1524f3 /plugins/Ping/src | |
parent | 6f9167b69872efc9c6d14daa8987d0ab51a5408e (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')
-rw-r--r-- | plugins/Ping/src/icmp.cpp | 4 | ||||
-rw-r--r-- | plugins/Ping/src/rawping.cpp | 17 |
2 files changed, 9 insertions, 12 deletions
diff --git a/plugins/Ping/src/icmp.cpp b/plugins/Ping/src/icmp.cpp index f54c356998..93bf4febd4 100644 --- a/plugins/Ping/src/icmp.cpp +++ b/plugins/Ping/src/icmp.cpp @@ -5,9 +5,7 @@ ICMP *ICMP::instance = 0; #define BUFFER_SIZE (16 * (sizeof(ICMP_ECHO_REPLY) + sizeof(data)))
-ICMP::ICMP() :
-timeout(2000),
-functions_loaded(false)
+ICMP::ICMP() : timeout(2000), functions_loaded(false), hIP(0)
{
WSAData wsaData;
if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) {
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);
|