1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-22 10:45:15 +03:00
aports/testing/portmidi/50-change_assert.patch
Taner Tas 24cdbb59af testing/portmidi: new aport
http://portmedia.sourceforge.net/
PortMidi is a platform independent library for MIDI input/output.
2018-02-28 12:53:05 +00:00

41 lines
1.5 KiB
Diff

diff --git a/pm_common/portmidi.c b/pm_common/portmidi.c
index b716170..9a469b1 100755
--- a/pm_common/portmidi.c
+++ b/pm_common/portmidi.c
@@ -9,7 +9,6 @@
#include "porttime.h"
#include "pmutil.h"
#include "pminternal.h"
-#include <assert.h>
#define MIDI_CLOCK 0xf8
#define MIDI_ACTIVE 0xfe
@@ -293,8 +292,8 @@ PMEXPORT const char *Pm_GetErrorText( PmError errnum ) {
* The error will always be in the global pm_hosterror_text.
*/
PMEXPORT void Pm_GetHostErrorText(char * msg, unsigned int len) {
- assert(msg);
- assert(len > 0);
+ if (!msg) return;
+ if (len <= 0) return;
if (pm_hosterror) {
strncpy(msg, (char *) pm_hosterror_text, len);
pm_hosterror = FALSE;
@@ -1016,7 +1015,7 @@ void pm_read_short(PmInternal *midi, PmEvent *event)
{
int status;
/* arg checking */
- assert(midi != NULL);
+ if (!midi) return;
/* midi filtering is applied here */
status = Pm_MessageStatus(event->message);
if (!pm_status_filtered(status, midi->filters)
@@ -1058,7 +1057,7 @@ unsigned int pm_read_bytes(PmInternal *midi, const unsigned char *data,
int i = 0; /* index into data, must not be unsigned (!) */
PmEvent event;
event.timestamp = timestamp;
- assert(midi);
+ if (!midi) return 0;
/* note that since buffers may not have multiples of 4 bytes,
* pm_read_bytes may be called in the middle of an outgoing
* 4-byte PortMidi message. sysex_in_progress indicates that