diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2020-02-10 00:21:15 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2020-02-10 02:23:18 +0100 |
commit | c1d670fd752b96abac09b919d7ca1bff4ebafcbc (patch) | |
tree | 27c927e9dc15e6d528aa3475b653bd0381031b83 /src/Common/Dlgcode.c | |
parent | a7b61ce5e5a0d0d5ab2814d59e832c169e1b845f (diff) | |
download | VeraCrypt-c1d670fd752b96abac09b919d7ca1bff4ebafcbc.tar.gz VeraCrypt-c1d670fd752b96abac09b919d7ca1bff4ebafcbc.zip |
Windows: Fix warnings reported by Coverity static code analyzer
Diffstat (limited to 'src/Common/Dlgcode.c')
-rw-r--r-- | src/Common/Dlgcode.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index 7640b59e..5a2ed526 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -5529,11 +5529,11 @@ static void DisplayBenchmarkResults (HWND hwndDlg) SendMessageW (hList, LVM_SETITEMW, 0, (LPARAM)&LvItem); break; case BENCHMARK_TYPE_PRF: - swprintf_s (item1, sizeof(item1) / sizeof(item1[0]), L"%d ms", benchmarkTable[i].meanBytesPerSec); + swprintf_s (item1, sizeof(item1) / sizeof(item1[0]), L"%d ms", (int) benchmarkTable[i].meanBytesPerSec); LvItem.iSubItem = 1; LvItem.pszText = item1; SendMessageW (hList, LVM_SETITEMW, 0, (LPARAM)&LvItem); - swprintf_s (item1, sizeof(item1) / sizeof(item1[0]), L"%d", benchmarkTable[i].decSpeed); + swprintf_s (item1, sizeof(item1) / sizeof(item1[0]), L"%d", (int) benchmarkTable[i].decSpeed); LvItem.iSubItem = 2; LvItem.pszText = item1; SendMessageW (hList, LVM_SETITEMW, 0, (LPARAM)&LvItem); @@ -7530,7 +7530,10 @@ int GetLastAvailableDrive () BOOL IsDriveAvailable (int driveNo) { - return (GetUsedLogicalDrives() & (1 << driveNo)) == 0; + if (driveNo >= 0 && driveNo < 26) + return (GetUsedLogicalDrives() & (1 << driveNo)) == 0; + else + return FALSE; } @@ -13057,7 +13060,7 @@ BOOL IsApplicationInstalled (const wchar_t *appName, BOOL b32bitApp) } wchar_t regName[1024]; - DWORD regNameSize = sizeof (regName); + DWORD regNameSize = ARRAYSIZE (regName); DWORD index = 0; while (RegEnumKeyEx (unistallKey, index++, regName, ®NameSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { |