--- a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp Mon Apr 23 12:01:46 2018 -0400
+++ b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp Mon Apr 23 16:15:26 2018 -0700
@@ -252,7 +252,7 @@
}
INT32 getMidiInCaps(INT32 deviceID, MIDIINCAPSW* caps, INT32* err) {
- (*err) = midiInGetDevCapsW(deviceID, caps, sizeof(MIDIINCAPS));
+ (*err) = midiInGetDevCapsW(deviceID, caps, sizeof(MIDIINCAPSW));
return ((*err) == MMSYSERR_NOERROR);
}
@@ -260,6 +260,7 @@
MIDIINCAPSW midiInCaps;
INT32 err;
+ memset(&midiInCaps, 0, sizeof(midiInCaps));
if (getMidiInCaps(deviceID, &midiInCaps, &err)) {
UnicodeToUTF8AndCopy(name, midiInCaps.szPname, nameLength);
return MIDI_SUCCESS;
@@ -284,6 +285,7 @@
MIDIINCAPSW midiInCaps;
INT32 err = MIDI_NOT_SUPPORTED;
+ memset(&midiInCaps, 0, sizeof(midiInCaps));
if (getMidiInCaps(deviceID, &midiInCaps, &err) && (nameLength>7)) {
sprintf(name, "%d.%d", (midiInCaps.vDriverVersion & 0xFF00) >> 8, midiInCaps.vDriverVersion & 0xFF);
return MIDI_SUCCESS;
--- a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiOut.c Mon Apr 23 12:01:46 2018 -0400
+++ b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiOut.c Mon Apr 23 16:15:26 2018 -0700
@@ -70,12 +70,13 @@
INT32 getMidiOutCaps(INT32 deviceID, MIDIOUTCAPSW* caps, INT32* err) {
+ UINT_PTR id;
if (deviceID == 0) {
- deviceID = MIDI_MAPPER;
+ id = MIDI_MAPPER;
} else {
- deviceID--;
+ id = (UINT_PTR)(deviceID-1);
}
- (*err) = (INT32) midiOutGetDevCapsW(deviceID, caps, sizeof(MIDIOUTCAPS));
+ (*err) = (INT32) midiOutGetDevCapsW(id, caps, sizeof(MIDIOUTCAPSW));
return ((*err) == MMSYSERR_NOERROR);
}
@@ -84,6 +85,7 @@
MIDIOUTCAPSW midiOutCaps;
INT32 err;
+ memset(&midiOutCaps, 0, sizeof(midiOutCaps));
if (getMidiOutCaps(deviceID, &midiOutCaps, &err)) {
UnicodeToUTF8AndCopy(name, midiOutCaps.szPname, nameLength);
return MIDI_SUCCESS;
@@ -103,6 +105,7 @@
char *desc;
INT32 err;
+ memset(&midiOutCaps, 0, sizeof(midiOutCaps));
if (getMidiOutCaps(deviceID, &midiOutCaps, &err)) {
int tech = (int)midiOutCaps.wTechnology;
switch(tech) {
@@ -139,6 +142,7 @@
MIDIOUTCAPSW midiOutCaps;
INT32 err;
+ memset(&midiOutCaps, 0, sizeof(midiOutCaps));
if (getMidiOutCaps(deviceID, &midiOutCaps, &err) && nameLength>7) {
sprintf(name, "%d.%d", (midiOutCaps.vDriverVersion & 0xFF00) >> 8, midiOutCaps.vDriverVersion & 0xFF);
return MIDI_SUCCESS;
--- a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Ports.c Mon Apr 23 12:01:46 2018 -0400
+++ b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Ports.c Mon Apr 23 16:15:26 2018 -0700
@@ -357,7 +357,7 @@
INT32 PORT_GetPortMixerDescription(INT32 mixerIndex, PortMixerDescription* description) {
MIXERCAPSW mixerCaps;
- if (mixerGetDevCapsW(mixerIndex, &mixerCaps, sizeof(MIXERCAPS)) == MMSYSERR_NOERROR) {
+ if (mixerGetDevCapsW(mixerIndex, &mixerCaps, sizeof(MIXERCAPSW)) == MMSYSERR_NOERROR) {
UnicodeToUTF8AndCopy(description->name, mixerCaps.szPname, PORT_STRING_LENGTH);
sprintf(description->version, "%d.%d", (mixerCaps.vDriverVersion & 0xFF00) >> 8, mixerCaps.vDriverVersion & 0xFF);
strncpy(description->description, "Port Mixer", PORT_STRING_LENGTH-1);
@@ -368,9 +368,9 @@
int getDestinationCount(HMIXER handle) {
int ret = 0;
- MIXERCAPS mixerCaps;
+ MIXERCAPSW mixerCaps;
- if (mixerGetDevCaps((UINT_PTR) handle, &mixerCaps, sizeof(MIXERCAPS)) == MMSYSERR_NOERROR) {
+ if (mixerGetDevCapsW((UINT_PTR) handle, &mixerCaps, sizeof(MIXERCAPSW)) == MMSYSERR_NOERROR) {
ret = mixerCaps.cDestinations;
}
return ret;