Another portion of HeapReAlloc fixes.
This commit is contained in:
parent
6661f30409
commit
b6ee614a81
|
@ -159,9 +159,16 @@ static void *grow_array( void *array, unsigned int *count, size_t elem )
|
||||||
void *new_array;
|
void *new_array;
|
||||||
unsigned int new_count = *count + *count / 2;
|
unsigned int new_count = *count + *count / 2;
|
||||||
if (new_count < 32) new_count = 32;
|
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;
|
*count = new_count;
|
||||||
else
|
else
|
||||||
|
if (array)
|
||||||
HeapFree( GetProcessHeap(), 0, array );
|
HeapFree( GetProcessHeap(), 0, array );
|
||||||
return new_array;
|
return new_array;
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,8 +124,13 @@ VHSTR WINAPI vsmStringAdd16(LPCSTR lpszName)
|
||||||
{
|
{
|
||||||
index = vhstr_alloc;
|
index = vhstr_alloc;
|
||||||
vhstr_alloc += 20;
|
vhstr_alloc += 20;
|
||||||
|
|
||||||
|
if (vhstrlist)
|
||||||
vhstrlist = HeapReAlloc(heap, HEAP_ZERO_MEMORY, vhstrlist,
|
vhstrlist = HeapReAlloc(heap, HEAP_ZERO_MEMORY, vhstrlist,
|
||||||
sizeof(VHSTR_STRUCT *) * vhstr_alloc);
|
sizeof(VHSTR_STRUCT *) * vhstr_alloc);
|
||||||
|
else
|
||||||
|
vhstrlist = HeapAlloc(heap, HEAP_ZERO_MEMORY,
|
||||||
|
sizeof(VHSTR_STRUCT *) * vhstr_alloc);
|
||||||
}
|
}
|
||||||
if (index == 0xffff)
|
if (index == 0xffff)
|
||||||
return 0xffff; /* failure */
|
return 0xffff; /* failure */
|
||||||
|
@ -229,8 +234,12 @@ RETERR16 VCP_VirtnodeCreate(LPVCPFILESPEC vfsSrc, LPVCPFILESPEC vfsDst, WORD fl,
|
||||||
if (vn_last == vn_num)
|
if (vn_last == vn_num)
|
||||||
{
|
{
|
||||||
vn_num += 20;
|
vn_num += 20;
|
||||||
|
if (pvnlist)
|
||||||
pvnlist = HeapReAlloc(heap, HEAP_ZERO_MEMORY, pvnlist,
|
pvnlist = HeapReAlloc(heap, HEAP_ZERO_MEMORY, pvnlist,
|
||||||
sizeof(LPVIRTNODE *) * vn_num);
|
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));
|
pvnlist[vn_last] = HeapAlloc(heap, HEAP_ZERO_MEMORY, sizeof(VIRTNODE));
|
||||||
lpvn = pvnlist[vn_last];
|
lpvn = pvnlist[vn_last];
|
||||||
|
|
|
@ -334,10 +334,17 @@ static int AllocEntry(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("Growing cache\n");
|
TRACE("Growing cache\n");
|
||||||
|
|
||||||
|
if (glyphsetCache)
|
||||||
glyphsetCache = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
glyphsetCache = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||||
glyphsetCache,
|
glyphsetCache,
|
||||||
(glyphsetCacheSize + INIT_CACHE_SIZE)
|
(glyphsetCacheSize + INIT_CACHE_SIZE)
|
||||||
* sizeof(*glyphsetCache));
|
* sizeof(*glyphsetCache));
|
||||||
|
else
|
||||||
|
glyphsetCache = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||||
|
(glyphsetCacheSize + INIT_CACHE_SIZE)
|
||||||
|
* sizeof(*glyphsetCache));
|
||||||
|
|
||||||
for(best = i = glyphsetCacheSize; i < glyphsetCacheSize + INIT_CACHE_SIZE;
|
for(best = i = glyphsetCacheSize; i < glyphsetCacheSize + INIT_CACHE_SIZE;
|
||||||
i++) {
|
i++) {
|
||||||
glyphsetCache[i].next = i + 1;
|
glyphsetCache[i].next = i + 1;
|
||||||
|
@ -538,19 +545,37 @@ static BOOL UploadGlyph(X11DRV_PDEVICE *physDev, int glyph)
|
||||||
|
|
||||||
if(entry->nrealized <= glyph) {
|
if(entry->nrealized <= glyph) {
|
||||||
entry->nrealized = (glyph / 128 + 1) * 128;
|
entry->nrealized = (glyph / 128 + 1) * 128;
|
||||||
|
|
||||||
|
if (entry->realized)
|
||||||
entry->realized = HeapReAlloc(GetProcessHeap(),
|
entry->realized = HeapReAlloc(GetProcessHeap(),
|
||||||
HEAP_ZERO_MEMORY,
|
HEAP_ZERO_MEMORY,
|
||||||
entry->realized,
|
entry->realized,
|
||||||
entry->nrealized * sizeof(BOOL));
|
entry->nrealized * sizeof(BOOL));
|
||||||
|
else
|
||||||
|
entry->realized = HeapAlloc(GetProcessHeap(),
|
||||||
|
HEAP_ZERO_MEMORY,
|
||||||
|
entry->nrealized * sizeof(BOOL));
|
||||||
|
|
||||||
if(entry->glyphset == 0) {
|
if(entry->glyphset == 0) {
|
||||||
|
if (entry->bitmaps)
|
||||||
entry->bitmaps = HeapReAlloc(GetProcessHeap(),
|
entry->bitmaps = HeapReAlloc(GetProcessHeap(),
|
||||||
HEAP_ZERO_MEMORY,
|
HEAP_ZERO_MEMORY,
|
||||||
entry->bitmaps,
|
entry->bitmaps,
|
||||||
entry->nrealized * sizeof(entry->bitmaps[0]));
|
entry->nrealized * sizeof(entry->bitmaps[0]));
|
||||||
|
else
|
||||||
|
entry->bitmaps = HeapAlloc(GetProcessHeap(),
|
||||||
|
HEAP_ZERO_MEMORY,
|
||||||
|
entry->nrealized * sizeof(entry->bitmaps[0]));
|
||||||
|
|
||||||
|
if (entry->gis)
|
||||||
entry->gis = HeapReAlloc(GetProcessHeap(),
|
entry->gis = HeapReAlloc(GetProcessHeap(),
|
||||||
HEAP_ZERO_MEMORY,
|
HEAP_ZERO_MEMORY,
|
||||||
entry->gis,
|
entry->gis,
|
||||||
entry->nrealized * sizeof(entry->gis[0]));
|
entry->nrealized * sizeof(entry->gis[0]));
|
||||||
|
else
|
||||||
|
entry->gis = HeapAlloc(GetProcessHeap(),
|
||||||
|
HEAP_ZERO_MEMORY,
|
||||||
|
entry->nrealized * sizeof(entry->gis[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue