static void CopyUTF8toUTF16NFC(nsACString& aSrc, nsAString& aResult)
static void CopyUTF8toUTF16NFC(const nsACString& aSrc, nsAString& aResult)
static void CopyUTF8toUTF16NFC(nsACString& aSrc, nsAString& aResult){    static PRBool sChecked = PR_FALSE;    static UnicodeNormalizer sUnicodeNormalizer = NULL;    // CFStringNormalize was not introduced until Mac OS 10.2    if (!sChecked) {        CFBundleRef carbonBundle =            CFBundleGetBundleWithIdentifier(CFSTR("com.apple.Carbon"));        if (carbonBundle)            sUnicodeNormalizer = (UnicodeNormalizer)                ::CFBundleGetFunctionPointerForName(carbonBundle,                                                    CFSTR("CFStringNormalize"));        sChecked = PR_TRUE;    }    if (!sUnicodeNormalizer) {  // OS X 10.2 or earlier        CopyUTF8toUTF16(aSrc, aResult);        return;      }    const nsAFlatCString &inFlatSrc = PromiseFlatCString(aSrc);    // The number of 16bit code units in a UTF-16 string will never be    // larger than the number of bytes in the corresponding UTF-8 string.    CFMutableStringRef inStr =        ::CFStringCreateMutable(NULL, inFlatSrc.Length());    if (!inStr) {        CopyUTF8toUTF16(aSrc, aResult);        return;      }         ::CFStringAppendCString(inStr, inFlatSrc.get(), kCFStringEncodingUTF8);     sUnicodeNormalizer(inStr, kCFStringNormalizationFormC);    CFIndex length = CFStringGetLength(inStr);    const UniChar* chars = CFStringGetCharactersPtr(inStr);    if (chars)         aResult.Assign(chars, length);    else {        StBuffer<UniChar> buffer;        if (!buffer.EnsureElemCapacity(length))            CopyUTF8toUTF16(aSrc, aResult);        else {            CFStringGetCharacters(inStr, CFRangeMake(0, length), buffer.get());            aResult.Assign(buffer.get(), length);        }    }    CFRelease(inStr);}