[tidy] move loop variable declaration to loop

This commit is contained in:
akallabeth 2024-01-30 10:25:38 +01:00 committed by akallabeth
parent 62f974a5c2
commit d7ebec5a65
345 changed files with 1568 additions and 2828 deletions

View File

@ -222,7 +222,6 @@ static UINT audin_ios_open(IAudinDevice *device, AudinReceive receive, void *use
DWORD errCode;
char errString[1024];
OSStatus devStat;
size_t index;
ios->receive = receive;
ios->user_data = user_data;
@ -237,7 +236,7 @@ static UINT audin_ios_open(IAudinDevice *device, AudinReceive receive, void *use
goto err_out;
}
for (index = 0; index < IOS_AUDIO_QUEUE_NUM_BUFFERS; index++)
for (size_t index = 0; index < IOS_AUDIO_QUEUE_NUM_BUFFERS; index++)
{
devStat = AudioQueueAllocateBuffer(ios->audioQueue,
ios->FramesPerPacket * 2 * ios->format.nChannels,

View File

@ -247,7 +247,6 @@ static UINT audin_mac_open(IAudinDevice *device, AudinReceive receive, void *use
DWORD errCode;
char errString[1024];
OSStatus devStat;
size_t index;
if (!mac->isAuthorized)
return ERROR_INTERNAL_ERROR;
@ -265,7 +264,7 @@ static UINT audin_mac_open(IAudinDevice *device, AudinReceive receive, void *use
goto err_out;
}
for (index = 0; index < MAC_AUDIO_QUEUE_NUM_BUFFERS; index++)
for (size_t index = 0; index < MAC_AUDIO_QUEUE_NUM_BUFFERS; index++)
{
devStat = AudioQueueAllocateBuffer(mac->audioQueue,
mac->FramesPerPacket * 2 * mac->format.nChannels,

View File

@ -168,11 +168,11 @@ static BOOL test_format_supported(const PWAVEFORMATEX pwfx)
static DWORD WINAPI audin_winmm_thread_func(LPVOID arg)
{
AudinWinmmDevice* winmm = (AudinWinmmDevice*)arg;
char* buffer;
int size, i;
char* buffer = NULL;
int size = 0;
WAVEHDR waveHdr[4] = { 0 };
DWORD status;
MMRESULT rc;
DWORD status = 0;
MMRESULT rc = 0;
if (!winmm->hWaveIn)
{
@ -189,7 +189,7 @@ static DWORD WINAPI audin_winmm_thread_func(LPVOID arg)
7) /
8;
for (i = 0; i < 4; i++)
for (int i = 0; i < 4; i++)
{
buffer = (char*)malloc(size);
@ -235,7 +235,7 @@ static DWORD WINAPI audin_winmm_thread_func(LPVOID arg)
{
}
for (i = 0; i < 4; i++)
for (int i = 0; i < 4; i++)
{
rc = waveInUnprepareHeader(winmm->hWaveIn, &waveHdr[i], sizeof(waveHdr[i]));
@ -263,13 +263,12 @@ static DWORD WINAPI audin_winmm_thread_func(LPVOID arg)
*/
static UINT audin_winmm_free(IAudinDevice* device)
{
UINT32 i;
AudinWinmmDevice* winmm = (AudinWinmmDevice*)device;
if (!winmm)
return ERROR_INVALID_PARAMETER;
for (i = 0; i < winmm->cFormats; i++)
for (UINT32 i = 0; i < winmm->cFormats; i++)
{
free(winmm->ppwfx[i]);
}
@ -322,7 +321,6 @@ static UINT audin_winmm_close(IAudinDevice* device)
static UINT audin_winmm_set_format(IAudinDevice* device, const AUDIO_FORMAT* format,
UINT32 FramesPerPacket)
{
UINT32 i;
AudinWinmmDevice* winmm = (AudinWinmmDevice*)device;
if (!winmm || !format)
@ -330,7 +328,7 @@ static UINT audin_winmm_set_format(IAudinDevice* device, const AUDIO_FORMAT* for
winmm->frames_per_packet = FramesPerPacket;
for (i = 0; i < winmm->cFormats; i++)
for (UINT32 i = 0; i < winmm->cFormats; i++)
{
const PWAVEFORMATEX ppwfx = winmm->ppwfx[i];
if ((ppwfx->wFormatTag == format->wFormatTag) && (ppwfx->nChannels == format->nChannels) &&

View File

@ -87,8 +87,6 @@ static FREERDP_ADDIN** freerdp_channels_list_client_static_addins(LPCSTR pszName
LPCSTR pszSubsystem,
LPCSTR pszType, DWORD dwFlags)
{
size_t i = 0;
size_t j = 0;
DWORD nAddins = 0;
FREERDP_ADDIN** ppAddins = NULL;
const STATIC_SUBSYSTEM_ENTRY* subsystems = NULL;
@ -103,7 +101,7 @@ static FREERDP_ADDIN** freerdp_channels_list_client_static_addins(LPCSTR pszName
ppAddins[nAddins] = NULL;
for (i = 0; CLIENT_STATIC_ADDIN_TABLE[i].name != NULL; i++)
for (size_t i = 0; CLIENT_STATIC_ADDIN_TABLE[i].name != NULL; i++)
{
FREERDP_ADDIN* pAddin = (FREERDP_ADDIN*)calloc(1, sizeof(FREERDP_ADDIN));
@ -120,7 +118,7 @@ static FREERDP_ADDIN** freerdp_channels_list_client_static_addins(LPCSTR pszName
ppAddins[nAddins++] = pAddin;
subsystems = (const STATIC_SUBSYSTEM_ENTRY*)CLIENT_STATIC_ADDIN_TABLE[i].table;
for (j = 0; subsystems[j].name != NULL; j++)
for (size_t j = 0; subsystems[j].name != NULL; j++)
{
pAddin = (FREERDP_ADDIN*)calloc(1, sizeof(FREERDP_ADDIN));
@ -165,7 +163,6 @@ static HANDLE FindFirstFileUTF8(LPCSTR pszSearchPath, WIN32_FIND_DATAW* FindData
static FREERDP_ADDIN** freerdp_channels_list_dynamic_addins(LPCSTR pszName, LPCSTR pszSubsystem,
LPCSTR pszType, DWORD dwFlags)
{
int index = 0;
int nDashes = 0;
HANDLE hFind = NULL;
DWORD nAddins = 0;
@ -270,7 +267,7 @@ static FREERDP_ADDIN** freerdp_channels_list_dynamic_addins(LPCSTR pszName, LPCS
goto skip;
nDashes = 0;
for (index = 0; cFileName[index]; index++)
for (size_t index = 0; cFileName[index]; index++)
nDashes += (cFileName[index] == '-') ? 1 : 0;
if (nDashes == 1)
@ -428,12 +425,10 @@ FREERDP_ADDIN** freerdp_channels_list_addins(LPCSTR pszName, LPCSTR pszSubsystem
void freerdp_channels_addin_list_free(FREERDP_ADDIN** ppAddins)
{
size_t index = 0;
if (!ppAddins)
return;
for (index = 0; ppAddins[index] != NULL; index++)
for (size_t index = 0; ppAddins[index] != NULL; index++)
free(ppAddins[index]);
free(ppAddins);
@ -443,9 +438,7 @@ extern const STATIC_ENTRY CLIENT_VirtualChannelEntryEx_TABLE[];
static BOOL freerdp_channels_is_virtual_channel_entry_ex(LPCSTR pszName)
{
size_t i = 0;
for (i = 0; CLIENT_VirtualChannelEntryEx_TABLE[i].name != NULL; i++)
for (size_t i = 0; CLIENT_VirtualChannelEntryEx_TABLE[i].name != NULL; i++)
{
const STATIC_ENTRY* entry = &CLIENT_VirtualChannelEntryEx_TABLE[i];

View File

@ -223,7 +223,6 @@ static UINT cliprdr_process_general_capability(cliprdrPlugin* cliprdr, wStream*
static UINT cliprdr_process_clip_caps(cliprdrPlugin* cliprdr, wStream* s, UINT32 length,
UINT16 flags)
{
UINT16 index = 0;
UINT16 lengthCapability = 0;
UINT16 cCapabilitiesSets = 0;
UINT16 capabilitySetType = 0;
@ -239,7 +238,7 @@ static UINT cliprdr_process_clip_caps(cliprdrPlugin* cliprdr, wStream* s, UINT32
Stream_Seek_UINT16(s); /* pad1 (2 bytes) */
WLog_Print(cliprdr->log, WLOG_DEBUG, "ServerCapabilities");
for (index = 0; index < cCapabilitiesSets; index++)
for (UINT16 index = 0; index < cCapabilitiesSets; index++)
{
if (!Stream_CheckAndLogRequiredLength(TAG, s, 4))
return ERROR_INVALID_DATA;

View File

@ -184,7 +184,6 @@ wStream* cliprdr_packet_format_list_new(const CLIPRDR_FORMAT_LIST* formatList,
BOOL useLongFormatNames)
{
wStream* s = NULL;
UINT32 index = 0;
size_t formatNameSize = 0;
char* szFormatName = NULL;
WCHAR* wszFormatName = NULL;
@ -206,7 +205,7 @@ wStream* cliprdr_packet_format_list_new(const CLIPRDR_FORMAT_LIST* formatList,
return NULL;
}
for (index = 0; index < formatList->numFormats; index++)
for (UINT32 index = 0; index < formatList->numFormats; index++)
{
size_t formatNameLength = 0;
format = (CLIPRDR_FORMAT*)&(formatList->formats[index]);
@ -259,7 +258,7 @@ wStream* cliprdr_packet_format_list_new(const CLIPRDR_FORMAT_LIST* formatList,
else
{
length = 0;
for (index = 0; index < formatList->numFormats; index++)
for (UINT32 index = 0; index < formatList->numFormats; index++)
{
format = (CLIPRDR_FORMAT*)&(formatList->formats[index]);
length += 4;
@ -284,7 +283,7 @@ wStream* cliprdr_packet_format_list_new(const CLIPRDR_FORMAT_LIST* formatList,
return NULL;
}
for (index = 0; index < formatList->numFormats; index++)
for (UINT32 index = 0; index < formatList->numFormats; index++)
{
format = (CLIPRDR_FORMAT*)&(formatList->formats[index]);
Stream_Write_UINT32(s, format->formatId); /* formatId (4 bytes) */
@ -550,14 +549,12 @@ error_out:
void cliprdr_free_format_list(CLIPRDR_FORMAT_LIST* formatList)
{
UINT index = 0;
if (formatList == NULL)
return;
if (formatList->formats)
{
for (index = 0; index < formatList->numFormats; index++)
for (UINT32 index = 0; index < formatList->numFormats; index++)
{
free(formatList->formats[index].formatName);
}

View File

@ -119,14 +119,12 @@ static UINT cliprdr_server_capabilities(CliprdrServerContext* context,
const CLIPRDR_CAPABILITIES* capabilities)
{
size_t offset = 0;
UINT32 x = 0;
wStream* s = NULL;
CliprdrServerPrivate* cliprdr = NULL;
WINPR_ASSERT(context);
WINPR_ASSERT(capabilities);
cliprdr = (CliprdrServerPrivate*)context->handle;
CliprdrServerPrivate* cliprdr = (CliprdrServerPrivate*)context->handle;
if (capabilities->common.msgType != CB_CLIP_CAPS)
WLog_WARN(TAG, "called with invalid type %08" PRIx32, capabilities->common.msgType);
@ -148,7 +146,7 @@ static UINT cliprdr_server_capabilities(CliprdrServerContext* context,
Stream_Write_UINT16(s,
(UINT16)capabilities->cCapabilitiesSets); /* cCapabilitiesSets (2 bytes) */
Stream_Write_UINT16(s, 0); /* pad1 (2 bytes) */
for (x = 0; x < capabilities->cCapabilitiesSets; x++)
for (UINT32 x = 0; x < capabilities->cCapabilitiesSets; x++)
{
const CLIPRDR_CAPABILITY_SET* cap =
(const CLIPRDR_CAPABILITY_SET*)(((const BYTE*)capabilities->capabilitySets) + offset);

View File

@ -63,7 +63,6 @@ disp_send_display_control_monitor_layout_pdu(GENERIC_CHANNEL_CALLBACK* callback,
{
UINT status = 0;
wStream* s = NULL;
UINT32 index = 0;
DISP_PLUGIN* disp = NULL;
UINT32 MonitorLayoutSize = 0;
DISPLAY_CONTROL_HEADER header = { 0 };
@ -99,7 +98,7 @@ disp_send_display_control_monitor_layout_pdu(GENERIC_CHANNEL_CALLBACK* callback,
Stream_Write_UINT32(s, NumMonitors); /* NumMonitors (4 bytes) */
WLog_DBG(TAG, "NumMonitors=%" PRIu32 "", NumMonitors);
for (index = 0; index < NumMonitors; index++)
for (UINT32 index = 0; index < NumMonitors; index++)
{
DISPLAY_CONTROL_MONITOR_LAYOUT current = Monitors[index];
current.Width -= (current.Width % 2);

View File

@ -127,7 +127,6 @@ static BOOL disp_server_is_monitor_layout_valid(const DISPLAY_CONTROL_MONITOR_LA
static UINT disp_recv_display_control_monitor_layout_pdu(wStream* s, DispServerContext* context)
{
UINT32 error = CHANNEL_RC_OK;
UINT32 index = 0;
DISPLAY_CONTROL_MONITOR_LAYOUT_PDU pdu = { 0 };
WINPR_ASSERT(s);
@ -170,7 +169,7 @@ static UINT disp_recv_display_control_monitor_layout_pdu(wStream* s, DispServerC
WLog_DBG(TAG, "disp_recv_display_control_monitor_layout_pdu: NumMonitors=%" PRIu32 "",
pdu.NumMonitors);
for (index = 0; index < pdu.NumMonitors; index++)
for (UINT32 index = 0; index < pdu.NumMonitors; index++)
{
DISPLAY_CONTROL_MONITOR_LAYOUT* monitor = &(pdu.Monitors[index]);

View File

@ -152,7 +152,6 @@ static UINT dvcman_register_plugin(IDRDYNVC_ENTRY_POINTS* pEntryPoints, const ch
static IWTSPlugin* dvcman_get_plugin(IDRDYNVC_ENTRY_POINTS* pEntryPoints, const char* name)
{
IWTSPlugin* plugin = NULL;
size_t i = 0;
size_t nc = 0;
size_t pc = 0;
WINPR_ASSERT(pEntryPoints);
@ -167,7 +166,7 @@ static IWTSPlugin* dvcman_get_plugin(IDRDYNVC_ENTRY_POINTS* pEntryPoints, const
ArrayList_Lock(dvcman->plugin_names);
ArrayList_Lock(dvcman->plugins);
for (i = 0; i < pc; i++)
for (size_t i = 0; i < pc; i++)
{
const char* cur = ArrayList_GetItem(dvcman->plugin_names, i);
if (strcmp(cur, name) == 0)
@ -579,13 +578,12 @@ static void dvcman_free(drdynvcPlugin* drdynvc, IWTSVirtualChannelManager* pChan
*/
static UINT dvcman_init(drdynvcPlugin* drdynvc, IWTSVirtualChannelManager* pChannelMgr)
{
size_t i = 0;
DVCMAN* dvcman = (DVCMAN*)pChannelMgr;
UINT error = CHANNEL_RC_OK;
WINPR_ASSERT(dvcman);
ArrayList_Lock(dvcman->plugins);
for (i = 0; i < ArrayList_Count(dvcman->plugins); i++)
for (size_t i = 0; i < ArrayList_Count(dvcman->plugins); i++)
{
IWTSPlugin* pPlugin = ArrayList_GetItem(dvcman->plugins, i);
@ -1672,7 +1670,6 @@ static UINT drdynvc_virtual_channel_event_connected(drdynvcPlugin* drdynvc, LPVO
{
UINT error = 0;
UINT32 status = 0;
UINT32 index = 0;
rdpSettings* settings = NULL;
WINPR_ASSERT(drdynvc);
@ -1698,8 +1695,8 @@ static UINT drdynvc_virtual_channel_event_connected(drdynvcPlugin* drdynvc, LPVO
settings = drdynvc->rdpcontext->settings;
WINPR_ASSERT(settings);
for (index = 0; index < freerdp_settings_get_uint32(settings, FreeRDP_DynamicChannelCount);
index++)
for (UINT32 index = 0;
index < freerdp_settings_get_uint32(settings, FreeRDP_DynamicChannelCount); index++)
{
const ADDIN_ARGV* args =
freerdp_settings_get_pointer_array(settings, FreeRDP_DynamicChannelArray, index);
@ -1834,7 +1831,6 @@ static UINT drdynvc_virtual_channel_event_terminated(drdynvcPlugin* drdynvc)
static UINT drdynvc_virtual_channel_event_attached(drdynvcPlugin* drdynvc)
{
UINT error = CHANNEL_RC_OK;
size_t i = 0;
DVCMAN* dvcman = NULL;
if (!drdynvc)
@ -1846,7 +1842,7 @@ static UINT drdynvc_virtual_channel_event_attached(drdynvcPlugin* drdynvc)
return CHANNEL_RC_BAD_CHANNEL_HANDLE;
ArrayList_Lock(dvcman->plugins);
for (i = 0; i < ArrayList_Count(dvcman->plugins); i++)
for (size_t i = 0; i < ArrayList_Count(dvcman->plugins); i++)
{
IWTSPlugin* pPlugin = ArrayList_GetItem(dvcman->plugins, i);
@ -1866,7 +1862,6 @@ fail:
static UINT drdynvc_virtual_channel_event_detached(drdynvcPlugin* drdynvc)
{
UINT error = CHANNEL_RC_OK;
size_t i = 0;
DVCMAN* dvcman = NULL;
if (!drdynvc)
@ -1878,7 +1873,7 @@ static UINT drdynvc_virtual_channel_event_detached(drdynvcPlugin* drdynvc)
return CHANNEL_RC_BAD_CHANNEL_HANDLE;
ArrayList_Lock(dvcman->plugins);
for (i = 0; i < ArrayList_Count(dvcman->plugins); i++)
for (size_t i = 0; i < ArrayList_Count(dvcman->plugins); i++)
{
IWTSPlugin* pPlugin = ArrayList_GetItem(dvcman->plugins, i);

View File

@ -61,14 +61,12 @@
static BOOL drive_file_fix_path(WCHAR* path, size_t length)
{
size_t i = 0;
if ((length == 0) || (length > UINT32_MAX))
return FALSE;
WINPR_ASSERT(path);
for (i = 0; i < length; i++)
for (size_t i = 0; i < length; i++)
{
if (path[i] == L'\\')
path[i] = L'/';

View File

@ -886,7 +886,6 @@ static void drive_message_free(void* obj)
static UINT drive_register_drive_path(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, const char* name,
const char* path, BOOL automount)
{
size_t i = 0;
size_t length = 0;
DRIVE_DEVICE* drive = NULL;
UINT error = ERROR_INTERNAL_ERROR;
@ -924,7 +923,7 @@ static UINT drive_register_drive_path(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints,
goto out_error;
}
for (i = 0; i < length; i++)
for (size_t i = 0; i < length; i++)
{
/* Filter 2.2.1.3 Device Announce Header (DEVICE_ANNOUNCE) forbidden symbols */
switch (name[i])
@ -1015,7 +1014,6 @@ FREERDP_ENTRY_POINT(UINT drive_DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS p
RDPDR_DRIVE* drive = NULL;
UINT error = 0;
#ifdef WIN32
char* dev;
int len;
char devlist[512], buf[512];
char* bufdup;
@ -1075,12 +1073,14 @@ FREERDP_ENTRY_POINT(UINT drive_DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS p
}
else if (strcmp(drive->Path, "*") == 0)
{
int i;
/* Enumerate all devices: */
GetLogicalDriveStringsA(sizeof(devlist) - 1, devlist);
for (dev = devlist, i = 0; *dev; dev += 4, i++)
for (size_t i = 0;; i++)
{
char* dev = &devlist[i * 4];
if (!*dev)
break;
if (*dev > 'B')
{
/* Suppress disk drives A and B to avoid pesty messages */

View File

@ -122,7 +122,6 @@ static UINT32 geometry_read_RGNDATA(wLog* logger, wStream* s, UINT32 len, FREERD
if (rgndata->nRectCount)
{
UINT32 i = 0;
RDP_RECT* tmp = realloc(rgndata->rects, rgndata->nRectCount * sizeof(RDP_RECT));
if (!tmp)
@ -133,7 +132,7 @@ static UINT32 geometry_read_RGNDATA(wLog* logger, wStream* s, UINT32 len, FREERD
}
rgndata->rects = tmp;
for (i = 0; i < rgndata->nRectCount; i++)
for (UINT32 i = 0; i < rgndata->nRectCount; i++)
{
Stream_Read_INT32(s, x);
Stream_Read_INT32(s, y);

View File

@ -418,7 +418,6 @@ FREERDP_ENTRY_POINT(UINT parallel_DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINT
{
char* name = NULL;
char* path = NULL;
size_t i = 0;
size_t length = 0;
RDPDR_PARALLEL* device = NULL;
PARALLEL_DEVICE* parallel = NULL;
@ -463,7 +462,7 @@ FREERDP_ENTRY_POINT(UINT parallel_DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINT
goto error_out;
}
for (i = 0; i <= length; i++)
for (size_t i = 0; i <= length; i++)
Stream_Write_UINT8(parallel->device.data, name[i] < 0 ? '_' : name[i]);
parallel->path = path;

View File

@ -356,8 +356,6 @@ static rdpPrinter** printer_cups_enum_printers(rdpPrinterDriver* driver)
rdpPrinter** printers = NULL;
int num_printers = 0;
cups_dest_t* dests = NULL;
cups_dest_t* dest = NULL;
int i = 0;
BOOL haveDefault = FALSE;
const int num_dests = cupsGetDests(&dests);
@ -367,8 +365,9 @@ static rdpPrinter** printer_cups_enum_printers(rdpPrinterDriver* driver)
if (!printers)
return NULL;
for (i = 0, dest = dests; i < num_dests; i++, dest++)
for (size_t i = 0; i < num_dests; i++)
{
const cups_dest_t* dest = &dests[i];
if (dest->instance == NULL)
{
rdpPrinter* current = printer_cups_new_printer((rdpCupsPrinterDriver*)driver,

View File

@ -301,7 +301,6 @@ static BOOL printer_load_from_config(const rdpSettings* settings, rdpPrinter* pr
void* CachedPrinterConfigData = NULL;
UINT32 CachedFieldsLen = 0;
UINT32 PrinterNameLen = 0;
WCHAR* wptr = NULL;
if (!settings || !printer || !printer->name)
return FALSE;
@ -372,7 +371,7 @@ static BOOL printer_load_from_config(const rdpSettings* settings, rdpPrinter* pr
backslash.c[0] = '\\';
backslash.c[1] = '\0';
for (wptr = wname; (wptr = _wcschr(wptr, backslash.w));)
for (WCHAR* wptr = wname; (wptr = _wcschr(wptr, backslash.w));)
*wptr = L'_';
Stream_Write(printer_dev->device.data, wname, PrinterNameLen);

View File

@ -313,7 +313,6 @@ static rdpPrinter** printer_win_enum_printers(rdpPrinterDriver* driver)
{
rdpPrinter** printers;
int num_printers;
int i;
PRINTER_INFO_2* prninfo = NULL;
DWORD needed, returned;
BOOL haveDefault = FALSE;
@ -359,7 +358,7 @@ static rdpPrinter** printer_win_enum_printers(rdpPrinterDriver* driver)
num_printers = 0;
for (i = 0; i < (int)returned; i++)
for (int i = 0; i < (int)returned; i++)
{
rdpPrinter* current = printers[num_printers];
current = printer_win_new_printer((rdpWinPrinterDriver*)driver, prninfo[i].pPrinterName,

View File

@ -113,9 +113,8 @@ static void dumpData(char* data, unsigned length)
{
unsigned const limit = 98;
unsigned l = length > limit ? limit / 2 : length;
unsigned i = 0;
for (i = 0; i < l; ++i)
for (unsigned i = 0; i < l; ++i)
{
printf("%02hhx", data[i]);
}
@ -124,7 +123,7 @@ static void dumpData(char* data, unsigned length)
{
printf("...");
for (i = length - l; i < length; ++i)
for (unsigned i = length - l; i < length; ++i)
printf("%02hhx", data[i]);
}

View File

@ -173,7 +173,6 @@ static UINT rdpdr_process_smartcard_capset(rdpdrPlugin* rdpdr, wStream* s,
UINT rdpdr_process_capability_request(rdpdrPlugin* rdpdr, wStream* s)
{
UINT status = CHANNEL_RC_OK;
UINT16 i = 0;
UINT16 numCapabilities = 0;
if (!rdpdr || !s)
@ -188,7 +187,7 @@ UINT rdpdr_process_capability_request(rdpdrPlugin* rdpdr, wStream* s)
Stream_Read_UINT16(s, numCapabilities);
Stream_Seek(s, 2); /* pad (2 bytes) */
for (i = 0; i < numCapabilities; i++)
for (UINT16 i = 0; i < numCapabilities; i++)
{
RDPDR_CAPABILITY_HEADER header = { 0 };
UINT error = rdpdr_read_capset_header(rdpdr->log, s, &header);

View File

@ -233,7 +233,6 @@ fail:
*/
static UINT rdpdr_send_device_list_remove_request(rdpdrPlugin* rdpdr, UINT32 count, UINT32 ids[])
{
UINT32 i = 0;
wStream* s = NULL;
WINPR_ASSERT(rdpdr);
@ -257,7 +256,7 @@ static UINT rdpdr_send_device_list_remove_request(rdpdrPlugin* rdpdr, UINT32 cou
Stream_Write_UINT16(s, PAKID_CORE_DEVICELIST_REMOVE);
Stream_Write_UINT32(s, count);
for (i = 0; i < count; i++)
for (UINT32 i = 0; i < count; i++)
Stream_Write_UINT32(s, ids[i]);
Stream_SealLength(s);
@ -295,10 +294,9 @@ static BOOL check_path(const char* path)
static void first_hotplug(rdpdrPlugin* rdpdr)
{
size_t i;
DWORD unitmask = GetLogicalDrives();
for (i = 0; i < 26; i++)
for (size_t i = 0; i < 26; i++)
{
if (unitmask & 0x01)
{
@ -334,9 +332,8 @@ static LRESULT CALLBACK hotplug_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM
{
PDEV_BROADCAST_VOLUME lpdbv = (PDEV_BROADCAST_VOLUME)lpdb;
DWORD unitmask = lpdbv->dbcv_unitmask;
int i;
for (i = 0; i < 26; i++)
for (int i = 0; i < 26; i++)
{
if (unitmask & 0x01)
{
@ -363,13 +360,13 @@ static LRESULT CALLBACK hotplug_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM
{
PDEV_BROADCAST_VOLUME lpdbv = (PDEV_BROADCAST_VOLUME)lpdb;
DWORD unitmask = lpdbv->dbcv_unitmask;
int i, j, count;
int count;
char drive_name_upper, drive_name_lower;
ULONG_PTR* keys = NULL;
DEVICE_DRIVE_EXT* device_ext;
UINT32 ids[1];
for (i = 0; i < 26; i++)
for (int i = 0; i < 26; i++)
{
if (unitmask & 0x01)
{
@ -377,7 +374,7 @@ static LRESULT CALLBACK hotplug_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM
drive_name_lower = 'a' + i;
count = ListDictionary_GetKeys(rdpdr->devman->devices, &keys);
for (j = 0; j < count; j++)
for (int j = 0; j < count; j++)
{
device_ext = (DEVICE_DRIVE_EXT*)ListDictionary_GetItemValue(
rdpdr->devman->devices, (void*)keys[j]);
@ -526,7 +523,6 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
int count;
DEVICE_DRIVE_EXT* device_ext;
ULONG_PTR* keys = NULL;
int i, j;
int size = 0;
UINT error;
UINT32 ids[1];
@ -566,7 +562,7 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
/* delete removed devices */
count = ListDictionary_GetKeys(rdpdr->devman->devices, &keys);
for (j = 0; j < count; j++)
for (size_t j = 0; j < count; j++)
{
char* path = NULL;
BOOL dev_found = FALSE;
@ -593,7 +589,7 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
continue;
}
for (i = 0; i < size; i++)
for (size_t i = 0; i < size; i++)
{
if (strstr(path, dev_array[i].path) != NULL)
{
@ -621,7 +617,7 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
}
/* add new devices */
for (i = 0; i < size; i++)
for (size_t i = 0; i < size; i++)
{
const hotplug_dev* dev = &dev_array[i];
if (dev->to_add)
@ -637,7 +633,7 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
cleanup:
free(keys);
for (i = 0; i < size; i++)
for (size_t i = 0; i < size; i++)
free(dev_array[i].path);
return error;
@ -650,12 +646,11 @@ static void drive_hotplug_fsevent_callback(ConstFSEventStreamRef streamRef,
const FSEventStreamEventId eventIds[])
{
rdpdrPlugin* rdpdr;
size_t i;
UINT error;
char** paths = (char**)eventPaths;
rdpdr = (rdpdrPlugin*)clientCallBackInfo;
for (i = 0; i < numEvents; i++)
for (size_t i = 0; i < numEvents; i++)
{
if (strcmp(paths[i], "/Volumes/") == 0)
{
@ -726,7 +721,6 @@ static const char* automountLocations[] = { "/run/user/%lu/gvfs", "/run/media/%s
static BOOL isAutomountLocation(const char* path)
{
const size_t nrLocations = sizeof(automountLocations) / sizeof(automountLocations[0]);
size_t x = 0;
char buffer[MAX_PATH] = { 0 };
uid_t uid = getuid();
char uname[MAX_PATH] = { 0 };
@ -738,7 +732,7 @@ static BOOL isAutomountLocation(const char* path)
if (!path)
return FALSE;
for (x = 0; x < nrLocations; x++)
for (size_t x = 0; x < nrLocations; x++)
{
const char* location = automountLocations[x];
size_t length = 0;
@ -820,7 +814,6 @@ static UINT handle_platform_mounts_sun(wLog* log, hotplug_dev* dev_array, size_t
static UINT handle_platform_mounts_bsd(wLog* log, hotplug_dev* dev_array, size_t* size)
{
int mntsize;
size_t idx;
struct statfs* mntbuf = NULL;
mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
@ -830,7 +823,7 @@ static UINT handle_platform_mounts_bsd(wLog* log, hotplug_dev* dev_array, size_t
WLog_Print(log, WLOG_ERROR, "getmntinfo failed!");
return ERROR_OPEN_FAILED;
}
for (idx = 0; idx < (size_t)mntsize; idx++)
for (size_t idx = 0; idx < (size_t)mntsize; idx++)
{
handle_mountpoint(dev_array, size, mntbuf[idx].f_mntonname);
}
@ -939,8 +932,7 @@ static BOOL hotplug_delete_foreach(ULONG_PTR key, void* element, void* data)
/* not plugable device */
if (isAutomountLocation(path))
{
size_t i = 0;
for (i = 0; i < arg->dev_array_size; i++)
for (size_t i = 0; i < arg->dev_array_size; i++)
{
hotplug_dev* cur = &arg->dev_array[i];
if (cur->path && strstr(path, cur->path) != NULL)
@ -979,7 +971,6 @@ static BOOL hotplug_delete_foreach(ULONG_PTR key, void* element, void* data)
static UINT handle_hotplug(rdpdrPlugin* rdpdr)
{
hotplug_dev dev_array[MAX_USB_DEVICES] = { 0 };
size_t i = 0;
size_t size = 0;
UINT error = ERROR_SUCCESS;
struct hotplug_delete_arg arg = { dev_array, ARRAYSIZE(dev_array), rdpdr };
@ -993,7 +984,7 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
/* Ignore result */ device_foreach(rdpdr, FALSE, hotplug_delete_foreach, &arg);
/* add new devices */
for (i = 0; i < size; i++)
for (size_t i = 0; i < size; i++)
{
hotplug_dev* cur = &dev_array[i];
if (!device_already_plugged(rdpdr, cur))
@ -1006,7 +997,7 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
}
}
for (i = 0; i < size; i++)
for (size_t i = 0; i < size; i++)
free(dev_array[i].path);
return error;
@ -1374,7 +1365,6 @@ static BOOL device_announce(ULONG_PTR key, void* element, void* data)
if ((rdpdr->clientVersionMinor == RDPDR_VERSION_MINOR_RDP51) ||
(device->type == RDPDR_DTYP_SMARTCARD) || arg->userLoggedOn)
{
size_t i = 0;
size_t data_len = (device->data == NULL ? 0 : Stream_GetPosition(device->data));
if (!Stream_EnsureRemainingCapacity(arg->s, 20 + data_len))
@ -1388,7 +1378,7 @@ static BOOL device_announce(ULONG_PTR key, void* element, void* data)
Stream_Write_UINT32(arg->s, device->id); /* deviceID */
strncpy(Stream_Pointer(arg->s), device->name, 8);
for (i = 0; i < 8; i++)
for (size_t i = 0; i < 8; i++)
{
BYTE c = 0;
Stream_Peek_UINT8(arg->s, c);

View File

@ -797,7 +797,6 @@ out:
static UINT rdpdr_server_receive_core_capability_response(RdpdrServerContext* context, wStream* s,
const RDPDR_HEADER* header)
{
UINT16 i = 0;
UINT status = 0;
UINT16 numCapabilities = 0;
@ -813,7 +812,7 @@ static UINT rdpdr_server_receive_core_capability_response(RdpdrServerContext* co
Stream_Seek_UINT16(s); /* Padding (2 bytes) */
UINT16 caps = 0;
for (i = 0; i < numCapabilities; i++)
for (UINT16 i = 0; i < numCapabilities; i++)
{
RDPDR_CAPABILITY_HEADER capabilityHeader = { 0 };
const size_t start = Stream_GetPosition(s);
@ -964,7 +963,6 @@ static UINT rdpdr_server_receive_device_list_announce_request(RdpdrServerContext
wStream* s,
const RDPDR_HEADER* header)
{
UINT32 i = 0;
UINT32 DeviceCount = 0;
WINPR_ASSERT(context);
@ -978,7 +976,7 @@ static UINT rdpdr_server_receive_device_list_announce_request(RdpdrServerContext
Stream_Read_UINT32(s, DeviceCount); /* DeviceCount (4 bytes) */
WLog_Print(context->priv->log, WLOG_DEBUG, "DeviceCount: %" PRIu32 "", DeviceCount);
for (i = 0; i < DeviceCount; i++)
for (UINT32 i = 0; i < DeviceCount; i++)
{
UINT error = 0;
RdpdrDevice device = { 0 };
@ -1080,7 +1078,6 @@ static UINT rdpdr_server_receive_device_list_announce_request(RdpdrServerContext
static UINT rdpdr_server_receive_device_list_remove_request(RdpdrServerContext* context, wStream* s,
const RDPDR_HEADER* header)
{
UINT32 i = 0;
UINT32 DeviceCount = 0;
UINT32 DeviceType = 0;
UINT32 DeviceId = 0;
@ -1095,7 +1092,7 @@ static UINT rdpdr_server_receive_device_list_remove_request(RdpdrServerContext*
Stream_Read_UINT32(s, DeviceCount); /* DeviceCount (4 bytes) */
WLog_Print(context->priv->log, WLOG_DEBUG, "DeviceCount: %" PRIu32 "", DeviceCount);
for (i = 0; i < DeviceCount; i++)
for (UINT32 i = 0; i < DeviceCount; i++)
{
UINT error = 0;
const RdpdrDevice* device = NULL;
@ -2479,10 +2476,9 @@ static UINT rdpdr_server_send_device_file_rename_request(RdpdrServerContext* con
static void rdpdr_server_convert_slashes(char* path, int size)
{
int i = 0;
WINPR_ASSERT(path || (size <= 0));
for (i = 0; (i < size) && (path[i] != '\0'); i++)
for (int i = 0; (i < size) && (path[i] != '\0'); i++)
{
if (path[i] == '/')
path[i] = '\\';

View File

@ -171,7 +171,7 @@ static UINT enumerator_server_recv_device_added_notification(CamDevEnumServerCon
/* Search for null terminator of DeviceName */
size_t i = 0;
for (i = 0; i < remaining_length; i += sizeof(WCHAR), ++channel_name_start)
for (; i < remaining_length; i += sizeof(WCHAR), ++channel_name_start)
{
if (*channel_name_start == L'\0')
break;

View File

@ -167,7 +167,6 @@ static UINT device_server_recv_stream_list_response(CameraDeviceServerContext* c
{
CAM_STREAM_LIST_RESPONSE pdu = { 0 };
UINT error = CHANNEL_RC_OK;
BYTE i = 0;
WINPR_ASSERT(context);
WINPR_ASSERT(header);
@ -179,7 +178,7 @@ static UINT device_server_recv_stream_list_response(CameraDeviceServerContext* c
pdu.N_Descriptions = MIN(Stream_GetRemainingLength(s) / 5, 255);
for (i = 0; i < pdu.N_Descriptions; ++i)
for (BYTE i = 0; i < pdu.N_Descriptions; ++i)
{
CAM_STREAM_DESCRIPTION* StreamDescription = &pdu.StreamDescriptions[i];
@ -341,8 +340,6 @@ static UINT device_server_recv_property_list_response(CameraDeviceServerContext*
if (pdu.N_Properties > 0)
{
size_t i = 0;
pdu.Properties = calloc(pdu.N_Properties, sizeof(CAM_PROPERTY_DESCRIPTION));
if (!pdu.Properties)
{
@ -351,7 +348,7 @@ static UINT device_server_recv_property_list_response(CameraDeviceServerContext*
return ERROR_NOT_ENOUGH_MEMORY;
}
for (i = 0; i < pdu.N_Properties; ++i)
for (size_t i = 0; i < pdu.N_Properties; ++i)
{
Stream_Read_UINT8(s, pdu.Properties[i].PropertySet);
Stream_Read_UINT8(s, pdu.Properties[i].PropertyId);
@ -806,7 +803,6 @@ device_send_start_streams_request_pdu(CameraDeviceServerContext* context,
const CAM_START_STREAMS_REQUEST* startStreamsRequest)
{
wStream* s = NULL;
size_t i = 0;
WINPR_ASSERT(context);
WINPR_ASSERT(startStreamsRequest);
@ -816,7 +812,7 @@ device_send_start_streams_request_pdu(CameraDeviceServerContext* context,
if (!s)
return ERROR_NOT_ENOUGH_MEMORY;
for (i = 0; i < startStreamsRequest->N_Infos; ++i)
for (size_t i = 0; i < startStreamsRequest->N_Infos; ++i)
{
const CAM_START_STREAM_INFO* info = &startStreamsRequest->StartStreamsInfo[i];
const CAM_MEDIA_TYPE_DESCRIPTION* description = &info->MediaTypeDescription;

View File

@ -123,9 +123,7 @@ static const char* rdpei_eventid_string(UINT16 event)
static RDPINPUT_CONTACT_POINT* rdpei_contact(RDPEI_PLUGIN* rdpei, INT32 externalId, BOOL active)
{
UINT16 i = 0;
for (i = 0; i < rdpei->maxTouchContacts; i++)
for (UINT16 i = 0; i < rdpei->maxTouchContacts; i++)
{
RDPINPUT_CONTACT_POINT* contactPoint = &rdpei->contactPoints[i];
@ -153,7 +151,6 @@ static RDPINPUT_CONTACT_POINT* rdpei_contact(RDPEI_PLUGIN* rdpei, INT32 external
*/
static UINT rdpei_add_frame(RdpeiClientContext* context)
{
UINT16 i = 0;
RDPEI_PLUGIN* rdpei = NULL;
RDPINPUT_TOUCH_FRAME frame = { 0 };
RDPINPUT_CONTACT_DATA contacts[MAX_CONTACTS] = { 0 };
@ -164,7 +161,7 @@ static UINT rdpei_add_frame(RdpeiClientContext* context)
rdpei = (RDPEI_PLUGIN*)context->handle;
frame.contacts = contacts;
for (i = 0; i < rdpei->maxTouchContacts; i++)
for (UINT16 i = 0; i < rdpei->maxTouchContacts; i++)
{
RDPINPUT_CONTACT_POINT* contactPoint = &rdpei->contactPoints[i];
RDPINPUT_CONTACT_DATA* contact = &contactPoint->data;
@ -236,7 +233,6 @@ static UINT rdpei_send_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s, UINT1
static UINT rdpei_write_pen_frame(wStream* s, const RDPINPUT_PEN_FRAME* frame)
{
UINT16 x = 0;
if (!s || !frame)
return ERROR_INTERNAL_ERROR;
@ -244,7 +240,7 @@ static UINT rdpei_write_pen_frame(wStream* s, const RDPINPUT_PEN_FRAME* frame)
return ERROR_OUTOFMEMORY;
if (!rdpei_write_8byte_unsigned(s, frame->frameOffset))
return ERROR_OUTOFMEMORY;
for (x = 0; x < frame->contactCount; x++)
for (UINT16 x = 0; x < frame->contactCount; x++)
{
const RDPINPUT_PEN_CONTACT* contact = &frame->contacts[x];
@ -293,7 +289,6 @@ static UINT rdpei_send_pen_event_pdu(GENERIC_CHANNEL_CALLBACK* callback, UINT32
{
UINT status = 0;
wStream* s = NULL;
UINT16 x = 0;
if (!frames || (count == 0))
return ERROR_INTERNAL_ERROR;
@ -314,7 +309,7 @@ static UINT rdpei_send_pen_event_pdu(GENERIC_CHANNEL_CALLBACK* callback, UINT32
rdpei_write_4byte_unsigned(s, frameOffset); /* encodeTime (FOUR_BYTE_UNSIGNED_INTEGER) */
rdpei_write_2byte_unsigned(s, count); /* (frameCount) TWO_BYTE_UNSIGNED_INTEGER */
for (x = 0; x < count; x++)
for (UINT16 x = 0; x < count; x++)
{
if ((status = rdpei_write_pen_frame(s, &frames[x])))
{
@ -372,7 +367,6 @@ static UINT rdpei_send_pen_frame(RdpeiClientContext* context, RDPINPUT_PEN_FRAME
static UINT rdpei_add_pen_frame(RdpeiClientContext* context)
{
UINT16 i = 0;
RDPEI_PLUGIN* rdpei = NULL;
RDPINPUT_PEN_FRAME penFrame = { 0 };
RDPINPUT_PEN_CONTACT penContacts[MAX_PEN_CONTACTS] = { 0 };
@ -384,7 +378,7 @@ static UINT rdpei_add_pen_frame(RdpeiClientContext* context)
penFrame.contacts = penContacts;
for (i = 0; i < rdpei->maxPenContacts; i++)
for (UINT16 i = 0; i < rdpei->maxPenContacts; i++)
{
RDPINPUT_PEN_CONTACT_POINT* contact = &(rdpei->penContactPoints[i]);
@ -557,7 +551,6 @@ static void rdpei_print_contact_flags(UINT32 contactFlags)
*/
static UINT rdpei_write_touch_frame(wStream* s, RDPINPUT_TOUCH_FRAME* frame)
{
UINT32 index = 0;
int rectSize = 2;
RDPINPUT_CONTACT_DATA* contact = NULL;
if (!s || !frame)
@ -581,7 +574,7 @@ static UINT rdpei_write_touch_frame(wStream* s, RDPINPUT_TOUCH_FRAME* frame)
return CHANNEL_RC_NO_MEMORY;
}
for (index = 0; index < frame->contactCount; index++)
for (UINT32 index = 0; index < frame->contactCount; index++)
{
contact = &frame->contacts[index];
contact->fieldsPresent |= CONTACT_DATA_CONTACTRECT_PRESENT;
@ -1131,11 +1124,10 @@ static UINT rdpei_touch_raw_event_va(RdpeiClientContext* context, INT32 external
static RDPINPUT_PEN_CONTACT_POINT* rdpei_pen_contact(RDPEI_PLUGIN* rdpei, INT32 externalId,
BOOL active)
{
UINT32 x = 0;
if (!rdpei)
return NULL;
for (x = 0; x < rdpei->maxPenContacts; x++)
for (UINT32 x = 0; x < rdpei->maxPenContacts; x++)
{
RDPINPUT_PEN_CONTACT_POINT* contact = &rdpei->penContactPoints[x];
if (active)

View File

@ -608,9 +608,7 @@ BOOL rdpei_write_8byte_unsigned(wStream* s, UINT64 value)
void touch_event_reset(RDPINPUT_TOUCH_EVENT* event)
{
UINT16 i = 0;
for (i = 0; i < event->frameCount; i++)
for (UINT16 i = 0; i < event->frameCount; i++)
touch_frame_reset(&event->frames[i]);
free(event->frames);
@ -627,9 +625,7 @@ void touch_frame_reset(RDPINPUT_TOUCH_FRAME* frame)
void pen_event_reset(RDPINPUT_PEN_EVENT* event)
{
UINT16 i = 0;
for (i = 0; i < event->frameCount; i++)
for (UINT16 i = 0; i < event->frameCount; i++)
pen_frame_reset(&event->frames[i]);
free(event->frames);

View File

@ -311,7 +311,6 @@ static UINT read_pen_contact(RdpeiServerContext* context, wStream* s,
*/
static UINT read_touch_frame(RdpeiServerContext* context, wStream* s, RDPINPUT_TOUCH_FRAME* frame)
{
UINT32 i = 0;
RDPINPUT_CONTACT_DATA* contact = NULL;
UINT error = 0;
@ -329,7 +328,7 @@ static UINT read_touch_frame(RdpeiServerContext* context, wStream* s, RDPINPUT_T
return CHANNEL_RC_NO_MEMORY;
}
for (i = 0; i < frame->contactCount; i++, contact++)
for (UINT32 i = 0; i < frame->contactCount; i++, contact++)
{
if ((error = read_touch_contact_data(context, s, contact)))
{
@ -344,7 +343,6 @@ static UINT read_touch_frame(RdpeiServerContext* context, wStream* s, RDPINPUT_T
static UINT read_pen_frame(RdpeiServerContext* context, wStream* s, RDPINPUT_PEN_FRAME* frame)
{
UINT32 i = 0;
RDPINPUT_PEN_CONTACT* contact = NULL;
UINT error = 0;
@ -362,7 +360,7 @@ static UINT read_pen_frame(RdpeiServerContext* context, wStream* s, RDPINPUT_PEN
return CHANNEL_RC_NO_MEMORY;
}
for (i = 0; i < frame->contactCount; i++, contact++)
for (UINT32 i = 0; i < frame->contactCount; i++, contact++)
{
if ((error = read_pen_contact(context, s, contact)))
{
@ -383,7 +381,6 @@ static UINT read_pen_frame(RdpeiServerContext* context, wStream* s, RDPINPUT_PEN
static UINT read_touch_event(RdpeiServerContext* context, wStream* s)
{
UINT16 frameCount = 0;
UINT32 i = 0;
RDPINPUT_TOUCH_EVENT* event = &context->priv->touchEvent;
RDPINPUT_TOUCH_FRAME* frame = NULL;
UINT error = CHANNEL_RC_OK;
@ -403,7 +400,7 @@ static UINT read_touch_event(RdpeiServerContext* context, wStream* s)
return CHANNEL_RC_NO_MEMORY;
}
for (i = 0; i < frameCount; i++, frame++)
for (UINT32 i = 0; i < frameCount; i++, frame++)
{
if ((error = read_touch_frame(context, s, frame)))
{
@ -425,7 +422,6 @@ out_cleanup:
static UINT read_pen_event(RdpeiServerContext* context, wStream* s)
{
UINT16 frameCount = 0;
UINT32 i = 0;
RDPINPUT_PEN_EVENT* event = &context->priv->penEvent;
RDPINPUT_PEN_FRAME* frame = NULL;
UINT error = CHANNEL_RC_OK;
@ -445,7 +441,7 @@ static UINT read_pen_event(RdpeiServerContext* context, wStream* s)
return CHANNEL_RC_NO_MEMORY;
}
for (i = 0; i < frameCount; i++, frame++)
for (UINT32 i = 0; i < frameCount; i++, frame++)
{
if ((error = read_pen_frame(context, s, frame)))
{

View File

@ -39,7 +39,6 @@
*/
static UINT rdpgfx_read_h264_metablock(RDPGFX_PLUGIN* gfx, wStream* s, RDPGFX_H264_METABLOCK* meta)
{
UINT32 index = 0;
RECTANGLE_16* regionRect = NULL;
RDPGFX_H264_QUANT_QUALITY* quantQualityVal = NULL;
UINT error = ERROR_INVALID_DATA;
@ -75,7 +74,7 @@ static UINT rdpgfx_read_h264_metablock(RDPGFX_PLUGIN* gfx, wStream* s, RDPGFX_H2
WLog_DBG(TAG, "H264_METABLOCK: numRegionRects: %" PRIu32 "", meta->numRegionRects);
for (index = 0; index < meta->numRegionRects; index++)
for (UINT32 index = 0; index < meta->numRegionRects; index++)
{
regionRect = &(meta->regionRects[index]);
@ -97,7 +96,7 @@ static UINT rdpgfx_read_h264_metablock(RDPGFX_PLUGIN* gfx, wStream* s, RDPGFX_H2
goto error_out;
}
for (index = 0; index < meta->numRegionRects; index++)
for (UINT32 index = 0; index < meta->numRegionRects; index++)
{
quantQualityVal = &(meta->quantQualityVals[index]);
Stream_Read_UINT8(s, quantQualityVal->qpVal); /* qpVal (1 byte) */

View File

@ -74,10 +74,8 @@ static void free_surfaces(RdpgfxClientContext* context, wHashTable* SurfaceTable
static void evict_cache_slots(RdpgfxClientContext* context, UINT16 MaxCacheSlots, void** CacheSlots)
{
UINT16 index = 0;
WINPR_ASSERT(CacheSlots);
for (index = 0; index < MaxCacheSlots; index++)
for (UINT16 index = 0; index < MaxCacheSlots; index++)
{
if (CacheSlots[index])
{
@ -103,7 +101,6 @@ static UINT rdpgfx_send_caps_advertise_pdu(RdpgfxClientContext* context,
const RDPGFX_CAPS_ADVERTISE_PDU* pdu)
{
UINT error = CHANNEL_RC_OK;
UINT16 index = 0;
RDPGFX_HEADER header = { 0 };
RDPGFX_PLUGIN* gfx = NULL;
GENERIC_CHANNEL_CALLBACK* callback = NULL;
@ -123,7 +120,7 @@ static UINT rdpgfx_send_caps_advertise_pdu(RdpgfxClientContext* context,
header.cmdId = RDPGFX_CMDID_CAPSADVERTISE;
header.pduLength = RDPGFX_HEADER_SIZE + 2;
for (index = 0; index < pdu->capsSetCount; index++)
for (UINT16 index = 0; index < pdu->capsSetCount; index++)
{
const RDPGFX_CAPSET* capsSet = &(pdu->capsSets[index]);
header.pduLength += RDPGFX_CAPSET_BASE_SIZE + capsSet->length;
@ -144,7 +141,7 @@ static UINT rdpgfx_send_caps_advertise_pdu(RdpgfxClientContext* context,
/* RDPGFX_CAPS_ADVERTISE_PDU */
Stream_Write_UINT16(s, pdu->capsSetCount); /* capsSetCount (2 bytes) */
for (index = 0; index < pdu->capsSetCount; index++)
for (UINT16 index = 0; index < pdu->capsSetCount; index++)
{
const RDPGFX_CAPSET* capsSet = &(pdu->capsSets[index]);
Stream_Write_UINT32(s, capsSet->version); /* version (4 bytes) */
@ -172,9 +169,8 @@ static BOOL rdpgfx_is_capability_filtered(RDPGFX_PLUGIN* gfx, UINT32 caps)
RDPGFX_CAPVERSION_104, RDPGFX_CAPVERSION_105,
RDPGFX_CAPVERSION_106, RDPGFX_CAPVERSION_106_ERR,
RDPGFX_CAPVERSION_107 };
UINT32 x = 0;
for (x = 0; x < ARRAYSIZE(capList); x++)
for (size_t x = 0; x < ARRAYSIZE(capList); x++)
{
if (caps == capList[x])
return (filter & (1 << x)) != 0;
@ -507,7 +503,6 @@ fail:
static UINT rdpgfx_recv_reset_graphics_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
int pad = 0;
UINT32 index = 0;
MONITOR_DEF* monitor = NULL;
RDPGFX_RESET_GRAPHICS_PDU pdu = { 0 };
WINPR_ASSERT(callback);
@ -538,7 +533,7 @@ static UINT rdpgfx_recv_reset_graphics_pdu(GENERIC_CHANNEL_CALLBACK* callback, w
return CHANNEL_RC_NO_MEMORY;
}
for (index = 0; index < pdu.monitorCount; index++)
for (UINT32 index = 0; index < pdu.monitorCount; index++)
{
monitor = &(pdu.monitorDefArray[index]);
Stream_Read_INT32(s, monitor->left); /* left (4 bytes) */
@ -562,7 +557,7 @@ static UINT rdpgfx_recv_reset_graphics_pdu(GENERIC_CHANNEL_CALLBACK* callback, w
pdu.width, pdu.height, pdu.monitorCount);
#if defined(WITH_DEBUG_RDPGFX)
for (index = 0; index < pdu.monitorCount; index++)
for (UINT32 index = 0; index < pdu.monitorCount; index++)
{
monitor = &(pdu.monitorDefArray[index]);
DEBUG_RDPGFX(gfx->log,
@ -630,7 +625,6 @@ static UINT rdpgfx_recv_evict_cache_entry_pdu(GENERIC_CHANNEL_CALLBACK* callback
*/
static UINT rdpgfx_load_cache_import_offer(RDPGFX_PLUGIN* gfx, RDPGFX_CACHE_IMPORT_OFFER_PDU* offer)
{
int idx = 0;
int count = 0;
UINT error = CHANNEL_RC_OK;
PERSISTENT_CACHE_ENTRY entry;
@ -685,7 +679,7 @@ static UINT rdpgfx_load_cache_import_offer(RDPGFX_PLUGIN* gfx, RDPGFX_CACHE_IMPO
offer->cacheEntriesCount = (UINT16)count;
for (idx = 0; idx < count; idx++)
for (int idx = 0; idx < count; idx++)
{
if (persistent_cache_read_entry(persistent, &entry) < 1)
{
@ -712,7 +706,6 @@ fail:
*/
static UINT rdpgfx_save_persistent_cache(RDPGFX_PLUGIN* gfx)
{
int idx = 0;
UINT error = CHANNEL_RC_OK;
PERSISTENT_CACHE_ENTRY cacheEntry;
rdpPersistentCache* persistent = NULL;
@ -746,7 +739,7 @@ static UINT rdpgfx_save_persistent_cache(RDPGFX_PLUGIN* gfx)
goto fail;
}
for (idx = 0; idx < gfx->MaxCacheSlots; idx++)
for (UINT16 idx = 0; idx < gfx->MaxCacheSlots; idx++)
{
if (gfx->CacheSlots[idx])
{
@ -775,7 +768,6 @@ fail:
static UINT rdpgfx_send_cache_import_offer_pdu(RdpgfxClientContext* context,
const RDPGFX_CACHE_IMPORT_OFFER_PDU* pdu)
{
UINT16 index = 0;
UINT error = CHANNEL_RC_OK;
wStream* s = NULL;
RDPGFX_HEADER header;
@ -822,7 +814,7 @@ static UINT rdpgfx_send_cache_import_offer_pdu(RdpgfxClientContext* context,
/* cacheEntriesCount (2 bytes) */
Stream_Write_UINT16(s, pdu->cacheEntriesCount);
for (index = 0; index < pdu->cacheEntriesCount; index++)
for (UINT16 index = 0; index < pdu->cacheEntriesCount; index++)
{
const RDPGFX_CACHE_ENTRY_METADATA* cacheEntry = &(pdu->cacheEntries[index]);
Stream_Write_UINT64(s, cacheEntry->cacheKey); /* cacheKey (8 bytes) */
@ -844,7 +836,6 @@ fail:
*/
static UINT rdpgfx_send_cache_offer(RDPGFX_PLUGIN* gfx)
{
int idx = 0;
int count = 0;
UINT error = CHANNEL_RC_OK;
PERSISTENT_CACHE_ENTRY entry;
@ -901,7 +892,7 @@ static UINT rdpgfx_send_cache_offer(RDPGFX_PLUGIN* gfx)
WLog_DBG(TAG, "Sending Cache Import Offer: %d", count);
for (idx = 0; idx < count; idx++)
for (int idx = 0; idx < count; idx++)
{
if (persistent_cache_read_entry(persistent, &entry) < 1)
{
@ -1007,7 +998,6 @@ fail:
*/
static UINT rdpgfx_recv_cache_import_reply_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
UINT16 idx = 0;
RDPGFX_CACHE_IMPORT_REPLY_PDU pdu = { 0 };
WINPR_ASSERT(callback);
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*)callback->plugin;
@ -1026,7 +1016,7 @@ static UINT rdpgfx_recv_cache_import_reply_pdu(GENERIC_CHANNEL_CALLBACK* callbac
if (pdu.importedEntriesCount > RDPGFX_CACHE_ENTRY_MAX_COUNT)
return ERROR_INVALID_DATA;
for (idx = 0; idx < pdu.importedEntriesCount; idx++)
for (UINT16 idx = 0; idx < pdu.importedEntriesCount; idx++)
{
Stream_Read_UINT16(s, pdu.cacheSlots[idx]); /* cacheSlot (2 bytes) */
}
@ -1473,7 +1463,6 @@ static UINT rdpgfx_recv_delete_encoding_context_pdu(GENERIC_CHANNEL_CALLBACK* ca
*/
static UINT rdpgfx_recv_solid_fill_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
UINT16 index = 0;
RECTANGLE_16* fillRect = NULL;
RDPGFX_SOLID_FILL_PDU pdu = { 0 };
WINPR_ASSERT(callback);
@ -1507,7 +1496,7 @@ static UINT rdpgfx_recv_solid_fill_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStre
return CHANNEL_RC_NO_MEMORY;
}
for (index = 0; index < pdu.fillRectCount; index++)
for (UINT16 index = 0; index < pdu.fillRectCount; index++)
{
fillRect = &(pdu.fillRects[index]);
@ -1542,7 +1531,6 @@ static UINT rdpgfx_recv_solid_fill_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStre
*/
static UINT rdpgfx_recv_surface_to_surface_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
UINT16 index = 0;
RDPGFX_POINT16* destPt = NULL;
RDPGFX_SURFACE_TO_SURFACE_PDU pdu = { 0 };
WINPR_ASSERT(callback);
@ -1577,7 +1565,7 @@ static UINT rdpgfx_recv_surface_to_surface_pdu(GENERIC_CHANNEL_CALLBACK* callbac
return CHANNEL_RC_NO_MEMORY;
}
for (index = 0; index < pdu.destPtsCount; index++)
for (UINT16 index = 0; index < pdu.destPtsCount; index++)
{
destPt = &(pdu.destPts[index]);
@ -1665,7 +1653,6 @@ static UINT rdpgfx_recv_surface_to_cache_pdu(GENERIC_CHANNEL_CALLBACK* callback,
*/
static UINT rdpgfx_recv_cache_to_surface_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* s)
{
UINT16 index = 0;
RDPGFX_POINT16* destPt = NULL;
RDPGFX_CACHE_TO_SURFACE_PDU pdu = { 0 };
WINPR_ASSERT(callback);
@ -1693,7 +1680,7 @@ static UINT rdpgfx_recv_cache_to_surface_pdu(GENERIC_CHANNEL_CALLBACK* callback,
return CHANNEL_RC_NO_MEMORY;
}
for (index = 0; index < pdu.destPtsCount; index++)
for (UINT16 index = 0; index < pdu.destPtsCount; index++)
{
destPt = &(pdu.destPts[index]);
@ -2248,7 +2235,6 @@ static UINT rdpgfx_get_surface_ids(RdpgfxClientContext* context, UINT16** ppSurf
UINT16* count_out)
{
size_t count = 0;
size_t index = 0;
UINT16* pSurfaceIds = NULL;
ULONG_PTR* pKeys = NULL;
WINPR_ASSERT(context);
@ -2273,7 +2259,7 @@ static UINT rdpgfx_get_surface_ids(RdpgfxClientContext* context, UINT16** ppSurf
return CHANNEL_RC_NO_MEMORY;
}
for (index = 0; index < count; index++)
for (size_t index = 0; index < count; index++)
{
pSurfaceIds[index] = (UINT16)(pKeys[index] - 1);
}

View File

@ -265,7 +265,7 @@ static UINT rdpgfx_send_reset_graphics_pdu(RdpgfxServerContext* context,
{
if (!checkCapsAreExchanged(context))
return CHANNEL_RC_NOT_INITIALIZED;
UINT32 index = 0;
wStream* s = NULL;
/* Check monitorCount. This ensures total size within 340 bytes) */
@ -290,7 +290,7 @@ static UINT rdpgfx_send_reset_graphics_pdu(RdpgfxServerContext* context,
Stream_Write_UINT32(s, pdu->height); /* height (4 bytes) */
Stream_Write_UINT32(s, pdu->monitorCount); /* monitorCount (4 bytes) */
for (index = 0; index < pdu->monitorCount; index++)
for (UINT32 index = 0; index < pdu->monitorCount; index++)
{
const MONITOR_DEF* monitor = &(pdu->monitorDefArray[index]);
Stream_Write_UINT32(s, monitor->left); /* left (4 bytes) */
@ -576,7 +576,6 @@ static INLINE UINT16 rdpgfx_surface_command_cmdid(const RDPGFX_SURFACE_COMMAND*
*/
static UINT rdpgfx_write_h264_metablock(wLog* log, wStream* s, const RDPGFX_H264_METABLOCK* meta)
{
UINT32 index = 0;
RECTANGLE_16* regionRect = NULL;
RDPGFX_H264_QUANT_QUALITY* quantQualityVal = NULL;
UINT error = CHANNEL_RC_OK;
@ -586,7 +585,7 @@ static UINT rdpgfx_write_h264_metablock(wLog* log, wStream* s, const RDPGFX_H264
Stream_Write_UINT32(s, meta->numRegionRects); /* numRegionRects (4 bytes) */
for (index = 0; index < meta->numRegionRects; index++)
for (UINT32 index = 0; index < meta->numRegionRects; index++)
{
regionRect = &(meta->regionRects[index]);
@ -598,7 +597,7 @@ static UINT rdpgfx_write_h264_metablock(wLog* log, wStream* s, const RDPGFX_H264
}
}
for (index = 0; index < meta->numRegionRects; index++)
for (UINT32 index = 0; index < meta->numRegionRects; index++)
{
quantQualityVal = &(meta->quantQualityVals[index]);
Stream_Write_UINT8(s, quantQualityVal->qp | (quantQualityVal->r << 6) |
@ -932,7 +931,6 @@ static UINT rdpgfx_send_solid_fill_pdu(RdpgfxServerContext* context,
if (!checkCapsAreExchanged(context))
return CHANNEL_RC_NOT_INITIALIZED;
UINT error = CHANNEL_RC_OK;
UINT16 index = 0;
RECTANGLE_16* fillRect = NULL;
wStream* s = rdpgfx_server_single_packet_new(context->priv->log, RDPGFX_CMDID_SOLIDFILL,
8 + 8 * pdu->fillRectCount);
@ -955,7 +953,7 @@ static UINT rdpgfx_send_solid_fill_pdu(RdpgfxServerContext* context,
Stream_Write_UINT16(s, pdu->fillRectCount); /* fillRectCount (2 bytes) */
for (index = 0; index < pdu->fillRectCount; index++)
for (UINT16 index = 0; index < pdu->fillRectCount; index++)
{
fillRect = &(pdu->fillRects[index]);
@ -984,7 +982,6 @@ static UINT rdpgfx_send_surface_to_surface_pdu(RdpgfxServerContext* context,
if (!checkCapsAreExchanged(context))
return CHANNEL_RC_NOT_INITIALIZED;
UINT error = CHANNEL_RC_OK;
UINT16 index = 0;
RDPGFX_POINT16* destPt = NULL;
wStream* s = rdpgfx_server_single_packet_new(context->priv->log, RDPGFX_CMDID_SURFACETOSURFACE,
14 + 4 * pdu->destPtsCount);
@ -1008,7 +1005,7 @@ static UINT rdpgfx_send_surface_to_surface_pdu(RdpgfxServerContext* context,
Stream_Write_UINT16(s, pdu->destPtsCount); /* destPtsCount (2 bytes) */
for (index = 0; index < pdu->destPtsCount; index++)
for (UINT16 index = 0; index < pdu->destPtsCount; index++)
{
destPt = &(pdu->destPts[index]);
@ -1075,7 +1072,6 @@ static UINT rdpgfx_send_cache_to_surface_pdu(RdpgfxServerContext* context,
if (!checkCapsAreExchanged(context))
return CHANNEL_RC_NOT_INITIALIZED;
UINT error = CHANNEL_RC_OK;
UINT16 index = 0;
RDPGFX_POINT16* destPt = NULL;
wStream* s = rdpgfx_server_single_packet_new(context->priv->log, RDPGFX_CMDID_CACHETOSURFACE,
6 + 4 * pdu->destPtsCount);
@ -1090,7 +1086,7 @@ static UINT rdpgfx_send_cache_to_surface_pdu(RdpgfxServerContext* context,
Stream_Write_UINT16(s, pdu->surfaceId); /* surfaceId (2 bytes) */
Stream_Write_UINT16(s, pdu->destPtsCount); /* destPtsCount (2 bytes) */
for (index = 0; index < pdu->destPtsCount; index++)
for (UINT16 index = 0; index < pdu->destPtsCount; index++)
{
destPt = &(pdu->destPts[index]);
@ -1224,7 +1220,7 @@ static UINT rdpgfx_recv_cache_import_offer_pdu(RdpgfxServerContext* context, wSt
{
if (!checkCapsAreExchanged(context))
return CHANNEL_RC_NOT_INITIALIZED;
UINT16 index = 0;
RDPGFX_CACHE_IMPORT_OFFER_PDU pdu = { 0 };
RDPGFX_CACHE_ENTRY_METADATA* cacheEntry = NULL;
UINT error = CHANNEL_RC_OK;
@ -1246,7 +1242,7 @@ static UINT rdpgfx_recv_cache_import_offer_pdu(RdpgfxServerContext* context, wSt
if (!Stream_CheckAndLogRequiredLengthOfSize(TAG, s, pdu.cacheEntriesCount, 12ull))
return ERROR_INVALID_DATA;
for (index = 0; index < pdu.cacheEntriesCount; index++)
for (UINT16 index = 0; index < pdu.cacheEntriesCount; index++)
{
cacheEntry = &(pdu.cacheEntries[index]);
Stream_Read_UINT64(s, cacheEntry->cacheKey); /* cacheKey (8 bytes) */
@ -1272,7 +1268,6 @@ static UINT rdpgfx_recv_cache_import_offer_pdu(RdpgfxServerContext* context, wSt
*/
static UINT rdpgfx_recv_caps_advertise_pdu(RdpgfxServerContext* context, wStream* s)
{
UINT16 index = 0;
RDPGFX_CAPSET* capsSets = NULL;
RDPGFX_CAPS_ADVERTISE_PDU pdu = { 0 };
UINT error = ERROR_INVALID_DATA;
@ -1293,7 +1288,7 @@ static UINT rdpgfx_recv_caps_advertise_pdu(RdpgfxServerContext* context, wStream
pdu.capsSets = capsSets;
for (index = 0; index < pdu.capsSetCount; index++)
for (UINT16 index = 0; index < pdu.capsSetCount; index++)
{
RDPGFX_CAPSET* capsSet = &(pdu.capsSets[index]);

View File

@ -353,7 +353,6 @@ static UINT32 rdpsnd_alsa_get_volume(rdpsndDevicePlugin* device)
UINT32 dwVolume = 0;
UINT16 dwVolumeLeft = 0;
UINT16 dwVolumeRight = 0;
snd_mixer_elem_t* elem = NULL;
rdpsndAlsaPlugin* alsa = (rdpsndAlsaPlugin*)device;
dwVolumeLeft = ((50 * 0xFFFF) / 100); /* 50% */
dwVolumeRight = ((50 * 0xFFFF) / 100); /* 50% */
@ -361,7 +360,8 @@ static UINT32 rdpsnd_alsa_get_volume(rdpsndDevicePlugin* device)
if (!rdpsnd_alsa_open_mixer(alsa))
return 0;
for (elem = snd_mixer_first_elem(alsa->mixer_handle); elem; elem = snd_mixer_elem_next(elem))
for (snd_mixer_elem_t* elem = snd_mixer_first_elem(alsa->mixer_handle); elem;
elem = snd_mixer_elem_next(elem))
{
if (snd_mixer_selem_has_playback_volume(elem))
{
@ -388,7 +388,6 @@ static BOOL rdpsnd_alsa_set_volume(rdpsndDevicePlugin* device, UINT32 value)
long volume_max = 0;
long volume_left = 0;
long volume_right = 0;
snd_mixer_elem_t* elem = NULL;
rdpsndAlsaPlugin* alsa = (rdpsndAlsaPlugin*)device;
if (!rdpsnd_alsa_open_mixer(alsa))
@ -397,7 +396,8 @@ static BOOL rdpsnd_alsa_set_volume(rdpsndDevicePlugin* device, UINT32 value)
left = (value & 0xFFFF);
right = ((value >> 16) & 0xFFFF);
for (elem = snd_mixer_first_elem(alsa->mixer_handle); elem; elem = snd_mixer_elem_next(elem))
for (snd_mixer_elem_t* elem = snd_mixer_first_elem(alsa->mixer_handle); elem;
elem = snd_mixer_elem_next(elem))
{
if (snd_mixer_selem_has_playback_volume(elem))
{

View File

@ -50,8 +50,6 @@ static OSStatus rdpsnd_ios_render_cb(void* inRefCon,
const AudioTimeStamp __unused* inTimeStamp, UInt32 inBusNumber,
UInt32 __unused inNumberFrames, AudioBufferList* ioData)
{
unsigned int i;
if (inBusNumber != 0)
{
return noErr;
@ -59,7 +57,7 @@ static OSStatus rdpsnd_ios_render_cb(void* inRefCon,
rdpsndIOSPlugin* p = THIS(inRefCon);
for (i = 0; i < ioData->mNumberBuffers; i++)
for (unsigned int i = 0; i < ioData->mNumberBuffers; i++)
{
AudioBuffer* target_buffer = &ioData->mBuffers[i];
int32_t available_bytes = 0;

View File

@ -316,7 +316,7 @@ static UINT rdpsnd_mac_play(rdpsndDevicePlugin *device, const BYTE *data, size_t
AVAudioPCMBuffer *buffer;
AVAudioFormat *format;
float *const *db;
size_t pos, step, x;
size_t step;
AVAudioFrameCount count;
UINT64 start = GetTickCount64();
@ -349,10 +349,10 @@ static UINT rdpsnd_mac_play(rdpsndDevicePlugin *device, const BYTE *data, size_t
buffer.frameLength = buffer.frameCapacity;
db = buffer.floatChannelData;
for (pos = 0; pos < count; pos++)
for (size_t pos = 0; pos < count; pos++)
{
const BYTE *d = &data[pos * step];
for (x = 0; x < mac->format.nChannels; x++)
for (size_t x = 0; x < mac->format.nChannels; x++)
{
const float val = (int16_t)((uint16_t)d[0] | ((uint16_t)d[1] << 8)) / 32768.0f;
db[x][pos] = val;

View File

@ -89,7 +89,6 @@ static BOOL rdpsnd_pulse_format_supported(rdpsndDevicePlugin* device, const AUDI
static void rdpsnd_pulse_get_sink_info(pa_context* c, const pa_sink_info* i, int eol,
void* userdata)
{
uint8_t x = 0;
UINT16 dwVolumeLeft = ((50 * 0xFFFF) / 100); /* 50% */
UINT16 dwVolumeRight = ((50 * 0xFFFF) / 100); /* 50% */
rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)userdata;
@ -98,7 +97,7 @@ static void rdpsnd_pulse_get_sink_info(pa_context* c, const pa_sink_info* i, int
if (!rdpsnd_check_pulse(pulse, FALSE) || !i)
return;
for (x = 0; x < i->volume.channels; x++)
for (uint8_t x = 0; x < i->volume.channels; x++)
{
pa_volume_t volume = i->volume.values[x];

View File

@ -162,7 +162,6 @@ static UINT rdpsnd_send_quality_mode_pdu(rdpsndPlugin* rdpsnd)
static void rdpsnd_select_supported_audio_formats(rdpsndPlugin* rdpsnd)
{
UINT16 index = 0;
WINPR_ASSERT(rdpsnd);
audio_formats_free(rdpsnd->ClientFormats, rdpsnd->NumberOfClientFormats);
rdpsnd->NumberOfClientFormats = 0;
@ -176,7 +175,7 @@ static void rdpsnd_select_supported_audio_formats(rdpsndPlugin* rdpsnd)
if (!rdpsnd->ClientFormats || !rdpsnd->device)
return;
for (index = 0; index < rdpsnd->NumberOfServerFormats; index++)
for (UINT16 index = 0; index < rdpsnd->NumberOfServerFormats; index++)
{
const AUDIO_FORMAT* serverFormat = &rdpsnd->ServerFormats[index];
@ -200,7 +199,6 @@ static void rdpsnd_select_supported_audio_formats(rdpsndPlugin* rdpsnd)
*/
static UINT rdpsnd_send_client_audio_formats(rdpsndPlugin* rdpsnd)
{
UINT16 index = 0;
wStream* pdu = NULL;
UINT16 length = 0;
UINT32 dwVolume = 0;
@ -214,7 +212,7 @@ static UINT rdpsnd_send_client_audio_formats(rdpsndPlugin* rdpsnd)
wNumberOfFormats = rdpsnd->NumberOfClientFormats;
length = 4 + 20;
for (index = 0; index < wNumberOfFormats; index++)
for (UINT16 index = 0; index < wNumberOfFormats; index++)
length += (18 + rdpsnd->ClientFormats[index].cbSize);
pdu = Stream_New(NULL, length);
@ -237,7 +235,7 @@ static UINT rdpsnd_send_client_audio_formats(rdpsndPlugin* rdpsnd)
Stream_Write_UINT16(pdu, CHANNEL_VERSION_WIN_MAX); /* wVersion */
Stream_Write_UINT8(pdu, 0); /* bPad */
for (index = 0; index < wNumberOfFormats; index++)
for (UINT16 index = 0; index < wNumberOfFormats; index++)
{
const AUDIO_FORMAT* clientFormat = &rdpsnd->ClientFormats[index];
@ -260,7 +258,6 @@ static UINT rdpsnd_send_client_audio_formats(rdpsndPlugin* rdpsnd)
*/
static UINT rdpsnd_recv_server_audio_formats_pdu(rdpsndPlugin* rdpsnd, wStream* s)
{
UINT16 index = 0;
UINT16 wNumberOfFormats = 0;
UINT ret = ERROR_BAD_LENGTH;
@ -293,7 +290,7 @@ static UINT rdpsnd_recv_server_audio_formats_pdu(rdpsndPlugin* rdpsnd, wStream*
if (!rdpsnd->ServerFormats)
return CHANNEL_RC_NO_MEMORY;
for (index = 0; index < wNumberOfFormats; index++)
for (UINT16 index = 0; index < wNumberOfFormats; index++)
{
AUDIO_FORMAT* format = &rdpsnd->ServerFormats[index];
@ -1070,9 +1067,7 @@ static UINT rdpsnd_process_connect(rdpsndPlugin* rdpsnd)
}
else
{
size_t x = 0;
for (x = 0; x < ARRAYSIZE(backends); x++)
for (size_t x = 0; x < ARRAYSIZE(backends); x++)
{
const char* subsystem_name = backends[x].subsystem;
const char* device_name = backends[x].device;

View File

@ -177,7 +177,6 @@ static UINT rdpsnd_server_recv_quality_mode(RdpsndServerContext* context, wStrea
*/
static UINT rdpsnd_server_recv_formats(RdpsndServerContext* context, wStream* s)
{
UINT16 i = 0;
UINT16 num_known_format = 0;
UINT16 udpPort = 0;
BYTE lastblock = 0;
@ -215,7 +214,7 @@ static UINT rdpsnd_server_recv_formats(RdpsndServerContext* context, wStream* s)
return CHANNEL_RC_NO_MEMORY;
}
for (i = 0; i < context->num_client_formats; i++)
for (UINT16 i = 0; i < context->num_client_formats; i++)
{
AUDIO_FORMAT* format = &context->client_formats[i];

View File

@ -174,14 +174,13 @@ static UINT remdesk_read_channel_header(wStream* s, REMDESK_CHANNEL_HEADER* head
*/
static UINT remdesk_write_channel_header(wStream* s, REMDESK_CHANNEL_HEADER* header)
{
int index = 0;
UINT32 ChannelNameLen = 0;
WCHAR ChannelNameW[32] = { 0 };
WINPR_ASSERT(s);
WINPR_ASSERT(header);
for (index = 0; index < 32; index++)
for (size_t index = 0; index < 32; index++)
{
ChannelNameW[index] = (WCHAR)header->ChannelName[index];
}

View File

@ -85,11 +85,10 @@ static UINT remdesk_read_channel_header(wStream* s, REMDESK_CHANNEL_HEADER* head
*/
static UINT remdesk_write_channel_header(wStream* s, REMDESK_CHANNEL_HEADER* header)
{
int index = 0;
UINT32 ChannelNameLen = 0;
WCHAR ChannelNameW[32] = { 0 };
for (index = 0; index < 32; index++)
for (size_t index = 0; index < 32; index++)
{
ChannelNameW[index] = (WCHAR)header->ChannelName[index];
}

View File

@ -820,7 +820,6 @@ FREERDP_ENTRY_POINT(UINT serial_DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS
char* driver = NULL;
RDPDR_SERIAL* device = NULL;
#if defined __linux__ && !defined ANDROID
size_t i = 0;
size_t len = 0;
SERIAL_DEVICE* serial = NULL;
#endif /* __linux__ */
@ -883,7 +882,7 @@ FREERDP_ENTRY_POINT(UINT serial_DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS
goto error_out;
}
for (i = 0; i <= len; i++)
for (size_t i = 0; i <= len; i++)
Stream_Write_UINT8(serial->device.data, name[i] < 0 ? '_' : name[i]);
if (driver != NULL)

View File

@ -451,9 +451,8 @@ static BOOL tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const BYTE* data, UI
int dst_offset = 0;
#if 0
WLog_DBG(TAG, ("tsmf_ffmpeg_decode_audio: data_size %"PRIu32"", data_size));
int i;
for (i = 0; i < data_size; i++)
for (int i = 0; i < data_size; i++)
{
WLog_DBG(TAG, ("%02"PRIX8"", data[i]));

View File

@ -384,7 +384,6 @@ int tsmf_window_resize(TSMFGstreamerDecoder* decoder, int x, int y, int width, i
#if defined(WITH_XEXT)
if (hdl->has_shape)
{
int i;
XRectangle* xrects = NULL;
if (nr_rects == 0)
@ -402,7 +401,7 @@ int tsmf_window_resize(TSMFGstreamerDecoder* decoder, int x, int y, int width, i
if (xrects)
{
for (i = 0; i < nr_rects; i++)
for (int i = 0; i < nr_rects; i++)
{
xrects[i].x = rects[i].x - x;
xrects[i].y = rects[i].y - y;

View File

@ -488,7 +488,6 @@ BOOL tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, wStream* s)
{
UINT32 cbFormat = 0;
BOOL ret = TRUE;
int i = 0;
ZeroMemory(mediatype, sizeof(TS_AM_MEDIA_TYPE));
@ -498,7 +497,8 @@ BOOL tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, wStream* s)
return FALSE;
tsmf_print_guid(Stream_Pointer(s));
for (i = 0; tsmf_major_type_map[i].type != TSMF_MAJOR_TYPE_UNKNOWN; i++)
size_t i = 0;
for (; tsmf_major_type_map[i].type != TSMF_MAJOR_TYPE_UNKNOWN; i++)
{
if (memcmp(tsmf_major_type_map[i].guid, Stream_Pointer(s), 16) == 0)
break;

View File

@ -68,7 +68,6 @@ UINT tsmf_ifman_rim_exchange_capability_request(TSMF_IFMAN* ifman)
*/
UINT tsmf_ifman_exchange_capability_request(TSMF_IFMAN* ifman)
{
UINT32 i = 0;
UINT32 v = 0;
UINT32 pos = 0;
UINT32 CapabilityType = 0;
@ -91,7 +90,7 @@ UINT tsmf_ifman_exchange_capability_request(TSMF_IFMAN* ifman)
Stream_Read_UINT32(ifman->output, numHostCapabilities);
for (i = 0; i < numHostCapabilities; i++)
for (UINT32 i = 0; i < numHostCapabilities; i++)
{
if (!Stream_CheckAndLogRequiredLength(TAG, ifman->output, 8))
return ERROR_INVALID_DATA;
@ -516,7 +515,7 @@ UINT tsmf_ifman_update_geometry_info(TSMF_IFMAN* ifman)
{
rects = (RDP_RECT*)calloc(num_rects, sizeof(RDP_RECT));
for (i = 0; i < num_rects; i++)
for (UINT32 i = 0; i < num_rects; i++)
{
Stream_Read_UINT16(ifman->input, rects[i].y); /* Top */
Stream_Seek_UINT16(ifman->input);

View File

@ -166,7 +166,6 @@ static UINT64 get_current_time(void)
static TSMF_SAMPLE* tsmf_stream_pop_sample(TSMF_STREAM* stream, int sync)
{
UINT32 index = 0;
UINT32 count = 0;
TSMF_STREAM* s = NULL;
TSMF_SAMPLE* sample = NULL;
@ -199,7 +198,7 @@ static TSMF_SAMPLE* tsmf_stream_pop_sample(TSMF_STREAM* stream, int sync)
ArrayList_Lock(presentation->stream_list);
count = ArrayList_Count(presentation->stream_list);
for (index = 0; index < count; index++)
for (UINT32 index = 0; index < count; index++)
{
s = (TSMF_STREAM*)ArrayList_GetItem(presentation->stream_list, index);
@ -381,12 +380,10 @@ error_stream_list:
static char* guid_to_string(const BYTE* guid, char* str, size_t len)
{
size_t i = 0;
if (!guid || !str)
return NULL;
for (i = 0; i < GUID_SIZE && (len > 2 * i); i++)
for (size_t i = 0; i < GUID_SIZE && (len > 2 * i); i++)
sprintf_s(str + (2 * i), len - 2 * i, "%02" PRIX8 "", guid[i]);
return str;
@ -394,7 +391,6 @@ static char* guid_to_string(const BYTE* guid, char* str, size_t len)
TSMF_PRESENTATION* tsmf_presentation_find_by_id(const BYTE* guid)
{
UINT32 index = 0;
UINT32 count = 0;
BOOL found = FALSE;
char guid_str[GUID_SIZE * 2 + 1] = { 0 };
@ -402,7 +398,7 @@ TSMF_PRESENTATION* tsmf_presentation_find_by_id(const BYTE* guid)
ArrayList_Lock(presentation_list);
count = ArrayList_Count(presentation_list);
for (index = 0; index < count; index++)
for (size_t index = 0; index < count; index++)
{
presentation = (TSMF_PRESENTATION*)ArrayList_GetItem(presentation_list, index);
@ -579,9 +575,8 @@ static BOOL tsmf_sample_playback(TSMF_SAMPLE* sample)
TSMF_PRESENTATION* presentation = stream->presentation;
ArrayList_Lock(presentation->stream_list);
int count = ArrayList_Count(presentation->stream_list);
int index = 0;
for (index = 0; index < count; index++)
for (size_t index = 0; index < count; index++)
{
UINT64 time_diff = 0;
temp_stream = (TSMF_STREAM*)ArrayList_GetItem(presentation->stream_list, index);
@ -971,16 +966,14 @@ static BOOL tsmf_stream_change_volume(TSMF_STREAM* stream, UINT32 newVolume, UIN
BOOL tsmf_presentation_volume_changed(TSMF_PRESENTATION* presentation, UINT32 newVolume,
UINT32 muted)
{
UINT32 index = 0;
UINT32 count = 0;
TSMF_STREAM* stream = NULL;
BOOL ret = TRUE;
presentation->volume = newVolume;
presentation->muted = muted;
ArrayList_Lock(presentation->stream_list);
count = ArrayList_Count(presentation->stream_list);
size_t count = ArrayList_Count(presentation->stream_list);
for (index = 0; index < count; index++)
for (size_t index = 0; index < count; index++)
{
stream = (TSMF_STREAM*)ArrayList_GetItem(presentation->stream_list, index);
ret &= tsmf_stream_change_volume(stream, newVolume, muted);
@ -992,14 +985,12 @@ BOOL tsmf_presentation_volume_changed(TSMF_PRESENTATION* presentation, UINT32 ne
BOOL tsmf_presentation_paused(TSMF_PRESENTATION* presentation)
{
UINT32 index = 0;
UINT32 count = 0;
TSMF_STREAM* stream = NULL;
BOOL ret = TRUE;
ArrayList_Lock(presentation->stream_list);
count = ArrayList_Count(presentation->stream_list);
size_t count = ArrayList_Count(presentation->stream_list);
for (index = 0; index < count; index++)
for (size_t index = 0; index < count; index++)
{
stream = (TSMF_STREAM*)ArrayList_GetItem(presentation->stream_list, index);
ret &= tsmf_stream_pause(stream);
@ -1011,14 +1002,12 @@ BOOL tsmf_presentation_paused(TSMF_PRESENTATION* presentation)
BOOL tsmf_presentation_restarted(TSMF_PRESENTATION* presentation)
{
UINT32 index = 0;
UINT32 count = 0;
TSMF_STREAM* stream = NULL;
BOOL ret = TRUE;
ArrayList_Lock(presentation->stream_list);
count = ArrayList_Count(presentation->stream_list);
size_t count = ArrayList_Count(presentation->stream_list);
for (index = 0; index < count; index++)
for (size_t index = 0; index < count; index++)
{
stream = (TSMF_STREAM*)ArrayList_GetItem(presentation->stream_list, index);
ret &= tsmf_stream_restart(stream);
@ -1030,14 +1019,12 @@ BOOL tsmf_presentation_restarted(TSMF_PRESENTATION* presentation)
BOOL tsmf_presentation_start(TSMF_PRESENTATION* presentation)
{
UINT32 index = 0;
UINT32 count = 0;
TSMF_STREAM* stream = NULL;
BOOL ret = TRUE;
ArrayList_Lock(presentation->stream_list);
count = ArrayList_Count(presentation->stream_list);
size_t count = ArrayList_Count(presentation->stream_list);
for (index = 0; index < count; index++)
for (size_t index = 0; index < count; index++)
{
stream = (TSMF_STREAM*)ArrayList_GetItem(presentation->stream_list, index);
ret &= tsmf_stream_start(stream);
@ -1054,13 +1041,11 @@ BOOL tsmf_presentation_start(TSMF_PRESENTATION* presentation)
*/
UINT tsmf_presentation_sync(TSMF_PRESENTATION* presentation)
{
UINT32 index = 0;
UINT32 count = 0;
UINT error = 0;
ArrayList_Lock(presentation->stream_list);
count = ArrayList_Count(presentation->stream_list);
size_t count = ArrayList_Count(presentation->stream_list);
for (index = 0; index < count; index++)
for (size_t index = 0; index < count; index++)
{
TSMF_STREAM* stream = (TSMF_STREAM*)ArrayList_GetItem(presentation->stream_list, index);
@ -1078,14 +1063,12 @@ UINT tsmf_presentation_sync(TSMF_PRESENTATION* presentation)
BOOL tsmf_presentation_stop(TSMF_PRESENTATION* presentation)
{
UINT32 index = 0;
UINT32 count = 0;
TSMF_STREAM* stream = NULL;
BOOL ret = TRUE;
ArrayList_Lock(presentation->stream_list);
count = ArrayList_Count(presentation->stream_list);
size_t count = ArrayList_Count(presentation->stream_list);
for (index = 0; index < count; index++)
for (size_t index = 0; index < count; index++)
{
stream = (TSMF_STREAM*)ArrayList_GetItem(presentation->stream_list, index);
ret &= tsmf_stream_stop(stream);
@ -1101,8 +1084,6 @@ BOOL tsmf_presentation_set_geometry_info(TSMF_PRESENTATION* presentation, UINT32
UINT32 width, UINT32 height, int num_rects,
RDP_RECT* rects)
{
UINT32 index = 0;
UINT32 count = 0;
TSMF_STREAM* stream = NULL;
void* tmp_rects = NULL;
BOOL ret = TRUE;
@ -1131,9 +1112,9 @@ BOOL tsmf_presentation_set_geometry_info(TSMF_PRESENTATION* presentation, UINT32
if (presentation->rects)
CopyMemory(presentation->rects, rects, sizeof(RDP_RECT) * num_rects);
ArrayList_Lock(presentation->stream_list);
count = ArrayList_Count(presentation->stream_list);
size_t count = ArrayList_Count(presentation->stream_list);
for (index = 0; index < count; index++)
for (size_t index = 0; index < count; index++)
{
stream = (TSMF_STREAM*)ArrayList_GetItem(presentation->stream_list, index);
@ -1313,14 +1294,12 @@ void tsmf_stream_start_threads(TSMF_STREAM* stream)
TSMF_STREAM* tsmf_stream_find_by_id(TSMF_PRESENTATION* presentation, UINT32 stream_id)
{
UINT32 index = 0;
UINT32 count = 0;
BOOL found = FALSE;
TSMF_STREAM* stream = NULL;
ArrayList_Lock(presentation->stream_list);
count = ArrayList_Count(presentation->stream_list);
size_t count = ArrayList_Count(presentation->stream_list);
for (index = 0; index < count; index++)
for (size_t index = 0; index < count; index++)
{
stream = (TSMF_STREAM*)ArrayList_GetItem(presentation->stream_list, index);

View File

@ -399,13 +399,12 @@ static UINT urbdrc_process_query_device_text(IUDEVICE* pdev, GENERIC_CHANNEL_CAL
static void func_select_all_interface_for_msconfig(IUDEVICE* pdev,
MSUSB_CONFIG_DESCRIPTOR* MsConfig)
{
UINT32 inum = 0;
MSUSB_INTERFACE_DESCRIPTOR** MsInterfaces = MsConfig->MsInterfaces;
BYTE InterfaceNumber = 0;
BYTE AlternateSetting = 0;
UINT32 NumInterfaces = MsConfig->NumInterfaces;
for (inum = 0; inum < NumInterfaces; inum++)
for (UINT32 inum = 0; inum < NumInterfaces; inum++)
{
InterfaceNumber = MsInterfaces[inum]->InterfaceNumber;
AlternateSetting = MsInterfaces[inum]->AlternateSetting;

View File

@ -84,12 +84,11 @@ static void request_free(void* value);
static struct libusb_transfer* list_contains(wArrayList* list, UINT32 streamID)
{
size_t x = 0;
size_t count = 0;
if (!list)
return NULL;
count = ArrayList_Count(list);
for (x = 0; x < count; x++)
for (size_t x = 0; x < count; x++)
{
struct libusb_transfer* transfer = ArrayList_GetItem(list, x);
@ -261,13 +260,12 @@ static void LIBUSB_CALL func_iso_callback(struct libusb_transfer* transfer)
{
case LIBUSB_TRANSFER_COMPLETED:
{
int i = 0;
UINT32 index = 0;
BYTE* dataStart = Stream_Pointer(user_data->data);
Stream_SetPosition(user_data->data,
40); /* TS_URB_ISOCH_TRANSFER_RESULT IsoPacket offset */
for (i = 0; i < transfer->num_iso_packets; i++)
for (int i = 0; i < transfer->num_iso_packets; i++)
{
const UINT32 act_len = transfer->iso_packet_desc[i].actual_length;
Stream_Write_UINT32(user_data->data, index);
@ -328,21 +326,15 @@ static const LIBUSB_ENDPOINT_DESCEIPTOR* func_get_ep_desc(LIBUSB_CONFIG_DESCRIPT
MSUSB_CONFIG_DESCRIPTOR* MsConfig,
UINT32 EndpointAddress)
{
BYTE alt = 0;
UINT32 inum = 0;
UINT32 pnum = 0;
MSUSB_INTERFACE_DESCRIPTOR** MsInterfaces = NULL;
const LIBUSB_INTERFACE* interface = NULL;
const LIBUSB_ENDPOINT_DESCEIPTOR* endpoint = NULL;
MsInterfaces = MsConfig->MsInterfaces;
interface = LibusbConfig->interface;
MSUSB_INTERFACE_DESCRIPTOR** MsInterfaces = MsConfig->MsInterfaces;
const LIBUSB_INTERFACE* interface = LibusbConfig->interface;
for (inum = 0; inum < MsConfig->NumInterfaces; inum++)
for (UINT32 inum = 0; inum < MsConfig->NumInterfaces; inum++)
{
alt = MsInterfaces[inum]->AlternateSetting;
endpoint = interface[inum].altsetting[alt].endpoint;
BYTE alt = MsInterfaces[inum]->AlternateSetting;
const LIBUSB_ENDPOINT_DESCEIPTOR* endpoint = interface[inum].altsetting[alt].endpoint;
for (pnum = 0; pnum < MsInterfaces[inum]->NumberOfPipes; pnum++)
for (UINT32 pnum = 0; pnum < MsInterfaces[inum]->NumberOfPipes; pnum++)
{
if (endpoint[pnum].bEndpointAddress == EndpointAddress)
{
@ -469,9 +461,7 @@ static int func_config_release_all_interface(URBDRC_PLUGIN* urbdrc,
LIBUSB_DEVICE_HANDLE* libusb_handle,
UINT32 NumInterfaces)
{
UINT32 i = 0;
for (i = 0; i < NumInterfaces; i++)
for (UINT32 i = 0; i < NumInterfaces; i++)
{
int ret = libusb_release_interface(libusb_handle, i);
@ -485,10 +475,9 @@ static int func_config_release_all_interface(URBDRC_PLUGIN* urbdrc,
static int func_claim_all_interface(URBDRC_PLUGIN* urbdrc, LIBUSB_DEVICE_HANDLE* libusb_handle,
int NumInterfaces)
{
int i = 0;
int ret = 0;
for (i = 0; i < NumInterfaces; i++)
for (int i = 0; i < NumInterfaces; i++)
{
ret = libusb_claim_interface(libusb_handle, i);
@ -502,12 +491,11 @@ static int func_claim_all_interface(URBDRC_PLUGIN* urbdrc, LIBUSB_DEVICE_HANDLE*
static LIBUSB_DEVICE* udev_get_libusb_dev(libusb_context* context, uint8_t bus_number,
uint8_t dev_number)
{
ssize_t i = 0;
LIBUSB_DEVICE** libusb_list = NULL;
LIBUSB_DEVICE* device = NULL;
const ssize_t total_device = libusb_get_device_list(context, &libusb_list);
for (i = 0; i < total_device; i++)
for (ssize_t i = 0; i < total_device; i++)
{
LIBUSB_DEVICE* dev = libusb_list[i];
if ((bus_number == libusb_get_bus_number(dev)) &&
@ -599,8 +587,6 @@ libusb_udev_complete_msconfig_setup(IUDEVICE* idev, MSUSB_CONFIG_DESCRIPTOR* MsC
const LIBUSB_ENDPOINT_DESCEIPTOR* LibusbEndpoint = NULL;
BYTE LibusbNumEndpoint = 0;
URBDRC_PLUGIN* urbdrc = NULL;
UINT32 inum = 0;
UINT32 pnum = 0;
UINT32 MsOutSize = 0;
if (!pdev || !pdev->LibusbConfig || !pdev->urbdrc || !MsConfig)
@ -620,7 +606,7 @@ libusb_udev_complete_msconfig_setup(IUDEVICE* idev, MSUSB_CONFIG_DESCRIPTOR* MsC
/* replace MsPipes for libusb */
MsInterfaces = MsConfig->MsInterfaces;
for (inum = 0; inum < MsConfig->NumInterfaces; inum++)
for (UINT32 inum = 0; inum < MsConfig->NumInterfaces; inum++)
{
MsInterface = MsInterfaces[inum];
/* get libusb's number of endpoints */
@ -630,7 +616,7 @@ libusb_udev_complete_msconfig_setup(IUDEVICE* idev, MSUSB_CONFIG_DESCRIPTOR* MsC
t_MsPipes =
(MSUSB_PIPE_DESCRIPTOR**)calloc(LibusbNumEndpoint, sizeof(MSUSB_PIPE_DESCRIPTOR*));
for (pnum = 0; pnum < LibusbNumEndpoint; pnum++)
for (UINT32 pnum = 0; pnum < LibusbNumEndpoint; pnum++)
{
t_MsPipe = (MSUSB_PIPE_DESCRIPTOR*)calloc(1, sizeof(MSUSB_PIPE_DESCRIPTOR));
@ -671,7 +657,7 @@ libusb_udev_complete_msconfig_setup(IUDEVICE* idev, MSUSB_CONFIG_DESCRIPTOR* MsC
MsConfig->bConfigurationValue | (pdev->bus_number << 24) | (pdev->dev_number << 16);
MsInterfaces = MsConfig->MsInterfaces;
for (inum = 0; inum < MsConfig->NumInterfaces; inum++)
for (UINT32 inum = 0; inum < MsConfig->NumInterfaces; inum++)
{
MsOutSize += 16;
MsInterface = MsInterfaces[inum];
@ -695,7 +681,7 @@ libusb_udev_complete_msconfig_setup(IUDEVICE* idev, MSUSB_CONFIG_DESCRIPTOR* MsC
MsPipes = MsInterface->MsPipes;
LibusbNumEndpoint = LibusbAltsetting->bNumEndpoints;
for (pnum = 0; pnum < LibusbNumEndpoint; pnum++)
for (UINT32 pnum = 0; pnum < LibusbNumEndpoint; pnum++)
{
MsOutSize += 20;
MsPipe = MsPipes[pnum];
@ -837,7 +823,6 @@ static UINT32 libusb_udev_control_query_device_text(IUDEVICE* idev, UINT32 TextT
BYTE bus_number = 0;
BYTE device_address = 0;
int ret = 0;
size_t i = 0;
size_t len = 0;
URBDRC_PLUGIN* urbdrc = NULL;
WCHAR* text = (WCHAR*)Buffer;
@ -879,7 +864,7 @@ static UINT32 libusb_udev_control_query_device_text(IUDEVICE* idev, UINT32 TextT
msg, ret, devDescriptor->iProduct);
len = MIN(sizeof(strDesc), inSize);
for (i = 0; i < len; i++)
for (ssize_t i = 0; i < len; i++)
text[i] = (WCHAR)strDesc[i];
*BufferSize = (BYTE)(len * 2);
@ -914,7 +899,7 @@ static UINT32 libusb_udev_control_query_device_text(IUDEVICE* idev, UINT32 TextT
len = strnlen(deviceLocation,
MIN(sizeof(deviceLocation), (inSize > 0) ? inSize - 1U : 0));
for (i = 0; i < len; i++)
for (ssize_t i = 0; i < len; i++)
text[i] = (WCHAR)deviceLocation[i];
text[len++] = '\0';
*BufferSize = (UINT8)(len * sizeof(WCHAR));
@ -1030,7 +1015,6 @@ static int libusb_udev_query_device_descriptor(IUDEVICE* idev, int offset)
static BOOL libusb_udev_detach_kernel_driver(IUDEVICE* idev)
{
int i = 0;
int err = 0;
UDEVICE* pdev = (UDEVICE*)idev;
URBDRC_PLUGIN* urbdrc = NULL;
@ -1045,7 +1029,7 @@ static BOOL libusb_udev_detach_kernel_driver(IUDEVICE* idev)
if ((pdev->status & URBDRC_DEVICE_DETACH_KERNEL) == 0)
{
for (i = 0; i < pdev->LibusbConfig->bNumInterfaces; i++)
for (int i = 0; i < pdev->LibusbConfig->bNumInterfaces; i++)
{
err = libusb_kernel_driver_active(pdev->libusb_handle, i);
log_libusb_result(urbdrc->log, WLOG_DEBUG, "libusb_kernel_driver_active", err);
@ -1066,14 +1050,13 @@ static BOOL libusb_udev_detach_kernel_driver(IUDEVICE* idev)
static BOOL libusb_udev_attach_kernel_driver(IUDEVICE* idev)
{
int i = 0;
int err = 0;
UDEVICE* pdev = (UDEVICE*)idev;
if (!pdev || !pdev->LibusbConfig || !pdev->libusb_handle || !pdev->urbdrc)
return FALSE;
for (i = 0; i < pdev->LibusbConfig->bNumInterfaces && err != LIBUSB_ERROR_NO_DEVICE; i++)
for (int i = 0; i < pdev->LibusbConfig->bNumInterfaces && err != LIBUSB_ERROR_NO_DEVICE; i++)
{
err = libusb_release_interface(pdev->libusb_handle, i);
@ -1429,7 +1412,6 @@ static void libusb_udev_cancel_all_transfer_request(IUDEVICE* idev)
{
UDEVICE* pdev = (UDEVICE*)idev;
size_t count = 0;
size_t x = 0;
if (!pdev || !pdev->request_queue || !pdev->urbdrc)
return;
@ -1437,7 +1419,7 @@ static void libusb_udev_cancel_all_transfer_request(IUDEVICE* idev)
ArrayList_Lock(pdev->request_queue);
count = ArrayList_Count(pdev->request_queue);
for (x = 0; x < count; x++)
for (size_t x = 0; x < count; x++)
{
struct libusb_transfer* transfer = ArrayList_GetItem(pdev->request_queue, x);
func_cancel_xact_request(pdev->urbdrc, transfer);
@ -1588,7 +1570,6 @@ static int udev_get_device_handle(URBDRC_PLUGIN* urbdrc, libusb_context* ctx, UD
UINT16 bus_number, UINT16 dev_number)
{
int error = -1;
ssize_t i = 0;
uint8_t port_numbers[16] = { 0 };
LIBUSB_DEVICE** libusb_list = NULL;
const ssize_t total_device = libusb_get_device_list(ctx, &libusb_list);
@ -1596,7 +1577,7 @@ static int udev_get_device_handle(URBDRC_PLUGIN* urbdrc, libusb_context* ctx, UD
WINPR_ASSERT(urbdrc);
/* Look for device. */
for (i = 0; i < total_device; i++)
for (ssize_t i = 0; i < total_device; i++)
{
LIBUSB_DEVICE* dev = libusb_list[i];
@ -1643,7 +1624,6 @@ static int udev_get_hub_handle(URBDRC_PLUGIN* urbdrc, libusb_context* ctx, UDEVI
UINT16 bus_number, UINT16 dev_number)
{
int error = -1;
ssize_t i = 0;
LIBUSB_DEVICE** libusb_list = NULL;
LIBUSB_DEVICE_HANDLE* handle = NULL;
const ssize_t total_device = libusb_get_device_list(ctx, &libusb_list);
@ -1651,7 +1631,7 @@ static int udev_get_hub_handle(URBDRC_PLUGIN* urbdrc, libusb_context* ctx, UDEVI
WINPR_ASSERT(urbdrc);
/* Look for device hub. */
for (i = 0; i < total_device; i++)
for (ssize_t i = 0; i < total_device; i++)
{
LIBUSB_DEVICE* dev = libusb_list[i];
@ -1811,7 +1791,6 @@ size_t udev_new_by_id(URBDRC_PLUGIN* urbdrc, libusb_context* ctx, UINT16 idVendo
{
LIBUSB_DEVICE** libusb_list = NULL;
UDEVICE** array = NULL;
ssize_t i = 0;
ssize_t total_device = 0;
size_t num = 0;
@ -1829,7 +1808,7 @@ size_t udev_new_by_id(URBDRC_PLUGIN* urbdrc, libusb_context* ctx, UINT16 idVendo
if (!array)
goto fail;
for (i = 0; i < total_device; i++)
for (ssize_t i = 0; i < total_device; i++)
{
LIBUSB_DEVICE* dev = libusb_list[i];
LIBUSB_DEVICE_DESCRIPTOR* descriptor = udev_new_descript(urbdrc, dev);

View File

@ -145,7 +145,6 @@ static size_t udevman_register_udevice(IUDEVMAN* idevman, BYTE bus_number, BYTE
IUDEVICE* pdev = NULL;
IUDEVICE** devArray = NULL;
URBDRC_PLUGIN* urbdrc = NULL;
size_t i = 0;
size_t num = 0;
size_t addnum = 0;
@ -200,7 +199,7 @@ static size_t udevman_register_udevice(IUDEVMAN* idevman, BYTE bus_number, BYTE
idProduct);
}
for (i = 0; i < num; i++)
for (size_t i = 0; i < num; i++)
{
UINT32 id = 0;
IUDEVICE* tdev = devArray[i];
@ -532,13 +531,10 @@ static BOOL device_is_filtered(struct libusb_device* dev,
int rc = libusb_get_active_config_descriptor(dev, &config);
if (rc == LIBUSB_SUCCESS)
{
uint8_t x = 0;
for (x = 0; x < config->bNumInterfaces; x++)
for (uint8_t x = 0; x < config->bNumInterfaces; x++)
{
int y = 0;
const struct libusb_interface* ifc = &config->interface[x];
for (y = 0; y < ifc->num_altsetting; y++)
for (int y = 0; y < ifc->num_altsetting; y++)
{
const struct libusb_interface_descriptor* const alt = &ifc->altsetting[y];
if (filter_by_class(alt->bInterfaceClass, alt->bInterfaceSubClass))
@ -718,10 +714,9 @@ static BOOL urbdrc_udevman_register_devices(UDEVMAN* udevman, const char* device
static UINT urbdrc_udevman_parse_addin_args(UDEVMAN* udevman, const ADDIN_ARGV* args)
{
int x = 0;
LPCSTR devices = NULL;
for (x = 0; x < args->argc; x++)
for (int x = 0; x < args->argc; x++)
{
const char* arg = args->argv[x];
if (strcmp(arg, "dbg") == 0)

View File

@ -34,11 +34,9 @@ static MSUSB_PIPE_DESCRIPTOR* msusb_mspipe_new(void)
static void msusb_mspipes_free(MSUSB_PIPE_DESCRIPTOR** MsPipes, UINT32 NumberOfPipes)
{
UINT32 pnum = 0;
if (MsPipes)
{
for (pnum = 0; pnum < NumberOfPipes && MsPipes[pnum]; pnum++)
for (UINT32 pnum = 0; pnum < NumberOfPipes && MsPipes[pnum]; pnum++)
free(MsPipes[pnum]);
free(MsPipes);
@ -61,7 +59,6 @@ BOOL msusb_mspipes_replace(MSUSB_INTERFACE_DESCRIPTOR* MsInterface,
static MSUSB_PIPE_DESCRIPTOR** msusb_mspipes_read(wStream* s, UINT32 NumberOfPipes)
{
UINT32 pnum = 0;
MSUSB_PIPE_DESCRIPTOR** MsPipes = NULL;
if (!Stream_CheckAndLogRequiredCapacityOfSize(TAG, (s), NumberOfPipes, 12ull))
@ -72,7 +69,7 @@ static MSUSB_PIPE_DESCRIPTOR** msusb_mspipes_read(wStream* s, UINT32 NumberOfPip
if (!MsPipes)
return NULL;
for (pnum = 0; pnum < NumberOfPipes; pnum++)
for (UINT32 pnum = 0; pnum < NumberOfPipes; pnum++)
{
MSUSB_PIPE_DESCRIPTOR* MsPipe = msusb_mspipe_new();
@ -96,7 +93,7 @@ static MSUSB_PIPE_DESCRIPTOR** msusb_mspipes_read(wStream* s, UINT32 NumberOfPip
return MsPipes;
out_error:
for (pnum = 0; pnum < NumberOfPipes; pnum++)
for (UINT32 pnum = 0; pnum < NumberOfPipes; pnum++)
free(MsPipes[pnum]);
free(MsPipes);
@ -121,11 +118,9 @@ void msusb_msinterface_free(MSUSB_INTERFACE_DESCRIPTOR* MsInterface)
static void msusb_msinterface_free_list(MSUSB_INTERFACE_DESCRIPTOR** MsInterfaces,
UINT32 NumInterfaces)
{
UINT32 inum = 0;
if (MsInterfaces)
{
for (inum = 0; inum < NumInterfaces; inum++)
for (UINT32 inum = 0; inum < NumInterfaces; inum++)
{
msusb_msinterface_free(MsInterfaces[inum]);
}
@ -188,7 +183,6 @@ BOOL msusb_msinterface_write(MSUSB_INTERFACE_DESCRIPTOR* MsInterface, wStream* o
{
MSUSB_PIPE_DESCRIPTOR** MsPipes = NULL;
MSUSB_PIPE_DESCRIPTOR* MsPipe = NULL;
UINT32 pnum = 0;
if (!MsInterface)
return FALSE;
@ -217,7 +211,7 @@ BOOL msusb_msinterface_write(MSUSB_INTERFACE_DESCRIPTOR* MsInterface, wStream* o
/* Pipes */
MsPipes = MsInterface->MsPipes;
for (pnum = 0; pnum < MsInterface->NumberOfPipes; pnum++)
for (UINT32 pnum = 0; pnum < MsInterface->NumberOfPipes; pnum++)
{
MsPipe = MsPipes[pnum];
/* MaximumPacketSize */
@ -241,7 +235,6 @@ BOOL msusb_msinterface_write(MSUSB_INTERFACE_DESCRIPTOR* MsInterface, wStream* o
static MSUSB_INTERFACE_DESCRIPTOR** msusb_msinterface_read_list(wStream* s, UINT32 NumInterfaces)
{
UINT32 inum = 0;
MSUSB_INTERFACE_DESCRIPTOR** MsInterfaces = NULL;
MsInterfaces =
(MSUSB_INTERFACE_DESCRIPTOR**)calloc(NumInterfaces, sizeof(MSUSB_INTERFACE_DESCRIPTOR*));
@ -249,7 +242,7 @@ static MSUSB_INTERFACE_DESCRIPTOR** msusb_msinterface_read_list(wStream* s, UINT
if (!MsInterfaces)
return NULL;
for (inum = 0; inum < NumInterfaces; inum++)
for (UINT32 inum = 0; inum < NumInterfaces; inum++)
{
MsInterfaces[inum] = msusb_msinterface_read(s);
@ -260,7 +253,7 @@ static MSUSB_INTERFACE_DESCRIPTOR** msusb_msinterface_read_list(wStream* s, UINT
return MsInterfaces;
fail:
for (inum = 0; inum < NumInterfaces; inum++)
for (UINT32 inum = 0; inum < NumInterfaces; inum++)
msusb_msinterface_free(MsInterfaces[inum]);
free(MsInterfaces);
@ -269,7 +262,6 @@ fail:
BOOL msusb_msconfig_write(MSUSB_CONFIG_DESCRIPTOR* MsConfg, wStream* out)
{
UINT32 inum = 0;
MSUSB_INTERFACE_DESCRIPTOR** MsInterfaces = NULL;
MSUSB_INTERFACE_DESCRIPTOR* MsInterface = NULL;
@ -286,7 +278,7 @@ BOOL msusb_msconfig_write(MSUSB_CONFIG_DESCRIPTOR* MsConfg, wStream* out)
/* Interfaces */
MsInterfaces = MsConfg->MsInterfaces;
for (inum = 0; inum < MsConfg->NumInterfaces; inum++)
for (UINT32 inum = 0; inum < MsConfg->NumInterfaces; inum++)
{
MsInterface = MsInterfaces[inum];
@ -357,8 +349,7 @@ void msusb_msconfig_dump(MSUSB_CONFIG_DESCRIPTOR* MsConfig)
MSUSB_INTERFACE_DESCRIPTOR* MsInterface = NULL;
MSUSB_PIPE_DESCRIPTOR** MsPipes = NULL;
MSUSB_PIPE_DESCRIPTOR* MsPipe = NULL;
UINT32 inum = 0;
UINT32 pnum = 0;
WLog_INFO(TAG, "=================MsConfig:========================");
WLog_INFO(TAG, "wTotalLength:%" PRIu16 "", MsConfig->wTotalLength);
WLog_INFO(TAG, "bConfigurationValue:%" PRIu8 "", MsConfig->bConfigurationValue);
@ -368,7 +359,7 @@ void msusb_msconfig_dump(MSUSB_CONFIG_DESCRIPTOR* MsConfig)
WLog_INFO(TAG, "NumInterfaces:%" PRIu32 "", MsConfig->NumInterfaces);
MsInterfaces = MsConfig->MsInterfaces;
for (inum = 0; inum < MsConfig->NumInterfaces; inum++)
for (UINT32 inum = 0; inum < MsConfig->NumInterfaces; inum++)
{
MsInterface = MsInterfaces[inum];
WLog_INFO(TAG, " Interface: %" PRIu8 "", MsInterface->InterfaceNumber);
@ -384,7 +375,7 @@ void msusb_msconfig_dump(MSUSB_CONFIG_DESCRIPTOR* MsConfig)
WLog_INFO(TAG, " InitCompleted: %d", MsInterface->InitCompleted);
MsPipes = MsInterface->MsPipes;
for (pnum = 0; pnum < MsInterface->NumberOfPipes; pnum++)
for (UINT32 pnum = 0; pnum < MsInterface->NumberOfPipes; pnum++)
{
MsPipe = MsPipes[pnum];
WLog_INFO(TAG, " Pipe: %" PRIu32, pnum);

View File

@ -36,7 +36,6 @@
UINT android_cliprdr_send_client_format_list(CliprdrClientContext* cliprdr)
{
UINT rc = ERROR_INTERNAL_ERROR;
UINT32 index;
UINT32 formatId;
UINT32 numFormats;
UINT32* pFormatIds;
@ -59,7 +58,7 @@ UINT android_cliprdr_send_client_format_list(CliprdrClientContext* cliprdr)
if (!formats)
goto fail;
for (index = 0; index < numFormats; index++)
for (UINT32 index = 0; index < numFormats; index++)
{
formatId = pFormatIds[index];
formatName = ClipboardGetFormatName(afc->clipboard, formatId);
@ -169,7 +168,6 @@ static UINT android_cliprdr_monitor_ready(CliprdrClientContext* cliprdr,
static UINT android_cliprdr_server_capabilities(CliprdrClientContext* cliprdr,
const CLIPRDR_CAPABILITIES* capabilities)
{
UINT32 index;
CLIPRDR_CAPABILITY_SET* capabilitySet;
androidContext* afc;
@ -181,7 +179,7 @@ static UINT android_cliprdr_server_capabilities(CliprdrClientContext* cliprdr,
if (!afc)
return ERROR_INVALID_PARAMETER;
for (index = 0; index < capabilities->cCapabilitiesSets; index++)
for (UINT32 index = 0; index < capabilities->cCapabilitiesSets; index++)
{
capabilitySet = &(capabilities->capabilitySets[index]);
@ -207,7 +205,6 @@ static UINT android_cliprdr_server_format_list(CliprdrClientContext* cliprdr,
const CLIPRDR_FORMAT_LIST* formatList)
{
UINT rc;
UINT32 index;
CLIPRDR_FORMAT* format;
androidContext* afc;
@ -221,7 +218,7 @@ static UINT android_cliprdr_server_format_list(CliprdrClientContext* cliprdr,
if (afc->serverFormats)
{
for (index = 0; index < afc->numServerFormats; index++)
for (UINT32 index = 0; index < afc->numServerFormats; index++)
free(afc->serverFormats[index].formatName);
free(afc->serverFormats);
@ -238,7 +235,7 @@ static UINT android_cliprdr_server_format_list(CliprdrClientContext* cliprdr,
if (!afc->serverFormats)
return CHANNEL_RC_NO_MEMORY;
for (index = 0; index < afc->numServerFormats; index++)
for (UINT32 index = 0; index < afc->numServerFormats; index++)
{
afc->serverFormats[index].formatId = formatList->formats[index].formatId;
afc->serverFormats[index].formatName = NULL;
@ -252,7 +249,7 @@ static UINT android_cliprdr_server_format_list(CliprdrClientContext* cliprdr,
}
}
for (index = 0; index < afc->numServerFormats; index++)
for (UINT32 index = 0; index < afc->numServerFormats; index++)
{
format = &(afc->serverFormats[index]);
@ -374,7 +371,6 @@ android_cliprdr_server_format_data_response(CliprdrClientContext* cliprdr,
{
BYTE* data;
UINT32 size;
UINT32 index;
UINT32 formatId;
CLIPRDR_FORMAT* format = NULL;
androidContext* afc;
@ -393,7 +389,7 @@ android_cliprdr_server_format_data_response(CliprdrClientContext* cliprdr,
if (!instance)
return ERROR_INVALID_PARAMETER;
for (index = 0; index < afc->numServerFormats; index++)
for (UINT32 index = 0; index < afc->numServerFormats; index++)
{
if (afc->requestedFormatId == afc->serverFormats[index].formatId)
format = &(afc->serverFormats[index]);

View File

@ -57,7 +57,6 @@ static ANDROID_EVENT* android_peek_event(ANDROID_EVENT_QUEUE* queue)
static ANDROID_EVENT* android_pop_event(ANDROID_EVENT_QUEUE* queue)
{
int i;
ANDROID_EVENT* event;
if (queue->count < 1)
@ -66,7 +65,7 @@ static ANDROID_EVENT* android_pop_event(ANDROID_EVENT_QUEUE* queue)
event = queue->events[0];
(queue->count)--;
for (i = 0; i < queue->count; i++)
for (size_t i = 0; i < queue->count; i++)
{
queue->events[i] = queue->events[i + 1];
}

View File

@ -110,7 +110,6 @@ static BOOL android_begin_paint(rdpContext* context)
static BOOL android_end_paint(rdpContext* context)
{
int i;
HGDI_WND hwnd;
int ninvalid;
rdpGdi* gdi;
@ -152,7 +151,7 @@ static BOOL android_end_paint(rdpContext* context)
x2 = cinvalid[0].x + cinvalid[0].w;
y2 = cinvalid[0].y + cinvalid[0].h;
for (i = 0; i < ninvalid; i++)
for (int i = 0; i < ninvalid; i++)
{
x1 = MIN(x1, cinvalid[i].x);
y1 = MIN(y1, cinvalid[i].y);
@ -698,7 +697,7 @@ Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1parse_1arguments(JNIEn
jobjectArray arguments)
{
freerdp* inst = (freerdp*)instance;
int i, count;
int count;
char** argv;
DWORD status;
@ -711,7 +710,7 @@ Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1parse_1arguments(JNIEn
if (!argv)
return JNI_TRUE;
for (i = 0; i < count; i++)
for (int i = 0; i < count; i++)
{
jstring str = (jstring)(*env)->GetObjectArrayElement(env, arguments, i);
const char* raw = (*env)->GetStringUTFChars(env, str, 0);
@ -722,7 +721,7 @@ Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1parse_1arguments(JNIEn
status =
freerdp_client_settings_parse_command_line(inst->context->settings, count, argv, FALSE);
for (i = 0; i < count; i++)
for (int i = 0; i < count; i++)
free(argv[i]);
free(argv);

View File

@ -112,7 +112,6 @@ jstring jniNewStringUTF(JNIEnv* env, const char* in, int len)
jstring out = NULL;
jchar* unicode = NULL;
jint result_size = 0;
jint i;
unsigned char* utf8 = (unsigned char*)in;
if (!in)
@ -128,7 +127,7 @@ jstring jniNewStringUTF(JNIEnv* env, const char* in, int len)
return NULL;
}
for (i = 0; i < len; i++)
for (jint i = 0; i < len; i++)
{
unsigned char one = utf8[i];
switch (one >> 4)

View File

@ -23,7 +23,6 @@
int mac_cliprdr_send_client_format_list(CliprdrClientContext *cliprdr)
{
UINT32 index;
UINT32 formatId;
UINT32 numFormats;
UINT32 *pFormatIds;
@ -43,7 +42,7 @@ int mac_cliprdr_send_client_format_list(CliprdrClientContext *cliprdr)
if (!formats)
return -1;
for (index = 0; index < numFormats; index++)
for (UINT32 index = 0; index < numFormats; index++)
{
formatId = pFormatIds[index];
formatName = ClipboardGetFormatName(mfc->clipboard, formatId);
@ -62,7 +61,7 @@ int mac_cliprdr_send_client_format_list(CliprdrClientContext *cliprdr)
mfc->cliprdr->ClientFormatList(mfc->cliprdr, &formatList);
for (index = 0; index < numFormats; index++)
for (UINT32 index = 0; index < numFormats; index++)
{
free(formats[index].formatName);
}
@ -151,11 +150,10 @@ static UINT mac_cliprdr_monitor_ready(CliprdrClientContext *cliprdr,
static UINT mac_cliprdr_server_capabilities(CliprdrClientContext *cliprdr,
const CLIPRDR_CAPABILITIES *capabilities)
{
UINT32 index;
CLIPRDR_CAPABILITY_SET *capabilitySet;
mfContext *mfc = (mfContext *)cliprdr->custom;
for (index = 0; index < capabilities->cCapabilitiesSets; index++)
for (UINT32 index = 0; index < capabilities->cCapabilitiesSets; index++)
{
capabilitySet = &(capabilities->capabilitySets[index]);
@ -181,13 +179,12 @@ static UINT mac_cliprdr_server_capabilities(CliprdrClientContext *cliprdr,
static UINT mac_cliprdr_server_format_list(CliprdrClientContext *cliprdr,
const CLIPRDR_FORMAT_LIST *formatList)
{
UINT32 index;
CLIPRDR_FORMAT *format;
mfContext *mfc = (mfContext *)cliprdr->custom;
if (mfc->serverFormats)
{
for (index = 0; index < mfc->numServerFormats; index++)
for (UINT32 index = 0; index < mfc->numServerFormats; index++)
{
free(mfc->serverFormats[index].formatName);
}
@ -206,7 +203,7 @@ static UINT mac_cliprdr_server_format_list(CliprdrClientContext *cliprdr,
if (!mfc->serverFormats)
return CHANNEL_RC_NO_MEMORY;
for (index = 0; index < mfc->numServerFormats; index++)
for (UINT32 index = 0; index < mfc->numServerFormats; index++)
{
mfc->serverFormats[index].formatId = formatList->formats[index].formatId;
mfc->serverFormats[index].formatName = NULL;
@ -217,7 +214,7 @@ static UINT mac_cliprdr_server_format_list(CliprdrClientContext *cliprdr,
mac_cliprdr_send_client_format_list_response(cliprdr, TRUE);
for (index = 0; index < mfc->numServerFormats; index++)
for (UINT32 index = 0; index < mfc->numServerFormats; index++)
{
format = &(mfc->serverFormats[index]);

View File

@ -671,9 +671,7 @@ static BOOL releaseFlagStates(rdpInput *input, UINT32 aKbdModFlags)
- (void)releaseResources
{
int i;
for (i = 0; i < argc; i++)
for (int i = 0; i < argc; i++)
free(argv[i]);
if (!is_connected)

View File

@ -209,8 +209,7 @@ static const struct sdl_exit_code_map_t sdl_exit_code_map[] = {
static const struct sdl_exit_code_map_t* sdl_map_entry_by_code(int exit_code)
{
size_t x = 0;
for (x = 0; x < ARRAYSIZE(sdl_exit_code_map); x++)
for (size_t x = 0; x < ARRAYSIZE(sdl_exit_code_map); x++)
{
const struct sdl_exit_code_map_t* cur = &sdl_exit_code_map[x];
if (cur->code == exit_code)
@ -221,8 +220,7 @@ static const struct sdl_exit_code_map_t* sdl_map_entry_by_code(int exit_code)
static const struct sdl_exit_code_map_t* sdl_map_entry_by_error(DWORD error)
{
size_t x = 0;
for (x = 0; x < ARRAYSIZE(sdl_exit_code_map); x++)
for (size_t x = 0; x < ARRAYSIZE(sdl_exit_code_map); x++)
{
const struct sdl_exit_code_map_t* cur = &sdl_exit_code_map[x];
if (cur->error == error)

View File

@ -79,7 +79,6 @@ int sdl_list_monitors(SdlContext* sdl)
static BOOL sdl_is_monitor_id_active(SdlContext* sdl, UINT32 id)
{
UINT32 index = 0;
const rdpSettings* settings = nullptr;
WINPR_ASSERT(sdl);
@ -91,7 +90,7 @@ static BOOL sdl_is_monitor_id_active(SdlContext* sdl, UINT32 id)
if (!NumMonitorIds)
return TRUE;
for (index = 0; index < NumMonitorIds; index++)
for (UINT32 index = 0; index < NumMonitorIds; index++)
{
auto cur = static_cast<const UINT32*>(
freerdp_settings_get_pointer_array(settings, FreeRDP_MonitorIds, index));

View File

@ -143,9 +143,7 @@ static BOOL wlf_mime_is_file(const char* mime)
static BOOL wlf_mime_is_text(const char* mime)
{
size_t x = 0;
for (x = 0; x < ARRAYSIZE(mime_text); x++)
for (size_t x = 0; x < ARRAYSIZE(mime_text); x++)
{
if (strcmp(mime, mime_text[x]) == 0)
return TRUE;
@ -156,9 +154,7 @@ static BOOL wlf_mime_is_text(const char* mime)
static BOOL wlf_mime_is_image(const char* mime)
{
size_t x = 0;
for (x = 0; x < ARRAYSIZE(mime_image); x++)
for (size_t x = 0; x < ARRAYSIZE(mime_image); x++)
{
if (strcmp(mime, mime_image[x]) == 0)
return TRUE;
@ -682,9 +678,7 @@ static UINT wlf_cliprdr_server_format_list(CliprdrClientContext* context,
if (text)
{
size_t x = 0;
for (x = 0; x < ARRAYSIZE(mime_text); x++)
for (size_t x = 0; x < ARRAYSIZE(mime_text); x++)
UwacClipboardOfferCreate(clipboard->seat, mime_text[x]);
}

View File

@ -290,7 +290,6 @@ UINT wlf_disp_sendLayout(DispClientContext* disp, const rdpMonitor* monitors, si
{
UINT ret = CHANNEL_RC_OK;
DISPLAY_CONTROL_MONITOR_LAYOUT* layouts = NULL;
size_t i = 0;
wlfDispContext* wlfDisp = NULL;
rdpSettings* settings = NULL;
@ -310,7 +309,7 @@ UINT wlf_disp_sendLayout(DispClientContext* disp, const rdpMonitor* monitors, si
if (!layouts)
return CHANNEL_RC_NO_MEMORY;
for (i = 0; i < nmonitors; i++)
for (size_t i = 0; i < nmonitors; i++)
{
const rdpMonitor* monitor = &monitors[i];
DISPLAY_CONTROL_MONITOR_LAYOUT* layout = &layouts[i];

View File

@ -247,7 +247,6 @@ BOOL wlf_handle_pointer_frame(freerdp* instance, const UwacPointerFrameEvent* ev
{
BOOL success = TRUE;
BOOL handle = FALSE;
size_t x = 0;
wlfContext* context = NULL;
enum wl_pointer_axis_source source = WL_POINTER_AXIS_SOURCE_CONTINUOUS;
@ -256,7 +255,7 @@ BOOL wlf_handle_pointer_frame(freerdp* instance, const UwacPointerFrameEvent* ev
context = (wlfContext*)instance->context;
for (x = 0; x < ArrayList_Count(context->events); x++)
for (size_t x = 0; x < ArrayList_Count(context->events); x++)
{
UwacEvent* cev = ArrayList_GetItem(context->events, x);
if (!cev)
@ -271,7 +270,7 @@ BOOL wlf_handle_pointer_frame(freerdp* instance, const UwacPointerFrameEvent* ev
/* We need source events to determine how to interpret the data */
if (handle)
{
for (x = 0; x < ArrayList_Count(context->events); x++)
for (size_t x = 0; x < ArrayList_Count(context->events); x++)
{
UwacEvent* cev = ArrayList_GetItem(context->events, x);
if (!cev)

View File

@ -750,7 +750,6 @@ BOOL wlf_copy_image(const void* src, size_t srcStride, size_t srcWidth, size_t s
}
else
{
size_t i = 0;
const size_t baseSrcOffset = area->top * srcStride + area->left * 4;
const size_t baseDstOffset = area->top * dstStride + area->left * 4;
const size_t width = MIN((size_t)area->right - area->left, dstWidth - area->left);
@ -758,7 +757,7 @@ BOOL wlf_copy_image(const void* src, size_t srcStride, size_t srcWidth, size_t s
const BYTE* psrc = (const BYTE*)src;
BYTE* pdst = (BYTE*)dst;
for (i = 0; i < height; i++)
for (size_t i = 0; i < height; i++)
{
const size_t srcOffset = i * srcStride + baseSrcOffset;
const size_t dstOffset = i * dstStride + baseDstOffset;

View File

@ -52,7 +52,7 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
char** argv = NULL;
RDP_CLIENT_ENTRY_POINTS clientEntryPoints = { 0 };
int ret = 1;
int argc = 0, i;
int argc = 0;
LPWSTR* args = NULL;
WINPR_UNUSED(hInstance);
@ -81,7 +81,7 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
if (!argv)
goto out;
for (i = 0; i < argc; i++)
for (int i = 0; i < argc; i++)
{
int size = WideCharToMultiByte(CP_UTF8, 0, args[i], -1, NULL, 0, NULL, NULL);
if (size <= 0)
@ -134,7 +134,7 @@ out:
if (argv)
{
for (i = 0; i < argc; i++)
for (int i = 0; i < argc; i++)
free(argv[i]);
free(argv);

View File

@ -81,7 +81,6 @@ static BOOL wf_has_console(void)
static BOOL wf_end_paint(rdpContext* context)
{
int i;
rdpGdi* gdi;
int ninvalid;
RECT updateRect;
@ -99,7 +98,7 @@ static BOOL wf_end_paint(rdpContext* context)
region16_init(&invalidRegion);
for (i = 0; i < ninvalid; i++)
for (int i = 0; i < ninvalid; i++)
{
invalidRect.left = cinvalid[i].x;
invalidRect.top = cinvalid[i].y;

View File

@ -161,8 +161,7 @@ static void CliprdrStream_Delete(CliprdrStream* instance);
static BOOL try_open_clipboard(HWND hwnd)
{
size_t x;
for (x = 0; x < 10; x++)
for (size_t x = 0; x < 10; x++)
{
if (OpenClipboard(hwnd))
return TRUE;
@ -493,12 +492,10 @@ void CliprdrStream_Delete(CliprdrStream* instance)
static LONG cliprdr_lookup_format(CliprdrDataObject* instance, FORMATETC* pFormatEtc)
{
ULONG i;
if (!instance || !pFormatEtc)
return -1;
for (i = 0; i < instance->m_nNumFormats; i++)
for (ULONG i = 0; i < instance->m_nNumFormats; i++)
{
if ((pFormatEtc->tymed & instance->m_pFormatEtc[i].tymed) &&
pFormatEtc->cfFormat == instance->m_pFormatEtc[i].cfFormat &&
@ -564,7 +561,6 @@ static ULONG STDMETHODCALLTYPE CliprdrDataObject_Release(IDataObject* This)
static HRESULT STDMETHODCALLTYPE CliprdrDataObject_GetData(IDataObject* This, FORMATETC* pFormatEtc,
STGMEDIUM* pMedium)
{
ULONG i;
LONG idx;
CliprdrDataObject* instance = (CliprdrDataObject*)This;
wfClipboard* clipboard;
@ -607,7 +603,7 @@ static HRESULT STDMETHODCALLTYPE CliprdrDataObject_GetData(IDataObject* This, FO
if (instance->m_pStream)
{
for (i = 0; i < instance->m_nStreams; i++)
for (ULONG i = 0; i < instance->m_nStreams; i++)
{
instance->m_pStream[i] =
(IStream*)CliprdrStream_New(i, clipboard, &dsc->fgd[i]);
@ -790,7 +786,7 @@ static CliprdrDataObject* CliprdrDataObject_New(FORMATETC* fmtetc, STGMEDIUM* st
if (!instance->m_pStgMedium)
goto error;
for (i = 0; i < count; i++)
for (ULONG i = 0; i < count; i++)
{
instance->m_pFormatEtc[i] = fmtetc[i];
instance->m_pStgMedium[i] = stgmed[i];
@ -813,9 +809,7 @@ void CliprdrDataObject_Delete(CliprdrDataObject* instance)
if (instance->m_pStream)
{
ULONG i;
for (i = 0; i < instance->m_nStreams; i++)
for (ULONG i = 0; i < instance->m_nStreams; i++)
CliprdrStream_Release(instance->m_pStream[i]);
free(instance->m_pStream);
@ -990,7 +984,6 @@ static HRESULT STDMETHODCALLTYPE CliprdrEnumFORMATETC_Clone(IEnumFORMATETC* This
CliprdrEnumFORMATETC* CliprdrEnumFORMATETC_New(ULONG nFormats, FORMATETC* pFormatEtc)
{
ULONG i;
CliprdrEnumFORMATETC* instance;
IEnumFORMATETC* iEnumFORMATETC;
@ -1026,7 +1019,7 @@ CliprdrEnumFORMATETC* CliprdrEnumFORMATETC_New(ULONG nFormats, FORMATETC* pForma
if (!instance->m_pFormatEtc)
goto error;
for (i = 0; i < nFormats; i++)
for (ULONG i = 0; i < nFormats; i++)
cliprdr_format_deep_copy(&instance->m_pFormatEtc[i], &pFormatEtc[i]);
}
@ -1038,15 +1031,13 @@ error:
void CliprdrEnumFORMATETC_Delete(CliprdrEnumFORMATETC* instance)
{
LONG i;
if (instance)
{
free(instance->iEnumFORMATETC.lpVtbl);
if (instance->m_pFormatEtc)
{
for (i = 0; i < instance->m_nNumFormats; i++)
for (LONG i = 0; i < instance->m_nNumFormats; i++)
{
if (instance->m_pFormatEtc[i].ptd)
CoTaskMemFree(instance->m_pFormatEtc[i].ptd);
@ -1063,7 +1054,6 @@ void CliprdrEnumFORMATETC_Delete(CliprdrEnumFORMATETC* instance)
static UINT32 get_local_format_id_by_name(wfClipboard* clipboard, const TCHAR* format_name)
{
size_t i;
formatMapping* map;
WCHAR* unicode_name;
#if !defined(UNICODE)
@ -1088,7 +1078,7 @@ static UINT32 get_local_format_id_by_name(wfClipboard* clipboard, const TCHAR* f
if (!unicode_name)
return 0;
for (i = 0; i < clipboard->map_size; i++)
for (size_t i = 0; i < clipboard->map_size; i++)
{
map = &clipboard->format_mappings[i];
@ -1113,13 +1103,12 @@ static INLINE BOOL file_transferring(wfClipboard* clipboard)
static UINT32 get_remote_format_id(wfClipboard* clipboard, UINT32 local_format)
{
UINT32 i;
formatMapping* map;
if (!clipboard)
return 0;
for (i = 0; i < clipboard->map_size; i++)
for (UINT32 i = 0; i < clipboard->map_size; i++)
{
map = &clipboard->format_mappings[i];
@ -1153,7 +1142,6 @@ static void map_ensure_capacity(wfClipboard* clipboard)
static BOOL clear_format_map(wfClipboard* clipboard)
{
size_t i;
formatMapping* map;
if (!clipboard)
@ -1161,7 +1149,7 @@ static BOOL clear_format_map(wfClipboard* clipboard)
if (clipboard->format_mappings)
{
for (i = 0; i < clipboard->map_capacity; i++)
for (size_t i = 0; i < clipboard->map_capacity; i++)
{
map = &clipboard->format_mappings[i];
map->remote_format_id = 0;
@ -1227,7 +1215,6 @@ static UINT cliprdr_send_format_list(wfClipboard* clipboard)
{
UINT rc;
int count = 0;
UINT32 index;
UINT32 numFormats = 0;
UINT32 formatId = 0;
char formatName[1024];
@ -1250,20 +1237,22 @@ static UINT cliprdr_send_format_list(wfClipboard* clipboard)
return CHANNEL_RC_NO_MEMORY;
}
index = 0;
if (IsClipboardFormatAvailable(CF_HDROP))
{
formats[index++].formatId = RegisterClipboardFormat(CFSTR_FILEDESCRIPTORW);
formats[index++].formatId = RegisterClipboardFormat(CFSTR_FILECONTENTS);
}
else
{
while (formatId = EnumClipboardFormats(formatId))
formats[index++].formatId = formatId;
}
UINT32 index = 0;
numFormats = index;
if (IsClipboardFormatAvailable(CF_HDROP))
{
formats[index++].formatId = RegisterClipboardFormat(CFSTR_FILEDESCRIPTORW);
formats[index++].formatId = RegisterClipboardFormat(CFSTR_FILECONTENTS);
}
else
{
while (formatId = EnumClipboardFormats(formatId))
formats[index++].formatId = formatId;
}
numFormats = index;
}
if (!CloseClipboard())
{
@ -1271,7 +1260,7 @@ static UINT cliprdr_send_format_list(wfClipboard* clipboard)
return ERROR_INTERNAL_ERROR;
}
for (index = 0; index < numFormats; index++)
for (UINT index = 0; index < numFormats; index++)
{
if (GetClipboardFormatNameA(formats[index].formatId, formatName, sizeof(formatName)))
{
@ -1285,7 +1274,7 @@ static UINT cliprdr_send_format_list(wfClipboard* clipboard)
formatList.common.msgType = CB_FORMAT_LIST;
rc = clipboard->context->ClientFormatList(clipboard->context, &formatList);
for (index = 0; index < numFormats; index++)
for (UINT index = 0; index < numFormats; index++)
free(formats[index].formatName);
free(formats);
@ -1579,15 +1568,13 @@ static DWORD WINAPI cliprdr_thread_func(LPVOID arg)
static void clear_file_array(wfClipboard* clipboard)
{
size_t i;
if (!clipboard)
return;
/* clear file_names array */
if (clipboard->file_names)
{
for (i = 0; i < clipboard->nFiles; i++)
for (size_t i = 0; i < clipboard->nFiles; i++)
{
free(clipboard->file_names[i]);
clipboard->file_names[i] = NULL;
@ -1600,7 +1587,7 @@ static void clear_file_array(wfClipboard* clipboard)
/* clear fileDescriptor array */
if (clipboard->fileDescriptor)
{
for (i = 0; i < clipboard->nFiles; i++)
for (size_t i = 0; i < clipboard->nFiles; i++)
{
free(clipboard->fileDescriptor[i]);
clipboard->fileDescriptor[i] = NULL;
@ -1853,14 +1840,13 @@ static UINT wf_cliprdr_monitor_ready(CliprdrClientContext* context,
static UINT wf_cliprdr_server_capabilities(CliprdrClientContext* context,
const CLIPRDR_CAPABILITIES* capabilities)
{
UINT32 index;
CLIPRDR_CAPABILITY_SET* capabilitySet;
wfClipboard* clipboard = (wfClipboard*)context->custom;
if (!context || !capabilities)
return ERROR_INTERNAL_ERROR;
for (index = 0; index < capabilities->cCapabilitiesSets; index++)
for (UINT32 index = 0; index < capabilities->cCapabilitiesSets; index++)
{
capabilitySet = &(capabilities->capabilitySets[index]);
@ -1886,7 +1872,6 @@ static UINT wf_cliprdr_server_format_list(CliprdrClientContext* context,
const CLIPRDR_FORMAT_LIST* formatList)
{
UINT rc = ERROR_INTERNAL_ERROR;
UINT32 i;
formatMapping* mapping;
CLIPRDR_FORMAT* format;
wfClipboard* clipboard = (wfClipboard*)context->custom;
@ -1894,7 +1879,7 @@ static UINT wf_cliprdr_server_format_list(CliprdrClientContext* context,
if (!clear_format_map(clipboard))
return ERROR_INTERNAL_ERROR;
for (i = 0; i < formatList->numFormats; i++)
for (UINT32 i = 0; i < formatList->numFormats; i++)
{
format = &(formatList->formats[i]);
mapping = &(clipboard->format_mappings[i]);
@ -1929,7 +1914,7 @@ static UINT wf_cliprdr_server_format_list(CliprdrClientContext* context,
if (EmptyClipboard())
{
for (i = 0; i < (UINT32)clipboard->map_size; i++)
for (UINT32 i = 0; i < (UINT32)clipboard->map_size; i++)
SetClipboardData(clipboard->format_mappings[i].local_format_id, NULL);
rc = CHANNEL_RC_OK;
@ -2052,8 +2037,6 @@ wf_cliprdr_server_format_data_request(CliprdrClientContext* context,
if (requestedFormatId == RegisterClipboardFormat(CFSTR_FILEDESCRIPTORW))
{
size_t len;
size_t i;
WCHAR* wFileName;
HRESULT result;
LPDATAOBJECT dataObj = NULL;
FORMATETC format_etc = { 0 };
@ -2093,7 +2076,7 @@ wf_cliprdr_server_format_data_request(CliprdrClientContext* context,
if (dropFiles->fWide)
{
/* dropFiles contains file names */
for (wFileName = (WCHAR*)((char*)dropFiles + dropFiles->pFiles);
for (WCHAR* wFileName = (WCHAR*)((char*)dropFiles + dropFiles->pFiles);
(len = wcslen(wFileName)) > 0; wFileName += len + 1)
{
wf_cliprdr_process_filename(clipboard, wFileName, wcslen(wFileName));
@ -2101,9 +2084,7 @@ wf_cliprdr_server_format_data_request(CliprdrClientContext* context,
}
else
{
char* p;
for (p = (char*)((char*)dropFiles + dropFiles->pFiles); (len = strlen(p)) > 0;
for (char* p = (char*)((char*)dropFiles + dropFiles->pFiles); (len = strlen(p)) > 0;
p += len + 1, clipboard->nFiles++)
{
int cchWideChar;
@ -2125,7 +2106,7 @@ wf_cliprdr_server_format_data_request(CliprdrClientContext* context,
{
groupDsc->cItems = clipboard->nFiles;
for (i = 0; i < clipboard->nFiles; i++)
for (size_t i = 0; i < clipboard->nFiles; i++)
{
if (clipboard->fileDescriptor[i])
groupDsc->fgd[i] = *clipboard->fileDescriptor[i];

View File

@ -95,13 +95,12 @@ struct s_FloatBar
static BOOL floatbar_kill_timers(wfFloatBar* floatbar)
{
size_t x;
UINT_PTR timers[] = { TIMER_HIDE, TIMER_ANIMAT_HIDE, TIMER_ANIMAT_SHOW };
if (!floatbar)
return FALSE;
for (x = 0; x < ARRAYSIZE(timers); x++)
for (size_t x = 0; x < ARRAYSIZE(timers); x++)
KillTimer(floatbar->hwnd, timers[x]);
floatbar->animating = 0;
@ -324,11 +323,9 @@ static Button* floatbar_create_lock_button(wfFloatBar* const floatbar, const int
static Button* floatbar_get_button(const wfFloatBar* const floatbar, const int x, const int y)
{
int i;
if ((y > BUTTON_Y) && (y < BUTTON_Y + BUTTON_HEIGHT))
{
for (i = 0; i < BTN_MAX; i++)
for (int i = 0; i < BTN_MAX; i++)
{
if ((floatbar->buttons[i] != NULL) && (x > floatbar->buttons[i]->x) &&
(x < floatbar->buttons[i]->x + floatbar->buttons[i]->w))
@ -343,7 +340,6 @@ static Button* floatbar_get_button(const wfFloatBar* const floatbar, const int x
static BOOL floatbar_paint(wfFloatBar* const floatbar, const HDC hdc)
{
int i;
HPEN hpen;
HGDIOBJECT orig;
/* paint background */
@ -389,7 +385,7 @@ static BOOL floatbar_paint(wfFloatBar* const floatbar, const HDC hdc)
/* paint buttons */
for (i = 0; i < BTN_MAX; i++)
for (int i = 0; i < BTN_MAX; i++)
button_paint(floatbar->buttons[i], hdc);
return TRUE;
@ -497,9 +493,7 @@ static LRESULT CALLBACK floatbar_proc(const HWND hWnd, const UINT Msg, const WPA
}
else
{
int i;
for (i = 0; i < BTN_MAX; i++)
for (int i = 0; i < BTN_MAX; i++)
{
if (floatbar->buttons[i] != NULL)
{
@ -525,9 +519,7 @@ static LRESULT CALLBACK floatbar_proc(const HWND hWnd, const UINT Msg, const WPA
case WM_MOUSELEAVE:
{
int i;
for (i = 0; i < BTN_MAX; i++)
for (int i = 0; i < BTN_MAX; i++)
{
if (floatbar->buttons[i] != NULL)
{

View File

@ -126,25 +126,18 @@ static void wf_glyph_free(wfBitmap* glyph)
wf_image_free(glyph);
}
static BYTE* wf_glyph_convert(wfContext* wfc, int width, int height, BYTE* data)
static BYTE* wf_glyph_convert(wfContext* wfc, int width, int height, const BYTE* data)
{
int indexx;
int indexy;
BYTE* src;
BYTE* dst;
BYTE* cdata;
int src_bytes_per_row;
int dst_bytes_per_row;
src_bytes_per_row = (width + 7) / 8;
dst_bytes_per_row = src_bytes_per_row + (src_bytes_per_row % 2);
cdata = (BYTE*)malloc(dst_bytes_per_row * height);
src = data;
const int src_bytes_per_row = (width + 7) / 8;
const int dst_bytes_per_row = src_bytes_per_row + (src_bytes_per_row % 2);
BYTE* cdata = (BYTE*)malloc(dst_bytes_per_row * height);
const BYTE* src = data;
for (indexy = 0; indexy < height; indexy++)
for (int indexy = 0; indexy < height; indexy++)
{
dst = cdata + indexy * dst_bytes_per_row;
BYTE* dst = cdata + indexy * dst_bytes_per_row;
for (indexx = 0; indexx < dst_bytes_per_row; indexx++)
for (int indexx = 0; indexx < dst_bytes_per_row; indexx++)
{
if (indexx < src_bytes_per_row)
*dst++ = *src++;
@ -158,7 +151,6 @@ static BYTE* wf_glyph_convert(wfContext* wfc, int width, int height, BYTE* data)
static HBRUSH wf_create_brush(wfContext* wfc, rdpBrush* brush, UINT32 color, UINT32 bpp)
{
UINT32 i;
HBRUSH br;
LOGBRUSH lbr;
BYTE* cdata;
@ -182,7 +174,7 @@ static HBRUSH wf_create_brush(wfContext* wfc, rdpBrush* brush, UINT32 color, UIN
}
else
{
for (i = 0; i != 8; i++)
for (UINT32 i = 0; i != 8; i++)
ipattern[7 - i] = brush->data[i];
cdata = wf_glyph_convert(wfc, 8, 8, ipattern);
@ -595,7 +587,6 @@ static BOOL wf_gdi_opaque_rect(rdpContext* context, const OPAQUE_RECT_ORDER* opa
static BOOL wf_gdi_multi_opaque_rect(rdpContext* context,
const MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
{
UINT32 i;
RECT rect;
HBRUSH brush;
COLORREF brush_color;
@ -607,7 +598,7 @@ static BOOL wf_gdi_multi_opaque_rect(rdpContext* context,
if (!wf_decode_color(wfc, multi_opaque_rect->color, &brush_color, NULL))
return FALSE;
for (i = 0; i < multi_opaque_rect->numRectangles; i++)
for (UINT32 i = 0; i < multi_opaque_rect->numRectangles; i++)
{
const DELTA_RECT* rectangle = &multi_opaque_rect->rectangles[i];
rect.left = rectangle->left;
@ -684,13 +675,12 @@ static BOOL wf_gdi_polyline(rdpContext* context, const POLYLINE_ORDER* polyline)
POINT* pts;
POINT temp;
int numPoints;
int i;
numPoints = polyline->numDeltaEntries + 1;
pts = (POINT*)malloc(sizeof(POINT) * numPoints);
pts[0].x = temp.x = polyline->xStart;
pts[0].y = temp.y = polyline->yStart;
for (i = 0; i < (int)polyline->numDeltaEntries; i++)
for (UINT32 i = 0; i < polyline->numDeltaEntries; i++)
{
temp.x += polyline->points[i].x;
temp.y += polyline->points[i].y;

View File

@ -172,10 +172,9 @@ static BOOL wf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL pr
static BOOL flip_bitmap(const BYTE* src, BYTE* dst, UINT32 scanline, UINT32 nHeight)
{
UINT32 x;
BYTE* bottomLine = dst + scanline * (nHeight - 1);
for (x = 0; x < nHeight; x++)
for (UINT32 x = 0; x < nHeight; x++)
{
memcpy(bottomLine, src, scanline);
src += scanline;

View File

@ -111,10 +111,9 @@ static const WINDOW_STYLE EXTENDED_WINDOW_STYLES[] = {
static void PrintWindowStyles(UINT32 style)
{
int i;
WLog_INFO(TAG, "\tWindow Styles:\t{");
for (i = 0; i < ARRAYSIZE(WINDOW_STYLES); i++)
for (size_t i = 0; i < ARRAYSIZE(WINDOW_STYLES); i++)
{
if (style & WINDOW_STYLES[i].style)
{
@ -131,10 +130,9 @@ static void PrintWindowStyles(UINT32 style)
static void PrintExtendedWindowStyles(UINT32 style)
{
int i;
WLog_INFO(TAG, "\tExtended Window Styles:\t{");
for (i = 0; i < ARRAYSIZE(EXTENDED_WINDOW_STYLES); i++)
for (size_t i = 0; i < ARRAYSIZE(EXTENDED_WINDOW_STYLES); i++)
{
if (style & EXTENDED_WINDOW_STYLES[i].style)
{
@ -228,11 +226,10 @@ static void PrintRailWindowState(const WINDOW_ORDER_INFO* orderInfo,
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_RECTS)
{
UINT32 index;
RECTANGLE_16* rect;
WLog_INFO(TAG, "\tnumWindowRects: %u", windowState->numWindowRects);
for (index = 0; index < windowState->numWindowRects; index++)
for (UINT32 index = 0; index < windowState->numWindowRects; index++)
{
rect = &windowState->windowRects[index];
WLog_INFO(TAG, "\twindowRect[%u]: left: %hu top: %hu right: %hu bottom: %hu", index,
@ -248,11 +245,10 @@ static void PrintRailWindowState(const WINDOW_ORDER_INFO* orderInfo,
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY)
{
UINT32 index;
RECTANGLE_16* rect;
WLog_INFO(TAG, "\tnumVisibilityRects: %u", windowState->numVisibilityRects);
for (index = 0; index < windowState->numVisibilityRects; index++)
for (UINT32 index = 0; index < windowState->numVisibilityRects; index++)
{
rect = &windowState->visibilityRects[index];
WLog_INFO(TAG, "\tvisibilityRect[%u]: left: %hu top: %hu right: %hu bottom: %hu", index,
@ -623,7 +619,6 @@ static BOOL wf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO*
if (fieldFlags & WINDOW_ORDER_FIELD_WND_RECTS)
{
UINT32 index;
HRGN hWndRect;
HRGN hWndRects;
RECTANGLE_16* rect;
@ -633,7 +628,7 @@ static BOOL wf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO*
rect = &(windowState->windowRects[0]);
hWndRects = CreateRectRgn(rect->left, rect->top, rect->right, rect->bottom);
for (index = 1; index < windowState->numWindowRects; index++)
for (UINT32 index = 1; index < windowState->numWindowRects; index++)
{
rect = &(windowState->windowRects[index]);
hWndRect = CreateRectRgn(rect->left, rect->top, rect->right, rect->bottom);
@ -936,8 +931,6 @@ static UINT wf_rail_server_get_appid_response(RailClientContext* context,
void wf_rail_invalidate_region(wfContext* wfc, REGION16* invalidRegion)
{
int index;
int count;
RECT updateRect;
RECTANGLE_16 windowRect;
ULONG_PTR* pKeys = NULL;
@ -945,9 +938,9 @@ void wf_rail_invalidate_region(wfContext* wfc, REGION16* invalidRegion)
const RECTANGLE_16* extents;
REGION16 windowInvalidRegion;
region16_init(&windowInvalidRegion);
count = HashTable_GetKeys(wfc->railWindows, &pKeys);
size_t count = HashTable_GetKeys(wfc->railWindows, &pKeys);
for (index = 0; index < count; index++)
for (size_t index = 0; index < count; index++)
{
railWindow = (wfRailWindow*)HashTable_GetItemValue(wfc->railWindows, (void*)pKeys[index]);

View File

@ -150,8 +150,7 @@ static void xf_teardown_x11(xfContext* xfc);
static int xf_map_error_to_exit_code(DWORD error)
{
size_t x = 0;
for (x = 0; x < ARRAYSIZE(xf_exit_code_map); x++)
for (size_t x = 0; x < ARRAYSIZE(xf_exit_code_map); x++)
{
const struct xf_exit_code_map_t* cur = &xf_exit_code_map[x];
if (cur->error == error)
@ -920,7 +919,6 @@ static void xf_get_x11_button_map(xfContext* xfc, unsigned char* x11_map)
XExtensionVersion* version = NULL;
XDeviceInfo* devices1 = NULL;
XIDeviceInfo* devices2 = NULL;
int i = 0;
int num_devices = 0;
if (XQueryExtension(xfc->display, "XInputExtension", &opcode, &event, &error))
@ -937,7 +935,7 @@ static void xf_get_x11_button_map(xfContext* xfc, unsigned char* x11_map)
if (devices2)
{
for (i = 0; i < num_devices; ++i)
for (int i = 0; i < num_devices; ++i)
{
if ((devices2[i].use == XISlavePointer) &&
(strncmp(devices2[i].name, TEST_PTR_STR, TEST_PTR_LEN) != 0))
@ -958,7 +956,7 @@ static void xf_get_x11_button_map(xfContext* xfc, unsigned char* x11_map)
if (devices1)
{
for (i = 0; i < num_devices; ++i)
for (int i = 0; i < num_devices; ++i)
{
if ((devices1[i].use == IsXExtensionPointer) &&
(strncmp(devices1[i].name, TEST_PTR_STR, TEST_PTR_LEN) != 0))
@ -1015,9 +1013,7 @@ static const button_map xf_button_flags[NUM_BUTTONS_MAPPED] = {
static UINT16 get_flags_for_button(int button)
{
size_t x = 0;
for (x = 0; x < ARRAYSIZE(xf_button_flags); x++)
for (size_t x = 0; x < ARRAYSIZE(xf_button_flags); x++)
{
const button_map* map = &xf_button_flags[x];
@ -1032,7 +1028,7 @@ static void xf_button_map_init(xfContext* xfc)
{
size_t pos = 0;
/* loop counter for array initialization */
size_t physical = 0;
/* logical mouse button which is used for each physical mouse */
/* button (indexed from zero). This is the default map. */
unsigned char x11_map[112] = { 0 };
@ -1061,7 +1057,7 @@ static void xf_button_map_init(xfContext* xfc)
/* iterate over all (mapped) physical buttons; for each of them */
/* find the logical button in X11, and assign to this the */
/* appropriate value to send over the RDP wire. */
for (physical = 0; physical < ARRAYSIZE(x11_map); ++physical)
for (size_t physical = 0; physical < ARRAYSIZE(x11_map); ++physical)
{
const unsigned char logical = x11_map[physical];
const UINT16 flags = get_flags_for_button(logical);
@ -1777,10 +1773,9 @@ static int xfreerdp_client_start(rdpContext* context)
static Atom get_supported_atom(xfContext* xfc, const char* atomName)
{
unsigned long i = 0;
const Atom atom = XInternAtom(xfc->display, atomName, False);
for (i = 0; i < xfc->supportedAtomCount; i++)
for (unsigned long i = 0; i < xfc->supportedAtomCount; i++)
{
if (xfc->supportedAtoms[i] == atom)
return atom;

View File

@ -443,7 +443,6 @@ static UINT xf_cliprdr_send_data_response(xfClipboard* clipboard, const xfCliprd
static wStream* xf_cliprdr_serialize_server_format_list(xfClipboard* clipboard)
{
UINT32 i = 0;
UINT32 formatCount = 0;
wStream* s = NULL;
@ -460,7 +459,7 @@ static wStream* xf_cliprdr_serialize_server_format_list(xfClipboard* clipboard)
formatCount = (clipboard->numServerFormats > 0) ? clipboard->numServerFormats - 1 : 0;
Stream_Write_UINT32(s, formatCount);
for (i = 0; i < formatCount; i++)
for (UINT32 i = 0; i < formatCount; i++)
{
CLIPRDR_FORMAT* format = &clipboard->serverFormats[i];
size_t name_length = format->formatName ? strlen(format->formatName) : 0;
@ -491,7 +490,6 @@ error:
static CLIPRDR_FORMAT* xf_cliprdr_parse_server_format_list(BYTE* data, size_t length,
UINT32* numFormats)
{
UINT32 i = 0;
wStream* s = NULL;
CLIPRDR_FORMAT* formats = NULL;
@ -521,7 +519,7 @@ static CLIPRDR_FORMAT* xf_cliprdr_parse_server_format_list(BYTE* data, size_t le
goto error;
}
for (i = 0; i < *numFormats; i++)
for (UINT32 i = 0; i < *numFormats; i++)
{
const char* formatName = NULL;
size_t formatNameLength = 0;
@ -555,11 +553,9 @@ error:
static void xf_cliprdr_free_formats(CLIPRDR_FORMAT* formats, UINT32 numFormats)
{
UINT32 i = 0;
WINPR_ASSERT(formats || (numFormats == 0));
for (i = 0; i < numFormats; i++)
for (UINT32 i = 0; i < numFormats; i++)
{
free(formats[i].formatName);
}
@ -729,20 +725,17 @@ static BOOL xf_clipboard_format_equal(const CLIPRDR_FORMAT* a, const CLIPRDR_FOR
static BOOL xf_clipboard_changed(xfClipboard* clipboard, const CLIPRDR_FORMAT* formats,
UINT32 numFormats)
{
UINT32 x = 0;
UINT32 y = 0;
WINPR_ASSERT(clipboard);
WINPR_ASSERT(formats || (numFormats == 0));
if (clipboard->lastSentNumFormats != numFormats)
return TRUE;
for (x = 0; x < numFormats; x++)
for (UINT32 x = 0; x < numFormats; x++)
{
const CLIPRDR_FORMAT* cur = &clipboard->lastSentFormats[x];
BOOL contained = FALSE;
for (y = 0; y < numFormats; y++)
for (UINT32 y = 0; y < numFormats; y++)
{
if (xf_clipboard_format_equal(cur, &formats[y]))
{
@ -769,8 +762,6 @@ static void xf_clipboard_formats_free(xfClipboard* clipboard)
static BOOL xf_clipboard_copy_formats(xfClipboard* clipboard, const CLIPRDR_FORMAT* formats,
UINT32 numFormats)
{
UINT32 x = 0;
WINPR_ASSERT(clipboard);
WINPR_ASSERT(formats || (numFormats == 0));
@ -779,7 +770,7 @@ static BOOL xf_clipboard_copy_formats(xfClipboard* clipboard, const CLIPRDR_FORM
if (!clipboard->lastSentFormats)
return FALSE;
clipboard->lastSentNumFormats = numFormats;
for (x = 0; x < numFormats; x++)
for (UINT32 x = 0; x < numFormats; x++)
{
CLIPRDR_FORMAT* lcur = &clipboard->lastSentFormats[x];
const CLIPRDR_FORMAT* cur = &formats[x];
@ -1752,7 +1743,6 @@ static UINT xf_cliprdr_monitor_ready(CliprdrClientContext* context,
static UINT xf_cliprdr_server_capabilities(CliprdrClientContext* context,
const CLIPRDR_CAPABILITIES* capabilities)
{
UINT32 i = 0;
const CLIPRDR_GENERAL_CAPABILITY_SET* generalCaps = NULL;
const BYTE* capsPtr = NULL;
xfClipboard* clipboard = NULL;
@ -1768,7 +1758,7 @@ static UINT xf_cliprdr_server_capabilities(CliprdrClientContext* context,
cliprdr_file_context_remote_set_flags(clipboard->file, 0);
for (i = 0; i < capabilities->cCapabilitiesSets; i++)
for (UINT32 i = 0; i < capabilities->cCapabilitiesSets; i++)
{
const CLIPRDR_CAPABILITY_SET* caps = (const CLIPRDR_CAPABILITY_SET*)capsPtr;
@ -1879,9 +1869,7 @@ static UINT xf_cliprdr_server_format_list(CliprdrClientContext* context,
if (!srvFormat->formatName)
{
UINT32 k = 0;
for (k = 0; k < i; k++)
for (UINT32 k = 0; k < i; k++)
free(clipboard->serverFormats[k].formatName);
clipboard->numServerFormats = 0;
@ -2224,8 +2212,6 @@ xf_cliprdr_server_format_data_response(CliprdrClientContext* context,
static BOOL xf_cliprdr_is_valid_unix_filename(LPCWSTR filename)
{
LPCWSTR c = NULL;
if (!filename)
return FALSE;
@ -2233,7 +2219,7 @@ static BOOL xf_cliprdr_is_valid_unix_filename(LPCWSTR filename)
return FALSE;
/* Reserved characters */
for (c = filename; *c; ++c)
for (const WCHAR* c = filename; *c; ++c)
{
if (*c == L'/')
return FALSE;

View File

@ -356,7 +356,6 @@ void xf_disp_free(xfDispContext* disp)
UINT xf_disp_sendLayout(DispClientContext* disp, const rdpMonitor* monitors, UINT32 nmonitors)
{
UINT ret = CHANNEL_RC_OK;
UINT32 i = 0;
xfDispContext* xfDisp = NULL;
rdpSettings* settings = NULL;
DISPLAY_CONTROL_MONITOR_LAYOUT* layouts = NULL;
@ -377,7 +376,7 @@ UINT xf_disp_sendLayout(DispClientContext* disp, const rdpMonitor* monitors, UIN
if (!layouts)
return CHANNEL_RC_NO_MEMORY;
for (i = 0; i < nmonitors; i++)
for (UINT32 i = 0; i < nmonitors; i++)
{
const rdpMonitor* monitor = &monitors[i];
DISPLAY_CONTROL_MONITOR_LAYOUT* layout = &layouts[i];

View File

@ -225,7 +225,6 @@ void xf_event_action_script_free(xfContext* xfc)
static BOOL xf_event_execute_action_script(xfContext* xfc, const XEvent* event)
{
int index = 0;
int count = 0;
char* name = NULL;
FILE* actionScript = NULL;
@ -244,7 +243,7 @@ static BOOL xf_event_execute_action_script(xfContext* xfc, const XEvent* event)
xeventName = x11_event_string(event->type);
count = ArrayList_Count(xfc->xevents);
for (index = 0; index < count; index++)
for (int index = 0; index < count; index++)
{
name = (char*)ArrayList_GetItem(xfc->xevents, index);
@ -916,7 +915,6 @@ static BOOL xf_event_PropertyNotify(xfContext* xfc, const XPropertyEvent* event,
if ((((Atom)event->atom == xfc->_NET_WM_STATE) && (event->state != PropertyDelete)) ||
(((Atom)event->atom == xfc->WM_STATE) && (event->state != PropertyDelete)))
{
unsigned long i = 0;
BOOL status = FALSE;
BOOL minimized = FALSE;
BOOL minimizedChanged = FALSE;
@ -945,7 +943,7 @@ static BOOL xf_event_PropertyNotify(xfContext* xfc, const XPropertyEvent* event,
appWindow->maxVert = FALSE;
appWindow->maxHorz = FALSE;
}
for (i = 0; i < nitems; i++)
for (unsigned long i = 0; i < nitems; i++)
{
if ((Atom)((UINT16**)prop)[i] ==
XInternAtom(xfc->display, "_NET_WM_STATE_MAXIMIZED_VERT", False))
@ -1266,12 +1264,11 @@ BOOL xf_event_process(freerdp* instance, const XEvent* event)
BOOL xf_generic_RawButtonEvent(xfContext* xfc, int button, BOOL app, BOOL down)
{
UINT16 flags = 0;
size_t i = 0;
if (app)
return FALSE;
for (i = 0; i < ARRAYSIZE(xfc->button_map); i++)
for (size_t i = 0; i < ARRAYSIZE(xfc->button_map); i++)
{
const button_map* cur = &xfc->button_map[i];

View File

@ -222,7 +222,6 @@ static BOOL create_floatbar(xfFloatbar* floatbar)
BOOL xf_floatbar_toggle_fullscreen(xfFloatbar* floatbar, bool fullscreen)
{
int i = 0;
int size = 0;
bool visible = False;
xfContext* xfc = NULL;
@ -250,7 +249,7 @@ BOOL xf_floatbar_toggle_fullscreen(xfFloatbar* floatbar, bool fullscreen)
XMapWindow(xfc->display, floatbar->handle);
size = ARRAYSIZE(floatbar->buttons);
for (i = 0; i < size; i++)
for (int i = 0; i < size; i++)
{
xfFloatbarButton* button = floatbar->buttons[i];
XMapWindow(xfc->display, button->handle);
@ -898,7 +897,6 @@ static void xf_floatbar_button_free(xfContext* xfc, xfFloatbarButton* button)
void xf_floatbar_free(xfFloatbar* floatbar)
{
size_t i = 0;
size_t size = 0;
xfContext* xfc = NULL;
@ -911,7 +909,7 @@ void xf_floatbar_free(xfFloatbar* floatbar)
size = ARRAYSIZE(floatbar->buttons);
for (i = 0; i < size; i++)
for (size_t i = 0; i < size; i++)
{
xf_floatbar_button_free(xfc, floatbar->buttons[i]);
floatbar->buttons[i] = NULL;

View File

@ -40,7 +40,6 @@ static UINT xf_OutputUpdate(xfContext* xfc, xfGfxSurface* surface)
rdpGdi* gdi = NULL;
const rdpSettings* settings = NULL;
UINT32 nbRects = 0;
UINT32 x = 0;
double sx = NAN;
double sy = NAN;
const RECTANGLE_16* rects = NULL;
@ -71,7 +70,7 @@ static UINT xf_OutputUpdate(xfContext* xfc, xfGfxSurface* surface)
if (!(rects = region16_rects(&surface->gdi.invalidRegion, &nbRects)))
return CHANNEL_RC_OK;
for (x = 0; x < nbRects; x++)
for (UINT32 x = 0; x < nbRects; x++)
{
const RECTANGLE_16* rect = &rects[x];
const UINT32 nXSrc = rect->left;
@ -134,7 +133,6 @@ static UINT xf_WindowUpdate(RdpgfxClientContext* context, xfGfxSurface* surface)
static UINT xf_UpdateSurfaces(RdpgfxClientContext* context)
{
UINT16 count = 0;
UINT32 index = 0;
UINT status = CHANNEL_RC_OK;
UINT16* pSurfaceIds = NULL;
rdpGdi* gdi = (rdpGdi*)context->custom;
@ -150,7 +148,7 @@ static UINT xf_UpdateSurfaces(RdpgfxClientContext* context)
EnterCriticalSection(&context->mux);
context->GetSurfaceIds(context, &pSurfaceIds, &count);
for (index = 0; index < count; index++)
for (UINT32 index = 0; index < count; index++)
{
xfGfxSurface* surface = (xfGfxSurface*)context->GetSurfaceData(context, pSurfaceIds[index]);
@ -181,7 +179,6 @@ static UINT xf_UpdateSurfaces(RdpgfxClientContext* context)
UINT xf_OutputExpose(xfContext* xfc, UINT32 x, UINT32 y, UINT32 width, UINT32 height)
{
UINT16 count = 0;
UINT32 index = 0;
UINT status = ERROR_INTERNAL_ERROR;
RECTANGLE_16 invalidRect = { 0 };
RECTANGLE_16 intersection = { 0 };
@ -208,7 +205,7 @@ UINT xf_OutputExpose(xfContext* xfc, UINT32 x, UINT32 y, UINT32 width, UINT32 he
free(pSurfaceIds);
return CHANNEL_RC_OK;
}
for (index = 0; index < count; index++)
for (UINT32 index = 0; index < count; index++)
{
RECTANGLE_16 surfaceRect = { 0 };
xfGfxSurface* surface = (xfGfxSurface*)context->GetSurfaceData(context, pSurfaceIds[index]);

View File

@ -330,7 +330,6 @@ static void xf_Pointer_Free(rdpContext* context, rdpPointer* pointer)
WLog_DBG(TAG, "%p", pointer);
#ifdef WITH_XCURSOR
UINT32 i = 0;
xfContext* xfc = (xfContext*)context;
xfPointer* xpointer = (xfPointer*)pointer;
@ -340,7 +339,7 @@ static void xf_Pointer_Free(rdpContext* context, rdpPointer* pointer)
free(xpointer->cursorWidths);
free(xpointer->cursorHeights);
for (i = 0; i < xpointer->nCursors; i++)
for (UINT32 i = 0; i < xpointer->nCursors; i++)
{
XFreeCursor(xfc->display, xpointer->cursors[i]);
}

View File

@ -485,10 +485,8 @@ static void xf_input_detect_pinch(xfContext* xfc)
static void xf_input_touch_begin(xfContext* xfc, const XIDeviceEvent* event)
{
int i = 0;
WINPR_UNUSED(xfc);
for (i = 0; i < MAX_CONTACTS; i++)
for (int i = 0; i < MAX_CONTACTS; i++)
{
if (xfc->contacts[i].id == 0)
{
@ -504,12 +502,10 @@ static void xf_input_touch_begin(xfContext* xfc, const XIDeviceEvent* event)
static void xf_input_touch_update(xfContext* xfc, const XIDeviceEvent* event)
{
int i = 0;
WINPR_ASSERT(xfc);
WINPR_ASSERT(event);
for (i = 0; i < MAX_CONTACTS; i++)
for (int i = 0; i < MAX_CONTACTS; i++)
{
if (xfc->contacts[i].id == event->detail)
{
@ -527,10 +523,8 @@ static void xf_input_touch_update(xfContext* xfc, const XIDeviceEvent* event)
static void xf_input_touch_end(xfContext* xfc, const XIDeviceEvent* event)
{
int i = 0;
WINPR_UNUSED(xfc);
for (i = 0; i < MAX_CONTACTS; i++)
for (int i = 0; i < MAX_CONTACTS; i++)
{
if (xfc->contacts[i].id == event->detail)
{

View File

@ -58,7 +58,6 @@ int xf_list_monitors(xfContext* xfc)
Display* display = NULL;
int major = 0;
int minor = 0;
int i = 0;
int nmonitors = 0;
display = XOpenDisplay(NULL);
@ -76,7 +75,7 @@ int xf_list_monitors(xfContext* xfc)
XRRMonitorInfo* monitors =
XRRGetMonitors(display, DefaultRootWindow(display), 1, &nmonitors);
for (i = 0; i < nmonitors; i++)
for (int i = 0; i < nmonitors; i++)
{
printf(" %s [%d] %dx%d\t+%d+%d\n", monitors[i].primary ? "*" : " ", i,
monitors[i].width, monitors[i].height, monitors[i].x, monitors[i].y);
@ -93,7 +92,7 @@ int xf_list_monitors(xfContext* xfc)
{
XineramaScreenInfo* screen = XineramaQueryScreens(display, &nmonitors);
for (i = 0; i < nmonitors; i++)
for (int i = 0; i < nmonitors; i++)
{
printf(" %s [%d] %hdx%hd\t+%hd+%hd\n", (i == 0) ? "*" : " ", i,
screen[i].width, screen[i].height, screen[i].x_org, screen[i].y_org);
@ -116,7 +115,6 @@ int xf_list_monitors(xfContext* xfc)
static BOOL xf_is_monitor_id_active(xfContext* xfc, UINT32 id)
{
UINT32 index = 0;
const rdpSettings* settings = NULL;
WINPR_ASSERT(xfc);
@ -128,7 +126,7 @@ static BOOL xf_is_monitor_id_active(xfContext* xfc, UINT32 id)
if (NumMonitorIds == 0)
return TRUE;
for (index = 0; index < NumMonitorIds; index++)
for (UINT32 index = 0; index < NumMonitorIds; index++)
{
const UINT32* cur = freerdp_settings_get_pointer_array(settings, FreeRDP_MonitorIds, index);
if (cur && (*cur == id))
@ -196,9 +194,7 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
if (vscreen->nmonitors)
{
int i = 0;
for (i = 0; i < vscreen->nmonitors; i++)
for (int i = 0; i < vscreen->nmonitors; i++)
{
MONITOR_INFO* cur_vscreen = &vscreen->monitors[i];
const XRRMonitorInfo* cur_monitor = &rrmonitors[i];
@ -224,9 +220,7 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
if (vscreen->nmonitors)
{
int i = 0;
for (i = 0; i < vscreen->nmonitors; i++)
for (int i = 0; i < vscreen->nmonitors; i++)
{
MONITOR_INFO* monitor = &vscreen->monitors[i];
monitor->area.left = screenInfo[i].x_org;
@ -246,9 +240,7 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
/* Determine which monitor that the mouse cursor is on */
if (vscreen->monitors)
{
int i = 0;
for (i = 0; i < vscreen->nmonitors; i++)
for (int i = 0; i < vscreen->nmonitors; i++)
{
const MONITOR_INFO* monitor = &vscreen->monitors[i];

View File

@ -592,11 +592,9 @@ static xfRailIconCache* RailIconCache_New(rdpSettings* settings)
static void RailIconCache_Free(xfRailIconCache* cache)
{
UINT32 i = 0;
if (cache)
{
for (i = 0; i < cache->numCaches * cache->numCacheEntries; i++)
for (UINT32 i = 0; i < cache->numCaches * cache->numCacheEntries; i++)
{
free(cache->entries[i].data);
}
@ -645,7 +643,6 @@ static BOOL convert_rail_icon(const ICON_INFO* iconInfo, xfRailIcon* railIcon)
BYTE* argbPixels = NULL;
BYTE* nextPixel = NULL;
long* pixels = NULL;
int i = 0;
int nelements = 0;
argbPixels = calloc(1ull * iconInfo->width * iconInfo->height, 4);
@ -670,7 +667,7 @@ static BOOL convert_rail_icon(const ICON_INFO* iconInfo, xfRailIcon* railIcon)
pixels[1] = iconInfo->height;
nextPixel = argbPixels;
for (i = 2; i < nelements; i++)
for (int i = 2; i < nelements; i++)
{
pixels[i] = FreeRDPReadColor(nextPixel, PIXEL_FORMAT_BGRA32);
nextPixel += 4;

View File

@ -56,12 +56,10 @@ typedef struct xf_xv_context xfXvContext;
static BOOL xf_tsmf_is_format_supported(xfXvContext* xv, UINT32 pixfmt)
{
int i = 0;
if (!xv->xv_pixfmts)
return FALSE;
for (i = 0; xv->xv_pixfmts[i]; i++)
for (int i = 0; xv->xv_pixfmts[i]; i++)
{
if (xv->xv_pixfmts[i] == pixfmt)
return TRUE;
@ -72,7 +70,6 @@ static BOOL xf_tsmf_is_format_supported(xfXvContext* xv, UINT32 pixfmt)
static int xf_tsmf_xv_video_frame_event(TsmfClientContext* tsmf, TSMF_VIDEO_FRAME_EVENT* event)
{
int i = 0;
int x = 0;
int y = 0;
UINT32 width = 0;
@ -122,7 +119,7 @@ static int xf_tsmf_xv_video_frame_event(TsmfClientContext* tsmf, TSMF_VIDEO_FRAM
if (!xrects)
return -1;
for (i = 0; i < numRects; i++)
for (int i = 0; i < numRects; i++)
{
x = event->x + event->visibleRects[i].left;
y = event->y + event->visibleRects[i].top;
@ -232,7 +229,7 @@ static int xf_tsmf_xv_video_frame_event(TsmfClientContext* tsmf, TSMF_VIDEO_FRAM
}
else
{
for (i = 0; i < event->frameHeight; i++)
for (int i = 0; i < event->frameHeight; i++)
{
CopyMemory(image->data + image->offsets[0] + i * image->pitches[0],
event->frameData + i * event->frameWidth, event->frameWidth);
@ -263,7 +260,7 @@ static int xf_tsmf_xv_video_frame_event(TsmfClientContext* tsmf, TSMF_VIDEO_FRAM
}
else
{
for (i = 0; i < event->frameHeight / 2; i++)
for (int i = 0; i < event->frameHeight / 2; i++)
{
CopyMemory(image->data + image->offsets[1] + i * image->pitches[1],
data1 + i * event->frameWidth / 2, event->frameWidth / 2);
@ -309,7 +306,6 @@ static int xf_tsmf_xv_video_frame_event(TsmfClientContext* tsmf, TSMF_VIDEO_FRAM
static int xf_tsmf_xv_init(xfContext* xfc, TsmfClientContext* tsmf)
{
int ret = 0;
unsigned int i = 0;
unsigned int version = 0;
unsigned int release = 0;
unsigned int event_base = 0;
@ -360,7 +356,7 @@ static int xf_tsmf_xv_init(xfContext* xfc, TsmfClientContext* tsmf)
return -1;
}
for (i = 0; i < num_adaptors; i++)
for (unsigned int i = 0; i < num_adaptors; i++)
{
WLog_DBG(TAG, "adapter port %lu-%lu (%s)", ai[i].base_id,
ai[i].base_id + ai[i].num_ports - 1, ai[i].name);
@ -381,7 +377,8 @@ static int xf_tsmf_xv_init(xfContext* xfc, TsmfClientContext* tsmf)
attr = XvQueryPortAttributes(xfc->display, xv->xv_port, &ret);
for (i = 0; i < (unsigned int)ret; i++)
unsigned int i = 0;
for (; i < (unsigned int)ret; i++)
{
if (strcmp(attr[i].name, "XV_COLORKEY") == 0)
{
@ -401,7 +398,7 @@ static int xf_tsmf_xv_init(xfContext* xfc, TsmfClientContext* tsmf)
{
xv->xv_pixfmts = (UINT32*)calloc((ret + 1), sizeof(UINT32));
for (i = 0; i < (unsigned int)ret; i++)
for (unsigned int i = 0; i < (unsigned int)ret; i++)
{
xv->xv_pixfmts[i] = fo[i].id;
WLog_DBG(TAG, "%c%c%c%c ", ((char*)(xv->xv_pixfmts + i))[0],

View File

@ -127,7 +127,6 @@ static void xf_SetWindowTitleText(xfContext* xfc, Window window, const char* nam
void xf_SendClientEvent(xfContext* xfc, Window window, Atom atom, unsigned int numArgs, ...)
{
XEvent xevent = { 0 };
unsigned int i = 0;
va_list argp;
va_start(argp, numArgs);
@ -139,7 +138,7 @@ void xf_SendClientEvent(xfContext* xfc, Window window, Atom atom, unsigned int n
xevent.xclient.message_type = atom;
xevent.xclient.format = 32;
for (i = 0; i < numArgs; i++)
for (size_t i = 0; i < numArgs; i++)
{
xevent.xclient.data.l[i] = va_arg(argp, int);
}
@ -158,7 +157,6 @@ void xf_SetWindowMinimized(xfContext* xfc, xfWindow* window)
void xf_SetWindowFullscreen(xfContext* xfc, xfWindow* window, BOOL fullscreen)
{
UINT32 i = 0;
const rdpSettings* settings = NULL;
int startX = 0;
int startY = 0;
@ -210,7 +208,7 @@ void xf_SetWindowFullscreen(xfContext* xfc, xfWindow* window, BOOL fullscreen)
startY = firstMonitor->y;
/* Search all monitors to find the lowest startX and startY values */
for (i = 0; i < freerdp_settings_get_uint32(settings, FreeRDP_MonitorCount); i++)
for (size_t i = 0; i < freerdp_settings_get_uint32(settings, FreeRDP_MonitorCount); i++)
{
const rdpMonitor* monitor =
freerdp_settings_get_pointer_array(settings, FreeRDP_MonitorDefArray, i);
@ -1060,7 +1058,6 @@ void xf_ShowWindow(xfContext* xfc, xfAppWindow* appWindow, BYTE state)
void xf_SetWindowRects(xfContext* xfc, xfAppWindow* appWindow, RECTANGLE_16* rects, int nrects)
{
int i = 0;
XRectangle* xrects = NULL;
if (nrects < 1)
@ -1069,7 +1066,7 @@ void xf_SetWindowRects(xfContext* xfc, xfAppWindow* appWindow, RECTANGLE_16* rec
#ifdef WITH_XEXT
xrects = (XRectangle*)calloc(nrects, sizeof(XRectangle));
for (i = 0; i < nrects; i++)
for (int i = 0; i < nrects; i++)
{
xrects[i].x = rects[i].left;
xrects[i].y = rects[i].top;
@ -1086,7 +1083,6 @@ void xf_SetWindowRects(xfContext* xfc, xfAppWindow* appWindow, RECTANGLE_16* rec
void xf_SetWindowVisibilityRects(xfContext* xfc, xfAppWindow* appWindow, UINT32 rectsOffsetX,
UINT32 rectsOffsetY, RECTANGLE_16* rects, int nrects)
{
int i = 0;
XRectangle* xrects = NULL;
if (nrects < 1)
@ -1095,7 +1091,7 @@ void xf_SetWindowVisibilityRects(xfContext* xfc, xfAppWindow* appWindow, UINT32
#ifdef WITH_XEXT
xrects = (XRectangle*)calloc(nrects, sizeof(XRectangle));
for (i = 0; i < nrects; i++)
for (int i = 0; i < nrects; i++)
{
xrects[i].x = rects[i].left;
xrects[i].y = rects[i].top;
@ -1200,17 +1196,15 @@ void xf_DestroyWindow(xfContext* xfc, xfAppWindow* appWindow)
xfAppWindow* xf_AppWindowFromX11Window(xfContext* xfc, Window wnd)
{
size_t index = 0;
size_t count = 0;
ULONG_PTR* pKeys = NULL;
WINPR_ASSERT(xfc);
if (!xfc->railWindows)
return NULL;
count = HashTable_GetKeys(xfc->railWindows, &pKeys);
size_t count = HashTable_GetKeys(xfc->railWindows, &pKeys);
for (index = 0; index < count; index++)
for (size_t index = 0; index < count; index++)
{
xfAppWindow* appWindow = xf_rail_get_window(xfc, *(UINT64*)pKeys[index]);

View File

@ -367,7 +367,6 @@ out:
int freerdp_client_settings_parse_assistance_file(rdpSettings* settings, int argc, char* argv[])
{
int status = 0;
int x = 0;
int ret = -1;
char* filename = NULL;
char* password = NULL;
@ -378,7 +377,7 @@ int freerdp_client_settings_parse_assistance_file(rdpSettings* settings, int arg
filename = argv[1];
for (x = 2; x < argc; x++)
for (int x = 2; x < argc; x++)
{
const char* key = strstr(argv[x], "assistance:");

View File

@ -1033,8 +1033,6 @@ static void cliprdr_file_fuse_readdir(fuse_req_t fuse_req, fuse_ino_t fuse_ino,
size_t entry_size = 0;
char* filename = NULL;
char* buf = NULL;
off_t i = 0;
size_t j = 0;
WINPR_ASSERT(file_context);
@ -1071,7 +1069,7 @@ static void cliprdr_file_fuse_readdir(fuse_req_t fuse_req, fuse_ino_t fuse_ino,
}
written_size = 0;
for (i = offset; i < 2; ++i)
for (off_t i = offset; i < 2; ++i)
{
if (i == 0)
{
@ -1102,7 +1100,7 @@ static void cliprdr_file_fuse_readdir(fuse_req_t fuse_req, fuse_ino_t fuse_ino,
written_size += entry_size;
}
for (j = 0, i = 2; j < ArrayList_Count(fuse_file->children); ++j, ++i)
for (size_t j = 0, i = 2; j < ArrayList_Count(fuse_file->children); ++j, ++i)
{
if (i < offset)
continue;

View File

@ -287,10 +287,9 @@ BOOL freerdp_client_print_buildconfig(void)
static void freerdp_client_print_scancodes(void)
{
DWORD x = 0;
printf("RDP scancodes and their name for use with /kbd:remap\n");
for (x = 0; x < UINT16_MAX; x++)
for (UINT32 x = 0; x < UINT16_MAX; x++)
{
const char* name = freerdp_keyboard_scancode_name(x);
if (name)
@ -923,9 +922,8 @@ static BOOL parseSubOptions(rdpSettings* settings, const CmdLineSubOptions* opts
const char* arg)
{
BOOL found = FALSE;
size_t xx = 0;
for (xx = 0; xx < count; xx++)
for (size_t xx = 0; xx < count; xx++)
{
const CmdLineSubOptions* opt = &opts[xx];
@ -995,7 +993,6 @@ static int freerdp_client_command_line_post_filter(void* context, COMMAND_LINE_A
ptr.p = CommandLineParseCommaSeparatedValuesEx("kerberos", arg->Value, &count);
if (ptr.pc)
{
size_t x = 0;
const CmdLineSubOptions opts[] = {
{ "kdc-url:", FreeRDP_KerberosKdcUrl, CMDLINE_SUBOPTION_STRING, NULL },
{ "start-time:", FreeRDP_KerberosStartTime, CMDLINE_SUBOPTION_STRING, NULL },
@ -1008,7 +1005,7 @@ static int freerdp_client_command_line_post_filter(void* context, COMMAND_LINE_A
{ "pkcs11-module:", FreeRDP_Pkcs11Module, CMDLINE_SUBOPTION_STRING, NULL }
};
for (x = 1; x < count; x++)
for (size_t x = 1; x < count; x++)
{
const char* cur = ptr.pc[x];
if (!parseSubOptions(settings, opts, ARRAYSIZE(opts), cur))
@ -1386,14 +1383,13 @@ BOOL freerdp_set_connection_type(rdpSettings* settings, UINT32 type)
static UINT32 freerdp_get_keyboard_layout_for_type(const char* name, DWORD type)
{
size_t count = 0;
size_t x = 0;
RDP_KEYBOARD_LAYOUT* layouts =
freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_STANDARD, &count);
if (!layouts || (count == 0))
return FALSE;
for (x = 0; x < count; x++)
for (size_t x = 0; x < count; x++)
{
const RDP_KEYBOARD_LAYOUT* layout = &layouts[x];
if (option_equals(layout->name, name))
@ -1408,11 +1404,10 @@ static UINT32 freerdp_get_keyboard_layout_for_type(const char* name, DWORD type)
static UINT32 freerdp_map_keyboard_layout_name_to_id(const char* name)
{
size_t x = 0;
const UINT32 variants[] = { RDP_KEYBOARD_LAYOUT_TYPE_STANDARD, RDP_KEYBOARD_LAYOUT_TYPE_VARIANT,
RDP_KEYBOARD_LAYOUT_TYPE_IME };
for (x = 0; x < ARRAYSIZE(variants); x++)
for (size_t x = 0; x < ARRAYSIZE(variants); x++)
{
UINT32 rc = freerdp_get_keyboard_layout_for_type(name, variants[x]);
if (rc > 0)
@ -1588,15 +1583,13 @@ int freerdp_client_settings_command_line_status_print(rdpSettings* settings, int
static void freerdp_client_print_keyboard_type_list(const char* msg, DWORD type)
{
size_t x = 0;
size_t count = 0;
RDP_KEYBOARD_LAYOUT* layouts = NULL;
layouts = freerdp_keyboard_get_layouts(type, &count);
printf("\n%s\n", msg);
for (x = 0; x < count; x++)
for (size_t x = 0; x < count; x++)
{
const RDP_KEYBOARD_LAYOUT* layout = &layouts[x];
printf("0x%08" PRIX32 "\t%s\n", layout->code, layout->name);
@ -1892,7 +1885,6 @@ static BOOL parseSizeValue(const char* input, unsigned long* v1, unsigned long*
static BOOL prepare_default_settings(rdpSettings* settings, COMMAND_LINE_ARGUMENT_A* args,
BOOL rdp_file)
{
size_t x = 0;
const char* arguments[] = { "network", "gfx", "rfx", "bpp" };
WINPR_ASSERT(settings);
WINPR_ASSERT(args);
@ -1900,7 +1892,7 @@ static BOOL prepare_default_settings(rdpSettings* settings, COMMAND_LINE_ARGUMEN
if (rdp_file)
return FALSE;
for (x = 0; x < ARRAYSIZE(arguments); x++)
for (size_t x = 0; x < ARRAYSIZE(arguments); x++)
{
const char* arg = arguments[x];
const COMMAND_LINE_ARGUMENT_A* p = CommandLineFindArgumentA(args, arg);
@ -2129,9 +2121,8 @@ static int parse_tls_options(rdpSettings* settings, const COMMAND_LINE_ARGUMENT_
WINPR_ASSERT(arg);
size_t count = 0;
size_t x = 0;
char** ptr = CommandLineParseCommaSeparatedValues(arg->Value, &count);
for (x = 0; x < count; x++)
for (size_t x = 0; x < count; x++)
{
COMMAND_LINE_ARGUMENT_A larg = *arg;
larg.Value = ptr[x];
@ -2942,9 +2933,8 @@ static int parse_clipboard_options(rdpSettings* settings, const COMMAND_LINE_ARG
const char** pc;
} ptr;
size_t count = 0;
size_t x = 0;
ptr.p = CommandLineParseCommaSeparatedValues(arg->Value, &count);
for (x = 0; (x < count) && (rc == 0); x++)
for (size_t x = 0; (x < count) && (rc == 0); x++)
{
const char* usesel = "use-selection:";
@ -3109,13 +3099,12 @@ static int parse_sec_options(rdpSettings* settings, const COMMAND_LINE_ARGUMENT_
WINPR_ASSERT(arg);
size_t count = 0;
size_t x = 0;
char** ptr = CommandLineParseCommaSeparatedValues(arg->Value, &count);
if (count == 0)
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
FreeRDP_Settings_Keys_Bool singleOptionWithoutOnOff = FreeRDP_BOOL_UNUSED;
for (x = 0; x < count; x++)
for (size_t x = 0; x < count; x++)
{
const char* cur = ptr[x];
const PARSE_ON_OFF_RESULT bval = parse_on_off_option(cur);
@ -3229,9 +3218,8 @@ static int parse_cert_options(rdpSettings* settings, const COMMAND_LINE_ARGUMENT
const char** pc;
} ptr;
size_t count = 0;
size_t x = 0;
ptr.p = CommandLineParseCommaSeparatedValues(arg->Value, &count);
for (x = 0; (x < count) && (rc == 0); x++)
for (size_t x = 0; (x < count) && (rc == 0); x++)
{
const char deny[] = "deny";
const char ignore[] = "ignore";
@ -3495,7 +3483,6 @@ static int parse_smartcard_logon_options(rdpSettings* settings, const COMMAND_LI
ptr.p = CommandLineParseCommaSeparatedValuesEx("smartcard-logon", arg->Value, &count);
if (ptr.pc)
{
size_t x = 0;
const CmdLineSubOptions opts[] = {
{ "cert:", FreeRDP_SmartcardCertificate, CMDLINE_SUBOPTION_FILE,
setSmartcardEmulation },
@ -3507,7 +3494,7 @@ static int parse_smartcard_logon_options(rdpSettings* settings, const COMMAND_LI
{ "container:", FreeRDP_ContainerName, CMDLINE_SUBOPTION_STRING, NULL }
};
for (x = 1; x < count; x++)
for (size_t x = 1; x < count; x++)
{
const char* cur = ptr.pc[x];
if (!parseSubOptions(settings, opts, ARRAYSIZE(opts), cur))
@ -3526,7 +3513,6 @@ static int parse_tune_options(rdpSettings* settings, const COMMAND_LINE_ARGUMENT
WINPR_ASSERT(settings);
WINPR_ASSERT(arg);
size_t x = 0;
size_t count = 0;
union
{
@ -3536,7 +3522,7 @@ static int parse_tune_options(rdpSettings* settings, const COMMAND_LINE_ARGUMENT
ptr.p = CommandLineParseCommaSeparatedValuesEx("tune", arg->Value, &count);
if (!ptr.pc)
return COMMAND_LINE_ERROR;
for (x = 1; x < count; x++)
for (size_t x = 1; x < count; x++)
{
const char* cur = ptr.pc[x];
char* sep = strchr(cur, ':');

View File

@ -1317,14 +1317,13 @@ BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, const rdpSett
{
size_t offset = 0;
UINT32 x = 0;
UINT32 count = freerdp_settings_get_uint32(settings, FreeRDP_NumMonitorIds);
const UINT32* MonitorIds = freerdp_settings_get_pointer(settings, FreeRDP_MonitorIds);
/* String size: 10 char UINT32 max string length, 1 char separator, one element NULL */
size_t size = count * (10 + 1) + 1;
char* str = calloc(size, sizeof(char));
for (x = 0; x < count; x++)
for (UINT32 x = 0; x < count; x++)
{
int rc = _snprintf(&str[offset], size - offset, "%" PRIu32 ",", MonitorIds[x]);
if (rc <= 0)
@ -1625,7 +1624,6 @@ size_t freerdp_client_write_rdp_file_buffer(const rdpFile* file, char* buffer, s
static ADDIN_ARGV* rdp_file_to_args(const char* channel, const char* values)
{
size_t count = 0;
size_t x = 0;
char** p = NULL;
ADDIN_ARGV* args = freerdp_addin_argv_new(0, NULL);
if (!args)
@ -1634,7 +1632,7 @@ static ADDIN_ARGV* rdp_file_to_args(const char* channel, const char* values)
goto fail;
p = CommandLineParseCommaSeparatedValues(values, &count);
for (x = 0; x < count; x++)
for (size_t x = 0; x < count; x++)
{
BOOL rc = 0;
const char* val = p[x];
@ -2423,7 +2421,6 @@ BOOL freerdp_client_populate_settings_from_rdp_file(const rdpFile* file, rdpSett
if (~(size_t)file->SelectedMonitors)
{
size_t count = 0;
size_t x = 0;
char** args = CommandLineParseCommaSeparatedValues(file->SelectedMonitors, &count);
UINT32* list = NULL;
@ -2438,7 +2435,7 @@ BOOL freerdp_client_populate_settings_from_rdp_file(const rdpFile* file, rdpSett
free(args);
return FALSE;
}
for (x = 0; x < count; x++)
for (size_t x = 0; x < count; x++)
{
unsigned long val = 0;
errno = 0;
@ -2543,11 +2540,10 @@ BOOL freerdp_client_populate_settings_from_rdp_file(const rdpFile* file, rdpSett
static rdpFileLine* freerdp_client_rdp_file_find_line_by_name(const rdpFile* file, const char* name)
{
size_t index = 0;
BOOL bFound = FALSE;
rdpFileLine* line = NULL;
for (index = 0; index < file->lineCount; index++)
for (size_t index = 0; index < file->lineCount; index++)
{
line = &(file->lines[index]);
@ -2660,8 +2656,7 @@ void freerdp_client_rdp_file_free(rdpFile* file)
{
if (file->lineCount)
{
size_t i = 0;
for (i = 0; i < file->lineCount; i++)
for (size_t i = 0; i < file->lineCount; i++)
{
free(file->lines[i].name);
free(file->lines[i].sValue);

View File

@ -8,9 +8,7 @@
int TestClientChannels(int argc, char* argv[])
{
int index = 0;
DWORD dwFlags = 0;
FREERDP_ADDIN* pAddin = NULL;
FREERDP_ADDIN** ppAddins = NULL;
WINPR_UNUSED(argc);
@ -20,9 +18,9 @@ int TestClientChannels(int argc, char* argv[])
printf("Enumerate all\n");
ppAddins = freerdp_channels_list_addins(NULL, NULL, NULL, dwFlags);
for (index = 0; ppAddins[index] != NULL; index++)
for (size_t index = 0; ppAddins[index] != NULL; index++)
{
pAddin = ppAddins[index];
FREERDP_ADDIN* pAddin = ppAddins[index];
printf("Addin: Name: %s Subsystem: %s Type: %s\n", pAddin->cName, pAddin->cSubsystem,
pAddin->cType);
@ -33,9 +31,9 @@ int TestClientChannels(int argc, char* argv[])
printf("Enumerate rdpsnd\n");
ppAddins = freerdp_channels_list_addins(RDPSND_CHANNEL_NAME, NULL, NULL, dwFlags);
for (index = 0; ppAddins[index] != NULL; index++)
for (size_t index = 0; ppAddins[index] != NULL; index++)
{
pAddin = ppAddins[index];
FREERDP_ADDIN* pAddin = ppAddins[index];
printf("Addin: Name: %s Subsystem: %s Type: %s\n", pAddin->cName, pAddin->cSubsystem,
pAddin->cType);
@ -47,9 +45,9 @@ int TestClientChannels(int argc, char* argv[])
printf("Enumerate tsmf video\n");
ppAddins = freerdp_channels_list_addins("tsmf", NULL, "video", dwFlags);
for (index = 0; ppAddins[index] != NULL; index++)
for (size_t index = 0; ppAddins[index] != NULL; index++)
{
pAddin = ppAddins[index];
FREERDP_ADDIN* pAddin = ppAddins[index];
printf("Addin: Name: %s Subsystem: %s Type: %s\n", pAddin->cName, pAddin->cSubsystem,
pAddin->cType);
@ -60,9 +58,9 @@ int TestClientChannels(int argc, char* argv[])
ppAddins = freerdp_channels_list_addins("unknown", NULL, NULL, dwFlags);
for (index = 0; ppAddins[index] != NULL; index++)
for (size_t index = 0; ppAddins[index] != NULL; index++)
{
pAddin = ppAddins[index];
FREERDP_ADDIN* pAddin = ppAddins[index];
printf("Addin: Name: %s Subsystem: %s Type: %s\n", pAddin->cName, pAddin->cSubsystem,
pAddin->cType);
@ -75,9 +73,9 @@ int TestClientChannels(int argc, char* argv[])
dwFlags = FREERDP_ADDIN_STATIC;
ppAddins = freerdp_channels_list_addins(NULL, NULL, NULL, dwFlags);
for (index = 0; ppAddins[index] != NULL; index++)
for (size_t index = 0; ppAddins[index] != NULL; index++)
{
pAddin = ppAddins[index];
FREERDP_ADDIN* pAddin = ppAddins[index];
printf("Addin: Name: %s Subsystem: %s Type: %s\n", pAddin->cName, pAddin->cSubsystem,
pAddin->cType);

View File

@ -30,10 +30,9 @@ typedef BOOL (*validate_settings_pr)(rdpSettings* settings);
static void print_test_title(int argc, char** argv)
{
int i = 0;
printf("Running test:");
for (i = 0; i < argc; i++)
for (int i = 0; i < argc; i++)
{
printf(" %s", argv[i]);
}
@ -212,10 +211,9 @@ static const test tests[] = {
static void check_modified_arguments(const test* test, char** command_line, int* rc)
{
int k = 0;
const char* expected_argument = NULL;
for (k = 0; (expected_argument = test->modified_arguments[k].expected_value); k++)
for (int k = 0; (expected_argument = test->modified_arguments[k].expected_value); k++)
{
int index = test->modified_arguments[k].index;
char* actual_argument = command_line[index];
@ -234,11 +232,10 @@ static void check_modified_arguments(const test* test, char** command_line, int*
int TestClientCmdLine(int argc, char* argv[])
{
int rc = 0;
size_t i = 0;
WINPR_UNUSED(argc);
WINPR_UNUSED(argv);
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
for (size_t i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
{
const test* current = &tests[i];
int failure = 0;

View File

@ -422,7 +422,6 @@ int TestClientRdpFile(int argc, char* argv[])
/* Check [MS-RDPECAM] related options */
#if defined(CHANNEL_RDPECAM_CLIENT)
{
int x = 0;
ADDIN_ARGV* args = NULL;
iValue =
freerdp_client_rdp_file_get_integer_option(file, "encode redirected video capture");
@ -451,7 +450,7 @@ int TestClientRdpFile(int argc, char* argv[])
goto fail;
}
for (x = 0; x < args->argc; x++)
for (int x = 0; x < args->argc; x++)
{
if (strcmp(args->argv[x], camera_args[x]) != 0)
{
@ -465,7 +464,6 @@ int TestClientRdpFile(int argc, char* argv[])
/* Check [URBDRC] related options */
#if defined(CHANNEL_URBDRC_CLIENT)
{
int x = 0;
ADDIN_ARGV* args = freerdp_dynamic_channel_collection_find(settings, "urbdrc");
if (!args)
{
@ -478,7 +476,7 @@ int TestClientRdpFile(int argc, char* argv[])
goto fail;
}
for (x = 0; x < args->argc; x++)
for (int x = 0; x < args->argc; x++)
{
if (strcmp(args->argv[x], urbdrc_args[x]) != 0)
{

View File

@ -146,8 +146,8 @@ NSString *DescriptionForObject(NSObject *object, id locale, NSUInteger indent)
- (NSString *)descriptionWithLocale:(id)locale indent:(NSUInteger)level
{
NSMutableString *indentString = [NSMutableString string];
NSUInteger i, count = level;
for (i = 0; i < count; i++)
NSUInteger count = level;
for (NSUInteger i = 0; i < count; i++)
{
[indentString appendFormat:@" "];
}

View File

@ -108,12 +108,11 @@
withSeparator:(NSString *)sep
afterNthChar:(int)sepnth
{
int i;
NSMutableString *result;
NSString *immutableResult;
result = [[NSMutableString alloc] init];
for (i = 0; i < size; i++)
for (int i = 0; i < size; i++)
{
if (i && sep && sepnth && i % sepnth == 0)
[result appendString:sep];

View File

@ -34,7 +34,6 @@
UINT ios_cliprdr_send_client_format_list(CliprdrClientContext *cliprdr)
{
UINT rc = ERROR_INTERNAL_ERROR;
UINT32 index;
UINT32 formatId;
UINT32 numFormats;
UINT32 *pFormatIds;
@ -57,7 +56,7 @@ UINT ios_cliprdr_send_client_format_list(CliprdrClientContext *cliprdr)
if (!formats)
goto fail;
for (index = 0; index < numFormats; index++)
for (UINT32 index = 0; index < numFormats; index++)
{
formatId = pFormatIds[index];
formatName = ClipboardGetFormatName(afc->clipboard, formatId);
@ -167,7 +166,6 @@ static UINT ios_cliprdr_monitor_ready(CliprdrClientContext *cliprdr,
static UINT ios_cliprdr_server_capabilities(CliprdrClientContext *cliprdr,
const CLIPRDR_CAPABILITIES *capabilities)
{
UINT32 index;
CLIPRDR_CAPABILITY_SET *capabilitySet;
mfContext *afc;
@ -179,7 +177,7 @@ static UINT ios_cliprdr_server_capabilities(CliprdrClientContext *cliprdr,
if (!afc)
return ERROR_INVALID_PARAMETER;
for (index = 0; index < capabilities->cCapabilitiesSets; index++)
for (UINT32 index = 0; index < capabilities->cCapabilitiesSets; index++)
{
capabilitySet = &(capabilities->capabilitySets[index]);
@ -205,7 +203,6 @@ static UINT ios_cliprdr_server_format_list(CliprdrClientContext *cliprdr,
const CLIPRDR_FORMAT_LIST *formatList)
{
UINT rc;
UINT32 index;
CLIPRDR_FORMAT *format;
mfContext *afc;
@ -219,7 +216,7 @@ static UINT ios_cliprdr_server_format_list(CliprdrClientContext *cliprdr,
if (afc->serverFormats)
{
for (index = 0; index < afc->numServerFormats; index++)
for (UINT32 index = 0; index < afc->numServerFormats; index++)
free(afc->serverFormats[index].formatName);
free(afc->serverFormats);
@ -236,7 +233,7 @@ static UINT ios_cliprdr_server_format_list(CliprdrClientContext *cliprdr,
if (!afc->serverFormats)
return CHANNEL_RC_NO_MEMORY;
for (index = 0; index < afc->numServerFormats; index++)
for (UINT32 index = 0; index < afc->numServerFormats; index++)
{
afc->serverFormats[index].formatId = formatList->formats[index].formatId;
afc->serverFormats[index].formatName = NULL;
@ -252,7 +249,7 @@ static UINT ios_cliprdr_server_format_list(CliprdrClientContext *cliprdr,
BOOL unicode = FALSE;
BOOL text = FALSE;
for (index = 0; index < afc->numServerFormats; index++)
for (UINT32 index = 0; index < afc->numServerFormats; index++)
{
format = &(afc->serverFormats[index]);
@ -368,7 +365,6 @@ ios_cliprdr_server_format_data_response(CliprdrClientContext *cliprdr,
{
BYTE *data;
UINT32 size;
UINT32 index;
UINT32 formatId;
CLIPRDR_FORMAT *format = NULL;
mfContext *afc;
@ -387,7 +383,7 @@ ios_cliprdr_server_format_data_response(CliprdrClientContext *cliprdr,
if (!instance)
return ERROR_INVALID_PARAMETER;
for (index = 0; index < afc->numServerFormats; index++)
for (UINT32 index = 0; index < afc->numServerFormats; index++)
{
if (afc->requestedFormatId == afc->serverFormats[index].formatId)
format = &(afc->serverFormats[index]);

View File

@ -69,9 +69,7 @@ static BOOL addFlag(int *argc, char ***argv, const char *str, BOOL flag)
static void freeArguments(int argc, char **argv)
{
int i;
for (i = 0; i < argc; i++)
for (int i = 0; i < argc; i++)
free(argv[i]);
free(argv);

View File

@ -78,12 +78,11 @@
_pointer_scrolling = NO;
// create areas array
int i, j;
CGFloat area_width = [_cur_pointer_img size].width / 3.0f;
CGFloat area_height = [_cur_pointer_img size].height / 3.0f;
for (i = 0; i < 3; i++)
for (int i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
for (int j = 0; j < 3; j++)
{
_pointer_areas[j + i * 3] =
CGRectMake(j * area_width, i * area_height, area_width, area_height);

View File

@ -90,9 +90,8 @@ extern "C"
static INLINE BOOL array_##TLOWER##_contains(const Array##T* a, T v) \
{ \
WINPR_ASSERT(a); \
UINT32 i; \
\
for (i = 0; i < a->nvalues; i++) \
for (UINT32 i = 0; i < a->nvalues; i++) \
{ \
if (memcmp(&a->values[i], &v, sizeof(T)) == 0) \
return TRUE; \
@ -104,8 +103,7 @@ extern "C"
static INLINE BOOL array_##TLOWER##_foreach(Array##T* a, Array##T##Cb cb, void* data) \
{ \
WINPR_ASSERT(a); \
size_t i; \
for (i = 0; i < a->nvalues; i++) \
for (size_t i = 0; i < a->nvalues; i++) \
{ \
if (!cb(&a->values[i], data)) \
return FALSE; \

View File

@ -348,7 +348,6 @@ end:
rdpBitmapCache* bitmap_cache_new(rdpContext* context)
{
UINT32 i = 0;
rdpSettings* settings = NULL;
rdpBitmapCache* bitmapCache = NULL;
@ -371,7 +370,7 @@ rdpBitmapCache* bitmap_cache_new(rdpContext* context)
goto fail;
bitmapCache->maxCells = BitmapCacheV2NumCells;
for (i = 0; i < bitmapCache->maxCells; i++)
for (UINT32 i = 0; i < bitmapCache->maxCells; i++)
{
const BITMAP_CACHE_V2_CELL_INFO* info =
freerdp_settings_get_pointer_array(settings, FreeRDP_BitmapCacheV2CellInfo, i);
@ -430,12 +429,10 @@ void bitmap_cache_free(rdpBitmapCache* bitmapCache)
static void free_bitmap_data(BITMAP_DATA* data, size_t count)
{
size_t x = 0;
if (!data)
return;
for (x = 0; x < count; x++)
for (size_t x = 0; x < count; x++)
free(data[x].bitmapDataStream);
free(data);
@ -443,13 +440,12 @@ static void free_bitmap_data(BITMAP_DATA* data, size_t count)
static BITMAP_DATA* copy_bitmap_data(const BITMAP_DATA* data, size_t count)
{
size_t x = 0;
BITMAP_DATA* dst = (BITMAP_DATA*)calloc(count, sizeof(BITMAP_DATA));
if (!dst)
goto fail;
for (x = 0; x < count; x++)
for (size_t x = 0; x < count; x++)
{
dst[x] = data[x];

View File

@ -279,13 +279,11 @@ fail:
void brush_cache_free(rdpBrushCache* brushCache)
{
size_t i = 0;
if (brushCache)
{
if (brushCache->entries)
{
for (i = 0; i < brushCache->maxEntries; i++)
for (size_t i = 0; i < brushCache->maxEntries; i++)
free(brushCache->entries[i].entry);
free(brushCache->entries);
@ -293,7 +291,7 @@ void brush_cache_free(rdpBrushCache* brushCache)
if (brushCache->monoEntries)
{
for (i = 0; i < brushCache->maxMonoEntries; i++)
for (size_t i = 0; i < brushCache->maxMonoEntries; i++)
free(brushCache->monoEntries[i].entry);
free(brushCache->monoEntries);

View File

@ -138,7 +138,6 @@ static BOOL update_process_glyph_fragments(rdpContext* context, const BYTE* data
INT32 opX, INT32 opY, INT32 opWidth, INT32 opHeight,
BOOL fOpRedundant)
{
UINT32 n = 0;
UINT32 id = 0;
UINT32 size = 0;
UINT32 index = 0;
@ -251,7 +250,7 @@ static BOOL update_process_glyph_fragments(rdpContext* context, const BYTE* data
if (fragments == NULL)
return FALSE;
for (n = 0; n < size;)
for (size_t n = 0; n < size;)
{
const UINT32 fop = fragments[n++];
n = update_glyph_offset(fragments, size, n, &x, &y, ulCharInc, flAccel);
@ -492,7 +491,6 @@ static BOOL update_gdi_fast_glyph(rdpContext* context, const FAST_GLYPH_ORDER* f
static BOOL update_gdi_cache_glyph(rdpContext* context, const CACHE_GLYPH_ORDER* cacheGlyph)
{
UINT32 i = 0;
rdpCache* cache = NULL;
if (!context || !cacheGlyph || !context->cache)
@ -500,7 +498,7 @@ static BOOL update_gdi_cache_glyph(rdpContext* context, const CACHE_GLYPH_ORDER*
cache = context->cache;
for (i = 0; i < cacheGlyph->cGlyphs; i++)
for (size_t i = 0; i < cacheGlyph->cGlyphs; i++)
{
const GLYPH_DATA* glyph_data = &cacheGlyph->glyphData[i];
rdpGlyph* glyph = NULL;
@ -524,7 +522,6 @@ static BOOL update_gdi_cache_glyph(rdpContext* context, const CACHE_GLYPH_ORDER*
static BOOL update_gdi_cache_glyph_v2(rdpContext* context, const CACHE_GLYPH_V2_ORDER* cacheGlyphV2)
{
UINT32 i = 0;
rdpCache* cache = NULL;
if (!context || !cacheGlyphV2 || !context->cache)
@ -532,7 +529,7 @@ static BOOL update_gdi_cache_glyph_v2(rdpContext* context, const CACHE_GLYPH_V2_
cache = context->cache;
for (i = 0; i < cacheGlyphV2->cGlyphs; i++)
for (size_t i = 0; i < cacheGlyphV2->cGlyphs; i++)
{
const GLYPH_DATA_V2* glyphData = &cacheGlyphV2->glyphData[i];
rdpGlyph* glyph = NULL;
@ -693,7 +690,6 @@ void glyph_cache_register_callbacks(rdpUpdate* update)
rdpGlyphCache* glyph_cache_new(rdpContext* context)
{
size_t i = 0;
rdpGlyphCache* glyphCache = NULL;
rdpSettings* settings = NULL;
@ -710,7 +706,7 @@ rdpGlyphCache* glyph_cache_new(rdpContext* context)
glyphCache->log = WLog_Get("com.freerdp.cache.glyph");
glyphCache->context = context;
for (i = 0; i < 10; i++)
for (size_t i = 0; i < 10; i++)
{
const GLYPH_CACHE_DEFINITION* currentGlyph =
freerdp_settings_get_pointer_array(settings, FreeRDP_GlyphCache, i);
@ -736,18 +732,16 @@ void glyph_cache_free(rdpGlyphCache* glyphCache)
{
if (glyphCache)
{
size_t i = 0;
GLYPH_CACHE* cache = glyphCache->glyphCache;
for (i = 0; i < 10; i++)
for (size_t i = 0; i < 10; i++)
{
UINT32 j = 0;
rdpGlyph** entries = cache[i].entries;
if (!entries)
continue;
for (j = 0; j < cache[i].number; j++)
for (size_t j = 0; j < cache[i].number; j++)
{
rdpGlyph* glyph = entries[j];
@ -762,7 +756,7 @@ void glyph_cache_free(rdpGlyphCache* glyphCache)
cache[i].entries = NULL;
}
for (i = 0; i < ARRAYSIZE(glyphCache->fragCache.entries); i++)
for (size_t i = 0; i < ARRAYSIZE(glyphCache->fragCache.entries); i++)
{
free(glyphCache->fragCache.entries[i].fragment);
glyphCache->fragCache.entries[i].fragment = NULL;
@ -774,7 +768,6 @@ void glyph_cache_free(rdpGlyphCache* glyphCache)
CACHE_GLYPH_ORDER* copy_cache_glyph_order(rdpContext* context, const CACHE_GLYPH_ORDER* glyph)
{
size_t x = 0;
CACHE_GLYPH_ORDER* dst = NULL;
WINPR_ASSERT(context);
@ -786,7 +779,7 @@ CACHE_GLYPH_ORDER* copy_cache_glyph_order(rdpContext* context, const CACHE_GLYPH
*dst = *glyph;
for (x = 0; x < glyph->cGlyphs; x++)
for (size_t x = 0; x < glyph->cGlyphs; x++)
{
const GLYPH_DATA* src = &glyph->glyphData[x];
GLYPH_DATA* data = &dst->glyphData[x];
@ -826,9 +819,7 @@ void free_cache_glyph_order(rdpContext* context, CACHE_GLYPH_ORDER* glyph)
{
if (glyph)
{
size_t x = 0;
for (x = 0; x < ARRAYSIZE(glyph->glyphData); x++)
for (size_t x = 0; x < ARRAYSIZE(glyph->glyphData); x++)
free(glyph->glyphData[x].aj);
free(glyph->unicodeCharacters);
@ -840,7 +831,6 @@ void free_cache_glyph_order(rdpContext* context, CACHE_GLYPH_ORDER* glyph)
CACHE_GLYPH_V2_ORDER* copy_cache_glyph_v2_order(rdpContext* context,
const CACHE_GLYPH_V2_ORDER* glyph)
{
size_t x = 0;
CACHE_GLYPH_V2_ORDER* dst = NULL;
WINPR_ASSERT(context);
@ -852,7 +842,7 @@ CACHE_GLYPH_V2_ORDER* copy_cache_glyph_v2_order(rdpContext* context,
*dst = *glyph;
for (x = 0; x < glyph->cGlyphs; x++)
for (size_t x = 0; x < glyph->cGlyphs; x++)
{
const GLYPH_DATA_V2* src = &glyph->glyphData[x];
GLYPH_DATA_V2* data = &dst->glyphData[x];
@ -892,9 +882,7 @@ void free_cache_glyph_v2_order(rdpContext* context, CACHE_GLYPH_V2_ORDER* glyph)
{
if (glyph)
{
size_t x = 0;
for (x = 0; x < ARRAYSIZE(glyph->glyphData); x++)
for (size_t x = 0; x < ARRAYSIZE(glyph->glyphData); x++)
free(glyph->glyphData[x].aj);
free(glyph->unicodeCharacters);

View File

@ -158,8 +158,7 @@ void nine_grid_cache_free(rdpNineGridCache* nine_grid)
{
if (nine_grid->entries != NULL)
{
size_t i = 0;
for (i = 0; i < nine_grid->maxEntries; i++)
for (size_t i = 0; i < nine_grid->maxEntries; i++)
free(nine_grid->entries[i].entry);
free(nine_grid->entries);

View File

@ -52,7 +52,6 @@ static BOOL
update_gdi_create_offscreen_bitmap(rdpContext* context,
const CREATE_OFFSCREEN_BITMAP_ORDER* createOffscreenBitmap)
{
UINT32 i = 0;
UINT16 index = 0;
rdpBitmap* bitmap = NULL;
rdpCache* cache = NULL;
@ -80,7 +79,7 @@ update_gdi_create_offscreen_bitmap(rdpContext* context,
if (cache->offscreen->currentSurface == createOffscreenBitmap->id)
bitmap->SetSurface(context, bitmap, FALSE);
for (i = 0; i < createOffscreenBitmap->deleteList.cIndices; i++)
for (UINT32 i = 0; i < createOffscreenBitmap->deleteList.cIndices; i++)
{
index = createOffscreenBitmap->deleteList.indices[i];
offscreen_cache_delete(cache->offscreen, index);
@ -229,10 +228,9 @@ void offscreen_cache_free(rdpOffscreenCache* offscreenCache)
{
if (offscreenCache)
{
size_t i = 0;
if (offscreenCache->entries)
{
for (i = 0; i < offscreenCache->maxEntries; i++)
for (size_t i = 0; i < offscreenCache->maxEntries; i++)
{
rdpBitmap* bitmap = offscreenCache->entries[i];
Bitmap_Free(offscreenCache->context, bitmap);

View File

@ -111,9 +111,7 @@ void palette_cache_free(rdpPaletteCache* paletteCache)
{
if (paletteCache)
{
UINT32 i = 0;
for (i = 0; i < paletteCache->maxEntries; i++)
for (UINT32 i = 0; i < paletteCache->maxEntries; i++)
free(paletteCache->entries[i].entry);
free(paletteCache->entries);

View File

@ -373,14 +373,11 @@ void pointer_cache_free(rdpPointerCache* pointer_cache)
{
if (pointer_cache != NULL)
{
UINT32 i = 0;
rdpPointer* pointer = NULL;
if (pointer_cache->entries)
{
for (i = 0; i < pointer_cache->cacheSize; i++)
for (UINT32 i = 0; i < pointer_cache->cacheSize; i++)
{
pointer = pointer_cache->entries[i];
rdpPointer* pointer = pointer_cache->entries[i];
pointer_free(pointer_cache->context, pointer);
}
}

View File

@ -130,16 +130,13 @@ void audio_format_print(wLog* log, DWORD level, const AUDIO_FORMAT* format)
void audio_formats_print(wLog* log, DWORD level, const AUDIO_FORMAT* formats, UINT16 count)
{
UINT16 index = 0;
const AUDIO_FORMAT* format = NULL;
if (formats)
{
WLog_Print(log, level, "AUDIO_FORMATS (%" PRIu16 ") ={", count);
for (index = 0; index < count; index++)
for (UINT32 index = 0; index < count; index++)
{
format = &formats[index];
const AUDIO_FORMAT* format = &formats[index];
WLog_Print(log, level, "\t");
audio_format_print(log, level, format);
}
@ -288,11 +285,9 @@ void audio_format_free(AUDIO_FORMAT* format)
void audio_formats_free(AUDIO_FORMAT* formats, size_t count)
{
size_t index = 0;
if (formats)
{
for (index = 0; index < count; index++)
for (size_t index = 0; index < count; index++)
{
AUDIO_FORMAT* format = &formats[index];
audio_format_free(format);

View File

@ -484,7 +484,6 @@ static SSIZE_T freerdp_bitmap_compress_24(const void* srcData, UINT32 width, UIN
while ((line >= start) && (out_count < 32768))
{
UINT32 j = 0;
size_t i = Stream_GetPosition(s) + count * 3U;
if ((i - (color_count * 3) >= byte_limit) && (i - (bicolor_count * 3) >= byte_limit) &&
@ -496,7 +495,7 @@ static SSIZE_T freerdp_bitmap_compress_24(const void* srcData, UINT32 width, UIN
out_count += end * 3;
for (j = 0; j < end; j++)
for (UINT32 j = 0; j < end; j++)
{
/* read next pixel */
const UINT32 pixel = IN_PIXEL32(line, j, 0, width, last_pixel);
@ -790,7 +789,6 @@ static SSIZE_T freerdp_bitmap_compress_16(const void* srcData, UINT32 width, UIN
while ((line >= start) && (out_count < 32768))
{
UINT32 j = 0;
size_t i = Stream_GetPosition(s) + count * 2;
if ((i - (color_count * 2) >= byte_limit) && (i - (bicolor_count * 2) >= byte_limit) &&
@ -802,7 +800,7 @@ static SSIZE_T freerdp_bitmap_compress_16(const void* srcData, UINT32 width, UIN
out_count += end * 2;
for (j = 0; j < end; j++)
for (UINT32 j = 0; j < end; j++)
{
/* read next pixel */
const UINT16 pixel = IN_PIXEL16(line, j, 0, width, last_pixel);

Some files were not shown because too many files have changed in this diff Show More