commit fc696d6b365f9104bf88130e126144bcf556686a
parent 8edb9035f9ff7dc2c5e8b5275488d5da7360d562
Author: cnlohr <lohr85@gmail.com>
Date: Fri, 22 Jun 2018 00:47:52 -0400
Merge branch 'master' of https://github.com/cnlohr/cnping
Diffstat:
5 files changed, 9 insertions(+), 31 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];
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] );