lpmmioinfo can sometimes, proven in the read case, be NULL.

This commit is contained in:
Johan Gill 2002-05-16 18:27:52 +00:00 committed by Alexandre Julliard
parent 1222aa63d5
commit b4f3cc9507
1 changed files with 12 additions and 8 deletions

View File

@ -1284,10 +1284,13 @@ MMRESULT WINAPI mmioAdvance(HMMIO hmmio, MMIOINFO* lpmmioinfo, UINT uFlags)
} }
if (MMIO_Flush(wm, 0) != MMSYSERR_NOERROR) if (MMIO_Flush(wm, 0) != MMSYSERR_NOERROR)
return MMIOERR_CANNOTWRITE; return MMIOERR_CANNOTWRITE;
wm->dwFileSize = max(wm->dwFileSize, lpmmioinfo->lBufOffset + (lpmmioinfo->pchNext - lpmmioinfo->pchBuffer));
if (lpmmioinfo) {
wm->dwFileSize = max(wm->dwFileSize, lpmmioinfo->lBufOffset + (lpmmioinfo->pchNext - lpmmioinfo->pchBuffer));
}
MMIO_GrabNextBuffer(wm, uFlags == MMIO_READ); MMIO_GrabNextBuffer(wm, uFlags == MMIO_READ);
if (lpmmioinfo) {
lpmmioinfo->pchNext = lpmmioinfo->pchBuffer; lpmmioinfo->pchNext = lpmmioinfo->pchBuffer;
lpmmioinfo->pchEndRead = lpmmioinfo->pchBuffer + lpmmioinfo->pchEndRead = lpmmioinfo->pchBuffer +
(wm->info.pchEndRead - wm->info.pchBuffer); (wm->info.pchEndRead - wm->info.pchBuffer);
@ -1295,6 +1298,7 @@ MMRESULT WINAPI mmioAdvance(HMMIO hmmio, MMIOINFO* lpmmioinfo, UINT uFlags)
(wm->info.pchEndWrite - wm->info.pchBuffer); (wm->info.pchEndWrite - wm->info.pchBuffer);
lpmmioinfo->lDiskOffset = wm->info.lDiskOffset; lpmmioinfo->lDiskOffset = wm->info.lDiskOffset;
lpmmioinfo->lBufOffset = wm->info.lBufOffset; lpmmioinfo->lBufOffset = wm->info.lBufOffset;
}
return MMSYSERR_NOERROR; return MMSYSERR_NOERROR;
} }