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
|
--- a/pm_common/portmidi.c
+++ b/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
@@ -468,8 +467,8 @@ PMEXPORT const char *Pm_GetErrorText(PmE
*/
PMEXPORT void Pm_GetHostErrorText(char * msg, unsigned int len)
{
- assert(msg);
- assert(len > 0);
+ if (!msg) return;
+ if (len <= 0) return;
if (pm_hosterror) {
#pragma warning(suppress: 4996) // don't use suggested strncpy_s
strncpy(msg, (char *) pm_hosterror_text, len);
@@ -1280,7 +1279,7 @@ void pm_read_short(PmInternal *midi, PmE
{
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)
@@ -1322,7 +1321,7 @@ unsigned int pm_read_bytes(PmInternal *m
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
|