mirror of
https://github.com/holub/mame
synced 2025-07-03 17:08:39 +03:00
3rdparty/portmidi: Try to get PortMidi into a state where it will build with sane compiler settings.
This commit is contained in:
parent
844af3a173
commit
cfec4a0ec0
2
3rdparty/portmidi/pm_common/pminternal.h
vendored
2
3rdparty/portmidi/pm_common/pminternal.h
vendored
@ -162,7 +162,7 @@ PmError pm_fail_timestamp_fn(PmInternal *midi, PmTimestamp timestamp);
|
||||
PmError pm_success_fn(PmInternal *midi);
|
||||
PmError pm_add_interf(char *interf, pm_create_fn create_fn,
|
||||
pm_delete_fn delete_fn);
|
||||
PmError pm_add_device(char *interf, const char *name, int is_input,
|
||||
PmError pm_add_device(const char *interf, const char *name, int is_input,
|
||||
int is_virtual, void *descriptor, pm_fns_type dictionary);
|
||||
void pm_undo_add_device(int id);
|
||||
uint32_t pm_read_bytes(PmInternal *midi, const unsigned char *data, int len,
|
||||
|
6
3rdparty/portmidi/pm_common/portmidi.c
vendored
6
3rdparty/portmidi/pm_common/portmidi.c
vendored
@ -179,7 +179,7 @@ PmError pm_create_virtual(PmInternal *midi, int is_input, const char *interf,
|
||||
* device would take the name of an existing device.
|
||||
* otherwise returns index (portmidi device_id) of the added device
|
||||
*/
|
||||
PmError pm_add_device(char *interf, const char *name, int is_input,
|
||||
PmError pm_add_device(const char *interf, const char *name, int is_input,
|
||||
int is_virtual, void *descriptor, pm_fns_type dictionary) {
|
||||
/* printf("pm_add_device: %s %s %d %p %p\n",
|
||||
interf, name, is_input, descriptor, dictionary); */
|
||||
@ -293,7 +293,7 @@ int pm_find_default_device(char *pattern, int is_input)
|
||||
int id = pmNoDevice;
|
||||
int i;
|
||||
/* first parse pattern into name, interf parts */
|
||||
char *interf_pref = ""; /* initially assume it is not there */
|
||||
char const *interf_pref = ""; /* initially assume it is not there */
|
||||
char *name_pref = strstr(pattern, ", ");
|
||||
|
||||
if (name_pref) { /* found separator, adjust the pointer */
|
||||
@ -909,7 +909,7 @@ PMEXPORT PmError Pm_OpenInput(PortMidiStream** stream,
|
||||
PmTimeProcPtr time_proc,
|
||||
void *time_info)
|
||||
{
|
||||
PmInternal *midi;
|
||||
PmInternal *midi = NULL;
|
||||
PmError err = pmNoError;
|
||||
pm_hosterror = FALSE;
|
||||
*stream = NULL; /* invariant: *stream == midi */
|
||||
|
13
3rdparty/portmidi/pm_linux/finddefault.c
vendored
13
3rdparty/portmidi/pm_linux/finddefault.c
vendored
@ -22,7 +22,7 @@ void skip_spaces(FILE *inf)
|
||||
}
|
||||
|
||||
/* trim leading spaces and match a string */
|
||||
int match_string(FILE *inf, char *s)
|
||||
int match_string(FILE *inf, const char *s)
|
||||
{
|
||||
skip_spaces(inf);
|
||||
while (*s && *s == getc(inf)) s++;
|
||||
@ -33,17 +33,18 @@ int match_string(FILE *inf, char *s)
|
||||
/*
|
||||
/* Parse preference files, find default device, search devices --
|
||||
*/
|
||||
PmDeviceID find_default_device(char *path, int input, PmDeviceID id)
|
||||
PmDeviceID find_default_device(const char *path, int input, PmDeviceID id)
|
||||
/* path -- the name of the preference we are searching for
|
||||
input -- true iff this is an input device
|
||||
id -- current default device id
|
||||
returns matching device id if found, otherwise id
|
||||
*/
|
||||
{
|
||||
static char *pref_2 = "/.java/.userPrefs/";
|
||||
static char *pref_3 = "prefs.xml";
|
||||
char *pref_1 = getenv("HOME");
|
||||
char *full_name, *path_ptr;
|
||||
static char const *const pref_2 = "/.java/.userPrefs/";
|
||||
static char const *const pref_3 = "prefs.xml";
|
||||
const char *pref_1 = getenv("HOME");
|
||||
const char *path_ptr;
|
||||
char *full_name;
|
||||
FILE *inf;
|
||||
int c, i;
|
||||
if (!pref_1) goto nopref; // cannot find preference file
|
||||
|
2
3rdparty/portmidi/pm_linux/finddefault.h
vendored
2
3rdparty/portmidi/pm_linux/finddefault.h
vendored
@ -2,4 +2,4 @@
|
||||
Roger Dannenberg, Jan 2021
|
||||
*/
|
||||
|
||||
PmDeviceID find_default_device(char *path, int input, PmDeviceID id);
|
||||
PmDeviceID find_default_device(const char *path, int input, PmDeviceID id);
|
||||
|
6
3rdparty/portmidi/pm_linux/pmlinux.c
vendored
6
3rdparty/portmidi/pm_linux/pmlinux.c
vendored
@ -31,7 +31,7 @@
|
||||
PmDeviceID pm_default_input_device_id = -1;
|
||||
PmDeviceID pm_default_output_device_id = -1;
|
||||
|
||||
void pm_init()
|
||||
void pm_init(void)
|
||||
{
|
||||
/* Note: it is not an error for PMALSA to fail to initialize.
|
||||
* It may be a design error that the client cannot query what subsystems
|
||||
@ -65,12 +65,12 @@ void pm_term(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
PmDeviceID Pm_GetDefaultInputDeviceID() {
|
||||
PmDeviceID Pm_GetDefaultInputDeviceID(void) {
|
||||
Pm_Initialize();
|
||||
return pm_default_input_device_id;
|
||||
}
|
||||
|
||||
PmDeviceID Pm_GetDefaultOutputDeviceID() {
|
||||
PmDeviceID Pm_GetDefaultOutputDeviceID(void) {
|
||||
Pm_Initialize();
|
||||
return pm_default_output_device_id;
|
||||
}
|
||||
|
2
3rdparty/portmidi/pm_mac/finddefault.c
vendored
2
3rdparty/portmidi/pm_mac/finddefault.c
vendored
@ -24,7 +24,7 @@ PmDeviceID find_default_device(char *path, int input, PmDeviceID id)
|
||||
returns matching device id if found, otherwise id
|
||||
*/
|
||||
{
|
||||
static char *pref_file = "com.apple.java.util.prefs.plist";
|
||||
static char const *const pref_file = "com.apple.java.util.prefs.plist";
|
||||
char *pref_str = NULL;
|
||||
// read device preferences
|
||||
value_ptr prefs = bplist_read_user_pref(pref_file);
|
||||
|
6
3rdparty/portmidi/pm_mac/pmmac.c
vendored
6
3rdparty/portmidi/pm_mac/pmmac.c
vendored
@ -18,7 +18,7 @@ non-CoreMIDI devices.
|
||||
PmDeviceID pm_default_input_device_id = -1;
|
||||
PmDeviceID pm_default_output_device_id = -1;
|
||||
|
||||
void pm_init()
|
||||
void pm_init(void)
|
||||
{
|
||||
PmError err = pm_macosxcm_init();
|
||||
// this is set when we return to Pm_Initialize, but we need it
|
||||
@ -41,13 +41,13 @@ void pm_term(void)
|
||||
}
|
||||
|
||||
|
||||
PmDeviceID Pm_GetDefaultInputDeviceID()
|
||||
PmDeviceID Pm_GetDefaultInputDeviceID(void)
|
||||
{
|
||||
Pm_Initialize();
|
||||
return pm_default_input_device_id;
|
||||
}
|
||||
|
||||
PmDeviceID Pm_GetDefaultOutputDeviceID()
|
||||
PmDeviceID Pm_GetDefaultOutputDeviceID(void)
|
||||
{
|
||||
Pm_Initialize();
|
||||
return pm_default_output_device_id;
|
||||
|
12
3rdparty/portmidi/pm_mac/readbinaryplist.c
vendored
12
3rdparty/portmidi/pm_mac/readbinaryplist.c
vendored
@ -155,7 +155,7 @@ static void *allocate(size_t size)
|
||||
return result;
|
||||
}
|
||||
|
||||
void bplist_free_data()
|
||||
void bplist_free_data(void)
|
||||
{
|
||||
while (block_list) {
|
||||
void *next = *(void **)block_list;
|
||||
@ -206,7 +206,7 @@ typedef struct bplist_info
|
||||
|
||||
|
||||
static value_ptr bplist_read_pldata(pldata_ptr data);
|
||||
static value_ptr bplist_read_pref(char *filename, OSType folder_type);
|
||||
static value_ptr bplist_read_pref(const char *filename, OSType folder_type);
|
||||
static uint64_t read_sized_int(bplist_info_ptr bplist, uint64_t offset,
|
||||
uint8_t size);
|
||||
static uint64_t read_offset(bplist_info_ptr bplist, uint64_t index);
|
||||
@ -344,7 +344,7 @@ BOOL is_binary_plist(pldata_ptr data)
|
||||
}
|
||||
|
||||
|
||||
value_ptr bplist_read_file(char *filename)
|
||||
value_ptr bplist_read_file(const char *filename)
|
||||
{
|
||||
struct stat stbuf;
|
||||
pldata_node pldata;
|
||||
@ -391,7 +391,7 @@ value_ptr bplist_read_file(char *filename)
|
||||
}
|
||||
|
||||
|
||||
value_ptr bplist_read_pref(char *filename, OSType folder_type)
|
||||
value_ptr bplist_read_pref(const char *filename, OSType folder_type)
|
||||
{
|
||||
FSRef prefdir;
|
||||
char cstr[MAX_PATH_LEN];
|
||||
@ -413,12 +413,12 @@ value_ptr bplist_read_pref(char *filename, OSType folder_type)
|
||||
}
|
||||
|
||||
|
||||
value_ptr bplist_read_system_pref(char *filename) {
|
||||
value_ptr bplist_read_system_pref(const char *filename) {
|
||||
return bplist_read_pref(filename, kSystemPreferencesFolderType);
|
||||
}
|
||||
|
||||
|
||||
value_ptr bplist_read_user_pref(char *filename) {
|
||||
value_ptr bplist_read_user_pref(const char *filename) {
|
||||
return bplist_read_pref(filename, kPreferencesFolderType);
|
||||
}
|
||||
|
||||
|
8
3rdparty/portmidi/pm_mac/readbinaryplist.h
vendored
8
3rdparty/portmidi/pm_mac/readbinaryplist.h
vendored
@ -71,10 +71,10 @@ typedef struct value_struct {
|
||||
} value_node, *value_ptr;
|
||||
|
||||
|
||||
value_ptr bplist_read_file(char *filename);
|
||||
value_ptr bplist_read_user_pref(char *filename);
|
||||
value_ptr bplist_read_system_pref(char *filename);
|
||||
void bplist_free_data();
|
||||
value_ptr bplist_read_file(const char *filename);
|
||||
value_ptr bplist_read_user_pref(const char *filename);
|
||||
value_ptr bplist_read_system_pref(const char *filename);
|
||||
void bplist_free_data(void);
|
||||
|
||||
/*************** functions for accessing values ****************/
|
||||
|
||||
|
2
3rdparty/portmidi/pm_win/pmwin.c
vendored
2
3rdparty/portmidi/pm_win/pmwin.c
vendored
@ -56,7 +56,7 @@ void pm_term(void) {
|
||||
}
|
||||
|
||||
|
||||
static PmDeviceID pm_get_default_device_id(int is_input, char *key) {
|
||||
static PmDeviceID pm_get_default_device_id(int is_input, const char *key) {
|
||||
HKEY hkey;
|
||||
#define PATTERN_MAX 256
|
||||
char pattern[PATTERN_MAX];
|
||||
|
16
3rdparty/portmidi/pm_win/pmwinmm.c
vendored
16
3rdparty/portmidi/pm_win/pmwinmm.c
vendored
@ -139,7 +139,7 @@ typedef struct winmm_info_struct {
|
||||
general MIDI device queries
|
||||
=============================================================================
|
||||
*/
|
||||
static void pm_winmm_general_inputs()
|
||||
static void pm_winmm_general_inputs(void)
|
||||
{
|
||||
UINT i;
|
||||
WORD wRtn;
|
||||
@ -168,7 +168,7 @@ static void pm_winmm_general_inputs()
|
||||
}
|
||||
|
||||
|
||||
static void pm_winmm_mapper_input()
|
||||
static void pm_winmm_mapper_input(void)
|
||||
{
|
||||
WORD wRtn;
|
||||
/* Note: if MIDIMAPPER opened as input (documentation implies you
|
||||
@ -186,7 +186,7 @@ static void pm_winmm_mapper_input()
|
||||
}
|
||||
|
||||
|
||||
static void pm_winmm_general_outputs()
|
||||
static void pm_winmm_general_outputs(void)
|
||||
{
|
||||
UINT i;
|
||||
DWORD wRtn;
|
||||
@ -210,7 +210,7 @@ static void pm_winmm_general_outputs()
|
||||
}
|
||||
|
||||
|
||||
static void pm_winmm_mapper_output()
|
||||
static void pm_winmm_mapper_output(void)
|
||||
{
|
||||
WORD wRtn;
|
||||
/* Note: if MIDIMAPPER opened as output (pseudo MIDI device
|
||||
@ -400,7 +400,7 @@ static unsigned int allocate_input_buffer(HMIDIIN h, long buffer_len)
|
||||
}
|
||||
|
||||
|
||||
static winmm_info_type winmm_info_create()
|
||||
static winmm_info_type winmm_info_create(void)
|
||||
{
|
||||
winmm_info_type info = (winmm_info_type) pm_alloc(sizeof(winmm_info_node));
|
||||
info->handle.in = NULL;
|
||||
@ -501,10 +501,10 @@ static PmError winmm_in_close(PmInternal *midi)
|
||||
winmm_info_type info = (winmm_info_type) midi->api_info;
|
||||
if (!info) return pmBadPtr;
|
||||
/* device to close */
|
||||
if (pm_hosterror = midiInStop(info->handle.in)) {
|
||||
if ((pm_hosterror = midiInStop(info->handle.in))) {
|
||||
midiInReset(info->handle.in); /* try to reset and close port */
|
||||
midiInClose(info->handle.in);
|
||||
} else if (pm_hosterror = midiInReset(info->handle.in)) {
|
||||
} else if ((pm_hosterror = midiInReset(info->handle.in))) {
|
||||
midiInClose(info->handle.in); /* best effort to close midi port */
|
||||
} else {
|
||||
pm_hosterror = midiInClose(info->handle.in);
|
||||
@ -988,7 +988,7 @@ static PmError winmm_write_byte(PmInternal *midi, unsigned char byte,
|
||||
info->hdr = hdr = get_free_output_buffer(midi);
|
||||
assert(hdr);
|
||||
midi->fill_base = (unsigned char *) info->hdr->lpData;
|
||||
midi->fill_offset_ptr = &(hdr->dwBytesRecorded);
|
||||
midi->fill_offset_ptr = (unsigned int *) &(hdr->dwBytesRecorded);
|
||||
/* when buffer fills, Pm_WriteSysEx will revert to calling
|
||||
* pmwin_write_byte, which expect to have space, so leave
|
||||
* one byte free for pmwin_write_byte. Leave another byte
|
||||
|
Loading…
Reference in New Issue
Block a user