Commit a6e54017 authored by dscho's avatar dscho

clean ups

parent 8e455cad
...@@ -9,8 +9,9 @@ VNCSERVERLIB=-L. -lvncserver -L/usr/local/lib -lz -ljpeg ...@@ -9,8 +9,9 @@ VNCSERVERLIB=-L. -lvncserver -L/usr/local/lib -lz -ljpeg
# The code for 3 Bytes/Pixel is not very efficient! # The code for 3 Bytes/Pixel is not very efficient!
FLAG24 = -DALLOW24BPP FLAG24 = -DALLOW24BPP
CFLAGS=-g -Wall $(PTHREADDEF) $(FLAG24) $(INCLUDES) OPTFLAGS=-g # -Wall
#CFLAGS=-O2 -Wall #OPTFLAGS=-O2 -Wall
CFLAGS=$(OPTFLAGS) $(PTHREADDEF) $(FLAG24) $(INCLUDES)
RANLIB=ranlib RANLIB=ranlib
LIBS=$(LDFLAGS) $(VNCSERVERLIB) $(PTHREADLIB) LIBS=$(LDFLAGS) $(VNCSERVERLIB) $(PTHREADLIB)
......
...@@ -390,7 +390,7 @@ void defaultSetXCutText(char* text, int len, rfbClientPtr cl) ...@@ -390,7 +390,7 @@ void defaultSetXCutText(char* text, int len, rfbClientPtr cl)
/* TODO: add a nice VNC or RFB cursor */ /* TODO: add a nice VNC or RFB cursor */
#ifdef WIN32 #if defined(WIN32) || defined(sparc)
static rfbCursor myCursor = static rfbCursor myCursor =
{ {
"\000\102\044\030\044\102\000", "\000\102\044\030\044\102\000",
......
...@@ -401,7 +401,7 @@ rfbProcessClientProtocolVersion(cl) ...@@ -401,7 +401,7 @@ rfbProcessClientProtocolVersion(cl)
rfbClientPtr cl; rfbClientPtr cl;
{ {
rfbProtocolVersionMsg pv; rfbProtocolVersionMsg pv;
int n, major, minor; int n, major_, minor_;
char failureReason[256]; char failureReason[256];
if ((n = ReadExact(cl, pv, sz_rfbProtocolVersionMsg)) <= 0) { if ((n = ReadExact(cl, pv, sz_rfbProtocolVersionMsg)) <= 0) {
...@@ -414,25 +414,25 @@ rfbProcessClientProtocolVersion(cl) ...@@ -414,25 +414,25 @@ rfbProcessClientProtocolVersion(cl)
} }
pv[sz_rfbProtocolVersionMsg] = 0; 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"); rfbLog("rfbProcessClientProtocolVersion: not a valid RFB client\n");
rfbCloseClient(cl); rfbCloseClient(cl);
return; 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 */ /* Major version mismatch - send a ConnFailed message */
rfbLog("Major version mismatch\n"); rfbLog("Major version mismatch\n");
sprintf(failureReason, sprintf(failureReason,
"RFB protocol version mismatch - server %d.%d, client %d.%d", "RFB protocol version mismatch - server %d.%d, client %d.%d",
rfbProtocolMajorVersion,rfbProtocolMinorVersion,major,minor); rfbProtocolMajorVersion,rfbProtocolMinorVersion,major_,minor_);
rfbClientConnFailed(cl, failureReason); rfbClientConnFailed(cl, failureReason);
return; return;
} }
if (minor != rfbProtocolMinorVersion) { if (minor_ != rfbProtocolMinorVersion) {
/* Minor version mismatch - warn but try to continue */ /* Minor version mismatch - warn but try to continue */
rfbLog("Ignoring minor version mismatch\n"); rfbLog("Ignoring minor version mismatch\n");
} }
......
...@@ -81,7 +81,7 @@ sraSpanDestroy(sraSpan *span) { ...@@ -81,7 +81,7 @@ sraSpanDestroy(sraSpan *span) {
void void
sraSpanCheck(const sraSpan *span, const char *text) { sraSpanCheck(const sraSpan *span, const char *text) {
// Check the span is valid! /* Check the span is valid! */
if (span->start == span->end) { if (span->start == span->end) {
printf(text); printf(text);
printf(":%d-%d\n", span->start, span->end); printf(":%d-%d\n", span->start, span->end);
...@@ -172,8 +172,8 @@ sraSpanListMakeEmpty(sraSpanList *list) { ...@@ -172,8 +172,8 @@ sraSpanListMakeEmpty(sraSpanList *list) {
list->back._next = NULL; list->back._next = NULL;
} }
int sraMax(int a, int b) {return (a>b)?a:b;}; int sraMax(int a, int b) {return (a>b)?a:b;}
int sraMin(int a, int b) {return (a<b)?a:b;}; int sraMin(int a, int b) {return (a<b)?a:b;}
Bool Bool
sraSpanListEqual(const sraSpanList *s1, const sraSpanList *s2) { sraSpanListEqual(const sraSpanList *s1, const sraSpanList *s2) {
...@@ -288,11 +288,11 @@ sraSpanListOr(sraSpanList *dest, const sraSpanList *src) { ...@@ -288,11 +288,11 @@ sraSpanListOr(sraSpanList *dest, const sraSpanList *src) {
s_end = s_curr->end; s_end = s_curr->end;
while (s_curr != &(src->back)) { while (s_curr != &(src->back)) {
// - If we are at end of destination list OR /* - If we are at end of destination list OR
// If the new span comes before the next destination one If the new span comes before the next destination one */
if ((d_curr == &(dest->back)) || if ((d_curr == &(dest->back)) ||
(d_curr->start >= s_end)) { (d_curr->start >= s_end)) {
// - Add the span /* - Add the span */
sraSpanInsertBefore(sraSpanCreate(s_start, s_end, sraSpanInsertBefore(sraSpanCreate(s_start, s_end,
s_curr->subspan), s_curr->subspan),
d_curr); d_curr);
...@@ -303,11 +303,11 @@ sraSpanListOr(sraSpanList *dest, const sraSpanList *src) { ...@@ -303,11 +303,11 @@ sraSpanListOr(sraSpanList *dest, const sraSpanList *src) {
s_end = s_curr->end; s_end = s_curr->end;
} else { } else {
// - If the new span overlaps the existing one /* - If the new span overlaps the existing one */
if ((s_start < d_curr->end) && if ((s_start < d_curr->end) &&
(s_end > d_curr->start)) { (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) { if (s_start < d_curr->start) {
sraSpanInsertBefore(sraSpanCreate(s_start, sraSpanInsertBefore(sraSpanCreate(s_start,
d_curr->start, d_curr->start,
...@@ -316,7 +316,7 @@ sraSpanListOr(sraSpanList *dest, const sraSpanList *src) { ...@@ -316,7 +316,7 @@ sraSpanListOr(sraSpanList *dest, const sraSpanList *src) {
sraSpanMergePrevious(d_curr); sraSpanMergePrevious(d_curr);
} }
// Split the existing span if necessary /* Split the existing span if necessary */
if (s_end < d_curr->end) { if (s_end < d_curr->end) {
sraSpanInsertAfter(sraSpanCreate(s_end, sraSpanInsertAfter(sraSpanCreate(s_end,
d_curr->end, d_curr->end,
...@@ -332,16 +332,16 @@ sraSpanListOr(sraSpanList *dest, const sraSpanList *src) { ...@@ -332,16 +332,16 @@ sraSpanListOr(sraSpanList *dest, const sraSpanList *src) {
d_curr->start = s_start; d_curr->start = s_start;
} }
// Recursively OR subspans /* Recursively OR subspans */
sraSpanListOr(d_curr->subspan, s_curr->subspan); 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)) if (d_curr->_prev != &(dest->front))
sraSpanMergePrevious(d_curr); sraSpanMergePrevious(d_curr);
if (d_curr->_next != &(dest->back)) if (d_curr->_next != &(dest->back))
sraSpanMergeNext(d_curr); sraSpanMergeNext(d_curr);
// Move onto the next pair to compare /* Move onto the next pair to compare */
if (s_end > d_curr->end) { if (s_end > d_curr->end) {
s_start = d_curr->end; s_start = d_curr->end;
d_curr = d_curr->_next; d_curr = d_curr->_next;
...@@ -351,7 +351,7 @@ sraSpanListOr(sraSpanList *dest, const sraSpanList *src) { ...@@ -351,7 +351,7 @@ sraSpanListOr(sraSpanList *dest, const sraSpanList *src) {
s_end = s_curr->end; s_end = s_curr->end;
} }
} else { } else {
// - No overlap. Move to the next destination span /* - No overlap. Move to the next destination span */
d_curr = d_curr->_next; d_curr = d_curr->_next;
} }
} }
...@@ -375,13 +375,13 @@ sraSpanListAnd(sraSpanList *dest, const sraSpanList *src) { ...@@ -375,13 +375,13 @@ sraSpanListAnd(sraSpanList *dest, const sraSpanList *src) {
s_curr = src->front._next; s_curr = src->front._next;
while ((s_curr != &(src->back)) && (d_curr != &(dest->back))) { 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) { if (d_curr->start >= s_curr->end) {
s_curr = s_curr->_next; s_curr = s_curr->_next;
continue; 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) { if (d_curr->end <= s_curr->start) {
sraSpan *next = d_curr->_next; sraSpan *next = d_curr->_next;
sraSpanRemove(d_curr); sraSpanRemove(d_curr);
...@@ -390,13 +390,13 @@ sraSpanListAnd(sraSpanList *dest, const sraSpanList *src) { ...@@ -390,13 +390,13 @@ sraSpanListAnd(sraSpanList *dest, const sraSpanList *src) {
continue; 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) { 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; d_curr->start = s_curr->start;
} }
if (s_curr->end < d_curr->end) { 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, sraSpanInsertAfter(sraSpanCreate(s_curr->end,
d_curr->end, d_curr->end,
d_curr->subspan), d_curr->subspan),
...@@ -404,19 +404,19 @@ sraSpanListAnd(sraSpanList *dest, const sraSpanList *src) { ...@@ -404,19 +404,19 @@ sraSpanListAnd(sraSpanList *dest, const sraSpanList *src) {
d_curr->end = s_curr->end; 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)) { 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; sraSpan *next = d_curr->_next;
sraSpanRemove(d_curr); sraSpanRemove(d_curr);
sraSpanDestroy(d_curr); sraSpanDestroy(d_curr);
d_curr = next; d_curr = next;
} else { } else {
// Merge this span with previous or next? /* Merge this span with previous or next? */
if (d_curr->_prev != &(dest->front)) if (d_curr->_prev != &(dest->front))
sraSpanMergePrevious(d_curr); sraSpanMergePrevious(d_curr);
// - Move on to the next span /* - Move on to the next span */
d_next = d_curr; d_next = d_curr;
if (s_curr->end >= d_curr->end) { if (s_curr->end >= d_curr->end) {
d_next = d_curr->_next; d_next = d_curr->_next;
...@@ -455,19 +455,19 @@ sraSpanListSubtract(sraSpanList *dest, const sraSpanList *src) { ...@@ -455,19 +455,19 @@ sraSpanListSubtract(sraSpanList *dest, const sraSpanList *src) {
s_curr = src->front._next; s_curr = src->front._next;
while ((s_curr != &(src->back)) && (d_curr != &(dest->back))) { 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) { if (d_curr->start >= s_curr->end) {
s_curr = s_curr->_next; s_curr = s_curr->_next;
continue; 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) { if (d_curr->end <= s_curr->start) {
d_curr = d_curr->_next; d_curr = d_curr->_next;
continue; 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) { if (s_curr->start > d_curr->start) {
sraSpanInsertBefore(sraSpanCreate(d_curr->start, sraSpanInsertBefore(sraSpanCreate(d_curr->start,
s_curr->start, s_curr->start,
...@@ -483,21 +483,21 @@ sraSpanListSubtract(sraSpanList *dest, const sraSpanList *src) { ...@@ -483,21 +483,21 @@ sraSpanListSubtract(sraSpanList *dest, const sraSpanList *src) {
d_curr->end = s_curr->end; 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)) { 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; sraSpan *next = d_curr->_next;
sraSpanRemove(d_curr); sraSpanRemove(d_curr);
sraSpanDestroy(d_curr); sraSpanDestroy(d_curr);
d_curr = next; d_curr = next;
} else { } else {
// Merge this span with previous or next? /* Merge this span with previous or next? */
if (d_curr->_prev != &(dest->front)) if (d_curr->_prev != &(dest->front))
sraSpanMergePrevious(d_curr); sraSpanMergePrevious(d_curr);
if (d_curr->_next != &(dest->back)) if (d_curr->_next != &(dest->back))
sraSpanMergeNext(d_curr); sraSpanMergeNext(d_curr);
// - Move on to the next span /* - Move on to the next span */
if (s_curr->end > d_curr->end) { if (s_curr->end > d_curr->end) {
d_curr = d_curr->_next; d_curr = d_curr->_next;
} else { } else {
...@@ -595,7 +595,7 @@ sraRgnPopRect(sraRegion *rgn, sraRect *rect, unsigned long flags) { ...@@ -595,7 +595,7 @@ sraRgnPopRect(sraRegion *rgn, sraRect *rect, unsigned long flags) {
Bool right2left = flags & 2; Bool right2left = flags & 2;
Bool bottom2top = flags & 1; Bool bottom2top = flags & 1;
// - Pick correct order /* - Pick correct order */
if (bottom2top) { if (bottom2top) {
vcurr = ((sraSpanList*)rgn)->back._prev; vcurr = ((sraSpanList*)rgn)->back._prev;
vend = &(((sraSpanList*)rgn)->front); vend = &(((sraSpanList*)rgn)->front);
...@@ -608,7 +608,7 @@ sraRgnPopRect(sraRegion *rgn, sraRect *rect, unsigned long flags) { ...@@ -608,7 +608,7 @@ sraRgnPopRect(sraRegion *rgn, sraRect *rect, unsigned long flags) {
rect->y1 = vcurr->start; rect->y1 = vcurr->start;
rect->y2 = vcurr->end; rect->y2 = vcurr->end;
// - Pick correct order /* - Pick correct order */
if (right2left) { if (right2left) {
hcurr = vcurr->subspan->back._prev; hcurr = vcurr->subspan->back._prev;
hend = &(vcurr->subspan->front); hend = &(vcurr->subspan->front);
......
...@@ -12,7 +12,6 @@ typedef struct _rect { ...@@ -12,7 +12,6 @@ typedef struct _rect {
int y2; int y2;
} sraRect; } sraRect;
//struct sraRegion;
typedef struct sraRegion sraRegion; typedef struct sraRegion sraRegion;
/* -=- Region manipulation functions */ /* -=- Region manipulation functions */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment