Add some casting and namespace specifiers to keep MSVC happy

This commit is contained in:
John Emmas 2014-05-06 09:20:03 +01:00
parent 0277c8c8d1
commit 9cf2cf55f5
4 changed files with 11 additions and 10 deletions

View file

@ -64,7 +64,7 @@ AsyncMIDIPort::~AsyncMIDIPort ()
}
void
AsyncMIDIPort::set_timer (boost::function<framecnt_t (void)>& f)
AsyncMIDIPort::set_timer (boost::function<MIDI::framecnt_t (void)>& f)
{
timer = f;
have_timer = true;

View file

@ -420,7 +420,7 @@ PMEXPORT PmError Pm_Poll( PortMidiStream *stream )
return pm_errmsg(err);
}
return !Pm_QueueEmpty(midi->queue);
return (PmError) !Pm_QueueEmpty(midi->queue);
}

View file

@ -91,7 +91,7 @@ static PmDeviceID pm_get_default_device_id(int is_input, char *key) {
ERROR_SUCCESS) {
return id;
}
if (RegQueryValueEx(hkey, key, NULL, &dwType, pattern, &pattern_max) !=
if (RegQueryValueEx(hkey, key, NULL, &dwType, (LPBYTE)pattern, (LPDWORD)&pattern_max) !=
ERROR_SUCCESS) {
return id;
}
@ -140,4 +140,3 @@ void pm_free(void *ptr) {
free(ptr);
}

View file

@ -2,6 +2,8 @@
#ifdef _MSC_VER
#pragma warning(disable: 4133) // stop warnings about implicit typecasts
#define max(a,b) __max(a,b)
#endif
#ifndef _WIN32_WINNT
@ -209,7 +211,7 @@ static void pm_winmm_general_outputs()
UINT i;
DWORD wRtn;
midi_num_outputs = midiOutGetNumDevs();
midi_out_caps = pm_alloc( sizeof(MIDIOUTCAPS) * midi_num_outputs );
midi_out_caps = (MIDIOUTCAPS*)pm_alloc( sizeof(MIDIOUTCAPS) * midi_num_outputs );
if (midi_out_caps == NULL) {
/* no error is reported -- see pm_winmm_general_inputs */
@ -533,10 +535,10 @@ static PmError allocate_input_buffer(HMIDIIN h, long buffer_len)
pm_hosterror = midiInPrepareHeader(h, hdr, sizeof(MIDIHDR));
if (pm_hosterror) {
pm_free(hdr);
return pm_hosterror;
return (PmError) pm_hosterror;
}
pm_hosterror = midiInAddBuffer(h, hdr, sizeof(MIDIHDR));
return pm_hosterror;
return (PmError) pm_hosterror;
}
@ -628,7 +630,7 @@ no_memory:
static PmError winmm_in_poll(PmInternal *midi) {
midiwinmm_type m = (midiwinmm_type) midi->descriptor;
return m->error;
return (PmError) m->error;
}
@ -1208,7 +1210,7 @@ static PmError winmm_write_byte(PmInternal *midi, unsigned char byte,
m->hdr = hdr = get_free_output_buffer(midi);
assert(hdr);
midi->fill_base = (unsigned char *) m->hdr->lpData;
midi->fill_offset_ptr = &(hdr->dwBytesRecorded);
midi->fill_offset_ptr = (uint32_t*) &(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
@ -1424,7 +1426,7 @@ void pm_winmm_term( void )
printf("pm_winmm_term called\n");
#endif
for (i = 0; i < pm_descriptor_index; i++) {
PmInternal * midi = descriptors[i].internalDescriptor;
PmInternal * midi = (PmInternal*) descriptors[i].internalDescriptor;
if (midi) {
midiwinmm_type m = (midiwinmm_type) midi->descriptor;
if (m->handle.out) {