Changeset 39469 in vbox
- Timestamp:
- Nov 30, 2011 8:30:52 AM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 75118
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/coreaudio.c
r39103 r39469 371 371 static char* caCFStringToCString(const CFStringRef pCFString) 372 372 { 373 const char *pszTmp = NULL;374 373 char *pszResult = NULL; 375 374 CFIndex cLen; 375 #if 0 376 /** 377 * CFStringGetCStringPtr doesn't reliably return requested string instead return depends on "many factors" (not clear which) 378 * ( please follow the link 379 * http://developer.apple.com/library/mac/#documentation/CoreFoundation/Reference/CFStringRef/Reference/reference.html 380 * for more details). Branch below allocates memory using mechanisms which hasn't got single method for memory free: 381 * RTStrDup - RTStrFree 382 * RTMemAllocZTag - RTMemFree 383 * which aren't compatible, opposite to CFStringGetCStringPtr CFStringGetCString has well defined 384 * behaviour and confident return value. 385 */ 386 const char *pszTmp = NULL; 376 387 377 388 /* First try to get the pointer directly. */ … … 393 404 } 394 405 } 406 #else 407 /* If the pointer isn't available directly, we have to make a copy. */ 408 cLen = CFStringGetLength(pCFString) + 1; 409 pszResult = RTMemAllocZTag(cLen * sizeof(char), RTSTR_TAG); 410 if (!CFStringGetCString(pCFString, pszResult, cLen, kCFStringEncodingUTF8)) 411 { 412 RTStrFree(pszResult); 413 pszResult = NULL; 414 } 415 #endif 395 416 396 417 return pszResult; … … 694 715 if (pszName && pszUID) 695 716 LogRel(("CoreAudio: Using output device: %s (UID: %s)\n", pszName, pszUID)); 696 RT StrFree(pszUID);717 RTMemFree(pszUID); 697 718 } 698 RT StrFree(pszName);719 RTMemFree(pszName); 699 720 } 700 721 else … … 1519 1540 LogRel(("CoreAudio: Using input device: %s (UID: %s)\n", pszName, pszUID)); 1520 1541 if (pszUID) 1521 RT StrFree(pszUID);1542 RTMemFree(pszUID); 1522 1543 } 1523 1544 if (pszName) 1524 RT StrFree(pszName);1545 RTMemFree(pszName); 1525 1546 } 1526 1547 else
Note:
See TracChangeset
for help on using the changeset viewer.