cnping

Minimal Graphical Ping Tool
git clone https://git.sinitax.com/cnlohr/cnping
Log | Files | Refs | Submodules | README | LICENSE | sfeed.txt

commit 4f1d2303a145a705d4abc9b3e45afcd19a8928d8
parent 3951f0e911382622fc48e0c30f83c4743b7c64b5
Author: CNLohr <charles@cnlohr.com>
Date:   Tue, 12 Jun 2018 11:40:43 -0400

Merge pull request #42 from onkelpit/master

fixed compiler warnings
Diffstat:
MCNFGXDriver.c | 18++++++------------
Mcnping-mousey.c | 9+--------
Dcnping.exe | 0
Mping.c | 12+++---------
Msearchnet.c | 9---------
5 files changed, 10 insertions(+), 38 deletions(-)

diff --git a/CNFGXDriver.c b/CNFGXDriver.c @@ -1,5 +1,5 @@ //Copyright (c) 2011, 2017 <>< Charles Lohr - Under the MIT/x11 or NewBSD License you choose. -//portions from +//portions from //http://www.xmission.com/~georgeps/documentation/tutorials/Xlib_Beginner.html //#define HAS_XINERAMA @@ -128,8 +128,8 @@ void CNFGSetupFullscreen( const char * WindowName, int screen_no ) CNFGWindow = XCreateWindow(CNFGDisplay, XRootWindow(CNFGDisplay, screen), xpos, ypos, CNFGWinAtt.width, CNFGWinAtt.height, - 0, CNFGWinAtt.depth, InputOutput, CNFGVisual, - CWBorderPixel | CWEventMask | CWOverrideRedirect | CWSaveUnder, + 0, CNFGWinAtt.depth, InputOutput, CNFGVisual, + CWBorderPixel | CWEventMask | CWOverrideRedirect | CWSaveUnder, &setwinattr); XMapWindow(CNFGDisplay, CNFGWindow); @@ -173,7 +173,7 @@ void CNFGSetup( const char * WindowName, int w, int h ) #ifdef CNFGOGL int attribs[] = { GLX_RGBA, - GLX_DOUBLEBUFFER, + GLX_DOUBLEBUFFER, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, @@ -214,10 +214,9 @@ void CNFGHandleInput() XEvent report; int bKeyDirection = 1; - int r; while( XPending( CNFGDisplay ) ) { - r=XNextEvent( CNFGDisplay, &report ); + XNextEvent( CNFGDisplay, &report ); bKeyDirection = 1; switch (report.type) @@ -263,8 +262,6 @@ void CNFGUpdateScreenWithBitmap( unsigned long * data, int w, int h ) static XImage *xi; static int depth; static int lw, lh; - static unsigned char * lbuffer; - int r, ls; if( !xi ) { @@ -282,9 +279,6 @@ void CNFGUpdateScreenWithBitmap( unsigned long * data, int w, int h ) lw = w; lh = h; } - - ls = lw * lh; - XPutImage(CNFGDisplay, CNFGWindow, CNFGWindowGC, xi, 0, 0, 0, 0, w, h ); } @@ -324,7 +318,7 @@ uint32_t CNFGColor( uint32_t RGB ) void CNFGClearFrame() { XGetWindowAttributes( CNFGDisplay, CNFGWindow, &CNFGWinAtt ); - XSetForeground(CNFGDisplay, CNFGGC, CNFGColor(CNFGBGColor) ); + XSetForeground(CNFGDisplay, CNFGGC, CNFGColor(CNFGBGColor) ); XFillRectangle(CNFGDisplay, CNFGPixmap, CNFGGC, 0, 0, CNFGWinAtt.width, CNFGWinAtt.height ); } diff --git a/cnping-mousey.c b/cnping-mousey.c @@ -262,14 +262,11 @@ int main( int argc, const char ** argv ) #endif { char title[1024]; - int i, x, y, r; + int i; double ThisTime; double LastFPSTime = OGGetAbsoluteTime(); double LastFrameTime = OGGetAbsoluteTime(); double SecToWait; - int linesegs = 0; -// struct in_addr dst; - struct addrinfo *result; srand( (int)(OGGetAbsoluteTime()*100000) ); @@ -310,10 +307,7 @@ int main( int argc, const char ** argv ) while(1) { - int i, pos; - float f; iframeno++; - RDPoint pto[3]; if( notemode && lastnoteupdown > 0 && OGGetAbsoluteTime() - lastnoteupdown > .05 ) @@ -335,7 +329,6 @@ int main( int argc, const char ** argv ) if( ThisTime > LastFPSTime + 1 ) { frames = 0; - linesegs = 0; LastFPSTime+=1; } diff --git a/cnping.exe b/cnping.exe Binary files differ. diff --git a/ping.c b/ping.c @@ -84,7 +84,7 @@ uint16_t checksum( const unsigned char * start, uint16_t len ) const uint16_t * wptr = (uint16_t*) start; uint32_t csum = 0; for (i=1;i<len;i+=2) - csum += (uint32_t)(*(wptr++)); + csum += (uint32_t)(*(wptr++)); if( len & 1 ) //See if there's an odd number of bytes? csum += *(uint8_t*)wptr; if (csum>>16) @@ -115,7 +115,7 @@ void listener() for (;;) { socklen_t addrlenval=sizeof(addr); - int bytes; + int bytes; #ifdef WIN32 WSAPOLLFD fda[1]; @@ -146,13 +146,7 @@ void listener() void ping(struct sockaddr_in *addr ) { -#ifdef WIN32 - const char val=255; -#else - const int val=255; -#endif - int i, cnt=1; - struct sockaddr_in r_addr; + int cnt=1; #ifdef WIN32 { diff --git a/searchnet.c b/searchnet.c @@ -19,17 +19,8 @@ void * PingListen( void * r ) void display(uint8_t *buf, int bytes) { - int i; uint32_t reqid = ((uint32_t)buf[0+1] << 24) | (buf[1+1]<<16) | (buf[2+1]<<8) | (buf[3+1]); -/* for( i = 0; i < bytes; i++ ) - { - printf( "%02x ", buf[i] ); - } - printf( "\n" ); - printf( "REQ: %08x %08x\n", reqid, my_random_key ); -/// printf( "%d.%d.%d.%d\n", buf[4], buf[5], buf[6], buf[7] ); -*/ if( reqid != my_random_key ) return; printf( "%d.%d.%d.%d\n", buf[4+1], buf[5+1], buf[6+1], buf[7+1] );