Skip to content

Commit 09c6736

Browse files
committed
[SHELL32]
- Use C++-style casts. Patch by Ivan Rodionov. CORE-7698 #resolve svn path=/trunk/; revision=62737
1 parent d585b0d commit 09c6736

File tree

10 files changed

+27
-28
lines changed

10 files changed

+27
-28
lines changed

reactos/dll/win32/shell32/autocomplete.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ HRESULT WINAPI CAutoComplete::SetOptions(DWORD dwFlag)
256256
*/
257257
LRESULT APIENTRY CAutoComplete::ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
258258
{
259-
CAutoComplete *pThis = (CAutoComplete *)GetPropW(hwnd, autocomplete_propertyW);;//GetWindowLongPtrW(hwnd, GWLP_USERDATA);
259+
CAutoComplete *pThis = static_cast<CAutoComplete *>(GetPropW(hwnd, autocomplete_propertyW));//GetWindowLongPtrW(hwnd, GWLP_USERDATA);
260260
LPOLESTR strs;
261261
HRESULT hr;
262262
WCHAR hwndText[255];
@@ -488,7 +488,7 @@ LRESULT APIENTRY CAutoComplete::ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM
488488

489489
LRESULT APIENTRY CAutoComplete::ACLBoxSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
490490
{
491-
CAutoComplete *pThis = (CAutoComplete *)GetWindowLongPtrW(hwnd, GWLP_USERDATA);
491+
CAutoComplete *pThis = reinterpret_cast<CAutoComplete *>(GetWindowLongPtrW(hwnd, GWLP_USERDATA));
492492
WCHAR *msg;
493493
int sel, len;
494494

reactos/dll/win32/shell32/desktop.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,7 @@ LRESULT CALLBACK CDesktopBrowser::ProgmanWindowProc(IN HWND hwnd, IN UINT uMsg,
389389

390390
if (uMsg != WM_NCCREATE)
391391
{
392-
pThis = (CDesktopBrowser*)GetWindowLongPtrW(hwnd,
393-
0);
392+
pThis = reinterpret_cast<CDesktopBrowser *>(GetWindowLongPtrW(hwnd, 0));
394393
if (pThis == NULL)
395394
goto DefMsgHandler;
396395
}
@@ -554,7 +553,7 @@ HANDLE WINAPI SHCreateDesktop(IShellDesktopTray *ShellDesk)
554553
*/
555554
BOOL WINAPI SHDesktopMessageLoop(HANDLE hDesktop)
556555
{
557-
CDesktopBrowser *Desk = (CDesktopBrowser *)hDesktop;
556+
CDesktopBrowser *Desk = static_cast<CDesktopBrowser *>(hDesktop);
558557

559558
if (Desk == NULL || Desk->Tag != SHDESK_TAG)
560559
{

reactos/dll/win32/shell32/drvdefext.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ CDrvDefExt::GeneralPageProc(
339339
if (ppsp == NULL)
340340
break;
341341

342-
CDrvDefExt *pDrvDefExt = (CDrvDefExt*)ppsp->lParam;
342+
CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(ppsp->lParam);
343343
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pDrvDefExt);
344344
pDrvDefExt->InitGeneralPage(hwndDlg);
345345
return TRUE;
@@ -350,7 +350,7 @@ CDrvDefExt::GeneralPageProc(
350350

351351
if (pDrawItem->CtlID >= 14013 && pDrawItem->CtlID <= 14015)
352352
{
353-
CDrvDefExt *pDrvDefExt = (CDrvDefExt*)GetWindowLongPtr(hwndDlg, DWLP_USER);
353+
CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
354354
pDrvDefExt->PaintStaticControls(hwndDlg, pDrawItem);
355355
return TRUE;
356356
}
@@ -361,7 +361,7 @@ CDrvDefExt::GeneralPageProc(
361361
case WM_COMMAND:
362362
if (LOWORD(wParam) == 14010) /* Disk Cleanup */
363363
{
364-
CDrvDefExt *pDrvDefExt = (CDrvDefExt*)GetWindowLongPtr(hwndDlg, DWLP_USER);
364+
CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
365365
WCHAR wszBuf[256];
366366
DWORD cbBuf = sizeof(wszBuf);
367367

@@ -395,7 +395,7 @@ CDrvDefExt::GeneralPageProc(
395395

396396
if (lppsn->hdr.code == PSN_APPLY)
397397
{
398-
CDrvDefExt *pDrvDefExt = (CDrvDefExt*)GetWindowLongPtr(hwndDlg, DWLP_USER);
398+
CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
399399
WCHAR wszBuf[256];
400400

401401
if (GetDlgItemTextW(hwndDlg, 14000, wszBuf, _countof(wszBuf)))
@@ -432,7 +432,7 @@ CDrvDefExt::ExtraPageProc(
432432
{
433433
WCHAR wszBuf[MAX_PATH];
434434
DWORD cbBuf = sizeof(wszBuf);
435-
CDrvDefExt *pDrvDefExt = (CDrvDefExt*)GetWindowLongPtr(hwndDlg, DWLP_USER);
435+
CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
436436

437437
switch(LOWORD(wParam))
438438
{

reactos/dll/win32/shell32/enumidlist.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ BOOL IEnumIDListImpl::AddToEnumList(LPITEMIDLIST pidl)
4545
if (!pidl)
4646
return FALSE;
4747

48-
pNew = (ENUMLIST *)SHAlloc(sizeof(ENUMLIST));
48+
pNew = static_cast<ENUMLIST *>(SHAlloc(sizeof(ENUMLIST)));
4949
if (pNew)
5050
{
5151
/*set the next pointer */

reactos/dll/win32/shell32/filedefext.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -626,15 +626,15 @@ CFileDefExt::GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
626626

627627
TRACE("WM_INITDIALOG hwnd %p lParam %p ppsplParam %S\n", hwndDlg, lParam, ppsp->lParam);
628628

629-
CFileDefExt *pFileDefExt = (CFileDefExt*)ppsp->lParam;
629+
CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(ppsp->lParam);
630630
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pFileDefExt);
631631
pFileDefExt->InitGeneralPage(hwndDlg);
632632
break;
633633
}
634634
case WM_COMMAND:
635635
if (LOWORD(wParam) == 14024) /* Opens With - Change */
636636
{
637-
CFileDefExt *pFileDefExt = (CFileDefExt*)GetWindowLongPtr(hwndDlg, DWLP_USER);
637+
CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
638638
OPENASINFO oainfo;
639639
oainfo.pcszFile = pFileDefExt->m_wszPath;
640640
oainfo.pcszClass = NULL;
@@ -654,7 +654,7 @@ CFileDefExt::GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
654654
LPPSHNOTIFY lppsn = (LPPSHNOTIFY)lParam;
655655
if (lppsn->hdr.code == PSN_APPLY)
656656
{
657-
CFileDefExt *pFileDefExt = (CFileDefExt*)GetWindowLongPtr(hwndDlg, DWLP_USER);
657+
CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
658658

659659
/* Update attributes first */
660660
DWORD dwAttr = GetFileAttributesW(pFileDefExt->m_wszPath);
@@ -826,7 +826,7 @@ CFileDefExt::VersionPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
826826

827827
TRACE("WM_INITDIALOG hwnd %p lParam %p ppsplParam %x\n", hwndDlg, lParam, ppsp->lParam);
828828

829-
CFileDefExt *pFileDefExt = (CFileDefExt*)ppsp->lParam;
829+
CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(ppsp->lParam);
830830
return pFileDefExt->InitVersionPage(hwndDlg);
831831
}
832832
case WM_COMMAND:

reactos/dll/win32/shell32/folders/recyclebin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ static LPITEMIDLIST _ILCreateRecycleItem(PDELETED_FILE_DETAILS_W pFileDetails)
231231

232232
BOOL WINAPI CRecycleBinEnum::CBEnumRecycleBin(IN PVOID Context, IN HANDLE hDeletedFile)
233233
{
234-
return ((CRecycleBinEnum *)Context)->CBEnumRecycleBin(hDeletedFile);
234+
return static_cast<CRecycleBinEnum *>(Context)->CBEnumRecycleBin(hDeletedFile);
235235
}
236236

237237
BOOL WINAPI CRecycleBinEnum::CBEnumRecycleBin(IN HANDLE hDeletedFile)

reactos/dll/win32/shell32/newmenu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ CNewMenu::SHELLNEW_ITEM *CNewMenu::LoadItem(LPCWSTR pwszExt)
165165
return NULL;
166166

167167
/* Create new item */
168-
SHELLNEW_ITEM *pNewItem = (SHELLNEW_ITEM *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SHELLNEW_ITEM));
168+
SHELLNEW_ITEM *pNewItem = static_cast<SHELLNEW_ITEM *>(HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SHELLNEW_ITEM)));
169169
if (!pNewItem)
170170
{
171171
free(pData);
@@ -225,7 +225,7 @@ CNewMenu::LoadAllItems()
225225

226226
if (!m_pLinkItem)
227227
{
228-
m_pLinkItem = (SHELLNEW_ITEM *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SHELLNEW_ITEM));
228+
m_pLinkItem = static_cast<SHELLNEW_ITEM *>(HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SHELLNEW_ITEM)));
229229
if (m_pLinkItem)
230230
{
231231
m_pLinkItem->Type = SHELLNEW_TYPE_NULLFILE;

reactos/dll/win32/shell32/openwithmenu.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,9 @@ COpenWithList::SApp *COpenWithList::AddInternal(LPCWSTR pwszFilename)
297297

298298
/* Create new item */
299299
if (!m_pApp)
300-
m_pApp = (SApp*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(m_pApp[0]));
300+
m_pApp = static_cast<SApp *>(HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(m_pApp[0])));
301301
else
302-
m_pApp = (SApp*)HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, m_pApp, (m_cApp + 1)*sizeof(m_pApp[0]));
302+
m_pApp = static_cast<SApp *>(HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, m_pApp, (m_cApp + 1)*sizeof(m_pApp[0])));
303303
if (!m_pApp)
304304
{
305305
ERR("Allocation failed\n");
@@ -989,13 +989,13 @@ VOID COpenWithDialog::Accept()
989989

990990
INT_PTR CALLBACK COpenWithDialog::DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
991991
{
992-
COpenWithDialog *pThis = (COpenWithDialog*)GetWindowLongPtr(hwndDlg, DWLP_USER);
992+
COpenWithDialog *pThis = reinterpret_cast<COpenWithDialog *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
993993

994994
switch(uMsg)
995995
{
996996
case WM_INITDIALOG:
997997
{
998-
COpenWithDialog *pThis = (COpenWithDialog*)lParam;
998+
COpenWithDialog *pThis = reinterpret_cast<COpenWithDialog *>(lParam);
999999

10001000
pThis->Init(hwndDlg);
10011001
return TRUE;

reactos/dll/win32/shell32/shelllink.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ static HRESULT Stream_ReadChunk(IStream* stm, LPVOID *data)
359359
if (FAILED(hr) || count != sizeof(size))
360360
return E_FAIL;
361361

362-
chunk = (sized_chunk *)HeapAlloc(GetProcessHeap(), 0, size);
362+
chunk = static_cast<sized_chunk *>(HeapAlloc(GetProcessHeap(), 0, size));
363363
if (!chunk)
364364
return E_OUTOFMEMORY;
365365

@@ -421,7 +421,7 @@ static HRESULT Stream_LoadLocation(IStream *stm,
421421
if (FAILED(hr))
422422
return hr;
423423

424-
LOCATION_INFO *loc = (LOCATION_INFO*) p;
424+
LOCATION_INFO *loc = reinterpret_cast<LOCATION_INFO *>(p);
425425
if (loc->dwTotalSize < sizeof(LOCATION_INFO))
426426
{
427427
HeapFree(GetProcessHeap(), 0, p);
@@ -721,7 +721,7 @@ static HRESULT Stream_WriteLocationInfo(IStream* stm, LPCWSTR path,
721721
DWORD total_size = sizeof(*loc) + volume_info_size + path_size + final_path_size;
722722

723723
/* create pointers to everything */
724-
loc = (LOCATION_INFO *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, total_size);
724+
loc = static_cast<LOCATION_INFO *>(HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, total_size));
725725
vol = (LOCAL_VOLUME_INFO*) &loc[1];
726726
LPSTR szLabel = (LPSTR) &vol[1];
727727
LPSTR szPath = &szLabel[label_size];
@@ -1954,7 +1954,7 @@ INT_PTR CALLBACK ExtendedShortcutProc(HWND hwndDlg, UINT uMsg,
19541954

19551955
INT_PTR CALLBACK CShellLink::SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
19561956
{
1957-
CShellLink *pThis = (CShellLink *)GetWindowLongPtr(hwndDlg, DWLP_USER);
1957+
CShellLink *pThis = reinterpret_cast<CShellLink *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
19581958

19591959
switch(uMsg)
19601960
{
@@ -1966,7 +1966,7 @@ INT_PTR CALLBACK CShellLink::SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM
19661966

19671967
TRACE("ShellLink_DlgProc (WM_INITDIALOG hwnd %p lParam %p ppsplParam %x)\n", hwndDlg, lParam, ppsp->lParam);
19681968

1969-
pThis = (CShellLink *)ppsp->lParam;
1969+
pThis = reinterpret_cast<CShellLink *>(ppsp->lParam);
19701970
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pThis);
19711971

19721972
TRACE("sArgs: %S sComponent: %S sDescription: %S sIcoPath: %S sPath: %S sPathRel: %S sProduct: %S sWorkDir: %S\n", pThis->sArgs, pThis->sComponent, pThis->sDescription,

reactos/dll/win32/shell32/shlview.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ BOOLEAN CDefView::LV_RenameItem(LPCITEMIDLIST pidlOld, LPCITEMIDLIST pidlNew)
816816
INT CALLBACK CDefView::fill_list( LPVOID ptr, LPVOID arg )
817817
{
818818
LPITEMIDLIST pidl = (LPITEMIDLIST)ptr;
819-
CDefView *pThis = (CDefView *)arg;
819+
CDefView *pThis = static_cast<CDefView *>(arg);
820820
/* in a commdlg This works as a filemask*/
821821
if (pThis->IncludeObject(pidl) == S_OK)
822822
pThis->LV_AddItem(pidl);

0 commit comments

Comments
 (0)