WINMM: Small header fix

Felix Nawothnig felix.nawothnig at t-online.de
Wed Aug 17 15:23:18 CDT 2005


The added casts are safe and necessary (we convert the MCI_OPEN_PARMS 
structure to Unicode before our 16-bit and A implementations call their 
W counterpart and convert the A strings into an allocated buffer - all 
strings coming from outside are actually const).

ChangeLog:
Make string elements of MCI_OPEN_PARMS const to match the SDK headers
-------------- next part --------------
Index: include/mmsystem.h
===================================================================
RCS file: /home/wine/wine/include/mmsystem.h,v
retrieving revision 1.79
diff -u -p -r1.79 mmsystem.h
--- include/mmsystem.h	20 Jun 2005 15:34:59 -0000	1.79
+++ include/mmsystem.h	17 Aug 2005 20:16:17 -0000
@@ -1942,17 +1942,17 @@ typedef struct tagMCI_GENERIC_PARMS {
 typedef struct tagMCI_OPEN_PARMSA {
        DWORD_PTR       dwCallback;
 	MCIDEVICEID	wDeviceID;
-	LPSTR		lpstrDeviceType;
-	LPSTR		lpstrElementName;
-	LPSTR		lpstrAlias;
+	LPCSTR		lpstrDeviceType;
+	LPCSTR		lpstrElementName;
+	LPCSTR		lpstrAlias;
 } MCI_OPEN_PARMSA, *LPMCI_OPEN_PARMSA;
 
 typedef struct tagMCI_OPEN_PARMSW {
        DWORD_PTR       dwCallback;
 	MCIDEVICEID	wDeviceID;
-	LPWSTR		lpstrDeviceType;
-	LPWSTR		lpstrElementName;
-	LPWSTR		lpstrAlias;
+	LPCWSTR		lpstrDeviceType;
+	LPCWSTR		lpstrElementName;
+	LPCWSTR		lpstrAlias;
 } MCI_OPEN_PARMSW, *LPMCI_OPEN_PARMSW;
 
 DECL_WINELIB_TYPE_AW(MCI_OPEN_PARMS)
Index: dlls/winmm/mci.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/mci.c,v
retrieving revision 1.63
diff -u -p -r1.63 mci.c
--- dlls/winmm/mci.c	20 Jun 2005 11:44:17 -0000	1.63
+++ dlls/winmm/mci.c	17 Aug 2005 20:16:20 -0000
@@ -456,15 +456,15 @@ static DWORD MCI_UnmapMsgAtoW(UINT msg, 
             if (dwParam1 & MCI_OPEN_TYPE)
             {
                 if (!(dwParam1 & MCI_OPEN_TYPE_ID))
-                    HeapFree(GetProcessHeap(), 0, mci_openW->lpstrDeviceType);
+                    HeapFree(GetProcessHeap(), 0, (LPWSTR)mci_openW->lpstrDeviceType);
             }
             if (dwParam1 & MCI_OPEN_ELEMENT)
             {
                 if (!(dwParam1 & MCI_OPEN_ELEMENT_ID))
-                    HeapFree(GetProcessHeap(), 0, mci_openW->lpstrElementName);
+                    HeapFree(GetProcessHeap(), 0, (LPWSTR)mci_openW->lpstrElementName);
             }
             if (dwParam1 & MCI_OPEN_ALIAS)
-                HeapFree(GetProcessHeap(), 0, mci_openW->lpstrAlias);
+                HeapFree(GetProcessHeap(), 0, (LPWSTR)mci_openW->lpstrAlias);
             HeapFree(GetProcessHeap(), 0, ptr);
         }
         break;
Index: dlls/winmm/message16.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/message16.c,v
retrieving revision 1.14
diff -u -p -r1.14 message16.c
--- dlls/winmm/message16.c	20 Jun 2005 11:44:17 -0000	1.14
+++ dlls/winmm/message16.c	17 Aug 2005 20:16:25 -0000
@@ -2808,11 +2808,11 @@ static  WINMM_MapType	MCI_UnMapMsg16To32
 
 	    mop16->wDeviceID = mop32w->wDeviceID;
             if( ( dwFlags & ( MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID)) == MCI_OPEN_TYPE)
-                HeapFree(GetProcessHeap(), 0, mop32w->lpstrDeviceType);
+                HeapFree(GetProcessHeap(), 0, (LPWSTR)mop32w->lpstrDeviceType);
             if( ( dwFlags & ( MCI_OPEN_ELEMENT | MCI_OPEN_ELEMENT_ID)) == MCI_OPEN_ELEMENT)
-                HeapFree(GetProcessHeap(), 0, mop32w->lpstrElementName);
+                HeapFree(GetProcessHeap(), 0, (LPWSTR)mop32w->lpstrElementName);
             if( ( dwFlags &  MCI_OPEN_ALIAS))
-                HeapFree(GetProcessHeap(), 0, mop32w->lpstrAlias);
+                HeapFree(GetProcessHeap(), 0, (LPWSTR)mop32w->lpstrAlias);
 	    if (!HeapFree(GetProcessHeap(), 0, (LPVOID)(lParam - sizeof(LPMCI_OPEN_PARMS16))))
 		FIXME("bad free line=%d\n", __LINE__);
 	}


More information about the wine-patches mailing list