Commit 42579f1d authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

riched20: Use CRT allocation functions.

parent de81e2ea
......@@ -444,7 +444,7 @@ BOOL ME_DeleteTextAtCursor(ME_TextEditor *editor, int nCursor, int nChars)
static struct re_object* create_re_object(const REOBJECT *reo, ME_Run *run)
{
struct re_object *reobj = heap_alloc(sizeof(*reobj));
struct re_object *reobj = malloc(sizeof(*reobj));
if (!reobj)
{
......
......@@ -87,7 +87,7 @@ static ULONG WINAPI EnumFormatImpl_Release(IEnumFORMATETC *iface)
if(!ref) {
GlobalFree(This->fmtetc);
heap_free(This);
free(This);
}
return ref;
......@@ -163,7 +163,7 @@ static HRESULT EnumFormatImpl_Create(const FORMATETC *fmtetc, UINT fmtetc_cnt,
EnumFormatImpl *ret;
TRACE("\n");
ret = heap_alloc(sizeof(EnumFormatImpl));
ret = malloc(sizeof(EnumFormatImpl));
ret->IEnumFORMATETC_iface.lpVtbl = &VT_EnumFormatImpl;
ret->ref = 1;
ret->cur = 0;
......@@ -206,7 +206,7 @@ static ULONG WINAPI DataObjectImpl_Release(IDataObject* iface)
if(This->unicode) GlobalFree(This->unicode);
if(This->rtf) GlobalFree(This->rtf);
if(This->fmtetc) GlobalFree(This->fmtetc);
heap_free(This);
free(This);
}
return ref;
......@@ -405,7 +405,7 @@ HRESULT ME_GetDataObject(ME_TextEditor *editor, const ME_Cursor *start, int nCha
DataObjectImpl *obj;
TRACE("(%p,%d,%d)\n", editor, ME_GetCursorOfs(start), nChars);
obj = heap_alloc(sizeof(DataObjectImpl));
obj = malloc(sizeof(DataObjectImpl));
if(cfRTF == 0)
cfRTF = RegisterClipboardFormatA("Rich Text Format");
......
......@@ -246,7 +246,7 @@ HINSTANCE dll_instance = NULL;
BOOL me_debug = FALSE;
static ME_TextBuffer *ME_MakeText(void) {
ME_TextBuffer *buf = heap_alloc(sizeof(*buf));
ME_TextBuffer *buf = malloc(sizeof(*buf));
ME_DisplayItem *p1 = ME_MakeDI(diTextStart);
ME_DisplayItem *p2 = ME_MakeDI(diTextEnd);
......@@ -607,7 +607,7 @@ void ME_RTFParAttrHook(RTF_Info *info)
{
while (info->rtfParam > info->nestingLevel)
{
RTFTable *tableDef = heap_alloc_zero(sizeof(*tableDef));
RTFTable *tableDef = calloc(1, sizeof(*tableDef));
tableDef->parent = info->tableDef;
info->tableDef = tableDef;
......@@ -641,7 +641,7 @@ void ME_RTFParAttrHook(RTF_Info *info)
ME_Paragraph *para;
if (!info->tableDef)
info->tableDef = heap_alloc_zero(sizeof(*info->tableDef));
info->tableDef = calloc(1, sizeof(*info->tableDef));
tableDef = info->tableDef;
RTFFlushOutputBuffer(info);
if (tableDef->row_start && tableDef->row_start->nFlags & MEPF_ROWEND)
......@@ -1059,14 +1059,14 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
{
tableDef = info->tableDef;
info->tableDef = tableDef->parent;
heap_free(tableDef);
free(tableDef);
}
}
}
else
{
info->tableDef = tableDef->parent;
heap_free(tableDef);
free(tableDef);
}
}
else /* v1.0 - v3.0 */
......@@ -1224,7 +1224,7 @@ static DWORD read_hex_data( RTF_Info *info, BYTE **out )
return 0;
}
buf = HeapAlloc( GetProcessHeap(), 0, size );
buf = malloc(size);
if (!buf) return 0;
val = info->rtfMajor;
......@@ -1233,7 +1233,7 @@ static DWORD read_hex_data( RTF_Info *info, BYTE **out )
RTFGetToken( info );
if (info->rtfClass == rtfEOF)
{
HeapFree( GetProcessHeap(), 0, buf );
free(buf);
return 0;
}
if (info->rtfClass != rtfText) break;
......@@ -1242,7 +1242,7 @@ static DWORD read_hex_data( RTF_Info *info, BYTE **out )
if (read >= size)
{
size *= 2;
buf = HeapReAlloc( GetProcessHeap(), 0, buf, size );
buf = realloc(buf, size);
if (!buf) return 0;
}
buf[read++] = RTFCharToHex(val) * 16 + RTFCharToHex(info->rtfMajor);
......@@ -1363,7 +1363,7 @@ static void ME_RTFReadPictGroup(RTF_Info *info)
break;
}
}
HeapFree( GetProcessHeap(), 0, buffer );
free( buffer );
RTFRouteToken( info ); /* feed "}" back to router */
return;
}
......@@ -2121,14 +2121,14 @@ static int ME_GetTextEx(ME_TextEditor *editor, GETTEXTEX *ex, LPARAM pText)
LRESULT rc;
buflen = min(crlfmul * nChars, ex->cb - 1);
buffer = heap_alloc((buflen + 1) * sizeof(WCHAR));
buffer = malloc((buflen + 1) * sizeof(WCHAR));
nChars = ME_GetTextW(editor, buffer, buflen, &start, nChars, ex->flags & GT_USECRLF, FALSE);
rc = WideCharToMultiByte(ex->codepage, 0, buffer, nChars + 1,
(LPSTR)pText, ex->cb, ex->lpDefaultChar, ex->lpUsedDefChar);
if (rc) rc--; /* do not count 0 terminator */
heap_free(buffer);
free(buffer);
return rc;
}
}
......@@ -2927,7 +2927,7 @@ static BOOL ME_ShowContextMenu(ME_TextEditor *editor, int x, int y)
ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
{
ME_TextEditor *ed = heap_alloc(sizeof(*ed));
ME_TextEditor *ed = malloc( sizeof(*ed) );
int i;
LONG selbarwidth;
HRESULT hr;
......@@ -2968,7 +2968,7 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
* or paragraph selection.
*/
ed->nCursors = 4;
ed->pCursors = heap_alloc(ed->nCursors * sizeof(*ed->pCursors));
ed->pCursors = malloc( ed->nCursors * sizeof(*ed->pCursors) );
ME_SetCursorToStart(ed, &ed->pCursors[0]);
ed->pCursors[1] = ed->pCursors[0];
ed->pCursors[2] = ed->pCursors[0];
......@@ -3099,9 +3099,9 @@ void ME_DestroyEditor(ME_TextEditor *editor)
OleUninitialize();
heap_free(editor->pBuffer);
heap_free(editor->pCursors);
heap_free(editor);
free(editor->pBuffer);
free(editor->pCursors);
free(editor);
}
static inline int get_default_line_height( ME_TextEditor *editor )
......@@ -4136,11 +4136,11 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam,
dwIndex = GCS_COMPSTR;
dwBufLen = ImmGetCompositionStringW(hIMC, dwIndex, NULL, 0);
lpCompStr = HeapAlloc(GetProcessHeap(),0,dwBufLen + sizeof(WCHAR));
lpCompStr = malloc(dwBufLen + sizeof(WCHAR));
ImmGetCompositionStringW(hIMC, dwIndex, lpCompStr, dwBufLen);
lpCompStr[dwBufLen/sizeof(WCHAR)] = 0;
ME_InsertTextFromCursor(editor,0,lpCompStr,dwBufLen/sizeof(WCHAR),style);
HeapFree(GetProcessHeap(), 0, lpCompStr);
free(lpCompStr);
if (dwIndex == GCS_COMPSTR)
set_selection_cursors(editor,editor->imeStartIndex,
......
......@@ -46,7 +46,6 @@
#include "wine/asm.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h"
#include "wine/rbtree.h"
......
......@@ -123,16 +123,16 @@ void ME_DestroyDisplayItem(ME_DisplayItem *item)
list_remove(&item->member.run.reobj->entry);
ME_DeleteReObject(item->member.run.reobj);
}
heap_free( item->member.run.glyphs );
heap_free( item->member.run.clusters );
free(item->member.run.glyphs);
free(item->member.run.clusters);
ME_ReleaseStyle(item->member.run.style);
}
heap_free(item);
free(item);
}
ME_DisplayItem *ME_MakeDI(ME_DIType type)
{
ME_DisplayItem *item = heap_alloc_zero(sizeof(*item));
ME_DisplayItem *item = calloc(1, sizeof(*item));
item->type = type;
item->prev = item->next = NULL;
......
......@@ -75,23 +75,6 @@ static void RTFPutCodePageChar(RTF_Info *info, int c);
/* ---------------------------------------------------------------------- */
/*
* Saves a string on the heap and returns a pointer to it.
*/
static inline char *RTFStrSave(const char *s)
{
char *p;
p = heap_alloc (lstrlenA(s) + 1);
if (p == NULL)
return NULL;
return lstrcpyA (p, s);
}
/* ---------------------------------------------------------------------- */
int _RTFGetChar(RTF_Info *info)
{
int ch;
......@@ -129,14 +112,14 @@ RTFDestroyAttrs(RTF_Info *info)
while (info->fontList)
{
fp = info->fontList->rtfNextFont;
heap_free (info->fontList->rtfFName);
heap_free (info->fontList);
free (info->fontList->rtfFName);
free (info->fontList);
info->fontList = fp;
}
while (info->colorList)
{
cp = info->colorList->rtfNextColor;
heap_free (info->colorList);
free (info->colorList);
info->colorList = cp;
}
while (info->styleList)
......@@ -146,12 +129,12 @@ RTFDestroyAttrs(RTF_Info *info)
while (eltList)
{
ep = eltList->rtfNextSE;
heap_free (eltList->rtfSEText);
heap_free (eltList);
free (eltList->rtfSEText);
free (eltList);
eltList = ep;
}
heap_free (info->styleList->rtfSName);
heap_free (info->styleList);
free (info->styleList->rtfSName);
free (info->styleList);
info->styleList = sp;
}
}
......@@ -162,16 +145,16 @@ RTFDestroy(RTF_Info *info)
{
if (info->rtfTextBuf)
{
heap_free(info->rtfTextBuf);
heap_free(info->pushedTextBuf);
free(info->rtfTextBuf);
free(info->pushedTextBuf);
}
RTFDestroyAttrs(info);
heap_free(info->cpOutputBuffer);
free(info->cpOutputBuffer);
while (info->tableDef)
{
RTFTable *tableDef = info->tableDef;
info->tableDef = tableDef->parent;
heap_free(tableDef);
free(tableDef);
}
}
......@@ -215,8 +198,8 @@ void RTFInit(RTF_Info *info)
if (info->rtfTextBuf == NULL) /* initialize the text buffers */
{
info->rtfTextBuf = heap_alloc (rtfBufSiz);
info->pushedTextBuf = heap_alloc (rtfBufSiz);
info->rtfTextBuf = malloc (rtfBufSiz);
info->pushedTextBuf = malloc (rtfBufSiz);
if (info->rtfTextBuf == NULL || info->pushedTextBuf == NULL) {
ERR ("Cannot allocate text buffers.\n");
return;
......@@ -262,7 +245,7 @@ void RTFInit(RTF_Info *info)
if (!info->cpOutputBuffer)
{
info->dwMaxCPOutputCount = 0x1000;
info->cpOutputBuffer = heap_alloc(info->dwMaxCPOutputCount);
info->cpOutputBuffer = malloc (info->dwMaxCPOutputCount);
}
info->tableDef = NULL;
......@@ -813,7 +796,7 @@ static void ReadFontTbl(RTF_Info *info)
if (info->rtfClass == rtfEOF)
break;
}
fp = heap_alloc(sizeof(*fp));
fp = malloc (sizeof(*fp));
if (fp == NULL) {
ERR ("cannot allocate font entry\n");
break;
......@@ -901,7 +884,7 @@ static void ReadFontTbl(RTF_Info *info)
RTFUngetToken (info);
}
*bp = '\0';
fp->rtfFName = RTFStrSave (buf);
fp->rtfFName = strdup (buf);
if (fp->rtfFName == NULL)
ERR ("cannot allocate font name\n");
/* already have next token; don't read one */
......@@ -986,7 +969,7 @@ static void ReadColorTbl(RTF_Info *info)
continue;
}
cp = heap_alloc(sizeof(*cp));
cp = malloc (sizeof(*cp));
if (cp == NULL) {
ERR ("cannot allocate color entry\n");
break;
......@@ -1036,7 +1019,7 @@ static void ReadStyleSheet(RTF_Info *info)
break;
if (RTFCheckCM (info, rtfGroup, rtfEndGroup))
break;
sp = heap_alloc(sizeof(*sp));
sp = malloc (sizeof(*sp));
if (sp == NULL) {
ERR ("cannot allocate stylesheet entry\n");
break;
......@@ -1104,7 +1087,7 @@ static void ReadStyleSheet(RTF_Info *info)
sp->rtfSNextPar = info->rtfParam;
continue;
}
sep = heap_alloc(sizeof(*sep));
sep = malloc (sizeof(*sep));
if (sep == NULL)
{
ERR ("cannot allocate style element\n");
......@@ -1114,7 +1097,7 @@ static void ReadStyleSheet(RTF_Info *info)
sep->rtfSEMajor = info->rtfMajor;
sep->rtfSEMinor = info->rtfMinor;
sep->rtfSEParam = info->rtfParam;
sep->rtfSEText = RTFStrSave (info->rtfTextBuf);
sep->rtfSEText = strdup (info->rtfTextBuf);
if (sep->rtfSEText == NULL)
ERR ("cannot allocate style element text\n");
if (sepLast == NULL)
......@@ -1149,7 +1132,7 @@ static void ReadStyleSheet(RTF_Info *info)
RTFGetToken (info);
}
*bp = '\0';
sp->rtfSName = RTFStrSave (buf);
sp->rtfSName = strdup (buf);
if (sp->rtfSName == NULL)
ERR ("cannot allocate style name\n");
}
......@@ -2199,10 +2182,7 @@ void LookupInit(void)
rp->rtfKHash = Hash (rp->rtfKStr);
index = rp->rtfKHash % (ARRAY_SIZE(rtfKey) * 2);
if (!rtfHashTable[index].count)
rtfHashTable[index].value = heap_alloc(sizeof(RTFKey *));
else
rtfHashTable[index].value = heap_realloc(rtfHashTable[index].value, sizeof(RTFKey *) * (rtfHashTable[index].count + 1));
rtfHashTable[index].value = realloc(rtfHashTable[index].value, sizeof(RTFKey *) * (rtfHashTable[index].count + 1));
rtfHashTable[index].value[rtfHashTable[index].count++] = rp;
}
}
......@@ -2213,7 +2193,7 @@ void LookupCleanup(void)
for (i = 0; i < ARRAY_SIZE(rtfKey) * 2; i++)
{
heap_free( rtfHashTable[i].value );
free(rtfHashTable[i].value);
rtfHashTable[i].value = NULL;
rtfHashTable[i].count = 0;
}
......@@ -2611,7 +2591,7 @@ static void
RTFFlushCPOutputBuffer(RTF_Info *info)
{
int bufferMax = info->dwCPOutputCount * 2 * sizeof(WCHAR);
WCHAR *buffer = heap_alloc(bufferMax);
WCHAR *buffer = malloc(bufferMax);
int length;
length = MultiByteToWideChar(info->codePage, 0, info->cpOutputBuffer,
......@@ -2619,7 +2599,7 @@ RTFFlushCPOutputBuffer(RTF_Info *info)
info->dwCPOutputCount = 0;
RTFPutUnicodeString(info, buffer, length);
heap_free(buffer);
free(buffer);
}
void
......@@ -2648,7 +2628,7 @@ RTFPutCodePageChar(RTF_Info *info, int c)
if (info->dwCPOutputCount >= info->dwMaxCPOutputCount)
{
info->dwMaxCPOutputCount *= 2;
info->cpOutputBuffer = heap_realloc(info->cpOutputBuffer, info->dwMaxCPOutputCount);
info->cpOutputBuffer = realloc(info->cpOutputBuffer, info->dwMaxCPOutputCount);
}
info->cpOutputBuffer[info->dwCPOutputCount++] = c;
}
......@@ -1005,7 +1005,7 @@ static ULONG WINAPI IOleClientSite_fnRelease(IOleClientSite *iface)
list_remove(&This->child.entry);
This->child.reole = NULL;
}
heap_free(This);
free(This);
}
return ref;
}
......@@ -1218,7 +1218,7 @@ static const IOleInPlaceSiteVtbl olestvt =
static HRESULT CreateOleClientSite( struct text_services *services, IOleClientSite **ret )
{
IOleClientSiteImpl *clientSite = heap_alloc(sizeof *clientSite);
IOleClientSiteImpl *clientSite = malloc(sizeof *clientSite);
if (!clientSite)
return E_OUTOFMEMORY;
......@@ -1481,7 +1481,7 @@ static ULONG WINAPI ITextRange_fnRelease(ITextRange *me)
list_remove(&This->child.entry);
This->child.reole = NULL;
}
heap_free(This);
free(This);
}
return ref;
}
......@@ -2775,7 +2775,7 @@ static ULONG WINAPI TextFont_Release(ITextFont *iface)
if (This->range)
ITextRange_Release(This->range);
SysFreeString(This->props[FONT_NAME].str);
heap_free(This);
free(This);
}
return ref;
......@@ -3489,7 +3489,7 @@ static HRESULT create_textfont(ITextRange *range, const ITextFontImpl *src, ITex
ITextFontImpl *font;
*ret = NULL;
font = heap_alloc(sizeof(*font));
font = malloc(sizeof(*font));
if (!font)
return E_OUTOFMEMORY;
......@@ -3556,7 +3556,7 @@ static ULONG WINAPI TextPara_Release(ITextPara *iface)
if (!ref)
{
ITextRange_Release(This->range);
heap_free(This);
free(This);
}
return ref;
......@@ -4024,7 +4024,7 @@ static HRESULT create_textpara(ITextRange *range, ITextPara **ret)
ITextParaImpl *para;
*ret = NULL;
para = heap_alloc(sizeof(*para));
para = malloc(sizeof(*para));
if (!para)
return E_OUTOFMEMORY;
......@@ -4304,7 +4304,7 @@ static HRESULT WINAPI ITextDocument2Old_fnRedo(ITextDocument2Old *iface, LONG Co
static HRESULT CreateITextRange(struct text_services *services, LONG start, LONG end, ITextRange** ppRange)
{
ITextRangeImpl *txtRge = heap_alloc(sizeof(ITextRangeImpl));
ITextRangeImpl *txtRge = malloc(sizeof(ITextRangeImpl));
if (!txtRge)
return E_OUTOFMEMORY;
......@@ -4613,7 +4613,7 @@ static ULONG WINAPI ITextSelection_fnRelease(ITextSelection *me)
struct text_selection *This = impl_from_ITextSelection(me);
ULONG ref = InterlockedDecrement(&This->ref);
if (ref == 0)
heap_free(This);
free(This);
return ref;
}
......@@ -5683,7 +5683,7 @@ static const ITextSelectionVtbl tsvt = {
static struct text_selection *text_selection_create(struct text_services *services)
{
struct text_selection *txtSel = heap_alloc(sizeof *txtSel);
struct text_selection *txtSel = malloc(sizeof *txtSel);
if (!txtSel)
return NULL;
......@@ -5911,7 +5911,7 @@ void ME_DeleteReObject(struct re_object *reobj)
if (reobj->obj.poleobj) IOleObject_Release(reobj->obj.poleobj);
if (reobj->obj.pstg) IStorage_Release(reobj->obj.pstg);
if (reobj->obj.polesite) IOleClientSite_Release(reobj->obj.polesite);
heap_free(reobj);
free(reobj);
}
void ME_CopyReObject(REOBJECT *dst, const REOBJECT *src, DWORD flags)
......
......@@ -29,7 +29,7 @@ static int ME_GetOptimalBuffer(int nLen)
static ME_String *make_string( void (*free)(ME_String *) )
{
ME_String *s = heap_alloc( sizeof(*s) );
ME_String *s = malloc( sizeof(*s) );
if (s) s->free = free;
return s;
......@@ -49,23 +49,23 @@ ME_String *ME_MakeStringConst(const WCHAR *str, int len)
return s;
}
static void heap_string_free(ME_String *s)
static void string_free(ME_String *s)
{
heap_free( s->szData );
free( s->szData );
}
/* Create a buffer (uninitialized string) of size nMaxChars */
ME_String *ME_MakeStringEmpty(int nMaxChars)
{
ME_String *s = make_string( heap_string_free );
ME_String *s = make_string( string_free );
if (!s) return NULL;
s->nLen = nMaxChars;
s->nBuffer = ME_GetOptimalBuffer(s->nLen + 1);
s->szData = heap_alloc( s->nBuffer * sizeof(WCHAR) );
s->szData = malloc( s->nBuffer * sizeof(WCHAR) );
if (!s->szData)
{
heap_free( s );
free( s );
return NULL;
}
s->szData[s->nLen] = 0;
......@@ -97,7 +97,7 @@ void ME_DestroyString(ME_String *s)
{
if (!s) return;
if (s->free) s->free( s );
heap_free( s );
free( s );
}
BOOL ME_InsertString(ME_String *s, int ofs, const WCHAR *insert, int len)
......@@ -111,7 +111,7 @@ BOOL ME_InsertString(ME_String *s, int ofs, const WCHAR *insert, int len)
if( new_len > s->nBuffer )
{
s->nBuffer = ME_GetOptimalBuffer( new_len );
new = heap_realloc( s->szData, s->nBuffer * sizeof(WCHAR) );
new = realloc( s->szData, s->nBuffer * sizeof(WCHAR) );
if (!new) return FALSE;
s->szData = new;
}
......@@ -201,12 +201,12 @@ ME_CallWordBreakProc(ME_TextEditor *editor, WCHAR *str, INT len, INT start, INT
int result;
int buffer_size = WideCharToMultiByte(CP_ACP, 0, str, len,
NULL, 0, NULL, NULL);
char *buffer = heap_alloc(buffer_size);
char *buffer = malloc(buffer_size);
if (!buffer) return 0;
WideCharToMultiByte(CP_ACP, 0, str, len,
buffer, buffer_size, NULL, NULL);
result = editor->pfnWordBreak((WCHAR*)buffer, start, buffer_size, code);
heap_free(buffer);
free(buffer);
return result;
}
}
......@@ -227,7 +227,7 @@ LPWSTR ME_ToUnicode(LONG codepage, LPVOID psz, INT *len)
if(!nChars) return NULL;
if((tmp = heap_alloc( nChars * sizeof(WCHAR) )) != NULL)
if((tmp = malloc(nChars * sizeof(WCHAR))) != NULL)
*len = MultiByteToWideChar(codepage, 0, psz, -1, tmp, nChars) - 1;
return tmp;
}
......@@ -236,5 +236,5 @@ LPWSTR ME_ToUnicode(LONG codepage, LPVOID psz, INT *len)
void ME_EndToUnicode(LONG codepage, LPVOID psz)
{
if (codepage != CP_UNICODE)
heap_free( psz );
free(psz);
}
......@@ -120,7 +120,7 @@ BOOL cf2w_to_cfany(CHARFORMAT2W *to, const CHARFORMAT2W *from)
ME_Style *ME_MakeStyle(CHARFORMAT2W *style)
{
ME_Style *s = heap_alloc(sizeof(*s));
ME_Style *s = malloc(sizeof(*s));
assert(style->cbSize == sizeof(CHARFORMAT2W));
s->fmt = *style;
......@@ -448,7 +448,7 @@ void ME_DestroyStyle(ME_Style *s)
s->font_cache = NULL;
}
ScriptFreeCache( &s->script_cache );
heap_free(s);
free(s);
}
void ME_AddRefStyle(ME_Style *s)
......
......@@ -546,7 +546,7 @@ void table_move_from_row_start( ME_TextEditor *editor )
struct RTFTable *ME_MakeTableDef(ME_TextEditor *editor)
{
RTFTable *tableDef = heap_alloc_zero(sizeof(*tableDef));
RTFTable *tableDef = calloc(1, sizeof(*tableDef));
if (!editor->bEmulateVersion10) /* v4.1 */
tableDef->gapH = 10;
......
......@@ -95,7 +95,7 @@ struct host *host_create( HWND hwnd, CREATESTRUCTW *cs, BOOL emulate_10 )
{
struct host *texthost;
texthost = heap_alloc(sizeof(*texthost));
texthost = malloc( sizeof(*texthost) );
if (!texthost) return NULL;
texthost->ITextHost_iface.lpVtbl = &textHostVtbl;
......@@ -162,7 +162,7 @@ static ULONG WINAPI ITextHostImpl_Release( ITextHost2 *iface )
{
SetWindowLongPtrW( host->window, 0, 0 );
ITextServices_Release( host->text_srv );
heap_free( host );
free( host );
}
return ref;
}
......@@ -898,7 +898,7 @@ static HRESULT get_lineA( ITextServices *text_srv, WPARAM wparam, LPARAM lparam,
sizeA = *(WORD *)lparam;
*(WORD *)lparam = 0;
if (!sizeA) return S_OK;
buf = heap_alloc( len * sizeof(WCHAR) );
buf = malloc( len * sizeof(WCHAR) );
if (!buf) return E_OUTOFMEMORY;
*(WORD *)buf = len;
hr = ITextServices_TxSendMessage( text_srv, EM_GETLINE, wparam, (LPARAM)buf, &len );
......@@ -909,7 +909,7 @@ static HRESULT get_lineA( ITextServices *text_srv, WPARAM wparam, LPARAM lparam,
if (len < sizeA) ((char *)lparam)[len] = '\0';
*res = len;
}
heap_free( buf );
free( buf );
return hr;
}
......@@ -928,7 +928,7 @@ static HRESULT get_text_rangeA( struct host *host, TEXTRANGEA *rangeA, LRESULT *
range.chrg.cpMax = len;
if (range.chrg.cpMin >= range.chrg.cpMax) return S_OK;
count = range.chrg.cpMax - range.chrg.cpMin + 1;
range.lpstrText = heap_alloc( count * sizeof(WCHAR) );
range.lpstrText = malloc( count * sizeof(WCHAR) );
if (!range.lpstrText) return E_OUTOFMEMORY;
hr = ITextServices_TxSendMessage( host->text_srv, EM_GETTEXTRANGE, 0, (LPARAM)&range, &len );
if (hr == S_OK && len)
......@@ -942,7 +942,7 @@ static HRESULT get_text_rangeA( struct host *host, TEXTRANGEA *rangeA, LRESULT *
rangeA->lpstrText[*res] = '\0';
}
}
heap_free( range.lpstrText );
free( range.lpstrText );
return hr;
}
......
......@@ -81,7 +81,7 @@ static ULONG WINAPI ITextServicesImpl_Release(IUnknown *iface)
{
richole_release_children( services );
ME_DestroyEditor( services->editor );
heap_free( services );
free( services );
}
return ref;
}
......@@ -582,7 +582,7 @@ HRESULT create_text_services( IUnknown *outer, ITextHost *text_host, IUnknown **
TRACE( "%p %p --> %p\n", outer, text_host, unk );
if (text_host == NULL) return E_POINTER;
services = heap_alloc( sizeof(*services) );
services = malloc( sizeof(*services) );
if (services == NULL) return E_OUTOFMEMORY;
services->ref = 1;
services->IUnknown_inner.lpVtbl = &textservices_inner_vtbl;
......
......@@ -27,7 +27,7 @@ static void destroy_undo_item( struct undo_item *undo )
switch( undo->type )
{
case undo_insert_run:
heap_free( undo->u.insert_run.str );
free( undo->u.insert_run.str );
ME_ReleaseStyle( undo->u.insert_run.style );
break;
case undo_split_para:
......@@ -37,7 +37,7 @@ static void destroy_undo_item( struct undo_item *undo )
break;
}
heap_free( undo );
free( undo );
}
static void empty_redo_stack(ME_TextEditor *editor)
......@@ -77,7 +77,7 @@ static struct undo_item *add_undo( ME_TextEditor *editor, enum undo_type type )
if (editor_undo_ignored(editor)) return NULL;
if (editor->nUndoLimit == 0) return NULL;
undo = heap_alloc( sizeof(*undo) );
undo = malloc( sizeof(*undo) );
if (!undo) return NULL;
undo->type = type;
......@@ -133,7 +133,7 @@ BOOL add_undo_insert_run( ME_TextEditor *editor, int pos, const WCHAR *str, int
struct undo_item *undo = add_undo( editor, undo_insert_run );
if (!undo) return FALSE;
undo->u.insert_run.str = heap_alloc( (len + 1) * sizeof(WCHAR) );
undo->u.insert_run.str = malloc( (len + 1) * sizeof(WCHAR) );
if (!undo->u.insert_run.str)
{
ME_EmptyUndoStack( editor );
......
......@@ -50,8 +50,8 @@ typedef struct tagME_WrapContext
static BOOL get_run_glyph_buffers( ME_Run *run )
{
heap_free( run->glyphs );
run->glyphs = heap_alloc( run->max_glyphs * (sizeof(WORD) + sizeof(SCRIPT_VISATTR) + sizeof(int) + sizeof(GOFFSET)) );
free( run->glyphs );
run->glyphs = malloc( run->max_glyphs * (sizeof(WORD) + sizeof(SCRIPT_VISATTR) + sizeof(int) + sizeof(GOFFSET)) );
if (!run->glyphs) return FALSE;
run->vis_attrs = (SCRIPT_VISATTR*)((char*)run->glyphs + run->max_glyphs * sizeof(WORD));
......@@ -75,9 +75,9 @@ static HRESULT shape_run( ME_Context *c, ME_Run *run )
if (run->max_clusters < run->len)
{
heap_free( run->clusters );
free( run->clusters );
run->max_clusters = run->len * 2;
run->clusters = heap_alloc( run->max_clusters * sizeof(WORD) );
run->clusters = malloc( run->max_clusters * sizeof(WORD) );
}
select_style( c, run->style );
......@@ -250,7 +250,7 @@ static void layout_row( ME_Run *start, ME_Run *last )
if (!num_runs) return;
if (num_runs > ARRAY_SIZE( buf ) / 5)
vis_to_log = heap_alloc( num_runs * sizeof(int) * 5 );
vis_to_log = malloc( num_runs * sizeof(int) * 5 );
log_to_vis = vis_to_log + num_runs;
widths = vis_to_log + 2 * num_runs;
......@@ -278,7 +278,7 @@ static void layout_row( ME_Run *start, ME_Run *last )
i++;
}
if (vis_to_log != buf) heap_free( vis_to_log );
if (vis_to_log != buf) free( vis_to_log );
}
static void ME_InsertRowStart( ME_WrapContext *wc, ME_Run *last )
......@@ -744,9 +744,9 @@ static HRESULT itemize_para( ME_Context *c, ME_Paragraph *para )
if (items_passed > para->text->nLen + 1) break; /* something else has gone wrong */
items_passed *= 2;
if (items == buf)
items = heap_alloc( items_passed * sizeof( *items ) );
items = malloc( items_passed * sizeof( *items ) );
else
items = heap_realloc( items, items_passed * sizeof( *items ) );
items = realloc( items, items_passed * sizeof( *items ) );
if (!items) break;
}
if (FAILED( hr )) goto end;
......@@ -792,7 +792,7 @@ static HRESULT itemize_para( ME_Context *c, ME_Paragraph *para )
para->nFlags |= MEPF_COMPLEX;
end:
if (items != buf) heap_free( items );
if (items != buf) free( items );
return hr;
}
......
......@@ -52,7 +52,7 @@ ME_StreamOutRTFText(ME_OutStream *pStream, const WCHAR *text, LONG nChars);
static ME_OutStream*
ME_StreamOutInit(ME_TextEditor *editor, EDITSTREAM *stream)
{
ME_OutStream *pStream = heap_alloc_zero(sizeof(*pStream));
ME_OutStream *pStream = calloc(1, sizeof(*pStream));
pStream->stream = stream;
pStream->stream->dwError = 0;
......@@ -92,7 +92,7 @@ ME_StreamOutFree(ME_OutStream *pStream)
LONG written = pStream->written;
TRACE("total length = %lu\n", written);
heap_free(pStream);
free(pStream);
return written;
}
......@@ -954,7 +954,7 @@ static BOOL stream_out_graphics( ME_TextEditor *editor, ME_OutStream *stream,
size = GetEnhMetaFileBits( med.hEnhMetaFile, 0, NULL );
if (size < FIELD_OFFSET(ENHMETAHEADER, cbPixelFormat)) goto done;
emf_bits = HeapAlloc( GetProcessHeap(), 0, size );
emf_bits = malloc( size );
if (!emf_bits) goto done;
size = GetEnhMetaFileBits( med.hEnhMetaFile, size, (BYTE *)emf_bits );
......@@ -986,7 +986,7 @@ static BOOL stream_out_graphics( ME_TextEditor *editor, ME_OutStream *stream,
done:
ME_DestroyContext( &c );
ITextHost_TxReleaseDC( editor->texthost, hdc );
HeapFree( GetProcessHeap(), 0, emf_bits );
free( emf_bits );
ReleaseStgMedium( &med );
IDataObject_Release( data );
return ret;
......@@ -1155,7 +1155,7 @@ static BOOL ME_StreamOutText(ME_TextEditor *editor, ME_OutStream *pStream,
nSize = WideCharToMultiByte(nCodePage, 0, get_text( cursor.run, cursor.nOffset ),
nLen, NULL, 0, NULL, NULL);
if (nSize > nBufLen) {
buffer = heap_realloc(buffer, nSize);
buffer = realloc(buffer, nSize);
nBufLen = nSize;
}
WideCharToMultiByte(nCodePage, 0, get_text( cursor.run, cursor.nOffset ),
......@@ -1169,7 +1169,7 @@ static BOOL ME_StreamOutText(ME_TextEditor *editor, ME_OutStream *pStream,
cursor.run = run_next_all_paras( cursor.run );
}
heap_free(buffer);
free(buffer);
return success;
}
......
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