Another portion of HeapReAlloc fixes.

This commit is contained in:
Oleg Prokhorov 2003-10-24 00:29:43 +00:00 committed by Alexandre Julliard
parent 6661f30409
commit b6ee614a81
3 changed files with 49 additions and 8 deletions

View File

@ -159,10 +159,17 @@ static void *grow_array( void *array, unsigned int *count, size_t elem )
void *new_array;
unsigned int new_count = *count + *count / 2;
if (new_count < 32) new_count = 32;
if ((new_array = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, array, new_count * elem )))
if (array)
new_array = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, array, new_count * elem );
else
new_array = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, new_count * elem );
if (new_array)
*count = new_count;
else
HeapFree( GetProcessHeap(), 0, array );
if (array)
HeapFree( GetProcessHeap(), 0, array );
return new_array;
}

View File

@ -124,7 +124,12 @@ VHSTR WINAPI vsmStringAdd16(LPCSTR lpszName)
{
index = vhstr_alloc;
vhstr_alloc += 20;
vhstrlist = HeapReAlloc(heap, HEAP_ZERO_MEMORY, vhstrlist,
if (vhstrlist)
vhstrlist = HeapReAlloc(heap, HEAP_ZERO_MEMORY, vhstrlist,
sizeof(VHSTR_STRUCT *) * vhstr_alloc);
else
vhstrlist = HeapAlloc(heap, HEAP_ZERO_MEMORY,
sizeof(VHSTR_STRUCT *) * vhstr_alloc);
}
if (index == 0xffff)
@ -229,7 +234,11 @@ RETERR16 VCP_VirtnodeCreate(LPVCPFILESPEC vfsSrc, LPVCPFILESPEC vfsDst, WORD fl,
if (vn_last == vn_num)
{
vn_num += 20;
pvnlist = HeapReAlloc(heap, HEAP_ZERO_MEMORY, pvnlist,
if (pvnlist)
pvnlist = HeapReAlloc(heap, HEAP_ZERO_MEMORY, pvnlist,
sizeof(LPVIRTNODE *) * vn_num);
else
pvnlist = HeapAlloc(heap, HEAP_ZERO_MEMORY,
sizeof(LPVIRTNODE *) * vn_num);
}
pvnlist[vn_last] = HeapAlloc(heap, HEAP_ZERO_MEMORY, sizeof(VIRTNODE));

View File

@ -334,10 +334,17 @@ static int AllocEntry(void)
}
TRACE("Growing cache\n");
glyphsetCache = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
if (glyphsetCache)
glyphsetCache = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
glyphsetCache,
(glyphsetCacheSize + INIT_CACHE_SIZE)
* sizeof(*glyphsetCache));
else
glyphsetCache = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
(glyphsetCacheSize + INIT_CACHE_SIZE)
* sizeof(*glyphsetCache));
for(best = i = glyphsetCacheSize; i < glyphsetCacheSize + INIT_CACHE_SIZE;
i++) {
glyphsetCache[i].next = i + 1;
@ -538,19 +545,37 @@ static BOOL UploadGlyph(X11DRV_PDEVICE *physDev, int glyph)
if(entry->nrealized <= glyph) {
entry->nrealized = (glyph / 128 + 1) * 128;
entry->realized = HeapReAlloc(GetProcessHeap(),
if (entry->realized)
entry->realized = HeapReAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
entry->realized,
entry->nrealized * sizeof(BOOL));
else
entry->realized = HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
entry->nrealized * sizeof(BOOL));
if(entry->glyphset == 0) {
entry->bitmaps = HeapReAlloc(GetProcessHeap(),
if (entry->bitmaps)
entry->bitmaps = HeapReAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
entry->bitmaps,
entry->nrealized * sizeof(entry->bitmaps[0]));
entry->gis = HeapReAlloc(GetProcessHeap(),
else
entry->bitmaps = HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
entry->nrealized * sizeof(entry->bitmaps[0]));
if (entry->gis)
entry->gis = HeapReAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
entry->gis,
entry->nrealized * sizeof(entry->gis[0]));
else
entry->gis = HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
entry->nrealized * sizeof(entry->gis[0]));
}
}