aboutsummaryrefslogtreecommitdiffstats
path: root/testing/portmidi/50-change_assert.patch
blob: 05a2bf709cb70fbdfffa45799ed76728fc359ed8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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