Commit a79b761c authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/pager: Use CRT allocation functions.

parent 80de4101
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
*/ */
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
...@@ -62,7 +63,6 @@ ...@@ -62,7 +63,6 @@
#include "commctrl.h" #include "commctrl.h"
#include "comctl32.h" #include "comctl32.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(pager); WINE_DEFAULT_DEBUG_CHANNEL(pager);
...@@ -576,7 +576,7 @@ PAGER_Create (HWND hwnd, const CREATESTRUCTW *lpcs) ...@@ -576,7 +576,7 @@ PAGER_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
INT ret; INT ret;
/* allocate memory for info structure */ /* allocate memory for info structure */
infoPtr = heap_alloc_zero (sizeof(*infoPtr)); infoPtr = calloc(1, sizeof(*infoPtr));
if (!infoPtr) return -1; if (!infoPtr) return -1;
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
...@@ -611,8 +611,8 @@ static LRESULT ...@@ -611,8 +611,8 @@ static LRESULT
PAGER_Destroy (PAGER_INFO *infoPtr) PAGER_Destroy (PAGER_INFO *infoPtr)
{ {
SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0); SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
heap_free (infoPtr->pwszBuffer); free (infoPtr->pwszBuffer);
heap_free (infoPtr); free (infoPtr);
return 0; return 0;
} }
...@@ -1099,9 +1099,9 @@ static UINT PAGER_GetAnsiNtfCode(UINT code) ...@@ -1099,9 +1099,9 @@ static UINT PAGER_GetAnsiNtfCode(UINT code)
static BOOL PAGER_AdjustBuffer(PAGER_INFO *infoPtr, INT size) static BOOL PAGER_AdjustBuffer(PAGER_INFO *infoPtr, INT size)
{ {
if (!infoPtr->pwszBuffer) if (!infoPtr->pwszBuffer)
infoPtr->pwszBuffer = heap_alloc(size); infoPtr->pwszBuffer = malloc(size);
else if (infoPtr->nBufferSize < size) else if (infoPtr->nBufferSize < size)
infoPtr->pwszBuffer = heap_realloc(infoPtr->pwszBuffer, size); infoPtr->pwszBuffer = realloc(infoPtr->pwszBuffer, size);
if (!infoPtr->pwszBuffer) return FALSE; if (!infoPtr->pwszBuffer) return FALSE;
if (infoPtr->nBufferSize < size) infoPtr->nBufferSize = size; if (infoPtr->nBufferSize < size) infoPtr->nBufferSize = size;
...@@ -1153,7 +1153,7 @@ static LRESULT PAGER_SendConvertedNotify(PAGER_INFO *infoPtr, NMHDR *hdr, UINT * ...@@ -1153,7 +1153,7 @@ static LRESULT PAGER_SendConvertedNotify(PAGER_INFO *infoPtr, NMHDR *hdr, UINT *
if ((*text && flags & (CONVERT_SEND | ZERO_SEND)) || (!*text && flags & SEND_EMPTY_IF_NULL)) if ((*text && flags & (CONVERT_SEND | ZERO_SEND)) || (!*text && flags & SEND_EMPTY_IF_NULL))
{ {
bufferSize = textMax ? *textMax : lstrlenW(*text) + 1; bufferSize = textMax ? *textMax : lstrlenW(*text) + 1;
sendBuffer = heap_alloc_zero(bufferSize); sendBuffer = calloc(1, bufferSize);
if (!sendBuffer) goto done; if (!sendBuffer) goto done;
if (!(flags & ZERO_SEND)) WideCharToMultiByte(CP_ACP, 0, *text, -1, sendBuffer, bufferSize, NULL, FALSE); if (!(flags & ZERO_SEND)) WideCharToMultiByte(CP_ACP, 0, *text, -1, sendBuffer, bufferSize, NULL, FALSE);
*text = (WCHAR *)sendBuffer; *text = (WCHAR *)sendBuffer;
...@@ -1167,18 +1167,18 @@ static LRESULT PAGER_SendConvertedNotify(PAGER_INFO *infoPtr, NMHDR *hdr, UINT * ...@@ -1167,18 +1167,18 @@ static LRESULT PAGER_SendConvertedNotify(PAGER_INFO *infoPtr, NMHDR *hdr, UINT *
if (*text == oldText) if (*text == oldText)
{ {
bufferSize = lstrlenA((CHAR *)*text) + 1; bufferSize = lstrlenA((CHAR *)*text) + 1;
receiveBuffer = heap_alloc(bufferSize); receiveBuffer = malloc(bufferSize);
if (!receiveBuffer) goto done; if (!receiveBuffer) goto done;
memcpy(receiveBuffer, *text, bufferSize); memcpy(receiveBuffer, *text, bufferSize);
MultiByteToWideChar(CP_ACP, 0, receiveBuffer, bufferSize, oldText, oldTextMax); MultiByteToWideChar(CP_ACP, 0, receiveBuffer, bufferSize, oldText, oldTextMax);
heap_free(receiveBuffer); free(receiveBuffer);
} }
else else
MultiByteToWideChar(CP_ACP, 0, (CHAR *)*text, -1, oldText, oldTextMax); MultiByteToWideChar(CP_ACP, 0, (CHAR *)*text, -1, oldText, oldTextMax);
} }
done: done:
heap_free(sendBuffer); free(sendBuffer);
*text = oldText; *text = oldText;
return ret; return ret;
} }
......
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