libfreerdp-utils: fix and clean stream utils
This commit is contained in:
parent
0991b312ae
commit
19f13942b2
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "test_color.h"
|
#include "test_color.h"
|
||||||
#include "test_libgdi.h"
|
#include "test_libgdi.h"
|
||||||
#include "test_network.h"
|
#include "test_stream.h"
|
||||||
#include "test_freerdp.h"
|
#include "test_freerdp.h"
|
||||||
|
|
||||||
void dump_data(unsigned char * p, int len, int width, char* name)
|
void dump_data(unsigned char * p, int len, int width, char* name)
|
||||||
@ -62,7 +62,7 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
add_color_suite();
|
add_color_suite();
|
||||||
add_libgdi_suite();
|
add_libgdi_suite();
|
||||||
add_network_suite();
|
add_stream_suite();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -76,9 +76,9 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
add_libgdi_suite();
|
add_libgdi_suite();
|
||||||
}
|
}
|
||||||
else if (strcmp("network", argv[*pindex]) == 0)
|
else if (strcmp("stream", argv[*pindex]) == 0)
|
||||||
{
|
{
|
||||||
add_network_suite();
|
add_stream_suite();
|
||||||
}
|
}
|
||||||
|
|
||||||
*pindex = *pindex + 1;
|
*pindex = *pindex + 1;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* FreeRDP: A Remote Desktop Protocol Client
|
* FreeRDP: A Remote Desktop Protocol Client
|
||||||
* Network Tests
|
* Stream Unit Tests
|
||||||
*
|
*
|
||||||
* Copyright 2011 Vic Lee
|
* Copyright 2011 Vic Lee
|
||||||
*
|
*
|
||||||
@ -24,26 +24,28 @@
|
|||||||
#include <freerdp/utils/hexdump.h>
|
#include <freerdp/utils/hexdump.h>
|
||||||
#include <freerdp/utils/stream.h>
|
#include <freerdp/utils/stream.h>
|
||||||
|
|
||||||
#include "test_network.h"
|
#include "test_stream.h"
|
||||||
|
|
||||||
int init_network_suite(void)
|
int init_stream_suite(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int clean_network_suite(void)
|
int clean_stream_suite(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int add_network_suite(void)
|
int add_stream_suite(void)
|
||||||
{
|
{
|
||||||
add_test_suite(network);
|
add_test_suite(stream);
|
||||||
|
|
||||||
add_test_function(network_stream);
|
add_test_function(stream);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_network_stream(void)
|
void test_stream(void)
|
||||||
{
|
{
|
||||||
STREAM * stream;
|
STREAM * stream;
|
||||||
int pos;
|
int pos;
|
||||||
@ -60,7 +62,7 @@ void test_network_stream(void)
|
|||||||
stream_write_uint32(stream, 0x03040506);
|
stream_write_uint32(stream, 0x03040506);
|
||||||
stream_write_uint64(stream, 0x0708091011121314LL);
|
stream_write_uint64(stream, 0x0708091011121314LL);
|
||||||
|
|
||||||
/*freerdp_hexdump(stream->buffer, 15);*/
|
/* freerdp_hexdump(stream->buffer, 15); */
|
||||||
|
|
||||||
stream_set_pos(stream, pos);
|
stream_set_pos(stream, pos);
|
||||||
stream_seek(stream, 3);
|
stream_seek(stream, 3);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* FreeRDP: A Remote Desktop Protocol Client
|
* FreeRDP: A Remote Desktop Protocol Client
|
||||||
* Network Tests
|
* Stream Unit Tests
|
||||||
*
|
*
|
||||||
* Copyright 2011 Vic Lee
|
* Copyright 2011 Vic Lee
|
||||||
*
|
*
|
||||||
@ -19,9 +19,8 @@
|
|||||||
|
|
||||||
#include "test_freerdp.h"
|
#include "test_freerdp.h"
|
||||||
|
|
||||||
int init_network_suite(void);
|
int init_stream_suite(void);
|
||||||
int clean_network_suite(void);
|
int clean_stream_suite(void);
|
||||||
int add_network_suite(void);
|
int add_stream_suite(void);
|
||||||
|
|
||||||
void test_network_stream(void);
|
|
||||||
|
|
||||||
|
void test_stream(void);
|
||||||
|
@ -37,10 +37,10 @@ void
|
|||||||
stream_free(STREAM * stream);
|
stream_free(STREAM * stream);
|
||||||
|
|
||||||
void
|
void
|
||||||
stream_increase_capacity(STREAM * stream);
|
stream_extend(STREAM * stream);
|
||||||
#define stream_check_capacity(_s,_n) \
|
#define stream_check_capacity(_s,_n) \
|
||||||
while (_s->ptr - _s->buffer + (_n) > _s->capacity) \
|
while (_s->ptr - _s->buffer + (_n) > _s->capacity) \
|
||||||
stream_increase_capacity(_s)
|
stream_extend(_s)
|
||||||
|
|
||||||
#define stream_get_pos(_s) (_s->ptr - _s->buffer)
|
#define stream_get_pos(_s) (_s->ptr - _s->buffer)
|
||||||
#define stream_set_pos(_s,_m) _s->ptr = _s->buffer + (_m)
|
#define stream_set_pos(_s,_m) _s->ptr = _s->buffer + (_m)
|
||||||
|
@ -52,7 +52,7 @@ stream_free(STREAM * stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
stream_increase_capacity(STREAM * stream)
|
stream_extend(STREAM * stream)
|
||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user