Commit ff9fbd97 authored by dscho's avatar dscho

Tim's Changes

parent 22405c3d
...@@ -230,18 +230,18 @@ rfbCursorPtr rfbMakeXCursor(int width,int height,char* cursorString,char* maskSt ...@@ -230,18 +230,18 @@ rfbCursorPtr rfbMakeXCursor(int width,int height,char* cursorString,char* maskSt
/*cursor->backRed=cursor->backGreen=cursor->backBlue=0xffff;*/ /*cursor->backRed=cursor->backGreen=cursor->backBlue=0xffff;*/
cursor->foreRed=cursor->foreGreen=cursor->foreBlue=0xffff; cursor->foreRed=cursor->foreGreen=cursor->foreBlue=0xffff;
cursor->source = (char*)calloc(w,height); cursor->source = (unsigned char*)calloc(w,height);
for(j=0,cp=cursorString;j<height;j++) for(j=0,cp=cursorString;j<height;j++)
for(i=0,bit=0x80;i<width;i++,bit=(bit&1)?0x80:bit>>1,cp++) for(i=0,bit=0x80;i<width;i++,bit=(bit&1)?0x80:bit>>1,cp++)
if(*cp!=' ') cursor->source[j*w+i/8]|=bit; if(*cp!=' ') cursor->source[j*w+i/8]|=bit;
if(maskString) { if(maskString) {
cursor->mask = (char*)calloc(w,height); cursor->mask = (unsigned char*)calloc(w,height);
for(j=0,cp=maskString;j<height;j++) for(j=0,cp=maskString;j<height;j++)
for(i=0,bit=0x80;i<width;i++,bit=(bit&1)?0x80:bit>>1,cp++) for(i=0,bit=0x80;i<width;i++,bit=(bit&1)?0x80:bit>>1,cp++)
if(*cp!=' ') cursor->mask[j*w+i/8]|=bit; if(*cp!=' ') cursor->mask[j*w+i/8]|=bit;
} else } else
cursor->mask = rfbMakeMaskForXCursor(width,height,cursor->source); cursor->mask = (unsigned char*)rfbMakeMaskForXCursor(width,height,cursor->source);
return(cursor); return(cursor);
} }
...@@ -291,7 +291,7 @@ void MakeXCursorFromRichCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor) ...@@ -291,7 +291,7 @@ void MakeXCursorFromRichCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor)
char *back=(char*)&background; char *back=(char*)&background;
unsigned char bit; unsigned char bit;
cursor->source=(char*)calloc(w,cursor->height); cursor->source=(unsigned char*)calloc(w,cursor->height);
if(format->bigEndian) if(format->bigEndian)
back+=4-bpp; back+=4-bpp;
...@@ -310,10 +310,11 @@ void MakeRichCursorFromXCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor) ...@@ -310,10 +310,11 @@ void MakeRichCursorFromXCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor)
rfbPixelFormat* format=&rfbScreen->rfbServerFormat; rfbPixelFormat* format=&rfbScreen->rfbServerFormat;
int i,j,w=(cursor->width+7)/8,bpp=format->bitsPerPixel/8; int i,j,w=(cursor->width+7)/8,bpp=format->bitsPerPixel/8;
CARD32 background,foreground; CARD32 background,foreground;
char *cp,*back=(char*)&background,*fore=(char*)&foreground; char *back=(char*)&background,*fore=(char*)&foreground;
unsigned char *cp;
unsigned char bit; unsigned char bit;
cp=cursor->richSource=(char*)calloc(cursor->width*bpp,cursor->height); cp=cursor->richSource=(unsigned char*)calloc(cursor->width*bpp,cursor->height);
if(format->bigEndian) { if(format->bigEndian) {
back+=4-bpp; back+=4-bpp;
......
...@@ -34,7 +34,7 @@ int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font, ...@@ -34,7 +34,7 @@ int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
} }
void rfbDrawString(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font, void rfbDrawString(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
int x,int y,const unsigned char* string,Pixel colour) int x,int y,const char* string,Pixel colour)
{ {
while(*string) { while(*string) {
x+=rfbDrawChar(rfbScreen,font,x,y,*string,colour); x+=rfbDrawChar(rfbScreen,font,x,y,*string,colour);
...@@ -100,7 +100,7 @@ int rfbDrawCharWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font, ...@@ -100,7 +100,7 @@ int rfbDrawCharWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
} }
void rfbDrawStringWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font, void rfbDrawStringWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
int x,int y,const unsigned char* string, int x,int y,const char* string,
int x1,int y1,int x2,int y2, int x1,int y1,int x2,int y2,
Pixel colour,Pixel backColour) Pixel colour,Pixel backColour)
{ {
...@@ -111,7 +111,7 @@ void rfbDrawStringWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font, ...@@ -111,7 +111,7 @@ void rfbDrawStringWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
} }
} }
int rfbWidthOfString(rfbFontDataPtr font,const unsigned char* string) int rfbWidthOfString(rfbFontDataPtr font,const char* string)
{ {
int i=0; int i=0;
while(*string) { while(*string) {
...@@ -166,7 +166,7 @@ rfbFontDataPtr rfbLoadConsoleFont(char *filename) ...@@ -166,7 +166,7 @@ rfbFontDataPtr rfbLoadConsoleFont(char *filename)
if(!f) return(0); if(!f) return(0);
p=(rfbFontDataPtr)malloc(sizeof(rfbFontData)); p=(rfbFontDataPtr)malloc(sizeof(rfbFontData));
p->data=(char*)malloc(4096); p->data=(unsigned char*)malloc(4096);
if(1!=fread(p->data,4096,1,f)) { if(1!=fread(p->data,4096,1,f)) {
free(p->data); free(p->data);
free(p); free(p);
......
...@@ -113,7 +113,7 @@ httpCheckFds(rfbScreenInfoPtr rfbScreen) ...@@ -113,7 +113,7 @@ httpCheckFds(rfbScreenInfoPtr rfbScreen)
fd_set fds; fd_set fds;
struct timeval tv; struct timeval tv;
struct sockaddr_in addr; struct sockaddr_in addr;
int addrlen = sizeof(addr); socklen_t addrlen = sizeof(addr);
if (!rfbScreen->httpDir) if (!rfbScreen->httpDir)
return; return;
...@@ -196,7 +196,7 @@ static void ...@@ -196,7 +196,7 @@ static void
httpProcessInput(rfbScreenInfoPtr rfbScreen) httpProcessInput(rfbScreenInfoPtr rfbScreen)
{ {
struct sockaddr_in addr; struct sockaddr_in addr;
int addrlen = sizeof(addr); socklen_t addrlen = sizeof(addr);
char fullFname[256]; char fullFname[256];
char *fname; char *fname;
unsigned int maxFnameLen; unsigned int maxFnameLen;
......
...@@ -34,11 +34,21 @@ ...@@ -34,11 +34,21 @@
MUTEX(logMutex); MUTEX(logMutex);
int rfbEnableLogging=1;
/* we cannot compare to _LITTLE_ENDIAN, because some systems /* we cannot compare to _LITTLE_ENDIAN, because some systems
(as Solaris) assume little endian if _LITTLE_ENDIAN is (as Solaris) assume little endian if _LITTLE_ENDIAN is
defined, even if _BYTE_ORDER is not _LITTLE_ENDIAN */ defined, even if _BYTE_ORDER is not _LITTLE_ENDIAN */
char rfbEndianTest = (_BYTE_ORDER == 1234); char rfbEndianTest = (_BYTE_ORDER == 1234);
/* from rfbserver.c */
void rfbIncrClientRef(rfbClientPtr cl);
void rfbDecrClientRef(rfbClientPtr cl);
void rfbLogEnable(int enabled) {
rfbEnableLogging=enabled;
}
/* /*
* rfbLog prints a time-stamped message to the log file (stderr). * rfbLog prints a time-stamped message to the log file (stderr).
*/ */
...@@ -50,6 +60,9 @@ rfbLog(const char *format, ...) ...@@ -50,6 +60,9 @@ rfbLog(const char *format, ...)
char buf[256]; char buf[256];
time_t log_clock; time_t log_clock;
if(!rfbEnableLogging)
return;
LOCK(logMutex); LOCK(logMutex);
va_start(args, format); va_start(args, format);
...@@ -259,7 +272,9 @@ clientOutput(void *data) ...@@ -259,7 +272,9 @@ clientOutput(void *data)
UNLOCK(cl->updateMutex); UNLOCK(cl->updateMutex);
/* Now actually send the update. */ /* Now actually send the update. */
rfbIncrClientRef(cl);
rfbSendFramebufferUpdate(cl, updateRegion); rfbSendFramebufferUpdate(cl, updateRegion);
rfbDecrClientRef(cl);
sraRgnDestroy(updateRegion); sraRgnDestroy(updateRegion);
} }
...@@ -300,7 +315,7 @@ listenerRun(void *data) ...@@ -300,7 +315,7 @@ listenerRun(void *data)
int client_fd; int client_fd;
struct sockaddr_in peer; struct sockaddr_in peer;
rfbClientPtr cl; rfbClientPtr cl;
int len; socklen_t len;
len = sizeof(peer); len = sizeof(peer);
...@@ -397,7 +412,7 @@ rfbCursorPtr defaultGetCursorPtr(rfbClientPtr cl) ...@@ -397,7 +412,7 @@ rfbCursorPtr defaultGetCursorPtr(rfbClientPtr cl)
} }
/* response is cl->authChallenge vncEncrypted with passwd */ /* response is cl->authChallenge vncEncrypted with passwd */
Bool defaultPasswordCheck(rfbClientPtr cl,char* response,int len) Bool defaultPasswordCheck(rfbClientPtr cl,const char* response,int len)
{ {
int i; int i;
char *passwd=vncDecryptPasswdFromFile(cl->screen->rfbAuthPasswdData); char *passwd=vncDecryptPasswdFromFile(cl->screen->rfbAuthPasswdData);
...@@ -427,7 +442,7 @@ Bool defaultPasswordCheck(rfbClientPtr cl,char* response,int len) ...@@ -427,7 +442,7 @@ Bool defaultPasswordCheck(rfbClientPtr cl,char* response,int len)
/* for this method, rfbAuthPasswdData is really a pointer to an array /* for this method, rfbAuthPasswdData is really a pointer to an array
of char*'s, where the last pointer is 0. */ of char*'s, where the last pointer is 0. */
Bool rfbCheckPasswordByList(rfbClientPtr cl,char* response,int len) Bool rfbCheckPasswordByList(rfbClientPtr cl,const char* response,int len)
{ {
char **passwds; char **passwds;
......
...@@ -47,6 +47,9 @@ typedef unsigned long KeySym; ...@@ -47,6 +47,9 @@ typedef unsigned long KeySym;
#define SIGNED signed #define SIGNED signed
/* for some strange reason, "typedef signed char Bool;" yields a four byte /* for some strange reason, "typedef signed char Bool;" yields a four byte
signed int on IRIX, but only for rfbserver.o!!! */ signed int on IRIX, but only for rfbserver.o!!! */
#ifdef Bool
#undef Bool
#endif
#define Bool signed char #define Bool signed char
#undef FALSE #undef FALSE
#define FALSE 0 #define FALSE 0
...@@ -179,7 +182,7 @@ typedef void (*PtrAddEventProcPtr) (int buttonMask, int x, int y, struct _rfbCli ...@@ -179,7 +182,7 @@ typedef void (*PtrAddEventProcPtr) (int buttonMask, int x, int y, struct _rfbCli
typedef void (*SetXCutTextProcPtr) (char* str,int len, struct _rfbClientRec* cl); typedef void (*SetXCutTextProcPtr) (char* str,int len, struct _rfbClientRec* cl);
typedef struct rfbCursor* (*GetCursorProcPtr) (struct _rfbClientRec* pScreen); typedef struct rfbCursor* (*GetCursorProcPtr) (struct _rfbClientRec* pScreen);
typedef Bool (*SetTranslateFunctionProcPtr)(struct _rfbClientRec* cl); typedef Bool (*SetTranslateFunctionProcPtr)(struct _rfbClientRec* cl);
typedef Bool (*PasswordCheckProcPtr)(struct _rfbClientRec* cl,char* encryptedPassWord,int len); typedef Bool (*PasswordCheckProcPtr)(struct _rfbClientRec* cl,const char* encryptedPassWord,int len);
typedef enum rfbNewClientAction (*NewClientHookPtr)(struct _rfbClientRec* cl); typedef enum rfbNewClientAction (*NewClientHookPtr)(struct _rfbClientRec* cl);
typedef void (*DisplayHookPtr)(struct _rfbClientRec* cl); typedef void (*DisplayHookPtr)(struct _rfbClientRec* cl);
...@@ -261,7 +264,7 @@ typedef struct _rfbScreenInfo ...@@ -261,7 +264,7 @@ typedef struct _rfbScreenInfo
rfbPixelFormat rfbServerFormat; rfbPixelFormat rfbServerFormat;
rfbColourMap colourMap; /* set this if rfbServerFormat.trueColour==FALSE */ rfbColourMap colourMap; /* set this if rfbServerFormat.trueColour==FALSE */
char* desktopName; const char* desktopName;
char rfbThisHost[255]; char rfbThisHost[255];
Bool autoPort; Bool autoPort;
...@@ -560,7 +563,8 @@ extern void rfbInitSockets(rfbScreenInfoPtr rfbScreen); ...@@ -560,7 +563,8 @@ extern void rfbInitSockets(rfbScreenInfoPtr rfbScreen);
extern void rfbDisconnectUDPSock(rfbScreenInfoPtr rfbScreen); extern void rfbDisconnectUDPSock(rfbScreenInfoPtr rfbScreen);
extern void rfbCloseClient(rfbClientPtr cl); extern void rfbCloseClient(rfbClientPtr cl);
extern int ReadExact(rfbClientPtr cl, char *buf, int len); extern int ReadExact(rfbClientPtr cl, char *buf, int len);
extern int WriteExact(rfbClientPtr cl, char *buf, int len); extern int ReadExactTimeout(rfbClientPtr cl, char *buf, int len,int timeout);
extern int WriteExact(rfbClientPtr cl, const char *buf, int len);
extern void rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec); extern void rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec);
extern int rfbConnect(rfbScreenInfoPtr rfbScreen, char* host, int port); extern int rfbConnect(rfbScreenInfoPtr rfbScreen, char* host, int port);
extern int ConnectToTcpAddr(char* host, int port); extern int ConnectToTcpAddr(char* host, int port);
...@@ -623,8 +627,8 @@ extern void rfbSetClientColourMaps(rfbScreenInfoPtr rfbScreen, int firstColour, ...@@ -623,8 +627,8 @@ extern void rfbSetClientColourMaps(rfbScreenInfoPtr rfbScreen, int firstColour,
extern int httpPort; extern int httpPort;
extern char *httpDir; extern char *httpDir;
extern void httpInitSockets(); extern void httpInitSockets(rfbScreenInfoPtr rfbScreen);
extern void httpCheckFds(); extern void httpCheckFds(rfbScreenInfoPtr rfbScreen);
...@@ -722,11 +726,11 @@ typedef struct rfbFontData { ...@@ -722,11 +726,11 @@ typedef struct rfbFontData {
} rfbFontData,* rfbFontDataPtr; } rfbFontData,* rfbFontDataPtr;
int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,unsigned char c,Pixel colour); int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,unsigned char c,Pixel colour);
void rfbDrawString(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,const unsigned char* string,Pixel colour); void rfbDrawString(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,const char* string,Pixel colour);
/* if colour==backColour, background is transparent */ /* if colour==backColour, background is transparent */
int rfbDrawCharWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,unsigned char c,int x1,int y1,int x2,int y2,Pixel colour,Pixel backColour); int rfbDrawCharWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,unsigned char c,int x1,int y1,int x2,int y2,Pixel colour,Pixel backColour);
void rfbDrawStringWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,const unsigned char* string,int x1,int y1,int x2,int y2,Pixel colour,Pixel backColour); void rfbDrawStringWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,const char* string,int x1,int y1,int x2,int y2,Pixel colour,Pixel backColour);
int rfbWidthOfString(rfbFontDataPtr font,const unsigned char* string); int rfbWidthOfString(rfbFontDataPtr font,const char* string);
int rfbWidthOfChar(rfbFontDataPtr font,unsigned char c); int rfbWidthOfChar(rfbFontDataPtr font,unsigned char c);
void rfbFontBBox(rfbFontDataPtr font,unsigned char c,int* x1,int* y1,int* x2,int* y2); void rfbFontBBox(rfbFontDataPtr font,unsigned char c,int* x1,int* y1,int* x2,int* y2);
/* this returns the smallest box enclosing any character of font. */ /* this returns the smallest box enclosing any character of font. */
...@@ -759,13 +763,14 @@ extern int rfbSelectBox(rfbScreenInfoPtr rfbScreen, ...@@ -759,13 +763,14 @@ extern int rfbSelectBox(rfbScreenInfoPtr rfbScreen,
/* cargs.c */ /* cargs.c */
extern void rfbUsage(); extern void rfbUsage(void);
extern void rfbPurgeArguments(int* argc,int* position,int count,char *argv[]); extern void rfbPurgeArguments(int* argc,int* position,int count,char *argv[]);
extern void rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[]); extern void rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[]);
extern void rfbProcessSizeArguments(int* width,int* height,int* bpp,int* argc, char *argv[]); extern void rfbProcessSizeArguments(int* width,int* height,int* bpp,int* argc, char *argv[]);
/* main.c */ /* main.c */
extern void rfbLogEnable(int enabled);
extern void rfbLog(const char *format, ...); extern void rfbLog(const char *format, ...);
extern void rfbLogPerror(const char *str); extern void rfbLogPerror(const char *str);
...@@ -781,7 +786,7 @@ void doNothingWithClient(rfbClientPtr cl); ...@@ -781,7 +786,7 @@ void doNothingWithClient(rfbClientPtr cl);
enum rfbNewClientAction defaultNewClientHook(rfbClientPtr cl); enum rfbNewClientAction defaultNewClientHook(rfbClientPtr cl);
/* to check against plain passwords */ /* to check against plain passwords */
Bool rfbCheckPasswordByList(rfbClientPtr cl,char* response,int len); Bool rfbCheckPasswordByList(rfbClientPtr cl,const char* response,int len);
/* functions to make a vnc server */ /* functions to make a vnc server */
extern rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv, extern rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
......
...@@ -71,6 +71,9 @@ void rfbDecrClientRef(rfbClientPtr cl) ...@@ -71,6 +71,9 @@ void rfbDecrClientRef(rfbClientPtr cl)
TSIGNAL(cl->deleteCond); TSIGNAL(cl->deleteCond);
UNLOCK(cl->refCountMutex); UNLOCK(cl->refCountMutex);
} }
#else
void rfbIncrClientRef(rfbClientPtr cl) {}
void rfbDecrClientRef(rfbClientPtr cl) {}
#endif #endif
MUTEX(rfbClientListMutex); MUTEX(rfbClientListMutex);
...@@ -190,7 +193,7 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP) ...@@ -190,7 +193,7 @@ rfbNewTCPOrUDPClient(rfbScreen,sock,isUDP)
rfbClientIteratorPtr iterator; rfbClientIteratorPtr iterator;
rfbClientPtr cl,cl_; rfbClientPtr cl,cl_;
struct sockaddr_in addr; struct sockaddr_in addr;
int addrlen = sizeof(struct sockaddr_in); socklen_t addrlen = sizeof(struct sockaddr_in);
int i; int i;
cl = (rfbClientPtr)calloc(sizeof(rfbClientRec),1); cl = (rfbClientPtr)calloc(sizeof(rfbClientRec),1);
...@@ -529,7 +532,7 @@ rfbProcessClientInitMessage(cl) ...@@ -529,7 +532,7 @@ rfbProcessClientInitMessage(cl)
si->format.blueMax = Swap16IfLE(si->format.blueMax); si->format.blueMax = Swap16IfLE(si->format.blueMax);
if (strlen(cl->screen->desktopName) > 128) /* sanity check on desktop name len */ if (strlen(cl->screen->desktopName) > 128) /* sanity check on desktop name len */
cl->screen->desktopName[128] = 0; ((char*)cl->screen->desktopName)[128] = 0;
strcpy(buf + sz_rfbServerInitMsg, cl->screen->desktopName); strcpy(buf + sz_rfbServerInitMsg, cl->screen->desktopName);
len = strlen(buf + sz_rfbServerInitMsg); len = strlen(buf + sz_rfbServerInitMsg);
......
...@@ -180,7 +180,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec) ...@@ -180,7 +180,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
fd_set fds; fd_set fds;
struct timeval tv; struct timeval tv;
struct sockaddr_in addr; struct sockaddr_in addr;
int addrlen = sizeof(addr); socklen_t addrlen = sizeof(addr);
char buf[6]; char buf[6];
const int one = 1; const int one = 1;
int sock; int sock;
...@@ -311,6 +311,7 @@ rfbCloseClient(cl) ...@@ -311,6 +311,7 @@ rfbCloseClient(cl)
LOCK(cl->updateMutex); LOCK(cl->updateMutex);
if (cl->sock != -1) { if (cl->sock != -1) {
FD_CLR(cl->sock,&(cl->screen->allFds)); FD_CLR(cl->sock,&(cl->screen->allFds));
shutdown(cl->sock,SHUT_RDWR);
close(cl->sock); close(cl->sock);
cl->sock = -1; cl->sock = -1;
} }
...@@ -369,10 +370,7 @@ rfbConnect(rfbScreen, host, port) ...@@ -369,10 +370,7 @@ rfbConnect(rfbScreen, host, port)
*/ */
int int
ReadExact(cl, buf, len) ReadExactTimeout(rfbClientPtr cl, char* buf, int len, int timeout)
rfbClientPtr cl;
char *buf;
int len;
{ {
int sock = cl->sock; int sock = cl->sock;
int n; int n;
...@@ -401,8 +399,8 @@ ReadExact(cl, buf, len) ...@@ -401,8 +399,8 @@ ReadExact(cl, buf, len)
FD_ZERO(&fds); FD_ZERO(&fds);
FD_SET(sock, &fds); FD_SET(sock, &fds);
tv.tv_sec = rfbMaxClientWait / 1000; tv.tv_sec = timeout / 1000;
tv.tv_usec = (rfbMaxClientWait % 1000) * 1000; tv.tv_usec = (timeout % 1000) * 1000;
n = select(sock+1, &fds, NULL, &fds, &tv); n = select(sock+1, &fds, NULL, &fds, &tv);
if (n < 0) { if (n < 0) {
rfbLogPerror("ReadExact: select"); rfbLogPerror("ReadExact: select");
...@@ -417,7 +415,10 @@ ReadExact(cl, buf, len) ...@@ -417,7 +415,10 @@ ReadExact(cl, buf, len)
return 1; return 1;
} }
int ReadExact(rfbClientPtr cl,char* buf,int len)
{
return(ReadExactTimeout(cl,buf,len,rfbMaxClientWait));
}
/* /*
* WriteExact writes an exact number of bytes to a client. Returns 1 if * WriteExact writes an exact number of bytes to a client. Returns 1 if
...@@ -428,7 +429,7 @@ ReadExact(cl, buf, len) ...@@ -428,7 +429,7 @@ ReadExact(cl, buf, len)
int int
WriteExact(cl, buf, len) WriteExact(cl, buf, len)
rfbClientPtr cl; rfbClientPtr cl;
char *buf; const char *buf;
int len; int len;
{ {
int sock = cl->sock; int sock = cl->sock;
...@@ -535,7 +536,7 @@ ConnectToTcpAddr(host, port) ...@@ -535,7 +536,7 @@ ConnectToTcpAddr(host, port)
addr.sin_family = AF_INET; addr.sin_family = AF_INET;
addr.sin_port = htons(port); addr.sin_port = htons(port);
if ((addr.sin_addr.s_addr = inet_addr(host)) == -1) if ((addr.sin_addr.s_addr = inet_addr(host)) == INADDR_NONE)
{ {
if (!(hp = gethostbyname(host))) { if (!(hp = gethostbyname(host))) {
errno = EINVAL; errno = EINVAL;
......
...@@ -172,9 +172,6 @@ sraSpanListMakeEmpty(sraSpanList *list) { ...@@ -172,9 +172,6 @@ sraSpanListMakeEmpty(sraSpanList *list) {
list->back._next = NULL; list->back._next = NULL;
} }
int sraMax(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) {
sraSpan *sp1, *sp2; sraSpan *sp1, *sp2;
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "rfb.h" #include "rfb.h"
static char* encNames[] = { static const char* encNames[] = {
"raw", "copyRect", "RRE", "[encoding 3]", "CoRRE", "hextile", "raw", "copyRect", "RRE", "[encoding 3]", "CoRRE", "hextile",
"zlib", "tight", "[encoding 8]", "[encoding 9]" "zlib", "tight", "[encoding 8]", "[encoding 9]"
}; };
......
...@@ -34,7 +34,7 @@ rfbInitColourMapSingleTable24(char **table, rfbPixelFormat *in, ...@@ -34,7 +34,7 @@ rfbInitColourMapSingleTable24(char **table, rfbPixelFormat *in,
CARD32 i, r, g, b, outValue; CARD32 i, r, g, b, outValue;
CARD8 *t; CARD8 *t;
CARD8 c; CARD8 c;
int nEntries = 1 << in->bitsPerPixel; unsigned int nEntries = 1 << in->bitsPerPixel;
int shift = colourMap->is16?16:8; int shift = colourMap->is16?16:8;
if (*table) free(*table); if (*table) free(*table);
......
...@@ -451,7 +451,7 @@ CheckSolidTile(cl, x, y, w, h, colorPtr, needSameColor) ...@@ -451,7 +451,7 @@ CheckSolidTile(cl, x, y, w, h, colorPtr, needSameColor)
static Bool \ static Bool \
CheckSolidTile##bpp(cl, x, y, w, h, colorPtr, needSameColor) \ CheckSolidTile##bpp(cl, x, y, w, h, colorPtr, needSameColor) \
rfbClientPtr cl; \ rfbClientPtr cl; \
int x, y; \ int x, y, w, h; \
CARD32 *colorPtr; \ CARD32 *colorPtr; \
Bool needSameColor; \ Bool needSameColor; \
{ \ { \
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "sraRegion.h" #include "sraRegion.h"
static void PrintPixelFormat(rfbPixelFormat *pf); static void PrintPixelFormat(rfbPixelFormat *pf);
static Bool rfbSetClientColourMapBGR233(); static Bool rfbSetClientColourMapBGR233(rfbClientPtr cl);
Bool rfbEconomicTranslate = FALSE; Bool rfbEconomicTranslate = FALSE;
...@@ -38,7 +38,7 @@ Bool rfbEconomicTranslate = FALSE; ...@@ -38,7 +38,7 @@ Bool rfbEconomicTranslate = FALSE;
*/ */
static const rfbPixelFormat BGR233Format = { static const rfbPixelFormat BGR233Format = {
8, 8, 0, 1, 7, 7, 3, 0, 3, 6 8, 8, 0, 1, 7, 7, 3, 0, 3, 6, 0, 0
}; };
......
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