VirtualBox

Changeset 39469 in vbox


Ignore:
Timestamp:
Nov 30, 2011 8:30:52 AM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
75118
Message:

Audio/mac: proper fix for xTracker/5971.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/coreaudio.c

    r39103 r39469  
    371371static char* caCFStringToCString(const CFStringRef pCFString)
    372372{
    373     const char *pszTmp = NULL;
    374373    char *pszResult = NULL;
    375374    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;
    376387
    377388    /* First try to get the pointer directly. */
     
    393404        }
    394405    }
     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
    395416
    396417    return pszResult;
     
    694715            if (pszName && pszUID)
    695716                LogRel(("CoreAudio: Using output device: %s (UID: %s)\n", pszName, pszUID));
    696             RTStrFree(pszUID);
     717            RTMemFree(pszUID);
    697718        }
    698         RTStrFree(pszName);
     719        RTMemFree(pszName);
    699720    }
    700721    else
     
    15191540                LogRel(("CoreAudio: Using input device: %s (UID: %s)\n", pszName, pszUID));
    15201541            if (pszUID)
    1521                 RTStrFree(pszUID);
     1542                RTMemFree(pszUID);
    15221543        }
    15231544        if (pszName)
    1524             RTStrFree(pszName);
     1545            RTMemFree(pszName);
    15251546    }
    15261547    else
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette