[SHELL32] Fix 2 compiler warnings for the rls-cfg 'unused variable' (#6539)

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
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.

That assert never fired for the last 6 years, therefore it would have been okay also to strip it together with the variable, but using DBG_UNREFERENCED_LOCAL_VARIABLE(iLargeImage); allows to keep the assert for master.
This commit is contained in:
Joachim Henze 2024-02-26 13:42:13 +01:00 committed by GitHub
parent ed7dc31103
commit a08b83a90b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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)