[clang-tidy] cppcoreguidelines-init-variables

This commit is contained in:
akallabeth
2024-01-23 16:49:54 +01:00
committed by akallabeth
parent 207def5c56
commit 0ba995655d
548 changed files with 9745 additions and 9771 deletions

View File

@@ -170,9 +170,9 @@ static wStream* test_peer_stream_init(testPeerContext* context)
static void test_peer_begin_frame(freerdp_peer* client)
{
rdpUpdate* update;
rdpUpdate* update = NULL;
SURFACE_FRAME_MARKER fm = { 0 };
testPeerContext* context;
testPeerContext* context = NULL;
WINPR_ASSERT(client);
WINPR_ASSERT(client->context);
@@ -191,9 +191,9 @@ static void test_peer_begin_frame(freerdp_peer* client)
static void test_peer_end_frame(freerdp_peer* client)
{
rdpUpdate* update;
rdpUpdate* update = NULL;
SURFACE_FRAME_MARKER fm = { 0 };
testPeerContext* context;
testPeerContext* context = NULL;
WINPR_ASSERT(client);
@@ -212,14 +212,14 @@ static void test_peer_end_frame(freerdp_peer* client)
static BOOL test_peer_draw_background(freerdp_peer* client)
{
size_t size;
wStream* s;
size_t size = 0;
wStream* s = NULL;
RFX_RECT rect;
BYTE* rgb_data;
const rdpSettings* settings;
rdpUpdate* update;
BYTE* rgb_data = NULL;
const rdpSettings* settings = NULL;
rdpUpdate* update = NULL;
SURFACE_BITS_COMMAND cmd = { 0 };
testPeerContext* context;
testPeerContext* context = NULL;
BOOL ret = FALSE;
const UINT32 colorFormat = PIXEL_FORMAT_RGB24;
const size_t bpp = FreeRDPGetBytesPerPixel(colorFormat);
@@ -331,8 +331,8 @@ static int open_icon(wImage* img)
static BOOL test_peer_load_icon(freerdp_peer* client)
{
testPeerContext* context;
rdpSettings* settings;
testPeerContext* context = NULL;
rdpSettings* settings = NULL;
WINPR_ASSERT(client);
@@ -366,12 +366,12 @@ out_fail:
static void test_peer_draw_icon(freerdp_peer* client, UINT32 x, UINT32 y)
{
wStream* s;
wStream* s = NULL;
RFX_RECT rect;
rdpUpdate* update;
rdpSettings* settings;
rdpUpdate* update = NULL;
rdpSettings* settings = NULL;
SURFACE_BITS_COMMAND cmd = { 0 };
testPeerContext* context;
testPeerContext* context = NULL;
WINPR_ASSERT(client);
@@ -495,8 +495,8 @@ static void test_peer_draw_icon(freerdp_peer* client, UINT32 x, UINT32 y)
static BOOL test_sleep_tsdiff(UINT32* old_sec, UINT32* old_usec, UINT32 new_sec, UINT32 new_usec)
{
INT64 sec;
INT64 usec;
INT64 sec = 0;
INT64 usec = 0;
WINPR_ASSERT(old_sec);
WINPR_ASSERT(old_usec);
@@ -537,13 +537,13 @@ static BOOL test_sleep_tsdiff(UINT32* old_sec, UINT32* old_usec, UINT32 new_sec,
static BOOL tf_peer_dump_rfx(freerdp_peer* client)
{
wStream* s;
UINT32 prev_seconds;
UINT32 prev_useconds;
rdpUpdate* update;
rdpPcap* pcap_rfx;
wStream* s = NULL;
UINT32 prev_seconds = 0;
UINT32 prev_useconds = 0;
rdpUpdate* update = NULL;
rdpPcap* pcap_rfx = NULL;
pcap_record record = { 0 };
struct server_info* info;
struct server_info* info = NULL;
WINPR_ASSERT(client);
WINPR_ASSERT(client->context);
@@ -596,11 +596,11 @@ static BOOL tf_peer_dump_rfx(freerdp_peer* client)
static DWORD WINAPI tf_debug_channel_thread_func(LPVOID arg)
{
void* fd;
wStream* s;
void* buffer;
void* fd = NULL;
wStream* s = NULL;
void* buffer = NULL;
DWORD BytesReturned = 0;
ULONG written;
ULONG written = 0;
testPeerContext* context = (testPeerContext*)arg;
WINPR_ASSERT(context);
@@ -619,7 +619,7 @@ static DWORD WINAPI tf_debug_channel_thread_func(LPVOID arg)
while (1)
{
DWORD status;
DWORD status = 0;
DWORD nCount = 0;
HANDLE handles[MAXIMUM_WAIT_OBJECTS] = { 0 };
@@ -663,8 +663,8 @@ fail:
static BOOL tf_peer_post_connect(freerdp_peer* client)
{
testPeerContext* context;
rdpSettings* settings;
testPeerContext* context = NULL;
rdpSettings* settings = NULL;
WINPR_ASSERT(client);
@@ -774,9 +774,9 @@ static BOOL tf_peer_post_connect(freerdp_peer* client)
static BOOL tf_peer_activate(freerdp_peer* client)
{
testPeerContext* context;
struct server_info* info;
rdpSettings* settings;
testPeerContext* context = NULL;
struct server_info* info = NULL;
rdpSettings* settings = NULL;
WINPR_ASSERT(client);
@@ -820,11 +820,11 @@ static BOOL tf_peer_synchronize_event(rdpInput* input, UINT32 flags)
static BOOL tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code)
{
freerdp_peer* client;
rdpUpdate* update;
rdpContext* context;
testPeerContext* tcontext;
rdpSettings* settings;
freerdp_peer* client = NULL;
rdpUpdate* update = NULL;
rdpContext* context = NULL;
testPeerContext* tcontext = NULL;
rdpSettings* settings = NULL;
WINPR_ASSERT(input);
@@ -878,7 +878,7 @@ static BOOL tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code)
{
if (tcontext->debug_channel)
{
ULONG written;
ULONG written = 0;
WTSVirtualChannelWrite(tcontext->debug_channel, (PCHAR) "test2", 5, &written);
}
}
@@ -941,7 +941,7 @@ static BOOL tf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x
static BOOL tf_peer_refresh_rect(rdpContext* context, BYTE count, const RECTANGLE_16* areas)
{
BYTE i;
BYTE i = 0;
WINPR_UNUSED(context);
WINPR_ASSERT(context);
WINPR_ASSERT(areas || (count == 0));
@@ -981,10 +981,9 @@ static int hook_peer_write_pdu(rdpTransport* transport, wStream* s)
UINT64 ts = 0;
wStream* ls = NULL;
UINT64 last_ts = 0;
const struct server_info* info;
freerdp_peer* client;
CONNECTION_STATE state;
testPeerContext* peerCtx;
const struct server_info* info = NULL;
freerdp_peer* client = NULL;
testPeerContext* peerCtx = NULL;
size_t offset = 0;
UINT32 flags = 0;
rdpContext* context = transport_get_context(transport);
@@ -1010,7 +1009,7 @@ static int hook_peer_write_pdu(rdpTransport* transport, wStream* s)
* configuration as the one that recorded the session!
*/
WINPR_ASSERT(info);
state = freerdp_get_state(context);
CONNECTION_STATE state = freerdp_get_state(context);
if (state < CONNECTION_STATE_NEGO)
return peerCtx->io.WritePdu(transport, s);
@@ -1020,7 +1019,7 @@ static int hook_peer_write_pdu(rdpTransport* transport, wStream* s)
while (stream_dump_get(context, &flags, ls, &offset, &ts) > 0)
{
int rc;
int rc = 0;
/* Skip messages from client. */
if (flags & STREAM_MSG_SRV_TX)
{
@@ -1044,16 +1043,16 @@ fail:
static DWORD WINAPI test_peer_mainloop(LPVOID arg)
{
BOOL rc;
BOOL rc = 0;
DWORD error = CHANNEL_RC_OK;
HANDLE handles[MAXIMUM_WAIT_OBJECTS] = { 0 };
DWORD count = 0;
DWORD status = 0;
testPeerContext* context = NULL;
struct server_info* info;
rdpSettings* settings;
rdpInput* input;
rdpUpdate* update;
struct server_info* info = NULL;
rdpSettings* settings = NULL;
rdpInput* input = NULL;
rdpUpdate* update = NULL;
freerdp_peer* client = (freerdp_peer*)arg;
WINPR_ASSERT(client);
@@ -1245,8 +1244,8 @@ fail:
static BOOL test_peer_accepted(freerdp_listener* instance, freerdp_peer* client)
{
HANDLE hThread;
struct server_info* info;
HANDLE hThread = NULL;
struct server_info* info = NULL;
WINPR_UNUSED(instance);

View File

@@ -92,7 +92,7 @@ size_t server_audin_get_formats(AUDIO_FORMAT** dst_formats)
{ WAVE_FORMAT_ALAW, 1, 22050, 22050, 2, 8, 0, NULL }
};
const size_t nrDefaultFormatsMax = ARRAYSIZE(default_supported_audio_formats);
size_t x;
size_t x = 0;
size_t nr_formats = 0;
AUDIO_FORMAT* formats = audio_formats_new(nrDefaultFormatsMax);
@@ -126,7 +126,7 @@ fail:
size_t server_rdpsnd_get_formats(AUDIO_FORMAT** dst_formats)
{
size_t x;
size_t x = 0;
size_t y = 0;
/* Default supported audio formats */
static const AUDIO_FORMAT default_supported_audio_formats[] = {

View File

@@ -232,12 +232,12 @@ static DynvcReadResult dynvc_read_varInt(wLog* log, wStream* s, size_t len, UINT
static PfChannelResult DynvcTrackerPeekFn(ChannelStateTracker* tracker, BOOL firstPacket,
BOOL lastPacket)
{
BYTE cmd;
BYTE byte0;
wStream* s;
BYTE cmd = 0;
BYTE byte0 = 0;
wStream* s = NULL;
wStream sbuffer;
BOOL haveChannelId;
BOOL haveLength;
BOOL haveChannelId = 0;
BOOL haveLength = 0;
UINT64 dynChannelId = 0;
UINT64 Length = 0;
pServerDynamicChannelContext* dynChannel = NULL;
@@ -350,7 +350,7 @@ static PfChannelResult DynvcTrackerPeekFn(ChannelStateTracker* tracker, BOOL fir
case CREATE_REQUEST_PDU:
{
UINT32 creationStatus;
UINT32 creationStatus = 0;
/* we only want the full packet */
if (!lastPacket)
@@ -559,7 +559,7 @@ static PfChannelResult DynvcTrackerPeekFn(ChannelStateTracker* tracker, BOOL fir
}
}
PfChannelResult result;
PfChannelResult result = PF_CHANNEL_RESULT_ERROR;
switch (dynChannel->channelMode)
{
case PF_UTILS_CHANNEL_PASSTHROUGH:

View File

@@ -219,7 +219,7 @@ static wStream* rdpdr_server_get_send_buffer(pf_channel_server_context* rdpdr, U
static UINT rdpdr_client_send(wLog* log, pClientContext* pc, wStream* s)
{
UINT16 channelId;
UINT16 channelId = 0;
WINPR_ASSERT(log);
WINPR_ASSERT(pc);
@@ -250,8 +250,8 @@ static UINT rdpdr_client_send(wLog* log, pClientContext* pc, wStream* s)
static UINT rdpdr_seal_send_free_request(pf_channel_server_context* context, wStream* s)
{
BOOL status;
size_t len;
BOOL status = 0;
size_t len = 0;
WINPR_ASSERT(context);
WINPR_ASSERT(context->handle);
@@ -269,8 +269,8 @@ static UINT rdpdr_seal_send_free_request(pf_channel_server_context* context, wSt
static BOOL rdpdr_process_server_header(BOOL server, wLog* log, wStream* s, UINT16 component,
UINT16 PacketId, size_t expect)
{
UINT16 rpacketid;
UINT16 rcomponent;
UINT16 rpacketid = 0;
UINT16 rcomponent = 0;
WINPR_ASSERT(s);
if (!Stream_CheckAndLogRequiredLengthRx(server, log, s, 4))
@@ -389,9 +389,9 @@ static UINT rdpdr_process_client_announce_reply(pf_channel_server_context* rdpdr
{
const UINT16 component = RDPDR_CTYP_CORE;
const UINT16 packetid = PAKID_CORE_CLIENTID_CONFIRM;
UINT16 versionMajor;
UINT16 versionMinor;
UINT32 clientID;
UINT16 versionMajor = 0;
UINT16 versionMinor = 0;
UINT32 clientID = 0;
WINPR_ASSERT(rdpdr);
WINPR_ASSERT(s);
@@ -490,7 +490,7 @@ static UINT rdpdr_process_client_name_request(pf_channel_server_context* rdpdr,
static UINT rdpdr_send_client_name_request(pClientContext* pc, pf_channel_client_context* rdpdr)
{
wStream* s;
wStream* s = NULL;
WINPR_ASSERT(rdpdr);
WINPR_ASSERT(pc);
@@ -569,8 +569,8 @@ static UINT rdpdr_process_server_core_capability_request(pf_channel_client_conte
wStream* s)
{
UINT status = CHANNEL_RC_OK;
UINT16 i;
UINT16 numCapabilities;
UINT16 i = 0;
UINT16 numCapabilities = 0;
WINPR_ASSERT(rdpdr);
@@ -735,8 +735,8 @@ static UINT rdpdr_process_client_capability_response(pf_channel_server_context*
const UINT16 component = RDPDR_CTYP_CORE;
const UINT16 packetid = PAKID_CORE_CLIENT_CAPABILITY;
UINT status = CHANNEL_RC_OK;
UINT16 numCapabilities;
UINT16 x;
UINT16 numCapabilities = 0;
UINT16 x = 0;
WINPR_ASSERT(rdpdr);
if (!rdpdr_process_server_header(TRUE, rdpdr->log, s, component, packetid, 4))
@@ -803,7 +803,7 @@ static UINT rdpdr_process_client_capability_response(pf_channel_server_context*
static UINT rdpdr_send_client_capability_response(pClientContext* pc,
pf_channel_client_context* rdpdr)
{
wStream* s;
wStream* s = NULL;
WINPR_ASSERT(rdpdr);
s = rdpdr_client_get_send_buffer(rdpdr, RDPDR_CTYP_CORE, PAKID_CORE_CLIENT_CAPABILITY, 4);
@@ -827,7 +827,7 @@ static UINT rdpdr_send_client_capability_response(pClientContext* pc,
static UINT rdpdr_send_server_clientid_confirm(pf_channel_server_context* rdpdr)
{
wStream* s;
wStream* s = NULL;
s = rdpdr_server_get_send_buffer(rdpdr, RDPDR_CTYP_CORE, PAKID_CORE_CLIENTID_CONFIRM, 8);
if (!s)
@@ -840,9 +840,9 @@ static UINT rdpdr_send_server_clientid_confirm(pf_channel_server_context* rdpdr)
static UINT rdpdr_process_server_clientid_confirm(pf_channel_client_context* rdpdr, wStream* s)
{
UINT16 versionMajor;
UINT16 versionMinor;
UINT32 clientID;
UINT16 versionMajor = 0;
UINT16 versionMinor = 0;
UINT32 clientID = 0;
WINPR_ASSERT(rdpdr);
WINPR_ASSERT(s);
@@ -893,8 +893,8 @@ rdpdr_process_server_capability_request_or_clientid_confirm(pf_channel_client_co
const UINT32 mask = STATE_CLIENT_EXPECT_SERVER_CLIENT_ID_CONFIRM |
STATE_CLIENT_EXPECT_SERVER_CORE_CAPABILITY_REQUEST;
const UINT16 rcomponent = RDPDR_CTYP_CORE;
UINT16 component;
UINT16 packetid;
UINT16 component = 0;
UINT16 packetid = 0;
WINPR_ASSERT(rdpdr);
WINPR_ASSERT(s);
@@ -946,7 +946,7 @@ rdpdr_process_server_capability_request_or_clientid_confirm(pf_channel_client_co
static UINT rdpdr_send_emulated_scard_device_list_announce_request(pClientContext* pc,
pf_channel_client_context* rdpdr)
{
wStream* s;
wStream* s = NULL;
s = rdpdr_client_get_send_buffer(rdpdr, RDPDR_CTYP_CORE, PAKID_CORE_DEVICELIST_ANNOUNCE, 24);
if (!s)
@@ -966,7 +966,7 @@ static UINT rdpdr_send_emulated_scard_device_list_announce_request(pClientContex
static UINT rdpdr_send_emulated_scard_device_remove(pClientContext* pc,
pf_channel_client_context* rdpdr)
{
wStream* s;
wStream* s = NULL;
s = rdpdr_client_get_send_buffer(rdpdr, RDPDR_CTYP_CORE, PAKID_CORE_DEVICELIST_REMOVE, 24);
if (!s)
@@ -984,8 +984,8 @@ static UINT rdpdr_process_server_device_announce_response(pf_channel_client_cont
{
const UINT16 component = RDPDR_CTYP_CORE;
const UINT16 packetid = PAKID_CORE_DEVICE_REPLY;
UINT32 deviceID;
UINT32 resultCode;
UINT32 deviceID = 0;
UINT32 resultCode = 0;
WINPR_ASSERT(rdpdr);
WINPR_ASSERT(s);
@@ -1110,8 +1110,8 @@ static BOOL pf_channel_rdpdr_rewrite_device_list(pf_channel_client_context* rdpd
WINPR_ASSERT(ps);
const size_t pos = Stream_GetPosition(s);
UINT16 component;
UINT16 packetid;
UINT16 component = 0;
UINT16 packetid = 0;
Stream_SetPosition(s, 0);
if (!Stream_CheckAndLogRequiredLengthWLog(rdpdr->log, s, 4))
@@ -1195,10 +1195,10 @@ static BOOL filter_smartcard_io_requests(pf_channel_client_context* rdpdr, wStre
UINT16* pPacketid)
{
BOOL rc = FALSE;
UINT16 component;
UINT16 packetid;
UINT16 component = 0;
UINT16 packetid = 0;
UINT32 deviceID = 0;
size_t pos;
size_t pos = 0;
WINPR_ASSERT(rdpdr);
WINPR_ASSERT(pPacketid);
@@ -1261,7 +1261,7 @@ fail:
BOOL pf_channel_send_client_queue(pClientContext* pc, pf_channel_client_context* rdpdr)
{
UINT16 channelId;
UINT16 channelId = 0;
WINPR_ASSERT(pc);
WINPR_ASSERT(rdpdr);
@@ -1315,11 +1315,11 @@ static BOOL rdpdr_handle_server_announce_request(pClientContext* pc,
BOOL pf_channel_rdpdr_client_handle(pClientContext* pc, UINT16 channelId, const char* channel_name,
const BYTE* xdata, size_t xsize, UINT32 flags, size_t totalSize)
{
pf_channel_client_context* rdpdr;
pServerContext* ps;
wStream* s;
pf_channel_client_context* rdpdr = NULL;
pServerContext* ps = NULL;
wStream* s = NULL;
#if defined(WITH_PROXY_EMULATE_SMARTCARD)
UINT16 packetid;
UINT16 packetid = 0;
#endif
WINPR_ASSERT(pc);
@@ -1513,7 +1513,7 @@ static BOOL pf_channel_rdpdr_client_pass_message(pServerContext* ps, pClientCont
UINT16 channelId, const char* channel_name,
wStream* s)
{
pf_channel_client_context* rdpdr;
pf_channel_client_context* rdpdr = NULL;
WINPR_ASSERT(ps);
WINPR_ASSERT(pc);
@@ -1534,9 +1534,9 @@ static BOOL pf_channel_rdpdr_client_pass_message(pServerContext* ps, pClientCont
#if defined(WITH_PROXY_EMULATE_SMARTCARD)
static BOOL filter_smartcard_device_list_remove(pf_channel_server_context* rdpdr, wStream* s)
{
size_t pos;
UINT32 x;
UINT32 count;
size_t pos = 0;
UINT32 x = 0;
UINT32 count = 0;
WINPR_ASSERT(rdpdr);
if (!Stream_CheckAndLogRequiredLengthWLog(rdpdr->log, s, sizeof(UINT32)))
@@ -1552,7 +1552,7 @@ static BOOL filter_smartcard_device_list_remove(pf_channel_server_context* rdpdr
for (x = 0; x < count; x++)
{
UINT32 deviceID;
UINT32 deviceID = 0;
BYTE* dst = Stream_Pointer(s);
Stream_Read_UINT32(s, deviceID);
if (deviceID == SCARD_DEVICE_ID)
@@ -1578,7 +1578,7 @@ static BOOL filter_smartcard_device_list_remove(pf_channel_server_context* rdpdr
static BOOL filter_smartcard_device_io_request(pf_channel_server_context* rdpdr, wStream* s)
{
UINT32 DeviceID;
UINT32 DeviceID = 0;
WINPR_ASSERT(rdpdr);
WINPR_ASSERT(s);
Stream_Read_UINT32(s, DeviceID);
@@ -1587,7 +1587,7 @@ static BOOL filter_smartcard_device_io_request(pf_channel_server_context* rdpdr,
static BOOL filter_smartcard_device_list_announce(pf_channel_server_context* rdpdr, wStream* s)
{
UINT32 count;
UINT32 count = 0;
WINPR_ASSERT(rdpdr);
if (!Stream_CheckAndLogRequiredLengthWLog(rdpdr->log, s, sizeof(UINT32)))
@@ -1600,10 +1600,10 @@ static BOOL filter_smartcard_device_list_announce(pf_channel_server_context* rdp
for (UINT32 x = 0; x < count; x++)
{
UINT32 DeviceType;
UINT32 DeviceId;
UINT32 DeviceType = 0;
UINT32 DeviceId = 0;
char PreferredDosName[8];
UINT32 DeviceDataLength;
UINT32 DeviceDataLength = 0;
BYTE* dst = Stream_Pointer(s);
if (!Stream_CheckAndLogRequiredLengthWLog(rdpdr->log, s, 20))
return TRUE;
@@ -1636,9 +1636,9 @@ static BOOL filter_smartcard_device_list_announce_request(pf_channel_server_cont
wStream* s)
{
BOOL rc = TRUE;
size_t pos;
UINT16 component;
UINT16 packetid;
size_t pos = 0;
UINT16 component = 0;
UINT16 packetid = 0;
WINPR_ASSERT(rdpdr);
if (!Stream_CheckAndLogRequiredLengthWLog(rdpdr->log, s, 8))
@@ -1718,8 +1718,8 @@ static const char* pf_channel_rdpdr_client_context(void* arg)
BOOL pf_channel_rdpdr_client_new(pClientContext* pc)
{
wObject* obj;
pf_channel_client_context* rdpdr;
wObject* obj = NULL;
pf_channel_client_context* rdpdr = NULL;
WINPR_ASSERT(pc);
WINPR_ASSERT(pc->interceptContextMap);
@@ -1782,7 +1782,7 @@ static const char* pf_channel_rdpdr_server_context(void* arg)
BOOL pf_channel_rdpdr_server_new(pServerContext* ps)
{
pf_channel_server_context* rdpdr;
pf_channel_server_context* rdpdr = NULL;
PULONG pSessionId = NULL;
DWORD BytesReturned = 0;
@@ -1830,7 +1830,7 @@ void pf_channel_rdpdr_server_free(pServerContext* ps)
static pf_channel_server_context* get_channel(pServerContext* ps, BOOL send)
{
pf_channel_server_context* rdpdr;
pf_channel_server_context* rdpdr = NULL;
WINPR_ASSERT(ps);
WINPR_ASSERT(ps->interceptContextMap);
@@ -1849,8 +1849,8 @@ static pf_channel_server_context* get_channel(pServerContext* ps, BOOL send)
BOOL pf_channel_rdpdr_server_handle(pServerContext* ps, UINT16 channelId, const char* channel_name,
const BYTE* xdata, size_t xsize, UINT32 flags, size_t totalSize)
{
wStream* s;
pClientContext* pc;
wStream* s = NULL;
pClientContext* pc = NULL;
pf_channel_server_context* rdpdr = get_channel(ps, FALSE);
if (!rdpdr)
return FALSE;
@@ -1944,7 +1944,7 @@ BOOL pf_channel_rdpdr_server_announce(pServerContext* ps)
BOOL pf_channel_rdpdr_client_reset(pClientContext* pc)
{
pf_channel_client_context* rdpdr;
pf_channel_client_context* rdpdr = NULL;
WINPR_ASSERT(pc);
WINPR_ASSERT(pc->pdata);

View File

@@ -60,7 +60,7 @@ typedef struct
static pf_channel_client_context* scard_get_client_context(pClientContext* pc)
{
pf_channel_client_context* scard;
pf_channel_client_context* scard = NULL;
WINPR_ASSERT(pc);
WINPR_ASSERT(pc->interceptContextMap);
@@ -74,11 +74,11 @@ static pf_channel_client_context* scard_get_client_context(pClientContext* pc)
static BOOL pf_channel_client_write_iostatus(wStream* out, const SMARTCARD_OPERATION* op,
UINT32 ioStatus)
{
UINT16 component;
UINT16 packetid;
UINT32 dID;
UINT32 cID;
size_t pos;
UINT16 component = 0;
UINT16 packetid = 0;
UINT32 dID = 0;
UINT32 cID = 0;
size_t pos = 0;
WINPR_ASSERT(op);
WINPR_ASSERT(out);
@@ -118,7 +118,7 @@ static VOID irp_thread(PTP_CALLBACK_INSTANCE Instance, PVOID Context, PTP_WORK W
struct thread_arg* arg = Context;
pf_channel_client_context* scard = arg->scard;
{
UINT32 ioStatus;
UINT32 ioStatus = 0;
LONG rc = smartcard_irp_device_control_call(arg->scard->callctx, arg->e->out, &ioStatus,
&arg->e->op);
if (rc == CHANNEL_RC_OK)
@@ -135,7 +135,7 @@ static VOID irp_thread(PTP_CALLBACK_INSTANCE Instance, PVOID Context, PTP_WORK W
static BOOL start_irp_thread(pf_channel_client_context* scard,
const pf_channel_client_queue_element* e)
{
PTP_WORK work;
PTP_WORK work = NULL;
struct thread_arg* arg = calloc(1, sizeof(struct thread_arg));
if (!arg)
return FALSE;
@@ -163,10 +163,10 @@ BOOL pf_channel_smartcard_client_handle(wLog* log, pClientContext* pc, wStream*
pf_scard_send_fkt_t send_fkt)
{
BOOL rc = FALSE;
LONG status;
UINT32 FileId;
UINT32 CompletionId;
UINT32 ioStatus;
LONG status = 0;
UINT32 FileId = 0;
UINT32 CompletionId = 0;
UINT32 ioStatus = 0;
pf_channel_client_queue_element e = { 0 };
pf_channel_client_context* scard = scard_get_client_context(pc);
@@ -187,9 +187,9 @@ BOOL pf_channel_smartcard_client_handle(wLog* log, pClientContext* pc, wStream*
return FALSE;
else
{
UINT32 DeviceId;
UINT32 MajorFunction;
UINT32 MinorFunction;
UINT32 DeviceId = 0;
UINT32 MajorFunction = 0;
UINT32 MinorFunction = 0;
Stream_Read_UINT32(s, DeviceId); /* DeviceId (4 bytes) */
Stream_Read_UINT32(s, FileId); /* FileId (4 bytes) */
@@ -312,7 +312,7 @@ static void queue_free(void* obj)
static void* queue_copy(const void* obj)
{
const pf_channel_client_queue_element* other = obj;
pf_channel_client_queue_element* copy;
pf_channel_client_queue_element* copy = NULL;
if (!other)
return NULL;
copy = calloc(1, sizeof(pf_channel_client_queue_element));
@@ -338,8 +338,8 @@ static void work_object_free(void* arg)
BOOL pf_channel_smartcard_client_new(pClientContext* pc)
{
pf_channel_client_context* scard;
wObject* obj;
pf_channel_client_context* scard = NULL;
wObject* obj = NULL;
WINPR_ASSERT(pc);
WINPR_ASSERT(pc->interceptContextMap);

View File

@@ -191,7 +191,7 @@ static BOOL demo_server_session_end(proxyPlugin* plugin, proxyData* pdata, void*
static BOOL demo_filter_keyboard_event(proxyPlugin* plugin, proxyData* pdata, void* param)
{
proxyPluginsManager* mgr;
proxyPluginsManager* mgr = nullptr;
auto event_data = static_cast<const proxyKeyboardEventInfo*>(param);
WINPR_ASSERT(plugin);
@@ -216,7 +216,7 @@ static BOOL demo_filter_keyboard_event(proxyPlugin* plugin, proxyData* pdata, vo
static BOOL demo_filter_unicode_event(proxyPlugin* plugin, proxyData* pdata, void* param)
{
proxyPluginsManager* mgr;
proxyPluginsManager* mgr = nullptr;
auto event_data = static_cast<const proxyUnicodeEventInfo*>(param);
WINPR_ASSERT(plugin);
@@ -372,7 +372,7 @@ extern "C"
BOOL proxy_module_entry_point(proxyPluginsManager* plugins_manager, void* userdata)
{
struct demo_custom_data* custom;
struct demo_custom_data* custom = nullptr;
proxyPlugin plugin = {};
plugin.name = plugin_name;

View File

@@ -93,7 +93,7 @@ fail:
PfChannelResult channelTracker_update(ChannelStateTracker* tracker, const BYTE* xdata, size_t xsize,
UINT32 flags, size_t totalSize)
{
PfChannelResult result;
PfChannelResult result = PF_CHANNEL_RESULT_ERROR;
BOOL firstPacket = (flags & CHANNEL_FLAG_FIRST);
BOOL lastPacket = (flags & CHANNEL_FLAG_LAST);
@@ -173,11 +173,11 @@ void channelTracker_free(ChannelStateTracker* t)
PfChannelResult channelTracker_flushCurrent(ChannelStateTracker* t, BOOL first, BOOL last,
BOOL toBack)
{
proxyData* pdata;
pServerContext* ps;
pServerStaticChannelContext* channel;
proxyData* pdata = NULL;
pServerContext* ps = NULL;
pServerStaticChannelContext* channel = NULL;
UINT32 flags = CHANNEL_FLAG_FIRST;
BOOL r;
BOOL r = 0;
const char* direction = toBack ? "F->B" : "B->F";
const size_t currentPacketSize = channelTracker_getCurrentPacketSize(t);
wStream* currentPacket = channelTracker_getCurrentPacket(t);

View File

@@ -71,7 +71,7 @@ static BOOL proxy_server_reactivate(rdpContext* ps, const rdpContext* pc)
static void pf_client_on_error_info(void* ctx, const ErrorInfoEventArgs* e)
{
pClientContext* pc = (pClientContext*)ctx;
pServerContext* ps;
pServerContext* ps = NULL;
WINPR_ASSERT(pc);
WINPR_ASSERT(pc->pdata);
@@ -93,8 +93,8 @@ static void pf_client_on_error_info(void* ctx, const ErrorInfoEventArgs* e)
static void pf_client_on_activated(void* ctx, const ActivatedEventArgs* e)
{
pClientContext* pc = (pClientContext*)ctx;
pServerContext* ps;
freerdp_peer* peer;
pServerContext* ps = NULL;
freerdp_peer* peer = NULL;
WINPR_ASSERT(pc);
WINPR_ASSERT(pc->pdata);
@@ -116,8 +116,8 @@ static void pf_client_on_activated(void* ctx, const ActivatedEventArgs* e)
static BOOL pf_client_load_rdpsnd(pClientContext* pc)
{
rdpContext* context = (rdpContext*)pc;
pServerContext* ps;
const proxyConfig* config;
pServerContext* ps = NULL;
const proxyConfig* config = NULL;
WINPR_ASSERT(pc);
WINPR_ASSERT(pc->pdata);
@@ -143,10 +143,10 @@ static BOOL pf_client_load_rdpsnd(pClientContext* pc)
static BOOL pf_client_use_peer_load_balance_info(pClientContext* pc)
{
pServerContext* ps;
rdpSettings* settings;
DWORD lb_info_len;
const char* lb_info;
pServerContext* ps = NULL;
rdpSettings* settings = NULL;
DWORD lb_info_len = 0;
const char* lb_info = NULL;
WINPR_ASSERT(pc);
WINPR_ASSERT(pc->pdata);
@@ -223,10 +223,10 @@ static BOOL freerdp_client_load_static_channel_addin(rdpChannels* channels, rdpS
static BOOL pf_client_pre_connect(freerdp* instance)
{
pClientContext* pc;
pServerContext* ps;
const proxyConfig* config;
rdpSettings* settings;
pClientContext* pc = NULL;
pServerContext* ps = NULL;
const proxyConfig* config = NULL;
rdpSettings* settings = NULL;
WINPR_ASSERT(instance);
pc = (pClientContext*)instance->context;
@@ -357,10 +357,10 @@ static BOOL pf_client_update_back_id(pServerContext* ps, const char* name, UINT3
static BOOL pf_client_load_channels(freerdp* instance)
{
pClientContext* pc;
pServerContext* ps;
const proxyConfig* config;
rdpSettings* settings;
pClientContext* pc = NULL;
pServerContext* ps = NULL;
const proxyConfig* config = NULL;
rdpSettings* settings = NULL;
WINPR_ASSERT(instance);
pc = (pClientContext*)instance->context;
@@ -409,7 +409,7 @@ static BOOL pf_client_load_channels(freerdp* instance)
{
CHANNEL_DEF* channels = (CHANNEL_DEF*)freerdp_settings_get_pointer_array_writable(
settings, FreeRDP_ChannelDefArray, 0);
size_t x;
size_t x = 0;
size_t size = freerdp_settings_get_uint32(settings, FreeRDP_ChannelCount);
UINT32 id = MCS_GLOBAL_CHANNEL_ID + 1;
@@ -454,10 +454,10 @@ static BOOL pf_client_receive_channel_data_hook(freerdp* instance, UINT16 channe
const BYTE* xdata, size_t xsize, UINT32 flags,
size_t totalSize)
{
pClientContext* pc;
pServerContext* ps;
proxyData* pdata;
pServerStaticChannelContext* channel;
pClientContext* pc = NULL;
pServerContext* ps = NULL;
proxyData* pdata = NULL;
pServerStaticChannelContext* channel = NULL;
UINT64 channelId64 = channelId;
WINPR_ASSERT(instance);
@@ -499,8 +499,8 @@ static BOOL pf_client_receive_channel_data_hook(freerdp* instance, UINT16 channe
static BOOL pf_client_on_server_heartbeat(freerdp* instance, BYTE period, BYTE count1, BYTE count2)
{
pClientContext* pc;
pServerContext* ps;
pClientContext* pc = NULL;
pServerContext* ps = NULL;
WINPR_ASSERT(instance);
pc = (pClientContext*)instance->context;
@@ -528,12 +528,12 @@ static BOOL sendQueuedChannelData(pClientContext* pc)
if (pc->connected)
{
proxyChannelDataEventInfo* ev;
proxyChannelDataEventInfo* ev = NULL;
Queue_Lock(pc->cached_server_channel_data);
while (rc && (ev = Queue_Dequeue(pc->cached_server_channel_data)))
{
UINT16 channelId;
UINT16 channelId = 0;
WINPR_ASSERT(pc->context.instance);
channelId = freerdp_channels_get_id_by_name(pc->context.instance, ev->channel_name);
@@ -567,12 +567,12 @@ static BOOL sendQueuedChannelData(pClientContext* pc)
*/
static BOOL pf_client_post_connect(freerdp* instance)
{
rdpContext* context;
rdpSettings* settings;
rdpUpdate* update;
rdpContext* ps;
pClientContext* pc;
const proxyConfig* config;
rdpContext* context = NULL;
rdpSettings* settings = NULL;
rdpUpdate* update = NULL;
rdpContext* ps = NULL;
pClientContext* pc = NULL;
const proxyConfig* config = NULL;
WINPR_ASSERT(instance);
context = instance->context;
@@ -623,8 +623,8 @@ static BOOL pf_client_post_connect(freerdp* instance)
*/
static void pf_client_post_disconnect(freerdp* instance)
{
pClientContext* pc;
proxyData* pdata;
pClientContext* pc = NULL;
proxyData* pdata = NULL;
if (!instance)
return;
@@ -656,8 +656,8 @@ static void pf_client_post_disconnect(freerdp* instance)
static BOOL pf_client_redirect(freerdp* instance)
{
pClientContext* pc;
proxyData* pdata;
pClientContext* pc = NULL;
proxyData* pdata = NULL;
if (!instance)
return FALSE;
@@ -686,8 +686,8 @@ static BOOL pf_client_redirect(freerdp* instance)
*/
static BOOL pf_client_should_retry_without_nla(pClientContext* pc)
{
rdpSettings* settings;
const proxyConfig* config;
rdpSettings* settings = NULL;
const proxyConfig* config = NULL;
WINPR_ASSERT(pc);
WINPR_ASSERT(pc->pdata);
@@ -705,8 +705,8 @@ static BOOL pf_client_should_retry_without_nla(pClientContext* pc)
static void pf_client_set_security_settings(pClientContext* pc)
{
rdpSettings* settings;
const proxyConfig* config;
rdpSettings* settings = NULL;
const proxyConfig* config = NULL;
WINPR_ASSERT(pc);
WINPR_ASSERT(pc->pdata);
@@ -732,8 +732,8 @@ static void pf_client_set_security_settings(pClientContext* pc)
static BOOL pf_client_connect_without_nla(pClientContext* pc)
{
freerdp* instance;
rdpSettings* settings;
freerdp* instance = NULL;
rdpSettings* settings = NULL;
WINPR_ASSERT(pc);
instance = pc->context.instance;
@@ -760,8 +760,8 @@ static BOOL pf_client_connect_without_nla(pClientContext* pc)
static BOOL pf_client_connect(freerdp* instance)
{
pClientContext* pc;
rdpSettings* settings;
pClientContext* pc = NULL;
rdpSettings* settings = NULL;
BOOL rc = FALSE;
BOOL retry = FALSE;
@@ -813,10 +813,10 @@ out:
*/
static DWORD WINAPI pf_client_thread_proc(pClientContext* pc)
{
freerdp* instance;
proxyData* pdata;
freerdp* instance = NULL;
proxyData* pdata = NULL;
DWORD nCount = 0;
DWORD status;
DWORD status = 0;
HANDLE handles[MAXIMUM_WAIT_OBJECTS] = { 0 };
WINPR_ASSERT(pc);
@@ -926,7 +926,7 @@ static void pf_client_context_free(freerdp* instance, rdpContext* context)
static int pf_client_verify_X509_certificate(freerdp* instance, const BYTE* data, size_t length,
const char* hostname, UINT16 port, DWORD flags)
{
pClientContext* pc;
pClientContext* pc = NULL;
WINPR_ASSERT(instance);
WINPR_ASSERT(data);
@@ -984,7 +984,7 @@ static void* channel_data_copy(const void* obj)
void* pv;
} cnv;
const proxyChannelDataEventInfo* src = obj;
proxyChannelDataEventInfo* dst;
proxyChannelDataEventInfo* dst = NULL;
WINPR_ASSERT(src);
@@ -1014,7 +1014,7 @@ fail:
static BOOL pf_client_client_new(freerdp* instance, rdpContext* context)
{
wObject* obj;
wObject* obj = NULL;
pClientContext* pc = (pClientContext*)context;
if (!instance || !context)
@@ -1058,7 +1058,7 @@ static BOOL pf_client_client_new(freerdp* instance, rdpContext* context)
static int pf_client_client_stop(rdpContext* context)
{
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
proxyData* pdata = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;

View File

@@ -138,8 +138,8 @@ static char** pf_config_parse_comma_separated_list(const char* list, size_t* cou
static BOOL pf_config_get_uint16(wIniFile* ini, const char* section, const char* key,
UINT16* result, BOOL required)
{
int val;
const char* strval;
int val = 0;
const char* strval = NULL;
WINPR_ASSERT(result);
@@ -163,8 +163,8 @@ static BOOL pf_config_get_uint16(wIniFile* ini, const char* section, const char*
static BOOL pf_config_get_uint32(wIniFile* ini, const char* section, const char* key,
UINT32* result, BOOL required)
{
int val;
const char* strval;
int val = 0;
const char* strval = NULL;
WINPR_ASSERT(result);
@@ -189,8 +189,8 @@ static BOOL pf_config_get_uint32(wIniFile* ini, const char* section, const char*
static BOOL pf_config_get_bool(wIniFile* ini, const char* section, const char* key, BOOL fallback)
{
int num_value;
const char* str_value;
int num_value = 0;
const char* str_value = NULL;
str_value = IniFile_GetKeyValueString(ini, section, key);
if (!str_value)
@@ -216,7 +216,7 @@ static BOOL pf_config_get_bool(wIniFile* ini, const char* section, const char* k
static const char* pf_config_get_str(wIniFile* ini, const char* section, const char* key,
BOOL required)
{
const char* value;
const char* value = NULL;
value = IniFile_GetKeyValueString(ini, section, key);
@@ -232,7 +232,7 @@ static const char* pf_config_get_str(wIniFile* ini, const char* section, const c
static BOOL pf_config_load_server(wIniFile* ini, proxyConfig* config)
{
const char* host;
const char* host = NULL;
WINPR_ASSERT(config);
host = pf_config_get_str(ini, section_server, key_host, FALSE);
@@ -253,7 +253,7 @@ static BOOL pf_config_load_server(wIniFile* ini, proxyConfig* config)
static BOOL pf_config_load_target(wIniFile* ini, proxyConfig* config)
{
const char* target_value;
const char* target_value = NULL;
WINPR_ASSERT(config);
config->FixedTarget = pf_config_get_bool(ini, section_target, key_target_fixed, FALSE);
@@ -373,8 +373,8 @@ static BOOL pf_config_load_clipboard(wIniFile* ini, proxyConfig* config)
static BOOL pf_config_load_modules(wIniFile* ini, proxyConfig* config)
{
const char* modules_to_load;
const char* required_modules;
const char* modules_to_load = NULL;
const char* required_modules = NULL;
modules_to_load = pf_config_get_str(ini, section_plugins, key_plugins_modules, FALSE);
required_modules = pf_config_get_str(ini, section_plugins, key_plugins_required, FALSE);
@@ -466,8 +466,8 @@ static char* pf_config_decode_base64(const char* data, const char* name, size_t*
static BOOL pf_config_load_certificates(wIniFile* ini, proxyConfig* config)
{
const char* tmp1;
const char* tmp2;
const char* tmp1 = NULL;
const char* tmp2 = NULL;
WINPR_ASSERT(ini);
WINPR_ASSERT(config);
@@ -751,7 +751,7 @@ fail:
proxyConfig* pf_server_config_load_buffer(const char* buffer)
{
proxyConfig* config = NULL;
wIniFile* ini;
wIniFile* ini = NULL;
ini = IniFile_New();
@@ -798,7 +798,7 @@ out:
static void pf_server_config_print_list(char** list, size_t count)
{
size_t i;
size_t i = 0;
WINPR_ASSERT(list);
for (i = 0; i < count; i++)
@@ -807,7 +807,7 @@ static void pf_server_config_print_list(char** list, size_t count)
void pf_server_config_print(const proxyConfig* config)
{
size_t x;
size_t x = 0;
WINPR_ASSERT(config);
WLog_INFO(TAG, "Proxy configuration:");
@@ -1077,9 +1077,9 @@ static BOOL config_plugin_unload(proxyPlugin* plugin)
static BOOL config_plugin_keyboard_event(proxyPlugin* plugin, proxyData* pdata, void* param)
{
BOOL rc;
const struct config_plugin_data* custom;
const proxyConfig* cfg;
BOOL rc = 0;
const struct config_plugin_data* custom = NULL;
const proxyConfig* cfg = NULL;
const proxyKeyboardEventInfo* event_data = (const proxyKeyboardEventInfo*)(param);
WINPR_ASSERT(plugin);
@@ -1101,9 +1101,9 @@ static BOOL config_plugin_keyboard_event(proxyPlugin* plugin, proxyData* pdata,
static BOOL config_plugin_unicode_event(proxyPlugin* plugin, proxyData* pdata, void* param)
{
BOOL rc;
const struct config_plugin_data* custom;
const proxyConfig* cfg;
BOOL rc = 0;
const struct config_plugin_data* custom = NULL;
const proxyConfig* cfg = NULL;
const proxyUnicodeEventInfo* event_data = (const proxyUnicodeEventInfo*)(param);
WINPR_ASSERT(plugin);
@@ -1125,9 +1125,9 @@ static BOOL config_plugin_unicode_event(proxyPlugin* plugin, proxyData* pdata, v
static BOOL config_plugin_mouse_event(proxyPlugin* plugin, proxyData* pdata, void* param)
{
BOOL rc;
const struct config_plugin_data* custom;
const proxyConfig* cfg;
BOOL rc = 0;
const struct config_plugin_data* custom = NULL;
const proxyConfig* cfg = NULL;
const proxyMouseEventInfo* event_data = (const proxyMouseEventInfo*)(param);
WINPR_ASSERT(plugin);
@@ -1148,9 +1148,9 @@ static BOOL config_plugin_mouse_event(proxyPlugin* plugin, proxyData* pdata, voi
static BOOL config_plugin_mouse_ex_event(proxyPlugin* plugin, proxyData* pdata, void* param)
{
BOOL rc;
const struct config_plugin_data* custom;
const proxyConfig* cfg;
BOOL rc = 0;
const struct config_plugin_data* custom = NULL;
const proxyConfig* cfg = NULL;
const proxyMouseExEventInfo* event_data = (const proxyMouseExEventInfo*)(param);
WINPR_ASSERT(plugin);
@@ -1197,23 +1197,20 @@ static BOOL config_plugin_server_channel_data(proxyPlugin* plugin, proxyData* pd
static BOOL config_plugin_dynamic_channel_create(proxyPlugin* plugin, proxyData* pdata, void* param)
{
pf_utils_channel_mode rc;
BOOL accept;
const struct config_plugin_data* custom;
const proxyConfig* cfg;
BOOL accept = 0;
const proxyChannelDataEventInfo* channel = (const proxyChannelDataEventInfo*)(param);
WINPR_ASSERT(plugin);
WINPR_ASSERT(pdata);
WINPR_ASSERT(channel);
custom = plugin->custom;
const struct config_plugin_data* custom = plugin->custom;
WINPR_ASSERT(custom);
cfg = custom->config;
const proxyConfig* cfg = custom->config;
WINPR_ASSERT(cfg);
rc = pf_utils_get_channel_mode(cfg, channel->channel_name);
pf_utils_channel_mode rc = pf_utils_get_channel_mode(cfg, channel->channel_name);
switch (rc)
{
@@ -1265,23 +1262,20 @@ static BOOL config_plugin_dynamic_channel_create(proxyPlugin* plugin, proxyData*
static BOOL config_plugin_channel_create(proxyPlugin* plugin, proxyData* pdata, void* param)
{
pf_utils_channel_mode rc;
BOOL accept;
const struct config_plugin_data* custom;
const proxyConfig* cfg;
BOOL accept = 0;
const proxyChannelDataEventInfo* channel = (const proxyChannelDataEventInfo*)(param);
WINPR_ASSERT(plugin);
WINPR_ASSERT(pdata);
WINPR_ASSERT(channel);
custom = plugin->custom;
const struct config_plugin_data* custom = plugin->custom;
WINPR_ASSERT(custom);
cfg = custom->config;
const proxyConfig* cfg = custom->config;
WINPR_ASSERT(cfg);
rc = pf_utils_get_channel_mode(cfg, channel->channel_name);
pf_utils_channel_mode rc = pf_utils_get_channel_mode(cfg, channel->channel_name);
switch (rc)
{
case PF_UTILS_CHANNEL_INTERCEPT:
@@ -1318,7 +1312,7 @@ static BOOL config_plugin_channel_create(proxyPlugin* plugin, proxyData* pdata,
BOOL pf_config_plugin(proxyPluginsManager* plugins_manager, void* userdata)
{
struct config_plugin_data* custom;
struct config_plugin_data* custom = NULL;
proxyPlugin plugin = { 0 };
plugin.name = config_plugin_name;

View File

@@ -103,7 +103,7 @@ static void HashStaticChannelContext_free(void* ptr)
static void client_to_proxy_context_free(freerdp_peer* client, rdpContext* ctx);
static BOOL client_to_proxy_context_new(freerdp_peer* client, rdpContext* ctx)
{
wObject* obj;
wObject* obj = NULL;
pServerContext* context = (pServerContext*)ctx;
WINPR_ASSERT(client);
@@ -225,7 +225,7 @@ void intercept_context_entry_free(void* obj)
BOOL pf_context_copy_settings(rdpSettings* dst, const rdpSettings* src)
{
BOOL rc = FALSE;
rdpSettings* before_copy;
rdpSettings* before_copy = NULL;
const FreeRDP_Settings_Keys_String to_revert[] = { FreeRDP_ConfigPath,
FreeRDP_CertificateName };
@@ -273,8 +273,8 @@ out_fail:
pClientContext* pf_context_create_client_context(const rdpSettings* clientSettings)
{
RDP_CLIENT_ENTRY_POINTS clientEntryPoints;
pClientContext* pc;
rdpContext* context;
pClientContext* pc = NULL;
rdpContext* context = NULL;
WINPR_ASSERT(clientSettings);
@@ -298,8 +298,8 @@ error:
proxyData* proxy_data_new(void)
{
BYTE temp[16];
char* hex;
proxyData* pdata;
char* hex = NULL;
proxyData* pdata = NULL;
pdata = calloc(1, sizeof(proxyData));
if (!pdata)

View File

@@ -46,8 +46,8 @@ static BOOL pf_server_check_and_sync_input_state(pClientContext* pc)
static BOOL pf_server_synchronize_event(rdpInput* input, UINT32 flags)
{
pServerContext* ps;
pClientContext* pc;
pServerContext* ps = NULL;
pClientContext* pc = NULL;
WINPR_ASSERT(input);
ps = (pServerContext*)input->context;
@@ -66,10 +66,10 @@ static BOOL pf_server_synchronize_event(rdpInput* input, UINT32 flags)
static BOOL pf_server_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code)
{
const proxyConfig* config;
const proxyConfig* config = NULL;
proxyKeyboardEventInfo event = { 0 };
pServerContext* ps;
pClientContext* pc;
pServerContext* ps = NULL;
pClientContext* pc = NULL;
WINPR_ASSERT(input);
ps = (pServerContext*)input->context;
@@ -99,10 +99,10 @@ static BOOL pf_server_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code)
static BOOL pf_server_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
const proxyConfig* config;
const proxyConfig* config = NULL;
proxyUnicodeEventInfo event = { 0 };
pServerContext* ps;
pClientContext* pc;
pServerContext* ps = NULL;
pClientContext* pc = NULL;
WINPR_ASSERT(input);
ps = (pServerContext*)input->context;
@@ -131,9 +131,9 @@ static BOOL pf_server_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT
static BOOL pf_server_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
proxyMouseEventInfo event = { 0 };
const proxyConfig* config;
pServerContext* ps;
pClientContext* pc;
const proxyConfig* config = NULL;
pServerContext* ps = NULL;
pClientContext* pc = NULL;
WINPR_ASSERT(input);
ps = (pServerContext*)input->context;
@@ -164,10 +164,10 @@ static BOOL pf_server_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT1
static BOOL pf_server_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
const proxyConfig* config;
const proxyConfig* config = NULL;
proxyMouseExEventInfo event = { 0 };
pServerContext* ps;
pClientContext* pc;
pServerContext* ps = NULL;
pClientContext* pc = NULL;
WINPR_ASSERT(input);
ps = (pServerContext*)input->context;

View File

@@ -125,16 +125,13 @@ static const char* pf_modules_get_hook_type_string(PF_HOOK_TYPE result)
static BOOL pf_modules_proxy_ArrayList_ForEachFkt(void* data, size_t index, va_list ap)
{
proxyPlugin* plugin = (proxyPlugin*)data;
PF_HOOK_TYPE type;
proxyData* pdata;
void* custom;
BOOL ok = FALSE;
WINPR_UNUSED(index);
type = va_arg(ap, PF_HOOK_TYPE);
pdata = va_arg(ap, proxyData*);
custom = va_arg(ap, void*);
PF_HOOK_TYPE type = va_arg(ap, PF_HOOK_TYPE);
proxyData* pdata = va_arg(ap, proxyData*);
void* custom = va_arg(ap, void*);
WLog_VRB(TAG, "running hook %s.%s", plugin->name, pf_modules_get_hook_type_string(type));
@@ -237,16 +234,13 @@ BOOL pf_modules_run_hook(proxyModule* module, PF_HOOK_TYPE type, proxyData* pdat
static BOOL pf_modules_ArrayList_ForEachFkt(void* data, size_t index, va_list ap)
{
proxyPlugin* plugin = (proxyPlugin*)data;
PF_FILTER_TYPE type;
proxyData* pdata;
void* param;
BOOL result = FALSE;
WINPR_UNUSED(index);
type = va_arg(ap, PF_FILTER_TYPE);
pdata = va_arg(ap, proxyData*);
param = va_arg(ap, void*);
PF_FILTER_TYPE type = va_arg(ap, PF_FILTER_TYPE);
proxyData* pdata = va_arg(ap, proxyData*);
void* param = va_arg(ap, void*);
WLog_VRB(TAG, "running filter: %s", plugin->name);
@@ -472,7 +466,7 @@ static BOOL pf_modules_print_ArrayList_ForEachFkt(void* data, size_t index, va_l
void pf_modules_list_loaded_plugins(proxyModule* module)
{
size_t count;
size_t count = 0;
WINPR_ASSERT(module);
WINPR_ASSERT(module->plugins);
@@ -488,7 +482,7 @@ void pf_modules_list_loaded_plugins(proxyModule* module)
static BOOL pf_modules_load_module(const char* module_path, proxyModule* module, void* userdata)
{
HMODULE handle = NULL;
proxyModuleEntryPoint pEntryPoint;
proxyModuleEntryPoint pEntryPoint = NULL;
WINPR_ASSERT(module);
handle = LoadLibraryX(module_path);
@@ -547,8 +541,8 @@ static void* new_plugin(const void* obj)
proxyModule* pf_modules_new(const char* root_dir, const char** modules, size_t count)
{
size_t i;
wObject* obj;
size_t i = 0;
wObject* obj = NULL;
char* path = NULL;
proxyModule* module = calloc(1, sizeof(proxyModule));
if (!module)
@@ -603,7 +597,7 @@ proxyModule* pf_modules_new(const char* root_dir, const char** modules, size_t c
for (i = 0; i < count; i++)
{
char name[8192] = { 0 };
char* fullpath;
char* fullpath = NULL;
_snprintf(name, sizeof(name), "proxy-%s-plugin%s", modules[i],
FREERDP_SHARED_LIBRARY_SUFFIX);
fullpath = GetCombinedPath(path, name);

View File

@@ -69,9 +69,9 @@ static BOOL pf_server_parse_target_from_routing_token(rdpContext* context, rdpSe
{
#define TARGET_MAX (100)
#define ROUTING_TOKEN_PREFIX "Cookie: msts="
char* colon;
size_t len;
DWORD routing_token_length;
char* colon = NULL;
size_t len = 0;
DWORD routing_token_length = 0;
const size_t prefix_len = strnlen(ROUTING_TOKEN_PREFIX, sizeof(ROUTING_TOKEN_PREFIX));
const char* routing_token = freerdp_nego_get_routing_token(context, &routing_token_length);
pServerContext* ps = (pServerContext*)context;
@@ -191,8 +191,8 @@ static BOOL pf_server_get_target_info(rdpContext* context, rdpSettings* settings
static BOOL pf_server_setup_channels(freerdp_peer* peer)
{
char** accepted_channels = NULL;
size_t accepted_channels_count;
size_t i;
size_t accepted_channels_count = 0;
size_t i = 0;
pServerContext* ps = (pServerContext*)peer->context;
accepted_channels = WTSGetAcceptedChannelNames(peer, &accepted_channels_count);
@@ -201,7 +201,7 @@ static BOOL pf_server_setup_channels(freerdp_peer* peer)
for (i = 0; i < accepted_channels_count; i++)
{
pServerStaticChannelContext* channelContext;
pServerStaticChannelContext* channelContext = NULL;
const char* cname = accepted_channels[i];
UINT16 channelId = WTSChannelGetId(peer, cname);
@@ -266,11 +266,11 @@ static BOOL pf_server_setup_channels(freerdp_peer* peer)
*/
static BOOL pf_server_post_connect(freerdp_peer* peer)
{
pServerContext* ps;
pClientContext* pc;
rdpSettings* client_settings;
proxyData* pdata;
rdpSettings* frontSettings;
pServerContext* ps = NULL;
pClientContext* pc = NULL;
rdpSettings* client_settings = NULL;
proxyData* pdata = NULL;
rdpSettings* frontSettings = NULL;
WINPR_ASSERT(peer);
@@ -328,9 +328,9 @@ static BOOL pf_server_post_connect(freerdp_peer* peer)
static BOOL pf_server_activate(freerdp_peer* peer)
{
pServerContext* ps;
proxyData* pdata;
rdpSettings* settings;
pServerContext* ps = NULL;
proxyData* pdata = NULL;
rdpSettings* settings = NULL;
WINPR_ASSERT(peer);
@@ -353,8 +353,8 @@ static BOOL pf_server_activate(freerdp_peer* peer)
static BOOL pf_server_logon(freerdp_peer* peer, const SEC_WINNT_AUTH_IDENTITY* identity,
BOOL automatic)
{
pServerContext* ps;
proxyData* pdata;
pServerContext* ps = NULL;
proxyData* pdata = NULL;
proxyServerPeerLogon info = { 0 };
WINPR_ASSERT(peer);
@@ -384,11 +384,11 @@ static BOOL pf_server_receive_channel_data_hook(freerdp_peer* peer, UINT16 chann
const BYTE* data, size_t size, UINT32 flags,
size_t totalSize)
{
pServerContext* ps;
pClientContext* pc;
proxyData* pdata;
const proxyConfig* config;
const pServerStaticChannelContext* channel;
pServerContext* ps = NULL;
pClientContext* pc = NULL;
proxyData* pdata = NULL;
const proxyConfig* config = NULL;
const pServerStaticChannelContext* channel = NULL;
UINT64 channelId64 = channelId;
WINPR_ASSERT(peer);
@@ -734,8 +734,8 @@ out_free_peer:
static BOOL pf_server_start_peer(freerdp_peer* client)
{
HANDLE hThread;
proxyServer* server;
HANDLE hThread = NULL;
proxyServer* server = NULL;
peer_thread_args* args = calloc(1, sizeof(peer_thread_args));
if (!args)
return FALSE;
@@ -885,7 +885,7 @@ fail:
static BOOL are_all_required_modules_loaded(proxyModule* module, const proxyConfig* config)
{
size_t i;
size_t i = 0;
for (i = 0; i < pf_config_required_plugins_count(config); i++)
{
@@ -909,8 +909,8 @@ static void peer_free(void* obj)
proxyServer* pf_server_new(const proxyConfig* config)
{
wObject* obj;
proxyServer* server;
wObject* obj = NULL;
proxyServer* server = NULL;
WINPR_ASSERT(config);
@@ -970,9 +970,9 @@ BOOL pf_server_run(proxyServer* server)
{
BOOL rc = TRUE;
HANDLE eventHandles[MAXIMUM_WAIT_OBJECTS] = { 0 };
DWORD eventCount;
DWORD status;
freerdp_listener* listener;
DWORD eventCount = 0;
DWORD status = 0;
freerdp_listener* listener = NULL;
WINPR_ASSERT(server);

View File

@@ -38,7 +38,7 @@
static BOOL pf_server_refresh_rect(rdpContext* context, BYTE count, const RECTANGLE_16* areas)
{
pServerContext* ps = (pServerContext*)context;
rdpContext* pc;
rdpContext* pc = NULL;
WINPR_ASSERT(ps);
WINPR_ASSERT(ps->pdata);
pc = (rdpContext*)ps->pdata->pc;
@@ -51,7 +51,7 @@ static BOOL pf_server_refresh_rect(rdpContext* context, BYTE count, const RECTAN
static BOOL pf_server_suppress_output(rdpContext* context, BYTE allow, const RECTANGLE_16* area)
{
pServerContext* ps = (pServerContext*)context;
rdpContext* pc;
rdpContext* pc = NULL;
WINPR_ASSERT(ps);
WINPR_ASSERT(ps->pdata);
pc = (rdpContext*)ps->pdata->pc;
@@ -70,8 +70,8 @@ static BOOL pf_server_suppress_output(rdpContext* context, BYTE allow, const REC
static BOOL pf_client_begin_paint(rdpContext* context)
{
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -91,8 +91,8 @@ static BOOL pf_client_begin_paint(rdpContext* context)
static BOOL pf_client_end_paint(rdpContext* context)
{
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -116,8 +116,8 @@ static BOOL pf_client_end_paint(rdpContext* context)
static BOOL pf_client_bitmap_update(rdpContext* context, const BITMAP_UPDATE* bitmap)
{
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -132,8 +132,8 @@ static BOOL pf_client_bitmap_update(rdpContext* context, const BITMAP_UPDATE* bi
static BOOL pf_client_desktop_resize(rdpContext* context)
{
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -155,8 +155,8 @@ static BOOL pf_client_remote_monitors(rdpContext* context, UINT32 count,
const MONITOR_DEF* monitors)
{
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -170,8 +170,8 @@ static BOOL pf_client_send_pointer_system(rdpContext* context,
const POINTER_SYSTEM_UPDATE* pointer_system)
{
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -188,8 +188,8 @@ static BOOL pf_client_send_pointer_position(rdpContext* context,
const POINTER_POSITION_UPDATE* pointerPosition)
{
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -206,8 +206,8 @@ static BOOL pf_client_send_pointer_color(rdpContext* context,
const POINTER_COLOR_UPDATE* pointer_color)
{
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -224,8 +224,8 @@ static BOOL pf_client_send_pointer_large(rdpContext* context,
const POINTER_LARGE_UPDATE* pointer_large)
{
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -241,8 +241,8 @@ static BOOL pf_client_send_pointer_large(rdpContext* context,
static BOOL pf_client_send_pointer_new(rdpContext* context, const POINTER_NEW_UPDATE* pointer_new)
{
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -259,8 +259,8 @@ static BOOL pf_client_send_pointer_cached(rdpContext* context,
const POINTER_CACHED_UPDATE* pointer_cached)
{
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -277,8 +277,8 @@ static BOOL pf_client_save_session_info(rdpContext* context, UINT32 type, void*
{
logon_info* logonInfo = NULL;
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -310,8 +310,8 @@ static BOOL pf_client_save_session_info(rdpContext* context, UINT32 type, void*
static BOOL pf_client_server_status_info(rdpContext* context, UINT32 status)
{
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -327,8 +327,8 @@ static BOOL pf_client_server_status_info(rdpContext* context, UINT32 status)
static BOOL pf_client_set_keyboard_indicators(rdpContext* context, UINT16 led_flags)
{
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -345,8 +345,8 @@ static BOOL pf_client_set_keyboard_ime_status(rdpContext* context, UINT16 imeId,
UINT32 imeConvMode)
{
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -362,10 +362,10 @@ static BOOL pf_client_set_keyboard_ime_status(rdpContext* context, UINT16 imeId,
static BOOL pf_client_window_create(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,
const WINDOW_STATE_ORDER* windowState)
{
BOOL rc;
BOOL rc = 0;
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -385,10 +385,10 @@ static BOOL pf_client_window_create(rdpContext* context, const WINDOW_ORDER_INFO
static BOOL pf_client_window_update(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,
const WINDOW_STATE_ORDER* windowState)
{
BOOL rc;
BOOL rc = 0;
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -408,10 +408,10 @@ static BOOL pf_client_window_update(rdpContext* context, const WINDOW_ORDER_INFO
static BOOL pf_client_window_icon(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,
const WINDOW_ICON_ORDER* windowIcon)
{
BOOL rc;
BOOL rc = 0;
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -431,10 +431,10 @@ static BOOL pf_client_window_icon(rdpContext* context, const WINDOW_ORDER_INFO*
static BOOL pf_client_window_cached_icon(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,
const WINDOW_CACHED_ICON_ORDER* windowCachedIcon)
{
BOOL rc;
BOOL rc = 0;
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -453,10 +453,10 @@ static BOOL pf_client_window_cached_icon(rdpContext* context, const WINDOW_ORDER
static BOOL pf_client_window_delete(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo)
{
BOOL rc;
BOOL rc = 0;
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -476,10 +476,10 @@ static BOOL pf_client_window_delete(rdpContext* context, const WINDOW_ORDER_INFO
static BOOL pf_client_notify_icon_create(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,
const NOTIFY_ICON_STATE_ORDER* notifyIconState)
{
BOOL rc;
BOOL rc = 0;
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -499,10 +499,10 @@ static BOOL pf_client_notify_icon_create(rdpContext* context, const WINDOW_ORDER
static BOOL pf_client_notify_icon_update(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,
const NOTIFY_ICON_STATE_ORDER* notifyIconState)
{
BOOL rc;
BOOL rc = 0;
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -521,11 +521,11 @@ static BOOL pf_client_notify_icon_update(rdpContext* context, const WINDOW_ORDER
static BOOL pf_client_notify_icon_delete(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo)
{
BOOL rc;
BOOL rc = 0;
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -545,10 +545,10 @@ static BOOL pf_client_notify_icon_delete(rdpContext* context, const WINDOW_ORDER
static BOOL pf_client_monitored_desktop(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,
const MONITORED_DESKTOP_ORDER* monitoredDesktop)
{
BOOL rc;
BOOL rc = 0;
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);
@@ -567,10 +567,10 @@ static BOOL pf_client_monitored_desktop(rdpContext* context, const WINDOW_ORDER_
static BOOL pf_client_non_monitored_desktop(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo)
{
BOOL rc;
BOOL rc = 0;
pClientContext* pc = (pClientContext*)context;
proxyData* pdata;
rdpContext* ps;
proxyData* pdata = NULL;
rdpContext* ps = NULL;
WINPR_ASSERT(pc);
pdata = pc->pdata;
WINPR_ASSERT(pdata);

View File

@@ -30,7 +30,7 @@
pf_utils_channel_mode pf_utils_get_channel_mode(const proxyConfig* config, const char* name)
{
pf_utils_channel_mode rc = PF_UTILS_CHANNEL_NOT_HANDLED;
size_t i;
size_t i = 0;
BOOL found = FALSE;
WINPR_ASSERT(config);

View File

@@ -71,10 +71,10 @@ typedef struct
static int x11_shadow_pam_conv(int num_msg, const struct pam_message** msg,
struct pam_response** resp, void* appdata_ptr)
{
int index;
int index = 0;
int pam_status = PAM_CONV_ERR;
SHADOW_PAM_AUTH_DATA* appdata;
struct pam_response* response;
SHADOW_PAM_AUTH_DATA* appdata = NULL;
struct pam_response* response = NULL;
WINPR_ASSERT(num_msg >= 0);
appdata = (SHADOW_PAM_AUTH_DATA*)appdata_ptr;
WINPR_ASSERT(appdata);
@@ -131,7 +131,7 @@ out_fail:
static BOOL x11_shadow_pam_get_service_name(SHADOW_PAM_AUTH_INFO* info)
{
size_t x;
size_t x = 0;
const char* base = "/etc/pam.d";
const char* hints[] = { "lightdm", "gdm", "xdm", "login", "sshd" };
@@ -155,7 +155,7 @@ static BOOL x11_shadow_pam_get_service_name(SHADOW_PAM_AUTH_INFO* info)
static int x11_shadow_pam_authenticate(rdpShadowSubsystem* subsystem, rdpShadowClient* client,
const char* user, const char* domain, const char* password)
{
int pam_status;
int pam_status = 0;
SHADOW_PAM_AUTH_INFO info = { 0 };
WINPR_UNUSED(subsystem);
WINPR_UNUSED(client);
@@ -210,9 +210,9 @@ static BOOL x11_shadow_input_keyboard_event(rdpShadowSubsystem* subsystem, rdpSh
{
#ifdef WITH_XTEST
x11ShadowSubsystem* x11 = (x11ShadowSubsystem*)subsystem;
DWORD vkcode;
DWORD keycode;
DWORD scancode;
DWORD vkcode = 0;
DWORD keycode = 0;
DWORD scancode = 0;
BOOL extended = FALSE;
if (!client || !subsystem)
@@ -267,8 +267,8 @@ static BOOL x11_shadow_input_mouse_event(rdpShadowSubsystem* subsystem, rdpShado
x11ShadowSubsystem* x11 = (x11ShadowSubsystem*)subsystem;
unsigned int button = 0;
BOOL down = FALSE;
rdpShadowServer* server;
rdpShadowSurface* surface;
rdpShadowServer* server = NULL;
rdpShadowSurface* surface = NULL;
if (!subsystem || !client)
return FALSE;
@@ -345,8 +345,8 @@ static BOOL x11_shadow_input_extended_mouse_event(rdpShadowSubsystem* subsystem,
x11ShadowSubsystem* x11 = (x11ShadowSubsystem*)subsystem;
UINT button = 0;
BOOL down = FALSE;
rdpShadowServer* server;
rdpShadowSurface* surface;
rdpShadowServer* server = NULL;
rdpShadowSurface* surface = NULL;
if (!subsystem || !client)
return FALSE;
@@ -410,7 +410,7 @@ static void x11_shadow_message_free(UINT32 id, SHADOW_MSG_OUT* msg)
static int x11_shadow_pointer_position_update(x11ShadowSubsystem* subsystem)
{
UINT32 msgId = SHADOW_MSG_OUT_POINTER_POSITION_UPDATE_ID;
rdpShadowServer* server;
rdpShadowServer* server = NULL;
SHADOW_MSG_OUT_POINTER_POSITION_UPDATE templateMsg;
int count = 0;
size_t index = 0;
@@ -426,7 +426,7 @@ static int x11_shadow_pointer_position_update(x11ShadowSubsystem* subsystem)
for (index = 0; index < ArrayList_Count(server->clients); index++)
{
SHADOW_MSG_OUT_POINTER_POSITION_UPDATE* msg;
SHADOW_MSG_OUT_POINTER_POSITION_UPDATE* msg = NULL;
rdpShadowClient* client = (rdpShadowClient*)ArrayList_GetItem(server->clients, index);
/* Skip the client which send us the latest mouse event */
@@ -453,7 +453,7 @@ static int x11_shadow_pointer_position_update(x11ShadowSubsystem* subsystem)
static int x11_shadow_pointer_alpha_update(x11ShadowSubsystem* subsystem)
{
SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE* msg;
SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE* msg = NULL;
UINT32 msgId = SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE_ID;
msg = (SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE*)calloc(1,
sizeof(SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE));
@@ -484,18 +484,18 @@ static int x11_shadow_query_cursor(x11ShadowSubsystem* subsystem, BOOL getImage)
{
int x = 0;
int y = 0;
int n;
int k;
rdpShadowServer* server;
rdpShadowSurface* surface;
int n = 0;
int k = 0;
rdpShadowServer* server = NULL;
rdpShadowSurface* surface = NULL;
server = subsystem->common.server;
surface = server->surface;
if (getImage)
{
#ifdef WITH_XFIXES
UINT32* pDstPixel;
XFixesCursorImage* ci;
UINT32* pDstPixel = NULL;
XFixesCursorImage* ci = NULL;
XLockDisplay(subsystem->display);
ci = XFixesGetCursorImage(subsystem->display);
XUnlockDisplay(subsystem->display);
@@ -532,13 +532,13 @@ static int x11_shadow_query_cursor(x11ShadowSubsystem* subsystem, BOOL getImage)
}
else
{
UINT32 mask;
int win_x;
int win_y;
int root_x;
int root_y;
Window root;
Window child;
UINT32 mask = 0;
int win_x = 0;
int win_y = 0;
int root_x = 0;
int root_y = 0;
Window root = 0;
Window child = 0;
XLockDisplay(subsystem->display);
if (!XQueryPointer(subsystem->display, subsystem->root_window, &root, &child, &root_x,
@@ -612,23 +612,23 @@ static void x11_shadow_validate_region(x11ShadowSubsystem* subsystem, int x, int
static int x11_shadow_blend_cursor(x11ShadowSubsystem* subsystem)
{
UINT32 x;
UINT32 y;
UINT32 nXSrc;
UINT32 nYSrc;
INT64 nXDst;
INT64 nYDst;
UINT32 nWidth;
UINT32 nHeight;
UINT32 nSrcStep;
UINT32 nDstStep;
BYTE* pSrcData;
BYTE* pDstData;
BYTE A;
BYTE R;
BYTE G;
BYTE B;
rdpShadowSurface* surface;
UINT32 x = 0;
UINT32 y = 0;
UINT32 nXSrc = 0;
UINT32 nYSrc = 0;
INT64 nXDst = 0;
INT64 nYDst = 0;
UINT32 nWidth = 0;
UINT32 nHeight = 0;
UINT32 nSrcStep = 0;
UINT32 nDstStep = 0;
BYTE* pSrcData = NULL;
BYTE* pDstData = NULL;
BYTE A = 0;
BYTE R = 0;
BYTE G = 0;
BYTE B = 0;
rdpShadowSurface* surface = NULL;
if (!subsystem)
return -1;
@@ -762,18 +762,18 @@ static int x11_shadow_error_handler_for_capture(Display* display, XErrorEvent* e
static int x11_shadow_screen_grab(x11ShadowSubsystem* subsystem)
{
int rc = 0;
size_t count;
size_t count = 0;
int status = -1;
int x;
int y;
int width;
int height;
XImage* image;
rdpShadowServer* server;
rdpShadowSurface* surface;
int x = 0;
int y = 0;
int width = 0;
int height = 0;
XImage* image = NULL;
rdpShadowServer* server = NULL;
rdpShadowSurface* surface = NULL;
RECTANGLE_16 invalidRect;
RECTANGLE_16 surfaceRect;
const RECTANGLE_16* extents;
const RECTANGLE_16* extents = NULL;
server = subsystem->common.server;
surface = server->surface;
count = ArrayList_Count(server->clients);
@@ -838,7 +838,7 @@ static int x11_shadow_screen_grab(x11ShadowSubsystem* subsystem)
if (status)
{
BOOL empty;
BOOL empty = 0;
EnterCriticalSection(&surface->lock);
region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion), &invalidRect);
region16_intersect_rect(&(surface->invalidRegion), &(surface->invalidRegion), &surfaceRect);
@@ -847,7 +847,7 @@ static int x11_shadow_screen_grab(x11ShadowSubsystem* subsystem)
if (!empty)
{
BOOL success;
BOOL success = 0;
EnterCriticalSection(&surface->lock);
extents = region16_extents(&(surface->invalidRegion));
x = extents->left;
@@ -872,7 +872,7 @@ static int x11_shadow_screen_grab(x11ShadowSubsystem* subsystem)
if (count == 1)
{
rdpShadowClient* client;
rdpShadowClient* client = NULL;
client = (rdpShadowClient*)ArrayList_GetItem(server->clients, 0);
if (client)
@@ -924,15 +924,15 @@ static DWORD WINAPI x11_shadow_subsystem_thread(LPVOID arg)
{
x11ShadowSubsystem* subsystem = (x11ShadowSubsystem*)arg;
XEvent xevent;
DWORD status;
DWORD nCount;
UINT64 cTime;
DWORD dwTimeout;
DWORD dwInterval;
UINT64 frameTime;
DWORD status = 0;
DWORD nCount = 0;
UINT64 cTime = 0;
DWORD dwTimeout = 0;
DWORD dwInterval = 0;
UINT64 frameTime = 0;
HANDLE events[32];
wMessage message;
wMessagePipe* MsgPipe;
wMessagePipe* MsgPipe = NULL;
MsgPipe = subsystem->common.MsgPipe;
nCount = 0;
events[nCount++] = subsystem->common.event;
@@ -1017,10 +1017,10 @@ static int x11_shadow_subsystem_base_init(x11ShadowSubsystem* subsystem)
static int x11_shadow_xfixes_init(x11ShadowSubsystem* subsystem)
{
#ifdef WITH_XFIXES
int xfixes_event;
int xfixes_error;
int major;
int minor;
int xfixes_event = 0;
int xfixes_error = 0;
int major = 0;
int minor = 0;
if (!XFixesQueryExtension(subsystem->display, &xfixes_event, &xfixes_error))
return -1;
@@ -1040,16 +1040,16 @@ static int x11_shadow_xfixes_init(x11ShadowSubsystem* subsystem)
static int x11_shadow_xinerama_init(x11ShadowSubsystem* subsystem)
{
#ifdef WITH_XINERAMA
int xinerama_event;
int xinerama_error;
int xinerama_event = 0;
int xinerama_error = 0;
x11_shadow_subsystem_base_init(subsystem);
if (!XineramaQueryExtension(subsystem->display, &xinerama_event, &xinerama_error))
return -1;
#if defined(WITH_XDAMAGE)
int major;
int minor;
int major = 0;
int minor = 0;
if (!XDamageQueryVersion(subsystem->display, &major, &minor))
return -1;
#endif
@@ -1066,10 +1066,10 @@ static int x11_shadow_xinerama_init(x11ShadowSubsystem* subsystem)
static int x11_shadow_xdamage_init(x11ShadowSubsystem* subsystem)
{
#ifdef WITH_XDAMAGE
int major;
int minor;
int damage_event;
int damage_error;
int major = 0;
int minor = 0;
int damage_event = 0;
int damage_error = 0;
if (!subsystem->use_xfixes)
return -1;
@@ -1105,9 +1105,9 @@ static int x11_shadow_xdamage_init(x11ShadowSubsystem* subsystem)
static int x11_shadow_xshm_init(x11ShadowSubsystem* subsystem)
{
Bool pixmaps;
int major;
int minor;
Bool pixmaps = 0;
int major = 0;
int minor = 0;
XGCValues values;
if (!XShmQueryExtension(subsystem->display))
@@ -1178,9 +1178,9 @@ static int x11_shadow_xshm_init(x11ShadowSubsystem* subsystem)
UINT32 x11_shadow_enum_monitors(MONITOR_DEF* monitors, UINT32 maxMonitors)
{
Display* display;
int displayWidth;
int displayHeight;
Display* display = NULL;
int displayWidth = 0;
int displayHeight = 0;
int numMonitors = 0;
if (!getenv("DISPLAY"))
@@ -1199,12 +1199,12 @@ UINT32 x11_shadow_enum_monitors(MONITOR_DEF* monitors, UINT32 maxMonitors)
#ifdef WITH_XINERAMA
{
#if defined(WITH_XDAMAGE)
int major;
int minor;
int major = 0;
int minor = 0;
#endif
int xinerama_event;
int xinerama_error;
XineramaScreenInfo* screens;
int xinerama_event = 0;
int xinerama_error = 0;
XineramaScreenInfo* screens = NULL;
const Bool xinerama = XineramaQueryExtension(display, &xinerama_event, &xinerama_error);
const Bool damage =
@@ -1223,7 +1223,7 @@ UINT32 x11_shadow_enum_monitors(MONITOR_DEF* monitors, UINT32 maxMonitors)
if (screens && (numMonitors > 0))
{
int index;
int index = 0;
for (index = 0; index < numMonitors; index++)
{
MONITOR_DEF* monitor = &monitors[index];
@@ -1261,16 +1261,16 @@ UINT32 x11_shadow_enum_monitors(MONITOR_DEF* monitors, UINT32 maxMonitors)
static int x11_shadow_subsystem_init(rdpShadowSubsystem* sub)
{
int i;
int pf_count;
int vi_count;
int nextensions;
char** extensions;
XVisualInfo* vi;
XVisualInfo* vis;
int i = 0;
int pf_count = 0;
int vi_count = 0;
int nextensions = 0;
char** extensions = NULL;
XVisualInfo* vi = NULL;
XVisualInfo* vis = NULL;
XVisualInfo template = { 0 };
XPixmapFormatValues* pf;
XPixmapFormatValues* pfs;
XPixmapFormatValues* pf = NULL;
XPixmapFormatValues* pfs = NULL;
x11ShadowSubsystem* subsystem = (x11ShadowSubsystem*)sub;
@@ -1469,7 +1469,7 @@ static int x11_shadow_subsystem_stop(rdpShadowSubsystem* sub)
static rdpShadowSubsystem* x11_shadow_subsystem_new(void)
{
x11ShadowSubsystem* subsystem;
x11ShadowSubsystem* subsystem = NULL;
subsystem = (x11ShadowSubsystem*)calloc(1, sizeof(x11ShadowSubsystem));
if (!subsystem)

View File

@@ -35,8 +35,8 @@
static UINT AudinServerData(audin_server_context* audin, const SNDIN_DATA* data)
{
rdpShadowClient* client;
rdpShadowSubsystem* subsystem;
rdpShadowClient* client = NULL;
rdpShadowSubsystem* subsystem = NULL;
WINPR_ASSERT(audin);
WINPR_ASSERT(data);

View File

@@ -31,8 +31,8 @@
int shadow_capture_align_clip_rect(RECTANGLE_16* rect, RECTANGLE_16* clip)
{
int dx;
int dy;
int dx = 0;
int dy = 0;
dx = (rect->left % 16);
if (dx != 0)
@@ -81,21 +81,21 @@ int shadow_capture_align_clip_rect(RECTANGLE_16* rect, RECTANGLE_16* clip)
int shadow_capture_compare(BYTE* pData1, UINT32 nStep1, UINT32 nWidth, UINT32 nHeight, BYTE* pData2,
UINT32 nStep2, RECTANGLE_16* rect)
{
BOOL equal;
BOOL allEqual;
UINT32 tw;
UINT32 th;
UINT32 tx;
UINT32 ty;
UINT32 k;
UINT32 nrow;
UINT32 ncol;
UINT32 l;
UINT32 t;
UINT32 r;
UINT32 b;
BYTE* p1;
BYTE* p2;
BOOL equal = 0;
BOOL allEqual = 0;
UINT32 tw = 0;
UINT32 th = 0;
UINT32 tx = 0;
UINT32 ty = 0;
UINT32 k = 0;
UINT32 nrow = 0;
UINT32 ncol = 0;
UINT32 l = 0;
UINT32 t = 0;
UINT32 r = 0;
UINT32 b = 0;
BYTE* p1 = NULL;
BYTE* p2 = NULL;
BOOL rows[1024];
#ifdef WITH_DEBUG_SHADOW_CAPTURE
BOOL cols[1024] = { FALSE };

View File

@@ -47,8 +47,8 @@ static INLINE BOOL shadow_client_rdpgfx_new_surface(rdpShadowClient* client)
UINT error = CHANNEL_RC_OK;
RDPGFX_CREATE_SURFACE_PDU createSurface;
RDPGFX_MAP_SURFACE_TO_OUTPUT_PDU surfaceToOutput;
RdpgfxServerContext* context;
rdpSettings* settings;
RdpgfxServerContext* context = NULL;
rdpSettings* settings = NULL;
WINPR_ASSERT(client);
context = client->rdpgfx;
@@ -89,7 +89,7 @@ static INLINE BOOL shadow_client_rdpgfx_release_surface(rdpShadowClient* client)
{
UINT error = CHANNEL_RC_OK;
RDPGFX_DELETE_SURFACE_PDU pdu;
RdpgfxServerContext* context;
RdpgfxServerContext* context = NULL;
WINPR_ASSERT(client);
@@ -112,8 +112,8 @@ static INLINE BOOL shadow_client_rdpgfx_reset_graphic(rdpShadowClient* client)
{
UINT error = CHANNEL_RC_OK;
RDPGFX_RESET_GRAPHICS_PDU pdu = { 0 };
RdpgfxServerContext* context;
rdpSettings* settings;
RdpgfxServerContext* context = NULL;
rdpSettings* settings = NULL;
WINPR_ASSERT(client);
WINPR_ASSERT(client->rdpgfx);
@@ -155,7 +155,7 @@ static INLINE void shadow_client_free_queued_message(void* obj)
static void shadow_client_context_free(freerdp_peer* peer, rdpContext* context)
{
rdpShadowClient* client = (rdpShadowClient*)context;
rdpShadowServer* server;
rdpShadowServer* server = NULL;
WINPR_UNUSED(peer);
if (!client)
@@ -180,12 +180,12 @@ static void shadow_client_context_free(freerdp_peer* peer, rdpContext* context)
static BOOL shadow_client_context_new(freerdp_peer* peer, rdpContext* context)
{
BOOL NSCodec;
BOOL NSCodec = 0;
const char bind_address[] = "bind-address,";
rdpShadowClient* client = (rdpShadowClient*)context;
rdpSettings* settings;
const rdpSettings* srvSettings;
rdpShadowServer* server;
rdpSettings* settings = NULL;
const rdpSettings* srvSettings = NULL;
rdpShadowServer* server = NULL;
const wObject cb = { NULL, NULL, NULL, shadow_client_free_queued_message, NULL };
WINPR_ASSERT(client);
@@ -276,9 +276,9 @@ fail:
static INLINE void shadow_client_mark_invalid(rdpShadowClient* client, UINT32 numRects,
const RECTANGLE_16* rects)
{
UINT32 index;
UINT32 index = 0;
RECTANGLE_16 screenRegion;
rdpSettings* settings;
rdpSettings* settings = NULL;
WINPR_ASSERT(client);
WINPR_ASSERT(rects || (numRects == 0));
@@ -318,10 +318,10 @@ static INLINE void shadow_client_mark_invalid(rdpShadowClient* client, UINT32 nu
*/
static INLINE BOOL shadow_client_recalc_desktop_size(rdpShadowClient* client)
{
INT32 width;
INT32 height;
rdpShadowServer* server;
rdpSettings* settings;
INT32 width = 0;
INT32 height = 0;
rdpShadowServer* server = NULL;
rdpSettings* settings = NULL;
RECTANGLE_16 viewport = { 0 };
WINPR_ASSERT(client);
@@ -358,8 +358,8 @@ static INLINE BOOL shadow_client_recalc_desktop_size(rdpShadowClient* client)
static BOOL shadow_client_capabilities(freerdp_peer* peer)
{
rdpShadowSubsystem* subsystem;
rdpShadowClient* client;
rdpShadowSubsystem* subsystem = NULL;
rdpShadowClient* client = NULL;
BOOL ret = TRUE;
WINPR_ASSERT(peer);
@@ -387,10 +387,10 @@ static void shadow_reset_desktop_resize(rdpShadowClient* client)
static BOOL shadow_send_desktop_resize(rdpShadowClient* client)
{
BOOL rc;
rdpUpdate* update;
rdpSettings* settings;
const freerdp_peer* peer;
BOOL rc = 0;
rdpUpdate* update = NULL;
rdpSettings* settings = NULL;
const freerdp_peer* peer = NULL;
WINPR_ASSERT(client);
@@ -440,11 +440,11 @@ static BOOL shadow_send_desktop_resize(rdpShadowClient* client)
static BOOL shadow_client_post_connect(freerdp_peer* peer)
{
int authStatus;
rdpSettings* settings;
rdpShadowClient* client;
rdpShadowServer* server;
rdpShadowSubsystem* subsystem;
int authStatus = 0;
rdpSettings* settings = NULL;
rdpShadowClient* client = NULL;
rdpShadowServer* server = NULL;
rdpShadowSubsystem* subsystem = NULL;
WINPR_ASSERT(peer);
@@ -557,7 +557,7 @@ static INLINE void shadow_client_convert_rects(rdpShadowClient* client, RECTANGL
static BOOL shadow_client_refresh_request(rdpShadowClient* client)
{
wMessage message = { 0 };
wMessagePipe* MsgPipe;
wMessagePipe* MsgPipe = NULL;
WINPR_ASSERT(client);
WINPR_ASSERT(client->subsystem);
@@ -576,7 +576,7 @@ static BOOL shadow_client_refresh_request(rdpShadowClient* client)
static BOOL shadow_client_refresh_rect(rdpContext* context, BYTE count, const RECTANGLE_16* areas)
{
rdpShadowClient* client = (rdpShadowClient*)context;
RECTANGLE_16* rects;
RECTANGLE_16* rects = NULL;
/* It is invalid if we have area count but no actual area */
if (count && !areas)
@@ -630,8 +630,8 @@ static BOOL shadow_client_suppress_output(rdpContext* context, BYTE allow, const
static BOOL shadow_client_activate(freerdp_peer* peer)
{
rdpSettings* settings;
rdpShadowClient* client;
rdpSettings* settings = NULL;
rdpShadowClient* client = NULL;
WINPR_ASSERT(peer);
@@ -666,7 +666,7 @@ static BOOL shadow_client_logon(freerdp_peer* peer, const SEC_WINNT_AUTH_IDENTIT
char* user = NULL;
char* domain = NULL;
char* password = NULL;
rdpSettings* settings;
rdpSettings* settings = NULL;
WINPR_UNUSED(automatic);
@@ -754,7 +754,7 @@ static UINT
shadow_client_rdpgfx_frame_acknowledge(RdpgfxServerContext* context,
const RDPGFX_FRAME_ACKNOWLEDGE_PDU* frameAcknowledge)
{
rdpShadowClient* client;
rdpShadowClient* client = NULL;
WINPR_ASSERT(context);
WINPR_ASSERT(frameAcknowledge);
@@ -806,9 +806,9 @@ static BOOL shadow_client_caps_test_version(RdpgfxServerContext* context, rdpSha
BOOL h264, const RDPGFX_CAPSET* capsSets,
UINT32 capsSetCount, UINT32 capsVersion, UINT* rc)
{
UINT32 index;
const rdpSettings* srvSettings;
rdpSettings* clientSettings;
UINT32 index = 0;
const rdpSettings* srvSettings = NULL;
rdpSettings* clientSettings = NULL;
WINPR_ASSERT(context);
WINPR_ASSERT(client);
@@ -831,7 +831,7 @@ static BOOL shadow_client_caps_test_version(RdpgfxServerContext* context, rdpSha
if (currentCaps->version == capsVersion)
{
UINT32 flags;
UINT32 flags = 0;
BOOL planar = FALSE;
BOOL rfx = FALSE;
BOOL avc444v2 = FALSE;
@@ -896,10 +896,10 @@ static BOOL shadow_client_caps_test_version(RdpgfxServerContext* context, rdpSha
static UINT shadow_client_rdpgfx_caps_advertise(RdpgfxServerContext* context,
const RDPGFX_CAPS_ADVERTISE_PDU* capsAdvertise)
{
UINT16 index;
UINT16 index = 0;
UINT rc = ERROR_INTERNAL_ERROR;
const rdpSettings* srvSettings;
rdpSettings* clientSettings;
const rdpSettings* srvSettings = NULL;
rdpSettings* clientSettings = NULL;
BOOL h264 = FALSE;
UINT32 flags = 0;
@@ -1056,11 +1056,11 @@ static BOOL shadow_client_send_surface_gfx(rdpShadowClient* client, const BYTE*
UINT32 nSrcStep, UINT32 SrcFormat, UINT16 nXSrc,
UINT16 nYSrc, UINT16 nWidth, UINT16 nHeight)
{
UINT32 id;
UINT32 id = 0;
UINT error = CHANNEL_RC_OK;
const rdpContext* context = (const rdpContext*)client;
const rdpSettings* settings;
rdpShadowEncoder* encoder;
const rdpSettings* settings = NULL;
rdpShadowEncoder* encoder = NULL;
RDPGFX_SURFACE_COMMAND cmd = { 0 };
RDPGFX_START_FRAME_PDU cmdstart = { 0 };
RDPGFX_END_FRAME_PDU cmdend = { 0 };
@@ -1102,7 +1102,7 @@ static BOOL shadow_client_send_surface_gfx(rdpShadowClient* client, const BYTE*
const BOOL GfxAVC444v2 = freerdp_settings_get_bool(settings, FreeRDP_GfxAVC444v2);
if (GfxAVC444 || GfxAVC444v2)
{
INT32 rc;
INT32 rc = 0;
RDPGFX_AVC444_BITMAP_STREAM avc444 = { 0 };
RECTANGLE_16 regionRect = { 0 };
BYTE version = GfxAVC444v2 ? 2 : 1;
@@ -1152,7 +1152,7 @@ static BOOL shadow_client_send_surface_gfx(rdpShadowClient* client, const BYTE*
}
else if (GfxH264)
{
INT32 rc;
INT32 rc = 0;
RDPGFX_AVC420_BITMAP_STREAM avc420 = { 0 };
RECTANGLE_16 regionRect;
@@ -1199,8 +1199,8 @@ static BOOL shadow_client_send_surface_gfx(rdpShadowClient* client, const BYTE*
#endif
if (freerdp_settings_get_bool(settings, FreeRDP_RemoteFxCodec) && (id != 0))
{
BOOL rc;
wStream* s;
BOOL rc = 0;
wStream* s = NULL;
RFX_RECT rect;
if (shadow_encoder_prepare(encoder, FREERDP_CODEC_REMOTEFX) < 0)
@@ -1253,7 +1253,7 @@ static BOOL shadow_client_send_surface_gfx(rdpShadowClient* client, const BYTE*
}
else if (freerdp_settings_get_bool(settings, FreeRDP_GfxProgressive))
{
INT32 rc;
INT32 rc = 0;
REGION16 region;
RECTANGLE_16 regionRect;
@@ -1299,7 +1299,7 @@ static BOOL shadow_client_send_surface_gfx(rdpShadowClient* client, const BYTE*
}
else if (freerdp_settings_get_bool(settings, FreeRDP_GfxPlanar))
{
BOOL rc;
BOOL rc = 0;
const UINT32 w = cmd.right - cmd.left;
const UINT32 h = cmd.bottom - cmd.top;
const BYTE* src =
@@ -1331,7 +1331,7 @@ static BOOL shadow_client_send_surface_gfx(rdpShadowClient* client, const BYTE*
}
else
{
BOOL rc;
BOOL rc = 0;
const UINT32 w = cmd.right - cmd.left;
const UINT32 h = cmd.bottom - cmd.top;
const UINT32 length = w * 4 * h;
@@ -1369,18 +1369,18 @@ static BOOL shadow_client_send_surface_bits(rdpShadowClient* client, BYTE* pSrcD
UINT16 nWidth, UINT16 nHeight)
{
BOOL ret = TRUE;
BOOL first;
BOOL last;
wStream* s;
size_t numMessages;
BOOL first = 0;
BOOL last = 0;
wStream* s = NULL;
size_t numMessages = 0;
UINT32 frameId = 0;
rdpUpdate* update;
rdpUpdate* update = NULL;
rdpContext* context = (rdpContext*)client;
rdpSettings* settings;
rdpShadowEncoder* encoder;
rdpSettings* settings = NULL;
rdpShadowEncoder* encoder = NULL;
SURFACE_BITS_COMMAND cmd = { 0 };
UINT32 nsID;
UINT32 rfxID;
UINT32 nsID = 0;
UINT32 rfxID = 0;
if (!context || !pSrcData)
return FALSE;
@@ -1527,24 +1527,24 @@ static BOOL shadow_client_send_bitmap_update(rdpShadowClient* client, BYTE* pSrc
UINT16 nWidth, UINT16 nHeight)
{
BOOL ret = TRUE;
BYTE* data;
BYTE* buffer;
UINT32 k;
UINT32 yIdx;
UINT32 xIdx;
UINT32 rows;
UINT32 cols;
UINT32 DstSize;
UINT32 SrcFormat;
BITMAP_DATA* bitmap;
rdpUpdate* update;
BYTE* data = NULL;
BYTE* buffer = NULL;
UINT32 k = 0;
UINT32 yIdx = 0;
UINT32 xIdx = 0;
UINT32 rows = 0;
UINT32 cols = 0;
UINT32 DstSize = 0;
UINT32 SrcFormat = 0;
BITMAP_DATA* bitmap = NULL;
rdpUpdate* update = NULL;
rdpContext* context = (rdpContext*)client;
rdpSettings* settings;
UINT32 totalBitmapSize;
UINT32 updateSizeEstimate;
BITMAP_DATA* bitmapData;
rdpSettings* settings = NULL;
UINT32 totalBitmapSize = 0;
UINT32 updateSizeEstimate = 0;
BITMAP_DATA* bitmapData = NULL;
BITMAP_UPDATE bitmapUpdate;
rdpShadowEncoder* encoder;
rdpShadowEncoder* encoder = NULL;
if (!context || !pSrcData)
return FALSE;
@@ -1650,7 +1650,7 @@ static BOOL shadow_client_send_bitmap_update(rdpShadowClient* client, BYTE* pSrc
}
else
{
UINT32 dstSize;
UINT32 dstSize = 0;
buffer = encoder->grid[k];
data = &pSrcData[(bitmap->destTop * nSrcStep) + (bitmap->destLeft * 4)];
@@ -1676,10 +1676,10 @@ static BOOL shadow_client_send_bitmap_update(rdpShadowClient* client, BYTE* pSrc
if (updateSizeEstimate > maxUpdateSize)
{
UINT32 i;
UINT32 j;
UINT32 updateSize;
UINT32 newUpdateSize;
UINT32 i = 0;
UINT32 j = 0;
UINT32 updateSize = 0;
UINT32 newUpdateSize = 0;
BITMAP_DATA* fragBitmapData = NULL;
if (k > 0)
@@ -1747,23 +1747,23 @@ out:
static BOOL shadow_client_send_surface_update(rdpShadowClient* client, SHADOW_GFX_STATUS* pStatus)
{
BOOL ret = TRUE;
INT64 nXSrc;
INT64 nYSrc;
INT64 nWidth;
INT64 nHeight;
INT64 nXSrc = 0;
INT64 nYSrc = 0;
INT64 nWidth = 0;
INT64 nHeight = 0;
rdpContext* context = (rdpContext*)client;
rdpSettings* settings;
rdpShadowServer* server;
rdpShadowSurface* surface;
rdpSettings* settings = NULL;
rdpShadowServer* server = NULL;
rdpShadowSurface* surface = NULL;
REGION16 invalidRegion;
RECTANGLE_16 surfaceRect;
const RECTANGLE_16* extents;
BYTE* pSrcData;
UINT32 nSrcStep;
UINT32 SrcFormat;
UINT32 index;
const RECTANGLE_16* extents = NULL;
BYTE* pSrcData = NULL;
UINT32 nSrcStep = 0;
UINT32 SrcFormat = 0;
UINT32 index = 0;
UINT32 numRects = 0;
const RECTANGLE_16* rects;
const RECTANGLE_16* rects = NULL;
if (!context || !pStatus)
return FALSE;
@@ -1822,8 +1822,8 @@ static BOOL shadow_client_send_surface_update(rdpShadowClient* client, SHADOW_GF
/* Move to new pSrcData / nXSrc / nYSrc according to sub rect */
if (server->shareSubRect)
{
INT32 subX;
INT32 subY;
INT32 subX = 0;
INT32 subY = 0;
subX = server->subRect.left;
subY = server->subRect.top;
nXSrc -= subX;
@@ -1916,8 +1916,8 @@ out:
static BOOL shadow_client_send_resize(rdpShadowClient* client, SHADOW_GFX_STATUS* pStatus)
{
rdpContext* context = (rdpContext*)client;
rdpSettings* settings;
freerdp_peer* peer;
rdpSettings* settings = NULL;
freerdp_peer* peer = NULL;
if (!context || !pStatus)
return FALSE;
@@ -1965,7 +1965,7 @@ static BOOL shadow_client_send_resize(rdpShadowClient* client, SHADOW_GFX_STATUS
static BOOL shadow_client_surface_update(rdpShadowClient* client, REGION16* region)
{
UINT32 numRects = 0;
const RECTANGLE_16* rects;
const RECTANGLE_16* rects = NULL;
rects = region16_rects(region, &numRects);
shadow_client_mark_invalid(client, numRects, rects);
return TRUE;
@@ -1980,8 +1980,8 @@ static BOOL shadow_client_surface_update(rdpShadowClient* client, REGION16* regi
static INLINE BOOL shadow_client_no_surface_update(rdpShadowClient* client,
SHADOW_GFX_STATUS* pStatus)
{
rdpShadowServer* server;
rdpShadowSurface* surface;
rdpShadowServer* server = NULL;
rdpShadowSurface* surface = NULL;
WINPR_UNUSED(pStatus);
WINPR_ASSERT(client);
server = client->server;
@@ -1993,7 +1993,7 @@ static INLINE BOOL shadow_client_no_surface_update(rdpShadowClient* client,
static int shadow_client_subsystem_process_message(rdpShadowClient* client, wMessage* message)
{
rdpContext* context = (rdpContext*)client;
rdpUpdate* update;
rdpUpdate* update = NULL;
WINPR_ASSERT(message);
WINPR_ASSERT(context);
@@ -2463,8 +2463,8 @@ out:
BOOL shadow_client_accepted(freerdp_listener* listener, freerdp_peer* peer)
{
rdpShadowClient* client;
rdpShadowServer* server;
rdpShadowClient* client = NULL;
rdpShadowServer* server = NULL;
if (!listener || !peer)
return FALSE;
@@ -2500,7 +2500,7 @@ BOOL shadow_client_accepted(freerdp_listener* listener, freerdp_peer* peer)
static void shadow_msg_out_addref(wMessage* message)
{
SHADOW_MSG_OUT* msg;
SHADOW_MSG_OUT* msg = NULL;
WINPR_ASSERT(message);
msg = (SHADOW_MSG_OUT*)message->wParam;
@@ -2511,7 +2511,7 @@ static void shadow_msg_out_addref(wMessage* message)
static void shadow_msg_out_release(wMessage* message)
{
SHADOW_MSG_OUT* msg;
SHADOW_MSG_OUT* msg = NULL;
WINPR_ASSERT(message);
msg = (SHADOW_MSG_OUT*)message->wParam;

View File

@@ -51,7 +51,7 @@ UINT32 shadow_encoder_inflight_frames(rdpShadowEncoder* encoder)
UINT32 shadow_encoder_create_frame_id(rdpShadowEncoder* encoder)
{
UINT32 frameId;
UINT32 frameId = 0;
UINT32 inFlightFrames = shadow_encoder_inflight_frames(encoder);
/*
@@ -80,11 +80,11 @@ UINT32 shadow_encoder_create_frame_id(rdpShadowEncoder* encoder)
static int shadow_encoder_init_grid(rdpShadowEncoder* encoder)
{
UINT32 i;
UINT32 j;
UINT32 k;
UINT32 tileSize;
UINT32 tileCount;
UINT32 i = 0;
UINT32 j = 0;
UINT32 k = 0;
UINT32 tileSize = 0;
UINT32 tileCount = 0;
encoder->gridWidth = ((encoder->width + (encoder->maxTileWidth - 1)) / encoder->maxTileWidth);
encoder->gridHeight =
((encoder->height + (encoder->maxTileHeight - 1)) / encoder->maxTileHeight);
@@ -401,7 +401,7 @@ static int shadow_encoder_uninit(rdpShadowEncoder* encoder)
int shadow_encoder_reset(rdpShadowEncoder* encoder)
{
int status;
int status = 0;
UINT32 codecs = encoder->codecs;
rdpContext* context = (rdpContext*)encoder->client;
rdpSettings* settings = context->settings;
@@ -430,7 +430,7 @@ int shadow_encoder_reset(rdpShadowEncoder* encoder)
int shadow_encoder_prepare(rdpShadowEncoder* encoder, UINT32 codecs)
{
int status;
int status = 0;
if ((codecs & FREERDP_CODEC_REMOTEFX) && !(encoder->codecs & FREERDP_CODEC_REMOTEFX))
{
@@ -492,7 +492,7 @@ int shadow_encoder_prepare(rdpShadowEncoder* encoder, UINT32 codecs)
rdpShadowEncoder* shadow_encoder_new(rdpShadowClient* client)
{
rdpShadowEncoder* encoder;
rdpShadowEncoder* encoder = NULL;
rdpShadowServer* server = client->server;
encoder = (rdpShadowEncoder*)calloc(1, sizeof(rdpShadowEncoder));

View File

@@ -36,9 +36,9 @@ static UINT
encomsp_change_participant_control_level(EncomspServerContext* context,
ENCOMSP_CHANGE_PARTICIPANT_CONTROL_LEVEL_PDU* pdu)
{
BOOL inLobby;
BOOL mayView;
BOOL mayInteract;
BOOL inLobby = 0;
BOOL mayView = 0;
BOOL mayInteract = 0;
rdpShadowClient* client = (rdpShadowClient*)context->custom;
WLog_INFO(TAG,
@@ -102,7 +102,7 @@ encomsp_change_participant_control_level(EncomspServerContext* context,
int shadow_client_encomsp_init(rdpShadowClient* client)
{
EncomspServerContext* encomsp;
EncomspServerContext* encomsp = NULL;
encomsp = client->encomsp = encomsp_server_context_new(client->vcm);

View File

@@ -27,10 +27,10 @@
BOOL shadow_client_init_lobby(rdpShadowServer* server)
{
int width;
int height;
rdtkEngine* engine;
rdtkSurface* surface;
int width = 0;
int height = 0;
rdtkEngine* engine = NULL;
rdtkSurface* surface = NULL;
RECTANGLE_16 invalidRect;
rdpShadowSurface* lobby = server->lobby;

View File

@@ -108,9 +108,9 @@ void shadow_multiclient_free(rdpShadowMultiClientEvent* event)
static void _Publish(rdpShadowMultiClientEvent* event)
{
wArrayList* subscribers;
wArrayList* subscribers = NULL;
struct rdp_shadow_multiclient_subscriber* subscriber = NULL;
size_t i;
size_t i = 0;
subscribers = event->subscribers;
@@ -253,7 +253,7 @@ static BOOL _Consume(struct rdp_shadow_multiclient_subscriber* subscriber, BOOL
void* shadow_multiclient_get_subscriber(rdpShadowMultiClientEvent* event)
{
struct rdp_shadow_multiclient_subscriber* subscriber;
struct rdp_shadow_multiclient_subscriber* subscriber = NULL;
if (!event)
return NULL;
@@ -296,8 +296,8 @@ out_error:
*/
void shadow_multiclient_release_subscriber(void* subscriber)
{
struct rdp_shadow_multiclient_subscriber* s;
rdpShadowMultiClientEvent* event;
struct rdp_shadow_multiclient_subscriber* s = NULL;
rdpShadowMultiClientEvent* event = NULL;
if (!subscriber)
return;
@@ -324,8 +324,8 @@ void shadow_multiclient_release_subscriber(void* subscriber)
BOOL shadow_multiclient_consume(void* subscriber)
{
struct rdp_shadow_multiclient_subscriber* s;
rdpShadowMultiClientEvent* event;
struct rdp_shadow_multiclient_subscriber* s = NULL;
rdpShadowMultiClientEvent* event = NULL;
BOOL ret = FALSE;
if (!subscriber)

View File

@@ -48,7 +48,7 @@ static void rdpsnd_activated(RdpsndServerContext* context)
int shadow_client_rdpsnd_init(rdpShadowClient* client)
{
RdpsndServerContext* rdpsnd;
RdpsndServerContext* rdpsnd = NULL;
rdpsnd = client->rdpsnd = rdpsnd_server_context_new(client->vcm);
if (!rdpsnd)

View File

@@ -26,7 +26,7 @@
int shadow_client_remdesk_init(rdpShadowClient* client)
{
RemdeskServerContext* remdesk;
RemdeskServerContext* remdesk = NULL;
remdesk = client->remdesk = remdesk_server_context_new(client->vcm);
remdesk->rdpcontext = &client->context;

View File

@@ -119,12 +119,12 @@ void shadow_screen_free(rdpShadowScreen* screen)
BOOL shadow_screen_resize(rdpShadowScreen* screen)
{
int x;
int y;
int width;
int height;
MONITOR_DEF* primary;
rdpShadowSubsystem* subsystem;
int x = 0;
int y = 0;
int width = 0;
int height = 0;
MONITOR_DEF* primary = NULL;
rdpShadowSubsystem* subsystem = NULL;
if (!screen)
return FALSE;

View File

@@ -47,9 +47,9 @@ static const char bind_address[] = "bind-address,";
static int shadow_server_print_command_line_help(int argc, char** argv,
COMMAND_LINE_ARGUMENT_A* largs)
{
char* str;
size_t length;
const COMMAND_LINE_ARGUMENT_A* arg;
char* str = NULL;
size_t length = 0;
const COMMAND_LINE_ARGUMENT_A* arg = NULL;
if ((argc < 1) || !largs || !argv)
return -1;
@@ -146,9 +146,9 @@ int shadow_server_command_line_status_print(rdpShadowServer* server, int argc, c
int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** argv,
COMMAND_LINE_ARGUMENT_A* cargs)
{
int status;
DWORD flags;
const COMMAND_LINE_ARGUMENT_A* arg;
int status = 0;
DWORD flags = 0;
const COMMAND_LINE_ARGUMENT_A* arg = NULL;
rdpSettings* settings = server->settings;
if ((argc < 2) || !argv || !cargs)
@@ -191,7 +191,7 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
}
CommandLineSwitchCase(arg, "bind-address")
{
int rc;
int rc = 0;
size_t len = strlen(arg->Value) + sizeof(bind_address);
/* /ipc-socket is incompatible */
if (server->ipcSocket)
@@ -224,7 +224,7 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
}
CommandLineSwitchCase(arg, "rect")
{
char* p;
char* p = NULL;
char* tok[4];
long x = -1;
long y = -1;
@@ -459,8 +459,8 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
if (arg && (arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT))
{
UINT32 index;
UINT32 numMonitors;
UINT32 index = 0;
UINT32 numMonitors = 0;
MONITOR_DEF monitors[16] = { 0 };
numMonitors = shadow_enum_monitors(monitors, 16);
@@ -507,7 +507,7 @@ static DWORD WINAPI shadow_server_thread(LPVOID arg)
{
rdpShadowServer* server = (rdpShadowServer*)arg;
BOOL running = TRUE;
DWORD status;
DWORD status = 0;
freerdp_listener* listener = server->listener;
shadow_subsystem_start(server->subsystem);
@@ -570,7 +570,7 @@ static DWORD WINAPI shadow_server_thread(LPVOID arg)
static BOOL open_port(rdpShadowServer* server, char* address)
{
BOOL status;
BOOL status = 0;
char* modaddr = address;
if (modaddr)
@@ -605,8 +605,8 @@ static BOOL open_port(rdpShadowServer* server, char* address)
int shadow_server_start(rdpShadowServer* server)
{
BOOL ipc;
BOOL status;
BOOL ipc = 0;
BOOL status = 0;
WSADATA wsaData;
if (!server)
@@ -644,8 +644,8 @@ int shadow_server_start(rdpShadowServer* server)
strnlen(bind_address, sizeof(bind_address))) != 0);
if (!ipc)
{
size_t x;
size_t count;
size_t x = 0;
size_t count = 0;
char** list = CommandLineParseCommaSeparatedValuesEx(NULL, server->ipcSocket, &count);
if (!list || (count <= 1))
{
@@ -777,7 +777,7 @@ static int shadow_server_init_config_path(rdpShadowServer* server)
if (!server->ConfigPath)
{
char* configHome;
char* configHome = NULL;
configHome = GetKnownPath(KNOWN_PATH_XDG_CONFIG_HOME);
if (configHome)
@@ -924,7 +924,7 @@ static BOOL shadow_server_check_peer_restrictions(freerdp_listener* listener)
int shadow_server_init(rdpShadowServer* server)
{
int status;
int status = 0;
winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT);
WTSRegisterWtsApiFunctionTable(FreeRDP_InitWtsApi());
@@ -997,7 +997,7 @@ int shadow_server_uninit(rdpShadowServer* server)
rdpShadowServer* shadow_server_new(void)
{
rdpShadowServer* server;
rdpShadowServer* server = NULL;
server = (rdpShadowServer*)calloc(1, sizeof(rdpShadowServer));
if (!server)

View File

@@ -124,8 +124,8 @@ void shadow_subsystem_uninit(rdpShadowSubsystem* subsystem)
if (subsystem->MsgPipe)
{
wObject* obj1;
wObject* obj2;
wObject* obj1 = NULL;
wObject* obj2 = NULL;
/* Release resource in messages before free */
obj1 = MessageQueue_Object(subsystem->MsgPipe->In);
@@ -148,7 +148,7 @@ void shadow_subsystem_uninit(rdpShadowSubsystem* subsystem)
int shadow_subsystem_start(rdpShadowSubsystem* subsystem)
{
int status;
int status = 0;
if (!subsystem || !subsystem->ep.Start)
return -1;
@@ -160,7 +160,7 @@ int shadow_subsystem_start(rdpShadowSubsystem* subsystem)
int shadow_subsystem_stop(rdpShadowSubsystem* subsystem)
{
int status;
int status = 0;
if (!subsystem || !subsystem->ep.Stop)
return -1;
@@ -193,19 +193,19 @@ int shadow_subsystem_pointer_convert_alpha_pointer_data(
BYTE* pixels, BOOL premultiplied, UINT32 width, UINT32 height,
SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE* pointerColor)
{
UINT32 x;
UINT32 y;
BYTE* pSrc8;
BYTE* pDst8;
UINT32 xorStep;
UINT32 andStep;
UINT32 andBit;
BYTE* andBits;
UINT32 andPixel;
BYTE A;
BYTE R;
BYTE G;
BYTE B;
UINT32 x = 0;
UINT32 y = 0;
BYTE* pSrc8 = NULL;
BYTE* pDst8 = NULL;
UINT32 xorStep = 0;
UINT32 andStep = 0;
UINT32 andBit = 0;
BYTE* andBits = NULL;
UINT32 andPixel = 0;
BYTE A = 0;
BYTE R = 0;
BYTE G = 0;
BYTE B = 0;
xorStep = (width * 3);
xorStep += (xorStep % 2);

View File

@@ -27,7 +27,7 @@
rdpShadowSurface* shadow_surface_new(rdpShadowServer* server, UINT16 x, UINT16 y, UINT32 width,
UINT32 height)
{
rdpShadowSurface* surface;
rdpShadowSurface* surface = NULL;
surface = (rdpShadowSurface*)calloc(1, sizeof(rdpShadowSurface));
if (!surface)