Changelog: - Fixed multiple bugs in FindSample implementation of AVI and WAV file handler. Regards, Michael. Index: dlls/avifil32/avifile.c =================================================================== RCS file: /home/wine/wine/dlls/avifil32/avifile.c,v retrieving revision 1.40 diff -d -u -r1.40 avifile.c --- dlls/avifil32/avifile.c 14 Oct 2003 20:06:23 -0000 1.40 +++ dlls/avifil32/avifile.c 26 Nov 2003 15:26:55 -0000 @@ -840,14 +840,18 @@ ULONG n; for (n = 0; n < This->sInfo.dwFormatChangeCount; n++) - if (This->idxFmtChanges[n].ckid >= pos) + if (This->idxFmtChanges[n].ckid >= pos) { + pos = This->idxFmtChanges[n].ckid; goto RETURN_FOUND; + } } else { LONG n; for (n = (LONG)This->sInfo.dwFormatChangeCount; n >= 0; n--) { - if (This->idxFmtChanges[n].ckid <= pos) + if (This->idxFmtChanges[n].ckid <= pos) { + pos = This->idxFmtChanges[n].ckid; goto RETURN_FOUND; + } } if (pos > (LONG)This->sInfo.dwStart) @@ -858,30 +862,34 @@ return -1; } - if (flags & FIND_RET) { - RETURN_FOUND: - if (flags & FIND_LENGTH) { - /* logical size */ - if (This->sInfo.dwSampleSize) - pos = This->sInfo.dwSampleSize; - else - pos = 1; - } else if (flags & FIND_OFFSET) { - /* physical position */ - pos = This->idxFrames[pos].dwChunkOffset + offset * This->sInfo.dwSampleSize; - } else if (flags & FIND_SIZE) { - /* physical size */ - pos = This->idxFrames[pos].dwChunkLength; - } else if (flags & FIND_INDEX) { - FIXME(": FIND_INDEX flag is not supported!"); - - pos = This->paf->dwIdxChunkPos; - } /* else logical position */ + RETURN_FOUND: + if (pos < (LONG)This->sInfo.dwStart) + return -1; - return pos; - } + switch (flags & FIND_RET) { + case FIND_LENGTH: + /* physical size */ + pos = This->idxFrames[pos].dwChunkLength; + break; + case FIND_OFFSET: + /* physical position */ + pos = This->idxFrames[pos].dwChunkOffset + 2 * sizeof(DWORD) + + offset * This->sInfo.dwSampleSize; + break; + case FIND_SIZE: + /* logical size */ + if (This->sInfo.dwSampleSize) + pos = This->sInfo.dwSampleSize; + else + pos = 1; + break; + case FIND_INDEX: + FIXME(": FIND_INDEX flag is not supported!\n"); + /* This is an index in the index-table on disc. */ + break; + }; /* else logical position */ - return -1; + return pos; } static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream *iface, LONG pos, Index: dlls/avifil32/wavfile.c =================================================================== RCS file: /home/wine/wine/dlls/avifil32/wavfile.c,v retrieving revision 1.8 diff -d -u -r1.8 wavfile.c --- dlls/avifil32/wavfile.c 5 Sep 2003 23:08:44 -0000 1.8 +++ dlls/avifil32/wavfile.c 26 Nov 2003 15:26:55 -0000 @@ -757,9 +757,10 @@ pos = 0; } - if (flags & (FIND_LENGTH|FIND_SIZE)) + if ((flags & FIND_RET) == FIND_LENGTH || + (flags & FIND_RET) == FIND_SIZE) return This->sInfo.dwSampleSize; - if (flags & FIND_OFFSET) + if ((flags & FIND_RET) == FIND_OFFSET) return This->ckData.dwDataOffset + pos * This->sInfo.dwSampleSize; return pos;