From 568075beb502c4d3e0e855140fa23d01862e67c3 Mon Sep 17 00:00:00 2001 From: ArkadiuszMichalski <2730894+ArkadiuszMichalski@users.noreply.github.com> Date: Sat, 4 Mar 2023 19:27:36 +0100 Subject: [PATCH] Fix wrong value set in Preferences->Performance->"Define Large File Size" Use correct type for file size variables. Fix #13280, close #13290 --- PowerEditor/src/Parameters.cpp | 4 ++-- PowerEditor/src/WinControls/Preference/preferenceDlg.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 76b17cddc..8ace90d62 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -5731,8 +5731,8 @@ void NppParameters::feedGUIParameters(TiXmlNode *node) { int fileSizeLimit4StylingMB = 0; element->Attribute(TEXT("fileSizeMB"), &fileSizeLimit4StylingMB); - if (fileSizeLimit4StylingMB > 0 && fileSizeLimit4StylingMB < 4096) - _nppGUI._largeFileRestriction._largeFileSizeDefInByte = (fileSizeLimit4StylingMB * 1024 * 1024); + if (fileSizeLimit4StylingMB > 0 && fileSizeLimit4StylingMB <= 4096) + _nppGUI._largeFileRestriction._largeFileSizeDefInByte = (static_cast(fileSizeLimit4StylingMB) * 1024 * 1024); const TCHAR* boolVal = element->Attribute(TEXT("isEnabled")); if (boolVal != NULL && !lstrcmp(boolVal, TEXT("no"))) diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 3dc9af039..b7beaef4a 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -5166,7 +5166,7 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L if (lstrcmp(str, TEXT("")) == 0) return TRUE; - size_t fileLenInMB = ::GetDlgItemInt(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, NULL, FALSE); + int64_t fileLenInMB = ::GetDlgItemInt(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, NULL, FALSE); if (fileLenInMB > 4096) { @@ -5195,7 +5195,7 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L return TRUE; } - size_t fileLenInMB = ::GetDlgItemInt(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, NULL, FALSE); + int64_t fileLenInMB = ::GetDlgItemInt(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, NULL, FALSE); if (fileLenInMB == 0) {