pad-windows: Fix a couple of warnings, make codacy happy.

This commit is contained in:
lightningterror 2021-03-18 18:58:54 +01:00
parent 0a3f380718
commit 5e27e6dd78
2 changed files with 5 additions and 11 deletions

View File

@ -26,11 +26,10 @@ Device* dev;
INT_PTR CALLBACK DiagDialog(HWND hWnd, unsigned int uMsg, WPARAM wParam, LPARAM lParam)
{
int i;
HWND hWndList = GetDlgItem(hWnd, IDC_DIAG_LIST);
static int fullRefresh;
if (dev)
{
static int fullRefresh;
switch (uMsg)
{
case WM_INITDIALOG:
@ -49,7 +48,7 @@ INT_PTR CALLBACK DiagDialog(HWND hWnd, unsigned int uMsg, WPARAM wParam, LPARAM
LVITEM item;
item.mask = LVIF_TEXT;
item.iSubItem = 0;
for (i = 0; i < dev->numVirtualControls; i++)
for (int i = 0; i < dev->numVirtualControls; i++)
{
item.pszText = dev->GetVirtualControlName(dev->virtualControls + i);
item.iItem = i;
@ -71,7 +70,7 @@ INT_PTR CALLBACK DiagDialog(HWND hWnd, unsigned int uMsg, WPARAM wParam, LPARAM
if (!dev->active)
{
item.pszText = L"N/A";
for (i = 0; i < dev->numVirtualControls; i++)
for (int i = 0; i < dev->numVirtualControls; i++)
{
item.iItem = i;
ListView_SetItem(hWndList, &item);
@ -80,7 +79,7 @@ INT_PTR CALLBACK DiagDialog(HWND hWnd, unsigned int uMsg, WPARAM wParam, LPARAM
}
else
{
for (i = 0; i < dev->numVirtualControls; i++)
for (int i = 0; i < dev->numVirtualControls; i++)
{
if (fullRefresh || dev->virtualControlState[i] != dev->oldVirtualControlState[i])
{
@ -100,10 +99,6 @@ INT_PTR CALLBACK DiagDialog(HWND hWnd, unsigned int uMsg, WPARAM wParam, LPARAM
sign = L"-";
val = -val;
}
if ((c->uid & UID_AXIS) && val)
{
val = val;
}
val = (int)floor(0.5 + val * 1000.0 / (double)FULLY_DOWN);
wsprintfW(temp, L"%s%i.%03i", sign, val / 1000, val % 1000);
}

View File

@ -199,13 +199,12 @@ struct DS3Command
int CharToAxis(unsigned char c)
{
int v = (int)c + ((unsigned int)c >> 7);
return ((c - 128) * FULLY_DOWN) >> 7;
}
int CharToButton(unsigned char c)
{
int v = (int)c + ((unsigned int)c >> 7);
const int v = (int)c + ((unsigned int)c >> 7);
return (v * FULLY_DOWN) >> 8;
}