Eliminate HeapAlloc casts.

This commit is contained in:
Jakob Eriksson 2005-03-22 18:26:06 +00:00 committed by Alexandre Julliard
parent 341f98ad8f
commit 461c830745
7 changed files with 21 additions and 29 deletions

View file

@ -2800,7 +2800,7 @@ BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorA(
LPWSTR StringSecurityDescriptorW;
len = MultiByteToWideChar(CP_ACP, 0, StringSecurityDescriptor, -1, NULL, 0);
StringSecurityDescriptorW = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
StringSecurityDescriptorW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (StringSecurityDescriptorW)
{
@ -2909,7 +2909,7 @@ BOOL WINAPI ConvertStringSidToSidA(LPCSTR StringSid, PSID* Sid)
else
{
UINT len = MultiByteToWideChar(CP_ACP, 0, StringSid, -1, NULL, 0);
LPWSTR wStringSid = (LPWSTR)HeapAlloc(GetProcessHeap(), 0,
LPWSTR wStringSid = HeapAlloc(GetProcessHeap(), 0,
len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, StringSid, -1, wStringSid, len);

View file

@ -437,8 +437,7 @@ static HRESULT WINAPI COMCAT_IEnumCATEGORYINFO_Clone(
if (This == NULL || ppenum == NULL) return E_POINTER;
new_this = (IEnumCATEGORYINFOImpl *) HeapAlloc(
GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumCATEGORYINFOImpl));
new_this = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumCATEGORYINFOImpl));
if (new_this == NULL) return E_OUTOFMEMORY;
new_this->lpVtbl = This->lpVtbl;
@ -467,8 +466,7 @@ static LPENUMCATEGORYINFO COMCAT_IEnumCATEGORYINFO_Construct(LCID lcid)
{
IEnumCATEGORYINFOImpl *This;
This = (IEnumCATEGORYINFOImpl *) HeapAlloc(
GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumCATEGORYINFOImpl));
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumCATEGORYINFOImpl));
if (This) {
WCHAR keyname[21] = { 'C', 'o', 'm', 'p', 'o', 'n', 'e', 'n',
't', ' ', 'C', 'a', 't', 'e', 'g', 'o',
@ -515,7 +513,7 @@ static struct class_categories *COMCAT_PrepareClassCategories(
struct class_categories *categories;
WCHAR *strings;
categories = (struct class_categories *)HeapAlloc(
categories = HeapAlloc(
GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(struct class_categories) +
((impl_count + req_count) * 39 + 2) * sizeof(WCHAR));
@ -740,14 +738,13 @@ static HRESULT WINAPI COMCAT_CLSID_IEnumGUID_Clone(
if (This == NULL || ppenum == NULL) return E_POINTER;
new_this = (CLSID_IEnumGUIDImpl *) HeapAlloc(
GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLSID_IEnumGUIDImpl));
new_this = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLSID_IEnumGUIDImpl));
if (new_this == NULL) return E_OUTOFMEMORY;
new_this->lpVtbl = This->lpVtbl;
new_this->ref = 1;
size = HeapSize(GetProcessHeap(), 0, (LPVOID)This->categories);
new_this->categories = (struct class_categories *)
new_this->categories =
HeapAlloc(GetProcessHeap(), 0, size);
if (new_this->categories == NULL) {
HeapFree(GetProcessHeap(), 0, new_this);
@ -778,8 +775,7 @@ static LPENUMGUID COMCAT_CLSID_IEnumGUID_Construct(
{
CLSID_IEnumGUIDImpl *This;
This = (CLSID_IEnumGUIDImpl *) HeapAlloc(
GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLSID_IEnumGUIDImpl));
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLSID_IEnumGUIDImpl));
if (This) {
WCHAR keyname[6] = { 'C', 'L', 'S', 'I', 'D', 0 };
@ -924,8 +920,7 @@ static HRESULT WINAPI COMCAT_CATID_IEnumGUID_Clone(
if (This == NULL || ppenum == NULL) return E_POINTER;
new_this = (CATID_IEnumGUIDImpl *) HeapAlloc(
GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CATID_IEnumGUIDImpl));
new_this = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CATID_IEnumGUIDImpl));
if (new_this == NULL) return E_OUTOFMEMORY;
new_this->lpVtbl = This->lpVtbl;
@ -955,8 +950,7 @@ static LPENUMGUID COMCAT_CATID_IEnumGUID_Construct(
{
CATID_IEnumGUIDImpl *This;
This = (CATID_IEnumGUIDImpl *) HeapAlloc(
GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CATID_IEnumGUIDImpl));
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CATID_IEnumGUIDImpl));
if (This) {
WCHAR prefix[6] = { 'C', 'L', 'S', 'I', 'D', '\\' };

View file

@ -1824,7 +1824,7 @@ HDPA WINAPI DPA_Clone (const HDPA hdpa, const HDPA hdpaNew)
if (!hdpaNew) {
/* create a new DPA */
hdpaTemp = (HDPA)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
hdpaTemp = HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
sizeof(*hdpaTemp));
hdpaTemp->hHeap = hdpa->hHeap;
hdpaTemp->nGrow = hdpa->nGrow;
@ -1844,8 +1844,7 @@ HDPA WINAPI DPA_Clone (const HDPA hdpa, const HDPA hdpaNew)
nNewItems = hdpaTemp->nGrow *
((INT)((hdpa->nItemCount - 1) / hdpaTemp->nGrow) + 1);
nSize = nNewItems * sizeof(LPVOID);
hdpaTemp->ptrs =
(LPVOID*)HeapAlloc (hdpaTemp->hHeap, HEAP_ZERO_MEMORY, nSize);
hdpaTemp->ptrs = HeapAlloc (hdpaTemp->hHeap, HEAP_ZERO_MEMORY, nSize);
hdpaTemp->nMaxCount = nNewItems;
/* clone the pointer array */
@ -1985,9 +1984,9 @@ BOOL WINAPI DPA_SetPtr (const HDPA hdpa, INT i, LPVOID p)
INT nSize = nNewItems * sizeof(LPVOID);
if (hdpa->ptrs)
lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, hdpa->ptrs, nSize);
lpTemp = HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, hdpa->ptrs, nSize);
else
lpTemp = (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, nSize);
lpTemp = HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, nSize);
if (!lpTemp)
return FALSE;
@ -2046,7 +2045,7 @@ LPVOID WINAPI DPA_DeletePtr (const HDPA hdpa, INT i)
if ((hdpa->nMaxCount - hdpa->nItemCount) >= hdpa->nGrow) {
INT nNewItems = max(hdpa->nGrow * 2, hdpa->nItemCount);
nSize = nNewItems * sizeof(LPVOID);
lpDest = (LPVOID)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
lpDest = HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
hdpa->ptrs, nSize);
if (!lpDest)
return NULL;
@ -2083,7 +2082,7 @@ BOOL WINAPI DPA_DeleteAllPtrs (const HDPA hdpa)
hdpa->nItemCount = 0;
hdpa->nMaxCount = hdpa->nGrow * 2;
hdpa->ptrs = (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
hdpa->ptrs = HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
hdpa->nMaxCount * sizeof(LPVOID));
return TRUE;
@ -2280,7 +2279,7 @@ HDPA WINAPI DPA_CreateEx (INT nGrow, HANDLE hHeap)
TRACE("(%d %p)\n", nGrow, hHeap);
if (hHeap)
hdpa = (HDPA)HeapAlloc (hHeap, HEAP_ZERO_MEMORY, sizeof(*hdpa));
hdpa = HeapAlloc (hHeap, HEAP_ZERO_MEMORY, sizeof(*hdpa));
else
hdpa = Alloc (sizeof(*hdpa));

View file

@ -1106,7 +1106,7 @@ BOOL WINAPI SetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass,
stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass);
if (!stack) {
/* allocate stack */
stack = (LPSUBCLASS_INFO)HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY,
stack = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(SUBCLASS_INFO));
if (!stack) {
ERR ("Failed to allocate our Subclassing stack\n");

View file

@ -229,7 +229,7 @@ static DWORD start_host_object2(IStream *stream, REFIID riid, IUnknown *object,
{
DWORD tid = 0;
HANDLE marshal_event = CreateEvent(NULL, FALSE, FALSE, NULL);
struct host_object_data *data = (struct host_object_data *)HeapAlloc(GetProcessHeap(), 0, sizeof(*data));
struct host_object_data *data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data));
data->stream = stream;
data->iid = *riid;

View file

@ -284,8 +284,7 @@ struct {
static LPWSTR GetWideString(const char* szString)
{
LPWSTR wszString = (LPWSTR) HeapAlloc(GetProcessHeap(), 0,
(2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR));
LPWSTR wszString = HeapAlloc(GetProcessHeap(), 0, (2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR));
MultiByteToWideChar(0, 0, szString, -1, wszString, INTERNET_MAX_URL_LENGTH);

View file

@ -180,7 +180,7 @@ void winapi_test(int flags)
if (length)
{
char *buffer;
buffer = (char*)HeapAlloc(GetProcessHeap(),0,length+1);
buffer = HeapAlloc(GetProcessHeap(),0,length+1);
rc = InternetReadFile(hor,buffer,length,&length);