[build] fix memory sanitizer stack frame warnings

This commit is contained in:
Armin Novak 2023-06-05 12:16:57 +02:00 committed by Martin Fleisz
parent 734ae69756
commit a4c6b36a19
65 changed files with 307 additions and 428 deletions

View File

@ -146,8 +146,8 @@ static DWORD WINAPI audin_oss_thread_func(LPVOID arg)
char mixer_name[PATH_MAX] = "/dev/mixer";
int pcm_handle = -1, mixer_handle;
BYTE* buffer = NULL;
unsigned long tmp;
size_t buffer_size;
unsigned long tmp = 0;
size_t buffer_size = 0;
AudinOSSDevice* oss = (AudinOSSDevice*)arg;
UINT error = 0;
DWORD status;
@ -240,7 +240,7 @@ static DWORD WINAPI audin_oss_thread_func(LPVOID arg)
while (1)
{
SSIZE_T stmp;
SSIZE_T stmp = -1;
status = WaitForSingleObject(oss->stopEvent, 0);
if (status == WAIT_FAILED)

View File

@ -530,8 +530,8 @@ typedef struct
static DWORD WINAPI channel_client_thread_proc(LPVOID userdata)
{
UINT error = CHANNEL_RC_OK;
wStream* data;
wMessage message;
wStream* data = NULL;
wMessage message = { 0 };
msg_proc_internals* internals = userdata;
WINPR_ASSERT(internals);

View File

@ -1387,19 +1387,16 @@ static UINT drdynvc_process_close_request(drdynvcPlugin* drdynvc, int Sp, int cb
*/
static UINT drdynvc_order_recv(drdynvcPlugin* drdynvc, wStream* s, UINT32 ThreadingFlags)
{
UINT8 value;
UINT8 Cmd;
UINT8 Sp;
UINT8 cbChId;
UINT8 value = 0;
WINPR_ASSERT(drdynvc);
if (!Stream_CheckAndLogRequiredLength(TAG, s, 1))
return ERROR_INVALID_DATA;
Stream_Read_UINT8(s, value);
Cmd = (value & 0xf0) >> 4;
Sp = (value & 0x0c) >> 2;
cbChId = (value & 0x03) >> 0;
const UINT8 Cmd = (value & 0xf0) >> 4;
const UINT8 Sp = (value & 0x0c) >> 2;
const UINT8 cbChId = (value & 0x03) >> 0;
WLog_Print(drdynvc->log, WLOG_TRACE, "order_recv: Cmd=%s, Sp=%" PRIu8 " cbChId=%" PRIu8,
drdynvc_get_packet_type(Cmd), Sp, cbChId);
@ -1552,8 +1549,8 @@ static void VCAPITYPE drdynvc_virtual_channel_open_event_ex(LPVOID lpUserParam,
static DWORD WINAPI drdynvc_virtual_channel_client_thread(LPVOID arg)
{
/* TODO: rewrite this */
wStream* data;
wMessage message;
wStream* data = NULL;
wMessage message = { 0 };
UINT error = CHANNEL_RC_OK;
drdynvcPlugin* drdynvc = (drdynvcPlugin*)arg;

View File

@ -739,8 +739,8 @@ static UINT drive_process_irp(DRIVE_DEVICE* drive, IRP* irp)
static DWORD WINAPI drive_thread_func(LPVOID arg)
{
IRP* irp;
wMessage message;
IRP* irp = NULL;
wMessage message = { 0 };
DRIVE_DEVICE* drive = (DRIVE_DEVICE*)arg;
UINT error = CHANNEL_RC_OK;

View File

@ -1015,8 +1015,8 @@ static VOID VCAPITYPE encomsp_virtual_channel_open_event_ex(LPVOID lpUserParam,
static DWORD WINAPI encomsp_virtual_channel_client_thread(LPVOID arg)
{
wStream* data;
wMessage message;
wStream* data = NULL;
wMessage message = { 0 };
encomspPlugin* encomsp = (encomspPlugin*)arg;
UINT error = CHANNEL_RC_OK;
encomsp_process_connect(encomsp);

View File

@ -312,8 +312,8 @@ static UINT parallel_process_irp(PARALLEL_DEVICE* parallel, IRP* irp)
static DWORD WINAPI parallel_thread_func(LPVOID arg)
{
IRP* irp;
wMessage message;
IRP* irp = NULL;
wMessage message = { 0 };
PARALLEL_DEVICE* parallel = (PARALLEL_DEVICE*)arg;
UINT error = CHANNEL_RC_OK;

View File

@ -90,12 +90,11 @@ static RdpdrDevice* rdpdr_device_new(void)
static void* rdpdr_device_clone(const void* val)
{
const RdpdrDevice* other = val;
RdpdrDevice* tmp;
if (!other)
return NULL;
tmp = rdpdr_device_new();
RdpdrDevice* tmp = rdpdr_device_new();
if (!tmp)
goto fail;

View File

@ -146,10 +146,8 @@ static UINT enumerator_server_recv_device_added_notification(CamDevEnumServerCon
{
CAM_DEVICE_ADDED_NOTIFICATION pdu;
UINT error = CHANNEL_RC_OK;
size_t remaining_length;
WCHAR* channel_name_start;
char* tmp;
size_t i;
size_t remaining_length = 0;
WCHAR* channel_name_start = 0;
WINPR_ASSERT(context);
WINPR_ASSERT(header);
@ -172,6 +170,7 @@ static UINT enumerator_server_recv_device_added_notification(CamDevEnumServerCon
channel_name_start = (WCHAR*)Stream_Pointer(s);
/* Search for null terminator of DeviceName */
size_t i = 0;
for (i = 0; i < remaining_length; i += sizeof(WCHAR), ++channel_name_start)
{
if (*channel_name_start == L'\0')
@ -194,7 +193,7 @@ static UINT enumerator_server_recv_device_added_notification(CamDevEnumServerCon
return ERROR_INVALID_DATA;
}
tmp = pdu.VirtualChannelName;
char* tmp = pdu.VirtualChannelName;
for (; i < remaining_length; ++i, ++tmp)
{
if (*tmp == '\0')
@ -221,9 +220,7 @@ static UINT enumerator_server_recv_device_removed_notification(CamDevEnumServerC
{
CAM_DEVICE_REMOVED_NOTIFICATION pdu;
UINT error = CHANNEL_RC_OK;
size_t remaining_length;
char* tmp;
size_t i;
size_t remaining_length = 0;
WINPR_ASSERT(context);
WINPR_ASSERT(header);
@ -236,9 +233,9 @@ static UINT enumerator_server_recv_device_removed_notification(CamDevEnumServerC
pdu.VirtualChannelName = (char*)Stream_Pointer(s);
remaining_length = Stream_GetRemainingLength(s);
tmp = (char*)(Stream_Pointer(s) + 1);
char* tmp = (char*)(Stream_Pointer(s) + 1);
for (i = 1; i < remaining_length; ++i, ++tmp)
for (size_t i = 1; i < remaining_length; ++i, ++tmp)
{
if (*tmp == '\0')
break;

View File

@ -168,13 +168,13 @@ static UINT rdpgfx_decode_AVC420(RDPGFX_PLUGIN* gfx, RDPGFX_SURFACE_COMMAND* cmd
*/
static UINT rdpgfx_decode_AVC444(RDPGFX_PLUGIN* gfx, RDPGFX_SURFACE_COMMAND* cmd)
{
UINT error;
UINT32 tmp;
size_t pos1, pos2;
wStream* s;
UINT error = 0;
UINT32 tmp = 0;
size_t pos1 = 0, pos2 = 0;
RDPGFX_AVC444_BITMAP_STREAM h264 = { 0 };
RdpgfxClientContext* context = gfx->context;
s = Stream_New(cmd->data, cmd->length);
wStream* s = Stream_New(cmd->data, cmd->length);
if (!s)
{

View File

@ -139,7 +139,7 @@ static BOOL rdpsnd_oss_format_supported(rdpsndDevicePlugin* device, const AUDIO_
static BOOL rdpsnd_oss_set_format(rdpsndDevicePlugin* device, const AUDIO_FORMAT* format,
UINT32 latency)
{
int tmp;
int tmp = 0;
rdpsndOssPlugin* oss = (rdpsndOssPlugin*)device;
if (device == NULL || oss->pcm_handle == -1 || format == NULL)

View File

@ -1384,10 +1384,10 @@ static DWORD WINAPI play_thread(LPVOID arg)
while (TRUE)
{
int rc;
wMessage message;
wStream* s;
DWORD status;
int rc = -1;
wMessage message = { 0 };
wStream* s = NULL;
DWORD status = 0;
DWORD nCount = 0;
HANDLE handles[MAXIMUM_WAIT_OBJECTS] = { 0 };

View File

@ -846,8 +846,8 @@ static VOID VCAPITYPE remdesk_virtual_channel_open_event_ex(LPVOID lpUserParam,
static DWORD WINAPI remdesk_virtual_channel_client_thread(LPVOID arg)
{
wStream* data;
wMessage message;
wStream* data = NULL;
wMessage message = { 0 };
remdeskPlugin* remdesk = (remdeskPlugin*)arg;
UINT error = CHANNEL_RC_OK;

View File

@ -692,8 +692,8 @@ static void terminate_pending_irp_threads(SERIAL_DEVICE* serial)
static DWORD WINAPI serial_thread_func(LPVOID arg)
{
IRP* irp;
wMessage message;
IRP* irp = NULL;
wMessage message = { 0 };
SERIAL_DEVICE* serial = (SERIAL_DEVICE*)arg;
UINT error = CHANNEL_RC_OK;

View File

@ -75,15 +75,15 @@ static SMARTCARD_DEVICE* cast_device_from(DEVICE* device, const char* fkt, const
static DWORD WINAPI smartcard_context_thread(LPVOID arg)
{
SMARTCARD_CONTEXT* pContext = (SMARTCARD_CONTEXT*)arg;
DWORD nCount;
DWORD nCount = 0;
LONG status = 0;
DWORD waitStatus;
HANDLE hEvents[2];
wMessage message;
SMARTCARD_DEVICE* smartcard;
DWORD waitStatus = 0;
HANDLE hEvents[2] = { 0 };
wMessage message = { 0 };
SMARTCARD_DEVICE* smartcard = NULL;
UINT error = CHANNEL_RC_OK;
smartcard = pContext->smartcard;
nCount = 0;
hEvents[nCount++] = MessageQueue_Event(pContext->IrpQueue);
while (1)
@ -520,18 +520,17 @@ static UINT smartcard_process_irp(SMARTCARD_DEVICE* smartcard, IRP* irp, BOOL* h
static DWORD WINAPI smartcard_thread_func(LPVOID arg)
{
IRP* irp;
DWORD nCount;
DWORD status;
HANDLE hEvents[1];
wMessage message;
IRP* irp = NULL;
DWORD nCount = 0;
DWORD status = 0;
HANDLE hEvents[1] = { 0 };
wMessage message = { 0 };
UINT error = CHANNEL_RC_OK;
SMARTCARD_DEVICE* smartcard = CAST_FROM_DEVICE(arg);
if (!smartcard)
return ERROR_INVALID_PARAMETER;
nCount = 0;
hEvents[nCount++] = MessageQueue_Event(smartcard->IrpQueue);
while (1)

View File

@ -512,11 +512,9 @@ out:
static BOOL xf_process_x_events(freerdp* instance)
{
BOOL status;
int pending_status;
BOOL status = TRUE;
int pending_status = 1;
xfContext* xfc = (xfContext*)instance->context;
status = TRUE;
pending_status = TRUE;
while (pending_status)
{
@ -574,16 +572,14 @@ BOOL xf_create_window(xfContext* xfc)
{
XGCValues gcv = { 0 };
XEvent xevent = { 0 };
int width, height;
char* windowTitle;
rdpSettings* settings;
char* windowTitle = NULL;
WINPR_ASSERT(xfc);
settings = xfc->common.context.settings;
rdpSettings* settings = xfc->common.context.settings;
WINPR_ASSERT(settings);
width = settings->DesktopWidth;
height = settings->DesktopHeight;
int width = settings->DesktopWidth;
int height = settings->DesktopHeight;
const XSetWindowAttributes empty = { 0 };
xfc->attribs = empty;
@ -1221,22 +1217,17 @@ static BOOL xf_pre_connect(freerdp* instance)
*/
static BOOL xf_post_connect(freerdp* instance)
{
rdpUpdate* update;
rdpContext* context;
rdpSettings* settings;
ResizeWindowEventArgs e;
xfContext* xfc;
BOOL serverIsWindowsPlatform;
ResizeWindowEventArgs e = { 0 };
WINPR_ASSERT(instance);
xfc = (xfContext*)instance->context;
context = instance->context;
xfContext* xfc = (xfContext*)instance->context;
rdpContext* context = instance->context;
WINPR_ASSERT(context);
settings = context->settings;
rdpSettings* settings = context->settings;
WINPR_ASSERT(settings);
update = context->update;
rdpUpdate* update = context->update;
WINPR_ASSERT(update);
if (settings->RemoteApplicationMode)
@ -1300,7 +1291,7 @@ static BOOL xf_post_connect(freerdp* instance)
update->SetKeyboardIndicators = xf_keyboard_set_indicators;
update->SetKeyboardImeStatus = xf_keyboard_set_ime_status;
serverIsWindowsPlatform = (settings->OsMajorType == OSMAJORTYPE_WINDOWS);
const BOOL serverIsWindowsPlatform = (settings->OsMajorType == OSMAJORTYPE_WINDOWS);
if (settings->RedirectClipboard &&
!(xfc->clipboard = xf_clipboard_new(xfc, !serverIsWindowsPlatform)))
return FALSE;
@ -1403,31 +1394,24 @@ static BOOL handle_window_events(freerdp* instance)
*/
static DWORD WINAPI xf_client_thread(LPVOID param)
{
BOOL status;
DWORD exit_code = 0;
DWORD nCount;
DWORD waitStatus;
HANDLE handles[MAXIMUM_WAIT_OBJECTS] = { 0 };
xfContext* xfc;
freerdp* instance;
rdpContext* context;
DWORD waitStatus = 0;
HANDLE inputEvent = NULL;
HANDLE timer = NULL;
LARGE_INTEGER due;
rdpSettings* settings;
TimerEventArgs timerEvent;
LARGE_INTEGER due = { 0 };
TimerEventArgs timerEvent = { 0 };
EventArgsInit(&timerEvent, "xfreerdp");
instance = (freerdp*)param;
freerdp* instance = (freerdp*)param;
WINPR_ASSERT(instance);
status = freerdp_connect(instance);
context = instance->context;
const BOOL status = freerdp_connect(instance);
rdpContext* context = instance->context;
WINPR_ASSERT(context);
xfc = (xfContext*)instance->context;
xfContext* xfc = (xfContext*)instance->context;
WINPR_ASSERT(xfc);
settings = context->settings;
rdpSettings* settings = context->settings;
WINPR_ASSERT(settings);
if (!status)
@ -1479,7 +1463,8 @@ static DWORD WINAPI xf_client_thread(LPVOID param)
while (!freerdp_shall_disconnect_context(instance->context))
{
nCount = 0;
HANDLE handles[MAXIMUM_WAIT_OBJECTS] = { 0 };
DWORD nCount = 0;
handles[nCount++] = timer;
handles[nCount++] = inputEvent;

View File

@ -589,19 +589,17 @@ static CLIPRDR_FORMAT* xf_cliprdr_get_raw_server_formats(xfClipboard* clipboard,
static CLIPRDR_FORMAT* xf_cliprdr_get_formats_from_targets(xfClipboard* clipboard,
UINT32* numFormats)
{
unsigned long i;
Atom atom;
Atom atom = None;
BYTE* data = NULL;
int format_property;
unsigned long length;
unsigned long bytes_left;
int format_property = 0;
unsigned long length = 0;
unsigned long bytes_left = 0;
CLIPRDR_FORMAT* formats = NULL;
xfContext* xfc;
WINPR_ASSERT(clipboard);
WINPR_ASSERT(numFormats);
xfc = clipboard->xfc;
xfContext* xfc = clipboard->xfc;
WINPR_ASSERT(xfc);
*numFormats = 0;
@ -623,7 +621,7 @@ static CLIPRDR_FORMAT* xf_cliprdr_get_formats_from_targets(xfClipboard* clipboar
}
}
for (i = 0; i < length; i++)
for (unsigned long i = 0; i < length; i++)
{
Atom tatom = ((Atom*)data)[i];
const xfCliprdrFormat* format = xf_cliprdr_get_client_format_by_atom(clipboard, tatom);
@ -1642,18 +1640,15 @@ static UINT xf_cliprdr_send_client_capabilities(xfClipboard* clipboard)
*/
static UINT xf_cliprdr_send_client_format_list(xfClipboard* clipboard, BOOL force)
{
UINT ret;
xfContext* xfc;
WINPR_ASSERT(clipboard);
xfc = clipboard->xfc;
xfContext* xfc = clipboard->xfc;
WINPR_ASSERT(xfc);
UINT32 numFormats = 0;
CLIPRDR_FORMAT* formats = xf_cliprdr_get_client_formats(clipboard, &numFormats);
ret = xf_cliprdr_send_format_list(clipboard, formats, numFormats, force);
const UINT ret = xf_cliprdr_send_format_list(clipboard, formats, numFormats, force);
if (clipboard->owner && clipboard->owner != xfc->drawable)
{

View File

@ -387,13 +387,12 @@ static BOOL xf_event_VisibilityNotify(xfContext* xfc, const XVisibilityEvent* ev
BOOL xf_generic_MotionNotify(xfContext* xfc, int x, int y, int state, Window window, BOOL app)
{
rdpInput* input;
Window childWindow;
Window childWindow = None;
WINPR_ASSERT(xfc);
WINPR_ASSERT(xfc->common.context.settings);
input = xfc->common.context.input;
rdpInput* input = xfc->common.context.input;
WINPR_ASSERT(input);
if (!xfc->common.context.settings->MouseMotion)
@ -455,12 +454,11 @@ BOOL xf_generic_ButtonEvent(xfContext* xfc, int x, int y, int button, Window win
BOOL down)
{
UINT16 flags = 0;
Window childWindow;
size_t i;
Window childWindow = None;
WINPR_ASSERT(xfc);
for (i = 0; i < ARRAYSIZE(xfc->button_map); i++)
for (size_t i = 0; i < ARRAYSIZE(xfc->button_map); i++)
{
const button_map* cur = &xfc->button_map[i];
@ -568,7 +566,7 @@ static BOOL xf_event_ButtonRelease(xfContext* xfc, const XButtonEvent* event, BO
static BOOL xf_event_KeyPress(xfContext* xfc, const XKeyEvent* event, BOOL app)
{
KeySym keysym;
KeySym keysym = 0;
char str[256] = { 0 };
union
{
@ -584,7 +582,7 @@ static BOOL xf_event_KeyPress(xfContext* xfc, const XKeyEvent* event, BOOL app)
static BOOL xf_event_KeyRelease(xfContext* xfc, const XKeyEvent* event, BOOL app)
{
KeySym keysym;
KeySym keysym = 0;
char str[256] = { 0 };
union
{
@ -754,14 +752,13 @@ static BOOL xf_event_LeaveNotify(xfContext* xfc, const XLeaveWindowEvent* event,
static BOOL xf_event_ConfigureNotify(xfContext* xfc, const XConfigureEvent* event, BOOL app)
{
Window childWindow;
xfAppWindow* appWindow;
const rdpSettings* settings;
Window childWindow = None;
xfAppWindow* appWindow = NULL;
WINPR_ASSERT(xfc);
WINPR_ASSERT(event);
settings = xfc->common.context.settings;
const rdpSettings* settings = xfc->common.context.settings;
WINPR_ASSERT(settings);
WLog_DBG(TAG, "x=%" PRId32 ", y=%" PRId32 ", w=%" PRId32 ", h=%" PRId32, event->x, event->y,
@ -907,13 +904,13 @@ static BOOL xf_event_PropertyNotify(xfContext* xfc, const XPropertyEvent* event,
if ((((Atom)event->atom == xfc->_NET_WM_STATE) && (event->state != PropertyDelete)) ||
(((Atom)event->atom == xfc->WM_STATE) && (event->state != PropertyDelete)))
{
unsigned long i;
BOOL status;
unsigned long i = 0;
BOOL status = FALSE;
BOOL minimized = FALSE;
BOOL minimizedChanged = FALSE;
unsigned long nitems;
unsigned long bytes;
unsigned char* prop;
unsigned long nitems = 0;
unsigned long bytes = 0;
unsigned char* prop = NULL;
xfAppWindow* appWindow = NULL;
if (app)
@ -1110,16 +1107,14 @@ static BOOL xf_event_suppress_events(xfContext* xfc, xfAppWindow* appWindow, con
BOOL xf_event_process(freerdp* instance, const XEvent* event)
{
BOOL status = TRUE;
xfContext* xfc;
rdpSettings* settings;
WINPR_ASSERT(instance);
WINPR_ASSERT(event);
xfc = (xfContext*)instance->context;
xfContext* xfc = (xfContext*)instance->context;
WINPR_ASSERT(xfc);
settings = xfc->common.context.settings;
rdpSettings* settings = xfc->common.context.settings;
WINPR_ASSERT(settings);
if (xfc->remote_app)

View File

@ -321,8 +321,6 @@ xfFloatbarButton* xf_floatbar_new_button(xfFloatbar* floatbar, int type)
xfFloatbar* xf_floatbar_new(xfContext* xfc, Window window, const char* name, DWORD flags)
{
xfFloatbar* floatbar;
WINPR_ASSERT(xfc);
WINPR_ASSERT(xfc->display);
WINPR_ASSERT(name);
@ -338,7 +336,7 @@ xfFloatbar* xf_floatbar_new(xfContext* xfc, Window window, const char* name, DWO
if (xfc->remote_app)
return NULL;
floatbar = (xfFloatbar*)calloc(1, sizeof(xfFloatbar));
xfFloatbar* floatbar = (xfFloatbar*)calloc(1, sizeof(xfFloatbar));
if (!floatbar)
return NULL;

View File

@ -48,20 +48,18 @@ static BOOL xf_Pointer_Set(rdpContext* context, rdpPointer* pointer);
BOOL xf_decode_color(xfContext* xfc, const UINT32 srcColor, XColor* color)
{
rdpGdi* gdi;
rdpSettings* settings;
UINT32 SrcFormat;
BYTE r, g, b, a;
UINT32 SrcFormat = 0;
BYTE r = 0, g = 0, b = 0, a = 0;
if (!xfc || !color)
return FALSE;
gdi = xfc->common.context.gdi;
rdpGdi* gdi = xfc->common.context.gdi;
if (!gdi)
return FALSE;
settings = xfc->common.context.settings;
rdpSettings* settings = xfc->common.context.settings;
if (!settings)
return FALSE;
@ -238,36 +236,29 @@ static BOOL xf_Pointer_GetCursorForCurrentScale(rdpContext* context, rdpPointer*
Cursor* cursor)
{
#if defined(WITH_XCURSOR) && defined(WITH_XRENDER)
UINT32 CursorFormat;
xfContext* xfc = (xfContext*)context;
xfPointer* xpointer = (xfPointer*)pointer;
XcursorImage ci = { 0 };
rdpSettings* settings;
UINT32 xTargetSize;
UINT32 yTargetSize;
double xscale;
double yscale;
size_t size;
int cursorIndex = -1;
UINT32 i;
void* tmp;
if (!context || !pointer || !context->gdi)
return FALSE;
settings = xfc->common.context.settings;
rdpSettings* settings = xfc->common.context.settings;
if (!settings)
return FALSE;
xscale = (settings->SmartSizing ? xfc->scaledWidth / (double)settings->DesktopWidth : 1);
yscale = (settings->SmartSizing ? xfc->scaledHeight / (double)settings->DesktopHeight : 1);
xTargetSize = MAX(1, pointer->width * xscale);
yTargetSize = MAX(1, pointer->height * yscale);
const double xscale =
(settings->SmartSizing ? xfc->scaledWidth / (double)settings->DesktopWidth : 1);
const double yscale =
(settings->SmartSizing ? xfc->scaledHeight / (double)settings->DesktopHeight : 1);
const UINT32 xTargetSize = MAX(1, pointer->width * xscale);
const UINT32 yTargetSize = MAX(1, pointer->height * yscale);
WLog_DBG(TAG, "scaled: %" PRIu32 "x%" PRIu32 ", desktop: %" PRIu32 "x%" PRIu32,
xfc->scaledWidth, xfc->scaledHeight, settings->DesktopWidth, settings->DesktopHeight);
for (i = 0; i < xpointer->nCursors; i++)
for (UINT32 i = 0; i < xpointer->nCursors; i++)
{
if ((xpointer->cursorWidths[i] == xTargetSize) &&
(xpointer->cursorHeights[i] == yTargetSize))
@ -278,6 +269,7 @@ static BOOL xf_Pointer_GetCursorForCurrentScale(rdpContext* context, rdpPointer*
if (cursorIndex == -1)
{
UINT32 CursorFormat = 0;
xf_lock_x11(xfc);
if (!xfc->invert)
@ -321,9 +313,9 @@ static BOOL xf_Pointer_GetCursorForCurrentScale(rdpContext* context, rdpPointer*
ci.height = yTargetSize;
ci.xhot = pointer->xPos * xscale;
ci.yhot = pointer->yPos * yscale;
size = ci.height * ci.width * FreeRDPGetBytesPerPixel(CursorFormat) * 1ULL;
const size_t size = ci.height * ci.width * FreeRDPGetBytesPerPixel(CursorFormat) * 1ULL;
tmp = winpr_aligned_malloc(size, 16);
void* tmp = winpr_aligned_malloc(size, 16);
if (!tmp)
{
xf_unlock_x11(xfc);
@ -568,10 +560,10 @@ static BOOL xf_Pointer_SetDefault(rdpContext* context)
static BOOL xf_Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y)
{
xfContext* xfc = (xfContext*)context;
XWindowAttributes current;
XSetWindowAttributes tmp;
XWindowAttributes current = { 0 };
XSetWindowAttributes tmp = { 0 };
BOOL ret = FALSE;
Status rc;
Status rc = 0;
Window handle = xf_Pointer_get_window(xfc);
if (!handle)

View File

@ -68,23 +68,20 @@ static const char* xf_input_get_class_string(int class)
static BOOL register_input_events(xfContext* xfc, Window window)
{
int i, ndevices;
int ndevices = 0;
int nmasks = 0;
XIDeviceInfo* info;
rdpSettings* settings;
XIEventMask evmasks[64] = { 0 };
BYTE masks[8][XIMaskLen(XI_LASTEVENT)] = { 0 };
WINPR_ASSERT(xfc);
settings = xfc->common.context.settings;
rdpSettings* settings = xfc->common.context.settings;
WINPR_ASSERT(settings);
info = XIQueryDevice(xfc->display, XIAllDevices, &ndevices);
XIDeviceInfo* info = XIQueryDevice(xfc->display, XIAllDevices, &ndevices);
for (i = 0; i < MIN(ndevices, 64); i++)
for (int i = 0; i < MIN(ndevices, 64); i++)
{
int j;
BOOL used = FALSE;
XIDeviceInfo* dev = &info[i];
@ -96,7 +93,7 @@ static BOOL register_input_events(xfContext* xfc, Window window)
if (strcmp(dev->name, "Virtual core pointer") == 0)
continue;
for (j = 0; j < dev->num_classes; j++)
for (int j = 0; j < dev->num_classes; j++)
{
const XIAnyClassInfo* class = dev->classes[j];
@ -181,12 +178,11 @@ int xf_input_init(xfContext* xfc, Window window)
{
int major = XI_2_Major;
int minor = XI_2_Minor;
int opcode, event, error;
rdpSettings* settings;
int opcode = 0, event = 0, error = 0;
WINPR_ASSERT(xfc);
settings = xfc->common.context.settings;
rdpSettings* settings = xfc->common.context.settings;
WINPR_ASSERT(settings);
xfc->firstDist = -1.0;

View File

@ -335,18 +335,18 @@ int xf_keyboard_read_keyboard_state(xfContext* xfc)
static int xf_keyboard_get_keymask(xfContext* xfc, int keysym)
{
int modifierpos, key, keysymMask = 0;
int keysymMask = 0;
KeyCode keycode = XKeysymToKeycode(xfc->display, keysym);
if (keycode == NoSymbol)
return 0;
WINPR_ASSERT(xfc->modifierMap);
for (modifierpos = 0; modifierpos < 8; modifierpos++)
for (int modifierpos = 0; modifierpos < 8; modifierpos++)
{
int offset = xfc->modifierMap->max_keypermod * modifierpos;
for (key = 0; key < xfc->modifierMap->max_keypermod; key++)
for (int key = 0; key < xfc->modifierMap->max_keypermod; key++)
{
if (xfc->modifierMap->modifiermap[offset + key] == keycode)
{
@ -370,12 +370,10 @@ BOOL xf_keyboard_get_key_state(xfContext* xfc, int state, int keysym)
static BOOL xf_keyboard_set_key_state(xfContext* xfc, BOOL on, int keysym)
{
int keysymMask;
if (!xfc->xkbAvailable)
return FALSE;
keysymMask = xf_keyboard_get_keymask(xfc, keysym);
const int keysymMask = xf_keyboard_get_keymask(xfc, keysym);
if (!keysymMask)
{
@ -387,9 +385,8 @@ static BOOL xf_keyboard_set_key_state(xfContext* xfc, BOOL on, int keysym)
UINT32 xf_keyboard_get_toggle_keys_state(xfContext* xfc)
{
int state;
UINT32 toggleKeysState = 0;
state = xf_keyboard_read_keyboard_state(xfc);
const int state = xf_keyboard_read_keyboard_state(xfc);
if (xf_keyboard_get_key_state(xfc, state, XK_Scroll_Lock))
toggleKeysState |= KBD_SYNC_SCROLL_LOCK;
@ -408,21 +405,18 @@ UINT32 xf_keyboard_get_toggle_keys_state(xfContext* xfc)
static void xk_keyboard_update_modifier_keys(xfContext* xfc)
{
int state;
size_t i;
KeyCode keycode;
int keysyms[] = { XK_Shift_L, XK_Shift_R, XK_Alt_L, XK_Alt_R,
XK_Control_L, XK_Control_R, XK_Super_L, XK_Super_R };
const int keysyms[] = { XK_Shift_L, XK_Shift_R, XK_Alt_L, XK_Alt_R,
XK_Control_L, XK_Control_R, XK_Super_L, XK_Super_R };
xf_keyboard_clear(xfc);
state = xf_keyboard_read_keyboard_state(xfc);
const int state = xf_keyboard_read_keyboard_state(xfc);
for (i = 0; i < ARRAYSIZE(keysyms); i++)
for (size_t i = 0; i < ARRAYSIZE(keysyms); i++)
{
if (xf_keyboard_get_key_state(xfc, state, keysyms[i]))
{
keycode = XKeysymToKeycode(xfc->display, keysyms[i]);
const KeyCode keycode = XKeysymToKeycode(xfc->display, keysyms[i]);
xfc->KeyboardState[keycode] = TRUE;
}
}
@ -430,19 +424,18 @@ static void xk_keyboard_update_modifier_keys(xfContext* xfc)
void xf_keyboard_focus_in(xfContext* xfc)
{
rdpInput* input;
UINT32 syncFlags, state;
Window w;
int d, x, y;
UINT32 state = 0;
Window w = None;
int d = 0, x = 0, y = 0;
WINPR_ASSERT(xfc);
if (!xfc->display || !xfc->window)
return;
input = xfc->common.context.input;
rdpInput* input = xfc->common.context.input;
WINPR_ASSERT(input);
syncFlags = xf_keyboard_get_toggle_keys_state(xfc);
const UINT32 syncFlags = xf_keyboard_get_toggle_keys_state(xfc);
freerdp_input_send_focus_in_event(input, syncFlags);
xk_keyboard_update_modifier_keys(xfc);
@ -463,17 +456,11 @@ void xf_keyboard_focus_in(xfContext* xfc)
static int xf_keyboard_execute_action_script(xfContext* xfc, XF_MODIFIER_KEYS* mod, KeySym keysym)
{
int index;
int count;
int status = 1;
FILE* keyScript;
const char* keyStr;
BOOL match = FALSE;
char* keyCombination;
char buffer[1024] = { 0 };
char command[2048] = { 0 };
char combination[1024] = { 0 };
const char* ActionScript;
if (!xfc->actionScriptExists)
return 1;
@ -484,7 +471,7 @@ static int xf_keyboard_execute_action_script(xfContext* xfc, XF_MODIFIER_KEYS* m
return 1;
}
keyStr = XKeysymToString(keysym);
const char* keyStr = XKeysymToString(keysym);
if (keyStr == 0)
{
@ -505,11 +492,11 @@ static int xf_keyboard_execute_action_script(xfContext* xfc, XF_MODIFIER_KEYS* m
winpr_str_append(keyStr, combination, sizeof(combination), NULL);
count = ArrayList_Count(xfc->keyCombinations);
const size_t count = ArrayList_Count(xfc->keyCombinations);
for (index = 0; index < count; index++)
for (size_t index = 0; index < count; index++)
{
keyCombination = (char*)ArrayList_GetItem(xfc->keyCombinations, index);
const char* keyCombination = (const char*)ArrayList_GetItem(xfc->keyCombinations, index);
if (_stricmp(keyCombination, combination) == 0)
{
@ -521,9 +508,10 @@ static int xf_keyboard_execute_action_script(xfContext* xfc, XF_MODIFIER_KEYS* m
if (!match)
return 1;
ActionScript = freerdp_settings_get_string(xfc->common.context.settings, FreeRDP_ActionScript);
const char* ActionScript =
freerdp_settings_get_string(xfc->common.context.settings, FreeRDP_ActionScript);
sprintf_s(command, sizeof(command), "%s key %s", ActionScript, combination);
keyScript = popen(command, "r");
FILE* keyScript = popen(command, "r");
if (!keyScript)
return -1;

View File

@ -483,21 +483,18 @@ void xf_DestroyDummyWindow(xfContext* xfc, Window window)
xfWindow* xf_CreateDesktopWindow(xfContext* xfc, char* name, int width, int height)
{
XEvent xevent;
int input_mask;
xfWindow* window;
Window parentWindow;
XClassHint* classHints;
rdpSettings* settings;
window = (xfWindow*)calloc(1, sizeof(xfWindow));
XEvent xevent = { 0 };
int input_mask = 0;
XClassHint* classHints = NULL;
xfWindow* window = (xfWindow*)calloc(1, sizeof(xfWindow));
if (!window)
return NULL;
settings = xfc->common.context.settings;
rdpSettings* settings = xfc->common.context.settings;
WINPR_ASSERT(settings);
parentWindow = (Window)settings->ParentWindowId;
Window parentWindow = (Window)settings->ParentWindowId;
window->width = width;
window->height = height;
window->decorations = xfc->decorations;

View File

@ -229,18 +229,16 @@ static BOOL copy_value(const char* value, char** dst)
static BOOL append_value(const char* value, char** dst)
{
size_t x = 0, y;
size_t size;
char* tmp;
size_t x = 0;
if (!dst || !value)
return FALSE;
if (*dst)
x = strlen(*dst);
y = strlen(value);
const size_t y = strlen(value);
size = x + y + 2;
tmp = realloc(*dst, size);
const size_t size = x + y + 2;
char* tmp = realloc(*dst, size);
if (!tmp)
return FALSE;
if (x == 0)

View File

@ -211,14 +211,11 @@ out_fail:
static BOOL update_pointer_new(rdpContext* context, const POINTER_NEW_UPDATE* pointer_new)
{
rdpPointer* pointer;
rdpCache* cache;
if (!context || !pointer_new)
return FALSE;
cache = context->cache;
pointer = Pointer_Alloc(context);
rdpCache* cache = context->cache;
rdpPointer* pointer = Pointer_Alloc(context);
if (!pointer)
return FALSE;

View File

@ -194,9 +194,9 @@ static BOOL clear_decompress_subcode_rlex(wStream* s, UINT32 bitmapDataByteCount
while (bitmapDataOffset < bitmapDataByteCount)
{
UINT32 tmp;
UINT32 color;
UINT32 runLengthFactor;
UINT32 tmp = 0;
UINT32 color = 0;
UINT32 runLengthFactor = 0;
if (!Stream_CheckAndLogRequiredLength(TAG, s, 2))
return FALSE;
@ -549,9 +549,10 @@ static BOOL resize_vbar_entry(CLEAR_CONTEXT* clear, CLEAR_VBAR_ENTRY* vBarEntry)
const UINT32 bpp = FreeRDPGetBytesPerPixel(clear->format);
const UINT32 oldPos = vBarEntry->size * bpp;
const UINT32 diffSize = (vBarEntry->count - vBarEntry->size) * bpp;
BYTE* tmp;
vBarEntry->size = vBarEntry->count;
tmp = (BYTE*)winpr_aligned_recalloc(vBarEntry->pixels, vBarEntry->count, bpp * 1ULL, 32);
BYTE* tmp =
(BYTE*)winpr_aligned_recalloc(vBarEntry->pixels, vBarEntry->count, bpp * 1ULL, 32);
if (!tmp)
{
@ -948,8 +949,8 @@ static BOOL clear_decompress_glyph_data(CLEAR_CONTEXT* clear, wStream* s, UINT32
if (glyphEntry->count > glyphEntry->size)
{
BYTE* tmp;
tmp = winpr_aligned_recalloc(glyphEntry->pixels, glyphEntry->count, bpp * 1ULL, 32);
BYTE* tmp =
winpr_aligned_recalloc(glyphEntry->pixels, glyphEntry->count, bpp * 1ULL, 32);
if (!tmp)
{

View File

@ -985,7 +985,7 @@ const char* FreeRDPGetColorFormatName(UINT32 format)
void FreeRDPSplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g, BYTE* _b, BYTE* _a,
const gdiPalette* palette)
{
UINT32 tmp;
UINT32 tmp = 0;
switch (format)
{

View File

@ -1920,7 +1920,7 @@ static const UINT32 LOMBaseLUT[30] = {
static INLINE UINT16 get_word(const BYTE* data)
{
UINT16 tmp;
UINT16 tmp = 0;
WINPR_ASSERT(data);
tmp = *data++;

View File

@ -443,7 +443,6 @@ fail:
static BOOL progressive_allocate_tile_cache(PROGRESSIVE_SURFACE_CONTEXT* surface, size_t min)
{
size_t x;
size_t oldIndex = 0;
WINPR_ASSERT(surface);
@ -463,7 +462,7 @@ static BOOL progressive_allocate_tile_cache(PROGRESSIVE_SURFACE_CONTEXT* surface
surface->tilesSize = surface->gridSize;
surface->tiles = tmp;
for (x = oldIndex; x < surface->tilesSize; x++)
for (size_t x = oldIndex; x < surface->tilesSize; x++)
{
surface->tiles[x] = progressive_tile_new();
if (!surface->tiles[x])
@ -2663,13 +2662,13 @@ int progressive_compress(PROGRESSIVE_CONTEXT* progressive, const BYTE* pSrcData,
UINT32 SrcFormat, UINT32 Width, UINT32 Height, UINT32 ScanLine,
const REGION16* invalidRegion, BYTE** ppDstData, UINT32* pDstSize)
{
BOOL rc;
BOOL rc = FALSE;
int res = -6;
wStream* s;
UINT32 i, numRects;
UINT32 x, y;
wStream* s = NULL;
UINT32 i = 0, numRects = 0;
UINT32 x = 0, y = 0;
RFX_RECT* rects = NULL;
RFX_MESSAGE* message;
RFX_MESSAGE* message = NULL;
if (!progressive || !pSrcData || !ppDstData || !pDstSize)
{

View File

@ -163,7 +163,7 @@ BOOL rectangles_equal(const RECTANGLE_16* r1, const RECTANGLE_16* r2)
BOOL rectangles_intersects(const RECTANGLE_16* r1, const RECTANGLE_16* r2)
{
RECTANGLE_16 tmp;
RECTANGLE_16 tmp = { 0 };
return rectangles_intersection(r1, r2, &tmp);
}
@ -356,7 +356,8 @@ static RECTANGLE_16* next_band(RECTANGLE_16* band1, RECTANGLE_16* endPtr, int* n
return band1;
}
static BOOL band_match(const RECTANGLE_16* band1, const RECTANGLE_16* band2, RECTANGLE_16* endPtr)
static BOOL band_match(const RECTANGLE_16* band1, const RECTANGLE_16* band2,
const RECTANGLE_16* endPtr)
{
int refBand2 = band2->top;
const RECTANGLE_16* band2Start = band2;
@ -417,7 +418,7 @@ static BOOL region16_simplify_bands(REGION16* region)
* ==================== ====================
*
*/
RECTANGLE_16 *band1, *band2, *endPtr, *endBand, *tmp;
RECTANGLE_16* endBand;
int nbRects, finalNbRects;
int bandItems, toMove;
finalNbRects = nbRects = region16_n_rects(region);
@ -425,12 +426,12 @@ static BOOL region16_simplify_bands(REGION16* region)
if (nbRects < 2)
return TRUE;
band1 = region16_rects_noconst(region);
endPtr = band1 + nbRects;
RECTANGLE_16* band1 = region16_rects_noconst(region);
const RECTANGLE_16* endPtr = band1 + nbRects;
do
{
band2 = next_band(band1, endPtr, &bandItems);
const RECTANGLE_16* band2 = next_band(band1, endPtr, &bandItems);
if (band2 == endPtr)
break;
@ -438,7 +439,7 @@ static BOOL region16_simplify_bands(REGION16* region)
if ((band1->bottom == band2->top) && band_match(band1, band2, endPtr))
{
/* adjust the bottom of band1 items */
tmp = band1;
RECTANGLE_16* tmp = band1;
while (tmp < band2)
{
@ -465,9 +466,8 @@ static BOOL region16_simplify_bands(REGION16* region)
if (finalNbRects != nbRects)
{
REGION16_DATA* data;
size_t allocSize = sizeof(REGION16_DATA) + (finalNbRects * sizeof(RECTANGLE_16));
data = realloc(region->data, allocSize);
REGION16_DATA* data = realloc(region->data, allocSize);
if (!data)
free(region->data);
region->data = data;

View File

@ -1070,20 +1070,19 @@ BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data, UINT32 length,
UINT32 top, BYTE* dst, UINT32 dstFormat, UINT32 dstStride,
UINT32 dstHeight, REGION16* invalidRegion)
{
REGION16 updateRegion;
UINT32 blockLen;
UINT32 blockType;
wStream inStream, *s;
REGION16 updateRegion = { 0 };
UINT32 blockLen = 0;
UINT32 blockType = 0;
wStream inStream = { 0 };
BOOL ok = TRUE;
RFX_MESSAGE* message;
if (!context || !data || !length)
return FALSE;
WINPR_ASSERT(context->priv);
message = &context->currentMessage;
RFX_MESSAGE* message = &context->currentMessage;
s = Stream_StaticConstInit(&inStream, data, length);
wStream* s = Stream_StaticConstInit(&inStream, data, length);
message->freeRects = TRUE;

View File

@ -300,14 +300,13 @@ PVIRTUALCHANNELENTRY freerdp_load_dynamic_channel_addin_entry(LPCSTR pszName, LP
{
LPCSTR pszExtension = PathGetSharedLibraryExtensionA(0);
LPCSTR pszPrefix = FREERDP_SHARED_LIBRARY_PREFIX;
LPSTR tmp;
int rc = 0;
if (pszPrefix)
cchFileName += strnlen(pszPrefix, MAX_PATH);
if (pszExtension)
cchFileName += strnlen(pszExtension, MAX_PATH) + 1;
tmp = calloc(cchFileName, sizeof(CHAR));
LPSTR tmp = calloc(cchFileName, sizeof(CHAR));
if (tmp)
rc = sprintf_s(tmp, cchFileName, "%s%s.%s", pszPrefix, pszFileName, pszExtension);

View File

@ -863,8 +863,6 @@ BOOL freerdp_capability_buffer_copy(rdpSettings* settings, const rdpSettings* sr
for (UINT32 x = 0; x < src->ReceivedCapabilitiesSize; x++)
{
void* tmp;
WINPR_ASSERT(settings->ReceivedCapabilities);
settings->ReceivedCapabilities[x] = src->ReceivedCapabilities[x];
@ -874,8 +872,8 @@ BOOL freerdp_capability_buffer_copy(rdpSettings* settings, const rdpSettings* sr
WINPR_ASSERT(settings->ReceivedCapabilityData);
if (src->ReceivedCapabilityDataSizes[x] > 0)
{
tmp = realloc(settings->ReceivedCapabilityData[x],
settings->ReceivedCapabilityDataSizes[x]);
void* tmp = realloc(settings->ReceivedCapabilityData[x],
settings->ReceivedCapabilityDataSizes[x]);
if (!tmp)
return FALSE;
memcpy(tmp, src->ReceivedCapabilityData[x], src->ReceivedCapabilityDataSizes[x]);

View File

@ -444,7 +444,7 @@ BOOL rdp_recv_client_persistent_key_list_pdu(wStream* s)
/* Skip totalEntriesCacheX */
for (x = 0; x < 5; x++)
{
UINT16 tmp;
UINT16 tmp = 0;
Stream_Read_UINT16(s, tmp);
total += tmp;
}

View File

@ -4003,7 +4003,6 @@ BOOL rdp_read_capability_set(wStream* sub, UINT16 type, rdpSettings* settings, B
if (type <= CAPSET_TYPE_FRAME_ACKNOWLEDGE)
{
size_t size = Stream_Length(sub);
void* tmp;
WINPR_ASSERT(settings->ReceivedCapabilities);
settings->ReceivedCapabilities[type] = TRUE;
@ -4012,7 +4011,7 @@ BOOL rdp_read_capability_set(wStream* sub, UINT16 type, rdpSettings* settings, B
settings->ReceivedCapabilityDataSizes[type] = size;
WINPR_ASSERT(settings->ReceivedCapabilityData);
tmp = realloc(settings->ReceivedCapabilityData[type], size);
void* tmp = realloc(settings->ReceivedCapabilityData[type], size);
if (!tmp && (size > 0))
return FALSE;
memcpy(tmp, Stream_Buffer(sub), size);

View File

@ -665,7 +665,7 @@ fail:
static int freerdp_channels_process_sync(rdpChannels* channels, freerdp* instance)
{
int status = TRUE;
wMessage message;
wMessage message = { 0 };
while (MessageQueue_Peek(channels->queue, &message, TRUE))
{
@ -1142,7 +1142,7 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelWriteEx(LPVOID pInitHandle, DWORD op
CHANNEL_INIT_DATA* pChannelInitData = NULL;
CHANNEL_OPEN_DATA* pChannelOpenData = NULL;
CHANNEL_OPEN_EVENT* pChannelOpenEvent = NULL;
wMessage message;
wMessage message = { 0 };
if (!pInitHandle)
return CHANNEL_RC_BAD_INIT_HANDLE;
@ -1197,10 +1197,10 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelWriteEx(LPVOID pInitHandle, DWORD op
static UINT VCAPITYPE FreeRDP_VirtualChannelWrite(DWORD openHandle, LPVOID pData, ULONG dataLength,
LPVOID pUserData)
{
wMessage message;
CHANNEL_OPEN_DATA* pChannelOpenData;
CHANNEL_OPEN_EVENT* pChannelOpenEvent;
rdpChannels* channels;
wMessage message = { 0 };
CHANNEL_OPEN_DATA* pChannelOpenData = NULL;
CHANNEL_OPEN_EVENT* pChannelOpenEvent = NULL;
rdpChannels* channels = NULL;
pChannelOpenData = HashTable_GetItemValue(g_ChannelHandles, (void*)(UINT_PTR)openHandle);

View File

@ -343,10 +343,6 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, wStream*
{
BOOL rc = FALSE;
int status = 0;
rdpUpdate* update;
rdpContext* context;
rdpPointerUpdate* pointer;
BOOL defaultReturn;
if (!fastpath || !fastpath->rdp || !s)
return -1;
@ -354,15 +350,15 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, wStream*
Stream_SealLength(s);
Stream_SetPosition(s, 0);
update = fastpath->rdp->update;
rdpUpdate* update = fastpath->rdp->update;
if (!update || !update->pointer || !update->context)
return -1;
context = update->context;
rdpContext* context = update->context;
WINPR_ASSERT(context);
pointer = update->pointer;
rdpPointerUpdate* pointer = update->pointer;
WINPR_ASSERT(pointer);
#ifdef WITH_DEBUG_RDP
@ -370,7 +366,8 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, wStream*
fastpath_update_to_string(updateCode), updateCode, Stream_GetRemainingLength(s));
#endif
defaultReturn = freerdp_settings_get_bool(context->settings, FreeRDP_DeactivateClientDecoding);
const BOOL defaultReturn =
freerdp_settings_get_bool(context->settings, FreeRDP_DeactivateClientDecoding);
switch (updateCode)
{
case FASTPATH_UPDATETYPE_ORDERS:
@ -488,28 +485,24 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, wStream*
static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
{
int status;
UINT16 size;
rdpRdp* rdp;
int bulkStatus;
BYTE updateCode;
BYTE fragmentation;
BYTE compression;
BYTE compressionFlags;
int status = 0;
UINT16 size = 0;
BYTE updateCode = 0;
BYTE fragmentation = 0;
BYTE compression = 0;
BYTE compressionFlags = 0;
UINT32 DstSize = 0;
const BYTE* pDstData = NULL;
rdpTransport* transport;
if (!fastpath || !s)
return -1;
status = 0;
rdp = fastpath->rdp;
rdpRdp* rdp = fastpath->rdp;
if (!rdp)
return -1;
transport = rdp->transport;
rdpTransport* transport = rdp->transport;
if (!transport)
return -1;
@ -535,7 +528,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
if (!Stream_CheckAndLogRequiredLength(TAG, s, size))
return -1;
bulkStatus =
const int bulkStatus =
bulk_decompress(rdp->bulk, Stream_Pointer(s), size, &pDstData, &DstSize, compressionFlags);
Stream_Seek(s, size);
@ -631,12 +624,11 @@ out_fail:
state_run_t fastpath_recv_updates(rdpFastPath* fastpath, wStream* s)
{
state_run_t rc = STATE_RUN_FAILED;
rdpUpdate* update;
if (!fastpath || !fastpath->rdp || !fastpath->rdp->update || !s)
return STATE_RUN_FAILED;
update = fastpath->rdp->update;
rdpUpdate* update = fastpath->rdp->update;
if (!update_begin_paint(update))
goto fail;

View File

@ -395,11 +395,9 @@ DWORD freerdp_get_event_handles(rdpContext* context, HANDLE* events, DWORD count
BOOL freerdp_check_event_handles(rdpContext* context)
{
BOOL status;
WINPR_ASSERT(context);
status = freerdp_check_fds(context->instance);
BOOL status = freerdp_check_fds(context->instance);
if (!status)
{
@ -438,11 +436,10 @@ BOOL freerdp_check_event_handles(rdpContext* context)
wMessageQueue* freerdp_get_message_queue(freerdp* instance, DWORD id)
{
wMessageQueue* queue = NULL;
rdpContext* context;
WINPR_ASSERT(instance);
context = instance->context;
rdpContext* context = instance->context;
WINPR_ASSERT(context);
switch (id)

View File

@ -853,7 +853,6 @@ static int rdg_chuncked_read(BIO* bio, BYTE* pBuffer, size_t size,
case ChunkStateLenghHeader:
{
BOOL _haveNewLine = FALSE;
size_t tmp;
char* dst = &encodingContext->lenBuffer[encodingContext->headerFooterPos];
WINPR_ASSERT(encodingContext->nextOffset == 0);
while (encodingContext->headerFooterPos < 10 && !_haveNewLine)
@ -874,7 +873,7 @@ static int rdg_chuncked_read(BIO* bio, BYTE* pBuffer, size_t size,
/* strtoul is tricky, error are reported via errno, we also need
* to ensure the result does not overflow */
errno = 0;
tmp = strtoul(encodingContext->lenBuffer, NULL, 16);
size_t tmp = strtoul(encodingContext->lenBuffer, NULL, 16);
if ((errno != 0) || (tmp > SIZE_MAX))
return -1;
encodingContext->nextOffset = tmp;

View File

@ -2663,13 +2663,11 @@ int update_message_queue_free_message(wMessage* message)
int update_message_queue_process_pending_messages(rdpUpdate* update)
{
int status;
wMessage message;
wMessageQueue* queue;
int status = 1;
wMessage message = { 0 };
rdp_update_internal* up = update_cast(update);
status = 1;
queue = up->queue;
wMessageQueue* queue = up->queue;
while (MessageQueue_Peek(queue, &message, TRUE))
{
@ -2860,7 +2858,7 @@ static BOOL update_message_register_interface(rdpUpdateProxy* message, rdpUpdate
static DWORD WINAPI update_message_proxy_thread(LPVOID arg)
{
rdpUpdate* update = (rdpUpdate*)arg;
wMessage message;
wMessage message = { 0 };
rdp_update_internal* up = update_cast(update);
while (MessageQueue_Wait(up->queue))
@ -2880,7 +2878,7 @@ static DWORD WINAPI update_message_proxy_thread(LPVOID arg)
rdpUpdateProxy* update_message_proxy_new(rdpUpdate* update)
{
rdpUpdateProxy* message;
rdpUpdateProxy* message = NULL;
if (!update)
return NULL;
@ -3104,17 +3102,15 @@ int input_message_queue_process_message(rdpInput* input, wMessage* message)
int input_message_queue_process_pending_messages(rdpInput* input)
{
int count;
int status;
wMessage message;
wMessageQueue* queue;
int count = 0;
int status = 1;
wMessage message = { 0 };
wMessageQueue* queue = NULL;
rdp_input_internal* in = input_cast(input);
if (!in->queue)
return -1;
count = 0;
status = 1;
queue = in->queue;
while (MessageQueue_Peek(queue, &message, TRUE))

View File

@ -1661,10 +1661,10 @@ out:
static state_run_t rdp_recv_fastpath_pdu(rdpRdp* rdp, wStream* s)
{
UINT16 length;
rdpFastPath* fastpath;
UINT16 length = 0;
WINPR_ASSERT(rdp);
fastpath = rdp->fastpath;
rdpFastPath* fastpath = rdp->fastpath;
if (!fastpath_read_header_rdp(fastpath, s, &length))
{

View File

@ -586,9 +586,9 @@ BOOL WTSVirtualChannelManagerOpen(HANDLE hServer)
BOOL WTSVirtualChannelManagerCheckFileDescriptorEx(HANDLE hServer, BOOL autoOpen)
{
wMessage message;
wMessage message = { 0 };
BOOL status = TRUE;
WTSVirtualChannelManager* vcm;
WTSVirtualChannelManager* vcm = NULL;
if (!hServer || hServer == INVALID_HANDLE_VALUE)
return FALSE;
@ -1492,9 +1492,9 @@ BOOL WINAPI FreeRDP_WTSVirtualChannelClose(HANDLE hChannelHandle)
BOOL WINAPI FreeRDP_WTSVirtualChannelRead(HANDLE hChannelHandle, ULONG TimeOut, PCHAR Buffer,
ULONG BufferSize, PULONG pBytesRead)
{
BYTE* buffer;
wMessage message;
wtsChannelMessage* messageCtx;
BYTE* buffer = NULL;
wMessage message = { 0 };
wtsChannelMessage* messageCtx = NULL;
rdpPeerChannel* channel = (rdpPeerChannel*)hChannelHandle;
WINPR_ASSERT(channel);

View File

@ -306,7 +306,6 @@ BOOL freerdp_settings_set_default_order_support(rdpSettings* settings)
BOOL freerdp_capability_buffer_allocate(rdpSettings* settings, UINT32 count)
{
void* tmp;
WINPR_ASSERT(settings);
WINPR_ASSERT(count > 0);
WINPR_ASSERT(count == 32);
@ -315,7 +314,7 @@ BOOL freerdp_capability_buffer_allocate(rdpSettings* settings, UINT32 count)
WINPR_ASSERT(settings->ReceivedCapabilitiesSize == 0);
settings->ReceivedCapabilitiesSize = count;
tmp = realloc(settings->ReceivedCapabilities, count * sizeof(BYTE));
void* tmp = realloc(settings->ReceivedCapabilities, count * sizeof(BYTE));
if (!tmp)
return FALSE;
memset(tmp, 0, count * sizeof(BYTE));

View File

@ -1160,7 +1160,6 @@ fail:
DWORD transport_get_event_handles(rdpTransport* transport, HANDLE* events, DWORD count)
{
DWORD nCount = 0; /* always the reread Event */
DWORD tmp;
WINPR_ASSERT(transport);
WINPR_ASSERT(events);
@ -1212,7 +1211,8 @@ DWORD transport_get_event_handles(rdpTransport* transport, HANDLE* events, DWORD
{
if (transport->rdg)
{
tmp = rdg_get_event_handles(transport->rdg, &events[nCount], count - nCount);
const DWORD tmp =
rdg_get_event_handles(transport->rdg, &events[nCount], count - nCount);
if (tmp == 0)
return 0;
@ -1221,7 +1221,8 @@ DWORD transport_get_event_handles(rdpTransport* transport, HANDLE* events, DWORD
}
else if (transport->tsg)
{
tmp = tsg_get_event_handles(transport->tsg, &events[nCount], count - nCount);
const DWORD tmp =
tsg_get_event_handles(transport->tsg, &events[nCount], count - nCount);
if (tmp == 0)
return 0;

View File

@ -588,7 +588,6 @@ static BOOL certificate_process_server_public_key(rdpCertificate* cert, wStream*
UINT32 keylen = 0;
UINT32 bitlen = 0;
UINT32 datalen = 0;
BYTE* tmp = NULL;
WINPR_ASSERT(cert);
WINPR_ASSERT(s);
@ -616,7 +615,7 @@ static BOOL certificate_process_server_public_key(rdpCertificate* cert, wStream*
return FALSE;
info->ModulusLength = keylen - 8;
tmp = realloc(info->Modulus, info->ModulusLength);
BYTE* tmp = realloc(info->Modulus, info->ModulusLength);
if (!tmp)
return FALSE;

View File

@ -821,17 +821,15 @@ static int verify_cb(int ok, X509_STORE_CTX* csc)
BOOL x509_utils_verify(X509* xcert, STACK_OF(X509) * chain, const char* certificate_store_path)
{
size_t i;
const int purposes[3] = { X509_PURPOSE_SSL_SERVER, X509_PURPOSE_SSL_CLIENT, X509_PURPOSE_ANY };
X509_STORE_CTX* csc;
X509_STORE_CTX* csc = NULL;
BOOL status = FALSE;
X509_STORE* cert_ctx = NULL;
X509_LOOKUP* lookup = NULL;
if (!xcert)
return FALSE;
cert_ctx = X509_STORE_new();
X509_STORE* cert_ctx = X509_STORE_new();
if (cert_ctx == NULL)
goto end;
@ -861,7 +859,7 @@ BOOL x509_utils_verify(X509* xcert, STACK_OF(X509) * chain, const char* certific
X509_STORE_set_flags(cert_ctx, 0);
for (i = 0; i < ARRAYSIZE(purposes); i++)
for (size_t i = 0; i < ARRAYSIZE(purposes); i++)
{
int err = -1, rc = -1;
int purpose = purposes[i];

View File

@ -213,10 +213,9 @@ BOOL gdi_CRectToRgn(INT32 left, INT32 top, INT32 right, INT32 bottom, HGDI_RGN r
BOOL gdi_RectToCRgn(const HGDI_RECT rect, INT32* x, INT32* y, INT32* w, INT32* h)
{
BOOL rc = TRUE;
INT64 tmp;
*x = rect->left;
*y = rect->top;
tmp = rect->right - rect->left + 1;
INT64 tmp = rect->right - rect->left + 1;
if ((tmp < 0) || (tmp > INT32_MAX))
{
char buffer[256];

View File

@ -32,7 +32,6 @@ static pstatus_t general_LumaToYUV444(const BYTE* const pSrcRaw[3], const UINT32
BYTE* pDstRaw[3], const UINT32 dstStep[3],
const RECTANGLE_16* roi)
{
UINT32 x, y;
const UINT32 nWidth = roi->right - roi->left;
const UINT32 nHeight = roi->bottom - roi->top;
const UINT32 halfWidth = (nWidth + 1) / 2;
@ -50,7 +49,7 @@ static pstatus_t general_LumaToYUV444(const BYTE* const pSrcRaw[3], const UINT32
/* Y data is already here... */
/* B1 */
for (y = 0; y < nHeight; y++)
for (UINT32 y = 0; y < nHeight; y++)
{
const BYTE* Ym = pSrc[0] + srcStep[0] * y;
BYTE* pY = pDst[0] + dstStep[0] * y;
@ -59,7 +58,7 @@ static pstatus_t general_LumaToYUV444(const BYTE* const pSrcRaw[3], const UINT32
/* The first half of U, V are already here part of this frame. */
/* B2 and B3 */
for (y = 0; y < halfHeight; y++)
for (UINT32 y = 0; y < halfHeight; y++)
{
const UINT32 val2y = (2 * y + evenY);
const UINT32 val2y1 = val2y + oddY;
@ -70,7 +69,7 @@ static pstatus_t general_LumaToYUV444(const BYTE* const pSrcRaw[3], const UINT32
BYTE* pU1 = pDst[1] + dstStep[1] * val2y1;
BYTE* pV1 = pDst[2] + dstStep[2] * val2y1;
for (x = 0; x < halfWidth; x++)
for (UINT32 x = 0; x < halfWidth; x++)
{
const UINT32 val2x = 2 * x + evenX;
const UINT32 val2x1 = val2x + oddX;

View File

@ -1101,10 +1101,8 @@ static DWORD WINAPI test_peer_mainloop(LPVOID arg)
{
count = 0;
{
DWORD tmp;
WINPR_ASSERT(client->GetEventHandles);
tmp = client->GetEventHandles(client, &handles[count], 32 - count);
DWORD tmp = client->GetEventHandles(client, &handles[count], 32 - count);
if (tmp == 0)
{

View File

@ -443,9 +443,8 @@ static UINT rdpdr_send_client_announce_reply(pClientContext* pc, pf_channel_clie
static UINT rdpdr_process_client_name_request(pf_channel_server_context* rdpdr, wStream* s,
pClientContext* pc)
{
UINT32 unicodeFlag;
UINT32 codePage;
void* tmp;
UINT32 unicodeFlag = 0;
UINT32 codePage = 0;
WINPR_ASSERT(rdpdr);
WINPR_ASSERT(s);
@ -469,7 +468,7 @@ static UINT rdpdr_process_client_name_request(pf_channel_server_context* rdpdr,
Stream_GetRemainingLength(s), rdpdr->common.computerNameLen);
return ERROR_INVALID_DATA;
}
tmp = realloc(rdpdr->common.computerName.v, rdpdr->common.computerNameLen);
void* tmp = realloc(rdpdr->common.computerName.v, rdpdr->common.computerNameLen);
if (!tmp)
return CHANNEL_RC_NO_MEMORY;
rdpdr->common.computerName.v = tmp;

View File

@ -551,24 +551,19 @@ static BOOL pf_server_initialize_peer_connection(freerdp_peer* peer)
static DWORD WINAPI pf_server_handle_peer(LPVOID arg)
{
HANDLE eventHandles[MAXIMUM_WAIT_OBJECTS] = { 0 };
DWORD tmp;
DWORD status;
pServerContext* ps = NULL;
proxyData* pdata = NULL;
freerdp_peer* client;
proxyServer* server;
size_t count;
peer_thread_args* args = arg;
WINPR_ASSERT(args);
client = args->client;
freerdp_peer* client = args->client;
WINPR_ASSERT(client);
server = (proxyServer*)client->ContextExtra;
proxyServer* server = (proxyServer*)client->ContextExtra;
WINPR_ASSERT(server);
count = ArrayList_Count(server->peer_list);
size_t count = ArrayList_Count(server->peer_list);
if (!pf_context_init_server_context(client))
goto out_free_peer;
@ -599,8 +594,8 @@ static DWORD WINAPI pf_server_handle_peer(LPVOID arg)
DWORD eventCount = 0;
{
WINPR_ASSERT(client->GetEventHandles);
tmp = client->GetEventHandles(client, &eventHandles[eventCount],
ARRAYSIZE(eventHandles) - eventCount);
const DWORD tmp = client->GetEventHandles(client, &eventHandles[eventCount],
ARRAYSIZE(eventHandles) - eventCount);
if (tmp == 0)
{
@ -619,8 +614,8 @@ static DWORD WINAPI pf_server_handle_peer(LPVOID arg)
eventHandles[eventCount++] = pdata->abort_event;
eventHandles[eventCount++] = server->stopEvent;
status = WaitForMultipleObjects(eventCount, eventHandles, FALSE,
1000); /* Do periodic polling to avoid client hang */
const DWORD status = WaitForMultipleObjects(
eventCount, eventHandles, FALSE, 1000); /* Do periodic polling to avoid client hang */
if (status == WAIT_FAILED)
{

View File

@ -2048,26 +2048,26 @@ static int shadow_client_subsystem_process_message(rdpShadowClient* client, wMes
static DWORD WINAPI shadow_client_thread(LPVOID arg)
{
rdpShadowClient* client = (rdpShadowClient*)arg;
BOOL rc;
DWORD status;
DWORD nCount;
wMessage message;
wMessage pointerPositionMsg;
wMessage pointerAlphaMsg;
wMessage audioVolumeMsg;
BOOL rc = FALSE;
DWORD status = 0;
DWORD nCount = 0;
wMessage message = { 0 };
wMessage pointerPositionMsg = { 0 };
wMessage pointerAlphaMsg = { 0 };
wMessage audioVolumeMsg = { 0 };
HANDLE events[32] = { 0 };
HANDLE ChannelEvent;
void* UpdateSubscriber;
HANDLE UpdateEvent;
freerdp_peer* peer;
rdpContext* context;
rdpSettings* settings;
rdpShadowServer* server;
rdpShadowSubsystem* subsystem;
wMessageQueue* MsgQueue;
HANDLE ChannelEvent = 0;
void* UpdateSubscriber = NULL;
HANDLE UpdateEvent = 0;
freerdp_peer* peer = NULL;
rdpContext* context = NULL;
rdpSettings* settings = NULL;
rdpShadowServer* server = NULL;
rdpShadowSubsystem* subsystem = NULL;
wMessageQueue* MsgQueue = NULL;
/* This should only be visited in client thread */
SHADOW_GFX_STATUS gfxstatus = { 0 };
rdpUpdate* update;
rdpUpdate* update = NULL;
WINPR_ASSERT(client);

View File

@ -175,12 +175,10 @@ int winpr_asprintf(char** s, size_t* slen, const char* templ, ...)
char* _strdup(const char* strSource)
{
char* strDestination;
if (strSource == NULL)
return NULL;
strDestination = strdup(strSource);
char* strDestination = strdup(strSource);
if (strDestination == NULL)
WLog_ERR(TAG, "strdup");
@ -190,10 +188,11 @@ char* _strdup(const char* strSource)
WCHAR* _wcsdup(const WCHAR* strSource)
{
size_t len = _wcslen(strSource);
WCHAR* strDestination;
if (!strSource)
return NULL;
strDestination = calloc(len + 1, sizeof(WCHAR));
size_t len = _wcslen(strSource);
WCHAR* strDestination = calloc(len + 1, sizeof(WCHAR));
if (strDestination != NULL)
memcpy(strDestination, strSource, len * sizeof(WCHAR));

View File

@ -379,9 +379,8 @@ LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
while ((offset + length + 8) > cchEnvironmentBlock)
{
LPCH tmp;
cchEnvironmentBlock *= 2;
tmp = (LPCH)realloc(lpszEnvironmentBlock, cchEnvironmentBlock * sizeof(CHAR));
LPCH tmp = (LPCH)realloc(lpszEnvironmentBlock, cchEnvironmentBlock * sizeof(CHAR));
if (!tmp)
{
@ -419,9 +418,8 @@ LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
{
while ((offset + mergeLength + 8) > cchEnvironmentBlock)
{
LPCH tmp;
cchEnvironmentBlock *= 2;
tmp =
LPCH tmp =
(LPCH)realloc(lpszEnvironmentBlock, cchEnvironmentBlock * sizeof(CHAR));
if (!tmp)
@ -463,9 +461,8 @@ LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
while ((offset + mergeLength + 8) > cchEnvironmentBlock)
{
LPCH tmp;
cchEnvironmentBlock *= 2;
tmp = (LPCH)realloc(lpszEnvironmentBlock, cchEnvironmentBlock * sizeof(CHAR));
LPCH tmp = (LPCH)realloc(lpszEnvironmentBlock, cchEnvironmentBlock * sizeof(CHAR));
if (!tmp)
{

View File

@ -249,7 +249,6 @@ LONG RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesir
LONG RegOpenKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
{
RegKey* pKey;
Reg* reg = RegGetInstance();
if (!reg)
@ -262,7 +261,7 @@ LONG RegOpenKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesire
}
WINPR_ASSERT(reg->root_key);
pKey = reg->root_key->subkeys;
RegKey* pKey = reg->root_key->subkeys;
while (pKey != NULL)
{

View File

@ -470,12 +470,10 @@ static void reg_unload_key(Reg* reg, RegKey* key)
static void reg_unload(Reg* reg)
{
RegKey* pKey;
WINPR_ASSERT(reg);
if (reg->root_key)
{
pKey = reg->root_key->subkeys;
RegKey* pKey = reg->root_key->subkeys;
while (pKey != NULL)
{

View File

@ -883,10 +883,8 @@ static SECURITY_STATUS SEC_ENTRY ntlm_QueryContextAttributesW(PCtxtHandle phCont
}
else if (ulAttribute == SECPKG_ATTR_AUTH_NTLM_MIC)
{
SecBuffer* mic;
NTLM_AUTHENTICATE_MESSAGE* message;
mic = (SecBuffer*)pBuffer;
message = &context->AUTHENTICATE_MESSAGE;
SecBuffer* mic = (SecBuffer*)pBuffer;
NTLM_AUTHENTICATE_MESSAGE* message = &context->AUTHENTICATE_MESSAGE;
if (!sspi_SecBufferAlloc(mic, 16))
return (SEC_E_INSUFFICIENT_MEMORY);

View File

@ -602,7 +602,7 @@ static BOOL test_default(void)
if (!DynamicTest)
{
SecPkgContext_AuthNtlmMessage AuthNtlmMessage;
SecPkgContext_AuthNtlmMessage AuthNtlmMessage = { 0 };
pSecBuffer->cbBuffer = sizeof(TEST_NTLM_CHALLENGE) - 1;
pSecBuffer->pvBuffer = (void*)malloc(pSecBuffer->cbBuffer);

View File

@ -55,7 +55,7 @@ static char* winpr_read_unix_timezone_identifier_from_file(FILE* fp)
{
const INT CHUNK_SIZE = 32;
INT64 rc, read = 0, length = CHUNK_SIZE;
char *tmp, *tzid = NULL;
char* tzid = NULL;
tzid = (char*)malloc(length);
if (!tzid)
@ -71,7 +71,7 @@ static char* winpr_read_unix_timezone_identifier_from_file(FILE* fp)
break;
length += CHUNK_SIZE;
tmp = (char*)realloc(tzid, length);
char* tmp = (char*)realloc(tzid, length);
if (!tmp)
{
free(tzid);

View File

@ -901,7 +901,7 @@ static size_t readLen(wStream* s, size_t* len, BOOL derCheck)
ret++;
if (retLen & 0x80)
{
BYTE tmp;
BYTE tmp = 0;
size_t nBytes = (retLen & 0x7f);
if (!Stream_CheckAndLogRequiredLength(TAG, s, nBytes))

View File

@ -121,13 +121,10 @@ static INLINE BOOL HashTable_IsProbablePrime(size_t oddNumber)
static INLINE size_t HashTable_CalculateIdealNumOfBuckets(wHashTable* table)
{
float tmp;
size_t idealNumOfBuckets;
WINPR_ASSERT(table);
tmp = (table->numOfElements / table->idealRatio);
idealNumOfBuckets = (size_t)tmp;
const float tmp = (table->numOfElements / table->idealRatio);
size_t idealNumOfBuckets = (size_t)tmp;
if (idealNumOfBuckets < 5)
idealNumOfBuckets = 5;

View File

@ -159,7 +159,7 @@ out:
BOOL MessageQueue_Post(wMessageQueue* queue, void* context, UINT32 type, void* wParam, void* lParam)
{
wMessage message;
wMessage message = { 0 };
message.context = context;
message.id = type;

View File

@ -322,6 +322,8 @@ static BOOL foreachFn3(const void* key, void* value, void* arg)
ForeachData d2;
WINPR_UNUSED(value);
WINPR_ASSERT(keyStr);
if (strcmp(keyStr, "key1") == 0)
{
/* when we pass on key1, let's remove key2 and check that the value is not

View File

@ -10,8 +10,8 @@ static DWORD WINAPI message_echo_pipe_client_thread(LPVOID arg)
while (index < 100)
{
wMessage message;
int count;
wMessage message = { 0 };
int count = -1;
if (!MessageQueue_Post(pipe->In, NULL, 0, (void*)(size_t)index, NULL))
break;
@ -40,10 +40,8 @@ static DWORD WINAPI message_echo_pipe_client_thread(LPVOID arg)
static DWORD WINAPI message_echo_pipe_server_thread(LPVOID arg)
{
wMessage message;
wMessagePipe* pipe;
pipe = (wMessagePipe*)arg;
wMessage message = { 0 };
wMessagePipe* pipe = (wMessagePipe*)arg;
while (MessageQueue_Wait(pipe->In))
{

View File

@ -5,10 +5,8 @@
static DWORD WINAPI message_queue_consumer_thread(LPVOID arg)
{
wMessage message;
wMessageQueue* queue;
queue = (wMessageQueue*)arg;
wMessage message = { 0 };
wMessageQueue* queue = (wMessageQueue*)arg;
while (MessageQueue_Wait(queue))
{

View File

@ -491,20 +491,14 @@ static BOOL WLog_reset_log_filters(wLog* log)
static BOOL WLog_AddStringLogFilters_int(wLog* root, LPCSTR filter)
{
DWORD pos;
DWORD size;
DWORD count;
LPCSTR cpp;
LPSTR p;
LPCSTR filterStr;
LPSTR cp;
wLogFilter* tmp;
if (!filter)
return FALSE;
count = 1;
cpp = filter;
DWORD count = 1;
LPCSTR cpp = filter;
while ((cpp = strchr(cpp, ',')) != NULL)
{
@ -512,15 +506,15 @@ static BOOL WLog_AddStringLogFilters_int(wLog* root, LPCSTR filter)
cpp++;
}
pos = g_FilterCount;
size = g_FilterCount + count;
tmp = (wLogFilter*)realloc(g_Filters, size * sizeof(wLogFilter));
DWORD pos = g_FilterCount;
DWORD size = g_FilterCount + count;
wLogFilter* tmp = (wLogFilter*)realloc(g_Filters, size * sizeof(wLogFilter));
if (!tmp)
return FALSE;
g_Filters = tmp;
cp = (LPSTR)_strdup(filter);
LPSTR cp = (LPSTR)_strdup(filter);
if (!cp)
return FALSE;