From 1afaa3f9485f31e4640f2b736afd24d8df365c03 Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Sat, 12 Mar 2011 19:11:02 +0100 Subject: [PATCH 01/12] Update NEWS for 0.9.8 release. --- NEWS | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/NEWS b/NEWS index 58f9285..ca64d1d 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,53 @@ +0.9.8 + - Overall changes: + * Automagically generated API documentation using doxygen. + * Fixed Mingw32 cross compilation. + * Fixed CMake build system. + + - LibVNCServer/LibVNCClient: + * All files used by _both_ LibVNCServer and LibVNCClient were put into + a 'common' directory, reducing code duplication. + * Implemented xvp VNC extension. + * Updated minilzo library used for Ultra encoding to ver 2.04. + According to the minilzo README, this brings a significant + speedup on 64-bit architechtures. + + - LibVNCServer: + * Thread safety for ZRLE, Zlib, Tight, RRE, CoRRE and Ultra encodings. + This makes all VNC encodings safe to use with a multithreaded server. + * A DisplayFinishedHook for LibVNCServer. If set, this hook gets called + just before rfbSendFrameBufferUpdate() returns. + * Fix for tight security type for RFB 3.8 in TightVNC file transfer + (Debian Bug #517422). + + - LibVNCClient: + * Unix sockets support. + * Anonymous TLS security type support. + * VeNCrypt security type support. + * MSLogon security type support. + * ARD (Apple Remote Desktop) security type support. + * UltraVNC Repeater support. + * A new FinishedFrameBufferUpdate callback that is invoked after each + complete framebuffer update. + * A new non-forking listen (reverse VNC) function that works under + Windows. + * IPv6 support. LibVNCClient is now able to connect to IPv6 VNC servers. + * IP QoS support. This enables setting the DSCP/Traffic Class field of + IP/IPv6 packets sent by a client. For example starting a client with + -qosdscp 184 marks all outgoing traffic for expedited forwarding. + Implementation for Win32 is still a TODO, though. + * Fixed hostname resolution problems under Windows. + + - SDLvncviewer + * Is now resizable and can do key repeat, mouse wheel scrolling + and clipboard copy and paste. + + - LinuxVNC: + * Fix for no input possible because of ctrl key being stuck. + Issue was reported as Debian bug #555988. + + +0.9.7 Mark sent me patches to no longer need C++ for ZRLE encoding! added --disable-cxx Option for configure x11vnc changes from Karl Runge: From d94db37d2dc3fcbbf7346b746ee7f72bcfc494e0 Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Sat, 12 Mar 2011 20:02:14 +0100 Subject: [PATCH 02/12] Remove autogenerated files. --- rfb/rfbconfig.h.in | 191 --------------------------------------------- rfb/stamp-h.in | 1 - 2 files changed, 192 deletions(-) delete mode 100644 rfb/rfbconfig.h.in delete mode 100644 rfb/stamp-h.in diff --git a/rfb/rfbconfig.h.in b/rfb/rfbconfig.h.in deleted file mode 100644 index 5736804..0000000 --- a/rfb/rfbconfig.h.in +++ /dev/null @@ -1,191 +0,0 @@ -/* rfb/rfbconfig.h.in. Generated automatically from configure.ac by autoheader. */ - -/* Enable 24 bit per pixel in native framebuffer */ -#undef ALLOW24BPP - -/* Enable BackChannel communication */ -#undef BACKCHANNEL - -/* Define if you have the header file. */ -#undef HAVE_ARPA_INET_H - -/* Define if you don't have `vprintf' but do have `_doprnt.' */ -#undef HAVE_DOPRNT - -/* Define if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define if you have the `ftime' function. */ -#undef HAVE_FTIME - -/* Define if you have the `gethostbyname' function. */ -#undef HAVE_GETHOSTBYNAME - -/* Define if you have the `gethostname' function. */ -#undef HAVE_GETHOSTNAME - -/* Define if you have the `gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define if you have the `inet_ntoa' function. */ -#undef HAVE_INET_NTOA - -/* Define if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define if you have the `jpeg' library (-ljpeg). */ -#undef HAVE_LIBJPEG - -/* Define if you have the `nsl' library (-lnsl). */ -#undef HAVE_LIBNSL - -/* Define if you have the `pthread' library (-lpthread). */ -#undef HAVE_LIBPTHREAD - -/* Define if you have the `socket' library (-lsocket). */ -#undef HAVE_LIBSOCKET - -/* Define if you have the `z' library (-lz). */ -#undef HAVE_LIBZ - -/* Define if your system has a working `malloc' function. */ -#undef HAVE_MALLOC - -/* Define if you have the `memmove' function. */ -#undef HAVE_MEMMOVE - -/* Define if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define if you have the `memset' function. */ -#undef HAVE_MEMSET - -/* Define if you have the `mkfifo' function. */ -#undef HAVE_MKFIFO - -/* Define if you have the header file. */ -#undef HAVE_NETDB_H - -/* Define if you have the header file. */ -#undef HAVE_NETINET_IN_H - -/* Define if you have the `select' function. */ -#undef HAVE_SELECT - -/* Define if you have the `socket' function. */ -#undef HAVE_SOCKET - -/* Define if `stat' has the bug that it succeeds when given the zero-length - file name argument. */ -#undef HAVE_STAT_EMPTY_STRING_BUG - -/* Define if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define if you have the `strchr' function. */ -#undef HAVE_STRCHR - -/* Define if you have the `strcspn' function. */ -#undef HAVE_STRCSPN - -/* Define if you have the `strdup' function. */ -#undef HAVE_STRDUP - -/* Define if you have the `strerror' function. */ -#undef HAVE_STRERROR - -/* Define if you have the `strftime' function. */ -#undef HAVE_STRFTIME - -/* Define if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define if you have the header file. */ -#undef HAVE_STRING_H - -/* Define if you have the `strstr' function. */ -#undef HAVE_STRSTR - -/* Define if you have the header file. */ -#undef HAVE_SYSLOG_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_TIMEB_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define if you have that is POSIX.1 compatible. */ -#undef HAVE_SYS_WAIT_H - -/* Define if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define if you have the `vprintf' function. */ -#undef HAVE_VPRINTF - -/* Use zrle compression; needs a c++ compiler */ -#undef HAVE_ZRLE - -/* Define if `lstat' dereferences a symlink specified with a trailing slash. - */ -#undef LSTAT_FOLLOWS_SLASHED_SYMLINK - -/* Name of package */ -#undef PACKAGE - -/* The number of bytes in type char */ -#undef SIZEOF_CHAR - -/* The number of bytes in type int */ -#undef SIZEOF_INT - -/* The number of bytes in type long */ -#undef SIZEOF_LONG - -/* The number of bytes in type short */ -#undef SIZEOF_SHORT - -/* The number of bytes in type void* */ -#undef SIZEOF_VOIDP - -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME - -/* Version number of package */ -#undef VERSION - -/* Define if your processor stores words with the most significant byte first - (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN - -/* Define if the X Window System is missing or not being used. */ -#undef X_DISPLAY_MISSING - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define as `__inline' if that's what the C compiler calls it, or to nothing - if it is not supported. */ -#undef inline - -/* Define to `unsigned' if does not define. */ -#undef size_t - -/* The type for socklen */ -#undef socklen_t diff --git a/rfb/stamp-h.in b/rfb/stamp-h.in deleted file mode 100644 index 9788f70..0000000 --- a/rfb/stamp-h.in +++ /dev/null @@ -1 +0,0 @@ -timestamp From 9882fdf7fa27b1ea2e6cbe272258fb28038be68f Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Sat, 12 Mar 2011 20:07:22 +0100 Subject: [PATCH 03/12] Include cmake configure file templates in dist tarball. Signed-off-by: Christian Beier --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index cfc5612..109ac65 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,7 +4,7 @@ endif SUBDIRS=libvncserver examples libvncclient vncterm classes client_examples test $(X11VNC) DIST_SUBDIRS=libvncserver examples libvncclient vncterm classes client_examples test -EXTRA_DIST = CMakeLists.txt +EXTRA_DIST = CMakeLists.txt rfb/rfbint.h.cmake rfb/rfbconfig.h.cmake bin_SCRIPTS = libvncserver-config From 56af603ec1d721b0f1aeff43068601f65cf0b488 Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Sat, 12 Mar 2011 21:59:27 +0100 Subject: [PATCH 04/12] CMake: fix building SDLvncviewer. --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b474a03..137c4dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ find_package(JPEG) find_package(SDL) find_package(GnuTLS) find_package(Threads) +find_package(X11) if(SDL_FOUND) # == pthread.h available option(TIGHTVNC_FILETRANSFER "Enable filetransfer" ON) @@ -219,6 +220,7 @@ if(SDL_FOUND) ${LIBVNCCLIENT_TESTS} SDLvncviewer ) + set(SDLvncviewer_EXTRA_SOURCES scrap.c) endif(SDL_FOUND) if(HAVE_FFMPEG) @@ -237,8 +239,8 @@ endforeach(test ${LIBVNCSERVER_TESTS}) file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/client_examples) foreach(test ${LIBVNCCLIENT_TESTS}) - add_executable(client_examples/${test} ${LIBVNCCLITEST_DIR}/${test}.c) - target_link_libraries(client_examples/${test} vncclient ${CMAKE_THREAD_LIBS_INIT} ${GNUTLS_LIBRARIES} ${SDL_LIBRARY} ${FFMPEG_LIBRARIES}) + add_executable(client_examples/${test} ${LIBVNCCLITEST_DIR}/${test}.c ${LIBVNCCLITEST_DIR}/${${test}_EXTRA_SOURCES} ) + target_link_libraries(client_examples/${test} vncclient ${CMAKE_THREAD_LIBS_INIT} ${GNUTLS_LIBRARIES} ${X11_LIBRARIES} ${SDL_LIBRARY} ${FFMPEG_LIBRARIES}) endforeach(test ${LIBVNCCLIENT_TESTS}) install_targets(/lib vncserver) From 887921373489576e812f48053ae5a7aefa661a28 Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Sat, 12 Mar 2011 22:01:31 +0100 Subject: [PATCH 05/12] CMake: Threads can be available even if SDL is not. --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 137c4dd..37b8e4c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,9 +20,9 @@ find_package(GnuTLS) find_package(Threads) find_package(X11) -if(SDL_FOUND) # == pthread.h available +if(Threads_FOUND) option(TIGHTVNC_FILETRANSFER "Enable filetransfer" ON) -endif(SDL_FOUND) +endif(Threads_FOUND) if(ZLIB_FOUND) set(LIBVNCSERVER_HAVE_LIBZ 1) endif(ZLIB_FOUND) @@ -188,12 +188,12 @@ set(LIBVNCSERVER_TESTS vncev ) -if(SDL_FOUND) +if(Threads_FOUND) set(LIBVNCSERVER_TESTS ${LIBVNCSERVER_TESTS} blooptest ) -endif(SDL_FOUND) +endif(Threads_FOUND) if(TIGHTVNC_FILETRANSFER) set(LIBVNCSERVER_TESTS From 6b60690a4a1642c77bd6ac42789c4da6ed770075 Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Sat, 12 Mar 2011 23:17:46 +0100 Subject: [PATCH 06/12] CMake: Check for libgcrypt availability. --- CMakeLists.txt | 6 ++++++ rfb/rfbconfig.h.cmake | 3 +++ 2 files changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 37b8e4c..a5425cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ find_package(SDL) find_package(GnuTLS) find_package(Threads) find_package(X11) +find_library(LIBGCRYPT_LIBRARIES gcrypt) if(Threads_FOUND) option(TIGHTVNC_FILETRANSFER "Enable filetransfer" ON) @@ -33,6 +34,11 @@ option(LIBVNCSERVER_ALLOW24BPP "Allow 24 bpp" ON) if(GNUTLS_FOUND) set(LIBVNCSERVER_WITH_CLIENT_TLS 1) endif(GNUTLS_FOUND) +if(LIBGCRYPT_LIBRARIES) + message(STATUS "Found libgcrypt: ${LIBGCRYPT_LIBRARIES}") + set(LIBVNCSERVER_WITH_CLIENT_GCRYPT 1) +endif(LIBGCRYPT_LIBRARIES) + check_include_file("fcntl.h" LIBVNCSERVER_HAVE_FCNTL_H) check_include_file("netinet/in.h" LIBVNCSERVER_HAVE_NETINET_IN_H) diff --git a/rfb/rfbconfig.h.cmake b/rfb/rfbconfig.h.cmake index f9f9ba3..de898fc 100644 --- a/rfb/rfbconfig.h.cmake +++ b/rfb/rfbconfig.h.cmake @@ -54,6 +54,9 @@ /* Define to the version of this package. */ #define LIBVNCSERVER_PACKAGE_VERSION "@PACKAGE_VERSION@" +/* Define to 1 if libgcrypt is present */ +#cmakedefine LIBVNCSERVER_WITH_CLIENT_GCRYPT 1 + /* Define to 1 if GnuTLS is present */ #cmakedefine LIBVNCSERVER_WITH_CLIENT_TLS 1 From bf2470cec69ab00f7213aa136f5a2d486c9da17a Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Thu, 17 Mar 2011 13:11:59 +0100 Subject: [PATCH 07/12] Check rfbGetScreen() return value everywhere. This fixes a segfault when a server is invoked with the '-help' commandline argument. --- VisualNaCro/nacro.c | 2 ++ examples/backchannel.c | 2 ++ examples/camera.c | 2 ++ examples/colourmaptest.c | 3 ++- examples/example.c | 5 +++-- examples/filetransfer.c | 2 ++ examples/fontsel.c | 3 +++ examples/mac.c | 2 ++ examples/pnmshow.c | 2 ++ examples/pnmshow24.c | 2 ++ examples/simple.c | 2 ++ examples/simple15.c | 3 ++- examples/vncev.c | 2 ++ examples/zippy.c | 2 ++ test/cargstest.c | 3 +++ test/copyrecttest.c | 2 ++ test/cursortest.c | 6 ++++-- test/encodingstest.c | 2 ++ 18 files changed, 41 insertions(+), 6 deletions(-) diff --git a/VisualNaCro/nacro.c b/VisualNaCro/nacro.c index 2fc9e36..9c492b0 100644 --- a/VisualNaCro/nacro.c +++ b/VisualNaCro/nacro.c @@ -121,6 +121,8 @@ static rfbBool malloc_frame_buffer(rfbClient* cl) res->client->frameBuffer=malloc(w*4*h); res->server=rfbGetScreen(NULL,NULL,w,h,8,3,4); + if(!res->server) + return FALSE; res->server->screenData=res; res->server->port=res->listen_port; res->server->frameBuffer=res->client->frameBuffer; diff --git a/examples/backchannel.c b/examples/backchannel.c index 7aa0fa1..c625753 100644 --- a/examples/backchannel.c +++ b/examples/backchannel.c @@ -107,6 +107,8 @@ int main(int argc,char** argv) rfbRegisterProtocolExtension(&backChannelExtension); server=rfbGetScreen(&argc,argv,400,300,8,3,4); + if(!server) + return 0; server->frameBuffer=(char*)malloc(400*300*4); rfbInitServer(server); rfbRunEventLoop(server,-1,FALSE); diff --git a/examples/camera.c b/examples/camera.c index 7077790..58ab1c3 100644 --- a/examples/camera.c +++ b/examples/camera.c @@ -133,6 +133,8 @@ int main(int argc,char** argv) long usec; rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,WIDTH,HEIGHT,8,3,BPP); + if(!server) + return 0; server->desktopName = "Live Video Feed Example"; server->frameBuffer=(char*)malloc(WIDTH*HEIGHT*BPP); server->alwaysShared=(1==1); diff --git a/examples/colourmaptest.c b/examples/colourmaptest.c index e403164..20ea303 100644 --- a/examples/colourmaptest.c +++ b/examples/colourmaptest.c @@ -7,7 +7,8 @@ int main(int argc,char** argv) uint8_t bytes[256*3]; rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,256,256,8,1,1); - + if(!server) + return 0; server->serverFormat.trueColour=FALSE; server->colourMap.count=256; server->colourMap.is16=FALSE; diff --git a/examples/example.c b/examples/example.c index 31bc38d..93fdf28 100644 --- a/examples/example.c +++ b/examples/example.c @@ -279,8 +279,9 @@ static void MakeRichCursor(rfbScreenInfoPtr rfbScreen) int main(int argc,char** argv) { - rfbScreenInfoPtr rfbScreen = - rfbGetScreen(&argc,argv,maxx,maxy,8,3,bpp); + rfbScreenInfoPtr rfbScreen = rfbGetScreen(&argc,argv,maxx,maxy,8,3,bpp); + if(!rfbScreen) + return 0; rfbScreen->desktopName = "LibVNCServer Example"; rfbScreen->frameBuffer = (char*)malloc(maxx*maxy*bpp); rfbScreen->alwaysShared = TRUE; diff --git a/examples/filetransfer.c b/examples/filetransfer.c index ff4af11..2d03fe1 100644 --- a/examples/filetransfer.c +++ b/examples/filetransfer.c @@ -7,6 +7,8 @@ int main(int argc,char** argv) { rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,400,300,8,3,4); + if(!server) + return 0; server->frameBuffer=(char*)malloc(400*300*4); rfbRegisterTightVNCFileTransferExtension(); rfbInitServer(server); diff --git a/examples/fontsel.c b/examples/fontsel.c index 85d2624..15139dc 100644 --- a/examples/fontsel.c +++ b/examples/fontsel.c @@ -41,6 +41,9 @@ int main(int argc,char** argv) rfbScreenInfoPtr s=rfbGetScreen(&argc,argv,640,480,8,3,3); int i,j; + if(!s) + return 0; + s->frameBuffer=(char*)malloc(640*480*3); rfbInitServer(s); diff --git a/examples/mac.c b/examples/mac.c index 2d335a4..1c85d73 100644 --- a/examples/mac.c +++ b/examples/mac.c @@ -455,6 +455,8 @@ ScreenInit(int argc, char**argv) CGDisplayPixelsHigh(kCGDirectMainDisplay), bitsPerSample, CGDisplaySamplesPerPixel(kCGDirectMainDisplay),4); + if(!rfbScreen) + exit(0); rfbScreen->serverFormat.redShift = bitsPerSample*2; rfbScreen->serverFormat.greenShift = bitsPerSample*1; rfbScreen->serverFormat.blueShift = 0; diff --git a/examples/pnmshow.c b/examples/pnmshow.c index 734155f..6ced92a 100644 --- a/examples/pnmshow.c +++ b/examples/pnmshow.c @@ -65,6 +65,8 @@ int main(int argc,char** argv) /* initialize data for vnc server */ rfbScreen = rfbGetScreen(&argc,argv,paddedWidth,height,8,(bitsPerPixelInFile+7)/8,bytesPerPixel); + if(!rfbScreen) + return 0; if(argc>1) rfbScreen->desktopName = argv[1]; else diff --git a/examples/pnmshow24.c b/examples/pnmshow24.c index a8d6c1d..81389d7 100644 --- a/examples/pnmshow24.c +++ b/examples/pnmshow24.c @@ -60,6 +60,8 @@ int main(int argc,char** argv) /* initialize data for vnc server */ rfbScreen = rfbGetScreen(&argc,argv,paddedWidth,height,8,3,3); + if(!rfbScreen) + return 0; if(argc>1) rfbScreen->desktopName = argv[1]; else diff --git a/examples/simple.c b/examples/simple.c index f6e94dc..6167d72 100644 --- a/examples/simple.c +++ b/examples/simple.c @@ -3,6 +3,8 @@ int main(int argc,char** argv) { rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,400,300,8,3,4); + if(!server) + return 0; server->frameBuffer=(char*)malloc(400*300*4); rfbInitServer(server); rfbRunEventLoop(server,-1,FALSE); diff --git a/examples/simple15.c b/examples/simple15.c index faff4f7..a90988e 100644 --- a/examples/simple15.c +++ b/examples/simple15.c @@ -9,7 +9,8 @@ int main(int argc,char** argv) uint16_t* f; rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,400,300,5,3,2); - + if(!server) + return 0; server->frameBuffer=(char*)malloc(400*300*2); f=(uint16_t*)server->frameBuffer; for(j=0;j<300;j++) diff --git a/examples/vncev.c b/examples/vncev.c index 9ebafc9..ba9441a 100644 --- a/examples/vncev.c +++ b/examples/vncev.c @@ -112,6 +112,8 @@ static enum rfbNewClientAction newclient(rfbClientPtr cl) int main(int argc,char** argv) { rfbScreenInfoPtr s=rfbGetScreen(&argc,argv,width,height,8,1,1); + if(!s) + return 0; s->colourMap.is16=FALSE; s->colourMap.count=2; s->colourMap.data.bytes=(unsigned char*)"\xd0\xd0\xd0\x30\x01\xe0"; diff --git a/examples/zippy.c b/examples/zippy.c index d8a90d7..4f793a9 100644 --- a/examples/zippy.c +++ b/examples/zippy.c @@ -27,6 +27,8 @@ int main (int argc, char **argv) return 1; server = rfbGetScreen (&argc, argv, maxx, maxy, 8, 3, bpp); + if(!server) + return 0; server->desktopName = "Zippy das wundersquirrel\'s VNC server"; server->frameBuffer = (char*)malloc(maxx*maxy*bpp); server->alwaysShared = TRUE; diff --git a/test/cargstest.c b/test/cargstest.c index 263982d..e2b97ee 100644 --- a/test/cargstest.c +++ b/test/cargstest.c @@ -10,6 +10,9 @@ int main(int argc,char** argv) rfbBool ret=0; screen = rfbGetScreen(&fake_argc,fake_argv,1024,768,8,3,1); + if(!screen) + return 0; + #define CHECK(a,b) if(screen->a!=b) { fprintf(stderr,#a " is %d (should be " #b ")\n",screen->a); ret=1; } CHECK(width,1024); CHECK(height,768); diff --git a/test/copyrecttest.c b/test/copyrecttest.c index 5521595..cd2a504 100644 --- a/test/copyrecttest.c +++ b/test/copyrecttest.c @@ -22,6 +22,8 @@ int main(int argc,char** argv) double r,phi=0; rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,width,height,8,3,4); + if(!server) + return 0; server->frameBuffer=(char*)malloc(width*height*4); initBackground(server); server->deferUpdateTime=0; diff --git a/test/cursortest.c b/test/cursortest.c index 7a4efd3..78c37e3 100644 --- a/test/cursortest.c +++ b/test/cursortest.c @@ -322,8 +322,10 @@ static void doptr(int buttonMask,int x,int y,rfbClientPtr cl) int main(int argc,char** argv) { - rfbScreenInfoPtr rfbScreen = - rfbGetScreen(&argc,argv,maxx,maxy,8,3,bpp); + rfbScreenInfoPtr rfbScreen = rfbGetScreen(&argc,argv,maxx,maxy,8,3,bpp); + if(!rfbScreen) + return 0; + rfbScreen->desktopName = "Cursor Test"; rfbScreen->frameBuffer = (char*)malloc(maxx*maxy*bpp); rfbScreen->ptrAddEvent = doptr; diff --git a/test/encodingstest.c b/test/encodingstest.c index bef30a8..6d2f04d 100644 --- a/test/encodingstest.c +++ b/test/encodingstest.c @@ -298,6 +298,8 @@ int main(int argc,char** argv) /* Initialize server */ server=rfbGetScreen(&argc,argv,width,height,8,3,4); + if(!server) + return 0; server->frameBuffer=malloc(400*300*4); server->cursor=NULL; From 56234cd0b656de3c8827288f2adf78c9cb12d0c5 Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Thu, 17 Mar 2011 13:32:08 +0100 Subject: [PATCH 08/12] Fix remaining compiler warnings. --- examples/rotate.c | 7 ------- examples/zippy.c | 6 ++++-- libvncserver/zrle.c | 3 --- libvncserver/zrleencodetemplate.c | 6 ------ 4 files changed, 4 insertions(+), 18 deletions(-) diff --git a/examples/rotate.c b/examples/rotate.c index 66fca80..e552e4a 100644 --- a/examples/rotate.c +++ b/examples/rotate.c @@ -2,13 +2,6 @@ #include #include -static int gcd(int x, int y) -{ - if (x == 0) - return y; - return gcd((y % x), x); -} - #define CONCAT2(a,b) a##b #define CONCAT2E(a,b) CONCAT2(a,b) #define CONCAT3(a,b,c) a##b##c diff --git a/examples/zippy.c b/examples/zippy.c index 4f793a9..5a5961a 100644 --- a/examples/zippy.c +++ b/examples/zippy.c @@ -13,6 +13,8 @@ static int maxx=400, maxy=400, bpp=4; void blank_framebuffer(char* frame_buffer, int x1, int y1, int x2, int y2); /* displays a red bar, a green bar, and a blue bar */ void draw_primary_colors (char* frame_buffer, int x1, int y1, int x2, int y2); +void draw_primary_colours_generic(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2); +void draw_primary_colours_generic_fast(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2); void linecount (char* frame_buffer); /* handles mouse events */ void on_mouse_event (int buttonMask,int x,int y,rfbClientPtr cl); @@ -76,7 +78,7 @@ void draw_primary_colors (char* frame_buffer, int x1, int y1, int x2, int y2) } /* Dscho's versions (slower, but works for bpp != 3 or 4) */ -static void draw_primary_colours_generic(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2) +void draw_primary_colours_generic(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2) { rfbPixelFormat f=s->serverFormat; int i,j; @@ -90,7 +92,7 @@ static void draw_primary_colours_generic(rfbScreenInfoPtr s,int x1,int y1,int x2 rfbDrawPixel(s,i,j,f.blueMax<serverFormat; int i,j,y3=(y1*2+y2)/3,y4=(y1+y2*2)/3; diff --git a/libvncserver/zrle.c b/libvncserver/zrle.c index e1f1447..80f629c 100644 --- a/libvncserver/zrle.c +++ b/libvncserver/zrle.c @@ -96,9 +96,6 @@ * data. */ -/* TODO: put into rfbClient struct */ - -static char zrleBeforeBuf[rfbZRLETileWidth * rfbZRLETileHeight * 4 + 4]; /* * rfbSendRectEncodingZRLE - send a given rectangle using ZRLE encoding. diff --git a/libvncserver/zrleencodetemplate.c b/libvncserver/zrleencodetemplate.c index 3a6f117..b6de755 100644 --- a/libvncserver/zrleencodetemplate.c +++ b/libvncserver/zrleencodetemplate.c @@ -84,8 +84,6 @@ static const int bitsPerPackedPixel[] = { 0, 1, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }; -static zrlePaletteHelper paletteHelper; - #endif /* ZRLE_ONCE */ void ZRLE_ENCODE_TILE (PIXEL_T* data, int w, int h, zrleOutStream* os, @@ -144,11 +142,7 @@ void ZRLE_ENCODE_TILE(PIXEL_T* data, int w, int h, zrleOutStream* os, PIXEL_T* end = ptr + h * w; *end = ~*(end-1); /* one past the end is different so the while loop ends */ -#if 0 - ph = &paletteHelper; -#else ph = (zrlePaletteHelper *) paletteHelper; -#endif zrlePaletteHelperInit(ph); while (ptr < end) { From fe1ca16e9b75b5f38ab374c8dfff92d2c3ea4532 Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Thu, 17 Mar 2011 14:43:55 +0100 Subject: [PATCH 09/12] Fix (most) MinGW32 compiler warnings. --- examples/rotate.c | 30 +++++++++++++++--------------- examples/rotatetemplate.c | 10 +++++----- examples/vncev.c | 3 ++- libvncclient/listen.c | 1 + libvncclient/rfbproto.c | 2 ++ libvncclient/ultra.c | 6 +++--- libvncclient/zrle.c | 2 +- libvncserver/rfbserver.c | 4 ++-- libvncserver/ultra.c | 4 ++-- 9 files changed, 33 insertions(+), 29 deletions(-) diff --git a/examples/rotate.c b/examples/rotate.c index e552e4a..028de8c 100644 --- a/examples/rotate.c +++ b/examples/rotate.c @@ -10,22 +10,22 @@ #define FUNCNAME rfbRotate #define FUNC(i, j) (h - 1 - j + i * h) #define SWAPDIMENSIONS -#define OUT 8 +#define OUTBITS 8 #include "rotatetemplate.c" -#define OUT 16 +#define OUTBITS 16 #include "rotatetemplate.c" -#define OUT 32 +#define OUTBITS 32 #include "rotatetemplate.c" #undef FUNCNAME #undef FUNC #define FUNCNAME rfbRotateCounterClockwise #define FUNC(i, j) (j + (w - 1 - i) * h) -#define OUT 8 +#define OUTBITS 8 #include "rotatetemplate.c" -#define OUT 16 +#define OUTBITS 16 #include "rotatetemplate.c" -#define OUT 32 +#define OUTBITS 32 #include "rotatetemplate.c" #undef FUNCNAME #undef FUNC @@ -33,33 +33,33 @@ #define FUNCNAME rfbFlipHorizontally #define FUNC(i, j) ((w - 1 - i) + j * w) -#define OUT 8 +#define OUTBITS 8 #include "rotatetemplate.c" -#define OUT 16 +#define OUTBITS 16 #include "rotatetemplate.c" -#define OUT 32 +#define OUTBITS 32 #include "rotatetemplate.c" #undef FUNCNAME #undef FUNC #define FUNCNAME rfbFlipVertically #define FUNC(i, j) (i + (h - 1 - j) * w) -#define OUT 8 +#define OUTBITS 8 #include "rotatetemplate.c" -#define OUT 16 +#define OUTBITS 16 #include "rotatetemplate.c" -#define OUT 32 +#define OUTBITS 32 #include "rotatetemplate.c" #undef FUNCNAME #undef FUNC #define FUNCNAME rfbRotateHundredAndEighty #define FUNC(i, j) ((w - 1 - i) + (h - 1 - j) * w) -#define OUT 8 +#define OUTBITS 8 #include "rotatetemplate.c" -#define OUT 16 +#define OUTBITS 16 #include "rotatetemplate.c" -#define OUT 32 +#define OUTBITS 32 #include "rotatetemplate.c" #undef FUNCNAME #undef FUNC diff --git a/examples/rotatetemplate.c b/examples/rotatetemplate.c index 57dc052..0d7e007 100644 --- a/examples/rotatetemplate.c +++ b/examples/rotatetemplate.c @@ -1,5 +1,5 @@ -#define OUT_T CONCAT3E(uint,OUT,_t) -#define FUNCTION CONCAT2E(FUNCNAME,OUT) +#define OUT_T CONCAT3E(uint,OUTBITS,_t) +#define FUNCTION CONCAT2E(FUNCNAME,OUTBITS) static void FUNCTION(rfbScreenInfoPtr screen) { @@ -16,7 +16,7 @@ static void FUNCTION(rfbScreenInfoPtr screen) #ifdef SWAPDIMENSIONS screen->width = h; - screen->paddedWidthInBytes = h * OUT / 8; + screen->paddedWidthInBytes = h * OUTBITS / 8; screen->height = w; { @@ -31,7 +31,7 @@ static void FUNCTION(rfbScreenInfoPtr screen) rfbMarkRectAsModified(screen, 0, 0, screen->width, screen->height); } -#if OUT == 32 +#if OUTBITS == 32 void FUNCNAME(rfbScreenInfoPtr screen) { if (screen->serverFormat.bitsPerPixel == 32) CONCAT2E(FUNCNAME,32)(screen); @@ -48,5 +48,5 @@ void FUNCNAME(rfbScreenInfoPtr screen) { #endif #undef FUNCTION -#undef OUT +#undef OUTBITS diff --git a/examples/vncev.c b/examples/vncev.c index ba9441a..b185746 100644 --- a/examples/vncev.c +++ b/examples/vncev.c @@ -99,7 +99,8 @@ static enum rfbNewClientAction newclient(rfbClientPtr cl) { char buffer[1024]; struct sockaddr_in addr; - unsigned int len=sizeof(addr),ip; + socklen_t len=sizeof(addr); + unsigned int ip; getpeername(cl->sock,(struct sockaddr*)&addr,&len); ip=ntohl(addr.sin_addr.s_addr); diff --git a/libvncclient/listen.c b/libvncclient/listen.c index 637abb1..58275a0 100644 --- a/libvncclient/listen.c +++ b/libvncclient/listen.c @@ -29,6 +29,7 @@ #ifdef __MINGW32__ #define close closesocket #include +#undef max #else #include #include diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c index dd06ebd..d10e8a6 100644 --- a/libvncclient/rfbproto.c +++ b/libvncclient/rfbproto.c @@ -1045,7 +1045,9 @@ InitialiseRFBConnection(rfbClient* client) rfbProtocolVersionMsg pv; int major,minor; uint32_t authScheme; +#ifdef LIBVNCSERVER_WITH_CLIENT_TLS uint32_t subAuthScheme; +#endif rfbClientInitMsg ci; /* if the connection is immediately closed, don't report anything, so diff --git a/libvncclient/ultra.c b/libvncclient/ultra.c index 3be150d..dddb0c0 100644 --- a/libvncclient/ultra.c +++ b/libvncclient/ultra.c @@ -37,7 +37,7 @@ HandleUltraBPP (rfbClient* client, int rx, int ry, int rw, int rh) rfbZlibHeader hdr; int toRead=0; int inflateResult=0; - int uncompressedBytes = (( rw * rh ) * ( BPP / 8 )); + lzo_uint uncompressedBytes = (( rw * rh ) * ( BPP / 8 )); if (!ReadFromRFBServer(client, (char *)&hdr, sz_rfbZlibHeader)) return FALSE; @@ -119,7 +119,7 @@ HandleUltraZipBPP (rfbClient* client, int rx, int ry, int rw, int rh) int toRead=0; int inflateResult=0; unsigned char *ptr=NULL; - int uncompressedBytes = ry + (rw * 65535); + lzo_uint uncompressedBytes = ry + (rw * 65535); unsigned int numCacheRects = rx; if (!ReadFromRFBServer(client, (char *)&hdr, sz_rfbZlibHeader)) @@ -170,7 +170,7 @@ HandleUltraZipBPP (rfbClient* client, int rx, int ry, int rw, int rh) uncompressedBytes = client->raw_buffer_size; inflateResult = lzo1x_decompress( (lzo_byte *)client->ultra_buffer, toRead, - (lzo_byte *)client->raw_buffer, (lzo_uintp) &uncompressedBytes, NULL); + (lzo_byte *)client->raw_buffer, &uncompressedBytes, NULL); if ( inflateResult != LZO_E_OK ) { rfbClientLog("ultra decompress returned error: %d\n", diff --git a/libvncclient/zrle.c b/libvncclient/zrle.c index 16fc091..a14ad44 100644 --- a/libvncclient/zrle.c +++ b/libvncclient/zrle.c @@ -363,7 +363,7 @@ static int HandleZRLETile(rfbClient* client, { return -8; } - else if( (type >= 130)&&(type <= 255) ) /* palette RLE */ + else if( type >= 130 ) /* palette RLE */ { CARDBPP palette[128]; int i,j; diff --git a/libvncserver/rfbserver.c b/libvncserver/rfbserver.c index 73be34c..70ae88b 100644 --- a/libvncserver/rfbserver.c +++ b/libvncserver/rfbserver.c @@ -1657,7 +1657,7 @@ rfbBool rfbProcessFileTransfer(rfbClientPtr cl, uint8_t contentType, uint8_t con #ifdef LIBVNCSERVER_HAVE_LIBZ /* compressed packet */ nRet = uncompress(compBuff,&nRawBytes,(const unsigned char*)buffer, length); - retval=write(cl->fileTransfer.fd, compBuff, nRawBytes); + retval=write(cl->fileTransfer.fd, (char*)compBuff, nRawBytes); #else /* Write the file out as received... */ retval=write(cl->fileTransfer.fd, buffer, length); @@ -3265,7 +3265,7 @@ void rfbNewUDPConnection(rfbScreenInfoPtr rfbScreen, int sock) { - if (write(sock, &ptrAcceleration, 1) < 0) { + if (write(sock, (char*) &ptrAcceleration, 1) < 0) { rfbLogPerror("rfbNewUDPConnection: write"); } } diff --git a/libvncserver/ultra.c b/libvncserver/ultra.c index 9a3b14f..47fab55 100644 --- a/libvncserver/ultra.c +++ b/libvncserver/ultra.c @@ -50,7 +50,7 @@ rfbSendOneRectEncodingUltra(rfbClientPtr cl, + (x * (cl->scaledScreen->bitsPerPixel / 8))); int maxRawSize; - int maxCompSize; + lzo_uint maxCompSize; maxRawSize = (w * h * (cl->format.bitsPerPixel / 8)); @@ -92,7 +92,7 @@ rfbSendOneRectEncodingUltra(rfbClientPtr cl, } /* Perform the compression here. */ - deflateResult = lzo1x_1_compress((unsigned char *)cl->beforeEncBuf, (lzo_uint)(w * h * (cl->format.bitsPerPixel / 8)), (unsigned char *)cl->afterEncBuf, (lzo_uint *)&maxCompSize, cl->lzoWrkMem); + deflateResult = lzo1x_1_compress((unsigned char *)cl->beforeEncBuf, (lzo_uint)(w * h * (cl->format.bitsPerPixel / 8)), (unsigned char *)cl->afterEncBuf, &maxCompSize, cl->lzoWrkMem); /* maxCompSize now contains the compressed size */ /* Find the total size of the resulting compressed data. */ From e92951d19dfba559e4893cd4ad27980e4a8166f8 Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Thu, 17 Mar 2011 14:51:34 +0100 Subject: [PATCH 10/12] Remove useless comparisons that always evaluate to false. There can not be more than 255 security types and MSLogon is RFB 3.6 only. --- libvncclient/rfbproto.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c index d10e8a6..d424b04 100644 --- a/libvncclient/rfbproto.c +++ b/libvncclient/rfbproto.c @@ -559,11 +559,6 @@ ReadSupportedSecurityType(rfbClient* client, uint32_t *result, rfbBool subAuth) ReadReason(client); return FALSE; } - if (count>sizeof(tAuth)) - { - rfbClientLog("%d security types are too many; maximum is %d\n", count, sizeof(tAuth)); - return FALSE; - } rfbClientLog("We have %d security types to read\n", count); authScheme=0; @@ -573,7 +568,7 @@ ReadSupportedSecurityType(rfbClient* client, uint32_t *result, rfbBool subAuth) if (!ReadFromRFBServer(client, (char *)&tAuth[loop], 1)) return FALSE; rfbClientLog("%d) Received security type %d\n", loop, tAuth[loop]); if (flag) continue; - if (tAuth[loop]==rfbVncAuth || tAuth[loop]==rfbNoAuth || tAuth[loop]==rfbMSLogon || + if (tAuth[loop]==rfbVncAuth || tAuth[loop]==rfbNoAuth || tAuth[loop]==rfbARD || (!subAuth && (tAuth[loop]==rfbTLS || tAuth[loop]==rfbVeNCrypt))) { From ab9fc40aab8fc3a6ec732a9afd87b8786e1046d3 Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Thu, 17 Mar 2011 16:58:42 +0100 Subject: [PATCH 11/12] Update encodingstest. * Fixed segfault on shutdown. * Updated to test all encodings. * Fixed to operate with encodings that split up rects into smaller rects. --- test/encodingstest.c | 67 +++++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 42 deletions(-) diff --git a/test/encodingstest.c b/test/encodingstest.c index 6d2f04d..e79f7e7 100644 --- a/test/encodingstest.c +++ b/test/encodingstest.c @@ -17,15 +17,16 @@ static MUTEX(frameBufferMutex); typedef struct { int id; char* str; } encoding_t; static encoding_t testEncodings[]={ - { rfbEncodingRaw, "raw" }, + { rfbEncodingRaw, "raw" }, { rfbEncodingRRE, "rre" }, - /* TODO: fix corre */ - /* { rfbEncodingCoRRE, "corre" }, */ + { rfbEncodingCoRRE, "corre" }, { rfbEncodingHextile, "hextile" }, + { rfbEncodingUltra, "ultra" }, #ifdef LIBVNCSERVER_HAVE_LIBZ { rfbEncodingZlib, "zlib" }, { rfbEncodingZlibHex, "zlibhex" }, { rfbEncodingZRLE, "zrle" }, + { rfbEncodingZYWRLE, "zywrle" }, #ifdef LIBVNCSERVER_HAVE_LIBJPEG { rfbEncodingTight, "tight" }, #endif @@ -39,7 +40,6 @@ static encoding_t testEncodings[]={ /* Here come the variables/functions to handle the test output */ static const int width=400,height=300; -static struct { int x1,y1,x2,y2; } lastUpdateRect; static unsigned int statistics[2][NUMBER_OF_ENCODINGS_TO_TEST]; static unsigned int totalFailed,totalCount; static unsigned int countGotUpdate; @@ -49,22 +49,9 @@ static void initStatistics(void) { memset(statistics[0],0,sizeof(int)*NUMBER_OF_ENCODINGS_TO_TEST); memset(statistics[1],0,sizeof(int)*NUMBER_OF_ENCODINGS_TO_TEST); totalFailed=totalCount=0; - lastUpdateRect.x1=0; - lastUpdateRect.y1=0; - lastUpdateRect.x2=width; - lastUpdateRect.y2=height; INIT_MUTEX(statisticsMutex); } -static void updateServerStatistics(int x1,int y1,int x2,int y2) { - LOCK(statisticsMutex); - countGotUpdate=0; - lastUpdateRect.x1=x1; - lastUpdateRect.y1=y1; - lastUpdateRect.x2=x2; - lastUpdateRect.y2=y2; - UNLOCK(statisticsMutex); -} static void updateStatistics(int encodingIndex,rfbBool failed) { LOCK(statisticsMutex); @@ -115,7 +102,7 @@ static rfbBool doFramebuffersMatch(rfbScreenInfo* server,rfbClient* client, static rfbBool resize(rfbClient* cl) { if(cl->frameBuffer) free(cl->frameBuffer); - cl->frameBuffer=(char*)malloc(cl->width*cl->height*cl->format.bitsPerPixel/8); + cl->frameBuffer=malloc(cl->width*cl->height*cl->format.bitsPerPixel/8); if(!cl->frameBuffer) return FALSE; SendFramebufferUpdateRequest(cl,0,0,cl->width,cl->height,FALSE); @@ -129,44 +116,44 @@ typedef struct clientData { } clientData; static void update(rfbClient* client,int x,int y,int w,int h) { - clientData* cd=(clientData*)client->clientData; - int maxDelta=0; - #ifndef VERY_VERBOSE + static const char* progress="|/-\\"; static int counter=0; if(++counter>sizeof(progress)) counter=0; fprintf(stderr,"%c\r",progress[counter]); #else + clientData* cd=(clientData*)client->clientData; rfbClientLog("Got update (encoding=%s): (%d,%d)-(%d,%d)\n", testEncodings[cd->encodingIndex].str, x,y,x+w,y+h); #endif +} - /* only check if this was the last update */ - if(x+w!=lastUpdateRect.x2 || y+h!=lastUpdateRect.y2) { -#ifdef VERY_VERBOSE - rfbClientLog("Waiting (%d!=%d or %d!=%d)\n", - x+w,lastUpdateRect.x2,y+h,lastUpdateRect.y2); -#endif - return; - } +static void update_finished(rfbClient* client) { + clientData* cd=(clientData*)client->clientData; + int maxDelta=0; #ifdef LIBVNCSERVER_HAVE_LIBZ + if(testEncodings[cd->encodingIndex].id==rfbEncodingZYWRLE) + maxDelta=5; +#ifdef LIBVNCSERVER_HAVE_LIBJPEG if(testEncodings[cd->encodingIndex].id==rfbEncodingTight) maxDelta=5; #endif - +#endif updateStatistics(cd->encodingIndex, !doFramebuffersMatch(cd->server,client,maxDelta)); } + static void* clientLoop(void* data) { rfbClient* client=(rfbClient*)data; clientData* cd=(clientData*)client->clientData; client->appData.encodingsString=strdup(testEncodings[cd->encodingIndex].str); + client->appData.qualityLevel = 7; /* ZYWRLE fails the test with standard settings */ sleep(1); rfbClientLog("Starting client (encoding %s, display %s)\n", @@ -201,6 +188,7 @@ static void startClient(int encodingIndex,rfbScreenInfo* server) { client->clientData=malloc(sizeof(clientData)); client->MallocFrameBuffer=resize; client->GotFrameBufferUpdate=update; + client->FinishedFrameBufferUpdate=update_finished; cd=(clientData*)client->clientData; cd->encodingIndex=encodingIndex; @@ -208,10 +196,6 @@ static void startClient(int encodingIndex,rfbScreenInfo* server) { cd->display=(char*)malloc(6); sprintf(cd->display,":%d",server->port-5900); - lastUpdateRect.x1=lastUpdateRect.y1=0; - lastUpdateRect.x2=server->width; - lastUpdateRect.y2=server->height; - pthread_create(&all_threads[thread_counter++],NULL,clientLoop,(void*)client); } @@ -228,11 +212,10 @@ static void idle(rfbScreenInfo* server) #else goForward=(countGotUpdate==1); #endif - /* if(lastUpdateRect.x2==354) - rfbLog("server checked: countGotUpdate=%d\n",countGotUpdate); */ + UNLOCK(statisticsMutex); if(!goForward) - return; + return; countGotUpdate=0; LOCK(frameBufferMutex); @@ -250,10 +233,6 @@ static void idle(rfbScreenInfo* server) } rfbMarkRectAsModified(server,x1,y1,x2,y2); - lastUpdateRect.x1=x1; - lastUpdateRect.y1=y1; - lastUpdateRect.x2=x2; - lastUpdateRect.y2=y2; #ifdef VERY_VERBOSE rfbLog("Sent update (%d,%d)-(%d,%d)\n",x1,y1,x2,y2); #endif @@ -338,10 +317,14 @@ int main(int argc,char** argv) } #endif - rfbScreenCleanup(server); + /* shut down server, disconnecting all clients */ + rfbShutdownServer(server, TRUE); + for(i=0;iframeBuffer); + rfbScreenCleanup(server); rfbLog("Statistics:\n"); for(i=0;i Date: Thu, 17 Mar 2011 17:00:43 +0100 Subject: [PATCH 12/12] Fix regression in Ultra encoding introduced by commit fe1ca16e9b75b5f38ab374c8dfff92d2c3ea4532. My bad. There we see what the encodings test is good for ;-) --- libvncclient/ultra.c | 4 ++-- libvncserver/ultra.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libvncclient/ultra.c b/libvncclient/ultra.c index dddb0c0..dac89b5 100644 --- a/libvncclient/ultra.c +++ b/libvncclient/ultra.c @@ -57,7 +57,7 @@ HandleUltraBPP (rfbClient* client, int rx, int ry, int rw, int rh) * buffer, this buffer allocation should only happen once, on the * first update. */ - if ( client->raw_buffer_size < uncompressedBytes) { + if ( client->raw_buffer_size < (int)uncompressedBytes) { if ( client->raw_buffer != NULL ) { free( client->raw_buffer ); } @@ -141,7 +141,7 @@ HandleUltraZipBPP (rfbClient* client, int rx, int ry, int rw, int rh) * buffer, this buffer allocation should only happen once, on the * first update. */ - if ( client->raw_buffer_size < (uncompressedBytes + 500)) { + if ( client->raw_buffer_size < (int)(uncompressedBytes + 500)) { if ( client->raw_buffer != NULL ) { free( client->raw_buffer ); } diff --git a/libvncserver/ultra.c b/libvncserver/ultra.c index 47fab55..9485591 100644 --- a/libvncserver/ultra.c +++ b/libvncserver/ultra.c @@ -68,7 +68,7 @@ rfbSendOneRectEncodingUltra(rfbClientPtr cl, */ maxCompSize = (maxRawSize + maxRawSize / 16 + 64 + 3); - if (cl->afterEncBufSize < maxCompSize) { + if (cl->afterEncBufSize < (int)maxCompSize) { cl->afterEncBufSize = maxCompSize; if (cl->afterEncBuf == NULL) cl->afterEncBuf = (char *)malloc(cl->afterEncBufSize);