From 8bee4eb990273c3654431467ba6618eb916f030a Mon Sep 17 00:00:00 2001 From: dscho Date: Sun, 15 May 2005 13:57:51 +0000 Subject: ANSIfy, fix some warnings from Linus' sparse --- client_examples/SDLvncviewer.c | 5 +++-- client_examples/ppmtest.c | 18 +++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'client_examples') diff --git a/client_examples/SDLvncviewer.c b/client_examples/SDLvncviewer.c index f94fda7..80bb5a4 100644 --- a/client_examples/SDLvncviewer.c +++ b/client_examples/SDLvncviewer.c @@ -46,7 +46,7 @@ static rfbBool resize(rfbClient* client) { return TRUE; } -rfbKeySym SDL_keysym2rfbKeySym(int keysym) { +static rfbKeySym SDL_keysym2rfbKeySym(int keysym) { switch(keysym) { case SDLK_BACKSPACE: return XK_BackSpace; case SDLK_TAB: return XK_ISO_Left_Tab; @@ -184,9 +184,10 @@ rfbKeySym SDL_keysym2rfbKeySym(int keysym) { case SDLK_BREAK: return XK_Break; default: rfbClientLog("Unknown keysym: %d\n",keysym); } + return 0; } -void update(rfbClient* cl,int x,int y,int w,int h) { +static void update(rfbClient* cl,int x,int y,int w,int h) { SDL_UpdateRect(cl->clientData, x, y, w, h); } diff --git a/client_examples/ppmtest.c b/client_examples/ppmtest.c index 6b84ad3..dbb5d57 100644 --- a/client_examples/ppmtest.c +++ b/client_examples/ppmtest.c @@ -6,11 +6,11 @@ #include #include -void PrintRect(rfbClient* client, int x, int y, int w, int h) { +static void PrintRect(rfbClient* client, int x, int y, int w, int h) { rfbClientLog("Received an update for %d,%d,%d,%d.\n",x,y,w,h); } -void SaveFramebufferAsPPM(rfbClient* client, int x, int y, int w, int h) { +static void SaveFramebufferAsPPM(rfbClient* client, int x, int y, int w, int h) { static time_t t=0,t1; FILE* f; int i,j; @@ -19,7 +19,7 @@ void SaveFramebufferAsPPM(rfbClient* client, int x, int y, int w, int h) { int row_stride=client->width*bpp; /* save one picture only if the last is older than 2 seconds */ - t1=time(0); + t1=time(NULL); if(t1-t>2) t=t1; else @@ -46,6 +46,8 @@ void SaveFramebufferAsPPM(rfbClient* client, int x, int y, int w, int h) { v=*(unsigned int*)p; else if(bpp==2) v=*(unsigned short*)p; + else + v=*(unsigned char*)p; fputc((v>>pf->redShift)*256/(pf->redMax+1),f); fputc((v>>pf->greenShift)*256/(pf->greenMax+1),f); fputc((v>>pf->blueShift)*256/(pf->blueMax+1),f); @@ -53,14 +55,11 @@ void SaveFramebufferAsPPM(rfbClient* client, int x, int y, int w, int h) { fclose(f); } - int +int main(int argc, char **argv) { - int i; rfbClient* client = rfbGetClient(8,3,4); - const char* vncServerHost=""; - int vncServerPort=5900; - time_t t=time(0); + time_t t=time(NULL); if(argc>1 && !strcmp("-print",argv[1])) { client->GotFrameBufferUpdate = PrintRect; @@ -81,7 +80,8 @@ main(int argc, char **argv) if (!rfbInitClient(client,&argc,argv)) return 1; - while (time(0)-t<5) { + /* TODO: better wait for update completion */ + while (time(NULL)-t<5) { static int i=0; fprintf(stderr,"\r%d",i++); if(WaitForMessage(client,50)<0) -- cgit v1.2.3