dmsynth: Fix compilation on systems that don't support nameless structs or unions. (resubmit)

Francois Gouget fgouget at free.fr
Sun Oct 28 13:45:43 CDT 2012


---
 dlls/dmsynth/synth.c         |   20 +++++++++++---------
 dlls/dmsynth/synthsink.c     |   10 +++++-----
 dlls/dmsynth/tests/dmsynth.c |   16 ++++++++--------
 3 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/dlls/dmsynth/synth.c b/dlls/dmsynth/synth.c
index f34594d..7b19ac0 100644
--- a/dlls/dmsynth/synth.c
+++ b/dlls/dmsynth/synth.c
@@ -19,6 +19,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#define NONAMELESSSTRUCT
+#define NONAMELESSUNION
 #define COBJMACROS
 
 #include "objbase.h"
@@ -418,45 +420,45 @@ static HRESULT WINAPI DMSynthImpl_IKsControl_KsProperty(IKsControl* iface, PKSPR
 {
     TRACE("(%p)->(%p, %u, %p, %u, %p)\n", iface, Property, PropertyLength, PropertyData, DataLength, BytesReturned);
 
-    TRACE("Property = %s - %u - %u\n", debugstr_guid(&Property->Set), Property->Id, Property->Flags);
+    TRACE("Property = %s - %u - %u\n", debugstr_guid(&Property->u.s.Set), Property->u.s.Id, Property->u.s.Flags);
 
-    if (Property->Flags != KSPROPERTY_TYPE_GET)
+    if (Property->u.s.Flags != KSPROPERTY_TYPE_GET)
     {
-        FIXME("Property flags %u not yet supported\n", Property->Flags);
+        FIXME("Property flags %u not yet supported\n", Property->u.s.Flags);
         return S_FALSE;
     }
 
     if (DataLength <  sizeof(DWORD))
         return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
 
-    if (IsEqualGUID(&Property->Set, &GUID_DMUS_PROP_INSTRUMENT2))
+    if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_INSTRUMENT2))
     {
         *(DWORD*)PropertyData = TRUE;
         *BytesReturned = sizeof(DWORD);
     }
-    else if (IsEqualGUID(&Property->Set, &GUID_DMUS_PROP_DLS2))
+    else if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_DLS2))
     {
         *(DWORD*)PropertyData = TRUE;
         *BytesReturned = sizeof(DWORD);
     }
-    else if (IsEqualGUID(&Property->Set, &GUID_DMUS_PROP_GM_Hardware))
+    else if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_GM_Hardware))
     {
         *(DWORD*)PropertyData = FALSE;
         *BytesReturned = sizeof(DWORD);
     }
-    else if (IsEqualGUID(&Property->Set, &GUID_DMUS_PROP_GS_Hardware))
+    else if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_GS_Hardware))
     {
         *(DWORD*)PropertyData = FALSE;
         *BytesReturned = sizeof(DWORD);
     }
-    else if (IsEqualGUID(&Property->Set, &GUID_DMUS_PROP_XG_Hardware))
+    else if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_XG_Hardware))
     {
         *(DWORD*)PropertyData = FALSE;
         *BytesReturned = sizeof(DWORD);
     }
     else
     {
-        FIXME("Unknown property %s\n", debugstr_guid(&Property->Set));
+        FIXME("Unknown property %s\n", debugstr_guid(&Property->u.s.Set));
         *(DWORD*)PropertyData = FALSE;
         *BytesReturned = sizeof(DWORD);
     }
diff --git a/dlls/dmsynth/synthsink.c b/dlls/dmsynth/synthsink.c
index 4d2001c..d17cdb5 100644
--- a/dlls/dmsynth/synthsink.c
+++ b/dlls/dmsynth/synthsink.c
@@ -212,25 +212,25 @@ static HRESULT WINAPI DMSynthSinkImpl_IKsControl_KsProperty(IKsControl* iface, P
 {
     TRACE("(%p)->(%p, %u, %p, %u, %p)\n", iface, Property, PropertyLength, PropertyData, DataLength, BytesReturned);
 
-    TRACE("Property = %s - %u - %u\n", debugstr_guid(&Property->Set), Property->Id, Property->Flags);
+    TRACE("Property = %s - %u - %u\n", debugstr_guid(&Property->u.s.Set), Property->u.s.Id, Property->u.s.Flags);
 
-    if (Property->Flags != KSPROPERTY_TYPE_GET)
+    if (Property->u.s.Flags != KSPROPERTY_TYPE_GET)
     {
-        FIXME("Property flags %u not yet supported\n", Property->Flags);
+        FIXME("Property flags %u not yet supported\n", Property->u.s.Flags);
         return S_FALSE;
     }
 
     if (DataLength <  sizeof(DWORD))
         return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
 
-    if (IsEqualGUID(&Property->Set, &GUID_DMUS_PROP_SinkUsesDSound))
+    if (IsEqualGUID(&Property->u.s.Set, &GUID_DMUS_PROP_SinkUsesDSound))
     {
         *(DWORD*)PropertyData = TRUE;
         *BytesReturned = sizeof(DWORD);
     }
     else
     {
-        FIXME("Unknown property %s\n", debugstr_guid(&Property->Set));
+        FIXME("Unknown property %s\n", debugstr_guid(&Property->u.s.Set));
         *(DWORD*)PropertyData = FALSE;
         *BytesReturned = sizeof(DWORD);
     }
diff --git a/dlls/dmsynth/tests/dmsynth.c b/dlls/dmsynth/tests/dmsynth.c
index 83a0bca..ba094a1 100644
--- a/dlls/dmsynth/tests/dmsynth.c
+++ b/dlls/dmsynth/tests/dmsynth.c
@@ -56,30 +56,30 @@ static void test_dmsynth(void)
     hr = IDirectMusicSynth_QueryInterface(dmsynth, &IID_IKsControl, (LPVOID*)&control_synth);
     ok(hr == S_OK, "IDirectMusicSynth_QueryInterface returned: %x\n", hr);
 
-    property.Id = 0;
-    property.Flags = KSPROPERTY_TYPE_GET;
+    S(U(property)).Id = 0;
+    S(U(property)).Flags = KSPROPERTY_TYPE_GET;
 
-    property.Set = GUID_DMUS_PROP_INSTRUMENT2;
+    S(U(property)).Set = GUID_DMUS_PROP_INSTRUMENT2;
     hr = IKsControl_KsProperty(control_synth, &property, sizeof(property), &value, sizeof(value), &bytes);
     ok(hr == S_OK, "IKsControl_KsProperty returned: %x\n", hr);
     ok(bytes == sizeof(DWORD), "Returned bytes: %u, should be 4\n", bytes);
     ok(value == TRUE, "Return value: %u, should be 1\n", value);
-    property.Set = GUID_DMUS_PROP_DLS2;
+    S(U(property)).Set = GUID_DMUS_PROP_DLS2;
     hr = IKsControl_KsProperty(control_synth, &property, sizeof(property), &value, sizeof(value), &bytes);
     ok(hr == S_OK, "IKsControl_KsProperty returned: %x\n", hr);
     ok(bytes == sizeof(DWORD), "Returned bytes: %u, should be 4\n", bytes);
     ok(value == TRUE, "Return value: %u, should be 1\n", value);
-    property.Set = GUID_DMUS_PROP_GM_Hardware;
+    S(U(property)).Set = GUID_DMUS_PROP_GM_Hardware;
     hr = IKsControl_KsProperty(control_synth, &property, sizeof(property), &value, sizeof(value), &bytes);
     ok(hr == S_OK, "IKsControl_KsProperty returned: %x\n", hr);
     ok(bytes == sizeof(DWORD), "Returned bytes: %u, should be 4\n", bytes);
     ok(value == FALSE, "Return value: %u, should be 0\n", value);
-    property.Set = GUID_DMUS_PROP_GS_Hardware;
+    S(U(property)).Set = GUID_DMUS_PROP_GS_Hardware;
     hr = IKsControl_KsProperty(control_synth, &property, sizeof(property), &value, sizeof(value), &bytes);
     ok(hr == S_OK, "IKsControl_KsProperty returned: %x\n", hr);
     ok(bytes == sizeof(DWORD), "Returned bytes: %u, should be 4\n", bytes);
     ok(value == FALSE, "Return value: %u, should be 0\n", value);
-    property.Set = GUID_DMUS_PROP_XG_Hardware;
+    S(U(property)).Set = GUID_DMUS_PROP_XG_Hardware;
     hr = IKsControl_KsProperty(control_synth, &property, sizeof(property), &value, sizeof(value), &bytes);
     ok(hr == S_OK, "IKsControl_KsProperty returned: %x\n", hr);
     ok(bytes == sizeof(DWORD), "Returned bytes: %u, should be 4\n", bytes);
@@ -88,7 +88,7 @@ static void test_dmsynth(void)
     hr = IDirectMusicSynthSink_QueryInterface(dmsynth_sink, &IID_IKsControl, (LPVOID*)&control_sink);
     ok(hr == S_OK, "IDirectMusicSynthSink_QueryInterface returned: %x\n", hr);
 
-    property.Set = GUID_DMUS_PROP_SinkUsesDSound;
+    S(U(property)).Set = GUID_DMUS_PROP_SinkUsesDSound;
     hr = IKsControl_KsProperty(control_sink, &property, sizeof(property), &value, sizeof(value), &bytes);
     ok(hr == S_OK, "IKsControl_KsProperty returned: %x\n", hr);
     ok(bytes == sizeof(DWORD), "Returned bytes: %u, should be 4\n", bytes);
-- 
1.7.10.4



More information about the wine-patches mailing list