From 50ef34933ba3e846605d52a96619323e12887959 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 6 May 2009 21:43:59 -0700 Subject: Clear many compiler & sparse warnings Signed-off-by: Alan Coopersmith --- audio.c | 16 ++++++------- common.c | 4 ++-- decode11.c | 17 ++++++++------ decode_render.c | 10 ++++---- decodenas.c | 2 +- fd.c | 2 +- print_bigreq.c | 4 ---- print_lbx.c | 4 ---- print_randr.c | 12 ---------- print_render.c | 18 --------------- print_shm.c | 8 ------- print_wcp.c | 27 +++------------------- prtype.c | 38 +++++++++++++++--------------- scope.c | 71 ++++++++++++++++++++++++++++----------------------------- server.c | 18 +++++++-------- table11.c | 2 +- 16 files changed, 94 insertions(+), 159 deletions(-) diff --git a/audio.c b/audio.c index 5f38398..94fd08a 100644 --- a/audio.c +++ b/audio.c @@ -47,7 +47,7 @@ ReportFromAudioClient ( if (NasVerbose) { if (ScopeEnabled) { PrintTime (); - fprintf(stdout, "NAS Client%s --> %4d %s\n", + fprintf(stdout, "NAS Client%s --> %4ld %s\n", ClientName(fd), n, (n == 1 ? "byte" : "bytes")); } } @@ -63,7 +63,7 @@ ReportFromAudioServer( if (NasVerbose) { if (ScopeEnabled) { PrintTime(); - fprintf(stdout, "\t\t\t\t\t%4d %s <-- NAS Server%s\n", + fprintf(stdout, "\t\t\t\t\t%4ld %s <-- NAS Server%s\n", n, (n == 1 ? "byte" : "bytes"), ClientName(fd)); } } @@ -137,7 +137,7 @@ StartAudioSetUpMessage ( CS[fd].ByteProcessing = FinishAudioSetUpMessage; CS[fd].NumberofBytesNeeded = n + pad((long)namelength) + pad((long)datalength); - debug(8,(stderr, "need %d bytes to finish startup\n", + debug(8,(stderr, "need %ld bytes to finish startup\n", CS[fd].NumberofBytesNeeded - n)); return(0); } @@ -172,7 +172,7 @@ StartAudioRequest ( requestlength = IShort(&buf[2]); CS[fd].ByteProcessing = FinishAudioRequest; CS[fd].NumberofBytesNeeded = 4 * requestlength; - debug(8,(stderr, "need %d more bytes to finish request\n", + debug(8,(stderr, "need %ld more bytes to finish request\n", CS[fd].NumberofBytesNeeded - n)); return(0); } @@ -234,7 +234,7 @@ StartAudioSetUpReply ( replylength = IShort(&buf[6]); CS[fd].ByteProcessing = FinishAudioSetUpReply; CS[fd].NumberofBytesNeeded = n + 4 * replylength; - debug(8,(stderr, "need %d bytes to finish startup reply\n", + debug(8,(stderr, "need %ld bytes to finish startup reply\n", CS[fd].NumberofBytesNeeded - n)); return(0); } @@ -304,7 +304,7 @@ AudioReplyPacket ( CS[fd].ByteProcessing = FinishAudioReply; CS[fd].NumberofBytesNeeded = n + 4 * replylength; - debug(8,(stderr, "need %d bytes to finish reply\n", (4 * replylength))); + debug(8,(stderr, "need %ld bytes to finish reply\n", (4 * replylength))); return(0); } @@ -379,7 +379,7 @@ DataFromAudioClient( } n = read(fd, FDinfo[ServerFD].buffer, BUFFER_SIZE); - debug(4,(stderr, "read %d bytes from Client%s\n", n, ClientName(fd))); + debug(4,(stderr, "read %ld bytes from Client%s\n", n, ClientName(fd))); if (n < 0) { PrintTime(); @@ -428,7 +428,7 @@ DataFromAudioServer( enterprocedure("DataFromAudioServer"); n = read(fd, (char *)FDinfo[ClientFD].buffer, BUFFER_SIZE); - debug(4,(stderr, "read %d bytes from Server%s\n", n, ClientName(fd))); + debug(4,(stderr, "read %ld bytes from Server%s\n", n, ClientName(fd))); if (n < 0) { PrintTime(); diff --git a/common.c b/common.c index ede4371..8d16e6d 100644 --- a/common.c +++ b/common.c @@ -99,7 +99,7 @@ Malloc (long n) { void *p; p = malloc(n); - debug(64,(stderr, "%x = malloc(%d)\n", p, n)); + debug(64,(stderr, "%lx = malloc(%ld)\n", (unsigned long) p, n)); if (p == NULL) panic("no more malloc space"); return(p); @@ -108,7 +108,7 @@ Malloc (long n) void Free(void *p) { - debug(64,(stderr, "%x = free\n", p)); + debug(64,(stderr, "%lx = free\n", (unsigned long) p)); free(p); } diff --git a/decode11.c b/decode11.c index bda221f..1cd9d30 100644 --- a/decode11.c +++ b/decode11.c @@ -184,13 +184,15 @@ static void DumpReplyQ ( FD fd) { - fprintf(stderr, "ReplyQ[%d] = { Head 0x%x; Tail 0x%x }\n", - fd, ReplyQ[fd].Head, ReplyQ[fd].Tail); + fprintf(stderr, "ReplyQ[%d] = { Head 0x%lx; Tail 0x%lx }\n", + fd, (unsigned long)ReplyQ[fd].Head, (unsigned long)ReplyQ[fd].Tail); { struct QueueEntry *p; for (p = ReplyQ[fd].Head; p != NULL; p = p->Next) - fprintf(stderr, "0x%x = { Next 0x%x; SequenceNumber %d; Request %d }\n", - p, p->Next, p->SequenceNumber, p->Request); + fprintf(stderr, + "0x%lx = { Next 0x%lx; SequenceNumber %ld; Request %d }\n", + (unsigned long) p, (unsigned long) p->Next, + (unsigned long) p->SequenceNumber, p->Request); } } /* ************************************************************ */ @@ -210,7 +212,8 @@ SequencedReplyExpected ( { struct QueueEntry *p; - debug(8,(stderr, "Reply expected: sequence %d and request type %d,%d for fd %d\n", + debug(8,(stderr, + "Reply expected: sequence %ld and request type %d,%d for fd %d\n", SequenceNumber, RequestType, RequestMinorType, fd)); /* create a new queue entry */ p = NewQEntry(SequenceNumber, RequestType, RequestMinorType); @@ -226,7 +229,7 @@ SequencedReplyExpected ( ReplyQ[fd].Head = p; ReplyQ[fd].Tail = p; - debug(8,(stderr, "Save sequence %d and request type %d,%d for fd %d\n", + debug(8,(stderr, "Save sequence %ld and request type %d,%d for fd %d\n", p->SequenceNumber, p->Request, p->RequestMinor, fd)); } @@ -336,7 +339,7 @@ static void SimpleDump (int type, FD fd, short Major, short Minor, long bytes) { PrintTime (); - fprintf (stdout, "@@%s %3d %3d %3d %7d\n", + fprintf (stdout, "@@%s %3d %3d %3d %7ld\n", simple_names[type], ClientNumber(fd), Major, Minor, bytes); diff --git a/decode_render.c b/decode_render.c index 6c46381..e1f5c05 100644 --- a/decode_render.c +++ b/decode_render.c @@ -116,7 +116,7 @@ PrintPICTURE ( if (n == 0) fprintf(stdout, "None"); else - fprintf(stdout, "PICTURE %08x", n); + fprintf(stdout, "PICTURE %08lx", n); return(4); } @@ -129,7 +129,7 @@ PrintPICTFORMAT ( if (n == 0) fprintf(stdout, "None"); else - fprintf(stdout, "PICTFORMAT %08x", n); + fprintf(stdout, "PICTFORMAT %08lx", n); return(4); } @@ -142,11 +142,11 @@ PrintPICTFORMINFO ( short t = IByte(buf+4); short d = IByte(buf+5); - fprintf (stdout, "PICTFORMINFO %08x %s %d ", + fprintf (stdout, "PICTFORMINFO %08lx %s %d ", n, t == 0 ? "Indexed" : "Direct", d); if (t == 0) { long c = ILong(buf+20); - fprintf (stdout, "cmap %08x", c); + fprintf (stdout, "cmap %08lx", c); } else { short r = IShort(buf+8); short g = IShort(buf+12); @@ -166,7 +166,7 @@ PrintGLYPHSET ( if (n == 0) fprintf(stdout, "None"); else - fprintf(stdout, "GLYPHSET %08x", n); + fprintf(stdout, "GLYPHSET %08lx", n); return(4); } diff --git a/decodenas.c b/decodenas.c index 56b9f33..befa2eb 100644 --- a/decodenas.c +++ b/decodenas.c @@ -56,7 +56,7 @@ static void AudioSimpleDump (int type, FD fd, short Major, short Minor, long bytes) { PrintTime (); - fprintf (stdout, "@@%s %3d %3d %3d %7d\n", + fprintf (stdout, "@@%s %3d %3d %3d %7ld\n", simple_names[type], ClientNumber(fd), Major, Minor, bytes); diff --git a/fd.c b/fd.c index af08595..69a00ee 100644 --- a/fd.c +++ b/fd.c @@ -279,7 +279,7 @@ MakeConnection( char address[256]; int connect_stat; - snprintf (address, sizeof(address), "%s:%d", server, port - ServerBasePort); + snprintf (address, sizeof(address), "%s:%ld", server, port - ServerBasePort); if ( (*trans_conn = _X11TransOpenCOTSClient(address)) == NULL ) { debug(1,(stderr, "OpenCOTSClient failed\n")); panic("Can't open connection to Server"); diff --git a/print_bigreq.c b/print_bigreq.c index dd1c84c..7871826 100644 --- a/print_bigreq.c +++ b/print_bigreq.c @@ -42,10 +42,6 @@ BigreqEnable (FD fd, const unsigned char *buf) void BigreqEnableReply (FD fd, const unsigned char *buf) { - short n; - long m; - long k; - PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* BigreqRequest reply */ ; if (Verbose < 1) return; diff --git a/print_lbx.c b/print_lbx.c index cc9d90e..2ec880c 100644 --- a/print_lbx.c +++ b/print_lbx.c @@ -52,10 +52,6 @@ LbxQueryVersionReply ( FD fd, const unsigned char *buf) { - short n; - long m; - long k; - PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* LbxRequest reply */ ; PrintField(RBf, 1, 1, LBXREPLY, LBXREPLYHEADER) /* LbxQueryVersion reply */; if (Verbose < 1) diff --git a/print_randr.c b/print_randr.c index c74647b..f987ebc 100644 --- a/print_randr.c +++ b/print_randr.c @@ -42,10 +42,6 @@ RandrQueryVersion (FD fd, const unsigned char *buf) void RandrQueryVersionReply (FD fd, const unsigned char *buf) { - short n; - long m; - long k; - PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* RandrRequest reply */ ; PrintField(RBf, 1, 1, RANDRREPLY, RANDRREPLYHEADER) /* RandrQueryVersion reply */; if (Verbose < 1) @@ -73,13 +69,9 @@ RandrGetScreenInfo (FD fd, const unsigned char *buf) void RandrGetScreenInfoReply (FD fd, const unsigned char *buf) { - short n; - long m; - long k; unsigned short nsize; unsigned short nvg; unsigned short ngvg; - unsigned short i; PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* RandrRequest reply */ ; if (Verbose < 1) @@ -123,10 +115,6 @@ RandrSetScreenConfig (FD fd, const unsigned char *buf) void RandrSetScreenConfigReply (FD fd, const unsigned char *buf) { - short n; - long m; - long k; - PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* RandrRequest reply */ ; PrintField(buf, 1, 1, BOOL, "success") /* RandrQueryVersion reply */; if (Verbose < 1) diff --git a/print_render.c b/print_render.c index 9436063..212fc27 100644 --- a/print_render.c +++ b/print_render.c @@ -42,10 +42,6 @@ RenderQueryVersion (FD fd, const unsigned char *buf) void RenderQueryVersionReply (FD fd, const unsigned char *buf) { - short n; - long m; - long k; - PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* RenderRequest reply */ ; PrintField(RBf, 1, 1, RENDERREPLY, RENDERREPLYHEADER) /* RenderQueryVersion reply */; if (Verbose < 1) @@ -77,8 +73,6 @@ RenderQueryPictFormatsReply (FD fd, const unsigned char *buf) long s; long d; long v; - long m; - long k; PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* RenderRequest reply */ ; PrintField(RBf, 1, 1, RENDERREPLY, RENDERREPLYHEADER) /* RenderQueryVersion reply */; @@ -110,10 +104,6 @@ RenderQueryPictIndexValues (FD fd, const unsigned char *buf) void RenderQueryPictIndexValuesReply (FD fd, const unsigned char *buf) { - short n; - long m; - long k; - PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* RenderRequest reply */ ; PrintField(RBf, 1, 1, RENDERREPLY, RENDERREPLYHEADER) /* RenderQueryVersion reply */; if (Verbose < 1) @@ -138,10 +128,6 @@ RenderQueryDithers (FD fd, const unsigned char *buf) void RenderQueryDithersReply (FD fd, const unsigned char *buf) { - short n; - long m; - long k; - PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* RenderRequest reply */ ; PrintField(RBf, 1, 1, RENDERREPLY, RENDERREPLYHEADER) /* RenderQueryVersion reply */; if (Verbose < 1) @@ -413,10 +399,6 @@ PrintGlyphs(const unsigned char *buf, int n, char *name) void RenderAddGlyphs (FD fd, const unsigned char *buf) { - long n; - long i; - long g; - long nb; PrintField (buf, 0, 1, REQUEST, REQUESTHEADER) /* RenderRequest */ ; PrintField (buf, 1, 1, RENDERREQUEST, RENDERREQUESTHEADER) /* RenderSwitch */ ; if (Verbose < 1) diff --git a/print_shm.c b/print_shm.c index aad6d28..02a30d9 100644 --- a/print_shm.c +++ b/print_shm.c @@ -42,10 +42,6 @@ MitshmQueryVersion (FD fd, const unsigned char *buf) void MitshmQueryVersionReply (FD fd, const unsigned char *buf) { - short n; - long m; - long k; - PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* MitshmRequest reply */ ; if (Verbose < 1) return; @@ -143,10 +139,6 @@ MitshmGetImage (FD fd, const unsigned char *buf) void MitshmGetImageReply (FD fd, const unsigned char *buf) { - short n; - long m; - long k; - PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* MitshmRequest reply */ ; if (Verbose < 1) return; diff --git a/print_wcp.c b/print_wcp.c index ff81cc1..b9bbbc3 100644 --- a/print_wcp.c +++ b/print_wcp.c @@ -47,10 +47,6 @@ WcpQueryVersionReply ( FD fd, const unsigned char *buf) { - short n; - long m; - long k; - PrintField(RBf, 0, 1, REPLY, REPLYHEADER) /* WcpRequest reply */ ; PrintField(RBf, 1, 1, WCPREPLY, WCPREPLYHEADER) /* WcpQueryVersion reply */; if (Verbose < 1) @@ -73,7 +69,7 @@ WcpAnalyzeImage1RLL ( unsigned char byte; unsigned char *data = (unsigned char *) buf; int x, y; - char *error = 0; + const char *error = NULL; int bytewidth; int i; int w; @@ -187,23 +183,6 @@ use ( return tmp; } -static int -match ( - PIXEL cache[LRU_CACHE], - PIXEL pixel) -{ - int e; - - for (e = 0; e < LRU_CACHE; e++) - if (cache[e] == pixel) - { - use (cache, e); - return e; - } - push (cache, pixel); - return LRU_MISS; -} - static void WcpAnalyzeImageNLRU ( const char *buf, @@ -222,7 +201,7 @@ WcpAnalyzeImageNLRU ( unsigned long run; PIXEL lru[LRU_CACHE]; PIXEL pix; - char *error = 0; + const char *error = NULL; y = 0; bytewidth = width * bytes; @@ -277,7 +256,7 @@ WcpAnalyzeImageNLRU ( break; } x += run; - fprintf (stdout, " %3d:%0*x", run, bytes * 2, pix); + fprintf (stdout, " %3ld:%0*x", run, bytes * 2, pix); } break; } diff --git a/prtype.c b/prtype.c index 56ff1db..6be200d 100644 --- a/prtype.c +++ b/prtype.c @@ -213,7 +213,7 @@ PrintINT16(const unsigned char *buf) long n = IShort (buf); if (n > 32767) n = 65536 - n; - fprintf(stdout, "%d", n); + fprintf(stdout, "%ld", n); return 2; } @@ -222,7 +222,7 @@ PrintINT32(const unsigned char *buf) { /* print a INT32 -- 32-bit signed integer */ long n = ILong (buf); - fprintf(stdout, "%d", n); + fprintf(stdout, "%ld", n); return 4; } @@ -251,7 +251,7 @@ PrintCARD32(const unsigned char *buf) { /* print a CARD32 -- 32-bit unsigned integer */ unsigned long n = ILong (buf); - fprintf(stdout, "%08x", n); + fprintf(stdout, "%08lx", n); return(4); } @@ -309,7 +309,7 @@ PrintWINDOW(const unsigned char *buf) if (n == 0) fprintf(stdout, "None"); else - fprintf(stdout, "WIN %08x", n); + fprintf(stdout, "WIN %08lx", n); return(4); } @@ -350,7 +350,7 @@ PrintPIXMAP(const unsigned char *buf) if (n == 0) fprintf(stdout, "None"); else - fprintf(stdout, "PXM %08x", n); + fprintf(stdout, "PXM %08lx", n); return 4; } @@ -389,7 +389,7 @@ PrintCURSOR(const unsigned char *buf) if (n == 0) fprintf(stdout, "None"); else - fprintf(stdout, "CUR %08x", n); + fprintf(stdout, "CUR %08lx", n); return 4; } @@ -402,7 +402,7 @@ PrintFONT(const unsigned char *buf) if (n == 0) fprintf(stdout, "None"); else - fprintf(stdout, "FNT %08x", n); + fprintf(stdout, "FNT %08lx", n); return 4; } @@ -412,7 +412,7 @@ PrintGCONTEXT(const unsigned char *buf) { /* print a GCONTEXT -- CARD32 */ long n = ILong (buf); - fprintf(stdout, "GXC %08x", n); + fprintf(stdout, "GXC %08lx", n); return 4; } @@ -425,7 +425,7 @@ PrintCOLORMAP(const unsigned char *buf) if (n == 0) fprintf(stdout, "None"); else - fprintf(stdout, "CMP %08x", n); + fprintf(stdout, "CMP %08lx", n); return(4); } @@ -447,7 +447,7 @@ PrintDRAWABLE(const unsigned char *buf) { /* print a DRAWABLE -- CARD32 */ long n = ILong (buf); - fprintf(stdout, "DWB %08x", n); + fprintf(stdout, "DWB %08lx", n); return 4; } @@ -456,7 +456,7 @@ PrintFONTABLE(const unsigned char *buf) { /* print a FONTABLE -- CARD32 */ long n = ILong (buf); - fprintf(stdout, "FTB %08x", n); + fprintf(stdout, "FTB %08lx", n); return 4; } @@ -494,7 +494,7 @@ PrintATOM(const unsigned char *buf) if (0 <= n && n <= NumberofAtoms) fprintf(stdout, "<%s>", AtomTable[n]); else - fprintf(stdout, "ATM %08x", n); + fprintf(stdout, "ATM %08lx", n); return(4); } @@ -519,7 +519,7 @@ PrintVISUALID(const unsigned char *buf) if (n == 0) fprintf(stdout, "None"); else - fprintf(stdout, "VIS %08x", n); + fprintf(stdout, "VIS %08lx", n); return 4; } @@ -544,7 +544,7 @@ PrintTIMESTAMP(const unsigned char *buf) if (n == 0) fprintf(stdout, "CurrentTime"); else - fprintf(stdout, "TIM %08x", n); + fprintf(stdout, "TIM %08lx", n); return 4; } @@ -557,7 +557,7 @@ PrintRESOURCEID(const unsigned char *buf) if (n == 0) fprintf(stdout, "AllTemporary"); else - fprintf(stdout, "RID %08x", n); + fprintf(stdout, "RID %08lx", n); return 4; } @@ -567,7 +567,7 @@ PrintKEYSYM(const unsigned char *buf) { /* print a KEYSYM -- CARD32 */ long n = ILong (buf); - fprintf(stdout, "KYS %08x", n); + fprintf(stdout, "KYS %08lx", n); return(4); } @@ -650,7 +650,7 @@ PrintENUMERATED( if (p != NULL) fprintf(stdout, "%s", p->Name); else - fprintf(stdout, "**INVALID** (%d)", n); + fprintf(stdout, "**INVALID** (%ld)", n); } /* ************************************************************ */ @@ -777,7 +777,7 @@ PrintList ( if (number == 0) return(0); - fprintf(stdout, "%s%20s: (%d)\n", Leader, name, number); + fprintf(stdout, "%s%20s: (%ld)\n", Leader, name, number); if (Verbose < 2) return(0); @@ -828,7 +828,7 @@ PrintListSTR ( if (number == 0) return(0); - fprintf(stdout, "%s%20s: (%d)\n", Leader, name, number); + fprintf(stdout, "%s%20s: (%ld)\n", Leader, name, number); if (Verbose < 2) return(0); diff --git a/scope.c b/scope.c index 8545930..591cfda 100644 --- a/scope.c +++ b/scope.c @@ -103,7 +103,7 @@ char DoAudio = 0; char TerminateClose = 0; int Interrupt = 0; -struct FDDescriptor *FDD = 0; +struct FDDescriptor *FDD = NULL; short MaxFD = 0; short nFDsInUse = 0; fd_set ReadDescriptors; @@ -116,7 +116,7 @@ short Verbose = 0; short XVerbose = 0; short NasVerbose = 0; int ScopePort = 0; -char *ScopeHost = 0; +char *ScopeHost = NULL; typedef struct _BreakPoint { @@ -149,26 +149,26 @@ typedef struct _CMDFunc { typedef const CMDFuncRec *CMDFuncPtr; static const CMDFuncRec CMDFuncs[] = { - "audio", "a", CMDAudio, "[a]udio", - "Set audio output level\n", - "break", "b", CMDBreak, "[b]reak", - "Create breakpoints\n", - "cont", "c", CMDCont, "[c]ont", - "Continue scoping\n", - "delete", "del", CMDDelete, "[del]ete", - "Delete breakpoints\n", - "disable","d", CMDDisable, "[d]isable", - "Disable breakpoints\n", - "enable", "e", CMDEnable, "[e]nable", - "Enable breakpoints\n", - "help", "?", CMDHelp, "help", - "Print this list\n", - "level", "l", CMDLevel, "[l]evel", - "Set output level\n", - "quit", "q", CMDQuit, "[q]uit", - "Quit Xscope\n", - "step", "s", CMDStep, "[s]tep", - "Step trace one request\n", + { "audio", "a", CMDAudio, "[a]udio", + "Set audio output level\n" }, + { "break", "b", CMDBreak, "[b]reak", + "Create breakpoints\n" }, + { "cont", "c", CMDCont, "[c]ont", + "Continue scoping\n" }, + { "delete", "del", CMDDelete, "[del]ete", + "Delete breakpoints\n" }, + { "disable","d", CMDDisable, "[d]isable", + "Disable breakpoints\n" }, + { "enable", "e", CMDEnable, "[e]nable", + "Enable breakpoints\n" }, + { "help", "?", CMDHelp, "help", + "Print this list\n" }, + { "level", "l", CMDLevel, "[l]evel", + "Set output level\n" }, + { "quit", "q", CMDQuit, "[q]uit", + "Quit Xscope\n" }, + { "step", "s", CMDStep, "[s]tep", + "Step trace one request\n" }, }; #define NumCMDFuncs (sizeof CMDFuncs / sizeof CMDFuncs[0]) @@ -248,7 +248,7 @@ CMDStringToFunc ( return &CMDFuncs[i]; } } - return 0; + return NULL; } static int @@ -285,7 +285,7 @@ CMDSplitIntoWords ( *line++ = '\0'; } } - *argv = 0; + *argv = NULL; return argc; } @@ -463,7 +463,7 @@ CMDBreak ( bp->request = request; bp->number = ++breakPointNumber; bp->enabled = true; - bp->next = 0; + bp->next = NULL; *prev = bp; prev = &bp->next; } @@ -527,7 +527,7 @@ CMDDelete ( if (argc == 1) { printf ("Deleting all breakpoints...\n"); - while (bp = breakPoints) + while ((bp = breakPoints) != NULL) { breakPoints = bp->next; free (bp); @@ -758,21 +758,21 @@ ScanArgs ( ServerOutPort = atoi(++*argv); if (ServerOutPort <= 0) ServerOutPort = 0; - debug(1,(stderr, "ServerOutPort = %d\n", ServerOutPort)); + debug(1,(stderr, "ServerOutPort = %ld\n", ServerOutPort)); break; case 'd': ServerDisplay = atoi(++*argv); if (ServerDisplay <= 0) ServerDisplay = 0; - debug(1,(stderr, "ServerDisplay=%d\n", ServerDisplay)); + debug(1,(stderr, "ServerDisplay = %ld\n", ServerDisplay)); break; case 'i': ServerInPort = atoi(++*argv); if (ServerInPort <= 0) ServerInPort = 0; - debug(1,(stderr, "ServerInPort = %d\n", ServerInPort)); + debug(1,(stderr, "ServerInPort = %ld\n", ServerInPort)); break; case 'h': @@ -821,7 +821,7 @@ ScanArgs ( if (ServerInPort == ServerOutPort) if (ServerHostName[0] == '\0') { - fprintf(stderr, "Can't have xscope on same port as server (%d)\n", + fprintf(stderr, "Can't have xscope on same port as server (%ld)\n", ServerInPort); Usage(); } @@ -883,7 +883,7 @@ ReadStdin ( enterprocedure("ReadStdin"); n = read(fd, buf, 2048); - debug(4,(stderr, "read %d bytes from stdin\n", n)); + debug(4,(stderr, "read %ld bytes from stdin\n", n)); } static void @@ -1017,7 +1017,7 @@ ClientName ( if (clientNumber <= 1) return(""); - (void)sprintf(name, " %d", FDinfo[fd].ClientNumber); + (void)sprintf(name, " %ld", FDinfo[fd].ClientNumber); return(name); } @@ -1119,7 +1119,7 @@ DataFromClient ( } n = read(fd, FDinfo[ServerFD].buffer, BUFFER_SIZE); - debug(4,(stderr, "read %d bytes from Client%s\n", n, ClientName(fd))); + debug(4,(stderr, "read %ld bytes from Client%s\n", n, ClientName(fd))); if (n < 0) { PrintTime(); @@ -1168,7 +1168,7 @@ DataFromServer ( enterprocedure("DataFromServer"); n = read(fd, (char *)FDinfo[ClientFD].buffer, BUFFER_SIZE); - debug(4,(stderr, "read %d bytes from Server%s\n", n, ClientName(fd))); + debug(4,(stderr, "read %ld bytes from Server%s\n", n, ClientName(fd))); if (n < 0) { PrintTime(); @@ -1202,8 +1202,6 @@ DataFromServer ( /* ************************************************************ */ -static int ON = 1 /* used in ioctl */ ; - void NewConnection ( FD fd) @@ -1229,6 +1227,7 @@ ConnectToClient ( #else struct sockaddr_in from; int len = sizeof (from); + int ON = 1 /* used in ioctl */ ; #endif enterprocedure("ConnectToClient"); diff --git a/server.c b/server.c index be5642b..d04c335 100644 --- a/server.c +++ b/server.c @@ -81,7 +81,7 @@ ReportFromClient( { if (ScopeEnabled) { PrintTime(); - fprintf(stdout, "Client%s --> %4d %s\n", + fprintf(stdout, "Client%s --> %4ld %s\n", ClientName(fd), n, (n == 1 ? "byte" : "bytes")); } } @@ -97,7 +97,7 @@ ReportFromServer ( if (Verbose > 0) { if (ScopeEnabled) { PrintTime(); - fprintf(stdout, "\t\t\t\t\t%4d %s <-- X11 Server%s\n", + fprintf(stdout, "\t\t\t\t\t%4ld %s <-- X11 Server%s\n", n, (n == 1 ? "byte" : "bytes"), ClientName(fd)); } } @@ -138,7 +138,7 @@ PrintTime(void) hsec += 100; sec -= 1; } - fprintf(stdout, "%2d.%02ld: ", sec, hsec); + fprintf(stdout, "%2ld.%02ld: ", sec, hsec); } /* ************************************************************ */ @@ -376,7 +376,7 @@ ProcessBuffer ( } /* end of while (NumberofSavedBytes + n >= NumberofBytesNeeded) */ if (Verbose > 3) - fprintf (stdout, "Have %d need %d\n", + fprintf (stdout, "Have %ld need %ld\n", CS[fd].NumberofSavedBytes + n, CS[fd].NumberofBytesNeeded); /* not enough bytes -- just save the new bytes for more later */ @@ -510,7 +510,7 @@ StartSetUpMessage ( CS[fd].ByteProcessing = FinishSetUpMessage; CS[fd].NumberofBytesNeeded = n + pad((long)namelength) + pad((long)datalength); - debug(8,(stderr, "need %d bytes to finish startup\n", + debug(8,(stderr, "need %ld bytes to finish startup\n", CS[fd].NumberofBytesNeeded - n)); StartStuff (fd); return(0); @@ -551,7 +551,7 @@ StartBigRequest ( CS[fd].ByteProcessing = FinishRequest; CS[fd].NumberofBytesNeeded = 4 * CS[fd].requestLen; - debug(8,(stderr, "need %d more bytes to finish request\n", + debug(8,(stderr, "need %ld more bytes to finish request\n", CS[fd].NumberofBytesNeeded - n)); StartStuff (fd); return(0); @@ -578,7 +578,7 @@ StartRequest ( CS[fd].requestLen = 1; CS[fd].ByteProcessing = FinishRequest; CS[fd].NumberofBytesNeeded = 4 * CS[fd].requestLen; - debug(8,(stderr, "need %d more bytes to finish request\n", + debug(8,(stderr, "need %ld more bytes to finish request\n", CS[fd].NumberofBytesNeeded - n)); } StartStuff (fd); @@ -648,7 +648,7 @@ StartSetUpReply ( replylength = IShort(&buf[6]); CS[fd].ByteProcessing = FinishSetUpReply; CS[fd].NumberofBytesNeeded = n + 4 * replylength; - debug(8,(stderr, "need %d bytes to finish startup reply\n", + debug(8,(stderr, "need %ld bytes to finish startup reply\n", CS[fd].NumberofBytesNeeded - n)); return(0); } @@ -720,7 +720,7 @@ ReplyPacket ( CS[fd].ByteProcessing = FinishReply; CS[fd].NumberofBytesNeeded = n + 4 * replylength; - debug(8,(stderr, "need %d bytes to finish reply\n", (4 * replylength))); + debug(8,(stderr, "need %ld bytes to finish reply\n", (4 * replylength))); return(0); } diff --git a/table11.c b/table11.c index e67b725..56fe988 100644 --- a/table11.c +++ b/table11.c @@ -140,7 +140,7 @@ GetValueRec ( if (value->key == key) return value; } - return 0; + return NULL; } void -- cgit v1.2.1