Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix clang errors #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions portmidi/pm_mac/pmmacosxcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@
#define MIDI_SYSEX 0xf0
#define MIDI_EOX 0xf7
#define MIDI_STATUS_MASK 0x80
#define MIDI_NULL 0
#define INT2VOIDP(i) (void *)(uintptr_t)(i)

static MIDIClientRef client = NULL; /* Client handle to the MIDI server */
static MIDIPortRef portIn = NULL; /* Input port handle */
static MIDIPortRef portOut = NULL; /* Output port handle */
static MIDIClientRef client = MIDI_NULL; /* Client handle to the MIDI server */
static MIDIPortRef portIn = MIDI_NULL; /* Input port handle */
static MIDIPortRef portOut = MIDI_NULL; /* Output port handle */

extern pm_fns_node pm_macosx_in_dictionary;
extern pm_fns_node pm_macosx_out_dictionary;
Expand Down Expand Up @@ -648,9 +650,9 @@ CFStringRef EndpointName(MIDIEndpointRef endpoint, bool isExternal)
CFRelease(str);
}

MIDIEntityRef entity = NULL;
MIDIEntityRef entity = MIDI_NULL;
MIDIEndpointGetEntity(endpoint, &entity);
if (entity == NULL)
if (entity == MIDI_NULL)
// probably virtual
return result;

Expand All @@ -664,9 +666,9 @@ CFStringRef EndpointName(MIDIEndpointRef endpoint, bool isExternal)
}
}
// now consider the device's name
MIDIDeviceRef device = NULL;
MIDIDeviceRef device = MIDI_NULL;
MIDIEntityGetDevice(entity, &device);
if (device == NULL)
if (device == MIDI_NULL)
return result;

str = NULL;
Expand Down Expand Up @@ -890,7 +892,7 @@ PmError pm_macosxcm_init(void)
/* Iterate over the MIDI input devices */
for (i = 0; i < numInputs; i++) {
endpoint = MIDIGetSource(i);
if (endpoint == NULL) {
if (endpoint == MIDI_NULL) {
continue;
}

Expand All @@ -900,13 +902,13 @@ PmError pm_macosxcm_init(void)

/* Register this device with PortMidi */
pm_add_device("CoreMIDI", cm_get_full_endpoint_name(endpoint),
TRUE, (void*)endpoint, &pm_macosx_in_dictionary);
TRUE, INT2VOIDP(endpoint), &pm_macosx_in_dictionary);
}

/* Iterate over the MIDI output devices */
for (i = 0; i < numOutputs; i++) {
endpoint = MIDIGetDestination(i);
if (endpoint == NULL) {
if (endpoint == MIDI_NULL) {
continue;
}

Expand All @@ -916,7 +918,7 @@ PmError pm_macosxcm_init(void)

/* Register this device with PortMidi */
pm_add_device("CoreMIDI", cm_get_full_endpoint_name(endpoint),
FALSE, (void*)endpoint, &pm_macosx_out_dictionary);
FALSE, INT2VOIDP(endpoint), &pm_macosx_out_dictionary);
}
return pmNoError;

Expand All @@ -929,7 +931,7 @@ PmError pm_macosxcm_init(void)

void pm_macosxcm_term(void)
{
if (client != NULL) MIDIClientDispose(client);
if (portIn != NULL) MIDIPortDispose(portIn);
if (portOut != NULL) MIDIPortDispose(portOut);
if (client != MIDI_NULL) MIDIClientDispose(client);
if (portIn != MIDI_NULL) MIDIPortDispose(portIn);
if (portOut != MIDI_NULL) MIDIPortDispose(portOut);
}