libfreerdp-core: code style cleanup

This commit is contained in:
Marc-André Moreau 2013-01-18 16:50:25 -05:00
parent 04c6f689cc
commit 930c9907ce
3 changed files with 154 additions and 139 deletions

View File

@ -152,14 +152,14 @@ static INLINE BOOL update_read_coord(STREAM* s, INT32* coord, BOOL delta)
if (delta)
{
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, lsi8);
*coord += lsi8;
}
else
{
if(stream_get_left(s) < 2)
if (stream_get_left(s) < 2)
return FALSE;
stream_read_UINT16(s, lsi16);
*coord = lsi16;
@ -171,7 +171,7 @@ static INLINE BOOL update_read_color(STREAM* s, UINT32* color)
{
BYTE byte;
if(stream_get_left(s) < 3)
if (stream_get_left(s) < 3)
return FALSE;
stream_read_BYTE(s, byte);
*color = byte;
@ -212,13 +212,13 @@ static INLINE BOOL update_read_2byte_unsigned(STREAM* s, UINT32* value)
{
BYTE byte;
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, byte);
if (byte & 0x80)
{
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
*value = (byte & 0x7F) << 8;
@ -237,7 +237,7 @@ static INLINE BOOL update_read_2byte_signed(STREAM* s, INT32* value)
BYTE byte;
BOOL negative;
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, byte);
@ -248,7 +248,7 @@ static INLINE BOOL update_read_2byte_signed(STREAM* s, INT32* value)
if (byte & 0x80)
{
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, byte);
*value = (*value << 8) | byte;
@ -264,12 +264,12 @@ static INLINE BOOL update_read_4byte_unsigned(STREAM* s, UINT32* value)
BYTE byte;
BYTE count;
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, byte);
count = (byte & 0xC0) >> 6;
if(stream_get_left(s) < count)
if (stream_get_left(s) < count)
return FALSE;
switch (count)
@ -312,7 +312,7 @@ static INLINE BOOL update_read_delta(STREAM* s, INT32* value)
{
BYTE byte;
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, byte);
@ -323,7 +323,7 @@ static INLINE BOOL update_read_delta(STREAM* s, INT32* value)
if (byte & 0x80)
{
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, byte);
*value = (*value << 8) | byte;
@ -357,28 +357,28 @@ static INLINE BOOL update_read_brush(STREAM* s, rdpBrush* brush, BYTE fieldFlags
{
if (fieldFlags & ORDER_FIELD_01)
{
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, brush->x);
}
if (fieldFlags & ORDER_FIELD_02)
{
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, brush->y);
}
if (fieldFlags & ORDER_FIELD_03)
{
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, brush->style);
}
if (fieldFlags & ORDER_FIELD_04)
{
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, brush->hatch);
}
@ -395,7 +395,7 @@ static INLINE BOOL update_read_brush(STREAM* s, rdpBrush* brush, BYTE fieldFlags
if (fieldFlags & ORDER_FIELD_05)
{
if(stream_get_left(s) < 7)
if (stream_get_left(s) < 7)
return FALSE;
brush->data = (BYTE*) brush->p8x8;
stream_read_BYTE(s, brush->data[7]);
@ -422,7 +422,7 @@ static INLINE BOOL update_read_delta_rects(STREAM* s, DELTA_RECT* rectangles, in
zeroBitsSize = ((number + 1) / 2);
if(stream_get_left(s) < zeroBitsSize)
if (stream_get_left(s) < zeroBitsSize)
return FALSE;
stream_get_mark(s, zeroBits);
stream_seek(s, zeroBitsSize);
@ -442,7 +442,7 @@ static INLINE BOOL update_read_delta_rects(STREAM* s, DELTA_RECT* rectangles, in
if (~flags & 0x20)
{
if(!update_read_delta(s, &rectangles[i].width))
if (!update_read_delta(s, &rectangles[i].width))
return FALSE;
}
else
@ -450,7 +450,7 @@ static INLINE BOOL update_read_delta_rects(STREAM* s, DELTA_RECT* rectangles, in
if (~flags & 0x10)
{
if(!update_read_delta(s, &rectangles[i].height))
if (!update_read_delta(s, &rectangles[i].height))
return FALSE;
}
else
@ -473,7 +473,7 @@ static INLINE BOOL update_read_delta_points(STREAM* s, DELTA_POINT* points, int
zeroBitsSize = ((number + 3) / 4);
if(stream_get_left(s) < zeroBitsSize)
if (stream_get_left(s) < zeroBitsSize)
return FALSE;
stream_get_mark(s, zeroBits);
stream_seek(s, zeroBitsSize);
@ -501,7 +501,7 @@ static INLINE BOOL update_read_delta_points(STREAM* s, DELTA_POINT* points, int
do {\
if (orderInfo->fieldFlags & (1 << (NO-1))) \
{ \
if(stream_get_left(s) < 1) \
if (stream_get_left(s) < 1) \
return FALSE; \
stream_read_BYTE(s, TARGET); \
} \
@ -511,7 +511,7 @@ static INLINE BOOL update_read_delta_points(STREAM* s, DELTA_POINT* points, int
do {\
if (orderInfo->fieldFlags & (1 << (NO-1))) \
{ \
if(stream_get_left(s) < 2) \
if (stream_get_left(s) < 2) \
return FALSE; \
stream_read_BYTE(s, TARGET1); \
stream_read_BYTE(s, TARGET2); \
@ -522,7 +522,7 @@ static INLINE BOOL update_read_delta_points(STREAM* s, DELTA_POINT* points, int
do {\
if (orderInfo->fieldFlags & (1 << (NO-1))) \
{ \
if(stream_get_left(s) < 2) \
if (stream_get_left(s) < 2) \
return FALSE; \
stream_read_UINT16(s, TARGET); \
} \
@ -531,7 +531,7 @@ static INLINE BOOL update_read_delta_points(STREAM* s, DELTA_POINT* points, int
do {\
if (orderInfo->fieldFlags & (1 << (NO-1))) \
{ \
if(stream_get_left(s) < 4) \
if (stream_get_left(s) < 4) \
return FALSE; \
stream_read_UINT32(s, TARGET); \
} \
@ -545,10 +545,10 @@ static INLINE BOOL update_read_delta_points(STREAM* s, DELTA_POINT* points, int
return FALSE
#define FIELD_SKIP_BUFFER16(s, TARGET_LEN) \
if(stream_get_left(s) < 2) \
if (stream_get_left(s) < 2) \
return FALSE; \
stream_read_UINT16(s, TARGET_LEN); \
if(!stream_skip(s, TARGET_LEN)) \
if (!stream_skip(s, TARGET_LEN)) \
return FALSE
@ -599,21 +599,21 @@ BOOL update_read_opaque_rect_order(STREAM* s, ORDER_INFO* orderInfo, OPAQUE_RECT
if (orderInfo->fieldFlags & ORDER_FIELD_05)
{
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, byte);
opaque_rect->color = (opaque_rect->color & 0xFFFFFF00) | byte;
}
if (orderInfo->fieldFlags & ORDER_FIELD_06) {
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, byte);
opaque_rect->color = (opaque_rect->color & 0xFFFF00FF) | (byte << 8);
}
if (orderInfo->fieldFlags & ORDER_FIELD_07) {
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, byte);
opaque_rect->color = (opaque_rect->color & 0xFF00FFFF) | (byte << 16);
@ -642,7 +642,7 @@ BOOL update_read_multi_dstblt_order(STREAM* s, ORDER_INFO* orderInfo, MULTI_DSTB
if (orderInfo->fieldFlags & ORDER_FIELD_07)
{
if(stream_get_left(s) < 2)
if (stream_get_left(s) < 2)
return FALSE;
stream_read_UINT16(s, multi_dstblt->cbData);
return update_read_delta_rects(s, multi_dstblt->rectangles, multi_dstblt->numRectangles);
@ -660,17 +660,17 @@ BOOL update_read_multi_patblt_order(STREAM* s, ORDER_INFO* orderInfo, MULTI_PATB
ORDER_FIELD_COLOR(6, multi_patblt->backColor);
ORDER_FIELD_COLOR(7, multi_patblt->foreColor);
if(!update_read_brush(s, &multi_patblt->brush, orderInfo->fieldFlags >> 7))
if (!update_read_brush(s, &multi_patblt->brush, orderInfo->fieldFlags >> 7))
return FALSE;
ORDER_FIELD_BYTE(13, multi_patblt->numRectangles);
if (orderInfo->fieldFlags & ORDER_FIELD_14)
{
if(stream_get_left(s) < 2)
if (stream_get_left(s) < 2)
return FALSE;
stream_read_UINT16(s, multi_patblt->cbData);
if(!update_read_delta_rects(s, multi_patblt->rectangles, multi_patblt->numRectangles))
if (!update_read_delta_rects(s, multi_patblt->rectangles, multi_patblt->numRectangles))
return FALSE;
}
return TRUE;
@ -689,7 +689,7 @@ BOOL update_read_multi_scrblt_order(STREAM* s, ORDER_INFO* orderInfo, MULTI_SCRB
if (orderInfo->fieldFlags & ORDER_FIELD_09)
{
if(stream_get_left(s) < 2)
if (stream_get_left(s) < 2)
return FALSE;
stream_read_UINT16(s, multi_scrblt->cbData);
return update_read_delta_rects(s, multi_scrblt->rectangles, multi_scrblt->numRectangles);
@ -707,7 +707,7 @@ BOOL update_read_multi_opaque_rect_order(STREAM* s, ORDER_INFO* orderInfo, MULTI
if (orderInfo->fieldFlags & ORDER_FIELD_05)
{
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, byte);
multi_opaque_rect->color = (multi_opaque_rect->color & 0xFFFFFF00) | byte;
@ -715,7 +715,7 @@ BOOL update_read_multi_opaque_rect_order(STREAM* s, ORDER_INFO* orderInfo, MULTI
if (orderInfo->fieldFlags & ORDER_FIELD_06)
{
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, byte);
multi_opaque_rect->color = (multi_opaque_rect->color & 0xFFFF00FF) | (byte << 8);
@ -723,7 +723,7 @@ BOOL update_read_multi_opaque_rect_order(STREAM* s, ORDER_INFO* orderInfo, MULTI
if (orderInfo->fieldFlags & ORDER_FIELD_07)
{
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, byte);
multi_opaque_rect->color = (multi_opaque_rect->color & 0xFF00FFFF) | (byte << 16);
@ -733,7 +733,7 @@ BOOL update_read_multi_opaque_rect_order(STREAM* s, ORDER_INFO* orderInfo, MULTI
if (orderInfo->fieldFlags & ORDER_FIELD_09)
{
if(stream_get_left(s) < 2)
if (stream_get_left(s) < 2)
return FALSE;
stream_read_UINT16(s, multi_opaque_rect->cbData);
return update_read_delta_rects(s, multi_opaque_rect->rectangles, multi_opaque_rect->numRectangles);
@ -786,7 +786,7 @@ BOOL update_read_polyline_order(STREAM* s, ORDER_INFO* orderInfo, POLYLINE_ORDER
if (orderInfo->fieldFlags & ORDER_FIELD_07)
{
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, polyline->cbData);
@ -830,7 +830,7 @@ BOOL update_read_mem3blt_order(STREAM* s, ORDER_INFO* orderInfo, MEM3BLT_ORDER*
ORDER_FIELD_COLOR(9, mem3blt->backColor);
ORDER_FIELD_COLOR(10, mem3blt->foreColor);
if(!update_read_brush(s, &mem3blt->brush, orderInfo->fieldFlags >> 10))
if (!update_read_brush(s, &mem3blt->brush, orderInfo->fieldFlags >> 10))
return FALSE;
ORDER_FIELD_UINT16(16, mem3blt->cacheIndex);
@ -867,7 +867,7 @@ BOOL update_read_glyph_index_order(STREAM* s, ORDER_INFO* orderInfo, GLYPH_INDEX
ORDER_FIELD_UINT16(13, glyph_index->opRight);
ORDER_FIELD_UINT16(14, glyph_index->opBottom);
if(!update_read_brush(s, &glyph_index->brush, orderInfo->fieldFlags >> 14))
if (!update_read_brush(s, &glyph_index->brush, orderInfo->fieldFlags >> 14))
return FALSE;
ORDER_FIELD_UINT16(20, glyph_index->x);
@ -875,11 +875,11 @@ BOOL update_read_glyph_index_order(STREAM* s, ORDER_INFO* orderInfo, GLYPH_INDEX
if (orderInfo->fieldFlags & ORDER_FIELD_22)
{
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, glyph_index->cbData);
if(stream_get_left(s) < glyph_index->cbData)
if (stream_get_left(s) < glyph_index->cbData)
return FALSE;
memcpy(glyph_index->data, s->p, glyph_index->cbData);
stream_seek(s, glyph_index->cbData);
@ -908,11 +908,11 @@ BOOL update_read_fast_index_order(STREAM* s, ORDER_INFO* orderInfo, FAST_INDEX_O
if (orderInfo->fieldFlags & ORDER_FIELD_15)
{
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, fast_index->cbData);
if(stream_get_left(s) < fast_index->cbData)
if (stream_get_left(s) < fast_index->cbData)
return FALSE;
memcpy(fast_index->data, s->p, fast_index->cbData);
stream_seek(s, fast_index->cbData);
@ -944,10 +944,10 @@ BOOL update_read_fast_glyph_order(STREAM* s, ORDER_INFO* orderInfo, FAST_GLYPH_O
if (orderInfo->fieldFlags & ORDER_FIELD_15)
{
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, fast_glyph->cbData);
if(stream_get_left(s) < fast_glyph->cbData)
if (stream_get_left(s) < fast_glyph->cbData)
return FALSE;
memcpy(fast_glyph->data, s->p, fast_glyph->cbData);
phold = s->p;
@ -959,14 +959,14 @@ BOOL update_read_fast_glyph_order(STREAM* s, ORDER_INFO* orderInfo, FAST_GLYPH_O
/* parse optional glyph data */
glyph = (GLYPH_DATA_V2*) malloc(sizeof(GLYPH_DATA_V2));
glyph->cacheIndex = fast_glyph->data[0];
if(!update_read_2byte_signed(s, &glyph->x) ||
if (!update_read_2byte_signed(s, &glyph->x) ||
!update_read_2byte_signed(s, &glyph->y) ||
!update_read_2byte_unsigned(s, &glyph->cx) ||
!update_read_2byte_unsigned(s, &glyph->cy))
return FALSE;
glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy;
glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0;
if(stream_get_left(s) < glyph->cb)
if (stream_get_left(s) < glyph->cb)
return FALSE;
glyph->aj = (BYTE*) malloc(glyph->cb);
stream_read(s, glyph->aj, glyph->cb);
@ -988,7 +988,7 @@ BOOL update_read_polygon_sc_order(STREAM* s, ORDER_INFO* orderInfo, POLYGON_SC_O
if (orderInfo->fieldFlags & ORDER_FIELD_07)
{
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, polygon_sc->cbData);
@ -1011,14 +1011,14 @@ BOOL update_read_polygon_cb_order(STREAM* s, ORDER_INFO* orderInfo, POLYGON_CB_O
ORDER_FIELD_COLOR(5, polygon_cb->backColor);
ORDER_FIELD_COLOR(6, polygon_cb->foreColor);
if(!update_read_brush(s, &polygon_cb->brush, orderInfo->fieldFlags >> 6))
if (!update_read_brush(s, &polygon_cb->brush, orderInfo->fieldFlags >> 6))
return FALSE;
ORDER_FIELD_BYTE(12, polygon_cb->numPoints);
if (orderInfo->fieldFlags & ORDER_FIELD_13)
{
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, polygon_cb->cbData);
@ -1027,7 +1027,7 @@ BOOL update_read_polygon_cb_order(STREAM* s, ORDER_INFO* orderInfo, POLYGON_CB_O
else
polygon_cb->points = (DELTA_POINT*) realloc(polygon_cb->points, sizeof(DELTA_POINT) * polygon_cb->numPoints);
if(!update_read_delta_points(s, polygon_cb->points, polygon_cb->numPoints, polygon_cb->xStart, polygon_cb->yStart))
if (!update_read_delta_points(s, polygon_cb->points, polygon_cb->numPoints, polygon_cb->xStart, polygon_cb->yStart))
return FALSE;
}
@ -1065,7 +1065,7 @@ BOOL update_read_ellipse_cb_order(STREAM* s, ORDER_INFO* orderInfo, ELLIPSE_CB_O
BOOL update_read_cache_bitmap_order(STREAM* s, CACHE_BITMAP_ORDER* cache_bitmap_order, BOOL compressed, UINT16 flags)
{
if(stream_get_left(s) < 9)
if (stream_get_left(s) < 9)
return FALSE;
stream_read_BYTE(s, cache_bitmap_order->cacheId); /* cacheId (1 byte) */
stream_seek_BYTE(s); /* pad1Octet (1 byte) */
@ -1080,13 +1080,13 @@ BOOL update_read_cache_bitmap_order(STREAM* s, CACHE_BITMAP_ORDER* cache_bitmap_
if ((flags & NO_BITMAP_COMPRESSION_HDR) == 0)
{
BYTE* bitmapComprHdr = (BYTE*) &(cache_bitmap_order->bitmapComprHdr);
if(stream_get_left(s) < 8)
if (stream_get_left(s) < 8)
return FALSE;
stream_read(s, bitmapComprHdr, 8); /* bitmapComprHdr (8 bytes) */
cache_bitmap_order->bitmapLength -= 8;
}
if(stream_get_left(s) < cache_bitmap_order->bitmapLength)
if (stream_get_left(s) < cache_bitmap_order->bitmapLength)
return FALSE;
stream_get_mark(s, cache_bitmap_order->bitmapDataStream);
@ -1094,7 +1094,7 @@ BOOL update_read_cache_bitmap_order(STREAM* s, CACHE_BITMAP_ORDER* cache_bitmap_
}
else
{
if(stream_get_left(s) < cache_bitmap_order->bitmapLength)
if (stream_get_left(s) < cache_bitmap_order->bitmapLength)
return FALSE;
stream_get_mark(s, cache_bitmap_order->bitmapDataStream);
@ -1116,7 +1116,7 @@ BOOL update_read_cache_bitmap_v2_order(STREAM* s, CACHE_BITMAP_V2_ORDER* cache_b
if (cache_bitmap_v2_order->flags & CBR2_PERSISTENT_KEY_PRESENT)
{
if(stream_get_left(s) < 8)
if (stream_get_left(s) < 8)
return FALSE;
stream_read_UINT32(s, cache_bitmap_v2_order->key1); /* key1 (4 bytes) */
stream_read_UINT32(s, cache_bitmap_v2_order->key2); /* key2 (4 bytes) */
@ -1124,18 +1124,18 @@ BOOL update_read_cache_bitmap_v2_order(STREAM* s, CACHE_BITMAP_V2_ORDER* cache_b
if (cache_bitmap_v2_order->flags & CBR2_HEIGHT_SAME_AS_WIDTH)
{
if(!update_read_2byte_unsigned(s, &cache_bitmap_v2_order->bitmapWidth)) /* bitmapWidth */
if (!update_read_2byte_unsigned(s, &cache_bitmap_v2_order->bitmapWidth)) /* bitmapWidth */
return FALSE;
cache_bitmap_v2_order->bitmapHeight = cache_bitmap_v2_order->bitmapWidth;
}
else
{
if(!update_read_2byte_unsigned(s, &cache_bitmap_v2_order->bitmapWidth) || /* bitmapWidth */
if (!update_read_2byte_unsigned(s, &cache_bitmap_v2_order->bitmapWidth) || /* bitmapWidth */
!update_read_2byte_unsigned(s, &cache_bitmap_v2_order->bitmapHeight)) /* bitmapHeight */
return FALSE;
}
if(!update_read_4byte_unsigned(s, &cache_bitmap_v2_order->bitmapLength) || /* bitmapLength */
if (!update_read_4byte_unsigned(s, &cache_bitmap_v2_order->bitmapLength) || /* bitmapLength */
!update_read_2byte_unsigned(s, &cache_bitmap_v2_order->cacheIndex)) /* cacheIndex */
return FALSE;
@ -1146,7 +1146,7 @@ BOOL update_read_cache_bitmap_v2_order(STREAM* s, CACHE_BITMAP_V2_ORDER* cache_b
{
if (!(cache_bitmap_v2_order->flags & CBR2_NO_BITMAP_COMPRESSION_HDR))
{
if(stream_get_left(s) < 8)
if (stream_get_left(s) < 8)
return FALSE;
stream_read_UINT16(s, cache_bitmap_v2_order->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */
@ -1156,14 +1156,14 @@ BOOL update_read_cache_bitmap_v2_order(STREAM* s, CACHE_BITMAP_V2_ORDER* cache_b
cache_bitmap_v2_order->bitmapLength = cache_bitmap_v2_order->cbCompMainBodySize;
}
if(stream_get_left(s) < cache_bitmap_v2_order->bitmapLength)
if (stream_get_left(s) < cache_bitmap_v2_order->bitmapLength)
return FALSE;
stream_get_mark(s, cache_bitmap_v2_order->bitmapDataStream);
stream_seek(s, cache_bitmap_v2_order->bitmapLength);
}
else
{
if(stream_get_left(s) < cache_bitmap_v2_order->bitmapLength)
if (stream_get_left(s) < cache_bitmap_v2_order->bitmapLength)
return FALSE;
stream_get_mark(s, cache_bitmap_v2_order->bitmapDataStream);
stream_seek(s, cache_bitmap_v2_order->bitmapLength);
@ -1183,7 +1183,7 @@ BOOL update_read_cache_bitmap_v3_order(STREAM* s, CACHE_BITMAP_V3_ORDER* cache_b
bitsPerPixelId = (flags & 0x00000078) >> 3;
cache_bitmap_v3_order->bpp = CBR23_BPP[bitsPerPixelId];
if(stream_get_left(s) < 21)
if (stream_get_left(s) < 21)
return FALSE;
stream_read_UINT16(s, cache_bitmap_v3_order->cacheIndex); /* cacheIndex (2 bytes) */
stream_read_UINT32(s, cache_bitmap_v3_order->key1); /* key1 (4 bytes) */
@ -1199,7 +1199,7 @@ BOOL update_read_cache_bitmap_v3_order(STREAM* s, CACHE_BITMAP_V3_ORDER* cache_b
stream_read_UINT16(s, bitmapData->height); /* height (2 bytes) */
stream_read_UINT32(s, bitmapData->length); /* length (4 bytes) */
if(stream_get_left(s) < bitmapData->length)
if (stream_get_left(s) < bitmapData->length)
return FALSE;
if (bitmapData->data == NULL)
bitmapData->data = (BYTE*) malloc(bitmapData->length);
@ -1215,12 +1215,12 @@ BOOL update_read_cache_color_table_order(STREAM* s, CACHE_COLOR_TABLE_ORDER* cac
int i;
UINT32* colorTable;
if(stream_get_left(s) < 3)
if (stream_get_left(s) < 3)
return FALSE;
stream_read_BYTE(s, cache_color_table_order->cacheIndex); /* cacheIndex (1 byte) */
stream_read_UINT16(s, cache_color_table_order->numberColors); /* numberColors (2 bytes) */
if(stream_get_left(s) < cache_color_table_order->numberColors * 4)
if (stream_get_left(s) < cache_color_table_order->numberColors * 4)
return FALSE;
colorTable = cache_color_table_order->colorTable;
@ -1245,7 +1245,7 @@ BOOL update_read_cache_glyph_order(STREAM* s, CACHE_GLYPH_ORDER* cache_glyph_ord
INT16 lsi16;
GLYPH_DATA* glyph;
if(stream_get_left(s) < 2)
if (stream_get_left(s) < 2)
return FALSE;
stream_read_BYTE(s, cache_glyph_order->cacheId); /* cacheId (1 byte) */
stream_read_BYTE(s, cache_glyph_order->cGlyphs); /* cGlyphs (1 byte) */
@ -1258,7 +1258,7 @@ BOOL update_read_cache_glyph_order(STREAM* s, CACHE_GLYPH_ORDER* cache_glyph_ord
}
glyph = cache_glyph_order->glyphData[i];
if(stream_get_left(s) < 10)
if (stream_get_left(s) < 10)
return FALSE;
stream_read_UINT16(s, glyph->cacheIndex);
stream_read_UINT16(s, lsi16);
@ -1271,7 +1271,7 @@ BOOL update_read_cache_glyph_order(STREAM* s, CACHE_GLYPH_ORDER* cache_glyph_ord
glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy;
glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0;
if(stream_get_left(s) < glyph->cb)
if (stream_get_left(s) < glyph->cb)
return FALSE;
glyph->aj = (BYTE*) malloc(glyph->cb);
stream_read(s, glyph->aj, glyph->cb);
@ -1300,11 +1300,11 @@ BOOL update_read_cache_glyph_v2_order(STREAM* s, CACHE_GLYPH_V2_ORDER* cache_gly
}
glyph = cache_glyph_v2_order->glyphData[i];
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, glyph->cacheIndex);
if(!update_read_2byte_signed(s, &glyph->x) ||
if (!update_read_2byte_signed(s, &glyph->x) ||
!update_read_2byte_signed(s, &glyph->y) ||
!update_read_2byte_unsigned(s, &glyph->cx) ||
!update_read_2byte_unsigned(s, &glyph->cy))
@ -1315,7 +1315,7 @@ BOOL update_read_cache_glyph_v2_order(STREAM* s, CACHE_GLYPH_V2_ORDER* cache_gly
glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy;
glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0;
if(stream_get_left(s) < glyph->cb)
if (stream_get_left(s) < glyph->cb)
return FALSE;
glyph->aj = (BYTE*) malloc(glyph->cb);
stream_read(s, glyph->aj, glyph->cb);
@ -1338,7 +1338,7 @@ BOOL update_decompress_brush(STREAM* s, BYTE* output, BYTE bpp)
palette = s->p + 16;
bytesPerPixel = ((bpp + 1) / 8);
if(stream_get_left(s) < 16) // 64 / 4
if (stream_get_left(s) < 16) // 64 / 4
return FALSE;
for (y = 7; y >= 0; y--)
@ -1366,7 +1366,7 @@ BOOL update_read_cache_brush_order(STREAM* s, CACHE_BRUSH_ORDER* cache_brush_ord
BYTE iBitmapFormat;
BOOL compressed = FALSE;
if(stream_get_left(s) < 6)
if (stream_get_left(s) < 6)
return FALSE;
stream_read_BYTE(s, cache_brush_order->index); /* cacheEntry (1 byte) */
@ -1393,7 +1393,7 @@ BOOL update_read_cache_brush_order(STREAM* s, CACHE_BRUSH_ORDER* cache_brush_ord
}
/* rows are encoded in reverse order */
if(stream_get_left(s) < 8)
if (stream_get_left(s) < 8)
return FALSE;
for (i = 7; i >= 0; i--)
@ -1413,14 +1413,14 @@ BOOL update_read_cache_brush_order(STREAM* s, CACHE_BRUSH_ORDER* cache_brush_ord
if (compressed != FALSE)
{
/* compressed brush */
if(!update_decompress_brush(s, cache_brush_order->data, cache_brush_order->bpp))
if (!update_decompress_brush(s, cache_brush_order->data, cache_brush_order->bpp))
return FALSE;
}
else
{
/* uncompressed brush */
int scanline = (cache_brush_order->bpp / 8) * 8;
if(stream_get_left(s) < scanline * 8)
if (stream_get_left(s) < scanline * 8)
return FALSE;
for (i = 7; i >= 0; i--)
@ -1441,7 +1441,7 @@ BOOL update_read_create_offscreen_bitmap_order(STREAM* s, CREATE_OFFSCREEN_BITMA
BOOL deleteListPresent;
OFFSCREEN_DELETE_LIST* deleteList;
if(stream_get_left(s) < 6)
if (stream_get_left(s) < 6)
return FALSE;
stream_read_UINT16(s, flags); /* flags (2 bytes) */
create_offscreen_bitmap->id = flags & 0x7FFF;
@ -1454,7 +1454,7 @@ BOOL update_read_create_offscreen_bitmap_order(STREAM* s, CREATE_OFFSCREEN_BITMA
if (deleteListPresent)
{
int i;
if(stream_get_left(s) < 2)
if (stream_get_left(s) < 2)
return FALSE;
stream_read_UINT16(s, deleteList->cIndices);
@ -1464,7 +1464,7 @@ BOOL update_read_create_offscreen_bitmap_order(STREAM* s, CREATE_OFFSCREEN_BITMA
deleteList->indices = realloc(deleteList->indices, deleteList->sIndices * 2);
}
if(stream_get_left(s) < 2 * deleteList->cIndices)
if (stream_get_left(s) < 2 * deleteList->cIndices)
return FALSE;
for (i = 0; i < (int) deleteList->cIndices; i++)
@ -1481,7 +1481,7 @@ BOOL update_read_create_offscreen_bitmap_order(STREAM* s, CREATE_OFFSCREEN_BITMA
BOOL update_read_switch_surface_order(STREAM* s, SWITCH_SURFACE_ORDER* switch_surface)
{
if(stream_get_left(s) < 2)
if (stream_get_left(s) < 2)
return FALSE;
stream_read_UINT16(s, switch_surface->bitmapId); /* bitmapId (2 bytes) */
return TRUE;
@ -1491,7 +1491,7 @@ BOOL update_read_create_nine_grid_bitmap_order(STREAM* s, CREATE_NINE_GRID_BITMA
{
NINE_GRID_BITMAP_INFO* nineGridInfo;
if(stream_get_left(s) < 19)
if (stream_get_left(s) < 19)
return FALSE;
stream_read_BYTE(s, create_nine_grid_bitmap->bitmapBpp); /* bitmapBpp (1 byte) */
stream_read_UINT16(s, create_nine_grid_bitmap->bitmapId); /* bitmapId (2 bytes) */
@ -1508,7 +1508,7 @@ BOOL update_read_create_nine_grid_bitmap_order(STREAM* s, CREATE_NINE_GRID_BITMA
BOOL update_read_frame_marker_order(STREAM* s, FRAME_MARKER_ORDER* frame_marker)
{
if(stream_get_left(s) < 4)
if (stream_get_left(s) < 4)
return FALSE;
stream_read_UINT32(s, frame_marker->action); /* action (4 bytes) */
return TRUE;
@ -1516,7 +1516,7 @@ BOOL update_read_frame_marker_order(STREAM* s, FRAME_MARKER_ORDER* frame_marker)
BOOL update_read_stream_bitmap_first_order(STREAM* s, STREAM_BITMAP_FIRST_ORDER* stream_bitmap_first)
{
if(stream_get_left(s) < 10) // 8 + 2 at least
if (stream_get_left(s) < 10) // 8 + 2 at least
return FALSE;
stream_read_BYTE(s, stream_bitmap_first->bitmapFlags); /* bitmapFlags (1 byte) */
stream_read_BYTE(s, stream_bitmap_first->bitmapBpp); /* bitmapBpp (1 byte) */
@ -1525,11 +1525,11 @@ BOOL update_read_stream_bitmap_first_order(STREAM* s, STREAM_BITMAP_FIRST_ORDER*
stream_read_UINT16(s, stream_bitmap_first->bitmapHeight); /* bitmapHeigth (2 bytes) */
if (stream_bitmap_first->bitmapFlags & STREAM_BITMAP_V2) {
if(stream_get_left(s) < 4)
if (stream_get_left(s) < 4)
return FALSE;
stream_read_UINT32(s, stream_bitmap_first->bitmapSize); /* bitmapSize (4 bytes) */
} else {
if(stream_get_left(s) < 2)
if (stream_get_left(s) < 2)
return FALSE;
stream_read_UINT16(s, stream_bitmap_first->bitmapSize); /* bitmapSize (2 bytes) */
}
@ -1540,7 +1540,7 @@ BOOL update_read_stream_bitmap_first_order(STREAM* s, STREAM_BITMAP_FIRST_ORDER*
BOOL update_read_stream_bitmap_next_order(STREAM* s, STREAM_BITMAP_FIRST_ORDER* stream_bitmap_next)
{
if(stream_get_left(s) < 5)
if (stream_get_left(s) < 5)
return FALSE;
stream_read_BYTE(s, stream_bitmap_next->bitmapFlags); /* bitmapFlags (1 byte) */
stream_read_UINT16(s, stream_bitmap_next->bitmapType); /* bitmapType (2 bytes) */
@ -1550,7 +1550,7 @@ BOOL update_read_stream_bitmap_next_order(STREAM* s, STREAM_BITMAP_FIRST_ORDER*
BOOL update_read_draw_gdiplus_first_order(STREAM* s, DRAW_GDIPLUS_FIRST_ORDER* draw_gdiplus_first)
{
if(stream_get_left(s) < 11)
if (stream_get_left(s) < 11)
return FALSE;
stream_seek_BYTE(s); /* pad1Octet (1 byte) */
stream_read_UINT16(s, draw_gdiplus_first->cbSize); /* cbSize (2 bytes) */
@ -1562,7 +1562,7 @@ BOOL update_read_draw_gdiplus_first_order(STREAM* s, DRAW_GDIPLUS_FIRST_ORDER* d
BOOL update_read_draw_gdiplus_next_order(STREAM* s, DRAW_GDIPLUS_NEXT_ORDER* draw_gdiplus_next)
{
if(stream_get_left(s) < 3)
if (stream_get_left(s) < 3)
return FALSE;
stream_seek_BYTE(s); /* pad1Octet (1 byte) */
FIELD_SKIP_BUFFER16(s, draw_gdiplus_next->cbSize); /* cbSize(2 bytes) + emfRecords */
@ -1571,7 +1571,7 @@ BOOL update_read_draw_gdiplus_next_order(STREAM* s, DRAW_GDIPLUS_NEXT_ORDER* dra
BOOL update_read_draw_gdiplus_end_order(STREAM* s, DRAW_GDIPLUS_END_ORDER* draw_gdiplus_end)
{
if(stream_get_left(s) < 11)
if (stream_get_left(s) < 11)
return FALSE;
stream_seek_BYTE(s); /* pad1Octet (1 byte) */
stream_read_UINT16(s, draw_gdiplus_end->cbSize); /* cbSize (2 bytes) */
@ -1583,7 +1583,7 @@ BOOL update_read_draw_gdiplus_end_order(STREAM* s, DRAW_GDIPLUS_END_ORDER* draw_
BOOL update_read_draw_gdiplus_cache_first_order(STREAM* s, DRAW_GDIPLUS_CACHE_FIRST_ORDER* draw_gdiplus_cache_first)
{
if(stream_get_left(s) < 11)
if (stream_get_left(s) < 11)
return FALSE;
stream_read_BYTE(s, draw_gdiplus_cache_first->flags); /* flags (1 byte) */
stream_read_UINT16(s, draw_gdiplus_cache_first->cacheType); /* cacheType (2 bytes) */
@ -1596,7 +1596,7 @@ BOOL update_read_draw_gdiplus_cache_first_order(STREAM* s, DRAW_GDIPLUS_CACHE_FI
BOOL update_read_draw_gdiplus_cache_next_order(STREAM* s, DRAW_GDIPLUS_CACHE_NEXT_ORDER* draw_gdiplus_cache_next)
{
if(stream_get_left(s) < 7)
if (stream_get_left(s) < 7)
return FALSE;
stream_read_BYTE(s, draw_gdiplus_cache_next->flags); /* flags (1 byte) */
stream_read_UINT16(s, draw_gdiplus_cache_next->cacheType); /* cacheType (2 bytes) */
@ -1608,7 +1608,7 @@ BOOL update_read_draw_gdiplus_cache_next_order(STREAM* s, DRAW_GDIPLUS_CACHE_NEX
BOOL update_read_draw_gdiplus_cache_end_order(STREAM* s, DRAW_GDIPLUS_CACHE_END_ORDER* draw_gdiplus_cache_end)
{
if(stream_get_left(s) < 11)
if (stream_get_left(s) < 11)
return FALSE;
stream_read_BYTE(s, draw_gdiplus_cache_end->flags); /* flags (1 byte) */
stream_read_UINT16(s, draw_gdiplus_cache_end->cacheType); /* cacheType (2 bytes) */
@ -1635,7 +1635,7 @@ BOOL update_read_field_flags(STREAM* s, UINT32* fieldFlags, BYTE flags, BYTE fie
fieldBytes = 0;
}
if(stream_get_left(s) < fieldBytes)
if (stream_get_left(s) < fieldBytes)
return FALSE;
*fieldFlags = 0;
@ -1651,7 +1651,7 @@ BOOL update_read_bounds(STREAM* s, rdpBounds* bounds)
{
BYTE flags;
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, flags); /* field flags */
@ -1673,29 +1673,29 @@ BOOL update_read_bounds(STREAM* s, rdpBounds* bounds)
}
else if (flags & BOUND_DELTA_TOP)
{
if(!update_read_coord(s, &bounds->top, TRUE))
if (!update_read_coord(s, &bounds->top, TRUE))
return FALSE;
}
if (flags & BOUND_RIGHT)
{
if(!update_read_coord(s, &bounds->right, FALSE))
if (!update_read_coord(s, &bounds->right, FALSE))
return FALSE;
}
else if (flags & BOUND_DELTA_RIGHT)
{
if(!update_read_coord(s, &bounds->right, TRUE))
if (!update_read_coord(s, &bounds->right, TRUE))
return FALSE;
}
if (flags & BOUND_BOTTOM)
{
if(!update_read_coord(s, &bounds->bottom, FALSE))
if (!update_read_coord(s, &bounds->bottom, FALSE))
return FALSE;
}
else if (flags & BOUND_DELTA_BOTTOM)
{
if(!update_read_coord(s, &bounds->bottom, TRUE))
if (!update_read_coord(s, &bounds->bottom, TRUE))
return FALSE;
}
return TRUE;
@ -1894,7 +1894,7 @@ BOOL update_recv_secondary_order(rdpUpdate* update, STREAM* s, BYTE flags)
rdpContext* context = update->context;
rdpSecondaryUpdate* secondary = update->secondary;
if(stream_get_left(s) < 5)
if (stream_get_left(s) < 5)
return FALSE;
stream_read_UINT16(s, orderLength); /* orderLength (2 bytes) */
stream_read_UINT16(s, extraFlags); /* extraFlags (2 bytes) */
@ -1950,20 +1950,20 @@ BOOL update_recv_secondary_order(rdpUpdate* update, STREAM* s, BYTE flags)
case ORDER_TYPE_CACHE_GLYPH:
if (secondary->glyph_v2)
{
if(!update_read_cache_glyph_v2_order(s, &(secondary->cache_glyph_v2_order), extraFlags))
if (!update_read_cache_glyph_v2_order(s, &(secondary->cache_glyph_v2_order), extraFlags))
return FALSE;
IFCALL(secondary->CacheGlyphV2, context, &(secondary->cache_glyph_v2_order));
}
else
{
if(!update_read_cache_glyph_order(s, &(secondary->cache_glyph_order), extraFlags))
if (!update_read_cache_glyph_order(s, &(secondary->cache_glyph_order), extraFlags))
return FALSE;
IFCALL(secondary->CacheGlyph, context, &(secondary->cache_glyph_order));
}
break;
case ORDER_TYPE_CACHE_BRUSH:
if(!update_read_cache_brush_order(s, &(secondary->cache_brush_order), extraFlags))
if (!update_read_cache_brush_order(s, &(secondary->cache_brush_order), extraFlags))
return FALSE;
IFCALL(secondary->CacheBrush, context, &(secondary->cache_brush_order));
break;
@ -1994,73 +1994,73 @@ BOOL update_recv_altsec_order(rdpUpdate* update, STREAM* s, BYTE flags)
switch (orderType)
{
case ORDER_TYPE_CREATE_OFFSCREEN_BITMAP:
if(!update_read_create_offscreen_bitmap_order(s, &(altsec->create_offscreen_bitmap)))
if (!update_read_create_offscreen_bitmap_order(s, &(altsec->create_offscreen_bitmap)))
return FALSE;
IFCALL(altsec->CreateOffscreenBitmap, context, &(altsec->create_offscreen_bitmap));
break;
case ORDER_TYPE_SWITCH_SURFACE:
if(!update_read_switch_surface_order(s, &(altsec->switch_surface)))
if (!update_read_switch_surface_order(s, &(altsec->switch_surface)))
return FALSE;
IFCALL(altsec->SwitchSurface, context, &(altsec->switch_surface));
break;
case ORDER_TYPE_CREATE_NINE_GRID_BITMAP:
if(!update_read_create_nine_grid_bitmap_order(s, &(altsec->create_nine_grid_bitmap)))
if (!update_read_create_nine_grid_bitmap_order(s, &(altsec->create_nine_grid_bitmap)))
return FALSE;
IFCALL(altsec->CreateNineGridBitmap, context, &(altsec->create_nine_grid_bitmap));
break;
case ORDER_TYPE_FRAME_MARKER:
if(!update_read_frame_marker_order(s, &(altsec->frame_marker)))
if (!update_read_frame_marker_order(s, &(altsec->frame_marker)))
return FALSE;
IFCALL(altsec->FrameMarker, context, &(altsec->frame_marker));
break;
case ORDER_TYPE_STREAM_BITMAP_FIRST:
if(!update_read_stream_bitmap_first_order(s, &(altsec->stream_bitmap_first)))
if (!update_read_stream_bitmap_first_order(s, &(altsec->stream_bitmap_first)))
return FALSE;
IFCALL(altsec->StreamBitmapFirst, context, &(altsec->stream_bitmap_first));
break;
case ORDER_TYPE_STREAM_BITMAP_NEXT:
if(!update_read_stream_bitmap_next_order(s, &(altsec->stream_bitmap_next)))
if (!update_read_stream_bitmap_next_order(s, &(altsec->stream_bitmap_next)))
return FALSE;
IFCALL(altsec->StreamBitmapNext, context, &(altsec->stream_bitmap_next));
break;
case ORDER_TYPE_GDIPLUS_FIRST:
if(!update_read_draw_gdiplus_first_order(s, &(altsec->draw_gdiplus_first)))
if (!update_read_draw_gdiplus_first_order(s, &(altsec->draw_gdiplus_first)))
return FALSE;
IFCALL(altsec->DrawGdiPlusFirst, context, &(altsec->draw_gdiplus_first));
break;
case ORDER_TYPE_GDIPLUS_NEXT:
if(!update_read_draw_gdiplus_next_order(s, &(altsec->draw_gdiplus_next)))
if (!update_read_draw_gdiplus_next_order(s, &(altsec->draw_gdiplus_next)))
return FALSE;
IFCALL(altsec->DrawGdiPlusNext, context, &(altsec->draw_gdiplus_next));
break;
case ORDER_TYPE_GDIPLUS_END:
if(update_read_draw_gdiplus_end_order(s, &(altsec->draw_gdiplus_end)))
if (update_read_draw_gdiplus_end_order(s, &(altsec->draw_gdiplus_end)))
return FALSE;
IFCALL(altsec->DrawGdiPlusEnd, context, &(altsec->draw_gdiplus_end));
break;
case ORDER_TYPE_GDIPLUS_CACHE_FIRST:
if(!update_read_draw_gdiplus_cache_first_order(s, &(altsec->draw_gdiplus_cache_first)))
if (!update_read_draw_gdiplus_cache_first_order(s, &(altsec->draw_gdiplus_cache_first)))
return FALSE;
IFCALL(altsec->DrawGdiPlusCacheFirst, context, &(altsec->draw_gdiplus_cache_first));
break;
case ORDER_TYPE_GDIPLUS_CACHE_NEXT:
if(!update_read_draw_gdiplus_cache_next_order(s, &(altsec->draw_gdiplus_cache_next)))
if (!update_read_draw_gdiplus_cache_next_order(s, &(altsec->draw_gdiplus_cache_next)))
return FALSE;
IFCALL(altsec->DrawGdiPlusCacheNext, context, &(altsec->draw_gdiplus_cache_next));
break;
case ORDER_TYPE_GDIPLUS_CACHE_END:
if(!update_read_draw_gdiplus_cache_end_order(s, &(altsec->draw_gdiplus_cache_end)))
if (!update_read_draw_gdiplus_cache_end_order(s, &(altsec->draw_gdiplus_cache_end)))
return FALSE;
IFCALL(altsec->DrawGdiPlusCacheEnd, context, &(altsec->draw_gdiplus_cache_end));
break;
@ -2082,8 +2082,9 @@ BOOL update_recv_order(rdpUpdate* update, STREAM* s)
{
BYTE controlFlags;
if(stream_get_left(s) < 1)
if (stream_get_left(s) < 1)
return FALSE;
stream_read_BYTE(s, controlFlags); /* controlFlags (1 byte) */
if (!(controlFlags & ORDER_STANDARD))

View File

@ -503,7 +503,7 @@ int rdp_recv_data_pdu(rdpRdp* rdp, STREAM* s)
UINT32 rlen;
STREAM* comp_stream;
if(!rdp_read_share_data_header(s, &length, &type, &share_id, &compressed_type, &compressed_len))
if (!rdp_read_share_data_header(s, &length, &type, &share_id, &compressed_type, &compressed_len))
return -1;
comp_stream = s;
@ -552,7 +552,7 @@ int rdp_recv_data_pdu(rdpRdp* rdp, STREAM* s)
break;
case DATA_PDU_TYPE_SYNCHRONIZE:
if(!rdp_recv_synchronize_pdu(rdp, comp_stream))
if (!rdp_recv_synchronize_pdu(rdp, comp_stream))
return -1;
break;

View File

@ -44,8 +44,9 @@ BOOL update_recv_orders(rdpUpdate* update, STREAM* s)
{
UINT16 numberOrders;
if(stream_get_left(s) < 6)
if (stream_get_left(s) < 6)
return FALSE;
stream_seek_UINT16(s); /* pad2OctetsA (2 bytes) */
stream_read_UINT16(s, numberOrders); /* numberOrders (2 bytes) */
stream_seek_UINT16(s); /* pad2OctetsB (2 bytes) */
@ -62,8 +63,9 @@ BOOL update_recv_orders(rdpUpdate* update, STREAM* s)
BOOL update_read_bitmap_data(STREAM* s, BITMAP_DATA* bitmap_data)
{
if(stream_get_left(s) < 18)
if (stream_get_left(s) < 18)
return FALSE;
stream_read_UINT16(s, bitmap_data->destLeft);
stream_read_UINT16(s, bitmap_data->destTop);
stream_read_UINT16(s, bitmap_data->destRight);
@ -91,7 +93,7 @@ BOOL update_read_bitmap_data(STREAM* s, BITMAP_DATA* bitmap_data)
}
else
{
if(stream_get_left(s) < bitmap_data->bitmapLength)
if (stream_get_left(s) < bitmap_data->bitmapLength)
return FALSE;
bitmap_data->compressed = FALSE;
stream_get_mark(s, bitmap_data->bitmapDataStream);
@ -103,8 +105,10 @@ BOOL update_read_bitmap_data(STREAM* s, BITMAP_DATA* bitmap_data)
BOOL update_read_bitmap(rdpUpdate* update, STREAM* s, BITMAP_UPDATE* bitmap_update)
{
int i;
if(stream_get_left(s) < 2)
if (stream_get_left(s) < 2)
return FALSE;
stream_read_UINT16(s, bitmap_update->number); /* numberRectangles (2 bytes) */
if (bitmap_update->number > bitmap_update->count)
@ -136,15 +140,16 @@ BOOL update_read_palette(rdpUpdate* update, STREAM* s, PALETTE_UPDATE* palette_u
int i;
PALETTE_ENTRY* entry;
if(stream_get_left(s) < 6)
if (stream_get_left(s) < 6)
return FALSE;
stream_seek_UINT16(s); /* pad2Octets (2 bytes) */
stream_read_UINT32(s, palette_update->number); /* numberColors (4 bytes), must be set to 256 */
if (palette_update->number > 256)
palette_update->number = 256;
if(stream_get_left(s) < palette_update->number * 3)
if (stream_get_left(s) < palette_update->number * 3)
return FALSE;
/* paletteEntries */
@ -171,25 +176,29 @@ void update_read_synchronize(rdpUpdate* update, STREAM* s)
BOOL update_read_play_sound(STREAM* s, PLAY_SOUND_UPDATE* play_sound)
{
if(stream_get_left(s) < 8)
if (stream_get_left(s) < 8)
return FALSE;
stream_read_UINT32(s, play_sound->duration); /* duration (4 bytes) */
stream_read_UINT32(s, play_sound->frequency); /* frequency (4 bytes) */
return TRUE;
}
BOOL update_recv_play_sound(rdpUpdate* update, STREAM* s)
{
if(!update_read_play_sound(s, &update->play_sound))
if (!update_read_play_sound(s, &update->play_sound))
return FALSE;
IFCALL(update->PlaySound, update->context, &update->play_sound);
return TRUE;
}
BOOL update_read_pointer_position(STREAM* s, POINTER_POSITION_UPDATE* pointer_position)
{
if(stream_get_left(s) < 4)
if (stream_get_left(s) < 4)
return FALSE;
stream_read_UINT16(s, pointer_position->xPos); /* xPos (2 bytes) */
stream_read_UINT16(s, pointer_position->yPos); /* yPos (2 bytes) */
return TRUE;
@ -197,15 +206,16 @@ BOOL update_read_pointer_position(STREAM* s, POINTER_POSITION_UPDATE* pointer_po
BOOL update_read_pointer_system(STREAM* s, POINTER_SYSTEM_UPDATE* pointer_system)
{
if(stream_get_left(s) < 4)
if (stream_get_left(s) < 4)
return FALSE;
stream_read_UINT32(s, pointer_system->type); /* systemPointerType (4 bytes) */
return TRUE;
}
BOOL update_read_pointer_color(STREAM* s, POINTER_COLOR_UPDATE* pointer_color)
{
if(stream_get_left(s) < 14)
if (stream_get_left(s) < 14)
return FALSE;
stream_read_UINT16(s, pointer_color->cacheIndex); /* cacheIndex (2 bytes) */
@ -229,7 +239,7 @@ BOOL update_read_pointer_color(STREAM* s, POINTER_COLOR_UPDATE* pointer_color)
if (pointer_color->lengthXorMask > 0)
{
if(stream_get_left(s) < pointer_color->lengthXorMask)
if (stream_get_left(s) < pointer_color->lengthXorMask)
return FALSE;
pointer_color->xorMaskData = (BYTE*) malloc(pointer_color->lengthXorMask);
stream_read(s, pointer_color->xorMaskData, pointer_color->lengthXorMask);
@ -237,7 +247,7 @@ BOOL update_read_pointer_color(STREAM* s, POINTER_COLOR_UPDATE* pointer_color)
if (pointer_color->lengthAndMask > 0)
{
if(stream_get_left(s) < pointer_color->lengthAndMask)
if (stream_get_left(s) < pointer_color->lengthAndMask)
return FALSE;
pointer_color->andMaskData = (BYTE*) malloc(pointer_color->lengthAndMask);
stream_read(s, pointer_color->andMaskData, pointer_color->lengthAndMask);
@ -250,16 +260,18 @@ BOOL update_read_pointer_color(STREAM* s, POINTER_COLOR_UPDATE* pointer_color)
BOOL update_read_pointer_new(STREAM* s, POINTER_NEW_UPDATE* pointer_new)
{
if(stream_get_left(s) < 2)
if (stream_get_left(s) < 2)
return FALSE;
stream_read_UINT16(s, pointer_new->xorBpp); /* xorBpp (2 bytes) */
return update_read_pointer_color(s, &pointer_new->colorPtrAttr); /* colorPtrAttr */
}
BOOL update_read_pointer_cached(STREAM* s, POINTER_CACHED_UPDATE* pointer_cached)
{
if(stream_get_left(s) < 2)
if (stream_get_left(s) < 2)
return FALSE;
stream_read_UINT16(s, pointer_cached->cacheIndex); /* cacheIndex (2 bytes) */
return TRUE;
}
@ -270,8 +282,9 @@ BOOL update_recv_pointer(rdpUpdate* update, STREAM* s)
rdpContext* context = update->context;
rdpPointerUpdate* pointer = update->pointer;
if(stream_get_left(s) < 2+2)
if (stream_get_left(s) < 2 + 2)
return FALSE;
stream_read_UINT16(s, messageType); /* messageType (2 bytes) */
stream_seek_UINT16(s); /* pad2Octets (2 bytes) */
@ -318,8 +331,9 @@ BOOL update_recv(rdpUpdate* update, STREAM* s)
UINT16 updateType;
rdpContext* context = update->context;
if(stream_get_left(s) < 2)
if (stream_get_left(s) < 2)
return FALSE;
stream_read_UINT16(s, updateType); /* updateType (2 bytes) */
//printf("%s Update Data PDU\n", UPDATE_TYPE_STRINGS[updateType]);
@ -615,7 +629,7 @@ BOOL update_read_refresh_rect(rdpUpdate* update, STREAM* s)
stream_read_BYTE(s, numberOfAreas);
stream_seek(s, 3); /* pad3Octects */
if(stream_get_left(s) < numberOfAreas * 4 * 2)
if (stream_get_left(s) < numberOfAreas * 4 * 2)
return FALSE;
areas = (RECTANGLE_16*) malloc(sizeof(RECTANGLE_16) * numberOfAreas);