diff options
Diffstat (limited to 'ping_protocol/rawping.cpp')
-rw-r--r-- | ping_protocol/rawping.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ping_protocol/rawping.cpp b/ping_protocol/rawping.cpp index 008a2a8..de8fa34 100644 --- a/ping_protocol/rawping.cpp +++ b/ping_protocol/rawping.cpp @@ -27,7 +27,7 @@ USHORT ip_checksum(USHORT* buffer, int size) return (USHORT)(~cksum);
}
-SOCKET sd = -1;
+SOCKET sd = (SOCKET)-1;
char packet[1024];
char recv_buff[1024];
USHORT seq_no = 0;
@@ -40,7 +40,7 @@ extern int init_raw_ping() { return 1;
}
- if(sd != -1)
+ if(sd != (SOCKET)-1)
closesocket(sd);
// Create the socket
@@ -110,7 +110,7 @@ extern int raw_ping(char *host, int timeout) { bool use_hi_res = false;
LARGE_INTEGER hr_freq, hr_send_time;
- DWORD send_time;
+ DWORD send_time = 0;
if(QueryPerformanceFrequency(&hr_freq)) {
use_hi_res = true;
QueryPerformanceCounter(&hr_send_time);
@@ -128,7 +128,7 @@ extern int raw_ping(char *host, int timeout) { int fromlen = sizeof(source);
IPHeader *reply_header = (IPHeader *)recv_buff;
ICMPHeader *reply;
- DWORD start, current_time;
+ DWORD start = 0, current_time = 0;
LARGE_INTEGER hr_start, hr_current_time, hr_timeout;
if(use_hi_res) {
hr_timeout.QuadPart = (timeout * hr_freq.QuadPart / 1000);
@@ -199,7 +199,7 @@ extern int raw_ping(char *host, int timeout) { extern int cleanup_raw_ping() {
if(inited) {
closesocket(sd);
- sd = -1;
+ sd = (SOCKET)-1;
WSACleanup();
}
return 0;
|