Merge pull request #27 from bradh/master

A couple more cleanups
This commit is contained in:
Otavio Salvador 2011-07-27 06:50:28 -07:00
commit b4c4b3fefe
5 changed files with 12 additions and 11 deletions

View File

@ -34,7 +34,7 @@
} while(0)
#define STRING_COPY(_str) do { \
settings->_str = xmalloc(strlen(argv[*i])); \
settings->_str = xmalloc(strlen(argv[*i]) + 1); \
memcpy(settings->_str, argv[*i], strlen(argv[*i])); \
settings->_str[strlen(argv[*i])] = '\0'; \
} while(0)
@ -145,7 +145,7 @@ boolean freerdp_process_params(int argc, char* argv[], rdpSettings* settings, in
&& (p[1] == 0 || (p[1] == ':' && !strchr(p + 2, ':'))))
{
/* Either "[...]" or "[...]:..." with at most one : after the brackets */
settings->hostname = (char*) xmalloc(strlen(argv[*i] + 1));
settings->hostname = (char*) xmalloc(strlen(argv[*i]) + 1);
strncpy(settings->hostname, argv[*i] + 1, strlen(argv[*i] + 1));
if ((p = strchr((const char*)settings->hostname, ']')))
@ -158,10 +158,11 @@ boolean freerdp_process_params(int argc, char* argv[], rdpSettings* settings, in
else
{
/* Port number is cut off and used if exactly one : in the string */
settings->hostname = (char*) xmalloc(strlen(argv[*i]));
settings->hostname = (char*) xmalloc(strlen(argv[*i]) + 1);
strncpy(settings->hostname, argv[*i], strlen(argv[*i]));
settings->hostname[strlen(argv[*i])] = '\0';
if ((p = strchr((const char*)settings->hostname, ':')) && !strchr(p + 1, ':'))
if ((p = strchr(settings->hostname, ':')) && !strchr(p + 1, ':'))
{
*p = 0;
settings->port = (uint16) atoi(p + 1);

View File

@ -90,7 +90,7 @@ boolean ber_read_universal_tag(STREAM* s, uint8 tag, boolean pc)
stream_read_uint8(s, byte);
if (byte != (BER_CLASS_UNIV | BER_PC(pc)) | (BER_TAG_MASK & tag))
if (byte != (BER_CLASS_UNIV | BER_PC(pc) | (BER_TAG_MASK & tag)))
return False;
return True;

View File

@ -160,7 +160,7 @@ void gcc_write_conference_create_request(STREAM* s, STREAM* user_data)
void gcc_read_conference_create_response(STREAM* s, rdpSettings* settings)
{
int length;
uint16 length;
uint32 tag;
uint16 nodeID;
uint8 result;

View File

@ -26,7 +26,7 @@
* @return
*/
boolean per_read_length(STREAM* s, int* length)
boolean per_read_length(STREAM* s, uint16* length)
{
uint8 byte;
@ -156,7 +156,7 @@ void per_write_padding(STREAM* s, int length)
boolean per_read_integer(STREAM* s, uint32* integer)
{
int length;
uint16 length;
per_read_length(s, &length);
@ -256,7 +256,7 @@ boolean per_read_enumerated(STREAM* s, uint8* enumerated, uint8 count)
boolean per_read_object_identifier(STREAM* s, uint8 oid[6])
{
uint8 t12;
int length;
uint16 length;
uint8 a_oid[6];
@ -330,7 +330,7 @@ void per_write_string(STREAM* s, uint8* str, int length)
boolean per_read_octet_string(STREAM* s, uint8* oct_str, int length, int min)
{
int i;
int mlength;
uint16 mlength;
uint8* a_oct_str;
per_read_length(s, &mlength);

View File

@ -22,7 +22,7 @@
#include <freerdp/utils/stream.h>
boolean per_read_length(STREAM* s, int* length);
boolean per_read_length(STREAM* s, uint16* length);
void per_write_length(STREAM* s, int length);
boolean per_read_choice(STREAM* s, uint8* choice);
void per_write_choice(STREAM* s, uint8 choice);