From: Armin Novak Date: Thu, 25 Feb 2016 19:01:12 +0000 (+0100) Subject: Fixed Stream API misuse. X-Git-Tag: 2.0.0-beta1+android10~288^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e79eee2bb1a09b103d418d37b56fba745c9bc7c1;p=platform%2Fupstream%2Ffreerdp.git Fixed Stream API misuse. --- diff --git a/libfreerdp/core/capabilities.c b/libfreerdp/core/capabilities.c index 114cfd2..d6e46e8 100644 --- a/libfreerdp/core/capabilities.c +++ b/libfreerdp/core/capabilities.c @@ -3392,10 +3392,10 @@ BOOL rdp_print_capability_sets(wStream* s, UINT16 numberCapabilities, BOOL recei break; } - if (s->pointer != em) + if (Stream_Pointer(s) != em) { WLog_ERR(TAG, "incorrect offset, type:0x%02X actual:%d expected:%d", - type, (int)(s->pointer - bm), (int)(em - bm)); + type, (int)(Stream_Pointer(s) - bm), (int)(em - bm)); } Stream_SetPointer(s, em); @@ -3617,10 +3617,10 @@ BOOL rdp_read_capability_sets(wStream* s, rdpSettings* settings, UINT16 numberCa } } - if (s->pointer != em) + if (Stream_Pointer(s) != em) { WLog_ERR(TAG, "incorrect offset, type:0x%02X actual:%d expected:%d", - type, (int)(s->pointer - bm), (int)(em - bm)); + type, (int)(Stream_Pointer(s) - bm), (int)(em - bm)); } Stream_SetPointer(s, em); diff --git a/libfreerdp/core/gateway/http.c b/libfreerdp/core/gateway/http.c index f12423f..a3d5da3 100644 --- a/libfreerdp/core/gateway/http.c +++ b/libfreerdp/core/gateway/http.c @@ -407,7 +407,7 @@ wStream* http_request_write(HttpContext* context, HttpRequest* request) free(lines); Stream_Write(s, "\0", 1); /* append null terminator */ Stream_Rewind(s, 1); /* don't include null terminator in length */ - Stream_Length(s) = Stream_GetPosition(s); + Stream_SetLength(s, Stream_GetPosition(s)); return s; out_free: diff --git a/libfreerdp/core/gcc.c b/libfreerdp/core/gcc.c index c235442..b0a0f1b 100644 --- a/libfreerdp/core/gcc.c +++ b/libfreerdp/core/gcc.c @@ -225,7 +225,7 @@ void gcc_write_conference_create_request(wStream* s, wStream* userData) per_write_octet_string(s, h221_cs_key, 4, 4); /* h221NonStandard, client-to-server H.221 key, "Duca" */ /* userData::value (OCTET_STRING) */ - per_write_octet_string(s, userData->buffer, Stream_GetPosition(userData), 0); /* array of client data blocks */ + per_write_octet_string(s, Stream_Buffer(userData), Stream_GetPosition(userData), 0); /* array of client data blocks */ } BOOL gcc_read_conference_create_response(wStream* s, rdpMcs* mcs) @@ -319,7 +319,7 @@ void gcc_write_conference_create_response(wStream* s, wStream* userData) per_write_octet_string(s, h221_sc_key, 4, 4); /* h221NonStandard, server-to-client H.221 key, "McDn" */ /* userData (OCTET_STRING) */ - per_write_octet_string(s, userData->buffer, Stream_GetPosition(userData), 0); /* array of server data blocks */ + per_write_octet_string(s, Stream_Buffer(userData), Stream_GetPosition(userData), 0); /* array of server data blocks */ } BOOL gcc_read_client_data_blocks(wStream* s, rdpMcs* mcs, int length) @@ -508,7 +508,7 @@ BOOL gcc_read_server_data_blocks(wStream* s, rdpMcs* mcs, int length) break; } offset += blockLength; - Stream_Pointer(s) = holdp + blockLength; + Stream_SetPointer(s, holdp + blockLength); } return TRUE; diff --git a/libfreerdp/core/mcs.c b/libfreerdp/core/mcs.c index 8d082b1..27c9126 100644 --- a/libfreerdp/core/mcs.c +++ b/libfreerdp/core/mcs.c @@ -571,7 +571,7 @@ BOOL mcs_write_connect_initial(wStream* s, rdpMcs* mcs, wStream* userData) goto out; /* userData (OCTET_STRING) */ - ber_write_octet_string(tmps, userData->buffer, Stream_GetPosition(userData)); + ber_write_octet_string(tmps, Stream_Buffer(userData), Stream_GetPosition(userData)); length = Stream_GetPosition(tmps); /* Connect-Initial (APPLICATION 101, IMPLICIT SEQUENCE) */ @@ -608,7 +608,7 @@ BOOL mcs_write_connect_response(wStream* s, rdpMcs* mcs, wStream* userData) if (!mcs_write_domain_parameters(tmps, &(mcs->domainParameters))) goto out; /* userData (OCTET_STRING) */ - ber_write_octet_string(tmps, userData->buffer, Stream_GetPosition(userData)); + ber_write_octet_string(tmps, Stream_Buffer(userData), Stream_GetPosition(userData)); length = Stream_GetPosition(tmps); ber_write_application_tag(s, MCS_TYPE_CONNECT_RESPONSE, length); diff --git a/libfreerdp/core/orders.c b/libfreerdp/core/orders.c index 60aed90..49df89a 100644 --- a/libfreerdp/core/orders.c +++ b/libfreerdp/core/orders.c @@ -1728,7 +1728,7 @@ BOOL update_read_fast_glyph_order(wStream* s, ORDER_INFO* orderInfo, FAST_GLYPH_ } } - Stream_Pointer(s) = phold + fastGlyph->cbData; + Stream_SetPointer(s, phold + fastGlyph->cbData); } return TRUE; @@ -3546,7 +3546,7 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags) break; } - Stream_Pointer(s) = next; + Stream_SetPointer(s, next); return TRUE; } diff --git a/libfreerdp/core/rdp.c b/libfreerdp/core/rdp.c index dfaa02d..37dc8ee 100644 --- a/libfreerdp/core/rdp.c +++ b/libfreerdp/core/rdp.c @@ -1056,7 +1056,7 @@ BOOL rdp_decrypt(rdpRdp* rdp, wStream* s, int length, UINT16 securityFlags) return FALSE; /* TODO */ } - Stream_Length(s) -= pad; + Stream_SetLength(s, Stream_Length(s) - pad); return TRUE; } diff --git a/libfreerdp/core/transport.c b/libfreerdp/core/transport.c index 6f928cc..147913f 100644 --- a/libfreerdp/core/transport.c +++ b/libfreerdp/core/transport.c @@ -733,8 +733,7 @@ out_cleanup: transport->layer = TRANSPORT_LAYER_CLOSED; } - if (s->pool) - Stream_Release(s); + Stream_Release(s); LeaveCriticalSection(&(transport->WriteLock)); return status; diff --git a/server/Sample/sfreerdp.c b/server/Sample/sfreerdp.c index ba2cf9e..96b6c9c 100644 --- a/server/Sample/sfreerdp.c +++ b/server/Sample/sfreerdp.c @@ -449,12 +449,12 @@ BOOL tf_peer_dump_rfx(freerdp_peer* client) if (!tmp) break; - Stream_Buffer(s) = tmp; + Stream_SetBuffer(s, tmp); record.data = Stream_Buffer(s); - Stream_Capacity(s) = record.length; + Stream_SetCapacity(s, record.length); pcap_get_next_record_content(pcap_rfx, &record); - Stream_Pointer(s) = Stream_Buffer(s) + Stream_Capacity(s); + Stream_SetPointer(s, Stream_Buffer(s) + Stream_Capacity(s)); if (test_dump_rfx_realtime && test_sleep_tsdiff(&prev_seconds, &prev_useconds, record.header.ts_sec, record.header.ts_usec) == FALSE) break;