Seems fine.
Michał Wiernowolski a écrit :
> This patch puts together pieces of SysEx messages until
> End-of-Exclusive (F7) arrives or the buffer gets filled.
> This improves current behavior (giving up on all multi-buffer sysex
> msgs), fixing partially bug #6788.
>
> ------------------------------------------------------------------------
>
> >From 0102a6ed573916067f0c2fd84b5218bd4200fede Mon Sep 17 00:00:00 2001
> From: =?ISO-8859-2?q?Micha=B3_Wiernowolski?= <mihalw(a)gmail.com>
> Date: Tue, 24 Apr 2007 19:17:34 +0200
> Subject: [PATCH] winealsa: Improved handling of SysEx MIDI messages (Bug #6788)
>
> ---
> dlls/winealsa.drv/midi.c | 20 +++++++++++---------
> 1 files changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/dlls/winealsa.drv/midi.c b/dlls/winealsa.drv/midi.c
> index 09018aa..90d52e6 100644
> --- a/dlls/winealsa.drv/midi.c
> +++ b/dlls/winealsa.drv/midi.c
> @@ -351,17 +351,19 @@ static DWORD WINAPI midRecThread(LPVOID arg)
> LPBYTE ptr = (BYTE*) ev->data.ext.ptr;
> LPMIDIHDR lpMidiHdr;
>
> - /* FIXME: Should handle sysex greater that a single buffer */
> + /* FIXME: Should handle sysex greater than lpMidiHdr->dwBufferLength */
> EnterCriticalSection(&crit_sect);
> if ((lpMidiHdr = MidiInDev[wDevID].lpQueueHdr) != NULL) {
> - if (len <= lpMidiHdr->dwBufferLength) {
> - lpMidiHdr->dwBytesRecorded = len;
> - memcpy(lpMidiHdr->lpData, ptr, len);
> - lpMidiHdr->dwFlags &= ~MHDR_INQUEUE;
> - lpMidiHdr->dwFlags |= MHDR_DONE;
> - MidiInDev[wDevID].lpQueueHdr = (LPMIDIHDR)lpMidiHdr->lpNext;
> - if (MIDI_NotifyClient(wDevID, MIM_LONGDATA, (DWORD)lpMidiHdr, dwTime) != MMSYSERR_NOERROR)
> - WARN("Couldn't notify client\n");
> + if (lpMidiHdr->dwBytesRecorded + len <= lpMidiHdr->dwBufferLength) {
> + memcpy(lpMidiHdr->lpData + lpMidiHdr->dwBytesRecorded, ptr, len);
> + lpMidiHdr->dwBytesRecorded += len;
> + if (*(ptr + (len-1)) == 0xF7) {
> + lpMidiHdr->dwFlags &= ~MHDR_INQUEUE;
> + lpMidiHdr->dwFlags |= MHDR_DONE;
> + MidiInDev[wDevID].lpQueueHdr = (LPMIDIHDR)lpMidiHdr->lpNext;
> + if (MIDI_NotifyClient(wDevID, MIM_LONGDATA, (DWORD)lpMidiHdr, dwTime) != MMSYSERR_NOERROR)
> + WARN("Couldn't notify client\n");
> + }
> } else
> FIXME("No enough space in the buffer to store sysex!\n");
> } else
>
> ------------------------------------------------------------------------
>
>
>