[CMIDRIVER]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Mon, 31 May 2010 14:58:43 +0000 (14:58 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Mon, 31 May 2010 14:58:43 +0000 (14:58 +0000)
- Fix a number of warnings, no actual code change
- Patch by Love Nystrom, improvements by me

See issue #5336 for more details.

svn path=/trunk/; revision=47496

reactos/drivers/wdm/audio/drivers/CMIDriver/adapter.cpp
reactos/drivers/wdm/audio/drivers/CMIDriver/common.cpp
reactos/drivers/wdm/audio/drivers/CMIDriver/mintopo.cpp
reactos/drivers/wdm/audio/drivers/CMIDriver/mintopotables.hpp
reactos/drivers/wdm/audio/drivers/CMIDriver/minwave.cpp
reactos/drivers/wdm/audio/drivers/CMIDriver/minwavetables.hpp

index edf88bf..a3d884d 100644 (file)
@@ -29,7 +29,9 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <initguid.h>
 #include "adapter.hpp"
 
-//#pragma code_seg("PAGE")
+#ifdef _MSC_VER
+//#pragma code_seg("PAGE") // GCC ignores pragma code_seg
+#endif
 
 const GUID KSNODETYPE_DAC = {0x507AE360L, 0xC554, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}};
 const GUID KSNODETYPE_ADC = {0x4D837FE0L, 0xC555, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}};
@@ -267,7 +269,9 @@ NTSTATUS StartDevice(PDEVICE_OBJECT DeviceObject, PIRP Irp, PRESOURCELIST Resour
        PUNKNOWN unknownTopology = NULL;
 
        // install the topology miniport.
-       ntStatus = InstallSubdevice(DeviceObject, Irp, L"Topology", CLSID_PortTopology, CLSID_PortTopology, CreateMiniportTopologyCMI, pCMIAdapter, NULL, GUID_NULL, &unknownTopology);
+       ntStatus = InstallSubdevice( DeviceObject, Irp, (PWCHAR) L"Topology",
+               CLSID_PortTopology, CLSID_PortTopology, CreateMiniportTopologyCMI,
+               pCMIAdapter, NULL, GUID_NULL, &unknownTopology );
        if (!NT_SUCCESS (ntStatus)) {
                DBGPRINT(("Topology miniport installation failed"));
                return ntStatus;
@@ -277,7 +281,7 @@ NTSTATUS StartDevice(PDEVICE_OBJECT DeviceObject, PIRP Irp, PRESOURCELIST Resour
        // install the UART miniport - execution order important
        ntStatus = STATUS_UNSUCCESSFUL;
        MPUBase = 0;
-       for (int i=0;i<ResourceList->NumberOfPorts();i++) {
+       for ( UINT i=0; i < ResourceList->NumberOfPorts(); i++ ) {
                if (ResourceList->FindTranslatedPort(i)->u.Port.Length == 2) {
                        MPUBase = (UInt32*)ResourceList->FindTranslatedPort(i)->u.Port.Start.QuadPart;
                }
@@ -285,7 +289,10 @@ NTSTATUS StartDevice(PDEVICE_OBJECT DeviceObject, PIRP Irp, PRESOURCELIST Resour
        if (MPUBase != 0) {
                ntStatus = pCMIAdapter->activateMPU(MPUBase);
                if (NT_SUCCESS(ntStatus)) {
-                       ntStatus = InstallSubdevice(DeviceObject, Irp, L"Uart", CLSID_PortDMus, CLSID_MiniportDriverDMusUART, NULL, pCMIAdapter->getInterruptSync(), UartResourceList, IID_IPortDMus, NULL);
+                       ntStatus = InstallSubdevice( DeviceObject, Irp, (PWCHAR) L"Uart",
+                               CLSID_PortDMus, CLSID_MiniportDriverDMusUART, NULL,
+                               pCMIAdapter->getInterruptSync(), UartResourceList,
+                               IID_IPortDMus, NULL );
                }
        }
        if (!NT_SUCCESS(ntStatus)) {
@@ -300,9 +307,13 @@ NTSTATUS StartDevice(PDEVICE_OBJECT DeviceObject, PIRP Irp, PRESOURCELIST Resour
 
        // install the wave miniport - the order matters here
 #ifdef WAVERT
-       ntStatus = InstallSubdevice(DeviceObject, Irp, L"Wave", CLSID_PortWaveRT, CLSID_PortWaveRT, CreateMiniportWaveCMI, pCMIAdapter, ResourceList, IID_IPortWaveRT, &unknownWave);
+       ntStatus = InstallSubdevice(DeviceObject, Irp, (PWCHAR) L"Wave",
+               CLSID_PortWaveRT, CLSID_PortWaveRT, CreateMiniportWaveCMI,
+               pCMIAdapter, ResourceList, IID_IPortWaveRT, &unknownWave );
 #else
-       ntStatus = InstallSubdevice(DeviceObject, Irp, L"Wave", CLSID_PortWaveCyclic, CLSID_PortWaveCyclic, CreateMiniportWaveCMI, pCMIAdapter, ResourceList, IID_IPortWaveCyclic, &unknownWave);
+       ntStatus = InstallSubdevice(DeviceObject, Irp, (PWCHAR) L"Wave",
+               CLSID_PortWaveCyclic, CLSID_PortWaveCyclic, CreateMiniportWaveCMI,
+               pCMIAdapter, ResourceList, IID_IPortWaveCyclic, &unknownWave );
 #endif
        if (!NT_SUCCESS(ntStatus)) {
                DBGPRINT(("Wave miniport installation failed"));
@@ -449,8 +460,10 @@ AdapterDispatchPnp(
                resourceList->List[0].Count    = 0;
 
                // copy the resources which have already been assigned
-               for (int i=0;i<list->List[0].Count;i++) {
-                       if (CopyResourceDescriptor(&list->List[0].Descriptors[i], &resourceList->List[0].Descriptors[resourceList->List[0].Count])) {
+               for ( UINT i=0; i < list->List[0].Count; i++ ) {
+                       if (CopyResourceDescriptor( &list->List[0].Descriptors[i],
+                               &resourceList->List[0].Descriptors[resourceList->List[0].Count] ))
+                       {
                                resourceList->List[0].Count++;
                        }
                }
index 260f51d..dc2b62a 100644 (file)
@@ -27,7 +27,9 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include "common.hpp"
 
-#pragma code_seg("PAGE")
+#ifdef _MSC_VER
+#pragma code_seg("PAGE") /* warning - ignored by GCC compiler */
+#endif
 
 NTSTATUS
 NewCMIAdapter(
@@ -63,7 +65,7 @@ STDMETHODIMP_(NTSTATUS) CCMIAdapter::init(PRESOURCELIST ResourceList, PDEVICE_OB
        DeviceObject = aDeviceObject;
 
        cm.IOBase = 0;
-       for (int i=0;i<ResourceList->NumberOfPorts();i++) {
+       for ( UINT i=0; i < ResourceList->NumberOfPorts(); i++ ) {
                if (ResourceList->FindTranslatedPort(i)->u.Port.Length == 0x100) {
                        cm.IOBase = (UInt32*)ResourceList->FindTranslatedPort(i)->u.Port.Start.QuadPart;
                }
@@ -357,7 +359,7 @@ STDMETHODIMP_(NTSTATUS) CCMIAdapter::loadSBMixerFromMemory()
        //PAGED_CODE();
        DBGPRINT(("CCMIAdapter[%p]::loadSBMixerFromMemory()", this));
 #endif
-       for (int i = 0; i<(sizeof(sbIndex)/sizeof(sbIndex[0]));i++) {
+       for ( UINT i = 0; i < (sizeof(sbIndex)/sizeof(sbIndex[0])); i++ ) {
                writeUInt8(REG_SBINDEX, sbIndex[i]);
                writeUInt8(REG_SBDATA, mixerCache[i]);
        }
@@ -368,7 +370,9 @@ STDMETHODIMP_(NTSTATUS) CCMIAdapter::loadSBMixerFromMemory()
 /*
 ** non-paged code below
 */
-#pragma code_seg()
+#ifdef _MSC_VER
+#pragma code_seg() /* warning - ignored by GCC compiler */
+#endif
 
 STDMETHODIMP_(UInt8) CCMIAdapter::readUInt8(UInt8 reg)
 {
index 23584dd..283dc2b 100644 (file)
@@ -31,7 +31,9 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #define NTSTRSAFE_LIB //for Windows 2000 compatibility
 #include "ntstrsafe.h"
 
-#pragma code_seg("PAGE")
+#ifdef _MSC_VER
+#pragma code_seg("PAGE") /* warning - ignored by GCC compiler */
+#endif
 
 const GUID KSPROPSETID_CMI = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFF}};
 
@@ -173,7 +175,7 @@ STDMETHODIMP CCMITopology::loadMixerSettingsFromRegistry()
        PropertyRequest.ValueSize    = sizeof(DWORD);
        PropertyRequest.PropertyItem = &PropertyItem;
 
-       for (int i=0;i < SIZEOF_ARRAY(TopologyNodes); i++) {
+       for ( UINT i=0; i < SIZEOF_ARRAY(TopologyNodes); i++ ) {
                PropertyRequest.Node = i;
 
                Channel = CHAN_LEFT;
@@ -310,7 +312,7 @@ STDMETHODIMP CCMITopology::storeMixerSettingsToRegistry()
        PropertyRequest.ValueSize    = sizeof(DWORD);
        PropertyRequest.PropertyItem = &PropertyItem;
 
-       for (int i=0;i < SIZEOF_ARRAY(TopologyNodes); i++) {
+       for ( UINT i=0; i < SIZEOF_ARRAY(TopologyNodes); i++ ) {
                PropertyRequest.Node = i;
                if (IsEqualGUIDAligned(*(TopologyNodes[i].Type), KSNODETYPE_VOLUME)) {
                        PropertyRequest.Node = i;
@@ -473,7 +475,8 @@ NTSTATUS NTAPI PropertyHandler_OnOff(PPCPROPERTY_REQUEST PropertyRequest)
        CCMITopology *that = (CCMITopology *) ((PMINIPORTTOPOLOGY) PropertyRequest->MajorTarget);
 
        NTSTATUS  ntStatus = STATUS_INVALID_PARAMETER;
-       UInt8     data, mask, reg;
+       //UInt8     data, mask, reg;
+       UInt8     mask, reg;
        LONG      channel;
 
        if (PropertyRequest->Node == ULONG(-1)) {
@@ -1042,7 +1045,7 @@ static NTSTATUS BasicSupportHandler(PPCPROPERTY_REQUEST PropertyRequest)
 
                        PKSPROPERTY_STEPPING_LONG Range = PKSPROPERTY_STEPPING_LONG(Members + 1);
 
-                       for (int i=0;i<SIZEOF_ARRAY(VolTable);i++) {
+                       for ( UINT i=0; i < SIZEOF_ARRAY(VolTable); i++ ) {
                                if (VolTable[i].node == PropertyRequest->Node) {
                                        Range->Bounds.SignedMaximum = (VolTable[i].max << 16);
                                        Range->Bounds.SignedMinimum = (VolTable[i].min << 16);
@@ -1110,7 +1113,7 @@ NTSTATUS NTAPI PropertyHandler_Level(PPCPROPERTY_REQUEST PropertyRequest)
 
                        PLONG Level = (PLONG)PropertyRequest->Value;
 
-                       for (int i=0;i<SIZEOF_ARRAY(VolTable);i++)
+                       for ( UINT i=0; i <SIZEOF_ARRAY(VolTable); i++ )
                        {
                                if (VolTable[i].node == PropertyRequest->Node) {
                                        if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
index dce93b1..182b4e6 100644 (file)
@@ -35,7 +35,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #define STATIC_KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF\
     DEFINE_WAVEFORMATEX_GUID(WAVE_FORMAT_DOLBY_AC3_SPDIF)
 DEFINE_GUIDSTRUCT("00000092-0000-0010-8000-00aa00389b71", KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF);
-#define KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF DEFINE_GUIDNAMED(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF)
+#define KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF  DEFINE_GUIDNAMED( KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF )
+/* Warning - Recursive #define for KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF */
 #endif
 #endif
 
@@ -47,15 +48,17 @@ NTSTATUS NTAPI PropertyHandler_Private(PPCPROPERTY_REQUEST PropertyRequest);
 
 static KSDATARANGE PinDataRangesBridge[] =
 {
-   {
-      sizeof(KSDATARANGE),
-      0,
-      0,
-      0,
-      STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO),
-      STATICGUIDOF(KSDATAFORMAT_SUBTYPE_ANALOG),
-      STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE)
-   }
+    {
+        {
+            sizeof(KSDATARANGE),
+            0,
+            0,
+            0,
+            { STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO) },
+            { STATICGUIDOF(KSDATAFORMAT_SUBTYPE_ANALOG) },
+            { STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) }
+        }
+    }
 };
 
 static PKSDATARANGE PinDataRangePointersBridge[] =
@@ -65,14 +68,16 @@ static PKSDATARANGE PinDataRangePointersBridge[] =
 
 static KSDATARANGE WavePinDataRangesAC3Bridge[] =
 {
-       {
-        sizeof(KSDATARANGE),
-        0,
-        0,
-        0,
-        STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO),
-        STATICGUIDOF(KSDATAFORMAT_SUBTYPE_AC3_AUDIO),
-        STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE)
+    {
+        {
+            sizeof(KSDATARANGE),
+            0,
+            0,
+            0,
+            { STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO) },
+            { STATICGUIDOF(KSDATAFORMAT_SUBTYPE_AC3_AUDIO) },
+            { STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) }
+        }
     }
 };
 
@@ -98,7 +103,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
             KSPIN_COMMUNICATION_NONE,                   // Communication
             &KSCATEGORY_AUDIO,                          // Category
             NULL,                                       // Name
-            0                                           // Reserved
+            { 0 }                                       // Reserved
         }
     },
 
@@ -117,7 +122,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
             KSPIN_COMMUNICATION_NONE,                   // Communication
             &KSNODETYPE_SPDIF_INTERFACE,                // Category
             NULL,                                       // Name
-            0                                           // Reserved
+            { 0 }                                       // Reserved
         }
     },
 
@@ -136,7 +141,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
                        KSPIN_COMMUNICATION_NONE,                                       // Communication
                        &KSNODETYPE_MICROPHONE,                                         // Category
                        NULL,                                                                           // Name
-                       0                                                                                       // Reserved
+            { 0 }                                       // Reserved
                }
        },
 
@@ -155,7 +160,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
                        KSPIN_COMMUNICATION_NONE,                                       // Communication
                        &KSNODETYPE_CD_PLAYER,                                          // Category
                        NULL,                                                                           // Name
-                       0                                                                                       // Reserved
+            { 0 }                                       // Reserved
                }
        },
 
@@ -174,7 +179,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
                        KSPIN_COMMUNICATION_NONE,                                       // Communication
                        &KSNODETYPE_LINE_CONNECTOR,                                     // Category
                        NULL,                                                                           // Name
-                       0                                                                                       // Reserved
+            { 0 }                                       // Reserved
                }
        },
 
@@ -193,7 +198,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
                        KSPIN_COMMUNICATION_NONE,                                       // Communication
                        &KSNODETYPE_ANALOG_CONNECTOR,                           // Category
                        NULL,                                                                           // Name
-                       0                                                                                       // Reserved
+            { 0 }                                       // Reserved
                }
        },
 
@@ -212,7 +217,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
                        KSPIN_COMMUNICATION_NONE,                                       // Communication
                        &KSNODETYPE_ANALOG_CONNECTOR,                           // Category
                        &CMINAME_DAC,                                                           // Name
-                       0                                                                                       // Reserved
+            { 0 }                                       // Reserved
                }
        },
 
@@ -231,7 +236,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
             KSPIN_COMMUNICATION_NONE,                   // Communication
             &KSNODETYPE_SPEAKER,                        // Category
             NULL,                                       // Name
-            0                                           // Reserved
+            { 0 }                                       // Reserved
         }
     },
 
@@ -250,7 +255,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
             KSPIN_COMMUNICATION_NONE,                   // Communication
             &KSCATEGORY_AUDIO,                          // Category
             NULL,                                       // Name
-            0                                           // Reserved
+            { 0 }                                       // Reserved
         }
     },
 
@@ -269,7 +274,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
             KSPIN_COMMUNICATION_NONE,                   // Communication
             &KSCATEGORY_AUDIO,                          // Category
             NULL,                                       // Name
-            0                                           // Reserved
+            { 0 }                                       // Reserved
         }
     },
 
@@ -288,7 +293,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
             KSPIN_COMMUNICATION_NONE,                   // Communication
             NULL,                                       // Category
             NULL,                                       // Name
-            0                                           // Reserved
+            { 0 }                                       // Reserved
         }
     }
 };
index 4a04771..5152d86 100644 (file)
@@ -29,7 +29,9 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "minwavetables.hpp"
 #include "ntddk.h"
 
-#pragma code_seg("PAGE")
+#ifdef _MSC_VER
+#pragma code_seg("PAGE") /* warning - ignored by GCC compiler */
+#endif
 
 HRESULT NTAPI CreateMiniportWaveCMI(PUNKNOWN *Unknown, REFCLSID, PUNKNOWN UnknownOuter, POOL_TYPE PoolType)
 {
@@ -233,7 +235,8 @@ NTSTATUS CMiniportWaveCMI::loadChannelConfigFromRegistry()
        PREGISTRYKEY       DriverKey;
        PREGISTRYKEY       SettingsKey;
     UNICODE_STRING     KeyName;
-    DWORD              Value, ResultLength;
+    //DWORD              Value, ResultLength;
+    DWORD              ResultLength;
        PVOID              KeyInfo;
 
     DBGPRINT(("CMiniportWaveCMI::loadChannelConfigFromRegistry()"));
@@ -418,12 +421,12 @@ NTSTATUS CMiniportWaveCMI::validateFormat(PKSDATAFORMAT format, ULONG PinID, BOO
        DBGPRINT(("---channels: %d, resolution: %d, sample rate: %d, pin: %d, formatMask: %x", waveFormat->nChannels, waveFormat->wBitsPerSample, waveFormat->nSamplesPerSec, PinID, cm->formatMask));
 
 //WaveFormatEx
-       if  ( ( format->FormatSize >= sizeof(KSDATAFORMAT_WAVEFORMATEX))
+       if  ( ( (size_t) format->FormatSize >= sizeof(KSDATAFORMAT_WAVEFORMATEX))
          && IsEqualGUIDAligned(format->MajorFormat,KSDATAFORMAT_TYPE_AUDIO)
          && IsEqualGUIDAligned(format->Specifier,KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) ) {
                switch (EXTRACT_WAVEFORMATEX_ID(&format->SubFormat)) {
                        case WAVE_FORMAT_PCM:
-                               if ((PinID != PIN_WAVE_RENDER_SINK) && (PinID != PIN_WAVE_CAPTURE_SOURCE) && (PinID != -1)) {
+                               if ((PinID != PIN_WAVE_RENDER_SINK) && (PinID != PIN_WAVE_CAPTURE_SOURCE) && ((int)PinID != -1)) {
                                        if ((PinID == PIN_WAVE_AC3_RENDER_SINK) && !IoIsWdmVersionAvailable(6,0)) {
                                                return STATUS_INVALID_PARAMETER;
                                        }
@@ -438,10 +441,10 @@ NTSTATUS CMiniportWaveCMI::validateFormat(PKSDATAFORMAT format, ULONG PinID, BOO
                                        return isFormatAllowed(waveFormat->nSamplesPerSec, FALSE, FALSE);
                                }
                                if ( (waveFormat->wBitsPerSample == 16)
-                                 && ((waveFormat->nChannels >= 4) && (waveFormat->nChannels <= cm->maxChannels))
+                                 && ((waveFormat->nChannels >= 4) && (waveFormat->nChannels <= (WORD) cm->maxChannels))
                                  && ((waveFormat->nSamplesPerSec == 44100) || (waveFormat->nSamplesPerSec == 48000)) ) {
 #if OUT_CHANNEL == 1
-                                       if ((PinID == PIN_WAVE_RENDER_SINK) || (PinID == -1)) {
+                                       if ((PinID == PIN_WAVE_RENDER_SINK) || ((int)PinID == -1)) {
                                                return isFormatAllowed(waveFormat->nSamplesPerSec, TRUE, FALSE);
                                        }
 #else
@@ -450,7 +453,7 @@ NTSTATUS CMiniportWaveCMI::validateFormat(PKSDATAFORMAT format, ULONG PinID, BOO
                                }
                                break;
                        case WAVE_FORMAT_DOLBY_AC3_SPDIF:
-                               if ((PinID != PIN_WAVE_AC3_RENDER_SINK) && (PinID != -1)) {
+                               if ((PinID != PIN_WAVE_AC3_RENDER_SINK) && ((int)PinID != -1)) {
                                        return STATUS_INVALID_PARAMETER;
                                }
                                if ( ((waveFormat->wBitsPerSample >= MIN_BITS_PER_SAMPLE_AC3) && (waveFormat->wBitsPerSample <= MAX_BITS_PER_SAMPLE_AC3))
@@ -907,7 +910,7 @@ NTSTATUS CMiniportWaveStreamCMI::prepareStream()
        DBGPRINT(("---streamIndex: %d, channelNumber: %d", streamIndex, channelNumber));
 
        NTSTATUS ntStatus;
-       UInt8    reg;
+       //UInt8    reg;
        UInt32   val;
 
        if (state == KSSTATE_RUN) {
@@ -990,7 +993,7 @@ NTSTATUS CMiniportWaveStreamCMI::setDACChannels()
        NTSTATUS ntStatus = STATUS_SUCCESS;
 
        if (currentChannelCount > 2) {
-               if (Miniport->cm->maxChannels < currentChannelCount) {
+               if ((WORD) Miniport->cm->maxChannels < currentChannelCount ) {
                        return STATUS_INVALID_DEVICE_REQUEST;
                }
                if ((currentResolution != 16) || (currentChannelCount < 2)) {
@@ -1052,7 +1055,7 @@ NTSTATUS CMiniportWaveStreamCMI::setupSPDIFPlayback(bool enableSPDIF)
        //PAGED_CODE();
        DBGPRINT(("CMiniportWaveStreamCMI[%p]::setupSPDIFPlayback(%d)", this, enableSPDIF));
 
-       NTSTATUS ntStatus;
+       //NTSTATUS ntStatus;
 
        KeWaitForSingleObject(&Miniport->mutex, Executive, KernelMode, false, NULL);
 
@@ -1434,7 +1437,9 @@ STDMETHODIMP_(NTSTATUS) CMiniportWaveStreamCMI::GetClockRegister(PKSRTAUDIO_HWRE
 /*
 ** non-paged code below
 */
-#pragma code_seg()
+#ifdef _MSC_VER
+#pragma code_seg() /* warning - ignored by GCC compiler */
+#endif
 
 STDMETHODIMP CMiniportWaveStreamCMI::SetState(KSSTATE NewState)
 {
@@ -1461,7 +1466,9 @@ STDMETHODIMP CMiniportWaveStreamCMI::SetState(KSSTATE NewState)
 
        // STOP -> ACQUIRE -> PAUSE -> PLAY -> PAUSE -> ACQUIRE -> STOP
        if (state != NewState) {
-               switch (NewState) {
+               switch ((UINT) NewState) {
+                       // LN: The cast on NewState is to satisfy the compiler about
+                       // KSSTATE_STOP_AC3, which is not in the original enum KSSTATE.
                        case KSSTATE_ACQUIRE:
                                DBGPRINT(("---KSSTATE_ACQUIRE: previous state: %d", state));
                                if (state == KSSTATE_PAUSE) {
index 0c0326c..8f44c5a 100644 (file)
@@ -31,23 +31,23 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #define STATIC_KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF\
     DEFINE_WAVEFORMATEX_GUID(WAVE_FORMAT_DOLBY_AC3_SPDIF)
 DEFINE_GUIDSTRUCT("00000092-0000-0010-8000-00aa00389b71", KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF);
-#define KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF DEFINE_GUIDNAMED(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF)
+#define KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF  DEFINE_GUIDNAMED(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF)
+/* Warning - Recursive #define for KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF */
 
 NTSTATUS NTAPI PropertyHandler_ChannelConfig(PPCPROPERTY_REQUEST PropertyRequest);
 
-
 static KSDATARANGE_AUDIO WavePinDataRangesPCMStream[] =
 {
     {
-        {
+        {{
             sizeof(KSDATARANGE_AUDIO),
             0,
             0,
             0,
-            STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO),
-            STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM),
-            STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX)
-        },
+            { STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO) },
+            { STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) },
+            { STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) }
+        }},
         MAX_CHANNELS_PCM,
         MIN_BITS_PER_SAMPLE_PCM,
         MAX_BITS_PER_SAMPLE_PCM,
@@ -59,15 +59,15 @@ static KSDATARANGE_AUDIO WavePinDataRangesPCMStream[] =
 static KSDATARANGE_AUDIO WavePinDataRangesAC3Stream[] =
 {
     {
-        {
+        {{
             sizeof(KSDATARANGE_AUDIO),
             0,
             0,
             0,
-            STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO),
-            STATICGUIDOF(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF),
-            STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX)
-        },
+            { STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO) },
+            { STATICGUIDOF(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF) },
+            { STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) }
+        }},
         MAX_CHANNELS_AC3,
         MIN_BITS_PER_SAMPLE_AC3,
         MAX_BITS_PER_SAMPLE_AC3,
@@ -75,15 +75,15 @@ static KSDATARANGE_AUDIO WavePinDataRangesAC3Stream[] =
         MAX_SAMPLE_RATE_AC3
     },
     {
-        {
+        {{
             sizeof(KSDATARANGE_AUDIO),
             0,
             0,
             0,
-            STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO),
-            STATICGUIDOF(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF),
-            STATICGUIDOF(KSDATAFORMAT_SPECIFIER_DSOUND)
-        },
+            { STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO) },
+            { STATICGUIDOF(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF) },
+            { STATICGUIDOF(KSDATAFORMAT_SPECIFIER_DSOUND) }
+        }},
         MAX_CHANNELS_AC3,
         MIN_BITS_PER_SAMPLE_AC3,
         MAX_BITS_PER_SAMPLE_AC3,
@@ -107,28 +107,28 @@ static PKSDATARANGE WavePinDataRangePointersAC3Stream[] =
 
 static KSDATARANGE WavePinDataRangesPCMBridge[] =
 {
-    {
+    {{
         sizeof(KSDATARANGE),
         0,
         0,
         0,
-        STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO),
-        STATICGUIDOF(KSDATAFORMAT_SUBTYPE_ANALOG),
-        STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE)
-    }
+        { STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO) },
+               { STATICGUIDOF(KSDATAFORMAT_SUBTYPE_ANALOG) },
+        { STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) }
+    }}
 };
 
 static KSDATARANGE WavePinDataRangesAC3Bridge[] =
 {
-       {
+       {{
         sizeof(KSDATARANGE),
         0,
         0,
         0,
-        STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO),
-        STATICGUIDOF(KSDATAFORMAT_SUBTYPE_AC3_AUDIO),
-        STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE)
-    }
+        { STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO) },
+        { STATICGUIDOF(KSDATAFORMAT_SUBTYPE_AC3_AUDIO) },
+        { STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) }
+    }}
 };
 
 static PKSDATARANGE WavePinDataRangePointersPCMBridge[] =
@@ -160,7 +160,7 @@ static PCPIN_DESCRIPTOR WaveMiniportPins[] =
             KSPIN_COMMUNICATION_SINK,
             &KSCATEGORY_AUDIO,
             &KSAUDFNAME_RECORDING_CONTROL,
-            0
+            { 0 }
         }
     },
 
@@ -181,7 +181,7 @@ static PCPIN_DESCRIPTOR WaveMiniportPins[] =
             KSPIN_COMMUNICATION_NONE,
             &KSCATEGORY_AUDIO,
             NULL,
-            0
+            { 0 }
         }
     },
 
@@ -202,7 +202,7 @@ static PCPIN_DESCRIPTOR WaveMiniportPins[] =
             KSPIN_COMMUNICATION_SINK,
             &KSCATEGORY_AUDIO,
             &KSAUDFNAME_VOLUME_CONTROL,
-            0
+            { 0 }
         }
     },
 
@@ -223,7 +223,7 @@ static PCPIN_DESCRIPTOR WaveMiniportPins[] =
             KSPIN_COMMUNICATION_NONE,
             &KSNODETYPE_SPEAKER,
             NULL,
-            0
+            { 0 }
         }
     },
 
@@ -244,7 +244,7 @@ static PCPIN_DESCRIPTOR WaveMiniportPins[] =
             KSPIN_COMMUNICATION_SINK,
             &KSCATEGORY_AUDIO,
             NULL,
-            0
+            { 0 }
         }
     },
 
@@ -266,7 +266,7 @@ static PCPIN_DESCRIPTOR WaveMiniportPins[] =
             KSPIN_COMMUNICATION_NONE,
             &KSNODETYPE_SPDIF_INTERFACE,
             NULL,
-            0
+            { 0 }
         }
     }
 };