Bruno Jesus : avifil32: Remove the 1024 frame limit when recording AVI files.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Dec 31 15:59:34 CST 2014
Module: wine
Branch: master
Commit: d28c40da3bc685241363370f4b486bd975396afc
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d28c40da3bc685241363370f4b486bd975396afc
Author: Bruno Jesus <00cpxxx at gmail.com>
Date: Wed Dec 31 02:19:26 2014 -0200
avifil32: Remove the 1024 frame limit when recording AVI files.
---
dlls/avifil32/avifile.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/dlls/avifil32/avifile.c b/dlls/avifil32/avifile.c
index af0315d..f5abc1c 100644
--- a/dlls/avifil32/avifile.c
+++ b/dlls/avifil32/avifile.c
@@ -1424,11 +1424,21 @@ static HRESULT AVIFILE_AddRecord(IAVIFileImpl *This)
/* pre-conditions */
assert(This != NULL && This->ppStreams[0] != NULL);
- if (This->idxRecords == NULL || This->cbIdxRecords == 0) {
- This->cbIdxRecords += 1024 * sizeof(AVIINDEXENTRY);
- This->idxRecords = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->cbIdxRecords);
- if (This->idxRecords == NULL)
+ if (This->idxRecords == NULL || This->cbIdxRecords / sizeof(AVIINDEXENTRY) <= This->nIdxRecords) {
+ DWORD new_count = This->cbIdxRecords + 1024 * sizeof(AVIINDEXENTRY);
+ void *mem;
+ if (!This->idxRecords)
+ mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, new_count);
+ else
+ mem = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->idxRecords, new_count);
+ if (mem) {
+ This->cbIdxRecords = new_count;
+ This->idxRecords = mem;
+ } else {
+ HeapFree(GetProcessHeap(), 0, This->idxRecords);
+ This->idxRecords = NULL;
return AVIERR_MEMORY;
+ }
}
assert(This->nIdxRecords < This->cbIdxRecords/sizeof(AVIINDEXENTRY));
More information about the wine-cvs
mailing list