From a6e540172b43c3eb3aee87250ceacbd63d227a14 Mon Sep 17 00:00:00 2001 From: dscho Date: Thu, 25 Oct 2001 11:34:25 +0000 Subject: [PATCH] clean ups --- Makefile | 5 +++-- main.c | 2 +- rfbserver.c | 12 +++++------ sraRegion.c | 62 ++++++++++++++++++++++++++--------------------------- sraRegion.h | 1 - 5 files changed, 41 insertions(+), 41 deletions(-) diff --git a/Makefile b/Makefile index 26b88b1..9227e99 100644 --- a/Makefile +++ b/Makefile @@ -9,8 +9,9 @@ VNCSERVERLIB=-L. -lvncserver -L/usr/local/lib -lz -ljpeg # The code for 3 Bytes/Pixel is not very efficient! FLAG24 = -DALLOW24BPP -CFLAGS=-g -Wall $(PTHREADDEF) $(FLAG24) $(INCLUDES) -#CFLAGS=-O2 -Wall +OPTFLAGS=-g # -Wall +#OPTFLAGS=-O2 -Wall +CFLAGS=$(OPTFLAGS) $(PTHREADDEF) $(FLAG24) $(INCLUDES) RANLIB=ranlib LIBS=$(LDFLAGS) $(VNCSERVERLIB) $(PTHREADLIB) diff --git a/main.c b/main.c index 84dfde6..bd0f585 100644 --- a/main.c +++ b/main.c @@ -390,7 +390,7 @@ void defaultSetXCutText(char* text, int len, rfbClientPtr cl) /* TODO: add a nice VNC or RFB cursor */ -#ifdef WIN32 +#if defined(WIN32) || defined(sparc) static rfbCursor myCursor = { "\000\102\044\030\044\102\000", diff --git a/rfbserver.c b/rfbserver.c index a4decae..48c6e66 100644 --- a/rfbserver.c +++ b/rfbserver.c @@ -401,7 +401,7 @@ rfbProcessClientProtocolVersion(cl) rfbClientPtr cl; { rfbProtocolVersionMsg pv; - int n, major, minor; + int n, major_, minor_; char failureReason[256]; if ((n = ReadExact(cl, pv, sz_rfbProtocolVersionMsg)) <= 0) { @@ -414,25 +414,25 @@ rfbProcessClientProtocolVersion(cl) } pv[sz_rfbProtocolVersionMsg] = 0; - if (sscanf(pv,rfbProtocolVersionFormat,&major,&minor) != 2) { + if (sscanf(pv,rfbProtocolVersionFormat,&major_,&minor_) != 2) { rfbLog("rfbProcessClientProtocolVersion: not a valid RFB client\n"); rfbCloseClient(cl); return; } - rfbLog("Protocol version %d.%d\n", major, minor); + rfbLog("Protocol version %d.%d\n", major_, minor_); - if (major != rfbProtocolMajorVersion) { + if (major_ != rfbProtocolMajorVersion) { /* Major version mismatch - send a ConnFailed message */ rfbLog("Major version mismatch\n"); sprintf(failureReason, "RFB protocol version mismatch - server %d.%d, client %d.%d", - rfbProtocolMajorVersion,rfbProtocolMinorVersion,major,minor); + rfbProtocolMajorVersion,rfbProtocolMinorVersion,major_,minor_); rfbClientConnFailed(cl, failureReason); return; } - if (minor != rfbProtocolMinorVersion) { + if (minor_ != rfbProtocolMinorVersion) { /* Minor version mismatch - warn but try to continue */ rfbLog("Ignoring minor version mismatch\n"); } diff --git a/sraRegion.c b/sraRegion.c index a70d521..5f5f2d6 100755 --- a/sraRegion.c +++ b/sraRegion.c @@ -81,7 +81,7 @@ sraSpanDestroy(sraSpan *span) { void sraSpanCheck(const sraSpan *span, const char *text) { - // Check the span is valid! + /* Check the span is valid! */ if (span->start == span->end) { printf(text); printf(":%d-%d\n", span->start, span->end); @@ -172,8 +172,8 @@ sraSpanListMakeEmpty(sraSpanList *list) { list->back._next = NULL; } -int sraMax(int a, int b) {return (a>b)?a:b;}; -int sraMin(int a, int b) {return (ab)?a:b;} +int sraMin(int a, int b) {return (aend; while (s_curr != &(src->back)) { - // - If we are at end of destination list OR - // If the new span comes before the next destination one + /* - If we are at end of destination list OR + If the new span comes before the next destination one */ if ((d_curr == &(dest->back)) || (d_curr->start >= s_end)) { - // - Add the span + /* - Add the span */ sraSpanInsertBefore(sraSpanCreate(s_start, s_end, s_curr->subspan), d_curr); @@ -303,11 +303,11 @@ sraSpanListOr(sraSpanList *dest, const sraSpanList *src) { s_end = s_curr->end; } else { - // - If the new span overlaps the existing one + /* - If the new span overlaps the existing one */ if ((s_start < d_curr->end) && (s_end > d_curr->start)) { - // - Insert new span before the existing destination one? + /* - Insert new span before the existing destination one? */ if (s_start < d_curr->start) { sraSpanInsertBefore(sraSpanCreate(s_start, d_curr->start, @@ -316,7 +316,7 @@ sraSpanListOr(sraSpanList *dest, const sraSpanList *src) { sraSpanMergePrevious(d_curr); } - // Split the existing span if necessary + /* Split the existing span if necessary */ if (s_end < d_curr->end) { sraSpanInsertAfter(sraSpanCreate(s_end, d_curr->end, @@ -332,16 +332,16 @@ sraSpanListOr(sraSpanList *dest, const sraSpanList *src) { d_curr->start = s_start; } - // Recursively OR subspans + /* Recursively OR subspans */ sraSpanListOr(d_curr->subspan, s_curr->subspan); - // Merge this span with previous or next? + /* Merge this span with previous or next? */ if (d_curr->_prev != &(dest->front)) sraSpanMergePrevious(d_curr); if (d_curr->_next != &(dest->back)) sraSpanMergeNext(d_curr); - // Move onto the next pair to compare + /* Move onto the next pair to compare */ if (s_end > d_curr->end) { s_start = d_curr->end; d_curr = d_curr->_next; @@ -351,7 +351,7 @@ sraSpanListOr(sraSpanList *dest, const sraSpanList *src) { s_end = s_curr->end; } } else { - // - No overlap. Move to the next destination span + /* - No overlap. Move to the next destination span */ d_curr = d_curr->_next; } } @@ -375,13 +375,13 @@ sraSpanListAnd(sraSpanList *dest, const sraSpanList *src) { s_curr = src->front._next; while ((s_curr != &(src->back)) && (d_curr != &(dest->back))) { - // - If we haven't reached a destination span yet then move on + /* - If we haven't reached a destination span yet then move on */ if (d_curr->start >= s_curr->end) { s_curr = s_curr->_next; continue; } - // - If we are beyond the current destination span then remove it + /* - If we are beyond the current destination span then remove it */ if (d_curr->end <= s_curr->start) { sraSpan *next = d_curr->_next; sraSpanRemove(d_curr); @@ -390,13 +390,13 @@ sraSpanListAnd(sraSpanList *dest, const sraSpanList *src) { continue; } - // - If we partially overlap a span then split it up or remove bits + /* - If we partially overlap a span then split it up or remove bits */ if (s_curr->start > d_curr->start) { - // - The top bit of the span does not match + /* - The top bit of the span does not match */ d_curr->start = s_curr->start; } if (s_curr->end < d_curr->end) { - // - The end of the span does not match + /* - The end of the span does not match */ sraSpanInsertAfter(sraSpanCreate(s_curr->end, d_curr->end, d_curr->subspan), @@ -404,19 +404,19 @@ sraSpanListAnd(sraSpanList *dest, const sraSpanList *src) { d_curr->end = s_curr->end; } - // - Now recursively process the affected span + /* - Now recursively process the affected span */ if (!sraSpanListAnd(d_curr->subspan, s_curr->subspan)) { - // - The destination subspan is now empty, so we should remove it + /* - The destination subspan is now empty, so we should remove it */ sraSpan *next = d_curr->_next; sraSpanRemove(d_curr); sraSpanDestroy(d_curr); d_curr = next; } else { - // Merge this span with previous or next? + /* Merge this span with previous or next? */ if (d_curr->_prev != &(dest->front)) sraSpanMergePrevious(d_curr); - // - Move on to the next span + /* - Move on to the next span */ d_next = d_curr; if (s_curr->end >= d_curr->end) { d_next = d_curr->_next; @@ -455,19 +455,19 @@ sraSpanListSubtract(sraSpanList *dest, const sraSpanList *src) { s_curr = src->front._next; while ((s_curr != &(src->back)) && (d_curr != &(dest->back))) { - // - If we haven't reached a destination span yet then move on + /* - If we haven't reached a destination span yet then move on */ if (d_curr->start >= s_curr->end) { s_curr = s_curr->_next; continue; } - // - If we are beyond the current destination span then skip it + /* - If we are beyond the current destination span then skip it */ if (d_curr->end <= s_curr->start) { d_curr = d_curr->_next; continue; } - // - If we partially overlap the current span then split it up + /* - If we partially overlap the current span then split it up */ if (s_curr->start > d_curr->start) { sraSpanInsertBefore(sraSpanCreate(d_curr->start, s_curr->start, @@ -483,21 +483,21 @@ sraSpanListSubtract(sraSpanList *dest, const sraSpanList *src) { d_curr->end = s_curr->end; } - // - Now recursively process the affected span + /* - Now recursively process the affected span */ if ((!d_curr->subspan) || !sraSpanListSubtract(d_curr->subspan, s_curr->subspan)) { - // - The destination subspan is now empty, so we should remove it + /* - The destination subspan is now empty, so we should remove it */ sraSpan *next = d_curr->_next; sraSpanRemove(d_curr); sraSpanDestroy(d_curr); d_curr = next; } else { - // Merge this span with previous or next? + /* Merge this span with previous or next? */ if (d_curr->_prev != &(dest->front)) sraSpanMergePrevious(d_curr); if (d_curr->_next != &(dest->back)) sraSpanMergeNext(d_curr); - // - Move on to the next span + /* - Move on to the next span */ if (s_curr->end > d_curr->end) { d_curr = d_curr->_next; } else { @@ -595,7 +595,7 @@ sraRgnPopRect(sraRegion *rgn, sraRect *rect, unsigned long flags) { Bool right2left = flags & 2; Bool bottom2top = flags & 1; - // - Pick correct order + /* - Pick correct order */ if (bottom2top) { vcurr = ((sraSpanList*)rgn)->back._prev; vend = &(((sraSpanList*)rgn)->front); @@ -608,7 +608,7 @@ sraRgnPopRect(sraRegion *rgn, sraRect *rect, unsigned long flags) { rect->y1 = vcurr->start; rect->y2 = vcurr->end; - // - Pick correct order + /* - Pick correct order */ if (right2left) { hcurr = vcurr->subspan->back._prev; hend = &(vcurr->subspan->front); diff --git a/sraRegion.h b/sraRegion.h index d0348cc..7606555 100755 --- a/sraRegion.h +++ b/sraRegion.h @@ -12,7 +12,6 @@ typedef struct _rect { int y2; } sraRect; -//struct sraRegion; typedef struct sraRegion sraRegion; /* -=- Region manipulation functions */