[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

@@ -50,12 +50,11 @@ int main(int argc, char* argv[])
freerdp_server_warn_unmaintained(argc, argv);
BOOL screen_selected = FALSE;
int index;
int index = 1;
wfServer* server;
server = wfreerdp_server_new();
set_screen_id(0);
// handle args
index = 1;
errno = 0;
while (index < argc)
@@ -66,11 +65,10 @@ int main(int argc, char* argv[])
int width;
int height;
int bpp;
int i;
WLog_INFO(TAG, "Detecting screens...");
WLog_INFO(TAG, "ID\tResolution\t\tName (Interface)");
for (i = 0;; i++)
for (int i = 0;; i++)
{
_TCHAR name[128] = { 0 };
if (get_screen_info(i, name, ARRAYSIZE(name), &width, &height, &bpp) != 0)
@@ -139,12 +137,11 @@ int main(int argc, char* argv[])
int width;
int height;
int bpp;
int i;
WLog_INFO(TAG, "screen id not provided. attempting to detect...");
WLog_INFO(TAG, "Detecting screens...");
WLog_INFO(TAG, "ID\tResolution\t\tName (Interface)");
for (i = 0;; i++)
for (int i = 0;; i++)
{
_TCHAR name[128] = { 0 };
if (get_screen_info(i, name, ARRAYSIZE(name), &width, &height, &bpp) != 0)

View File

@@ -411,7 +411,6 @@ int wf_dxgi_releasePixelData(wfInfo* wfi)
int wf_dxgi_getInvalidRegion(RECT* invalid)
{
UINT i;
HRESULT status;
UINT dirty;
UINT BufSize;
@@ -474,7 +473,7 @@ int wf_dxgi_getInvalidRegion(RECT* invalid)
pRect = (RECT*)DirtyRects;
for (i = 0; i < dirty; ++i)
for (UINT i = 0; i < dirty; ++i)
{
UnionRect(invalid, invalid, pRect);
++pRect;

View File

@@ -193,7 +193,6 @@ wfInfo* wf_info_get_instance()
BOOL wf_info_peer_register(wfInfo* wfi, wfPeerContext* context)
{
int i;
int peerId = 0;
if (!wfi || !context)
@@ -227,7 +226,7 @@ BOOL wf_info_peer_register(wfInfo* wfi, wfPeerContext* context)
#endif
// look through the array of peers until an empty slot
for (i = 0; i < FREERDP_SERVER_WIN_INFO_MAXPEERS; ++i)
for (int i = 0; i < FREERDP_SERVER_WIN_INFO_MAXPEERS; ++i)
{
// empty index will be our peer id
if (wfi->peers[i] == NULL)
@@ -308,11 +307,10 @@ void wf_info_find_invalid_region(wfInfo* wfi)
#ifdef WITH_DXGI_1_2
wf_dxgi_getInvalidRegion(&wfi->invalid);
#else
int i;
GETCHANGESBUF* buf;
buf = (GETCHANGESBUF*)wfi->changeBuffer;
for (i = wfi->lastUpdate; i != wfi->nextUpdate; i = (i + 1) % MAXCHANGES_BUF)
for (int i = wfi->lastUpdate; i != wfi->nextUpdate; i = (i + 1) % MAXCHANGES_BUF)
{
LPRECT lpR = &buf->buffer->pointrect[i].rect;

View File

@@ -45,16 +45,14 @@
static void wf_peer_rdpsnd_activated(RdpsndServerContext* context)
{
wfInfo* wfi;
size_t i;
wfi = wf_info_get_instance();
wfi->agreed_format = NULL;
WLog_DBG(TAG, "Client supports the following %d formats:", context->num_client_formats);
for (i = 0; i < context->num_client_formats; i++)
for (size_t i = 0; i < context->num_client_formats; i++)
{
size_t j;
// TODO: improve the way we agree on a format
for (j = 0; j < context->num_server_formats; j++)
for (size_t j = 0; j < context->num_server_formats; j++)
{
if ((context->client_formats[i].wFormatTag == context->server_formats[j].wFormatTag) &&
(context->client_formats[i].nChannels == context->server_formats[j].nChannels) &&

View File

@@ -38,8 +38,6 @@
DWORD WINAPI wf_update_thread(LPVOID lpParam)
{
int index;
int peerindex;
DWORD fps;
wfInfo* wfi;
DWORD beg, end;
@@ -62,9 +60,9 @@ DWORD WINAPI wf_update_thread(LPVOID lpParam)
{
wf_update_encode(wfi);
// WLog_DBG(TAG, "Start of parallel sending");
index = 0;
int index = 0;
for (peerindex = 0; peerindex < wfi->peerCount; peerindex++)
for (int peerindex = 0; peerindex < wfi->peerCount; peerindex++)
{
for (; index < FREERDP_SERVER_WIN_INFO_MAXPEERS; index++)
{
@@ -77,7 +75,7 @@ DWORD WINAPI wf_update_thread(LPVOID lpParam)
}
}
for (index = 0; index < wfi->activePeerCount; index++)
for (int index = 0; index < wfi->activePeerCount; index++)
{
// WLog_DBG(TAG, "Waiting for %d of %d", index + 1, wfi->activePeerCount);
// WaitForSingleObject(wfi->updateSemaphore, INFINITE);

View File

@@ -71,7 +71,7 @@ int wf_wasapi_get_device_string(LPWSTR pattern, LPWSTR* deviceStr)
IMMDevice* pEndpoint = NULL;
IPropertyStore* pProps = NULL;
LPWSTR pwszID = NULL;
unsigned int count, i;
unsigned int count;
CoInitialize(NULL);
hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &IID_IMMDeviceEnumerator,
@@ -99,7 +99,7 @@ int wf_wasapi_get_device_string(LPWSTR pattern, LPWSTR* deviceStr)
exit(1);
}
for (i = 0; i < count; ++i)
for (unsigned int i = 0; i < count; ++i)
{
PROPVARIANT nameVar;
PropVariantInit(&nameVar);