summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--gst/librfb/Makefile.am2
-rw-r--r--gst/librfb/rfb.h1
-rw-r--r--gst/librfb/rfbbytestream.c149
-rw-r--r--gst/librfb/rfbbytestream.h37
-rw-r--r--gst/librfb/rfbdecoder.c65
-rw-r--r--gst/librfb/rfbdecoder.h2
7 files changed, 10 insertions, 256 deletions
diff --git a/ChangeLog b/ChangeLog
index 0df07383..09ff9145 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-10-16 Thijs Vermeir <thijsvermeir@gmail.com>
+
+ * gst/librfb/Makefile.am:
+ * gst/librfb/rfb.h:
+ * gst/librfb/rfbbytestream.c:
+ * gst/librfb/rfbbytestream.h:
+ * gst/librfb/rfbdecoder.c:
+ * gst/librfb/rfbdecoder.h:
+ remove the rfbbytestream dead code
+
2007-10-16 Zaheer Abbas Merali <zaheerabbas at merali dot org>
patch by: Alessandro Decina
diff --git a/gst/librfb/Makefile.am b/gst/librfb/Makefile.am
index 626dc5b4..507afd76 100644
--- a/gst/librfb/Makefile.am
+++ b/gst/librfb/Makefile.am
@@ -11,7 +11,6 @@ libgstrfbsrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
librfb_la_SOURCES = \
rfbbuffer.c \
rfbdecoder.c \
- rfbbytestream.c \
d3des.c \
vncauth.c
librfb_la_CFLAGS = $(GST_CFLAGS) -I$(srcdir)/..
@@ -21,7 +20,6 @@ noinst_HEADERS = \
rfb.h \
rfbdecoder.h \
rfbbuffer.h \
- rfbbytestream.h \
rfbcontext.h \
rfbutil.h \
gstrfbsrc.h \
diff --git a/gst/librfb/rfb.h b/gst/librfb/rfb.h
index 68b62925..89a4be99 100644
--- a/gst/librfb/rfb.h
+++ b/gst/librfb/rfb.h
@@ -2,7 +2,6 @@
#define _RFB_RFB_H_
#include <librfb/rfbdecoder.h>
-#include <librfb/rfbbytestream.h>
#include <librfb/rfbbuffer.h>
#endif
diff --git a/gst/librfb/rfbbytestream.c b/gst/librfb/rfbbytestream.c
deleted file mode 100644
index b33a33a3..00000000
--- a/gst/librfb/rfbbytestream.c
+++ /dev/null
@@ -1,149 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rfbbytestream.h>
-#include <string.h>
-
-static gint rfb_bytestream_copy_nocheck (RfbBytestream * bs,
- RfbBuffer * buffer, gint len);
-
-RfbBytestream *
-rfb_bytestream_new (void)
-{
- return g_new0 (RfbBytestream, 1);
-}
-
-void
-rfb_bytestream_free (RfbBytestream * bs)
-{
- g_return_if_fail (bs != NULL);
-
- g_slist_free (bs->buffer_list);
- g_free (bs);
-}
-
-gint
-rfb_bytestream_get (RfbBytestream * bs, gint len)
-{
- RfbBuffer *buffer;
-
- g_return_val_if_fail (bs != NULL, 0);
-
- buffer = bs->get_buffer (len, bs->user_data);
-
- if (buffer) {
- // g_print ("got buffer (%d bytes)\n", buffer->length);
- bs->buffer_list = g_slist_append (bs->buffer_list, buffer);
-
- bs->length += buffer->length;
-
- return len;
- }
-
- return 0;
-}
-
-gboolean
-rfb_bytestream_check (RfbBytestream * bs, gint len)
-{
- g_return_val_if_fail (bs != NULL, FALSE);
-
- while (bs->length < len) {
- rfb_bytestream_get (bs, len - bs->length);
- }
- return TRUE;
-}
-
-gint
-rfb_bytestream_read (RfbBytestream * bs, RfbBuffer ** buffer, gint len)
-{
- RfbBuffer *buf;
-
- g_return_val_if_fail (bs != NULL, 0);
- g_return_val_if_fail (buffer != NULL, 0);
-
- rfb_bytestream_check (bs, len);
-
- buf = rfb_buffer_new_and_alloc (len);
- rfb_bytestream_copy_nocheck (bs, buf, len);
-
- rfb_bytestream_flush (bs, len);
-
- *buffer = buf;
- return len;
-}
-
-gint
-rfb_bytestream_peek (RfbBytestream * bs, RfbBuffer ** buffer, gint len)
-{
- RfbBuffer *buf;
-
- g_return_val_if_fail (bs != NULL, 0);
- g_return_val_if_fail (buffer != NULL, 0);
-
- rfb_bytestream_check (bs, len);
-
- buf = rfb_buffer_new_and_alloc (len);
- rfb_bytestream_copy_nocheck (bs, buf, len);
-
- *buffer = buf;
- return len;
-}
-
-gint
-rfb_bytestream_flush (RfbBytestream * bs, gint len)
-{
- GSList *item;
- RfbBuffer *buf;
- gint n;
-
- g_return_val_if_fail (bs != NULL, 0);
-
- while ((item = bs->buffer_list)) {
- buf = (RfbBuffer *) item->data;
-
- n = MIN (buf->length - bs->offset, len);
- if (n <= len) {
- bs->offset = 0;
- bs->buffer_list = g_slist_delete_link (bs->buffer_list, item);
- rfb_buffer_free (buf);
- } else {
- bs->offset = bs->offset + len;
- }
- bs->length -= n;
- len -= n;
- if (len == 0)
- return 0;
- }
-
- g_assert_not_reached ();
- return 0;
-}
-
-static gint
-rfb_bytestream_copy_nocheck (RfbBytestream * bs, RfbBuffer * buffer, gint len)
-{
- GSList *item;
- gint offset;
- gint first_offset;
- RfbBuffer *frombuf;
- gint n;
-
- offset = 0;
- first_offset = bs->offset;
- for (item = bs->buffer_list; item; item = item->next) {
- frombuf = (RfbBuffer *) item->data;
- n = MIN (len, frombuf->length - first_offset);
- // g_print ("copying %d bytes from %p\n", n, frombuf);
- memcpy (buffer->data + offset, frombuf->data + first_offset, n);
- first_offset = 0;
- len -= n;
- offset += n;
- if (len == 0)
- return len;
- }
-
- g_assert_not_reached ();
- return 0;
-}
diff --git a/gst/librfb/rfbbytestream.h b/gst/librfb/rfbbytestream.h
deleted file mode 100644
index 65b936d1..00000000
--- a/gst/librfb/rfbbytestream.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef _LIBRFB_BYTESTREAM_H_
-#define _LIBRFB_BYTESTREAM_H_
-
-#include <glib.h>
-
-#include <librfb/rfbbuffer.h>
-
-G_BEGIN_DECLS
-
-typedef struct _RfbBytestream RfbBytestream;
-
-struct _RfbBytestream
-{
- RfbBuffer * (* get_buffer) (gint length, gpointer user_data);
-
- gpointer user_data;
-
- GSList *buffer_list;
- gint length;
- gint offset;
-};
-
-RfbBytestream *rfb_bytestream_new (void);
-void rfb_bytestream_free (RfbBytestream * bs);
-
-gint rfb_bytestream_read (RfbBytestream * bs,
- RfbBuffer ** buffer,
- gint len);
-gint rfb_bytestream_peek (RfbBytestream * bs,
- RfbBuffer ** buffer,
- gint len);
-gint rfb_bytestream_flush (RfbBytestream * bs,
- gint len);
-
-G_END_DECLS
-
-#endif
diff --git a/gst/librfb/rfbdecoder.c b/gst/librfb/rfbdecoder.c
index 8b9254a1..f8f9b02d 100644
--- a/gst/librfb/rfbdecoder.c
+++ b/gst/librfb/rfbdecoder.c
@@ -48,9 +48,6 @@ static gboolean rfb_decoder_state_framebuffer_update_rectangle (RfbDecoder *
decoder);
static gboolean rfb_decoder_state_set_colour_map_entries (RfbDecoder * decoder);
static gboolean rfb_decoder_state_server_cut_text (RfbDecoder * decoder);
-static RfbBuffer *rfb_socket_get_buffer (gint length, gpointer user_data);
-static gint rfb_socket_send_buffer (guint8 * buffer, gint length,
- gpointer user_data);
RfbDecoder *
rfb_decoder_new (void)
@@ -58,7 +55,6 @@ rfb_decoder_new (void)
RfbDecoder *decoder = g_new0 (RfbDecoder, 1);
decoder->fd = -1;
- decoder->bytestream = rfb_bytestream_new ();
decoder->password = NULL;
@@ -75,28 +71,10 @@ rfb_decoder_free (RfbDecoder * decoder)
{
g_return_if_fail (decoder != NULL);
- rfb_bytestream_free (decoder->bytestream);
if (decoder->fd >= 0)
close (decoder->fd);
}
-void
-rfb_decoder_use_file_descriptor (RfbDecoder * decoder, gint fd)
-{
- g_return_if_fail (decoder != NULL);
- g_return_if_fail (decoder->fd == -1);
- g_return_if_fail (!decoder->inited);
- g_return_if_fail (fd >= 0);
-
- decoder->fd = fd;
-
- decoder->bytestream->get_buffer = rfb_socket_get_buffer;
- decoder->bytestream->user_data = GINT_TO_POINTER (fd);
-
- decoder->send_data = rfb_socket_send_buffer;
- decoder->buffer_handler_data = GINT_TO_POINTER (fd);
-}
-
gboolean
rfb_decoder_connect_tcp (RfbDecoder * decoder, gchar * addr, guint port)
{
@@ -631,46 +609,3 @@ rfb_decoder_state_server_cut_text (RfbDecoder * decoder)
return FALSE;
}
-
-static RfbBuffer *
-rfb_socket_get_buffer (gint length, gpointer user_data)
-{
- RfbBuffer *buffer;
- gint fd = GPOINTER_TO_INT (user_data);
- gint ret;
-
- buffer = rfb_buffer_new ();
-
- buffer->data = g_malloc (length);
- buffer->free_data = (RfbBufferFreeFunc) g_free;
-
- // g_print ("calling read(%d, %p, %d)\n", fd, buffer->data, length);
- ret = read (fd, buffer->data, length);
- if (ret <= 0) {
- g_critical ("read: %s", strerror (errno));
- rfb_buffer_free (buffer);
- return NULL;
- }
-
- buffer->length = ret;
-
- return buffer;
-}
-
-static gint
-rfb_socket_send_buffer (guint8 * buffer, gint length, gpointer user_data)
-{
- gint fd = GPOINTER_TO_INT (user_data);
- gint ret;
-
- // g_print ("calling write(%d, %p, %d)\n", fd, buffer, length);
- ret = write (fd, buffer, length);
- if (ret < 0) {
- g_critical ("write: %s", strerror (errno));
- return 0;
- }
-
- g_assert (ret == length);
-
- return ret;
-}
diff --git a/gst/librfb/rfbdecoder.h b/gst/librfb/rfbdecoder.h
index d6fec5f6..5d7d983e 100644
--- a/gst/librfb/rfbdecoder.h
+++ b/gst/librfb/rfbdecoder.h
@@ -2,7 +2,6 @@
#define _LIBRFB_DECODER_H_
#include <glib.h>
-#include <librfb/rfbbytestream.h>
G_BEGIN_DECLS
@@ -32,7 +31,6 @@ struct _RfbDecoder
gpointer buffer_handler_data;
gint fd;
- RfbBytestream *bytestream;
gpointer decoder_private;