=?UTF-8?Q?J=C3=B6rg=20H=C3=B6hle=20?=: mciseq: Map MMSYSERR_* to MCIERR_* error codes.

Alexandre Julliard julliard at winehq.org
Mon Oct 8 13:39:57 CDT 2012


Module: wine
Branch: master
Commit: 4a823fdf00d39e6667ec46c94c5dd89846c76fab
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4a823fdf00d39e6667ec46c94c5dd89846c76fab

Author: Jörg Höhle <hoehle at users.sourceforge.net>
Date:   Fri Sep 14 16:46:32 2012 +0200

mciseq: Map MMSYSERR_* to MCIERR_* error codes.

---

 dlls/mciseq/mcimidi.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/dlls/mciseq/mcimidi.c b/dlls/mciseq/mcimidi.c
index e77d3f8..3b544c3 100644
--- a/dlls/mciseq/mcimidi.c
+++ b/dlls/mciseq/mcimidi.c
@@ -86,6 +86,22 @@ typedef struct tagWINE_MCIMIDI {
  *                  	    MCI MIDI implementation			*
  *======================================================================*/
 
+static DWORD mmr2mci(DWORD ret)
+{
+    switch (ret) {
+    case MMSYSERR_ALLOCATED:
+	return			MCIERR_SEQ_PORT_INUSE;
+    case MMSYSERR_NOMEM:
+	return			MCIERR_OUT_OF_MEMORY;
+    case MMSYSERR_BADDEVICEID:	/* wine*.drv disabled */
+      return			MCIERR_SEQ_PORT_NONEXISTENT;
+    case MIDIERR_INVALIDSETUP:	/* from midimap.dll without snd-seq module  */
+	return			MCIERR_SEQ_PORT_MAPNODEVICE;
+    default:
+	return ret;
+    }
+}
+
 static DWORD MIDI_mciResume(WINE_MCIMIDI* wmm, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms);
 
 /**************************************************************************
@@ -862,7 +878,7 @@ static DWORD MIDI_player(WINE_MCIMIDI* wmm, DWORD dwFlags)
 
     dwRet = midiOutOpen((LPHMIDIOUT)&wmm->hMidi, wmm->wPort, 0L, 0L, CALLBACK_NULL);
     if (dwRet != MMSYSERR_NOERROR) {
-	return dwRet;
+	return mmr2mci(dwRet);
     }
 
     wmm->dwPulse = 0;
@@ -1071,7 +1087,7 @@ static DWORD MIDI_player(WINE_MCIMIDI* wmm, DWORD dwFlags)
     /* Let the potentially asynchronous commands support FAILURE notification. */
     if (oldcb) mciDriverNotify(oldcb, wmm->wDevID,
 	dwRet ? MCI_NOTIFY_FAILURE : MCI_NOTIFY_SUCCESSFUL);
-    return dwRet;
+    return mmr2mci(dwRet);
 }
 
 static DWORD CALLBACK MIDI_Starter(void *ptr)




More information about the wine-cvs mailing list