mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 16:46:35 +01:00
'libs/evoral' - cast the returned pointers from malloc() / g_ptr_array_index() etc, as needed to satisfy MSVC
This commit is contained in:
parent
1cb37fc11c
commit
453ed61c4a
5 changed files with 29 additions and 29 deletions
|
|
@ -123,7 +123,7 @@ parse_mthd_header(smf_t *smf)
|
|||
return (-1);
|
||||
}
|
||||
|
||||
tmp_mthd = smf->file_buffer;
|
||||
tmp_mthd = (chunk_header_struct*)smf->file_buffer;
|
||||
|
||||
if (!chunk_signature_matches(tmp_mthd, "MThd")) {
|
||||
g_critical("SMF error: MThd signature not found, is that a MIDI file?");
|
||||
|
|
@ -409,7 +409,7 @@ extract_sysex_event(const unsigned char *buf, const size_t buffer_length, smf_ev
|
|||
}
|
||||
|
||||
event->midi_buffer_length = message_length;
|
||||
event->midi_buffer = malloc(event->midi_buffer_length);
|
||||
event->midi_buffer = (uint8_t*)malloc(event->midi_buffer_length);
|
||||
if (event->midi_buffer == NULL) {
|
||||
g_critical("Cannot allocate memory in extract_sysex_event(): %s", strerror(errno));
|
||||
return (-4);
|
||||
|
|
@ -452,7 +452,7 @@ extract_escaped_event(const unsigned char *buf, const size_t buffer_length, smf_
|
|||
}
|
||||
|
||||
event->midi_buffer_length = message_length;
|
||||
event->midi_buffer = malloc(event->midi_buffer_length);
|
||||
event->midi_buffer = (uint8_t*)malloc(event->midi_buffer_length);
|
||||
if (event->midi_buffer == NULL) {
|
||||
g_critical("Cannot allocate memory in extract_escaped_event(): %s", strerror(errno));
|
||||
return (-4);
|
||||
|
|
@ -522,7 +522,7 @@ extract_midi_event(const unsigned char *buf, const size_t buffer_length, smf_eve
|
|||
}
|
||||
|
||||
event->midi_buffer_length = message_length;
|
||||
event->midi_buffer = malloc(event->midi_buffer_length);
|
||||
event->midi_buffer = (uint8_t*)malloc(event->midi_buffer_length);
|
||||
if (event->midi_buffer == NULL) {
|
||||
g_critical("Cannot allocate memory in extract_midi_event(): %s", strerror(errno));
|
||||
return (-4);
|
||||
|
|
@ -611,7 +611,7 @@ make_string(const unsigned char *buf, const size_t buffer_length, uint32_t len)
|
|||
len = buffer_length;
|
||||
}
|
||||
|
||||
str = malloc(len + 1);
|
||||
str = (char*)malloc(len + 1);
|
||||
if (str == NULL) {
|
||||
g_critical("Cannot allocate memory in make_string().");
|
||||
return (NULL);
|
||||
|
|
@ -662,14 +662,14 @@ smf_event_extract_text(const smf_event_t *event)
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
smf_extract_vlq((void *)&(event->midi_buffer[2]), event->midi_buffer_length - 2, &string_length, &length_length);
|
||||
smf_extract_vlq((const unsigned char*)(void *)&(event->midi_buffer[2]), event->midi_buffer_length - 2, &string_length, &length_length);
|
||||
|
||||
if (string_length <= 0) {
|
||||
g_critical("smf_event_extract_text: truncated MIDI message.");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
return (make_string((void *)(&event->midi_buffer[2] + length_length), event->midi_buffer_length - 2 - length_length, string_length));
|
||||
return (make_string((const unsigned char*)(void *)(&event->midi_buffer[2] + length_length), event->midi_buffer_length - 2 - length_length, string_length));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue