diff options
author | dscho <dscho> | 2005-05-23 19:26:12 +0000 |
---|---|---|
committer | dscho <dscho> | 2005-05-23 19:26:12 +0000 |
commit | 669b4c86855cc11a8904f4acb4039a14b91cbf6d (patch) | |
tree | 9575e388cfbac5bcdd63aa54ae053c465d93dc62 /libvncclient/rfbproto.c | |
parent | dc1094f03c10c2d863a15f1d8638ea8742e42f32 (diff) | |
download | libtdevnc-669b4c86855cc11a8904f4acb4039a14b91cbf6d.tar.gz libtdevnc-669b4c86855cc11a8904f4acb4039a14b91cbf6d.zip |
make zlib and tight handling thread safe (static -> rfbClient)
Diffstat (limited to 'libvncclient/rfbproto.c')
-rw-r--r-- | libvncclient/rfbproto.c | 129 |
1 files changed, 0 insertions, 129 deletions
diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c index 211a478..dd5d961 100644 --- a/libvncclient/rfbproto.c +++ b/libvncclient/rfbproto.c @@ -166,48 +166,6 @@ static void JpegSetSrcManager(j_decompress_ptr cinfo, uint8_t *compressedData, #endif #endif -/* The zlib encoding requires expansion/decompression/deflation of the - compressed data in the "buffer" above into another, result buffer. - However, the size of the result buffer can be determined precisely - based on the bitsPerPixel, height and width of the rectangle. We - allocate this buffer one time to be the full size of the buffer. */ - -#ifdef LIBVNCSERVER_HAVE_LIBZ -static int raw_buffer_size = -1; -static char *raw_buffer; - -static z_stream decompStream; -static rfbBool decompStreamInited = FALSE; - -#endif - - -#ifdef LIBVNCSERVER_HAVE_LIBJPEG -/* - * Variables for the ``tight'' encoding implementation. - */ - -/* Separate buffer for compressed data. */ -/* TODO: threading issues */ -#define ZLIB_BUFFER_SIZE 30000 -static char zlib_buffer[ZLIB_BUFFER_SIZE]; - -/* Four independent compression streams for zlib library. */ -static z_stream zlibStream[4]; -static rfbBool zlibStreamActive[4] = { - FALSE, FALSE, FALSE, FALSE -}; - -/* Filter stuff. Should be initialized by filter initialization code. */ -static rfbBool cutZeros; -static int rectWidth, rectColors; -static char tightPalette[256*4]; -static uint8_t tightPrevRow[2048*3*sizeof(uint16_t)]; - -/* JPEG decoder state. */ -static rfbBool jpegError; -#endif - /* * ConnectToRFBServer. */ @@ -1060,93 +1018,6 @@ PrintPixelFormat(rfbPixelFormat *format) } } -#ifdef LIBVNCSERVER_HAVE_LIBJPEG - -static long -ReadCompactLen (rfbClient* client) -{ - long len; - uint8_t b; - - if (!ReadFromRFBServer(client, (char *)&b, 1)) - return -1; - len = (int)b & 0x7F; - if (b & 0x80) { - if (!ReadFromRFBServer(client, (char *)&b, 1)) - return -1; - len |= ((int)b & 0x7F) << 7; - if (b & 0x80) { - if (!ReadFromRFBServer(client, (char *)&b, 1)) - return -1; - len |= ((int)b & 0xFF) << 14; - } - } - return len; -} - -/* - * JPEG source manager functions for JPEG decompression in Tight decoder. - */ - -static struct jpeg_source_mgr jpegSrcManager; -static JOCTET *jpegBufferPtr; -static size_t jpegBufferLen; - -static void -JpegInitSource(j_decompress_ptr cinfo) -{ - jpegError = FALSE; -} - -static boolean -JpegFillInputBuffer(j_decompress_ptr cinfo) -{ - jpegError = TRUE; - jpegSrcManager.bytes_in_buffer = jpegBufferLen; - jpegSrcManager.next_input_byte = (JOCTET *)jpegBufferPtr; - - return TRUE; -} - -static void -JpegSkipInputData(j_decompress_ptr cinfo, long num_bytes) -{ - if (num_bytes < 0 || num_bytes > jpegSrcManager.bytes_in_buffer) { - jpegError = TRUE; - jpegSrcManager.bytes_in_buffer = jpegBufferLen; - jpegSrcManager.next_input_byte = (JOCTET *)jpegBufferPtr; - } else { - jpegSrcManager.next_input_byte += (size_t) num_bytes; - jpegSrcManager.bytes_in_buffer -= (size_t) num_bytes; - } -} - -static void -JpegTermSource(j_decompress_ptr cinfo) -{ - /* No work necessary here. */ -} - -static void -JpegSetSrcManager(j_decompress_ptr cinfo, uint8_t *compressedData, - int compressedLen) -{ - jpegBufferPtr = (JOCTET *)compressedData; - jpegBufferLen = (size_t)compressedLen; - - jpegSrcManager.init_source = JpegInitSource; - jpegSrcManager.fill_input_buffer = JpegFillInputBuffer; - jpegSrcManager.skip_input_data = JpegSkipInputData; - jpegSrcManager.resync_to_restart = jpeg_resync_to_restart; - jpegSrcManager.term_source = JpegTermSource; - jpegSrcManager.next_input_byte = jpegBufferPtr; - jpegSrcManager.bytes_in_buffer = jpegBufferLen; - - cinfo->src = &jpegSrcManager; -} - -#endif - /* avoid name clashes with LibVNCServer */ #define rfbEncryptBytes rfbClientEncryptBytes |