From aeea99a87fbb8ec490dbd966744b99388ee6c73f Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Wed, 17 Jul 2013 10:22:03 -0700 Subject: [PATCH] Detect types availability. --- configure.ac | 6 +++ src/protocols/rdp/compat/winpr-wtypes.h | 51 +++++++++++++++++++ .../rdp/guac_rdpsnd/rdpsnd_messages.c | 5 +- .../rdp/guac_rdpsnd/rdpsnd_service.c | 15 ++++-- src/protocols/rdp/rdp_keymap.h | 8 ++- 5 files changed, 78 insertions(+), 7 deletions(-) create mode 100644 src/protocols/rdp/compat/winpr-wtypes.h diff --git a/configure.ac b/configure.ac index a5d82d8e..db3c35a9 100644 --- a/configure.ac +++ b/configure.ac @@ -253,6 +253,12 @@ AC_CHECK_HEADER(winpr/stream.h,, # <-- stab AC_CHECK_LIB([freerdp-utils], [stream_write_uint8],, # <-- stable-1.0 [have_freerdp=no])]) +# Check for types in WinPR +AC_CHECK_HEADER(winpr/wtypes.h,, # <-- stable-1.1 + [have_winpr=no, + AC_CHECK_HEADER(freerdp/types.h,, # <-- stable-1.0 + [have_freerdp=no])]) + if test "x${have_winpr}" = "xyes" then AC_DEFINE([ENABLE_WINPR]) diff --git a/src/protocols/rdp/compat/winpr-wtypes.h b/src/protocols/rdp/compat/winpr-wtypes.h new file mode 100644 index 00000000..6fe7fee0 --- /dev/null +++ b/src/protocols/rdp/compat/winpr-wtypes.h @@ -0,0 +1,51 @@ +/* ***** 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-rdp. + * + * The Initial Developer of the Original Code is + * Michael Jumper. + * 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_WINPR_WTYPES_COMPAT_H +#define __GUAC_WINPR_WTYPES_COMPAT_H + +#include + +typedef uint8 UINT8; +typedef uint16 UINT16; +typedef uint32 UINT32; +typedef boolean BOOL; + +#define TRUE true +#define FALSE true + +#endif + diff --git a/src/protocols/rdp/guac_rdpsnd/rdpsnd_messages.c b/src/protocols/rdp/guac_rdpsnd/rdpsnd_messages.c index fd6aaba3..72b9fdb0 100644 --- a/src/protocols/rdp/guac_rdpsnd/rdpsnd_messages.c +++ b/src/protocols/rdp/guac_rdpsnd/rdpsnd_messages.c @@ -39,13 +39,14 @@ #include #include #include -#include #include #ifdef ENABLE_WINPR #include +#include #else -#include "winpr-compat/stream.h" +#include "compat/winpr-stream.h" +#include "compat/winpr-wtypes.h" #endif #include diff --git a/src/protocols/rdp/guac_rdpsnd/rdpsnd_service.c b/src/protocols/rdp/guac_rdpsnd/rdpsnd_service.c index dc254901..b37024f0 100644 --- a/src/protocols/rdp/guac_rdpsnd/rdpsnd_service.c +++ b/src/protocols/rdp/guac_rdpsnd/rdpsnd_service.c @@ -40,9 +40,16 @@ #include #include -#include #include +#ifdef ENABLE_WINPR +#include +#include +#else +#include "compat/winpr-stream.h" +#include "compat/winpr-wtypes.h" +#endif + #include #include "audio.h" @@ -93,9 +100,9 @@ void guac_rdpsnd_process_receive(rdpSvcPlugin* plugin, plugin->channel_entry_points.pExtendedData; /* Read RDPSND PDU header */ - stream_read_uint8(input_stream, header.message_type); - stream_seek_uint8(input_stream); - stream_read_uint16(input_stream, header.body_size); + Stream_Read_UINT8(input_stream, header.message_type); + Stream_Seek_UINT8(input_stream); + Stream_Read_UINT16(input_stream, header.body_size); /* * If next PDU is SNDWAVE (due to receiving WaveInfo PDU previously), diff --git a/src/protocols/rdp/rdp_keymap.h b/src/protocols/rdp/rdp_keymap.h index fcefdea1..1b18c0cd 100644 --- a/src/protocols/rdp/rdp_keymap.h +++ b/src/protocols/rdp/rdp_keymap.h @@ -44,6 +44,12 @@ #include #endif +#ifdef ENABLE_WINPR +#include +#else +#include "compat/winpr-wtypes.h" +#endif + /** * Represents a keysym-to-scancode mapping for RDP, with extra information * about the state of prerequisite keysyms. @@ -107,7 +113,7 @@ struct guac_rdp_keymap { * keymap. If this keymap is selected, this layout * will be requested from the server. */ - const uint32 freerdp_keyboard_layout; + const UINT32 freerdp_keyboard_layout; };