Commit b723e6f6 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

comctl32: Remove the superfluous casting of the LPVOID returned by Alloc().

parent 2d94915f
......@@ -817,7 +817,7 @@ static BOOL ANIMATE_Create(HWND hWnd, const CREATESTRUCTW *lpcs)
}
/* allocate memory for info structure */
infoPtr = (ANIMATE_INFO *)Alloc(sizeof(ANIMATE_INFO));
infoPtr = Alloc(sizeof(ANIMATE_INFO));
if (!infoPtr) return FALSE;
/* store crossref hWnd <-> info structure */
......
......@@ -211,7 +211,7 @@ COMBOEX_NotifyItem (COMBOEX_INFO *infoPtr, UINT code, NMCOMBOBOXEXW *hdr)
if ((hdr->ceItem.mask & CBEIF_TEXT) && is_textW(wstr)) {
len = WideCharToMultiByte (CP_ACP, 0, wstr, -1, 0, 0, NULL, NULL);
if (len > 0) {
astr = (LPSTR)Alloc ((len + 1)*sizeof(CHAR));
astr = Alloc ((len + 1)*sizeof(CHAR));
if (!astr) return 0;
WideCharToMultiByte (CP_ACP, 0, wstr, -1, astr, len, 0, 0);
hdr->ceItem.pszText = (LPWSTR)astr;
......@@ -320,7 +320,7 @@ static LPCWSTR COMBOEX_GetText(COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item)
if (is_textW(nmce.ceItem.pszText)) {
len = MultiByteToWideChar (CP_ACP, 0, (LPSTR)nmce.ceItem.pszText, -1, NULL, 0);
buf = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR));
buf = Alloc ((len + 1)*sizeof(WCHAR));
if (buf)
MultiByteToWideChar (CP_ACP, 0, (LPSTR)nmce.ceItem.pszText, -1, buf, len);
if (nmce.ceItem.mask & CBEIF_DI_SETITEM) {
......@@ -622,7 +622,7 @@ static INT COMBOEX_InsertItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW const *ci
if (index > infoPtr->nb_items) return -1;
/* get zero-filled space and chain it in */
if(!(item = (CBE_ITEMDATA *)Alloc (sizeof(*item)))) return -1;
if(!(item = Alloc (sizeof(*item)))) return -1;
/* locate position to insert new item in */
if (index == infoPtr->nb_items) {
......@@ -654,7 +654,7 @@ static INT COMBOEX_InsertItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW const *ci
if (is_textW(cit->pszText)) len = strlenW (cit->pszText);
if (len > 0) {
item->pszText = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR));
item->pszText = Alloc ((len + 1)*sizeof(WCHAR));
if (!item->pszText) {
Free(item);
return -1;
......@@ -700,7 +700,7 @@ static INT COMBOEX_InsertItemA (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA const *ci
memcpy(&citW,cit,sizeof(COMBOBOXEXITEMA));
if (cit->mask & CBEIF_TEXT && is_textA(cit->pszText)) {
INT len = MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, NULL, 0);
wstr = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR));
wstr = Alloc ((len + 1)*sizeof(WCHAR));
if (!wstr) return -1;
MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, wstr, len);
citW.pszText = wstr;
......@@ -787,7 +787,7 @@ static BOOL COMBOEX_SetItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW *cit)
COMBOEX_FreeText(item);
if (is_textW(cit->pszText)) len = strlenW(cit->pszText);
if (len > 0) {
item->pszText = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR));
item->pszText = Alloc ((len + 1)*sizeof(WCHAR));
if (!item->pszText) return FALSE;
strcpyW(item->pszText, cit->pszText);
} else if (cit->pszText == LPSTR_TEXTCALLBACKW)
......@@ -824,7 +824,7 @@ static BOOL COMBOEX_SetItemA (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA const *cit)
memcpy(&citW, cit, sizeof(COMBOBOXEXITEMA));
if ((cit->mask & CBEIF_TEXT) && is_textA(cit->pszText)) {
INT len = MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, NULL, 0);
wstr = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR));
wstr = Alloc ((len + 1)*sizeof(WCHAR));
if (!wstr) return FALSE;
MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, wstr, len);
citW.pszText = wstr;
......@@ -976,7 +976,7 @@ static LRESULT COMBOEX_Create (HWND hwnd, CREATESTRUCTA const *cs)
INT i;
/* allocate memory for info structure */
infoPtr = (COMBOEX_INFO *)Alloc (sizeof(COMBOEX_INFO));
infoPtr = Alloc (sizeof(COMBOEX_INFO));
if (!infoPtr) return -1;
/* initialize info structure */
......@@ -1109,7 +1109,7 @@ static LRESULT COMBOEX_Create (HWND hwnd, CREATESTRUCTA const *cs)
* Create an item structure to represent the data in the
* EDIT control. It is allocated zero-filled.
*/
infoPtr->edit = (CBE_ITEMDATA *)Alloc (sizeof (CBE_ITEMDATA));
infoPtr->edit = Alloc (sizeof (CBE_ITEMDATA));
if (!infoPtr->edit) {
COMBOEX_Destroy(infoPtr);
return -1;
......@@ -1408,7 +1408,7 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT const *di
item->mask &= ~CBEIF_TEXT;
if( (len = GetWindowTextLengthW(infoPtr->hwndEdit)) ) {
item->mask |= CBEIF_TEXT;
item->pszText = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR));
item->pszText = Alloc ((len + 1)*sizeof(WCHAR));
if (item->pszText)
GetWindowTextW(infoPtr->hwndEdit, item->pszText, len+1);
......
......@@ -1225,7 +1225,7 @@ static LRESULT
DATETIME_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
{
static const WCHAR SysMonthCal32W[] = { 'S', 'y', 's', 'M', 'o', 'n', 't', 'h', 'C', 'a', 'l', '3', '2', 0 };
DATETIME_INFO *infoPtr = (DATETIME_INFO *)Alloc (sizeof(DATETIME_INFO));
DATETIME_INFO *infoPtr = Alloc (sizeof(DATETIME_INFO));
STYLESTRUCT ss = { 0, lpcs->style };
if (!infoPtr) return -1;
......@@ -1234,9 +1234,9 @@ DATETIME_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
infoPtr->dwStyle = lpcs->style;
infoPtr->nrFieldsAllocated = 32;
infoPtr->fieldspec = (int *) Alloc (infoPtr->nrFieldsAllocated * sizeof(int));
infoPtr->fieldRect = (RECT *) Alloc (infoPtr->nrFieldsAllocated * sizeof(RECT));
infoPtr->buflen = (int *) Alloc (infoPtr->nrFieldsAllocated * sizeof(int));
infoPtr->fieldspec = Alloc (infoPtr->nrFieldsAllocated * sizeof(int));
infoPtr->fieldRect = Alloc (infoPtr->nrFieldsAllocated * sizeof(RECT));
infoPtr->buflen = Alloc (infoPtr->nrFieldsAllocated * sizeof(int));
infoPtr->hwndNotify = lpcs->hwndParent;
infoPtr->select = -1; /* initially, nothing is selected */
infoPtr->bDropdownEnabled = TRUE;
......
......@@ -1454,7 +1454,7 @@ HEADER_Create (HWND hwnd, LPARAM lParam)
HFONT hOldFont;
HDC hdc;
infoPtr = (HEADER_INFO *)Alloc (sizeof(HEADER_INFO));
infoPtr = Alloc (sizeof(HEADER_INFO));
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent;
......
......@@ -411,7 +411,7 @@ HOTKEY_NCCreate (HWND hwnd, const CREATESTRUCTW *lpcs)
dwExStyle | WS_EX_CLIENTEDGE);
/* allocate memory for info structure */
infoPtr = (HOTKEY_INFO *)Alloc (sizeof(HOTKEY_INFO));
infoPtr = Alloc (sizeof(HOTKEY_INFO));
SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr);
/* initialize info structure */
......
......@@ -598,7 +598,7 @@ ImageList_Create (INT cx, INT cy, UINT flags,
TRACE("(%d %d 0x%x %d %d)\n", cx, cy, flags, cInitial, cGrow);
himl = (HIMAGELIST)Alloc (sizeof(struct _IMAGELIST));
himl = Alloc (sizeof(struct _IMAGELIST));
if (!himl)
return NULL;
......
......@@ -178,7 +178,7 @@ static LRESULT IPADDRESS_Create (HWND hwnd, const CREATESTRUCTA *lpCreate)
SetWindowLongW (hwnd, GWL_STYLE,
GetWindowLongW(hwnd, GWL_STYLE) & ~WS_BORDER);
infoPtr = (IPADDRESS_INFO *)Alloc (sizeof(IPADDRESS_INFO));
infoPtr = Alloc (sizeof(IPADDRESS_INFO));
if (!infoPtr) return -1;
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
......
......@@ -1896,7 +1896,7 @@ MONTHCAL_Create(HWND hwnd, LPARAM lParam)
MONTHCAL_INFO *infoPtr;
/* allocate memory for info structure */
infoPtr =(MONTHCAL_INFO*)Alloc(sizeof(MONTHCAL_INFO));
infoPtr = Alloc(sizeof(MONTHCAL_INFO));
SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr);
if(infoPtr == NULL) {
......
......@@ -52,7 +52,7 @@ NATIVEFONT_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
NATIVEFONT_INFO *infoPtr;
/* allocate memory for info structure */
infoPtr = (NATIVEFONT_INFO *)Alloc (sizeof(NATIVEFONT_INFO));
infoPtr = Alloc (sizeof(NATIVEFONT_INFO));
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
/* initialize info structure */
......
......@@ -801,7 +801,7 @@ PAGER_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
PAGER_INFO *infoPtr;
/* allocate memory for info structure */
infoPtr = (PAGER_INFO *)Alloc (sizeof(PAGER_INFO));
infoPtr = Alloc (sizeof(PAGER_INFO));
if (!infoPtr) return -1;
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
......
......@@ -567,7 +567,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
/* allocate memory for info struct */
infoPtr = (PROGRESS_INFO *)Alloc (sizeof(PROGRESS_INFO));
infoPtr = Alloc (sizeof(PROGRESS_INFO));
if (!infoPtr) return -1;
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
......
......@@ -2277,9 +2277,7 @@ static BOOL PROPSHEET_AddPage(HWND hwndDlg,
/*
* Allocate and fill in a new PropPageInfo entry.
*/
ppi = (PropPageInfo*) ReAlloc(psInfo->proppage,
sizeof(PropPageInfo) *
(psInfo->nPages + 1));
ppi = ReAlloc(psInfo->proppage, sizeof(PropPageInfo) * (psInfo->nPages + 1));
if (!ppi)
return FALSE;
......@@ -2829,8 +2827,7 @@ INT_PTR WINAPI PropertySheetA(LPCPROPSHEETHEADERA lppsh)
PROPSHEET_CollectSheetInfoA(lppsh, psInfo);
psInfo->proppage = (PropPageInfo*) Alloc(sizeof(PropPageInfo) *
lppsh->nPages);
psInfo->proppage = Alloc(sizeof(PropPageInfo) * lppsh->nPages);
pByte = (const BYTE*) psInfo->ppshheader.u3.ppsp;
for (n = i = 0; i < lppsh->nPages; i++, n++)
......@@ -2872,8 +2869,7 @@ INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
PROPSHEET_CollectSheetInfoW(lppsh, psInfo);
psInfo->proppage = (PropPageInfo*) Alloc(sizeof(PropPageInfo) *
lppsh->nPages);
psInfo->proppage = Alloc(sizeof(PropPageInfo) * lppsh->nPages);
pByte = (const BYTE*) psInfo->ppshheader.u3.ppsp;
for (n = i = 0; i < lppsh->nPages; i++, n++)
......@@ -3414,7 +3410,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_INITDIALOG:
{
PropSheetInfo* psInfo = (PropSheetInfo*) lParam;
WCHAR* strCaption = (WCHAR*)Alloc(MAX_CAPTION_LENGTH*sizeof(WCHAR));
WCHAR* strCaption = Alloc(MAX_CAPTION_LENGTH*sizeof(WCHAR));
HWND hwndTabCtrl = GetDlgItem(hwnd, IDC_TABCONTROL);
int idx;
LOGFONTW logFont;
......
......@@ -2595,8 +2595,7 @@ REBAR_MoveBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
}
/* allocate new space and copy rest of bands into it */
infoPtr->bands =
(REBAR_BAND *)Alloc ((infoPtr->uNumBands)*sizeof(REBAR_BAND));
infoPtr->bands = Alloc ((infoPtr->uNumBands)*sizeof(REBAR_BAND));
/* pre insert copy */
if (uTo > 0) {
......@@ -3185,7 +3184,7 @@ REBAR_NCCreate (HWND hwnd, LPARAM lParam)
}
/* allocate memory for info structure */
infoPtr = (REBAR_INFO *)Alloc (sizeof(REBAR_INFO));
infoPtr = Alloc (sizeof(REBAR_INFO));
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
/* initialize info structure - initial values are 0 */
......
......@@ -907,7 +907,7 @@ STATUSBAR_WMCreate (HWND hwnd, const CREATESTRUCTA *lpCreate)
int len;
TRACE("\n");
infoPtr = (STATUS_INFO*)Alloc (sizeof(STATUS_INFO));
infoPtr = Alloc (sizeof(STATUS_INFO));
if (!infoPtr) goto create_fail;
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
......
......@@ -2939,7 +2939,7 @@ static LRESULT TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
HFONT hOldFont;
DWORD dwStyle;
infoPtr = (TAB_INFO *)Alloc (sizeof(TAB_INFO));
infoPtr = Alloc (sizeof(TAB_INFO));
SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr);
......
......@@ -2085,7 +2085,7 @@ static void TOOLBAR_Cust_AddButton(const CUSTDLG_INFO *custInfo, HWND hwnd, INT
PCUSTOMBUTTON btnNew;
/* duplicate 'separator' button */
btnNew = (PCUSTOMBUTTON)Alloc(sizeof(CUSTOMBUTTON));
btnNew = Alloc(sizeof(CUSTOMBUTTON));
*btnNew = *btnInfo;
btnInfo = btnNew;
}
......@@ -2308,7 +2308,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
/* add items to 'toolbar buttons' list and check if removable */
for (i = 0; i < custInfo->tbInfo->nNumButtons; i++)
{
btnInfo = (PCUSTOMBUTTON)Alloc(sizeof(CUSTOMBUTTON));
btnInfo = Alloc(sizeof(CUSTOMBUTTON));
memset (&btnInfo->btn, 0, sizeof(TBBUTTON));
btnInfo->btn.fsStyle = BTNS_SEP;
btnInfo->bVirtual = FALSE;
......@@ -2324,7 +2324,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
SendDlgItemMessageW (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMHEIGHT, 0, infoPtr->nBitmapHeight + 8);
/* insert separator button into 'available buttons' list */
btnInfo = (PCUSTOMBUTTON)Alloc(sizeof(CUSTOMBUTTON));
btnInfo = Alloc(sizeof(CUSTOMBUTTON));
memset (&btnInfo->btn, 0, sizeof(TBBUTTON));
btnInfo->btn.fsStyle = BTNS_SEP;
btnInfo->bVirtual = FALSE;
......@@ -2359,7 +2359,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
index = TOOLBAR_GetButtonIndex (custInfo->tbInfo, nmtb.tbButton.idCommand, FALSE);
if (index == -1)
{
btnInfo = (PCUSTOMBUTTON)Alloc(sizeof(CUSTOMBUTTON));
btnInfo = Alloc(sizeof(CUSTOMBUTTON));
btnInfo->bVirtual = FALSE;
btnInfo->bRemovable = TRUE;
}
......@@ -2392,7 +2392,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
SendDlgItemMessageW (hwnd, IDC_AVAILBTN_LBOX, LB_SETCURSEL, 0, 0);
/* append 'virtual' separator button to the 'toolbar buttons' list */
btnInfo = (PCUSTOMBUTTON)Alloc(sizeof(CUSTOMBUTTON));
btnInfo = Alloc(sizeof(CUSTOMBUTTON));
memset (&btnInfo->btn, 0, sizeof(TBBUTTON));
btnInfo->btn.fsStyle = BTNS_SEP;
btnInfo->bVirtual = TRUE;
......@@ -6157,7 +6157,7 @@ TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
DWORD styleadd = 0;
/* allocate memory for info structure */
infoPtr = (TOOLBAR_INFO *)Alloc (sizeof(TOOLBAR_INFO));
infoPtr = Alloc (sizeof(TOOLBAR_INFO));
SetWindowLongPtrW (hwnd, 0, (LONG_PTR)infoPtr);
/* paranoid!! */
......@@ -7103,7 +7103,7 @@ static HIMAGELIST TOOLBAR_InsertImageList(PIMLENTRY **pies, INT *cies, HIMAGELIS
{
PIMLENTRY *pnies;
c = (PIMLENTRY) Alloc(sizeof(IMLENTRY));
c = Alloc(sizeof(IMLENTRY));
c->id = id;
pnies = Alloc((*cies + 1) * sizeof(PIMLENTRY));
......
......@@ -2351,7 +2351,7 @@ TOOLTIPS_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
TOOLTIPS_INFO *infoPtr;
/* allocate memory for info structure */
infoPtr = (TOOLTIPS_INFO *)Alloc (sizeof(TOOLTIPS_INFO));
infoPtr = Alloc (sizeof(TOOLTIPS_INFO));
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
/* initialize info structure */
......
......@@ -1397,7 +1397,7 @@ TRACKBAR_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
TRACKBAR_INFO *infoPtr;
DWORD dwStyle;
infoPtr = (TRACKBAR_INFO *)Alloc (sizeof(TRACKBAR_INFO));
infoPtr = Alloc (sizeof(TRACKBAR_INFO));
if (!infoPtr) return -1;
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
......
......@@ -751,7 +751,7 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
(LPSTR)callback.item.pszText, -1,
NULL, 0);
buflen = max((len)*sizeof(WCHAR), TEXT_CALLBACK_SIZE);
newText = (LPWSTR)ReAlloc(wineItem->pszText, buflen);
newText = ReAlloc(wineItem->pszText, buflen);
TRACE("returned str %s, len=%d, buflen=%d\n",
debugstr_a((LPSTR)callback.item.pszText), len, buflen);
......@@ -793,7 +793,7 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
(LPSTR)callback.item.pszText, -1,
NULL, 0);
buflen = max((len)*sizeof(WCHAR), TEXT_CALLBACK_SIZE);
newText = (LPWSTR)Alloc(buflen);
newText = Alloc(buflen);
TRACE("same buffer str %s, len=%d, buflen=%d\n",
debugstr_a((LPSTR)callback.item.pszText), len, buflen);
......@@ -4896,7 +4896,7 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
TRACE("wnd %p, style %x\n", hwnd, GetWindowLongW(hwnd, GWL_STYLE));
infoPtr = (TREEVIEW_INFO *)Alloc(sizeof(TREEVIEW_INFO));
infoPtr = Alloc(sizeof(TREEVIEW_INFO));
if (infoPtr == NULL)
{
......
......@@ -828,7 +828,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
switch(message)
{
case WM_CREATE:
infoPtr = (UPDOWN_INFO*)Alloc (sizeof(UPDOWN_INFO));
infoPtr = Alloc (sizeof(UPDOWN_INFO));
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
/* initialize the info struct */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment