usp10: Rename the wrappers around HeapAlloc() &Co to use the standard names.

This commit is contained in:
Michael Stefaniuc 2007-12-10 23:53:07 +01:00 committed by Alexandre Julliard
parent b2add094ad
commit 8f1b74a846
1 changed files with 41 additions and 41 deletions

View File

@ -173,24 +173,24 @@ typedef struct {
SIZE* sz;
} StringAnalysis;
static inline void *usp_alloc(SIZE_T size)
static inline void *heap_alloc(SIZE_T size)
{
return HeapAlloc(GetProcessHeap(), 0, size);
}
static inline void *usp_zero_alloc(SIZE_T size)
static inline void *heap_alloc_zero(SIZE_T size)
{
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
}
static inline void *usp_zero_realloc(LPVOID mem, SIZE_T size)
static inline void *heap_realloc_zero(LPVOID mem, SIZE_T size)
{
return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, size);
}
static inline void usp_free(LPVOID mem)
static inline BOOL heap_free(LPVOID mem)
{
HeapFree(GetProcessHeap(), 0, mem);
return HeapFree(GetProcessHeap(), 0, mem);
}
static HDC get_cache_hdc(SCRIPT_CACHE *psc)
@ -230,10 +230,10 @@ static HRESULT get_script_cache(const HDC hdc, SCRIPT_CACHE *psc)
ScriptCache *sc;
if (!hdc) return E_PENDING;
if (!(sc = usp_zero_alloc(sizeof(ScriptCache)))) return E_OUTOFMEMORY;
if (!(sc = heap_alloc_zero(sizeof(ScriptCache)))) return E_OUTOFMEMORY;
if ((ret = init_script_cache(hdc, sc)))
{
usp_free(sc);
heap_free(sc);
return ret;
}
*psc = sc;
@ -292,7 +292,7 @@ HRESULT WINAPI ScriptFreeCache(SCRIPT_CACHE *psc)
if (psc)
{
usp_free(*psc);
heap_free(*psc);
*psc = NULL;
}
return S_OK;
@ -610,8 +610,8 @@ HRESULT WINAPI ScriptStringAnalyse(HDC hdc, const void *pString, int cString,
if (cString < 1 || !pString) return E_INVALIDARG;
if ((dwFlags & SSA_GLYPHS) && !hdc) return E_PENDING;
if (!(analysis = usp_zero_alloc(sizeof(StringAnalysis)))) return E_OUTOFMEMORY;
if (!(analysis->pItem = usp_zero_alloc(num_items * sizeof(SCRIPT_ITEM) + 1))) goto error;
if (!(analysis = heap_alloc_zero(sizeof(StringAnalysis)))) return E_OUTOFMEMORY;
if (!(analysis->pItem = heap_alloc_zero(num_items * sizeof(SCRIPT_ITEM) + 1))) goto error;
/* FIXME: handle clipping */
analysis->clip_len = cString;
@ -624,7 +624,7 @@ HRESULT WINAPI ScriptStringAnalyse(HDC hdc, const void *pString, int cString,
SCRIPT_ITEM *tmp;
num_items *= 2;
if (!(tmp = usp_zero_realloc(analysis->pItem, num_items * sizeof(SCRIPT_ITEM) + 1)))
if (!(tmp = heap_realloc_zero(analysis->pItem, num_items * sizeof(SCRIPT_ITEM) + 1)))
goto error;
analysis->pItem = tmp;
@ -633,12 +633,12 @@ HRESULT WINAPI ScriptStringAnalyse(HDC hdc, const void *pString, int cString,
}
if (hr) goto error;
if ((analysis->logattrs = usp_alloc(sizeof(SCRIPT_LOGATTR) * cString)))
if ((analysis->logattrs = heap_alloc(sizeof(SCRIPT_LOGATTR) * cString)))
ScriptBreak(pString, cString, (SCRIPT_STRING_ANALYSIS)analysis, analysis->logattrs);
else
goto error;
if (!(analysis->glyphs = usp_zero_alloc(sizeof(StringGlyphs) * analysis->numItems)))
if (!(analysis->glyphs = heap_alloc_zero(sizeof(StringGlyphs) * analysis->numItems)))
goto error;
for (i = 0; i < analysis->numItems; i++)
@ -646,12 +646,12 @@ HRESULT WINAPI ScriptStringAnalyse(HDC hdc, const void *pString, int cString,
SCRIPT_CACHE *sc = (SCRIPT_CACHE *)&analysis->sc;
int cChar = analysis->pItem[i+1].iCharPos - analysis->pItem[i].iCharPos;
int numGlyphs = 1.5 * cChar + 16;
WORD *glyphs = usp_zero_alloc(sizeof(WORD) * numGlyphs);
WORD *pwLogClust = usp_zero_alloc(sizeof(WORD) * cChar);
int *piAdvance = usp_zero_alloc(sizeof(int) * numGlyphs);
SCRIPT_VISATTR *psva = usp_zero_alloc(sizeof(SCRIPT_VISATTR) * cChar);
GOFFSET *pGoffset = usp_zero_alloc(sizeof(GOFFSET) * numGlyphs);
ABC *abc = usp_zero_alloc(sizeof(ABC));
WORD *glyphs = heap_alloc_zero(sizeof(WORD) * numGlyphs);
WORD *pwLogClust = heap_alloc_zero(sizeof(WORD) * cChar);
int *piAdvance = heap_alloc_zero(sizeof(int) * numGlyphs);
SCRIPT_VISATTR *psva = heap_alloc_zero(sizeof(SCRIPT_VISATTR) * cChar);
GOFFSET *pGoffset = heap_alloc_zero(sizeof(GOFFSET) * numGlyphs);
ABC *abc = heap_alloc_zero(sizeof(ABC));
int numGlyphsReturned;
/* FIXME: non unicode strings */
@ -675,11 +675,11 @@ HRESULT WINAPI ScriptStringAnalyse(HDC hdc, const void *pString, int cString,
return S_OK;
error:
usp_free(analysis->glyphs);
usp_free(analysis->logattrs);
usp_free(analysis->pItem);
usp_free(analysis->sc);
usp_free(analysis);
heap_free(analysis->glyphs);
heap_free(analysis->logattrs);
heap_free(analysis->pItem);
heap_free(analysis->sc);
heap_free(analysis);
return hr;
}
@ -731,7 +731,7 @@ HRESULT WINAPI ScriptStringOut(SCRIPT_STRING_ANALYSIS ssa,
{
cnt += analysis->glyphs[item].numGlyphs;
}
if (!(glyphs = usp_alloc(sizeof(WCHAR) * cnt))) return E_OUTOFMEMORY;
if (!(glyphs = heap_alloc(sizeof(WCHAR) * cnt))) return E_OUTOFMEMORY;
/*
* ScriptStringOut only processes glyphs hence set ETO_GLYPH_INDEX
@ -767,7 +767,7 @@ HRESULT WINAPI ScriptStringOut(SCRIPT_STRING_ANALYSIS ssa,
/*
* Free the output buffer and script cache
*/
usp_free(glyphs);
heap_free(glyphs);
return hr;
}
@ -894,20 +894,20 @@ HRESULT WINAPI ScriptStringFree(SCRIPT_STRING_ANALYSIS *pssa)
for (i = 0; i < analysis->numItems; i++)
{
usp_free(analysis->glyphs[i].glyphs);
usp_free(analysis->glyphs[i].pwLogClust);
usp_free(analysis->glyphs[i].piAdvance);
usp_free(analysis->glyphs[i].psva);
usp_free(analysis->glyphs[i].pGoffset);
usp_free(analysis->glyphs[i].abc);
heap_free(analysis->glyphs[i].glyphs);
heap_free(analysis->glyphs[i].pwLogClust);
heap_free(analysis->glyphs[i].piAdvance);
heap_free(analysis->glyphs[i].psva);
heap_free(analysis->glyphs[i].pGoffset);
heap_free(analysis->glyphs[i].abc);
}
usp_free(analysis->glyphs);
usp_free(analysis->pItem);
usp_free(analysis->logattrs);
usp_free(analysis->sz);
usp_free(analysis->sc);
usp_free(analysis);
heap_free(analysis->glyphs);
heap_free(analysis->pItem);
heap_free(analysis->logattrs);
heap_free(analysis->sz);
heap_free(analysis->sc);
heap_free(analysis);
if (invalid) return E_INVALIDARG;
return S_OK;
@ -1321,7 +1321,7 @@ HRESULT WINAPI ScriptPlace(HDC hdc, SCRIPT_CACHE *psc, const WORD *pwGlyphs,
* has been converted to glyphs and we still need to translate back to the original chars
* to get the correct ABC widths. */
if (!(lpABC = usp_zero_alloc(sizeof(ABC) * cGlyphs))) return E_OUTOFMEMORY;
if (!(lpABC = heap_alloc_zero(sizeof(ABC) * cGlyphs))) return E_OUTOFMEMORY;
if (pABC)
memset(pABC, 0, sizeof(ABC));
@ -1357,7 +1357,7 @@ HRESULT WINAPI ScriptPlace(HDC hdc, SCRIPT_CACHE *psc, const WORD *pwGlyphs,
if (pABC)
TRACE("Total for run: abcA=%d, abcB=%d, abcC=%d\n", pABC->abcA, pABC->abcB, pABC->abcC);
usp_free(lpABC);
heap_free(lpABC);
unselect_cached_font(psc, hfont);
return S_OK;
}
@ -1615,7 +1615,7 @@ const SIZE * WINAPI ScriptString_pSize(SCRIPT_STRING_ANALYSIS ssa)
if (!analysis->sz)
{
if (!(analysis->sz = usp_alloc(sizeof(SIZE)))) return NULL;
if (!(analysis->sz = heap_alloc(sizeof(SIZE)))) return NULL;
analysis->sz->cy = analysis->sc->height;
analysis->sz->cx = 0;