From 324d13853ffcd3cda7a9189695c5d5b61ae0c07b Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Wed, 17 Jul 2013 11:54:24 -0700 Subject: [PATCH] Switch to UINT* and BOOL types. --- src/protocols/rdp/client.c | 86 +++++++++++++++++-------------- src/protocols/rdp/guac_handlers.c | 8 ++- src/protocols/rdp/rdp_bitmap.c | 16 ++++-- src/protocols/rdp/rdp_bitmap.h | 10 +++- src/protocols/rdp/rdp_cliprdr.c | 12 +++-- src/protocols/rdp/rdp_gdi.c | 12 +++-- src/protocols/rdp/rdp_glyph.c | 10 +++- src/protocols/rdp/rdp_glyph.h | 10 +++- 8 files changed, 106 insertions(+), 58 deletions(-) diff --git a/src/protocols/rdp/client.c b/src/protocols/rdp/client.c index 26931a48..ff77d5a1 100644 --- a/src/protocols/rdp/client.c +++ b/src/protocols/rdp/client.c @@ -58,6 +58,12 @@ #include #include +#ifdef ENABLE_WINPR +#include +#else +#include "compat/winpr-wtypes.h" +#endif + #include #include #include @@ -117,11 +123,11 @@ enum RDP_ARGS_IDX { RDP_ARGS_COUNT }; -int __guac_receive_channel_data(freerdp* rdp_inst, int channelId, uint8* data, int size, int flags, int total_size) { +int __guac_receive_channel_data(freerdp* rdp_inst, int channelId, UINT8* data, int size, int flags, int total_size) { return freerdp_channels_data(rdp_inst, channelId, data, size, flags, total_size); } -boolean rdp_freerdp_pre_connect(freerdp* instance) { +BOOL rdp_freerdp_pre_connect(freerdp* instance) { rdpContext* context = instance->context; guac_client* client = ((rdp_freerdp_context*) context)->client; @@ -270,14 +276,14 @@ boolean rdp_freerdp_pre_connect(freerdp* instance) { if (freerdp_channels_pre_connect(channels, instance)) { guac_protocol_send_error(client->socket, "Error initializing RDP client channel manager"); guac_socket_flush(client->socket); - return false; + return FALSE; } - return true; + return TRUE; } -boolean rdp_freerdp_post_connect(freerdp* instance) { +BOOL rdp_freerdp_post_connect(freerdp* instance) { rdpContext* context = instance->context; guac_client* client = ((rdp_freerdp_context*) context)->client; @@ -287,7 +293,7 @@ boolean rdp_freerdp_post_connect(freerdp* instance) { if (freerdp_channels_post_connect(channels, instance)) { guac_protocol_send_error(client->socket, "Error initializing RDP client channel manager"); guac_socket_flush(client->socket); - return false; + return FALSE; } /* Client handlers */ @@ -297,7 +303,7 @@ boolean rdp_freerdp_post_connect(freerdp* instance) { client->key_handler = rdp_guac_client_key_handler; client->clipboard_handler = rdp_guac_client_clipboard_handler; - return true; + return TRUE; } @@ -348,7 +354,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) { char* hostname; int port = RDP_DEFAULT_PORT; - boolean bitmap_cache; + BOOL bitmap_cache; /** * Selected server-side keymap. Client will be assumed to also use this @@ -398,17 +404,17 @@ int guac_client_init(guac_client* client, int argc, char** argv) { settings = rdp_inst->settings; /* Console */ - settings->console_session = (strcmp(argv[IDX_CONSOLE], "true") == 0); - settings->console_audio = (strcmp(argv[IDX_CONSOLE_AUDIO], "true") == 0); + settings->console_session = (strcmp(argv[IDX_CONSOLE], "TRUE") == 0); + settings->console_audio = (strcmp(argv[IDX_CONSOLE_AUDIO], "TRUE") == 0); /* --no-auth */ - settings->authentication = false; + settings->authentication = FALSE; /* --sec rdp */ - settings->rdp_security = true; - settings->tls_security = false; - settings->nla_security = false; - settings->encryption = true; + settings->rdp_security = TRUE; + settings->tls_security = FALSE; + settings->nla_security = FALSE; + settings->encryption = TRUE; settings->encryption_method = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS; settings->encryption_level = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE; @@ -479,44 +485,44 @@ int guac_client_init(guac_client* client, int argc, char** argv) { /* Audio enable/disable */ guac_client_data->audio_enabled = - (strcmp(argv[IDX_DISABLE_AUDIO], "true") != 0); + (strcmp(argv[IDX_DISABLE_AUDIO], "TRUE") != 0); /* Printing enable/disable */ guac_client_data->printing_enabled = - (strcmp(argv[IDX_ENABLE_PRINTING], "true") == 0); + (strcmp(argv[IDX_ENABLE_PRINTING], "TRUE") == 0); /* Order support */ bitmap_cache = settings->bitmap_cache; settings->os_major_type = OSMAJORTYPE_UNSPECIFIED; settings->os_minor_type = OSMINORTYPE_UNSPECIFIED; - settings->order_support[NEG_DSTBLT_INDEX] = true; - settings->order_support[NEG_PATBLT_INDEX] = false; /* PATBLT not yet supported */ - settings->order_support[NEG_SCRBLT_INDEX] = true; - settings->order_support[NEG_OPAQUE_RECT_INDEX] = true; - settings->order_support[NEG_DRAWNINEGRID_INDEX] = false; - settings->order_support[NEG_MULTIDSTBLT_INDEX] = false; - settings->order_support[NEG_MULTIPATBLT_INDEX] = false; - settings->order_support[NEG_MULTISCRBLT_INDEX] = false; - settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = false; - settings->order_support[NEG_MULTI_DRAWNINEGRID_INDEX] = false; - settings->order_support[NEG_LINETO_INDEX] = false; - settings->order_support[NEG_POLYLINE_INDEX] = false; + settings->order_support[NEG_DSTBLT_INDEX] = TRUE; + settings->order_support[NEG_PATBLT_INDEX] = FALSE; /* PATBLT not yet supported */ + settings->order_support[NEG_SCRBLT_INDEX] = TRUE; + settings->order_support[NEG_OPAQUE_RECT_INDEX] = TRUE; + settings->order_support[NEG_DRAWNINEGRID_INDEX] = FALSE; + settings->order_support[NEG_MULTIDSTBLT_INDEX] = FALSE; + settings->order_support[NEG_MULTIPATBLT_INDEX] = FALSE; + settings->order_support[NEG_MULTISCRBLT_INDEX] = FALSE; + settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = FALSE; + settings->order_support[NEG_MULTI_DRAWNINEGRID_INDEX] = FALSE; + settings->order_support[NEG_LINETO_INDEX] = FALSE; + settings->order_support[NEG_POLYLINE_INDEX] = FALSE; settings->order_support[NEG_MEMBLT_INDEX] = bitmap_cache; - settings->order_support[NEG_MEM3BLT_INDEX] = false; + settings->order_support[NEG_MEM3BLT_INDEX] = FALSE; settings->order_support[NEG_MEMBLT_V2_INDEX] = bitmap_cache; - settings->order_support[NEG_MEM3BLT_V2_INDEX] = false; - settings->order_support[NEG_SAVEBITMAP_INDEX] = false; - settings->order_support[NEG_GLYPH_INDEX_INDEX] = true; - settings->order_support[NEG_FAST_INDEX_INDEX] = true; - settings->order_support[NEG_FAST_GLYPH_INDEX] = true; - settings->order_support[NEG_POLYGON_SC_INDEX] = false; - settings->order_support[NEG_POLYGON_CB_INDEX] = false; - settings->order_support[NEG_ELLIPSE_SC_INDEX] = false; - settings->order_support[NEG_ELLIPSE_CB_INDEX] = false; + settings->order_support[NEG_MEM3BLT_V2_INDEX] = FALSE; + settings->order_support[NEG_SAVEBITMAP_INDEX] = FALSE; + settings->order_support[NEG_GLYPH_INDEX_INDEX] = TRUE; + settings->order_support[NEG_FAST_INDEX_INDEX] = TRUE; + settings->order_support[NEG_FAST_GLYPH_INDEX] = TRUE; + settings->order_support[NEG_POLYGON_SC_INDEX] = FALSE; + settings->order_support[NEG_POLYGON_CB_INDEX] = FALSE; + settings->order_support[NEG_ELLIPSE_SC_INDEX] = FALSE; + settings->order_support[NEG_ELLIPSE_CB_INDEX] = FALSE; /* Store client data */ guac_client_data->rdp_inst = rdp_inst; - guac_client_data->bounded = false; + guac_client_data->bounded = FALSE; guac_client_data->mouse_button_mask = 0; guac_client_data->current_surface = GUAC_DEFAULT_LAYER; guac_client_data->clipboard = NULL; diff --git a/src/protocols/rdp/guac_handlers.c b/src/protocols/rdp/guac_handlers.c index 006332a2..95a2fb8d 100644 --- a/src/protocols/rdp/guac_handlers.c +++ b/src/protocols/rdp/guac_handlers.c @@ -54,6 +54,12 @@ #include #include +#ifdef ENABLE_WINPR +#include +#else +#include "compat/winpr-wtypes.h" +#endif + #include #include #include @@ -424,7 +430,7 @@ int rdp_guac_client_clipboard_handler(guac_client* client, char* data) { ((rdp_guac_client_data*) client->data)->clipboard = strdup(data); /* Notify server that text data is now available */ - format_list->formats = (uint32*) malloc(sizeof(uint32)); + format_list->formats = (UINT32*) malloc(sizeof(UINT32)); format_list->formats[0] = CB_FORMAT_TEXT; format_list->num_formats = 1; diff --git a/src/protocols/rdp/rdp_bitmap.c b/src/protocols/rdp/rdp_bitmap.c index 8cb45008..c36b8646 100644 --- a/src/protocols/rdp/rdp_bitmap.c +++ b/src/protocols/rdp/rdp_bitmap.c @@ -50,6 +50,12 @@ #include #include +#ifdef ENABLE_WINPR +#include +#else +#include "compat/winpr-wtypes.h" +#endif + #include "client.h" #include "rdp_bitmap.h" @@ -165,7 +171,7 @@ void guac_rdp_bitmap_free(rdpContext* context, rdpBitmap* bitmap) { } -void guac_rdp_bitmap_setsurface(rdpContext* context, rdpBitmap* bitmap, boolean primary) { +void guac_rdp_bitmap_setsurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary) { guac_client* client = ((rdp_freerdp_context*) context)->client; if (primary) @@ -191,21 +197,21 @@ void guac_rdp_bitmap_setsurface(rdpContext* context, rdpBitmap* bitmap, boolean } -void guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap, uint8* data, int width, int height, int bpp, int length, boolean compressed) { +void guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap, UINT8* data, int width, int height, int bpp, int length, BOOL compressed) { int size = width * height * (bpp + 7) / 8; if (bitmap->data == NULL) - bitmap->data = (uint8*) malloc(size); + bitmap->data = (UINT8*) malloc(size); else - bitmap->data = (uint8*) realloc(bitmap->data, size); + bitmap->data = (UINT8*) realloc(bitmap->data, size); if (compressed) bitmap_decompress(data, bitmap->data, width, height, length, bpp, bpp); else freerdp_image_flip(data, bitmap->data, width, height, bpp); - bitmap->compressed = false; + bitmap->compressed = FALSE; bitmap->length = size; bitmap->bpp = bpp; diff --git a/src/protocols/rdp/rdp_bitmap.h b/src/protocols/rdp/rdp_bitmap.h index b4cdd1e0..00867e8a 100644 --- a/src/protocols/rdp/rdp_bitmap.h +++ b/src/protocols/rdp/rdp_bitmap.h @@ -40,6 +40,12 @@ #include +#ifdef ENABLE_WINPR +#include +#else +#include "compat/winpr-wtypes.h" +#endif + #include typedef struct guac_rdp_bitmap { @@ -63,9 +69,9 @@ typedef struct guac_rdp_bitmap { void guac_rdp_cache_bitmap(rdpContext* context, rdpBitmap* bitmap); void guac_rdp_bitmap_new(rdpContext* context, rdpBitmap* bitmap); -void guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap, uint8* data, int width, int height, int bpp, int length, boolean compressed); +void guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap, UINT8* data, int width, int height, int bpp, int length, BOOL compressed); void guac_rdp_bitmap_paint(rdpContext* context, rdpBitmap* bitmap); void guac_rdp_bitmap_free(rdpContext* context, rdpBitmap* bitmap); -void guac_rdp_bitmap_setsurface(rdpContext* context, rdpBitmap* bitmap, boolean primary); +void guac_rdp_bitmap_setsurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary); #endif diff --git a/src/protocols/rdp/rdp_cliprdr.c b/src/protocols/rdp/rdp_cliprdr.c index 168e3dd0..846913ec 100644 --- a/src/protocols/rdp/rdp_cliprdr.c +++ b/src/protocols/rdp/rdp_cliprdr.c @@ -41,6 +41,12 @@ #include #include +#ifdef ENABLE_WINPR +#include +#else +#include "compat/winpr-wtypes.h" +#endif + #include #include @@ -92,7 +98,7 @@ void guac_rdp_process_cb_monitor_ready(guac_client* client, RDP_EVENT* event) { /* Received notification of clipboard support. */ /* Respond with supported format list */ - format_list->formats = (uint32*) malloc(sizeof(uint32)); + format_list->formats = (UINT32*) malloc(sizeof(UINT32)); format_list->formats[0] = CB_FORMAT_TEXT; format_list->num_formats = 1; @@ -159,11 +165,11 @@ void guac_rdp_process_cb_data_request(guac_client* client, /* Set data and length */ if (clipboard != NULL) { - data_response->data = (uint8*) strdup(clipboard); + data_response->data = (UINT8*) strdup(clipboard); data_response->size = strlen(clipboard) + 1; } else { - data_response->data = (uint8*) strdup(""); + data_response->data = (UINT8*) strdup(""); data_response->size = 1; } diff --git a/src/protocols/rdp/rdp_gdi.c b/src/protocols/rdp/rdp_gdi.c index fa6b4fdb..ac850160 100644 --- a/src/protocols/rdp/rdp_gdi.c +++ b/src/protocols/rdp/rdp_gdi.c @@ -39,6 +39,12 @@ #include #include +#ifdef ENABLE_WINPR +#include +#else +#include "compat/winpr-wtypes.h" +#endif + #include #include "client.h" @@ -421,7 +427,7 @@ void guac_rdp_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt) { void guac_rdp_gdi_opaquerect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect) { guac_client* client = ((rdp_freerdp_context*) context)->client; - uint32 color = freerdp_color_convert_var(opaque_rect->color, + UINT32 color = freerdp_color_convert_var(opaque_rect->color, context->instance->settings->color_depth, 32, ((rdp_freerdp_context*) context)->clrconv); @@ -464,11 +470,11 @@ void guac_rdp_gdi_set_bounds(rdpContext* context, rdpBounds* bounds) { /* If no bounds given, clear bounding rect */ if (bounds == NULL) - data->bounded = false; + data->bounded = FALSE; /* Otherwise, set bounding rectangle */ else { - data->bounded = true; + data->bounded = TRUE; data->bounds_left = bounds->left; data->bounds_top = bounds->top; data->bounds_right = bounds->right; diff --git a/src/protocols/rdp/rdp_glyph.c b/src/protocols/rdp/rdp_glyph.c index 44f33ef4..7d784d38 100644 --- a/src/protocols/rdp/rdp_glyph.c +++ b/src/protocols/rdp/rdp_glyph.c @@ -39,6 +39,12 @@ #include #include +#ifdef ENABLE_WINPR +#include +#else +#include "compat/winpr-wtypes.h" +#endif + #include #include @@ -131,7 +137,7 @@ void guac_rdp_glyph_free(rdpContext* context, rdpGlyph* glyph) { } void guac_rdp_glyph_begindraw(rdpContext* context, - int x, int y, int width, int height, uint32 fgcolor, uint32 bgcolor) { + int x, int y, int width, int height, UINT32 fgcolor, UINT32 bgcolor) { guac_client* client = ((rdp_freerdp_context*) context)->client; rdp_guac_client_data* guac_client_data = @@ -203,7 +209,7 @@ void guac_rdp_glyph_begindraw(rdpContext* context, } void guac_rdp_glyph_enddraw(rdpContext* context, - int x, int y, int width, int height, uint32 fgcolor, uint32 bgcolor) { + int x, int y, int width, int height, UINT32 fgcolor, UINT32 bgcolor) { guac_client* client = ((rdp_freerdp_context*) context)->client; rdp_guac_client_data* guac_client_data = (rdp_guac_client_data*) client->data; diff --git a/src/protocols/rdp/rdp_glyph.h b/src/protocols/rdp/rdp_glyph.h index 2c9510a3..4efa53d5 100644 --- a/src/protocols/rdp/rdp_glyph.h +++ b/src/protocols/rdp/rdp_glyph.h @@ -40,6 +40,12 @@ #include +#ifdef ENABLE_WINPR +#include +#else +#include "compat/winpr-wtypes.h" +#endif + #include typedef struct guac_rdp_glyph { @@ -60,8 +66,8 @@ void guac_rdp_glyph_new(rdpContext* context, rdpGlyph* glyph); void guac_rdp_glyph_draw(rdpContext* context, rdpGlyph* glyph, int x, int y); void guac_rdp_glyph_free(rdpContext* context, rdpGlyph* glyph); void guac_rdp_glyph_begindraw(rdpContext* context, - int x, int y, int width, int height, uint32 fgcolor, uint32 bgcolor); + int x, int y, int width, int height, UINT32 fgcolor, UINT32 bgcolor); void guac_rdp_glyph_enddraw(rdpContext* context, - int x, int y, int width, int height, uint32 fgcolor, uint32 bgcolor); + int x, int y, int width, int height, UINT32 fgcolor, UINT32 bgcolor); #endif