Browse Source

cmMidiOsx.c: Fixed bug in va_list usage in _cmMpError() which showed

up in spat-lab port.
master
kevin 11 years ago
parent
commit
a204e9ad1c
1 changed files with 13 additions and 10 deletions
  1. 13
    10
      osx/cmMidiOsx.c

+ 13
- 10
osx/cmMidiOsx.c View File

58
 
58
 
59
 cmMpRC_t _cmMpError( cmErr_t* errPtr, cmMpRC_t rc, OSStatus err, const char* fmt, ... )
59
 cmMpRC_t _cmMpError( cmErr_t* errPtr, cmMpRC_t rc, OSStatus err, const char* fmt, ... )
60
 { 
60
 { 
61
-  va_list     vl;
62
-  unsigned    n0   = vsnprintf(NULL,0,fmt,vl);
61
+  va_list vl0;
62
+  va_list vl1;
63
+  
64
+  va_start(vl0,fmt);
65
+  va_copy(vl1,vl0);
66
+
67
+  unsigned    n0   = vsnprintf(NULL,0,fmt,vl0);
63
   unsigned    n1   = 0;
68
   unsigned    n1   = 0;
64
   unsigned    n2   = 0;
69
   unsigned    n2   = 0;
65
   const char* fmt2 = "OS Status:%i";
70
   const char* fmt2 = "OS Status:%i";
71
+  va_end(vl0);
66
 
72
 
67
-  va_start(vl,fmt);
68
 
73
 
69
   if( err != noErr )
74
   if( err != noErr )
70
     n1 = snprintf(NULL,0,fmt2,err);
75
     n1 = snprintf(NULL,0,fmt2,err);
72
   unsigned bufCharCnt = n0 + n1;
77
   unsigned bufCharCnt = n0 + n1;
73
   char     buf[ bufCharCnt + 1];
78
   char     buf[ bufCharCnt + 1];
74
 
79
 
75
-  va_end(vl);
76
-  va_start(vl,fmt);
77
-
78
-  vsnprintf(buf,n0,fmt,vl);
80
+  vsnprintf(buf,n0,fmt,vl1);
79
   n2 = strlen(buf);
81
   n2 = strlen(buf);
80
   snprintf(buf+n2,bufCharCnt-n2,fmt2,err);
82
   snprintf(buf+n2,bufCharCnt-n2,fmt2,err);
81
   buf[bufCharCnt]=0;
83
   buf[bufCharCnt]=0;
82
 
84
 
83
   cmErrMsg(errPtr,rc,buf);
85
   cmErrMsg(errPtr,rc,buf);
84
   
86
   
85
-  va_end(vl);
87
+  va_end(vl1);
86
 
88
 
87
   return rc;
89
   return rc;
88
 }
90
 }
223
     offline = 1;
225
     offline = 1;
224
     if((err = MIDIObjectGetIntegerProperty( epr, kMIDIPropertyOffline, &offline)) != noErr )
226
     if((err = MIDIObjectGetIntegerProperty( epr, kMIDIPropertyOffline, &offline)) != noErr )
225
     {
227
     {
226
-      rc= _cmMpError(errPtr,kSysErrMpRC,err,"Get online status on %s endpoint %i failed.",dirLabel,pi);
227
-      goto errLabel;
228
+       _cmMpError(errPtr,kSysErrMpRC,err,"Get online status on %s endpoint %i failed.",dirLabel,pi);
229
+      //goto errLabel;  kpl 09/05/13 - report error and fall through and report the device as 'offline'. 
230
+      // This should be a warning rather than a error.
228
     }
231
     }
229
 
232
 
230
     if( offline )
233
     if( offline )

Loading…
Cancel
Save