Compare commits

...

2 Commits

Author SHA1 Message Date
Joachim Henze
5eb27e3f4a using DBG_UNREFERENCED_LOCAL_VARIABLE(iLargeImage); allows to keep the assert.
As suggested by Stasm.

Personally I think the assert is overkill here, but if it makes others happy,
then I do it like that. Better than the compilers whining definitely.
2024-02-25 21:22:35 +01:00
Joachim Henze
3edc2e8dd6 [SHELL32] Fix 2 compiler warnings for the rls-configuration about unused variable
I noticed it on releases/0.4.10 with the RosBEWin2.1.6 GCC4.7.2 *rls* configuration:

C:/0410rls/reactos/dll/win32/shell32/dialogs/filetypes.cpp: In function 'BOOL FileTypesDlg_InsertToLV(HWND, LPCWSTR, INT, LPCWSTR)':
C:/0410rls/reactos/dll/win32/shell32/dialogs/filetypes.cpp:663:9: warning: variable 'iLargeImage' set but not used [-Wunused-but-set-variable]
C:/0410rls/reactos/dll/win32/shell32/dialogs/filetypes.cpp: In function 'BOOL EditTypeDlg_UpdateEntryIcon(HWND, PEDITTYPE_DIALOG, LPCWSTR, INT)':
C:/0410rls/reactos/dll/win32/shell32/dialogs/filetypes.cpp:1040:9: warning: unused variable 'iLargeImage' [-Wunused-variable]

But I do assume, that MSVC compilers would also complain about that in rls cfg.

Please notice that before 0.4.10-dev-202-g 698cbc6184 which did splitup and restructure the code
this function was placed within the file folder_options.cpp and was named
InsertFileType(HWND hDlgCtrl, WCHAR * szName, PINT iItem, WCHAR * szFile)
and not yet within file_types.cpp with the new name
FileTypesDlg_InsertToLV(HWND hListView, LPCWSTR szName, INT iItem, LPCWSTR szFile)
Back then it did not have the iLargeImage variable yet, and it also didn't warn upon rls-cfg-compilation.
Therefore 0.4.10-dev-202-g 698cbc6184 from (#582) is indeed the guilty revision (2018-06-06).
It was done in the very first commit of that PR 2fe0eab721
FTR: It's bad practice to move and refactor/extend code in functionality within the very same commit, as it makes reviewing the changes much harder.

For the record: That assert never fired for the last 6 years, therefore I dared to strip it,
because the alternative with adding 2x '#ifdef DEBUG' would look rather ugly.
2024-02-25 21:05:28 +01:00

View File

@@ -666,6 +666,7 @@ FileTypesDlg_InsertToLV(HWND hListView, LPCWSTR szName, INT iItem, LPCWSTR szFil
iLargeImage = ImageList_AddIcon(himlLarge, Entry->hIconLarge);
iSmallImage = ImageList_AddIcon(himlSmall, Entry->hIconSmall);
ASSERT(iLargeImage == iSmallImage);
DBG_UNREFERENCED_LOCAL_VARIABLE(iLargeImage);
}
// Do not add excluded entries
@@ -1041,6 +1042,7 @@ EditTypeDlg_UpdateEntryIcon(HWND hwndDlg, PEDITTYPE_DIALOG pEditType,
INT iLargeImage = ImageList_AddIcon(himlLarge, pEntry->hIconLarge);
INT iSmallImage = ImageList_AddIcon(himlSmall, pEntry->hIconSmall);
ASSERT(iLargeImage == iSmallImage);
DBG_UNREFERENCED_LOCAL_VARIABLE(iLargeImage);
INT iItem = ListView_GetNextItem(hListView, -1, LVNI_SELECTED);
if (iItem != -1)