summaryrefslogtreecommitdiffstats
path: root/libvncclient/rfbproto.c
diff options
context:
space:
mode:
authordscho <dscho>2004-10-16 02:46:52 +0000
committerdscho <dscho>2004-10-16 02:46:52 +0000
commitb583cf5347fbd3f1d45e068a970e9cc207337e78 (patch)
treec4f0e9dd5fab0adaa233442fd51b33b545959a01 /libvncclient/rfbproto.c
parent8715a8ab4243f667e38ad315d98fc38588946362 (diff)
downloadlibtdevnc-b583cf5347fbd3f1d45e068a970e9cc207337e78.tar.gz
libtdevnc-b583cf5347fbd3f1d45e068a970e9cc207337e78.zip
move read buffer to rfbClient structure (thread safety); make rfbClientLog
overrideable
Diffstat (limited to 'libvncclient/rfbproto.c')
-rw-r--r--libvncclient/rfbproto.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c
index cc4da85..0f12407 100644
--- a/libvncclient/rfbproto.c
+++ b/libvncclient/rfbproto.c
@@ -43,7 +43,7 @@
rfbBool rfbEnableClientLogging=TRUE;
void
-rfbClientLog(const char *format, ...)
+rfbDefaultClientLog(const char *format, ...)
{
va_list args;
char buf[256];
@@ -64,6 +64,9 @@ rfbClientLog(const char *format, ...)
va_end(args);
}
+rfbClientLogProc rfbClientLog=rfbDefaultClientLog;
+rfbClientLogProc rfbClientErr=rfbDefaultClientLog;
+
void FillRectangle(rfbClient* client, int x, int y, int w, int h, uint32_t colour) {
int i,j;
@@ -271,13 +274,14 @@ InitialiseRFBConnection(rfbClient* client)
errorMessageOnReadFailure = FALSE;
if (!ReadFromRFBServer(client, pv, sz_rfbProtocolVersionMsg)) return FALSE;
+ pv[sz_rfbProtocolVersionMsg]=0;
errorMessageOnReadFailure = TRUE;
pv[sz_rfbProtocolVersionMsg] = 0;
if (sscanf(pv,rfbProtocolVersionFormat,&major,&minor) != 2) {
- rfbClientLog("Not a valid VNC server\n");
+ rfbClientLog("Not a valid VNC server (%s)\n",pv);
return FALSE;
}
@@ -769,7 +773,7 @@ HandleRFBServerMessage(rfbClient* client)
int y=rect.r.y, h=rect.r.h;
bytesPerLine = rect.r.w * client->format.bitsPerPixel / 8;
- linesToRead = BUFFER_SIZE / bytesPerLine;
+ linesToRead = RFB_BUFFER_SIZE / bytesPerLine;
while (h > 0) {
if (linesToRead > h)