Simplify code by using per_read_length() instead of reimplementing it.

This commit is contained in:
Pawel Jakub Dawidek 2012-01-25 16:00:16 +01:00
parent af87360135
commit cea62dd9f6

View File

@ -24,6 +24,7 @@
#include <freerdp/utils/stream.h> #include <freerdp/utils/stream.h>
#include "orders.h" #include "orders.h"
#include "per.h"
#include "update.h" #include "update.h"
#include "surface.h" #include "surface.h"
@ -99,10 +100,7 @@ uint16 fastpath_read_header_rdp(rdpFastPath* fastpath, STREAM* s)
{ {
uint8 header; uint8 header;
uint16 length; uint16 length;
uint8 t;
uint16 hs;
hs = 2;
stream_read_uint8(s, header); stream_read_uint8(s, header);
if (fastpath != NULL) if (fastpath != NULL)
@ -111,18 +109,9 @@ uint16 fastpath_read_header_rdp(rdpFastPath* fastpath, STREAM* s)
fastpath->numberEvents = (header & 0x3C) >> 2; fastpath->numberEvents = (header & 0x3C) >> 2;
} }
stream_read_uint8(s, length); /* length1 */ per_read_length(s, &length);
/* If most significant bit is not set, length2 is not presented. */
if ((length & 0x80))
{
hs++;
length &= 0x7F;
length <<= 8;
stream_read_uint8(s, t);
length += t;
}
return length - hs; return length - stream_get_length(s);
} }
static void fastpath_recv_orders(rdpFastPath* fastpath, STREAM* s) static void fastpath_recv_orders(rdpFastPath* fastpath, STREAM* s)