winealsa: Ignore failure to notify MIDI clients.

Joerg-Cyril.Hoehle at t-systems.com Joerg-Cyril.Hoehle at t-systems.com
Wed Feb 3 06:10:34 CST 2010


Hi,

-    if (MIDI_NotifyClient(wDevID, MIM_OPEN, 0L, 0L) != MMSYSERR_NOERROR) {
-	WARN("can't notify client !\n");
-	return MMSYSERR_INVALPARAM;
-    }
It was wrong to return an error upon notification failure in open/close
yet leave the resources allocated.

Native doesn't check for invalid callback flags and successfully
opens the device and beeps (tested on w2k).

Maybe I went overboard with removing the return value of
MIDI_NotifyClient, however:
-	if (wDevID > MODM_NumDevs)
-	    return MMSYSERR_BADDEVICEID;
+	if (wDevID > MODM_NumDevs) return;
Could be turned into an assertion failure instead.
I'm wondering whether Wine perhaps dislikes assertions as it tends to
interrupt apps that would otherwise perhaps continue to work.

     default:
-	WARN("Unsupported MSW-MIDI message %u\n", wMsg);
-	return MMSYSERR_ERROR;
+	ERR("Unsupported MSW-MIDI message %u\n", wMsg);
Here it is statically provable that this branch is never taken. As all
values are litterals in the code, not app-supplied, I left an ERR instead.

-   if (MIDI_NotifyClient(wDevID, MIM_LONGDATA, (DWORD_PTR)lpMidiHdr, dwTime) != MMSYSERR_NOERROR)
-       WARN("Couldn't notify client\n");

All that MIDI_NotifyClient checked was the callback flags, not success
of actual notification.
Driver.c will already issue a WARN for a bad value, no need to repeat.

If you agree with me and this patch is accepted, I'll write the same
for OSS and CoreAudio.
Then the same likely applies to wave, not MIDI only.

Regards,
	Jörg Höhle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008-winealsa-Ignore-failure-to-notify-MIDI-clients.patch
Type: application/octet-stream
Size: 6104 bytes
Desc: 0008-winealsa-Ignore-failure-to-notify-MIDI-clients.patch
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20100203/fbcc40d0/attachment.obj>


More information about the wine-patches mailing list