=?UTF-8?Q?J=C3=B6rg=20H=C3=B6hle=20?=: mciseq: Correct MCI_SEEK return codes.

Alexandre Julliard julliard at winehq.org
Thu Oct 25 13:50:44 CDT 2012


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

Author: Jörg Höhle <hoehle at users.sourceforge.net>
Date:   Sun Sep 16 00:50:15 2012 +0200

mciseq: Correct MCI_SEEK return codes.

---

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

diff --git a/dlls/mciseq/mcimidi.c b/dlls/mciseq/mcimidi.c
index 3b544c3..abea412 100644
--- a/dlls/mciseq/mcimidi.c
+++ b/dlls/mciseq/mcimidi.c
@@ -1541,32 +1541,32 @@ static DWORD MIDI_mciInfo(WINE_MCIMIDI* wmm, DWORD dwFlags, LPMCI_INFO_PARMSW lp
  */
 static DWORD MIDI_mciSeek(WINE_MCIMIDI* wmm, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
 {
-    DWORD		ret = 0;
+    DWORD		position;
 
     TRACE("(%d, %08X, %p);\n", wmm->wDevID, dwFlags, lpParms);
 
-    if (lpParms == NULL) {
-	ret = MCIERR_NULL_PARAMETER_BLOCK;
-    } else {
-	MIDI_mciStop(wmm, MCI_WAIT, 0);
-
-	if (dwFlags & MCI_SEEK_TO_START) {
-	    wmm->dwPositionMS = 0;
-	} else if (dwFlags & MCI_SEEK_TO_END) {
-	    wmm->dwPositionMS = 0xFFFFFFFF; /* FIXME */
-	} else if (dwFlags & MCI_TO) {
-	    wmm->dwPositionMS = MIDI_ConvertTimeFormatToMS(wmm, lpParms->dwTo);
-	} else {
-	    WARN("dwFlag doesn't tell where to seek to...\n");
-	    return MCIERR_MISSING_PARAMETER;
-	}
+    if (lpParms == NULL) 	return MCIERR_NULL_PARAMETER_BLOCK;
 
-	TRACE("Seeking to position=%u ms\n", wmm->dwPositionMS);
+    position = dwFlags & (MCI_SEEK_TO_START|MCI_SEEK_TO_END|MCI_TO);
+    if (!position)		return MCIERR_MISSING_PARAMETER;
+    if (position&(position-1))	return MCIERR_FLAGS_NOT_COMPATIBLE;
 
-	if (dwFlags & MCI_NOTIFY)
-	    MIDI_mciNotify(lpParms->dwCallback, wmm, MCI_NOTIFY_SUCCESSFUL);
+    MIDI_mciStop(wmm, MCI_WAIT, 0);
+
+    if (dwFlags & MCI_TO) { /* FIXME: compare with length */
+        wmm->dwPositionMS = MIDI_ConvertTimeFormatToMS(wmm, lpParms->dwTo);
+    } else if (dwFlags & MCI_SEEK_TO_START) {
+        wmm->dwPositionMS = 0;
+    } else {
+        wmm->dwPositionMS = 0xFFFFFFFF; /* FIXME */
     }
-    return ret;
+
+    TRACE("Seeking to position=%u ms\n", wmm->dwPositionMS);
+
+    if (dwFlags & MCI_NOTIFY)
+        MIDI_mciNotify(lpParms->dwCallback, wmm, MCI_NOTIFY_SUCCESSFUL);
+
+    return 0;
 }
 
 /*======================================================================*




More information about the wine-cvs mailing list