From 46a3fe1458b6d34eb5f1b97e8fc6f60656cb3611 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sun, 11 Jun 2017 11:07:51 +0200 Subject: Windows: fix compiler warnings --- src/Common/BootEncryption.cpp | 2 -- src/Common/Combo.c | 2 +- src/Common/Dlgcode.c | 2 +- src/ExpandVolume/WinMain.cpp | 20 ++++++++++---------- src/Format/Tcformat.c | 4 ++-- src/Mount/Mount.c | 2 +- 6 files changed, 15 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp index 1c68a2fe..b2ab9f2a 100644 --- a/src/Common/BootEncryption.cpp +++ b/src/Common/BootEncryption.cpp @@ -2223,8 +2223,6 @@ namespace VeraCrypt } void EfiBoot::MountBootPartition(WCHAR letter) { - NTSTATUS res; - ULONG len; if (!bBootVolumePathSelected) { SelectBootVolumeESP(); } diff --git a/src/Common/Combo.c b/src/Common/Combo.c index 50e9761c..ab550a14 100644 --- a/src/Common/Combo.c +++ b/src/Common/Combo.c @@ -142,7 +142,7 @@ void LoadCombo (HWND hComboBox, BOOL bEnabled, BOOL bOnlyCheckModified, BOOL *pb char *xml = history; char volume[MAX_PATH]; int i, nComboIdx[SIZEOF_MRU_LIST] = {0}; - int count = SendMessage (hComboBox, CB_GETCOUNT, 0, 0); + int count = (int) SendMessage (hComboBox, CB_GETCOUNT, 0, 0); if (xml == NULL) { diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index f21d551f..ccd44e16 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -3416,7 +3416,7 @@ BOOL CALLBACK TextEditDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa if (!prm->ReadOnly) { prm->Text.resize(GetWindowTextLengthA (GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT)) + 1); - GetWindowTextA (GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), &(prm->Text)[0], prm->Text.size()); + GetWindowTextA (GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), &(prm->Text)[0], (int) prm->Text.size()); } NormalCursor (); EndDialog (hwndDlg, IDOK); diff --git a/src/ExpandVolume/WinMain.cpp b/src/ExpandVolume/WinMain.cpp index 70ea266a..150ed83d 100644 --- a/src/ExpandVolume/WinMain.cpp +++ b/src/ExpandVolume/WinMain.cpp @@ -428,13 +428,13 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA HWND hComboBox = GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID); SendMessage (hComboBox, CB_RESETCONTENT, 0, 0); - nIndex = SendMessageW (hComboBox, CB_ADDSTRING, 0, (LPARAM) GetString ("AUTODETECTION")); - SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) 0); + nIndex =(int) SendMessageW (hComboBox, CB_ADDSTRING, 0, (LPARAM) GetString ("AUTODETECTION")); + SendMessage (hComboBox, CB_SETITEMDATA, (WPARAM) nIndex, (LPARAM) 0); for (i = FIRST_PRF_ID; i <= LAST_PRF_ID; i++) { - nIndex = SendMessage (hComboBox, CB_ADDSTRING, 0, (LPARAM) get_pkcs5_prf_name(i)); - SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) i); + nIndex = (int) SendMessage (hComboBox, CB_ADDSTRING, 0, (LPARAM) get_pkcs5_prf_name(i)); + SendMessage (hComboBox, CB_SETITEMDATA, (WPARAM) nIndex, (LPARAM) i); } /* make autodetection the default */ @@ -502,7 +502,7 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA HWND hComboBox = GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID); SendMessage (hComboBox, CB_RESETCONTENT, 0, 0); - int i, nIndex = SendMessageW (hComboBox, CB_ADDSTRING, 0, (LPARAM) GetString ("AUTODETECTION")); + int i, nIndex = (int) SendMessageW (hComboBox, CB_ADDSTRING, 0, (LPARAM) GetString ("AUTODETECTION")); SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) 0); BOOL bIsGPT = FALSE; @@ -517,8 +517,8 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA { if (bIsGPT || HashForSystemEncryption(i)) { - nIndex = SendMessage (hComboBox, CB_ADDSTRING, 0, (LPARAM) get_pkcs5_prf_name(i)); - SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) i); + nIndex = (int) SendMessage (hComboBox, CB_ADDSTRING, 0, (LPARAM) get_pkcs5_prf_name(i)); + SendMessage (hComboBox, CB_SETITEMDATA, (WPARAM) nIndex, (LPARAM) i); } } @@ -677,7 +677,7 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA KeyFilesApply (hwndDlg, &mountOptions.ProtectedHidVolPassword, hidVolProtKeyFilesParam.FirstKeyFile, PasswordDlgVolume); if (GetPassword (hwndDlg, IDC_PASSWORD, (LPSTR) szXPwd->Text, MAX_PASSWORD + 1, TRUE)) - szXPwd->Length = strlen ((char *) szXPwd->Text); + szXPwd->Length = (unsigned __int32) (strlen ((char *) szXPwd->Text)); else return 1; @@ -803,7 +803,7 @@ int RestoreVolumeHeader (HWND hwndDlg, char *lpszVolume) int ExtcvAskVolumePassword (HWND hwndDlg, const wchar_t* fileName, Password *password, int *pkcs5, int *pim, BOOL* truecryptMode, char *titleStringId, BOOL enableMountOptions) { - int result; + INT_PTR result; PasswordDlgParam dlgParam; PasswordDialogTitleStringId = titleStringId; @@ -850,7 +850,7 @@ static BOOL SelectPartition (HWND hwndDlg) { RawDevicesDlgParam param; param.pszFileName = szFileName; - int nResult = DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_RAWDEVICES_DLG), hwndDlg, + INT_PTR nResult = DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_RAWDEVICES_DLG), hwndDlg, (DLGPROC) RawDevicesDlgProc, (LPARAM) & param); if (nResult == IDOK) { diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c index e7acdc68..d6eb0c37 100644 --- a/src/Format/Tcformat.c +++ b/src/Format/Tcformat.c @@ -6134,8 +6134,8 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (nVolumeSize < (bHiddenVolHost ? TC_MIN_HIDDEN_VOLUME_HOST_SIZE : (bHiddenVol ? TC_MIN_HIDDEN_VOLUME_SIZE : TC_MIN_VOLUME_SIZE))) AbortProcess ("ERR_VOLUME_SIZE_TOO_SMALL"); - if ( ((!bHiddenVolHost && bHiddenVol) && (nVolumeSize > nMaximumHiddenVolSize)) - || (nVolumeSize > (bHiddenVolHost ? TC_MAX_HIDDEN_VOLUME_HOST_SIZE : TC_MAX_VOLUME_SIZE)) + if ( ((!bHiddenVolHost && bHiddenVol) && (nVolumeSize > (unsigned __int64) nMaximumHiddenVolSize)) + || (nVolumeSize > (unsigned __int64) (bHiddenVolHost ? TC_MAX_HIDDEN_VOLUME_HOST_SIZE : TC_MAX_VOLUME_SIZE)) ) { AbortProcess ("ERR_VOLUME_SIZE_TOO_BIG"); diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c index 6b4d92dc..51a856e4 100644 --- a/src/Mount/Mount.c +++ b/src/Mount/Mount.c @@ -11065,7 +11065,7 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA { platforminfo = ReadESPFile (L"\\EFI\\VeraCrypt\\PlatformInfo", true); } - catch (Exception &e) {} + catch (Exception &) {} if (platforminfo.length() == 0) { -- cgit v1.2.3