[-]
[+]
|
Changed |
libguac-client-vnc.changes
|
|
[-]
[+]
|
Changed |
libguac-client-vnc.spec
^
|
|
[-]
[+]
|
Changed |
libguac-client-vnc-0.7.2.tar.bz2/AUTHORS
^
|
@@ -1 +1,3 @@
Michael Jumper <zhangmaike@users.sourceforge.net>
+James Muehlner <james.muehlner@guac-dev.org>
+Saul Gio Perez <gio.perez@sv.cmu.edu>
|
[-]
[+]
|
Changed |
libguac-client-vnc-0.7.2.tar.bz2/ChangeLog
^
|
@@ -1,3 +1,15 @@
+2013-05-23 James Muehlner <james.muehlner@guac-dev.org>
+
+ * convert() should return NULL only on malloc failure (fixes #313)
+
+2013-02-07 Saul Gio Perez <gio.perez@sv.cmu.edu>
+
+ * Implement color-depth parameter (fixes #272)
+
+2012-10-15 Michael Jumper <zhangmaike@users.sourceforge.net>
+
+ * Fix m4/ autoreconf error
+
2011-05-04 Michael Jumper <zhangmaike@users.sourceforge.net>
* Migrated to 0.6.0 version of libguac API
|
[-]
[+]
|
Changed |
libguac-client-vnc-0.7.2.tar.bz2/Makefile.am
^
|
@@ -41,8 +41,8 @@
lib_LTLIBRARIES = libguac-client-vnc.la
-libguac_client_vnc_la_SOURCES = src/client.c src/vnc_handlers.c src/guac_handlers.c
-noinst_HEADERS = include/client.h include/vnc_handlers.h include/guac_handlers.h
+libguac_client_vnc_la_SOURCES = src/client.c src/vnc_handlers.c src/guac_handlers.c src/convert.c
+noinst_HEADERS = include/client.h include/vnc_handlers.h include/guac_handlers.h include/convert.h
libguac_client_vnc_la_LDFLAGS = -version-info 0:0:0
|
[-]
[+]
|
Changed |
libguac-client-vnc-0.7.2.tar.bz2/Makefile.in
^
|
@@ -113,7 +113,7 @@
LTLIBRARIES = $(lib_LTLIBRARIES)
libguac_client_vnc_la_LIBADD =
am_libguac_client_vnc_la_OBJECTS = client.lo vnc_handlers.lo \
- guac_handlers.lo
+ guac_handlers.lo convert.lo
libguac_client_vnc_la_OBJECTS = $(am_libguac_client_vnc_la_OBJECTS)
libguac_client_vnc_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -262,8 +262,8 @@
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = -Werror -Wall -pedantic -Iinclude
lib_LTLIBRARIES = libguac-client-vnc.la
-libguac_client_vnc_la_SOURCES = src/client.c src/vnc_handlers.c src/guac_handlers.c
-noinst_HEADERS = include/client.h include/vnc_handlers.h include/guac_handlers.h
+libguac_client_vnc_la_SOURCES = src/client.c src/vnc_handlers.c src/guac_handlers.c src/convert.c
+noinst_HEADERS = include/client.h include/vnc_handlers.h include/guac_handlers.h include/convert.h
libguac_client_vnc_la_LDFLAGS = -version-info 0:0:0
EXTRA_DIST = LICENSE
all: all-am
@@ -345,6 +345,7 @@
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/convert.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/guac_handlers.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vnc_handlers.Plo@am__quote@
@@ -390,6 +391,13 @@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o guac_handlers.lo `test -f 'src/guac_handlers.c' || echo '$(srcdir)/'`src/guac_handlers.c
+convert.lo: src/convert.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT convert.lo -MD -MP -MF $(DEPDIR)/convert.Tpo -c -o convert.lo `test -f 'src/convert.c' || echo '$(srcdir)/'`src/convert.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/convert.Tpo $(DEPDIR)/convert.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='src/convert.c' object='convert.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o convert.lo `test -f 'src/convert.c' || echo '$(srcdir)/'`src/convert.c
+
mostlyclean-libtool:
-rm -f *.lo
@@ -543,7 +551,7 @@
*.zip*) \
unzip $(distdir).zip ;;\
esac
- chmod -R a-w $(distdir); chmod a+w $(distdir)
+ chmod -R a-w $(distdir); chmod u+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
|
[-]
[+]
|
Changed |
libguac-client-vnc-0.7.2.tar.bz2/configure
^
|
@@ -2758,7 +2758,7 @@
# Define the identity of the package.
PACKAGE=libguac-client-vnc
- VERSION=0.6.0
+ VERSION=0.7.2
cat >>confdefs.h <<_ACEOF
@@ -10555,7 +10555,7 @@
# Checks for header files.
-for ac_header in stdlib.h string.h syslog.h guacamole/client.h guacamole/socket.h guacamole/protocol.h
+for ac_header in stdlib.h string.h syslog.h guacamole/client.h guacamole/socket.h guacamole/protocol.h iconv.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
[-]
[+]
|
Changed |
libguac-client-vnc-0.7.2.tar.bz2/configure.in
^
|
@@ -35,7 +35,7 @@
# ***** END LICENSE BLOCK *****
AC_INIT(src/client.c)
-AM_INIT_AUTOMAKE([libguac-client-vnc], 0.6.0)
+AM_INIT_AUTOMAKE([libguac-client-vnc], 0.7.2)
AC_CONFIG_MACRO_DIR([m4])
# Checks for programs.
@@ -48,7 +48,7 @@
AC_CHECK_LIB([vncclient], [rfbInitClient],, AC_MSG_ERROR("libvncclient is required"))
# Checks for header files.
-AC_CHECK_HEADERS([stdlib.h string.h syslog.h guacamole/client.h guacamole/socket.h guacamole/protocol.h])
+AC_CHECK_HEADERS([stdlib.h string.h syslog.h guacamole/client.h guacamole/socket.h guacamole/protocol.h iconv.h])
# Checks for library functions.
AC_FUNC_MALLOC
|
[-]
[+]
|
Added |
libguac-client-vnc-0.7.2.tar.bz2/include/convert.h
^
|
@@ -0,0 +1,53 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac-client-vnc.
+ *
+ * The Initial Developer of the Original Code is
+ * James Muehlner.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef __GUAC_VNC_VNC_CONVERT_H
+#define __GUAC_VNC_VNC_CONVERT_H
+
+#include <iconv.h>
+
+/**
+ * Converts a string from one charset to another. Returns a newly allocated string.
+ * @param from_charset The string representing the character set to convert from.
+ * @param to_charset The string representing the character set to convert to.
+ * @return A newly allocated string that is the result of the conversion, or NULL
+ * if an error has occured.
+ */
+char* convert (const char* from_charset, const char* to_charset, const char* input);
+
+#endif
+
|
[-]
[+]
|
Changed |
libguac-client-vnc-0.7.2.tar.bz2/include/vnc_handlers.h
^
|
@@ -48,6 +48,7 @@
void guac_vnc_cut_text(rfbClient* client, const char* text, int textlen);
void guac_vnc_client_log_info(const char* format, ...);
void guac_vnc_client_log_error(const char* format, ...);
+void guac_vnc_set_pixel_format(rfbClient* client, int color_depth);
#endif
|
[-]
[+]
|
Changed |
libguac-client-vnc-0.7.2.tar.bz2/src/client.c
^
|
@@ -56,6 +56,7 @@
"encodings",
"password",
"swap-red-blue",
+ "color-depth",
NULL
};
@@ -75,7 +76,7 @@
/*** PARSE ARGUMENTS ***/
- if (argc < 6) {
+ if (argc < 7) {
guac_protocol_send_error(client->socket, "Wrong argument count received.");
guac_socket_flush(client->socket);
return 1;
@@ -117,7 +118,10 @@
/* Password */
rfb_client->GetPassword = guac_vnc_get_password;
-
+
+ /* Depth */
+ guac_vnc_set_pixel_format(rfb_client, atoi(argv[6]));
+
/* Hook into allocation so we can handle resize. */
guac_client_data->rfb_MallocFrameBuffer = rfb_client->MallocFrameBuffer;
rfb_client->MallocFrameBuffer = guac_vnc_malloc_framebuffer;
|
[-]
[+]
|
Added |
libguac-client-vnc-0.7.2.tar.bz2/src/convert.c
^
|
@@ -0,0 +1,116 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac-client-vnc.
+ *
+ * The Initial Developer of the Original Code is
+ * James Muehlner.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include <stdlib.h>
+#include <string.h>
+#include <iconv.h>
+#include <errno.h>
+
+char* convert(const char* from_charset, const char* to_charset, const char* input) {
+ size_t input_remaining;
+ size_t output_remaining;
+ size_t bytes_converted = 0;
+ char* output;
+ char* output_buffer;
+ char* new_buffer;
+ char* input_buffer;
+ size_t output_length;
+ iconv_t cd;
+
+ cd = iconv_open(to_charset, from_charset);
+
+ if(cd == (iconv_t) -1)
+ /* Cannot convert due to invalid character set */
+ return NULL;
+
+ input_remaining = strlen(input);
+ input_buffer = (char*) input;
+
+ /* Start the output buffer the same size as the input buffer */
+ output_length = input_remaining;
+
+ /* Leave some space at the end for NULL terminator */
+ if (!(output = (char*) malloc(output_length + 4))) {
+ /* Cannot convert due to memory allocation error */
+ iconv_close(cd);
+ return NULL;
+ }
+
+ do {
+ output_buffer = output + bytes_converted;
+ output_remaining = output_length - bytes_converted;
+
+ bytes_converted = iconv(cd, &input_buffer,
+ &input_remaining, &output_buffer, &output_remaining);
+
+ if(bytes_converted == -1) {
+ if(errno == E2BIG) {
+ /* The output buffer is too small, so allocate more space */
+ bytes_converted = output_buffer - output;
+ output_length += input_remaining * 2 + 8;
+
+ if (!(new_buffer = (char*) realloc(output, output_length + 4))) {
+ /* Cannot convert due to memory allocation error */
+ iconv_close(cd);
+ free(output);
+ return NULL;
+ }
+
+ output = new_buffer;
+ output_buffer = output + bytes_converted;
+ }
+ else if (errno == EILSEQ) {
+ /* Invalid sequence detected, return what's been converted so far */
+ break;
+ }
+ else if (errno == EINVAL) {
+ /* Incomplete sequence detected, can be ignored */
+ break;
+ }
+ }
+ } while (input_remaining);
+
+ /* Flush the iconv conversion */
+ iconv(cd, NULL, NULL, &output_buffer, &output_remaining);
+ iconv_close(cd);
+
+ /* Add the NULL terminator */
+ memset(output_buffer, 0, 4);
+
+ return output;
+}
+
|
[-]
[+]
|
Changed |
libguac-client-vnc-0.7.2.tar.bz2/src/guac_handlers.c
^
|
@@ -38,12 +38,14 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#include <iconv.h>
#include <rfb/rfbclient.h>
#include <guacamole/client.h>
#include "client.h"
+#include "convert.h"
int vnc_guac_client_handle_messages(guac_client* client) {
@@ -92,7 +94,21 @@
rfbClient* rfb_client = ((vnc_guac_client_data*) client->data)->rfb_client;
- SendClientCutText(rfb_client, data, strlen(data));
+ /* Convert UTF-8 character data to ISO_8859-1 */
+ # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 || _LIBICONV_VERSION >= 0x0105
+ char* iso_8559_1_data = convert("UTF-8", "ISO_8859-1//TRANSLIT", data);
+ #else
+ char* iso_8559_1_data = convert("UTF-8", "ISO_8859-1", data);
+ #endif
+
+ /* If the conversion was successful, send the converted character data. */
+ if(iso_8559_1_data) {
+ SendClientCutText(rfb_client, iso_8559_1_data, strlen(iso_8559_1_data));
+ free(iso_8559_1_data);
+ /* Otherwise, just send an empty string. */
+ }
+ else
+ SendClientCutText(rfb_client, "", 0);
return 0;
}
|
[-]
[+]
|
Changed |
libguac-client-vnc-0.7.2.tar.bz2/src/vnc_handlers.c
^
|
@@ -38,6 +38,7 @@
#include <stdlib.h>
#include <time.h>
#include <syslog.h>
+#include <iconv.h>
#include <cairo/cairo.h>
@@ -48,6 +49,7 @@
#include <guacamole/client.h>
#include "client.h"
+#include "convert.h"
void guac_vnc_cursor(rfbClient* client, int x, int y, int w, int h, int bpp) {
@@ -251,6 +253,44 @@
return ((vnc_guac_client_data*) gc->data)->password;
}
+void guac_vnc_set_pixel_format(rfbClient* client, int color_depth) {
+ switch(color_depth) {
+ case 8:
+ client->format.depth = 8;
+ client->format.bitsPerPixel = 8;
+ client->format.blueShift = 6;
+ client->format.redShift = 0;
+ client->format.greenShift = 3;
+ client->format.blueMax = 3;
+ client->format.redMax = 7;
+ client->format.greenMax = 7;
+ break;
+
+ case 16:
+ client->format.depth = 16;
+ client->format.bitsPerPixel = 16;
+ client->format.blueShift = 0;
+ client->format.redShift = 11;
+ client->format.greenShift = 5;
+ client->format.blueMax = 0x1f;
+ client->format.redMax = 0x1f;
+ client->format.greenMax = 0x3f;
+ break;
+
+ case 24:
+ case 32:
+ default:
+ client->format.depth = 24;
+ client->format.bitsPerPixel = 32;
+ client->format.blueShift = 0;
+ client->format.redShift = 16;
+ client->format.greenShift = 8;
+ client->format.blueMax = 0xff;
+ client->format.redMax = 0xff;
+ client->format.greenMax = 0xff;
+ }
+}
+
rfbBool guac_vnc_malloc_framebuffer(rfbClient* rfb_client) {
guac_client* gc = rfbClientGetClientData(rfb_client, __GUAC_CLIENT);
@@ -269,7 +309,12 @@
guac_client* gc = rfbClientGetClientData(client, __GUAC_CLIENT);
guac_socket* socket = gc->socket;
- guac_protocol_send_clipboard(socket, text);
+ /* Convert ASCII character data to UTF-8 */
+ char* utf8_text = convert("ISO_8859-1", "UTF-8", text);
+
+ guac_protocol_send_clipboard(socket, utf8_text);
+
+ free(utf8_text);
}
|