Eliminate HeapAlloc casts.
This commit is contained in:
parent
341f98ad8f
commit
461c830745
|
@ -2800,7 +2800,7 @@ BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorA(
|
||||||
LPWSTR StringSecurityDescriptorW;
|
LPWSTR StringSecurityDescriptorW;
|
||||||
|
|
||||||
len = MultiByteToWideChar(CP_ACP, 0, StringSecurityDescriptor, -1, NULL, 0);
|
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)
|
if (StringSecurityDescriptorW)
|
||||||
{
|
{
|
||||||
|
@ -2909,7 +2909,7 @@ BOOL WINAPI ConvertStringSidToSidA(LPCSTR StringSid, PSID* Sid)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UINT len = MultiByteToWideChar(CP_ACP, 0, StringSid, -1, NULL, 0);
|
UINT len = MultiByteToWideChar(CP_ACP, 0, StringSid, -1, NULL, 0);
|
||||||
LPWSTR wStringSid = (LPWSTR)HeapAlloc(GetProcessHeap(), 0,
|
LPWSTR wStringSid = HeapAlloc(GetProcessHeap(), 0,
|
||||||
len * sizeof(WCHAR));
|
len * sizeof(WCHAR));
|
||||||
|
|
||||||
MultiByteToWideChar(CP_ACP, 0, StringSid, -1, wStringSid, len);
|
MultiByteToWideChar(CP_ACP, 0, StringSid, -1, wStringSid, len);
|
||||||
|
|
|
@ -437,8 +437,7 @@ static HRESULT WINAPI COMCAT_IEnumCATEGORYINFO_Clone(
|
||||||
|
|
||||||
if (This == NULL || ppenum == NULL) return E_POINTER;
|
if (This == NULL || ppenum == NULL) return E_POINTER;
|
||||||
|
|
||||||
new_this = (IEnumCATEGORYINFOImpl *) HeapAlloc(
|
new_this = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumCATEGORYINFOImpl));
|
||||||
GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumCATEGORYINFOImpl));
|
|
||||||
if (new_this == NULL) return E_OUTOFMEMORY;
|
if (new_this == NULL) return E_OUTOFMEMORY;
|
||||||
|
|
||||||
new_this->lpVtbl = This->lpVtbl;
|
new_this->lpVtbl = This->lpVtbl;
|
||||||
|
@ -467,8 +466,7 @@ static LPENUMCATEGORYINFO COMCAT_IEnumCATEGORYINFO_Construct(LCID lcid)
|
||||||
{
|
{
|
||||||
IEnumCATEGORYINFOImpl *This;
|
IEnumCATEGORYINFOImpl *This;
|
||||||
|
|
||||||
This = (IEnumCATEGORYINFOImpl *) HeapAlloc(
|
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumCATEGORYINFOImpl));
|
||||||
GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumCATEGORYINFOImpl));
|
|
||||||
if (This) {
|
if (This) {
|
||||||
WCHAR keyname[21] = { 'C', 'o', 'm', 'p', 'o', 'n', 'e', 'n',
|
WCHAR keyname[21] = { 'C', 'o', 'm', 'p', 'o', 'n', 'e', 'n',
|
||||||
't', ' ', 'C', 'a', 't', 'e', 'g', 'o',
|
't', ' ', 'C', 'a', 't', 'e', 'g', 'o',
|
||||||
|
@ -515,7 +513,7 @@ static struct class_categories *COMCAT_PrepareClassCategories(
|
||||||
struct class_categories *categories;
|
struct class_categories *categories;
|
||||||
WCHAR *strings;
|
WCHAR *strings;
|
||||||
|
|
||||||
categories = (struct class_categories *)HeapAlloc(
|
categories = HeapAlloc(
|
||||||
GetProcessHeap(), HEAP_ZERO_MEMORY,
|
GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||||
sizeof(struct class_categories) +
|
sizeof(struct class_categories) +
|
||||||
((impl_count + req_count) * 39 + 2) * sizeof(WCHAR));
|
((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;
|
if (This == NULL || ppenum == NULL) return E_POINTER;
|
||||||
|
|
||||||
new_this = (CLSID_IEnumGUIDImpl *) HeapAlloc(
|
new_this = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLSID_IEnumGUIDImpl));
|
||||||
GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLSID_IEnumGUIDImpl));
|
|
||||||
if (new_this == NULL) return E_OUTOFMEMORY;
|
if (new_this == NULL) return E_OUTOFMEMORY;
|
||||||
|
|
||||||
new_this->lpVtbl = This->lpVtbl;
|
new_this->lpVtbl = This->lpVtbl;
|
||||||
new_this->ref = 1;
|
new_this->ref = 1;
|
||||||
size = HeapSize(GetProcessHeap(), 0, (LPVOID)This->categories);
|
size = HeapSize(GetProcessHeap(), 0, (LPVOID)This->categories);
|
||||||
new_this->categories = (struct class_categories *)
|
new_this->categories =
|
||||||
HeapAlloc(GetProcessHeap(), 0, size);
|
HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
if (new_this->categories == NULL) {
|
if (new_this->categories == NULL) {
|
||||||
HeapFree(GetProcessHeap(), 0, new_this);
|
HeapFree(GetProcessHeap(), 0, new_this);
|
||||||
|
@ -778,8 +775,7 @@ static LPENUMGUID COMCAT_CLSID_IEnumGUID_Construct(
|
||||||
{
|
{
|
||||||
CLSID_IEnumGUIDImpl *This;
|
CLSID_IEnumGUIDImpl *This;
|
||||||
|
|
||||||
This = (CLSID_IEnumGUIDImpl *) HeapAlloc(
|
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLSID_IEnumGUIDImpl));
|
||||||
GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLSID_IEnumGUIDImpl));
|
|
||||||
if (This) {
|
if (This) {
|
||||||
WCHAR keyname[6] = { 'C', 'L', 'S', 'I', 'D', 0 };
|
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;
|
if (This == NULL || ppenum == NULL) return E_POINTER;
|
||||||
|
|
||||||
new_this = (CATID_IEnumGUIDImpl *) HeapAlloc(
|
new_this = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CATID_IEnumGUIDImpl));
|
||||||
GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CATID_IEnumGUIDImpl));
|
|
||||||
if (new_this == NULL) return E_OUTOFMEMORY;
|
if (new_this == NULL) return E_OUTOFMEMORY;
|
||||||
|
|
||||||
new_this->lpVtbl = This->lpVtbl;
|
new_this->lpVtbl = This->lpVtbl;
|
||||||
|
@ -955,8 +950,7 @@ static LPENUMGUID COMCAT_CATID_IEnumGUID_Construct(
|
||||||
{
|
{
|
||||||
CATID_IEnumGUIDImpl *This;
|
CATID_IEnumGUIDImpl *This;
|
||||||
|
|
||||||
This = (CATID_IEnumGUIDImpl *) HeapAlloc(
|
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CATID_IEnumGUIDImpl));
|
||||||
GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CATID_IEnumGUIDImpl));
|
|
||||||
if (This) {
|
if (This) {
|
||||||
WCHAR prefix[6] = { 'C', 'L', 'S', 'I', 'D', '\\' };
|
WCHAR prefix[6] = { 'C', 'L', 'S', 'I', 'D', '\\' };
|
||||||
|
|
||||||
|
|
|
@ -1824,7 +1824,7 @@ HDPA WINAPI DPA_Clone (const HDPA hdpa, const HDPA hdpaNew)
|
||||||
|
|
||||||
if (!hdpaNew) {
|
if (!hdpaNew) {
|
||||||
/* create a new DPA */
|
/* create a new DPA */
|
||||||
hdpaTemp = (HDPA)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
|
hdpaTemp = HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
|
||||||
sizeof(*hdpaTemp));
|
sizeof(*hdpaTemp));
|
||||||
hdpaTemp->hHeap = hdpa->hHeap;
|
hdpaTemp->hHeap = hdpa->hHeap;
|
||||||
hdpaTemp->nGrow = hdpa->nGrow;
|
hdpaTemp->nGrow = hdpa->nGrow;
|
||||||
|
@ -1844,8 +1844,7 @@ HDPA WINAPI DPA_Clone (const HDPA hdpa, const HDPA hdpaNew)
|
||||||
nNewItems = hdpaTemp->nGrow *
|
nNewItems = hdpaTemp->nGrow *
|
||||||
((INT)((hdpa->nItemCount - 1) / hdpaTemp->nGrow) + 1);
|
((INT)((hdpa->nItemCount - 1) / hdpaTemp->nGrow) + 1);
|
||||||
nSize = nNewItems * sizeof(LPVOID);
|
nSize = nNewItems * sizeof(LPVOID);
|
||||||
hdpaTemp->ptrs =
|
hdpaTemp->ptrs = HeapAlloc (hdpaTemp->hHeap, HEAP_ZERO_MEMORY, nSize);
|
||||||
(LPVOID*)HeapAlloc (hdpaTemp->hHeap, HEAP_ZERO_MEMORY, nSize);
|
|
||||||
hdpaTemp->nMaxCount = nNewItems;
|
hdpaTemp->nMaxCount = nNewItems;
|
||||||
|
|
||||||
/* clone the pointer array */
|
/* clone the pointer array */
|
||||||
|
@ -1985,9 +1984,9 @@ BOOL WINAPI DPA_SetPtr (const HDPA hdpa, INT i, LPVOID p)
|
||||||
INT nSize = nNewItems * sizeof(LPVOID);
|
INT nSize = nNewItems * sizeof(LPVOID);
|
||||||
|
|
||||||
if (hdpa->ptrs)
|
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
|
else
|
||||||
lpTemp = (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, nSize);
|
lpTemp = HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, nSize);
|
||||||
|
|
||||||
if (!lpTemp)
|
if (!lpTemp)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -2046,7 +2045,7 @@ LPVOID WINAPI DPA_DeletePtr (const HDPA hdpa, INT i)
|
||||||
if ((hdpa->nMaxCount - hdpa->nItemCount) >= hdpa->nGrow) {
|
if ((hdpa->nMaxCount - hdpa->nItemCount) >= hdpa->nGrow) {
|
||||||
INT nNewItems = max(hdpa->nGrow * 2, hdpa->nItemCount);
|
INT nNewItems = max(hdpa->nGrow * 2, hdpa->nItemCount);
|
||||||
nSize = nNewItems * sizeof(LPVOID);
|
nSize = nNewItems * sizeof(LPVOID);
|
||||||
lpDest = (LPVOID)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
|
lpDest = HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
|
||||||
hdpa->ptrs, nSize);
|
hdpa->ptrs, nSize);
|
||||||
if (!lpDest)
|
if (!lpDest)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2083,7 +2082,7 @@ BOOL WINAPI DPA_DeleteAllPtrs (const HDPA hdpa)
|
||||||
|
|
||||||
hdpa->nItemCount = 0;
|
hdpa->nItemCount = 0;
|
||||||
hdpa->nMaxCount = hdpa->nGrow * 2;
|
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));
|
hdpa->nMaxCount * sizeof(LPVOID));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -2280,7 +2279,7 @@ HDPA WINAPI DPA_CreateEx (INT nGrow, HANDLE hHeap)
|
||||||
TRACE("(%d %p)\n", nGrow, hHeap);
|
TRACE("(%d %p)\n", nGrow, hHeap);
|
||||||
|
|
||||||
if (hHeap)
|
if (hHeap)
|
||||||
hdpa = (HDPA)HeapAlloc (hHeap, HEAP_ZERO_MEMORY, sizeof(*hdpa));
|
hdpa = HeapAlloc (hHeap, HEAP_ZERO_MEMORY, sizeof(*hdpa));
|
||||||
else
|
else
|
||||||
hdpa = Alloc (sizeof(*hdpa));
|
hdpa = Alloc (sizeof(*hdpa));
|
||||||
|
|
||||||
|
|
|
@ -1106,7 +1106,7 @@ BOOL WINAPI SetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass,
|
||||||
stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass);
|
stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass);
|
||||||
if (!stack) {
|
if (!stack) {
|
||||||
/* allocate stack */
|
/* allocate stack */
|
||||||
stack = (LPSUBCLASS_INFO)HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY,
|
stack = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||||
sizeof(SUBCLASS_INFO));
|
sizeof(SUBCLASS_INFO));
|
||||||
if (!stack) {
|
if (!stack) {
|
||||||
ERR ("Failed to allocate our Subclassing stack\n");
|
ERR ("Failed to allocate our Subclassing stack\n");
|
||||||
|
|
|
@ -229,7 +229,7 @@ static DWORD start_host_object2(IStream *stream, REFIID riid, IUnknown *object,
|
||||||
{
|
{
|
||||||
DWORD tid = 0;
|
DWORD tid = 0;
|
||||||
HANDLE marshal_event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
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->stream = stream;
|
||||||
data->iid = *riid;
|
data->iid = *riid;
|
||||||
|
|
|
@ -284,8 +284,7 @@ struct {
|
||||||
|
|
||||||
static LPWSTR GetWideString(const char* szString)
|
static LPWSTR GetWideString(const char* szString)
|
||||||
{
|
{
|
||||||
LPWSTR wszString = (LPWSTR) HeapAlloc(GetProcessHeap(), 0,
|
LPWSTR wszString = HeapAlloc(GetProcessHeap(), 0, (2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR));
|
||||||
(2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR));
|
|
||||||
|
|
||||||
MultiByteToWideChar(0, 0, szString, -1, wszString, INTERNET_MAX_URL_LENGTH);
|
MultiByteToWideChar(0, 0, szString, -1, wszString, INTERNET_MAX_URL_LENGTH);
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ void winapi_test(int flags)
|
||||||
if (length)
|
if (length)
|
||||||
{
|
{
|
||||||
char *buffer;
|
char *buffer;
|
||||||
buffer = (char*)HeapAlloc(GetProcessHeap(),0,length+1);
|
buffer = HeapAlloc(GetProcessHeap(),0,length+1);
|
||||||
|
|
||||||
rc = InternetReadFile(hor,buffer,length,&length);
|
rc = InternetReadFile(hor,buffer,length,&length);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue