[SHELL32]
authorThomas Faber <thomas.faber@reactos.org>
Sun, 13 Apr 2014 12:20:31 +0000 (12:20 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Sun, 13 Apr 2014 12:20:31 +0000 (12:20 +0000)
- Use C++-style casts. Patch by Ivan Rodionov.
CORE-7698 #resolve

svn path=/trunk/; revision=62737

reactos/dll/win32/shell32/autocomplete.cpp
reactos/dll/win32/shell32/desktop.cpp
reactos/dll/win32/shell32/drvdefext.cpp
reactos/dll/win32/shell32/enumidlist.cpp
reactos/dll/win32/shell32/filedefext.cpp
reactos/dll/win32/shell32/folders/recyclebin.cpp
reactos/dll/win32/shell32/newmenu.cpp
reactos/dll/win32/shell32/openwithmenu.cpp
reactos/dll/win32/shell32/shelllink.cpp
reactos/dll/win32/shell32/shlview.cpp

index 8d1352e..f7d27dc 100644 (file)
@@ -256,7 +256,7 @@ HRESULT WINAPI CAutoComplete::SetOptions(DWORD dwFlag)
  */
 LRESULT APIENTRY CAutoComplete::ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-    CAutoComplete            *pThis = (CAutoComplete *)GetPropW(hwnd, autocomplete_propertyW);;//GetWindowLongPtrW(hwnd, GWLP_USERDATA);
+    CAutoComplete *pThis = static_cast<CAutoComplete *>(GetPropW(hwnd, autocomplete_propertyW));//GetWindowLongPtrW(hwnd, GWLP_USERDATA);
     LPOLESTR strs;
     HRESULT hr;
     WCHAR hwndText[255];
@@ -488,7 +488,7 @@ LRESULT APIENTRY CAutoComplete::ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM
 
 LRESULT APIENTRY CAutoComplete::ACLBoxSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-    CAutoComplete *pThis = (CAutoComplete *)GetWindowLongPtrW(hwnd, GWLP_USERDATA);
+    CAutoComplete *pThis = reinterpret_cast<CAutoComplete *>(GetWindowLongPtrW(hwnd, GWLP_USERDATA));
     WCHAR *msg;
     int sel, len;
 
index 58b95e2..cc0b8d8 100644 (file)
@@ -389,8 +389,7 @@ LRESULT CALLBACK CDesktopBrowser::ProgmanWindowProc(IN HWND hwnd, IN UINT uMsg,
 
     if (uMsg != WM_NCCREATE)
     {
-        pThis = (CDesktopBrowser*)GetWindowLongPtrW(hwnd,
-                                          0);
+        pThis = reinterpret_cast<CDesktopBrowser *>(GetWindowLongPtrW(hwnd, 0));
         if (pThis == NULL)
             goto DefMsgHandler;
     }
@@ -554,7 +553,7 @@ HANDLE WINAPI SHCreateDesktop(IShellDesktopTray *ShellDesk)
  */
 BOOL WINAPI SHDesktopMessageLoop(HANDLE hDesktop)
 {
-    CDesktopBrowser *Desk = (CDesktopBrowser *)hDesktop;
+    CDesktopBrowser *Desk = static_cast<CDesktopBrowser *>(hDesktop);
 
     if (Desk == NULL || Desk->Tag != SHDESK_TAG)
     {
index 2379c05..d24fcb8 100644 (file)
@@ -339,7 +339,7 @@ CDrvDefExt::GeneralPageProc(
             if (ppsp == NULL)
                 break;
 
-            CDrvDefExt *pDrvDefExt = (CDrvDefExt*)ppsp->lParam;
+            CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(ppsp->lParam);
             SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pDrvDefExt);
             pDrvDefExt->InitGeneralPage(hwndDlg);
             return TRUE;
@@ -350,7 +350,7 @@ CDrvDefExt::GeneralPageProc(
 
             if (pDrawItem->CtlID >= 14013 && pDrawItem->CtlID <= 14015)
             {
-                CDrvDefExt *pDrvDefExt = (CDrvDefExt*)GetWindowLongPtr(hwndDlg, DWLP_USER);
+                CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
                 pDrvDefExt->PaintStaticControls(hwndDlg, pDrawItem);
                 return TRUE;
             }
@@ -361,7 +361,7 @@ CDrvDefExt::GeneralPageProc(
         case WM_COMMAND:
             if (LOWORD(wParam) == 14010) /* Disk Cleanup */
             {
-                CDrvDefExt *pDrvDefExt = (CDrvDefExt*)GetWindowLongPtr(hwndDlg, DWLP_USER);
+                CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
                 WCHAR wszBuf[256];
                 DWORD cbBuf = sizeof(wszBuf);
 
@@ -395,7 +395,7 @@ CDrvDefExt::GeneralPageProc(
 
                 if (lppsn->hdr.code == PSN_APPLY)
                 {
-                    CDrvDefExt *pDrvDefExt = (CDrvDefExt*)GetWindowLongPtr(hwndDlg, DWLP_USER);
+                    CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
                     WCHAR wszBuf[256];
 
                     if (GetDlgItemTextW(hwndDlg, 14000, wszBuf, _countof(wszBuf)))
@@ -432,7 +432,7 @@ CDrvDefExt::ExtraPageProc(
         {
             WCHAR wszBuf[MAX_PATH];
             DWORD cbBuf = sizeof(wszBuf);
-            CDrvDefExt *pDrvDefExt = (CDrvDefExt*)GetWindowLongPtr(hwndDlg, DWLP_USER);
+            CDrvDefExt *pDrvDefExt = reinterpret_cast<CDrvDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
 
             switch(LOWORD(wParam))
             {
index 203fb12..ee7394e 100644 (file)
@@ -45,7 +45,7 @@ BOOL IEnumIDListImpl::AddToEnumList(LPITEMIDLIST pidl)
     if (!pidl)
         return FALSE;
 
-    pNew = (ENUMLIST *)SHAlloc(sizeof(ENUMLIST));
+    pNew = static_cast<ENUMLIST *>(SHAlloc(sizeof(ENUMLIST)));
     if (pNew)
     {
       /*set the next pointer */
index e64c1c1..82a6664 100644 (file)
@@ -626,7 +626,7 @@ CFileDefExt::GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
 
             TRACE("WM_INITDIALOG hwnd %p lParam %p ppsplParam %S\n", hwndDlg, lParam, ppsp->lParam);
 
-            CFileDefExt *pFileDefExt = (CFileDefExt*)ppsp->lParam;
+            CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(ppsp->lParam);
             SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pFileDefExt);
             pFileDefExt->InitGeneralPage(hwndDlg);
             break;
@@ -634,7 +634,7 @@ CFileDefExt::GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
         case WM_COMMAND:
             if (LOWORD(wParam) == 14024) /* Opens With - Change */
             {
-                CFileDefExt *pFileDefExt = (CFileDefExt*)GetWindowLongPtr(hwndDlg, DWLP_USER);
+                CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
                 OPENASINFO oainfo;
                 oainfo.pcszFile = pFileDefExt->m_wszPath;
                 oainfo.pcszClass = NULL;
@@ -654,7 +654,7 @@ CFileDefExt::GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
             LPPSHNOTIFY lppsn = (LPPSHNOTIFY)lParam;
             if (lppsn->hdr.code == PSN_APPLY)
             {
-                CFileDefExt *pFileDefExt = (CFileDefExt*)GetWindowLongPtr(hwndDlg, DWLP_USER);
+                CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
 
                 /* Update attributes first */
                 DWORD dwAttr = GetFileAttributesW(pFileDefExt->m_wszPath);
@@ -826,7 +826,7 @@ CFileDefExt::VersionPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
 
             TRACE("WM_INITDIALOG hwnd %p lParam %p ppsplParam %x\n", hwndDlg, lParam, ppsp->lParam);
 
-            CFileDefExt *pFileDefExt = (CFileDefExt*)ppsp->lParam;
+            CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(ppsp->lParam);
             return pFileDefExt->InitVersionPage(hwndDlg);
         }
         case WM_COMMAND:
index 648debf..9b1a389 100644 (file)
@@ -231,7 +231,7 @@ static LPITEMIDLIST _ILCreateRecycleItem(PDELETED_FILE_DETAILS_W pFileDetails)
 
 BOOL WINAPI CRecycleBinEnum::CBEnumRecycleBin(IN PVOID Context, IN HANDLE hDeletedFile)
 {
-    return ((CRecycleBinEnum *)Context)->CBEnumRecycleBin(hDeletedFile);
+    return static_cast<CRecycleBinEnum *>(Context)->CBEnumRecycleBin(hDeletedFile);
 }
 
 BOOL WINAPI CRecycleBinEnum::CBEnumRecycleBin(IN HANDLE hDeletedFile)
index 7c5f853..53dc802 100644 (file)
@@ -165,7 +165,7 @@ CNewMenu::SHELLNEW_ITEM *CNewMenu::LoadItem(LPCWSTR pwszExt)
         return NULL;
 
     /* Create new item */
-    SHELLNEW_ITEM *pNewItem = (SHELLNEW_ITEM *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SHELLNEW_ITEM));
+    SHELLNEW_ITEM *pNewItem = static_cast<SHELLNEW_ITEM *>(HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SHELLNEW_ITEM)));
     if (!pNewItem)
     {
         free(pData);
@@ -225,7 +225,7 @@ CNewMenu::LoadAllItems()
 
     if (!m_pLinkItem)
     {
-        m_pLinkItem = (SHELLNEW_ITEM *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SHELLNEW_ITEM));
+        m_pLinkItem = static_cast<SHELLNEW_ITEM *>(HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SHELLNEW_ITEM)));
         if (m_pLinkItem)
         {
             m_pLinkItem->Type = SHELLNEW_TYPE_NULLFILE;
index 6648a78..02e5b9f 100644 (file)
@@ -297,9 +297,9 @@ COpenWithList::SApp *COpenWithList::AddInternal(LPCWSTR pwszFilename)
 
     /* Create new item */
     if (!m_pApp)
-        m_pApp = (SApp*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(m_pApp[0]));
+        m_pApp = static_cast<SApp *>(HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(m_pApp[0])));
     else
-        m_pApp = (SApp*)HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, m_pApp, (m_cApp + 1)*sizeof(m_pApp[0]));
+        m_pApp = static_cast<SApp *>(HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, m_pApp, (m_cApp + 1)*sizeof(m_pApp[0])));
     if (!m_pApp)
     {
         ERR("Allocation failed\n");
@@ -989,13 +989,13 @@ VOID COpenWithDialog::Accept()
 
 INT_PTR CALLBACK COpenWithDialog::DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-    COpenWithDialog *pThis = (COpenWithDialog*)GetWindowLongPtr(hwndDlg, DWLP_USER);
+    COpenWithDialog *pThis = reinterpret_cast<COpenWithDialog *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
 
     switch(uMsg)
     {
         case WM_INITDIALOG:
         {
-            COpenWithDialog *pThis = (COpenWithDialog*)lParam;
+            COpenWithDialog *pThis = reinterpret_cast<COpenWithDialog *>(lParam);
 
             pThis->Init(hwndDlg);
             return TRUE;
index 4982f7d..6c63a77 100644 (file)
@@ -359,7 +359,7 @@ static HRESULT Stream_ReadChunk(IStream* stm, LPVOID *data)
     if (FAILED(hr) || count != sizeof(size))
         return E_FAIL;
 
-    chunk = (sized_chunk *)HeapAlloc(GetProcessHeap(), 0, size);
+    chunk = static_cast<sized_chunk *>(HeapAlloc(GetProcessHeap(), 0, size));
     if (!chunk)
         return E_OUTOFMEMORY;
 
@@ -421,7 +421,7 @@ static HRESULT Stream_LoadLocation(IStream *stm,
     if (FAILED(hr))
         return hr;
 
-    LOCATION_INFO *loc = (LOCATION_INFO*) p;
+    LOCATION_INFO *loc = reinterpret_cast<LOCATION_INFO *>(p);
     if (loc->dwTotalSize < sizeof(LOCATION_INFO))
     {
         HeapFree(GetProcessHeap(), 0, p);
@@ -721,7 +721,7 @@ static HRESULT Stream_WriteLocationInfo(IStream* stm, LPCWSTR path,
     DWORD total_size = sizeof(*loc) + volume_info_size + path_size + final_path_size;
 
     /* create pointers to everything */
-    loc = (LOCATION_INFO *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, total_size);
+    loc = static_cast<LOCATION_INFO *>(HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, total_size));
     vol = (LOCAL_VOLUME_INFO*) &loc[1];
     LPSTR szLabel = (LPSTR) &vol[1];
     LPSTR szPath = &szLabel[label_size];
@@ -1954,7 +1954,7 @@ INT_PTR CALLBACK ExtendedShortcutProc(HWND hwndDlg, UINT uMsg,
 
 INT_PTR CALLBACK CShellLink::SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-    CShellLink *pThis = (CShellLink *)GetWindowLongPtr(hwndDlg, DWLP_USER);
+    CShellLink *pThis = reinterpret_cast<CShellLink *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
 
     switch(uMsg)
     {
@@ -1966,7 +1966,7 @@ INT_PTR CALLBACK CShellLink::SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM
 
             TRACE("ShellLink_DlgProc (WM_INITDIALOG hwnd %p lParam %p ppsplParam %x)\n", hwndDlg, lParam, ppsp->lParam);
 
-            pThis = (CShellLink *)ppsp->lParam;
+            pThis = reinterpret_cast<CShellLink *>(ppsp->lParam);
             SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pThis);
 
             TRACE("sArgs: %S sComponent: %S sDescription: %S sIcoPath: %S sPath: %S sPathRel: %S sProduct: %S sWorkDir: %S\n", pThis->sArgs, pThis->sComponent, pThis->sDescription,
index 5afc0e8..d368225 100644 (file)
@@ -816,7 +816,7 @@ BOOLEAN CDefView::LV_RenameItem(LPCITEMIDLIST pidlOld, LPCITEMIDLIST pidlNew)
 INT CALLBACK CDefView::fill_list( LPVOID ptr, LPVOID arg )
 {
     LPITEMIDLIST pidl = (LPITEMIDLIST)ptr;
-    CDefView *pThis = (CDefView *)arg;
+    CDefView *pThis = static_cast<CDefView *>(arg);
     /* in a commdlg This works as a filemask*/
     if (pThis->IncludeObject(pidl) == S_OK)
         pThis->LV_AddItem(pidl);