Merge pull request #6562 from akallabeth/warning_fixes

Fixed compilation warnings.
This commit is contained in:
Martin Fleisz 2020-11-10 09:13:23 +01:00 committed by GitHub
commit fcbe7010ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 91 additions and 47 deletions

View File

@ -192,7 +192,7 @@ static const char* dvcman_get_channel_name(IWTSVirtualChannel* channel)
static IWTSVirtualChannel* dvcman_find_channel_by_id(IWTSVirtualChannelManager* pChannelMgr,
UINT32 ChannelId)
{
int index;
size_t index;
IWTSVirtualChannel* channel = NULL;
DVCMAN* dvcman = (DVCMAN*)pChannelMgr;
ArrayList_Lock(dvcman->channels);
@ -415,7 +415,7 @@ static void dvcman_free(drdynvcPlugin* drdynvc, IWTSVirtualChannelManager* pChan
*/
static UINT dvcman_init(drdynvcPlugin* drdynvc, IWTSVirtualChannelManager* pChannelMgr)
{
int i;
size_t i;
DVCMAN* dvcman = (DVCMAN*)pChannelMgr;
UINT error = CHANNEL_RC_OK;
@ -488,7 +488,7 @@ static UINT dvcman_close_channel_iface(IWTSVirtualChannel* pChannel)
static UINT dvcman_create_channel(drdynvcPlugin* drdynvc, IWTSVirtualChannelManager* pChannelMgr,
UINT32 ChannelId, const char* ChannelName)
{
int i;
size_t i;
BOOL bAccept;
DVCMAN_CHANNEL* channel;
DrdynvcClientContext* context;
@ -1618,7 +1618,7 @@ static UINT drdynvc_virtual_channel_event_terminated(drdynvcPlugin* drdynvc)
static UINT drdynvc_virtual_channel_event_attached(drdynvcPlugin* drdynvc)
{
UINT error = CHANNEL_RC_OK;
int i;
size_t i;
DVCMAN* dvcman;
if (!drdynvc)
@ -1650,7 +1650,7 @@ fail:
static UINT drdynvc_virtual_channel_event_detached(drdynvcPlugin* drdynvc)
{
UINT error = CHANNEL_RC_OK;
int i;
size_t i;
DVCMAN* dvcman;
if (!drdynvc)

View File

@ -860,7 +860,7 @@ static DWORD WINAPI drive_hotplug_thread_func(LPVOID arg)
DWORD status;
rdpdr = (rdpdrPlugin*)arg;
while (status = WaitForSingleObject(rdpdr->stopEvent, 1000) == WAIT_TIMEOUT)
while ((status = WaitForSingleObject(rdpdr->stopEvent, 1000)) == WAIT_TIMEOUT)
{
error = handle_hotplug(rdpdr);
switch (error)

View File

@ -1744,12 +1744,11 @@ size_t udev_new_by_id(URBDRC_PLUGIN* urbdrc, libusb_context* ctx, UINT16 idVendo
WLog_Print(urbdrc->log, WLOG_INFO, "VID: 0x%04" PRIX16 ", PID: 0x%04" PRIX16 "", idVendor,
idProduct);
array = (UDEVICE**)calloc(16, sizeof(UDEVICE*));
total_device = libusb_get_device_list(ctx, &libusb_list);
array = (UDEVICE**)calloc(total_device, sizeof(UDEVICE*));
if (!array)
return 0;
total_device = libusb_get_device_list(ctx, &libusb_list);
goto fail;
for (i = 0; i < total_device; i++)
{
@ -1768,6 +1767,7 @@ size_t udev_new_by_id(URBDRC_PLUGIN* urbdrc, libusb_context* ctx, UINT16 idVendo
free(descriptor);
}
fail:
libusb_free_device_list(libusb_list, 1);
*devArray = (IUDEVICE**)array;
return num;

View File

@ -240,7 +240,8 @@ static BOOL _xf_Pointer_GetCursorForCurrentScale(rdpContext* context, const rdpP
double xscale;
double yscale;
size_t size;
int cursorIndex = -1, i;
int cursorIndex = -1;
UINT32 i;
void* tmp;
if (!context || !pointer || !context->gdi)

View File

@ -217,7 +217,6 @@ static BOOL freerdp_dsp_resample(FREERDP_DSP_CONTEXT* context, const BYTE* src,
size_t idone, odone;
size_t sframes, rframes;
size_t rsize;
size_t j;
size_t sbytes, rbytes;
#endif
size_t srcBytesPerFrame, dstBytesPerFrame;

View File

@ -136,12 +136,14 @@ BOOL pf_modules_run_hook(PF_HOOK_TYPE type, proxyData* pdata)
static BOOL pf_modules_ArrayList_ForEachFkt(void* data, size_t index, va_list ap)
{
proxyPlugin* plugin = (proxyPlugin*)data;
PF_HOOK_TYPE type;
PF_FILTER_TYPE type;
proxyData* pdata;
void* param;
BOOL result = FALSE;
type = va_arg(ap, PF_HOOK_TYPE);
WINPR_UNUSED(index);
type = va_arg(ap, PF_FILTER_TYPE);
pdata = va_arg(ap, proxyData*);
param = va_arg(ap, void*);
@ -308,7 +310,6 @@ BOOL pf_modules_is_plugin_loaded(const char* plugin_name)
static BOOL pf_modules_print_ArrayList_ForEachFkt(void* data, size_t index, va_list ap)
{
proxyPlugin* plugin = (proxyPlugin*)data;
const char* plugin_name = va_arg(ap, const char*);
WINPR_UNUSED(index);
WINPR_UNUSED(ap);
@ -429,7 +430,6 @@ error:
static BOOL pf_modules_free_ArrayList_ForEachFkt(void* data, size_t index, va_list ap)
{
proxyPlugin* plugin = (proxyPlugin*)data;
const char* plugin_name = va_arg(ap, const char*);
WINPR_UNUSED(index);
WINPR_UNUSED(ap);

View File

@ -399,7 +399,7 @@ static int x11_shadow_pointer_position_update(x11ShadowSubsystem* subsystem)
rdpShadowServer* server;
SHADOW_MSG_OUT_POINTER_POSITION_UPDATE templateMsg;
int count = 0;
int index = 0;
size_t index = 0;
if (!subsystem || !subsystem->common.server || !subsystem->common.server->clients)
return -1;

View File

@ -1998,7 +1998,7 @@ int shadow_client_boardcast_msg(rdpShadowServer* server, void* context, UINT32 t
wMessage message = { 0 };
rdpShadowClient* client = NULL;
int count = 0;
int index = 0;
size_t index = 0;
message.context = context;
message.id = type;
message.wParam = (void*)msg;
@ -2029,7 +2029,7 @@ int shadow_client_boardcast_quit(rdpShadowServer* server, int nExitCode)
{
wMessageQueue* queue = NULL;
int count = 0;
int index = 0;
size_t index = 0;
ArrayList_Lock(server->clients);
for (index = 0; index < ArrayList_Count(server->clients); index++)

View File

@ -112,7 +112,7 @@ static void _Publish(rdpShadowMultiClientEvent* event)
{
wArrayList* subscribers;
struct rdp_shadow_multiclient_subscriber* subscriber = NULL;
int i;
size_t i;
subscribers = event->subscribers;

View File

@ -485,7 +485,7 @@ extern "C"
{
const char* EventName;
wEventArgs EventArgs;
int EventHandlerCount;
size_t EventHandlerCount;
pEventHandler EventHandlers[MAX_EVENT_HANDLERS];
};
typedef struct _wEventType wEventType;

View File

@ -23,7 +23,9 @@
#include <errno.h>
#include <stdio.h>
#include <ctype.h>
#include <wctype.h>
#include <wchar.h>
#include <winpr/crt.h>
#include <winpr/endian.h>
@ -232,7 +234,7 @@ LPSTR CharUpperA(LPSTR lpsz)
char c = *lpsz;
if ((c >= 'a') && (c <= 'z'))
c = c - 32;
c = c - 'a' + 'A';
*lpsz = c;
return lpsz;
@ -241,7 +243,7 @@ LPSTR CharUpperA(LPSTR lpsz)
for (i = 0; i < length; i++)
{
if ((lpsz[i] >= 'a') && (lpsz[i] <= 'z'))
lpsz[i] = lpsz[i] - 32;
lpsz[i] = lpsz[i] - 'a' + 'A';
}
return lpsz;
@ -249,8 +251,35 @@ LPSTR CharUpperA(LPSTR lpsz)
LPWSTR CharUpperW(LPWSTR lpsz)
{
WLog_ERR(TAG, "CharUpperW unimplemented!");
return (LPWSTR)NULL;
size_t i;
size_t length;
if (!lpsz)
return NULL;
length = _wcslen(lpsz);
if (length < 1)
return (LPWSTR)NULL;
if (length == 1)
{
WCHAR c = *lpsz;
if ((c >= L'a') && (c <= L'z'))
c = c - L'a' + L'A';
*lpsz = c;
return lpsz;
}
for (i = 0; i < length; i++)
{
if ((lpsz[i] >= L'a') && (lpsz[i] <= L'z'))
lpsz[i] = lpsz[i] - L'a' + L'A';
}
return lpsz;
}
DWORD CharUpperBuffA(LPSTR lpsz, DWORD cchLength)
@ -263,7 +292,7 @@ DWORD CharUpperBuffA(LPSTR lpsz, DWORD cchLength)
for (i = 0; i < cchLength; i++)
{
if ((lpsz[i] >= 'a') && (lpsz[i] <= 'z'))
lpsz[i] = lpsz[i] - 32;
lpsz[i] = lpsz[i] - 'a' + 'A';
}
return cchLength;
@ -302,7 +331,7 @@ LPSTR CharLowerA(LPSTR lpsz)
char c = *lpsz;
if ((c >= 'A') && (c <= 'Z'))
c = c + 32;
c = c - 'A' + 'a';
*lpsz = c;
return lpsz;
@ -311,7 +340,7 @@ LPSTR CharLowerA(LPSTR lpsz)
for (i = 0; i < length; i++)
{
if ((lpsz[i] >= 'A') && (lpsz[i] <= 'Z'))
lpsz[i] = lpsz[i] + 32;
lpsz[i] = lpsz[i] - 'A' + 'a';
}
return lpsz;
@ -319,8 +348,8 @@ LPSTR CharLowerA(LPSTR lpsz)
LPWSTR CharLowerW(LPWSTR lpsz)
{
WLog_ERR(TAG, "CharLowerW unimplemented!");
return (LPWSTR)NULL;
CharLowerBuffW(lpsz, _wcslen(lpsz));
return lpsz;
}
DWORD CharLowerBuffA(LPSTR lpsz, DWORD cchLength)
@ -333,7 +362,7 @@ DWORD CharLowerBuffA(LPSTR lpsz, DWORD cchLength)
for (i = 0; i < cchLength; i++)
{
if ((lpsz[i] >= 'A') && (lpsz[i] <= 'Z'))
lpsz[i] = lpsz[i] + 32;
lpsz[i] = lpsz[i] - 'A' + 'a';
}
return cchLength;
@ -364,8 +393,10 @@ BOOL IsCharAlphaA(CHAR ch)
BOOL IsCharAlphaW(WCHAR ch)
{
WLog_ERR(TAG, "IsCharAlphaW unimplemented!");
return 0;
if (((ch >= L'a') && (ch <= L'z')) || ((ch >= L'A') && (ch <= L'Z')))
return 1;
else
return 0;
}
BOOL IsCharAlphaNumericA(CHAR ch)
@ -379,8 +410,11 @@ BOOL IsCharAlphaNumericA(CHAR ch)
BOOL IsCharAlphaNumericW(WCHAR ch)
{
WLog_ERR(TAG, "IsCharAlphaNumericW unimplemented!");
return 0;
if (((ch >= L'a') && (ch <= L'z')) || ((ch >= L'A') && (ch <= L'Z')) ||
((ch >= L'0') && (ch <= L'9')))
return 1;
else
return 0;
}
BOOL IsCharUpperA(CHAR ch)
@ -393,8 +427,10 @@ BOOL IsCharUpperA(CHAR ch)
BOOL IsCharUpperW(WCHAR ch)
{
WLog_ERR(TAG, "IsCharUpperW unimplemented!");
return 0;
if ((ch >= L'A') && (ch <= L'Z'))
return 1;
else
return 0;
}
BOOL IsCharLowerA(CHAR ch)
@ -407,8 +443,10 @@ BOOL IsCharLowerA(CHAR ch)
BOOL IsCharLowerW(WCHAR ch)
{
WLog_ERR(TAG, "IsCharLowerW unimplemented!");
return 0;
if ((ch >= L'a') && (ch <= L'z'))
return 1;
else
return 0;
}
int lstrlenA(LPCSTR lpString)

View File

@ -238,7 +238,7 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
{
int i;
size_t i;
if (!lpFileName)
return INVALID_HANDLE_VALUE;

View File

@ -480,6 +480,10 @@ BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpP
int pipe_fd[2];
WINPR_PIPE* pReadPipe;
WINPR_PIPE* pWritePipe;
WINPR_UNUSED(lpPipeAttributes);
WINPR_UNUSED(nSize);
pipe_fd[0] = -1;
pipe_fd[1] = -1;
@ -516,7 +520,7 @@ BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpP
static void winpr_unref_named_pipe(WINPR_NAMED_PIPE* pNamedPipe)
{
int index;
size_t index;
NamedPipeServerSocketEntry* baseSocket;
if (!pNamedPipe)
@ -559,13 +563,15 @@ HANDLE CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD
DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut,
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
{
int index;
size_t index;
char* lpPipePath;
struct sockaddr_un s;
WINPR_NAMED_PIPE* pNamedPipe = NULL;
int serverfd = -1;
NamedPipeServerSocketEntry* baseSocket = NULL;
WINPR_UNUSED(lpSecurityAttributes);
if (dwOpenMode & FILE_FLAG_OVERLAPPED)
{
WLog_ERR(TAG, "WinPR %s does not support the FILE_FLAG_OVERLAPPED flag", __FUNCTION__);

View File

@ -140,7 +140,7 @@ void* ArrayList_GetItem(wArrayList* arrayList, size_t index)
{
void* obj = NULL;
if ((index >= 0) && (index < arrayList->size))
if (index < arrayList->size)
{
obj = arrayList->array[index];
}
@ -154,7 +154,7 @@ void* ArrayList_GetItem(wArrayList* arrayList, size_t index)
void ArrayList_SetItem(wArrayList* arrayList, size_t index, const void* obj)
{
if ((index >= 0) && (index < arrayList->size))
if (index < arrayList->size)
{
if (arrayList->object.fnObjectNew)
arrayList->array[index] = arrayList->object.fnObjectNew(obj);
@ -297,7 +297,7 @@ BOOL ArrayList_Insert(wArrayList* arrayList, size_t index, const void* obj)
ArrayList_Lock_Conditional(arrayList);
if ((index >= 0) && (index < arrayList->size))
if (index < arrayList->size)
{
if (!ArrayList_Shift(arrayList, index, 1))
{
@ -358,7 +358,7 @@ BOOL ArrayList_RemoveAt(wArrayList* arrayList, size_t index)
ArrayList_Lock_Conditional(arrayList);
if ((index >= 0) && (index < arrayList->size))
if (index < arrayList->size)
{
if (arrayList->object.fnObjectFree)
arrayList->object.fnObjectFree(arrayList->array[index]);

View File

@ -172,7 +172,7 @@ int PubSub_Unsubscribe(wPubSub* pubSub, const char* EventName, pEventHandler Eve
int PubSub_OnEvent(wPubSub* pubSub, const char* EventName, void* context, wEventArgs* e)
{
int index;
size_t index;
wEventType* event;
int status = -1;