- Use C++-style casts. Patch by Ivan Rodionov.
CORE-7698 #resolve
svn path=/trunk/; revision=62737
*/
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];
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;
if (uMsg != WM_NCCREATE)
{
- pThis = (CDesktopBrowser*)GetWindowLongPtrW(hwnd,
- 0);
+ pThis = reinterpret_cast<CDesktopBrowser *>(GetWindowLongPtrW(hwnd, 0));
if (pThis == NULL)
goto DefMsgHandler;
}
*/
BOOL WINAPI SHDesktopMessageLoop(HANDLE hDesktop)
{
- CDesktopBrowser *Desk = (CDesktopBrowser *)hDesktop;
+ CDesktopBrowser *Desk = static_cast<CDesktopBrowser *>(hDesktop);
if (Desk == NULL || Desk->Tag != SHDESK_TAG)
{
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;
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;
}
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);
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)))
{
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))
{
if (!pidl)
return FALSE;
- pNew = (ENUMLIST *)SHAlloc(sizeof(ENUMLIST));
+ pNew = static_cast<ENUMLIST *>(SHAlloc(sizeof(ENUMLIST)));
if (pNew)
{
/*set the next pointer */
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;
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;
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);
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:
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)
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);
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;
/* 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");
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;
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;
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);
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];
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)
{
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,
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);