wintab32: Use CRT allocation functions.

This commit is contained in:
Alex Henrie 2023-09-07 17:36:12 -06:00 committed by Alexandre Julliard
parent 6dae924d55
commit 537bcadbe8

View file

@ -423,10 +423,10 @@ static UINT WTInfoT(UINT wCategory, UINT nIndex, LPVOID lpOutput, BOOL bUnicode)
else if (is_string_field(wCategory, nIndex) && !bUnicode) else if (is_string_field(wCategory, nIndex) && !bUnicode)
{ {
int size = pWTInfoW(wCategory, nIndex, NULL); int size = pWTInfoW(wCategory, nIndex, NULL);
WCHAR *buf = HeapAlloc(GetProcessHeap(), 0, size); WCHAR *buf = malloc(size);
pWTInfoW(wCategory, nIndex, buf); pWTInfoW(wCategory, nIndex, buf);
result = WideCharToMultiByte(CP_ACP, 0, buf, size/sizeof(WCHAR), lpOutput, lpOutput ? 2*size : 0, NULL, NULL); result = WideCharToMultiByte(CP_ACP, 0, buf, size/sizeof(WCHAR), lpOutput, lpOutput ? 2*size : 0, NULL, NULL);
HeapFree(GetProcessHeap(), 0, buf); free(buf);
} }
else else
result = pWTInfoW(wCategory, nIndex, lpOutput); result = pWTInfoW(wCategory, nIndex, lpOutput);
@ -464,13 +464,13 @@ HCTX WINAPI WTOpenW(HWND hWnd, LPLOGCONTEXTW lpLogCtx, BOOL fEnable)
TRACE("hWnd=%p, lpLogCtx=%p, fEnable=%u\n", hWnd, lpLogCtx, fEnable); TRACE("hWnd=%p, lpLogCtx=%p, fEnable=%u\n", hWnd, lpLogCtx, fEnable);
DUMPCONTEXT(*lpLogCtx); DUMPCONTEXT(*lpLogCtx);
newcontext = HeapAlloc(GetProcessHeap(), 0 , sizeof(OPENCONTEXT)); newcontext = malloc(sizeof(OPENCONTEXT));
newcontext->context = *lpLogCtx; newcontext->context = *lpLogCtx;
newcontext->hwndOwner = hWnd; newcontext->hwndOwner = hWnd;
newcontext->ActiveCursor = -1; newcontext->ActiveCursor = -1;
newcontext->QueueSize = 10; newcontext->QueueSize = 10;
newcontext->PacketsQueued = 0; newcontext->PacketsQueued = 0;
newcontext->PacketQueue=HeapAlloc(GetProcessHeap(),0,sizeof(WTPACKET)*10); newcontext->PacketQueue = malloc(sizeof(WTPACKET) * 10);
EnterCriticalSection(&csTablet); EnterCriticalSection(&csTablet);
newcontext->handle = gTopContext++; newcontext->handle = gTopContext++;
@ -547,8 +547,8 @@ BOOL WINAPI WTClose(HCTX hCtx)
TABLET_PostTabletMessage(context, _WT_CTXCLOSE(context->context.lcMsgBase), (WPARAM)context->handle, TABLET_PostTabletMessage(context, _WT_CTXCLOSE(context->context.lcMsgBase), (WPARAM)context->handle,
context->context.lcStatus,TRUE); context->context.lcStatus,TRUE);
HeapFree(GetProcessHeap(),0,context->PacketQueue); free(context->PacketQueue);
HeapFree(GetProcessHeap(),0,context); free(context);
return TRUE; return TRUE;
} }
@ -1124,8 +1124,7 @@ BOOL WINAPI WTQueueSizeSet(HCTX hCtx, int nPkts)
return FALSE; return FALSE;
} }
context->PacketQueue = HeapReAlloc(GetProcessHeap(), 0, context->PacketQueue = realloc(context->PacketQueue, sizeof(WTPACKET) * nPkts);
context->PacketQueue, sizeof(WTPACKET)*nPkts);
context->QueueSize = nPkts; context->QueueSize = nPkts;
LeaveCriticalSection(&csTablet); LeaveCriticalSection(&csTablet);