Commit 354a74e0 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

wininet: Use wrappers for HeapAlloc calls.

parent a08aa539
......@@ -89,7 +89,7 @@ static void COOKIE_deleteDomain(cookie_domain *deadDomain);
/* adds a cookie to the domain */
static cookie *COOKIE_addCookie(cookie_domain *domain, LPCWSTR name, LPCWSTR data, FILETIME expiry)
{
cookie *newCookie = HeapAlloc(GetProcessHeap(), 0, sizeof(cookie));
cookie *newCookie = heap_alloc(sizeof(cookie));
list_init(&newCookie->entry);
newCookie->lpCookieName = NULL;
......@@ -145,7 +145,7 @@ static void COOKIE_deleteCookie(cookie *deadCookie, BOOL deleteDomain)
/* allocates a domain and adds it to the end */
static cookie_domain *COOKIE_addDomain(LPCWSTR domain, LPCWSTR path)
{
cookie_domain *newDomain = HeapAlloc(GetProcessHeap(), 0, sizeof(cookie_domain));
cookie_domain *newDomain = heap_alloc(sizeof(cookie_domain));
list_init(&newDomain->entry);
list_init(&newDomain->cookie_list);
......@@ -397,7 +397,7 @@ BOOL WINAPI InternetGetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
r = InternetGetCookieW( url, name, NULL, &len );
if( r )
{
szCookieData = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
szCookieData = heap_alloc(len * sizeof(WCHAR));
if( !szCookieData )
{
r = FALSE;
......@@ -453,7 +453,7 @@ static BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWST
if (value != data)
HeapFree(GetProcessHeap(), 0, value);
value = HeapAlloc(GetProcessHeap(), 0, (ptr - data) * sizeof(WCHAR));
value = heap_alloc((ptr - data) * sizeof(WCHAR));
if (value == NULL)
{
HeapFree(GetProcessHeap(), 0, data);
......
......@@ -916,7 +916,7 @@ BOOL WINAPI FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrentDire
len = *lpdwCurrentDirectory;
if(lpszCurrentDirectory)
{
dir = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
dir = heap_alloc(len * sizeof(WCHAR));
if (NULL == dir)
{
INTERNET_SetLastError(ERROR_OUTOFMEMORY);
......@@ -1383,7 +1383,7 @@ static HINTERNET FTP_FtpOpenFileW(ftp_session_t *lpwfs,
if (!InternetCreateUrlW(&uc, 0, NULL, &len) && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
WCHAR *url = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
WCHAR *url = heap_alloc(len * sizeof(WCHAR));
if (url && InternetCreateUrlW(&uc, 0, url, &len) && CreateUrlCacheEntryW(url, 0, NULL, filename, 0))
{
......@@ -2290,7 +2290,7 @@ BOOL WINAPI FtpCommandW( HINTERNET hConnect, BOOL fExpectResponse, DWORD dwFlags
}
len = WideCharToMultiByte(CP_ACP, 0, lpszCommand, -1, NULL, 0, NULL, NULL) + strlen(szCRLF);
if ((cmd = HeapAlloc(GetProcessHeap(), 0, len )))
if ((cmd = heap_alloc(len)))
WideCharToMultiByte(CP_ACP, 0, lpszCommand, -1, cmd, len, NULL, NULL);
else
{
......@@ -2660,7 +2660,7 @@ static BOOL FTP_SendCommandA(INT nSocket, FTP_COMMAND ftpCmd, LPCSTR lpszParam,
dwParamLen = lpszParam?strlen(lpszParam)+1:0;
len = dwParamLen + strlen(szFtpCommands[ftpCmd]) + strlen(szCRLF);
if (NULL == (buf = HeapAlloc(GetProcessHeap(), 0, len+1)))
if (NULL == (buf = heap_alloc(len+1)))
{
INTERNET_SetLastError(ERROR_OUTOFMEMORY);
return FALSE;
......@@ -3227,7 +3227,7 @@ static BOOL FTP_SendData(ftp_session_t *lpwfs, INT nDataSocket, HANDLE hFile)
CHAR *lpszBuffer;
TRACE("\n");
lpszBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CHAR)*DATA_PACKET_SIZE);
lpszBuffer = heap_alloc_zero(sizeof(CHAR)*DATA_PACKET_SIZE);
/* Get the size of the file. */
GetFileInformationByHandle(hFile, &fi);
......@@ -3349,7 +3349,7 @@ static BOOL FTP_RetrieveFileData(ftp_session_t *lpwfs, INT nDataSocket, HANDLE h
TRACE("\n");
lpszBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CHAR)*DATA_PACKET_SIZE);
lpszBuffer = heap_alloc_zero(sizeof(CHAR)*DATA_PACKET_SIZE);
if (NULL == lpszBuffer)
{
INTERNET_SetLastError(ERROR_OUTOFMEMORY);
......@@ -3752,7 +3752,7 @@ static BOOL FTP_ParseDirectory(ftp_session_t *lpwfs, INT nSocket, LPCWSTR lpszSe
TRACE("\n");
/* Allocate initial file properties array */
*lpafp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FILEPROPERTIESW)*(sizeFilePropArray));
*lpafp = heap_alloc_zero(sizeof(FILEPROPERTIESW)*(sizeFilePropArray));
if (!*lpafp)
return FALSE;
......
......@@ -91,7 +91,7 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
DWORD size;
size = (strlenW(str)+1)*sizeof(WCHAR);
ret = HeapAlloc(GetProcessHeap(), 0, size);
ret = heap_alloc(size);
if(ret)
memcpy(ret, str, size);
}
......@@ -111,7 +111,7 @@ static inline LPWSTR heap_strndupW(LPCWSTR str, UINT max_len)
if(str[len] == '\0')
break;
ret = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*(len+1));
ret = heap_alloc(sizeof(WCHAR)*(len+1));
if(ret) {
memcpy(ret, str, sizeof(WCHAR)*len);
ret[len] = '\0';
......@@ -128,7 +128,7 @@ static inline WCHAR *heap_strdupAtoW(const char *str)
DWORD len;
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
ret = heap_alloc(len*sizeof(WCHAR));
if(ret)
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
}
......@@ -142,7 +142,7 @@ static inline char *heap_strdupWtoA(LPCWSTR str)
if(str) {
DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
ret = HeapAlloc(GetProcessHeap(), 0, size);
ret = heap_alloc(size);
if(ret)
WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
}
......
......@@ -201,7 +201,7 @@ static PCCERT_CONTEXT X509_to_cert_context(X509 *cert)
*/
if (!p)
{
buffer = HeapAlloc(GetProcessHeap(),0,len);
buffer = heap_alloc(len);
p = buffer;
len = pi2d_X509(cert,&p);
}
......
......@@ -454,7 +454,7 @@ static void URLCacheContainer_CloseIndex(URLCACHECONTAINER * pContainer)
static BOOL URLCacheContainers_AddContainer(LPCWSTR cache_prefix, LPCWSTR path, LPWSTR mutex_name)
{
URLCACHECONTAINER * pContainer = HeapAlloc(GetProcessHeap(), 0, sizeof(URLCACHECONTAINER));
URLCACHECONTAINER * pContainer = heap_alloc(sizeof(URLCACHECONTAINER));
int cache_prefix_len = strlenW(cache_prefix);
if (!pContainer)
......@@ -472,7 +472,7 @@ static BOOL URLCacheContainers_AddContainer(LPCWSTR cache_prefix, LPCWSTR path,
return FALSE;
}
pContainer->cache_prefix = HeapAlloc(GetProcessHeap(), 0, (cache_prefix_len + 1) * sizeof(WCHAR));
pContainer->cache_prefix = heap_alloc((cache_prefix_len + 1) * sizeof(WCHAR));
if (!pContainer->cache_prefix)
{
HeapFree(GetProcessHeap(), 0, pContainer->path);
......@@ -3001,7 +3001,7 @@ HANDLE WINAPI RetrieveUrlCacheEntryStreamA(
return FALSE;
/* allocate handle storage space */
pStream = HeapAlloc(GetProcessHeap(), 0, sizeof(STREAM_HANDLE) + strlen(lpszUrlName) * sizeof(CHAR));
pStream = heap_alloc(sizeof(STREAM_HANDLE) + strlen(lpszUrlName) * sizeof(CHAR));
if (!pStream)
{
CloseHandle(hFile);
......@@ -3062,7 +3062,7 @@ HANDLE WINAPI RetrieveUrlCacheEntryStreamW(
size = sizeof(STREAM_HANDLE);
url_len = WideCharToMultiByte(CP_ACP, 0, lpszUrlName, -1, NULL, 0, NULL, NULL);
size += url_len;
pStream = HeapAlloc(GetProcessHeap(), 0, size);
pStream = heap_alloc(size);
if (!pStream)
{
CloseHandle(hFile);
......@@ -3349,7 +3349,7 @@ INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryA(LPCSTR lpszUrlSearchPattern,
TRACE("(%s, %p, %p)\n", debugstr_a(lpszUrlSearchPattern), lpFirstCacheEntryInfo, lpdwFirstCacheEntryInfoBufferSize);
pEntryHandle = HeapAlloc(GetProcessHeap(), 0, sizeof(*pEntryHandle));
pEntryHandle = heap_alloc(sizeof(*pEntryHandle));
if (!pEntryHandle)
return NULL;
......@@ -3388,7 +3388,7 @@ INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryW(LPCWSTR lpszUrlSearchPattern,
TRACE("(%s, %p, %p)\n", debugstr_w(lpszUrlSearchPattern), lpFirstCacheEntryInfo, lpdwFirstCacheEntryInfoBufferSize);
pEntryHandle = HeapAlloc(GetProcessHeap(), 0, sizeof(*pEntryHandle));
pEntryHandle = heap_alloc(sizeof(*pEntryHandle));
if (!pEntryHandle)
return NULL;
......
......@@ -172,7 +172,7 @@ BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
len = strlenW(lpszServerName);
sz = WideCharToMultiByte( CP_UNIXCP, 0, lpszServerName, len, NULL, 0, NULL, NULL );
if (!(name = HeapAlloc( GetProcessHeap(), 0, sz + 1 ))) return FALSE;
if (!(name = heap_alloc(sz + 1))) return FALSE;
WideCharToMultiByte( CP_UNIXCP, 0, lpszServerName, len, name, sz, NULL, NULL );
name[sz] = 0;
......@@ -320,7 +320,7 @@ VOID INTERNET_SendCallback(object_header_t *hdr, DWORD_PTR dwContext,
case INTERNET_STATUS_NAME_RESOLVED:
case INTERNET_STATUS_CONNECTING_TO_SERVER:
case INTERNET_STATUS_CONNECTED_TO_SERVER:
lpvNewInfo = HeapAlloc(GetProcessHeap(), 0, strlen(lpvStatusInfo) + 1);
lpvNewInfo = heap_alloc(strlen(lpvStatusInfo) + 1);
if (lpvNewInfo) strcpy(lpvNewInfo, lpvStatusInfo);
break;
case INTERNET_STATUS_RESOLVING_NAME:
......@@ -379,7 +379,7 @@ void SendAsyncCallback(object_header_t *hdr, DWORD_PTR dwContext,
if (lpvStatusInfo)
{
lpvStatusInfo_copy = HeapAlloc(GetProcessHeap(), 0, dwStatusInfoLength);
lpvStatusInfo_copy = heap_alloc(dwStatusInfoLength);
memcpy(lpvStatusInfo_copy, lpvStatusInfo, dwStatusInfoLength);
}
......
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