Sfoglia il codice sorgente

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

up in spat-lab port.
master
kevin 11 anni fa
parent
commit
a204e9ad1c
1 ha cambiato i file con 13 aggiunte e 10 eliminazioni
  1. 13
    10
      osx/cmMidiOsx.c

+ 13
- 10
osx/cmMidiOsx.c Vedi File

@@ -58,13 +58,18 @@ cmMpRoot* _cmMpRtPtr = NULL;
58 58
 
59 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 68
   unsigned    n1   = 0;
64 69
   unsigned    n2   = 0;
65 70
   const char* fmt2 = "OS Status:%i";
71
+  va_end(vl0);
66 72
 
67
-  va_start(vl,fmt);
68 73
 
69 74
   if( err != noErr )
70 75
     n1 = snprintf(NULL,0,fmt2,err);
@@ -72,17 +77,14 @@ cmMpRC_t _cmMpError( cmErr_t* errPtr, cmMpRC_t rc, OSStatus err, const char* fmt
72 77
   unsigned bufCharCnt = n0 + n1;
73 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 81
   n2 = strlen(buf);
80 82
   snprintf(buf+n2,bufCharCnt-n2,fmt2,err);
81 83
   buf[bufCharCnt]=0;
82 84
 
83 85
   cmErrMsg(errPtr,rc,buf);
84 86
   
85
-  va_end(vl);
87
+  va_end(vl1);
86 88
 
87 89
   return rc;
88 90
 }
@@ -223,8 +225,9 @@ cmMpRC_t _cmMpGetEntityUniqueIdArray( MIDIEntityRef mer, SInt32* idArray, unsign
223 225
     offline = 1;
224 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 233
     if( offline )

Loading…
Annulla
Salva