[PATCH 1/3] mciqtz32: Move MCIQTZ_mciGetOpenDev at the top and always use it.

Christian Costa titan.costa at wanadoo.fr
Wed Apr 22 17:03:52 CDT 2009


---

 dlls/mciqtz32/mciqtz.c |   34 +++++++++++++++++-----------------
 1 files changed, 17 insertions(+), 17 deletions(-)
-------------- next part --------------
diff --git a/dlls/mciqtz32/mciqtz.c b/dlls/mciqtz32/mciqtz.c
index 63b80f5..8222199 100644
--- a/dlls/mciqtz32/mciqtz.c
+++ b/dlls/mciqtz32/mciqtz.c
@@ -54,6 +54,20 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID fImpLoad)
 }
 
 /**************************************************************************
+ *                              MCIQTZ_mciGetOpenDev            [internal]
+ */
+static WINE_MCIQTZ* MCIQTZ_mciGetOpenDev(UINT wDevID)
+{
+    WINE_MCIQTZ* wma = (WINE_MCIQTZ*)mciGetDriverData(wDevID);
+
+    if (!wma) {
+        WARN("Invalid wDevID=%u\n", wDevID);
+        return NULL;
+    }
+    return wma;
+}
+
+/**************************************************************************
  *                              MCIQTZ_drvOpen                  [internal]
  */
 static DWORD MCIQTZ_drvOpen(LPCWSTR str, LPMCI_OPEN_DRIVER_PARMSW modp)
@@ -88,7 +102,7 @@ static DWORD MCIQTZ_drvClose(DWORD dwDevID)
     /* finish all outstanding things */
     MCIQTZ_mciClose(dwDevID, MCI_WAIT, NULL);
 
-    wma = (WINE_MCIQTZ*)mciGetDriverData(dwDevID);
+    wma = MCIQTZ_mciGetOpenDev(dwDevID);
 
     if (wma) {
         HeapFree(GetProcessHeap(), 0, wma);
@@ -109,7 +123,7 @@ static DWORD MCIQTZ_drvConfigure(DWORD dwDevID)
 
     MCIQTZ_mciStop(dwDevID, MCI_WAIT, NULL);
 
-    wma = (WINE_MCIQTZ*)mciGetDriverData(dwDevID);
+    wma = MCIQTZ_mciGetOpenDev(dwDevID);
 
     if (wma) {
         MessageBoxA(0, "Sample QTZ Wine Driver !", "MM-Wine Driver", MB_OK);
@@ -119,20 +133,6 @@ static DWORD MCIQTZ_drvConfigure(DWORD dwDevID)
     return 0;
 }
 
-/**************************************************************************
- *                              MCIQTZ_mciGetOpenDev            [internal]
- */
-static WINE_MCIQTZ* MCIQTZ_mciGetOpenDev(UINT wDevID)
-{
-    WINE_MCIQTZ* wma = (WINE_MCIQTZ*)mciGetDriverData(wDevID);
-
-    if (!wma) {
-        WARN("Invalid wDevID=%u\n", wDevID);
-        return 0;
-    }
-    return wma;
-}
-
 /***************************************************************************
  *                              MCIQTZ_mciOpen                  [internal]
  */
@@ -149,7 +149,7 @@ static DWORD MCIQTZ_mciOpen(UINT wDevID, DWORD dwFlags,
     if (!lpOpenParms)
         return MCIERR_NULL_PARAMETER_BLOCK;
 
-    wma = (WINE_MCIQTZ*)mciGetDriverData(wDevID);
+    wma = MCIQTZ_mciGetOpenDev(wDevID);
     if (!wma)
         return MCIERR_INVALID_DEVICE_ID;
 


More information about the wine-patches mailing list