freerdp: fix build warnings on Windows

This commit is contained in:
Marc-André Moreau 2014-05-10 09:50:36 -04:00
parent ad9f73350e
commit ee282a931b
9 changed files with 45 additions and 38 deletions

View File

@ -138,8 +138,8 @@ static DWORD audin_winmm_thread_func(void* arg)
static void audin_winmm_free(IAudinDevice* device)
{
UINT32 i;
AudinWinmmDevice* winmm = (AudinWinmmDevice*) device;
int i;
for (i = 0; i < winmm->cFormats; i++)
{
@ -172,8 +172,8 @@ static void audin_winmm_close(IAudinDevice* device)
static void audin_winmm_set_format(IAudinDevice* device, audinFormat* format, UINT32 FramesPerPacket)
{
UINT32 i;
AudinWinmmDevice* winmm = (AudinWinmmDevice*) device;
int i;
winmm->frames_per_packet = FramesPerPacket;

View File

@ -482,8 +482,8 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
/* http://msdn.microsoft.com/en-us/library/cc232067.aspx */
case FileAllocationInformation:
/* http://msdn.microsoft.com/en-us/library/cc232076.aspx */
#ifndef _WIN32
Stream_Read_UINT64(input, size);
#ifndef _WIN32
if (ftruncate(file->fd, size) != 0)
return FALSE;
#endif

View File

@ -65,8 +65,8 @@ static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL use
static void rdpdr_send_device_list_remove_request(rdpdrPlugin* rdpdr, UINT32 count, UINT32 ids[])
{
UINT32 i;
wStream* s;
int i;
s = Stream_New(NULL, 256);

View File

@ -165,7 +165,7 @@ static void cliprdr_send_format_list(cliprdrContext *cliprdr)
format_count = CountClipboardFormats();
data_size = format_count * (4 + MAX_PATH * 2);
format_data = (BYTE *)calloc(1, data_size);
format_data = (BYTE*) calloc(1, data_size);
assert(format_data != NULL);
while (format = EnumClipboardFormats(format))
@ -191,7 +191,7 @@ static void cliprdr_send_format_list(cliprdrContext *cliprdr)
{
if (format >= CF_MAX)
{
static wchar_t wName[MAX_PATH] = {0};
static WCHAR wName[MAX_PATH] = {0};
int wLen;
ZeroMemory(wName, MAX_PATH*2);
@ -216,15 +216,16 @@ static void cliprdr_send_format_list(cliprdrContext *cliprdr)
if (stream_file_transferring)
{
cliprdr_event->raw_format_data = (BYTE *)calloc(1, (4 + 42));
cliprdr_event->raw_format_data_size = 4 + 42;
cliprdr_event->raw_format_data = (BYTE*) calloc(1, cliprdr_event->raw_format_data_size);
format = RegisterClipboardFormatW(L"FileGroupDescriptorW");
Write_UINT32(cliprdr_event->raw_format_data, format);
wcscpy((wchar_t *)(cliprdr_event->raw_format_data + 4), L"FileGroupDescriptorW");
cliprdr_event->raw_format_data_size = 4 + 42;
wcscpy_s((WCHAR*)(cliprdr_event->raw_format_data + 4),
(cliprdr_event->raw_format_data_size - 4) / 2, L"FileGroupDescriptorW");
}
else
{
cliprdr_event->raw_format_data = (BYTE *)calloc(1, len);
cliprdr_event->raw_format_data = (BYTE*) calloc(1, len);
assert(cliprdr_event->raw_format_data != NULL);
CopyMemory(cliprdr_event->raw_format_data, format_data, len);
@ -232,7 +233,7 @@ static void cliprdr_send_format_list(cliprdrContext *cliprdr)
}
free(format_data);
freerdp_channels_send_event(cliprdr->channels, (wMessage *) cliprdr_event);
freerdp_channels_send_event(cliprdr->channels, (wMessage*) cliprdr_event);
}
int cliprdr_send_data_request(cliprdrContext *cliprdr, UINT32 format)
@ -681,18 +682,21 @@ static BOOL wf_cliprdr_get_file_contents(wchar_t *file_name, BYTE *buffer, int p
}
/* path_name has a '\' at the end. e.g. c:\newfolder\, file_name is c:\newfolder\new.txt */
static FILEDESCRIPTORW *wf_cliprdr_get_file_descriptor(wchar_t *file_name, int pathLen)
static FILEDESCRIPTORW *wf_cliprdr_get_file_descriptor(WCHAR* file_name, int pathLen)
{
FILEDESCRIPTORW *fd;
HANDLE hFile;
fd = (FILEDESCRIPTORW *)malloc(sizeof(FILEDESCRIPTORW));
fd = (FILEDESCRIPTORW*) malloc(sizeof(FILEDESCRIPTORW));
if (!fd)
return NULL;
ZeroMemory(fd, sizeof(FILEDESCRIPTORW));
hFile = CreateFileW(file_name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, NULL);
hFile = CreateFileW(file_name, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
free(fd);
@ -702,13 +706,15 @@ static FILEDESCRIPTORW *wf_cliprdr_get_file_descriptor(wchar_t *file_name, int p
fd->dwFlags = FD_ATTRIBUTES | FD_FILESIZE | FD_WRITESTIME | FD_PROGRESSUI;
fd->dwFileAttributes = GetFileAttributes(file_name);
if (!GetFileTime(hFile, NULL, NULL, &fd->ftLastWriteTime))
{
fd->dwFlags &= ~FD_WRITESTIME;
}
fd->nFileSizeLow = GetFileSize(hFile, &fd->nFileSizeHigh);
wcscpy(fd->cFileName, file_name + pathLen);
wcscpy_s(fd->cFileName, sizeof(fd->cFileName) / 2, file_name + pathLen);
CloseHandle(hFile);
return fd;
@ -727,8 +733,8 @@ static void wf_cliprdr_array_ensure_capacity(cliprdrContext *cliprdr)
static void wf_cliprdr_add_to_file_arrays(cliprdrContext *cliprdr, WCHAR *full_file_name, int pathLen)
{
/* add to name array */
cliprdr->file_names[cliprdr->nFiles] = (LPWSTR)malloc(MAX_PATH);
wcscpy(cliprdr->file_names[cliprdr->nFiles], full_file_name);
cliprdr->file_names[cliprdr->nFiles] = (LPWSTR) malloc(MAX_PATH);
wcscpy_s(cliprdr->file_names[cliprdr->nFiles], MAX_PATH, full_file_name);
/* add to descriptor array */
cliprdr->fileDescriptor[cliprdr->nFiles] = wf_cliprdr_get_file_descriptor(full_file_name, pathLen);
@ -843,14 +849,15 @@ static void wf_cliprdr_process_cb_data_request_event(wfContext* wfc, RDP_CB_DATA
format_etc.ptd = 0;
result = IDataObject_GetData(dataObj, &format_etc, &stg_medium);
if (SUCCEEDED(result))
{
DEBUG_CLIPRDR("Got FileGroupDescriptorW.");
globlemem = (char *)GlobalLock(stg_medium.hGlobal);
uSize = GlobalSize(stg_medium.hGlobal);
size = uSize;
buff = malloc(uSize);
memcpy(buff, globlemem, uSize);
buff = (char*) malloc(uSize);
CopyMemory(buff, globlemem, uSize);
GlobalUnlock(stg_medium.hGlobal);
ReleaseStgMedium(&stg_medium);

View File

@ -94,7 +94,7 @@ HRESULT STDMETHODCALLTYPE CliprdrEnumFORMATETC_Skip(IEnumFORMATETC *This, ULONG
{
CliprdrEnumFORMATETC *instance = (CliprdrEnumFORMATETC *)This;
if (instance->m_nIndex + celt > instance->m_nNumFormats)
if (instance->m_nIndex + (LONG) celt > instance->m_nNumFormats)
return S_FALSE;
instance->m_nIndex += celt;

View File

@ -55,7 +55,7 @@ CHANNEL_OPEN_DATA* freerdp_channels_find_channel_open_data_by_name(rdpChannels*
/* returns rdpChannel for the channel name passed in */
rdpMcsChannel* freerdp_channels_find_channel_by_name(rdpRdp* rdp, const char* name)
{
int index;
UINT32 index;
rdpMcsChannel* channel;
rdpMcs* mcs = rdp->mcs;
@ -221,7 +221,7 @@ int freerdp_channels_post_connect(rdpChannels* channels, freerdp* instance)
int freerdp_channels_data(freerdp* instance, UINT16 channelId, BYTE* data, int dataSize, int flags, int totalSize)
{
int index;
UINT32 index;
rdpMcs* mcs;
rdpChannels* channels;
rdpMcsChannel* channel = NULL;

View File

@ -186,7 +186,7 @@ static const char* const mcs_result_enumerated[] =
int mcs_initialize_client_channels(rdpMcs* mcs, rdpSettings* settings)
{
int index;
UINT32 index;
mcs->channelCount = settings->ChannelCount;
if (mcs->channelCount > mcs->channelMaxCount)

View File

@ -358,7 +358,7 @@ static void WTSProcessChannelData(rdpPeerChannel* channel, UINT16 channelId, BYT
static int WTSReceiveChannelData(freerdp_peer* client, UINT16 channelId, BYTE* data, int size, int flags, int totalSize)
{
int i;
UINT32 i;
BOOL status = FALSE;
rdpPeerChannel* channel;
rdpMcs* mcs = client->context->rdp->mcs;
@ -846,8 +846,8 @@ BOOL WINAPI FreeRDP_WTSWaitSystemEvent(HANDLE hServer, DWORD EventMask, DWORD* p
HANDLE WINAPI FreeRDP_WTSVirtualChannelOpen(HANDLE hServer, DWORD SessionId, LPSTR pVirtualName)
{
int index;
int length;
UINT32 index;
rdpMcs* mcs;
BOOL joined = FALSE;
freerdp_peer* client;
@ -910,7 +910,7 @@ HANDLE WINAPI FreeRDP_WTSVirtualChannelOpen(HANDLE hServer, DWORD SessionId, LPS
HANDLE WINAPI FreeRDP_WTSVirtualChannelOpenEx(DWORD SessionId, LPSTR pVirtualName, DWORD flags)
{
int index;
UINT32 index;
wStream* s;
rdpMcs* mcs;
BOOL joined = FALSE;

View File

@ -48,37 +48,37 @@ extern "C" {
#define BitStream_Prefetch(_bs) do { \
(_bs->prefetch) = 0; \
if ((_bs->pointer - _bs->buffer) < (_bs->capacity + 4)) \
if (((UINT32) (_bs->pointer - _bs->buffer)) < (_bs->capacity + 4)) \
(_bs->prefetch) |= (*(_bs->pointer + 4) << 24); \
if ((_bs->pointer - _bs->buffer) < (_bs->capacity + 5)) \
if (((UINT32) (_bs->pointer - _bs->buffer)) < (_bs->capacity + 5)) \
(_bs->prefetch) |= (*(_bs->pointer + 5) << 16); \
if ((_bs->pointer - _bs->buffer) < (_bs->capacity + 6)) \
if (((UINT32) (_bs->pointer - _bs->buffer)) < (_bs->capacity + 6)) \
(_bs->prefetch) |= (*(_bs->pointer + 6) << 8); \
if ((_bs->pointer - _bs->buffer) < (_bs->capacity + 7)) \
if (((UINT32) (_bs->pointer - _bs->buffer)) < (_bs->capacity + 7)) \
(_bs->prefetch) |= (*(_bs->pointer + 7) << 0); \
} while(0)
#define BitStream_Fetch(_bs) do { \
(_bs->accumulator) = 0; \
if ((_bs->pointer - _bs->buffer) < (_bs->capacity + 0)) \
if (((UINT32) (_bs->pointer - _bs->buffer)) < (_bs->capacity + 0)) \
(_bs->accumulator) |= (*(_bs->pointer + 0) << 24); \
if ((_bs->pointer - _bs->buffer) < (_bs->capacity + 1)) \
if (((UINT32) (_bs->pointer - _bs->buffer)) < (_bs->capacity + 1)) \
(_bs->accumulator) |= (*(_bs->pointer + 1) << 16); \
if ((_bs->pointer - _bs->buffer) < (_bs->capacity + 2)) \
if (((UINT32) (_bs->pointer - _bs->buffer)) < (_bs->capacity + 2)) \
(_bs->accumulator) |= (*(_bs->pointer + 2) << 8); \
if ((_bs->pointer - _bs->buffer) < (_bs->capacity + 3)) \
if (((UINT32) (_bs->pointer - _bs->buffer)) <(_bs->capacity + 3)) \
(_bs->accumulator) |= (*(_bs->pointer + 3) << 0); \
BitStream_Prefetch(_bs); \
} while(0)
#define BitStream_Flush(_bs) do { \
if ((_bs->pointer - _bs->buffer) < (_bs->capacity + 0)) \
if (((UINT32) (_bs->pointer - _bs->buffer)) < (_bs->capacity + 0)) \
*(_bs->pointer + 0) = (_bs->accumulator >> 24); \
if ((_bs->pointer - _bs->buffer) < (_bs->capacity + 1)) \
if (((UINT32) (_bs->pointer - _bs->buffer)) < (_bs->capacity + 1)) \
*(_bs->pointer + 1) = (_bs->accumulator >> 16); \
if ((_bs->pointer - _bs->buffer) < (_bs->capacity + 2)) \
if (((UINT32) (_bs->pointer - _bs->buffer)) < (_bs->capacity + 2)) \
*(_bs->pointer + 2) = (_bs->accumulator >> 8); \
if ((_bs->pointer - _bs->buffer) < (_bs->capacity + 3)) \
if (((UINT32) (_bs->pointer - _bs->buffer)) < (_bs->capacity + 3)) \
*(_bs->pointer + 3) = (_bs->accumulator >> 0); \
} while(0)