rdp-compositor: fix compilation with FreeRDP 2.0-rc4

Submitted by David Fort on Dec. 4, 2018, 10:43 p.m.

Details

Message ID 20181204224333.3874-1-contact@hardening-consulting.com
State Accepted
Series "rdp-compositor: fix compilation with FreeRDP 2.0-rc4"
Commit 7b7d9d316a9ce9b4f5f50ba766c2963b0fdcbaa5
Headers show

Commit Message

David Fort Dec. 4, 2018, 10:43 p.m.
Some members have been removed from FreeRDP structs, so let's use local
variables.
---
 libweston/compositor-rdp.c | 86 +++++++++++++++++++-------------------
 1 file changed, 43 insertions(+), 43 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libweston/compositor-rdp.c b/libweston/compositor-rdp.c
index 134e7298..871a0a3e 100644
--- a/libweston/compositor-rdp.c
+++ b/libweston/compositor-rdp.c
@@ -67,19 +67,19 @@ 
 #endif
 
 #ifdef HAVE_SURFACE_BITS_BMP
-#define SURFACE_BPP(cmd) cmd->bmp.bpp
-#define SURFACE_CODECID(cmd) cmd->bmp.codecID
-#define SURFACE_WIDTH(cmd) cmd->bmp.width
-#define SURFACE_HEIGHT(cmd) cmd->bmp.height
-#define SURFACE_BITMAP_DATA(cmd) cmd->bmp.bitmapData
-#define SURFACE_BITMAP_DATA_LEN(cmd) cmd->bmp.bitmapDataLength
+#define SURFACE_BPP(cmd) cmd.bmp.bpp
+#define SURFACE_CODECID(cmd) cmd.bmp.codecID
+#define SURFACE_WIDTH(cmd) cmd.bmp.width
+#define SURFACE_HEIGHT(cmd) cmd.bmp.height
+#define SURFACE_BITMAP_DATA(cmd) cmd.bmp.bitmapData
+#define SURFACE_BITMAP_DATA_LEN(cmd) cmd.bmp.bitmapDataLength
 #else
-#define SURFACE_BPP(cmd) cmd->bpp
-#define SURFACE_CODECID(cmd) cmd->codecID
-#define SURFACE_WIDTH(cmd) cmd->width
-#define SURFACE_HEIGHT(cmd) cmd->height
-#define SURFACE_BITMAP_DATA(cmd) cmd->bitmapData
-#define SURFACE_BITMAP_DATA_LEN(cmd) cmd->bitmapDataLength
+#define SURFACE_BPP(cmd) cmd.bpp
+#define SURFACE_CODECID(cmd) cmd.codecID
+#define SURFACE_WIDTH(cmd) cmd.width
+#define SURFACE_HEIGHT(cmd) cmd.height
+#define SURFACE_BITMAP_DATA(cmd) cmd.bitmapData
+#define SURFACE_BITMAP_DATA_LEN(cmd) cmd.bitmapDataLength
 #endif
 
 #include <freerdp/freerdp.h>
@@ -198,7 +198,7 @@  rdp_peer_refresh_rfx(pixman_region32_t *damage, pixman_image_t *image, freerdp_p
 	uint32_t *ptr;
 	RFX_RECT *rfxRect;
 	rdpUpdate *update = peer->update;
-	SURFACE_BITS_COMMAND *cmd = &update->surface_bits_command;
+	SURFACE_BITS_COMMAND cmd;
 	RdpPeerContext *context = (RdpPeerContext *)peer->context;
 
 	Stream_Clear(context->encode_stream);
@@ -208,14 +208,14 @@  rdp_peer_refresh_rfx(pixman_region32_t *damage, pixman_image_t *image, freerdp_p
 	height = (damage->extents.y2 - damage->extents.y1);
 
 #ifdef HAVE_SKIP_COMPRESSION
-	cmd->skipCompression = TRUE;
+	cmd.skipCompression = TRUE;
 #else
-	memset(cmd, 0, sizeof(*cmd));
+	memset(&cmd, 0, sizeof(*cmd));
 #endif
-	cmd->destLeft = damage->extents.x1;
-	cmd->destTop = damage->extents.y1;
-	cmd->destRight = damage->extents.x2;
-	cmd->destBottom = damage->extents.y2;
+	cmd.destLeft = damage->extents.x1;
+	cmd.destTop = damage->extents.y1;
+	cmd.destRight = damage->extents.x2;
+	cmd.destBottom = damage->extents.y2;
 	SURFACE_BPP(cmd) = 32;
 	SURFACE_CODECID(cmd) = peer->settings->RemoteFxCodecId;
 	SURFACE_WIDTH(cmd) = width;
@@ -245,7 +245,7 @@  rdp_peer_refresh_rfx(pixman_region32_t *damage, pixman_image_t *image, freerdp_p
 	SURFACE_BITMAP_DATA_LEN(cmd) = Stream_GetPosition(context->encode_stream);
 	SURFACE_BITMAP_DATA(cmd) = Stream_Buffer(context->encode_stream);
 
-	update->SurfaceBits(update->context, cmd);
+	update->SurfaceBits(update->context, &cmd);
 }
 
 
@@ -255,7 +255,7 @@  rdp_peer_refresh_nsc(pixman_region32_t *damage, pixman_image_t *image, freerdp_p
 	int width, height;
 	uint32_t *ptr;
 	rdpUpdate *update = peer->update;
-	SURFACE_BITS_COMMAND *cmd = &update->surface_bits_command;
+	SURFACE_BITS_COMMAND cmd;
 	RdpPeerContext *context = (RdpPeerContext *)peer->context;
 
 	Stream_Clear(context->encode_stream);
@@ -265,15 +265,15 @@  rdp_peer_refresh_nsc(pixman_region32_t *damage, pixman_image_t *image, freerdp_p
 	height = (damage->extents.y2 - damage->extents.y1);
 
 #ifdef HAVE_SKIP_COMPRESSION
-	cmd->skipCompression = TRUE;
+	cmd.skipCompression = TRUE;
 #else
 	memset(cmd, 0, sizeof(*cmd));
 #endif
 
-	cmd->destLeft = damage->extents.x1;
-	cmd->destTop = damage->extents.y1;
-	cmd->destRight = damage->extents.x2;
-	cmd->destBottom = damage->extents.y2;
+	cmd.destLeft = damage->extents.x1;
+	cmd.destTop = damage->extents.y1;
+	cmd.destRight = damage->extents.x2;
+	cmd.destBottom = damage->extents.y2;
 	SURFACE_BPP(cmd) = 32;
 	SURFACE_CODECID(cmd) = peer->settings->NSCodecId;
 	SURFACE_WIDTH(cmd) = width;
@@ -289,7 +289,7 @@  rdp_peer_refresh_nsc(pixman_region32_t *damage, pixman_image_t *image, freerdp_p
 	SURFACE_BITMAP_DATA_LEN(cmd) = Stream_GetPosition(context->encode_stream);
 	SURFACE_BITMAP_DATA(cmd) = Stream_Buffer(context->encode_stream);
 
-	update->SurfaceBits(update->context, cmd);
+	update->SurfaceBits(update->context, &cmd);
 }
 
 static void
@@ -310,8 +310,8 @@  static void
 rdp_peer_refresh_raw(pixman_region32_t *region, pixman_image_t *image, freerdp_peer *peer)
 {
 	rdpUpdate *update = peer->update;
-	SURFACE_BITS_COMMAND *cmd = &update->surface_bits_command;
-	SURFACE_FRAME_MARKER *marker = &update->surface_frame_marker;
+	SURFACE_BITS_COMMAND cmd;
+	SURFACE_FRAME_MARKER marker;
 	pixman_box32_t *rect, subrect;
 	int nrects, i;
 	int heightIncrement, remainingHeight, top;
@@ -320,18 +320,18 @@  rdp_peer_refresh_raw(pixman_region32_t *region, pixman_image_t *image, freerdp_p
 	if (!nrects)
 		return;
 
-	marker->frameId++;
-	marker->frameAction = SURFACECMD_FRAMEACTION_BEGIN;
-	update->SurfaceFrameMarker(peer->context, marker);
+	marker.frameId++;
+	marker.frameAction = SURFACECMD_FRAMEACTION_BEGIN;
+	update->SurfaceFrameMarker(peer->context, &marker);
 
-	memset(cmd, 0, sizeof(*cmd));
+	memset(&cmd, 0, sizeof(cmd));
 	SURFACE_BPP(cmd) = 32;
 	SURFACE_CODECID(cmd) = 0;
 
 	for (i = 0; i < nrects; i++, rect++) {
 		/*weston_log("rect(%d,%d, %d,%d)\n", rect->x1, rect->y1, rect->x2, rect->y2);*/
-		cmd->destLeft = rect->x1;
-		cmd->destRight = rect->x2;
+		cmd.destLeft = rect->x1;
+		cmd.destRight = rect->x2;
 		SURFACE_WIDTH(cmd) = rect->x2 - rect->x1;
 
 		heightIncrement = peer->settings->MultifragMaxRequestSize / (16 + SURFACE_WIDTH(cmd) * 4);
@@ -343,8 +343,8 @@  rdp_peer_refresh_raw(pixman_region32_t *region, pixman_image_t *image, freerdp_p
 
 		while (remainingHeight) {
 			   SURFACE_HEIGHT(cmd) = (remainingHeight > heightIncrement) ? heightIncrement : remainingHeight;
-			   cmd->destTop = top;
-			   cmd->destBottom = top + SURFACE_HEIGHT(cmd);
+			   cmd.destTop = top;
+			   cmd.destBottom = top + SURFACE_HEIGHT(cmd);
 			   SURFACE_BITMAP_DATA_LEN(cmd) = SURFACE_WIDTH(cmd) * SURFACE_HEIGHT(cmd) * 4;
 			   SURFACE_BITMAP_DATA(cmd) = (BYTE *)realloc(SURFACE_BITMAP_DATA(cmd), SURFACE_BITMAP_DATA_LEN(cmd));
 
@@ -353,15 +353,15 @@  rdp_peer_refresh_raw(pixman_region32_t *region, pixman_image_t *image, freerdp_p
 			   pixman_image_flipped_subrect(&subrect, image, SURFACE_BITMAP_DATA(cmd));
 
 			   /*weston_log("*  sending (%d,%d, %d,%d)\n", subrect.x1, subrect.y1, subrect.x2, subrect.y2); */
-			   update->SurfaceBits(peer->context, cmd);
+			   update->SurfaceBits(peer->context, &cmd);
 
 			   remainingHeight -= SURFACE_HEIGHT(cmd);
 			   top += SURFACE_HEIGHT(cmd);
 		}
 	}
 
-	marker->frameAction = SURFACECMD_FRAMEACTION_END;
-	update->SurfaceFrameMarker(peer->context, marker);
+	marker.frameAction = SURFACECMD_FRAMEACTION_END;
+	update->SurfaceFrameMarker(peer->context, &marker);
 }
 
 static void
@@ -956,7 +956,7 @@  xf_peer_activate(freerdp_peer* client)
 	pixman_box32_t box;
 	pixman_region32_t damage;
 	char seat_name[50];
-
+	POINTER_SYSTEM_UPDATE pointer_system;
 
 	peerCtx = (RdpPeerContext *)client->context;
 	b = peerCtx->rdpBackend;
@@ -1056,8 +1056,8 @@  xf_peer_activate(freerdp_peer* client)
 
 	/* disable pointer on the client side */
 	pointer = client->update->pointer;
-	pointer->pointer_system.type = SYSPTR_NULL;
-	pointer->PointerSystem(client->context, &pointer->pointer_system);
+	pointer_system.type = SYSPTR_NULL;
+	pointer->PointerSystem(client->context, &pointer_system);
 
 	/* sends a full refresh */
 	box.x1 = 0;