wfreerdp: fix multiple warnings

This commit is contained in:
Marc-André Moreau 2014-02-10 01:06:11 -05:00
parent d64f86d52c
commit 5ff847a6e6
14 changed files with 58 additions and 50 deletions

View File

@ -102,7 +102,7 @@ static int audin_process_version(IWTSVirtualChannelCallback* pChannelCallback, w
out = Stream_New(NULL, 5);
Stream_Write_UINT8(out, MSG_SNDIN_VERSION);
Stream_Write_UINT32(out, Version);
error = callback->channel->Write(callback->channel, Stream_GetPosition(s), Stream_Buffer(s), NULL);
error = callback->channel->Write(callback->channel, (UINT32) Stream_GetPosition(s), Stream_Buffer(s), NULL);
Stream_Free(out, TRUE);
return error;
@ -183,7 +183,7 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w
audin_send_incoming_data_pdu(pChannelCallback);
cbSizeFormatsPacket = Stream_GetPosition(out);
cbSizeFormatsPacket = (UINT32) Stream_GetPosition(out);
Stream_SetPosition(out, 0);
Stream_Write_UINT8(out, MSG_SNDIN_FORMATS); /* Header (1 byte) */
@ -240,7 +240,7 @@ static BOOL audin_receive_wave_data(BYTE* data, int size, void* user_data)
out = Stream_New(NULL, size + 1);
Stream_Write_UINT8(out, MSG_SNDIN_DATA);
Stream_Write(out, data, size);
error = callback->channel->Write(callback->channel, Stream_GetPosition(out), Stream_Buffer(out), NULL);
error = callback->channel->Write(callback->channel, (UINT32) Stream_GetPosition(out), Stream_Buffer(out), NULL);
Stream_Free(out, TRUE);
return (error == 0 ? TRUE : FALSE);

View File

@ -514,7 +514,7 @@ int freerdp_channels_post_connect(rdpChannels* channels, freerdp* instance)
channels->is_connected = 1;
hostname = instance->settings->ServerHostname;
hostnameLength = strlen(hostname);
hostnameLength = (int) strlen(hostname);
for (index = 0; index < channels->clientDataCount; index++)
{

View File

@ -73,10 +73,10 @@ typedef struct _DISP_PLUGIN DISP_PLUGIN;
int disp_send_display_control_monitor_layout_pdu(DISP_CHANNEL_CALLBACK* callback, UINT32 NumMonitors, DISPLAY_CONTROL_MONITOR_LAYOUT* Monitors)
{
int index;
int status;
wStream* s;
UINT32 type;
UINT32 index;
UINT32 length;
DISP_PLUGIN* disp;
UINT32 MonitorLayoutSize;
@ -155,7 +155,7 @@ int disp_send_display_control_monitor_layout_pdu(DISP_CHANNEL_CALLBACK* callback
Stream_SealLength(s);
status = callback->channel->Write(callback->channel, Stream_Length(s), Stream_Buffer(s), NULL);
status = callback->channel->Write(callback->channel, (UINT32) Stream_Length(s), Stream_Buffer(s), NULL);
Stream_Free(s, TRUE);

View File

@ -64,7 +64,7 @@ static void drive_file_fix_path(char* path)
int i;
int length;
length = strlen(path);
length = (int) strlen(path);
for (i = 0; i < length; i++)
{

View File

@ -650,7 +650,7 @@ void drive_register_drive_path(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, char*
drive->device.IRPRequest = drive_irp_request;
drive->device.Free = drive_free;
length = strlen(name);
length = (int) strlen(name);
drive->device.data = Stream_New(NULL, length + 1);
for (i = 0; i <= length; i++)

View File

@ -35,7 +35,7 @@ void rail_send_pdu(railPlugin* rail, wStream* s, UINT16 orderType)
{
UINT16 orderLength;
orderLength = Stream_GetPosition(s);
orderLength = (UINT16) Stream_GetPosition(s);
Stream_SetPosition(s, 0);
rail_write_pdu_header(s, orderType, orderLength);

View File

@ -45,7 +45,7 @@ static void irp_complete(IRP* irp)
{
int pos;
pos = Stream_GetPosition(irp->output);
pos = (int) Stream_GetPosition(irp->output);
Stream_SetPosition(irp->output, 12);
Stream_Write_UINT32(irp->output, irp->IoStatus);
Stream_SetPosition(irp->output, pos);

View File

@ -46,7 +46,7 @@
static void rdpdr_process_connect(rdpdrPlugin* rdpdr)
{
int index;
UINT32 index;
RDPDR_DEVICE* device;
rdpSettings* settings;
@ -153,7 +153,7 @@ static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL use
Stream_Write_UINT16(s, RDPDR_CTYP_CORE);
Stream_Write_UINT16(s, PAKID_CORE_DEVICELIST_ANNOUNCE);
count_pos = Stream_GetPosition(s);
count_pos = (int) Stream_GetPosition(s);
count = 0;
Stream_Seek_UINT32(s); /* deviceCount */
@ -175,7 +175,7 @@ static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL use
if ((rdpdr->versionMinor == 0x0005) ||
(device->type == RDPDR_DTYP_SMARTCARD) || userLoggedOn)
{
data_len = (device->data == NULL ? 0 : Stream_GetPosition(device->data));
data_len = (int) (device->data == NULL ? 0 : Stream_GetPosition(device->data));
Stream_EnsureRemainingCapacity(s, 20 + data_len);
Stream_Write_UINT32(s, device->type); /* deviceType */
@ -207,7 +207,7 @@ static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL use
if (pKeys)
free(pKeys);
pos = Stream_GetPosition(s);
pos = (int) Stream_GetPosition(s);
Stream_SetPosition(s, count_pos);
Stream_Write_UINT32(s, count);
Stream_SetPosition(s, pos);
@ -349,10 +349,14 @@ int rdpdr_send(rdpdrPlugin* rdpdr, wStream* s)
rdpdrPlugin* plugin = (rdpdrPlugin*) rdpdr;
if (!plugin)
{
status = CHANNEL_RC_BAD_INIT_HANDLE;
}
else
{
status = plugin->channelEntryPoints.pVirtualChannelWrite(plugin->OpenHandle,
Stream_Buffer(s), Stream_GetPosition(s), s);
Stream_Buffer(s), (UINT32) Stream_GetPosition(s), s);
}
if (status != CHANNEL_RC_OK)
{

View File

@ -196,7 +196,7 @@ int rdpei_send_pdu(RDPEI_CHANNEL_CALLBACK* callback, wStream* s, UINT16 eventId,
Stream_Write_UINT32(s, pduLength); /* pduLength (4 bytes) */
Stream_SetPosition(s, Stream_Length(s));
status = callback->channel->Write(callback->channel, Stream_Length(s), Stream_Buffer(s), NULL);
status = callback->channel->Write(callback->channel, (UINT32) Stream_Length(s), Stream_Buffer(s), NULL);
#ifdef WITH_DEBUG_RDPEI
fprintf(stderr, "rdpei_send_pdu: eventId: %d (%s) length: %d status: %d\n",
@ -269,7 +269,7 @@ int rdpei_write_touch_frame(wStream* s, RDPINPUT_TOUCH_FRAME* frame)
*/
rdpei_write_8byte_unsigned(s, frame->frameOffset * 1000); /* frameOffset (EIGHT_BYTE_UNSIGNED_INTEGER) */
Stream_EnsureRemainingCapacity(s, frame->contactCount * 64);
Stream_EnsureRemainingCapacity(s, (size_t) frame->contactCount * 64);
for (index = 0; index < frame->contactCount; index++)
{
@ -345,7 +345,7 @@ int rdpei_send_touch_event_pdu(RDPEI_CHANNEL_CALLBACK* callback, RDPINPUT_TOUCH_
* the time that has elapsed (in milliseconds) from when the oldest touch frame
* was generated to when it was encoded for transmission by the client.
*/
rdpei_write_4byte_unsigned(s, frame->frameOffset); /* encodeTime (FOUR_BYTE_UNSIGNED_INTEGER) */
rdpei_write_4byte_unsigned(s, (UINT32) frame->frameOffset); /* encodeTime (FOUR_BYTE_UNSIGNED_INTEGER) */
rdpei_write_2byte_unsigned(s, 1); /* (frameCount) TWO_BYTE_UNSIGNED_INTEGER */

View File

@ -453,7 +453,7 @@ static void rdpsnd_recv_wave_pdu(rdpsndPlugin* rdpsnd, wStream* s)
CopyMemory(Stream_Buffer(s), rdpsnd->waveData, 4);
data = Stream_Buffer(s);
size = Stream_Capacity(s);
size = (int) Stream_Capacity(s);
wave = (RDPSND_WAVE*) malloc(sizeof(RDPSND_WAVE));
@ -866,10 +866,14 @@ int rdpsnd_virtual_channel_write(rdpsndPlugin* rdpsnd, wStream* s)
UINT32 status = 0;
if (!rdpsnd)
{
status = CHANNEL_RC_BAD_INIT_HANDLE;
}
else
{
status = rdpsnd->channelEntryPoints.pVirtualChannelWrite(rdpsnd->OpenHandle,
Stream_Buffer(s), Stream_GetPosition(s), s);
Stream_Buffer(s), (UINT32) Stream_GetPosition(s), s);
}
if (status != CHANNEL_RC_OK)
{

View File

@ -195,7 +195,7 @@ int freerdp_client_print_command_line_help(int argc, char** argv)
if (arg->Format)
{
length = strlen(arg->Name) + strlen(arg->Format) + 2;
length = (int) (strlen(arg->Name) + strlen(arg->Format) + 2);
str = (char*) malloc(length + 1);
sprintf_s(str, length + 1, "%s:%s", arg->Name, arg->Format);
printf("%-20s", str);
@ -210,7 +210,7 @@ int freerdp_client_print_command_line_help(int argc, char** argv)
}
else if (arg->Flags & COMMAND_LINE_VALUE_BOOL)
{
length = strlen(arg->Name) + 32;
length = (int) strlen(arg->Name) + 32;
str = (char*) malloc(length + 1);
sprintf_s(str, length + 1, "%s (default:%s)", arg->Name,
arg->Default ? "on" : "off");
@ -266,7 +266,7 @@ int freerdp_client_command_line_pre_filter(void* context, int index, int argc, L
int length;
rdpSettings* settings;
length = strlen(argv[index]);
length = (int) strlen(argv[index]);
if (length > 4)
{
@ -745,7 +745,7 @@ int freerdp_parse_username(char* username, char** user, char** domain)
if (p)
{
length = p - username;
length = (int) (p - username);
*domain = (char*) malloc(length + 1);
strncpy(*domain, username, length);
(*domain)[length] = '\0';
@ -757,7 +757,7 @@ int freerdp_parse_username(char* username, char** user, char** domain)
if (p)
{
length = p - username;
length = (int) (p - username);
*user = (char*) malloc(length + 1);
strncpy(*user, username, length);
(*user)[length] = '\0';
@ -893,7 +893,7 @@ int freerdp_detect_command_line_pre_filter(void* context, int index, int argc, L
if (index == 1)
{
length = strlen(argv[index]);
length = (int) strlen(argv[index]);
if (length > 4)
{
@ -1127,7 +1127,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
if (p)
{
length = p - arg->Value;
length = (int) (p - arg->Value);
settings->ServerPort = atoi(&p[1]);
settings->ServerHostname = (char*) malloc(length + 1);
strncpy(settings->ServerHostname, arg->Value, length);
@ -1202,7 +1202,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
{
char** p;
int i, count = 0;
UINT32 i, count = 0;
p = freerdp_command_line_parse_comma_separated_values(arg->Value, &count);
@ -1316,7 +1316,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
if (p)
{
length = p - arg->Value;
length = (int) (p - arg->Value);
settings->GatewayPort = atoi(&p[1]);
settings->GatewayHostname = (char*) malloc(length + 1);
strncpy(settings->GatewayHostname, arg->Value, length);
@ -1371,7 +1371,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
CommandLineSwitchCase(arg, "load-balance-info")
{
settings->LoadBalanceInfo = (BYTE*) _strdup(arg->Value);
settings->LoadBalanceInfoLength = strlen((char*) settings->LoadBalanceInfo);
settings->LoadBalanceInfoLength = (UINT32) strlen((char*) settings->LoadBalanceInfo);
}
CommandLineSwitchCase(arg, "app-name")
{
@ -1795,7 +1795,7 @@ int freerdp_client_load_static_channel_addin(rdpChannels* channels, rdpSettings*
int freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
{
int index;
UINT32 index;
ADDIN_ARGV* args;
if ((freerdp_static_channel_collection_find(settings, "rdpsnd")) ||

View File

@ -263,8 +263,8 @@ int freerdp_client_old_command_line_pre_filter(void* context, int index, int arg
if (p != NULL)
{
p = strchr(p, ':');
length = p - a;
args->argv[j + 1] = malloc(length + 1);
length = (int) (p - a);
args->argv[j + 1] = (char*) malloc(length + 1);
CopyMemory(args->argv[j + 1], a, length);
args->argv[j + 1][length] = '\0';
p++;

View File

@ -212,12 +212,12 @@ void freerdp_client_parse_rdp_file_integer_unicode(rdpFile* file, WCHAR* name, W
char* nameA;
char* valueA;
length = _wcslen(name);
length = (int) _wcslen(name);
nameA = (char*) malloc(length + 1);
WideCharToMultiByte(CP_UTF8, 0, name, length, nameA, length, NULL, NULL);
nameA[length] = '\0';
length = _wcslen(value);
length = (int) _wcslen(value);
valueA = (char*) malloc(length + 1);
WideCharToMultiByte(CP_UTF8, 0, value, length, valueA, length, NULL, NULL);
valueA[length] = '\0';
@ -353,12 +353,12 @@ void freerdp_client_parse_rdp_file_string_unicode(rdpFile* file, WCHAR* name, WC
char* nameA;
char* valueA;
length = _wcslen(name);
length = (int) _wcslen(name);
nameA = (char*) malloc(length + 1);
WideCharToMultiByte(CP_UTF8, 0, name, length, nameA, length, NULL, NULL);
nameA[length] = '\0';
length = _wcslen(value);
length = (int) _wcslen(value);
valueA = (char*) malloc(length + 1);
WideCharToMultiByte(CP_UTF8, 0, value, length, valueA, length, NULL, NULL);
valueA[length] = '\0';
@ -407,7 +407,7 @@ BOOL freerdp_client_parse_rdp_file_buffer_ascii(rdpFile* file, const BYTE* buffe
while (line)
{
length = strlen(line);
length = (int) strlen(line);
if (length > 1)
{
@ -482,7 +482,7 @@ BOOL freerdp_client_parse_rdp_file_buffer_unicode(rdpFile* file, const BYTE* buf
while (line != NULL)
{
length = _wcslen(line);
length = (int) _wcslen(line);
if (length > 1)
{
@ -661,7 +661,7 @@ BOOL freerdp_client_write_rdp_file(const rdpFile* file, const char* name, BOOL u
int status = 0;
WCHAR* unicodestr = NULL;
length = freerdp_client_write_rdp_file_buffer(file, NULL, 0);
length = (int) freerdp_client_write_rdp_file_buffer(file, NULL, 0);
if (length < 0)
{
@ -722,7 +722,7 @@ size_t freerdp_client_write_rdp_file_buffer(const rdpFile* file, char* buffer, s
{
line = &(file->lines[index]);
length = strlen(line->text);
length = (int) strlen(line->text);
if (!buffer)
{
@ -812,7 +812,7 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
if (~((size_t) file->LoadBalanceInfo))
{
settings->LoadBalanceInfo = (BYTE*) _strdup(file->LoadBalanceInfo);
settings->LoadBalanceInfoLength = strlen((char*) settings->LoadBalanceInfo);
settings->LoadBalanceInfoLength = (int) strlen((char*) settings->LoadBalanceInfo);
}
if (~file->AuthenticationLevel)

View File

@ -151,11 +151,11 @@ WINPR_SAM_ENTRY* SamReadEntry(WINPR_SAM* sam, WINPR_SAM_ENTRY* entry)
p[5] = strchr(p[4], ':') + 1;
p[6] = p[0] + strlen(p[0]);
entry->UserLength = p[1] - p[0] - 1;
entry->DomainLength = p[2] - p[1] - 1;
entry->UserLength = (UINT32) (p[1] - p[0] - 1);
entry->DomainLength = (UINT32) (p[2] - p[1] - 1);
LmHashLength = p[3] - p[2] - 1;
NtHashLength = p[4] - p[3] - 1;
LmHashLength = (int) (p[3] - p[2] - 1);
NtHashLength = (int) (p[4] - p[3] - 1);
entry->User = (LPSTR) malloc(entry->UserLength + 1);
memcpy(entry->User, p[0], entry->UserLength);
@ -211,7 +211,7 @@ WINPR_SAM_ENTRY* SamLookupUserA(WINPR_SAM* sam, LPSTR User, UINT32 UserLength, L
while (sam->line != NULL)
{
length = strlen(sam->line);
length = (int) strlen(sam->line);
if (length > 1)
{
@ -259,7 +259,7 @@ WINPR_SAM_ENTRY* SamLookupUserW(WINPR_SAM* sam, LPWSTR User, UINT32 UserLength,
while (sam->line != NULL)
{
length = strlen(sam->line);
length = (int) strlen(sam->line);
if (length > 1)
{
@ -274,7 +274,7 @@ WINPR_SAM_ENTRY* SamLookupUserW(WINPR_SAM* sam, LPWSTR User, UINT32 UserLength,
{
if (entry->DomainLength > 0)
{
EntryDomainLength = strlen(entry->Domain) * 2;
EntryDomainLength = (UINT32) strlen(entry->Domain) * 2;
EntryDomain = (LPWSTR) malloc(EntryDomainLength + 2);
MultiByteToWideChar(CP_ACP, 0, entry->Domain, EntryDomainLength / 2,
(LPWSTR) EntryDomain, EntryDomainLength / 2);
@ -300,7 +300,7 @@ WINPR_SAM_ENTRY* SamLookupUserW(WINPR_SAM* sam, LPWSTR User, UINT32 UserLength,
if (DomainMatch)
{
EntryUserLength = strlen(entry->User) * 2;
EntryUserLength = (UINT32) strlen(entry->User) * 2;
EntryUser = (LPWSTR) malloc(EntryUserLength + 2);
MultiByteToWideChar(CP_ACP, 0, entry->User, EntryUserLength / 2,
(LPWSTR) EntryUser, EntryUserLength / 2);