File: 50-change_assert.diff

package info (click to toggle)
portmidi 2%3A2.0.6-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,156 kB
  • sloc: ansic: 8,180; java: 532; cpp: 461; makefile: 55
file content (39 lines) | stat: -rw-r--r-- 1,147 bytes parent folder | download
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
--- portmidi.orig/pm_common/portmidi.c
+++ portmidi/pm_common/portmidi.c
@@ -7,7 +7,6 @@
 #include "porttime.h"
 #include "pmutil.h"
 #include "pminternal.h"
-#include <assert.h>
 
 #define MIDI_CLOCK      0xf8
 #define MIDI_ACTIVE     0xfe
@@ -503,8 +502,8 @@
  */
 PMEXPORT void Pm_GetHostErrorText(char * msg, unsigned int len)
 {
-    assert(msg);
-    assert(len > 0);
+    if (!msg) return;
+    if (len <= 0) return;
     if (pm_hosterror) {
 #if defined(WIN32) && !defined(_WIN32)
 #pragma warning(suppress: 4996)  /* don't use suggested strncpy_s */
@@ -1320,7 +1319,7 @@
 { 
     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)
@@ -1367,7 +1366,7 @@
     int i = 0; /* index into data, must not be unsigned (!) */
     PmEvent event;
     event.timestamp = timestamp;
-    assert(midi);
+    if (!midi) return 0;
 
     /* Since sysex messages may have embedded real-time messages, we
      * cannot simply send every consecutive group of 4 bytes as sysex