From c5173f364f98230bb51fa8c1baf79d171e2c9e72 Mon Sep 17 00:00:00 2001 From: dscho Date: Thu, 31 Jan 2008 11:52:50 +0000 Subject: [PATCH] Fix Swap16IfLE() on bytes When swapping the values for the colour table to little-endian (because they are 16-bit values), we need to cast "unsigned char" to "unsigned short"; otherwise, Microsoft's compiler would keep complaining. Noticed by Christian Ehrlicher. Signed-off-by: Johannes Schindelin --- libvncserver/rfbserver.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libvncserver/rfbserver.c b/libvncserver/rfbserver.c index e809110..3dd2f29 100644 --- a/libvncserver/rfbserver.c +++ b/libvncserver/rfbserver.c @@ -3093,9 +3093,9 @@ rfbSendSetColourMapEntries(rfbClientPtr cl, rgb[i*3+1] = Swap16IfLE(cm->data.shorts[i*3+1]); rgb[i*3+2] = Swap16IfLE(cm->data.shorts[i*3+2]); } else { - rgb[i*3] = Swap16IfLE(cm->data.bytes[i*3]); - rgb[i*3+1] = Swap16IfLE(cm->data.bytes[i*3+1]); - rgb[i*3+2] = Swap16IfLE(cm->data.bytes[i*3+2]); + rgb[i*3] = Swap16IfLE((unsigned short)cm->data.bytes[i*3]); + rgb[i*3+1] = Swap16IfLE((unsigned short)cm->data.bytes[i*3+1]); + rgb[i*3+2] = Swap16IfLE((unsigned short)cm->data.bytes[i*3+2]); } } }