当前位置: 首页>>代码示例>>C++>>正文


C++ CFEqual函数代码示例

本文整理汇总了C++中CFEqual函数的典型用法代码示例。如果您正苦于以下问题:C++ CFEqual函数的具体用法?C++ CFEqual怎么用?C++ CFEqual使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CFEqual函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CGImageSourceGetType

bool ImageSource::frameHasAlphaAtIndex(size_t index)
{
    if (!m_decoder)
        return false; // FIXME: why doesn't this return true?

    if (!frameIsCompleteAtIndex(index))
        return true;

    CFStringRef imageType = CGImageSourceGetType(m_decoder);

    // Return false if there is no image type or the image type is JPEG, because
    // JPEG does not support alpha transparency.
    if (!imageType || CFEqual(imageType, CFSTR("public.jpeg")))
        return false;

    // FIXME: Could return false for other non-transparent image formats.
    // FIXME: Could maybe return false for a GIF Frame if we have enough info in the GIF properties dictionary
    // to determine whether or not a transparent color was defined.
    return true;
}
开发者ID:MYSHLIFE,项目名称:webkit,代码行数:20,代码来源:ImageSourceCG.cpp

示例2: unused

// -----------------------------------------------------------------------------
//	FLACMDImporterPluginFactory
// -----------------------------------------------------------------------------
//	Implementation of the factory function for this type.
//
void *MetadataImporterPluginFactory(CFAllocatorRef allocator,CFUUIDRef typeID)
{

#pragma unused(allocator)

    MetadataImporterPluginType *result;
    CFUUIDRef                 uuid;

    /* If correct type is being requested, allocate an
     * instance of TestType and return the IUnknown interface.
     */
    if (CFEqual(typeID,kMDImporterTypeID)) {
        uuid = CFUUIDCreateFromString(kCFAllocatorDefault,CFSTR(PLUGIN_ID));
        result = AllocMetadataImporterPluginType(uuid);
        CFRelease(uuid);
        return result;
    }
    /* If the requested type is incorrect, return NULL. */
    return NULL;
}
开发者ID:sbooth,项目名称:FLACImporter,代码行数:25,代码来源:main.c

示例3: updateStore

static void
updateStore(const void *key, const void *value, void *context)
{
	CFDictionaryRef dict;
	CFDictionaryRef newDict = (CFDictionaryRef)value;
	CFDictionaryRef	oldIFs	= (CFDictionaryRef)context;

	dict = CFDictionaryGetValue(oldIFs, key);

	if (!dict || !CFEqual(dict, newDict)) {
		if (CFDictionaryGetCount(newDict) > 0) {
			cache_SCDynamicStoreSetValue(store, key, newDict);
		} else if (dict) {
			cache_SCDynamicStoreRemoveValue(store, key);
		}
		network_changed = TRUE;
	}

	return;
}
开发者ID:010001111,项目名称:darling,代码行数:20,代码来源:ev_ipv6.c

示例4: findStartupItemInList

LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef findUrl)
{
    // loop through the list of startup items and try to find the bitcoin app
    CFArrayRef listSnapshot = LSSharedFileListCopySnapshot(list, NULL);
    for(int i = 0; i < CFArrayGetCount(listSnapshot); i++) {
        LSSharedFileListItemRef item = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(listSnapshot, i);
        UInt32 resolutionFlags = kLSSharedFileListNoUserInteraction | kLSSharedFileListDoNotMountVolumes;
        CFURLRef currentItemURL = NULL;
        LSSharedFileListItemResolve(item, resolutionFlags, &currentItemURL, NULL);
        if(currentItemURL && CFEqual(currentItemURL, findUrl)) {
            // found
            CFRelease(currentItemURL);
            return item;
        }
        if(currentItemURL) {
            CFRelease(currentItemURL);
        }
    }
    return NULL;
}
开发者ID:Lederstrumpf,项目名称:Gridcoin-master,代码行数:20,代码来源:guiutil.cpp

示例5: CFUUIDCreateFromUUIDBytes

HRESULT IOHIDTransactionClass::queryInterface(REFIID iid, void ** ppv)
{
    CFUUIDRef uuid = CFUUIDCreateFromUUIDBytes(NULL, iid);
    HRESULT res = S_OK;

    if (CFEqual(uuid, kIOHIDDeviceTransactionInterfaceID))
    {
        *ppv = getInterfaceMap();
        addRef();
    }
    else {
        res = fOwningDevice->queryInterface(iid, ppv);
    }

    if (!*ppv)
        res = E_NOINTERFACE;

    CFRelease(uuid);
    return res;
}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:20,代码来源:IOHIDTransactionClass.cpp

示例6: SecKeyEqual

static Boolean SecKeyEqual(CFTypeRef cf1, CFTypeRef cf2)
{
    SecKeyRef key1 = (SecKeyRef)cf1;
    SecKeyRef key2 = (SecKeyRef)cf2;
    if (key1 == key2)
        return true;
    if (!key2 || key1->key_class != key2->key_class)
        return false;
    if (key1->key_class->extraBytes)
        return !memcmp(key1->key, key2->key, key1->key_class->extraBytes);
    
    /* TODO: Won't work when we get reference keys. */
    CFDictionaryRef d1, d2;
    d1 = SecKeyCopyAttributeDictionary(key1);
    d2 = SecKeyCopyAttributeDictionary(key2);
    Boolean result = CFEqual(d1, d2);
    CFReleaseSafe(d1);
    CFReleaseSafe(d2);
    return result;
}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:20,代码来源:SecKey.c

示例7: dataCopyProperty

static CFPropertyListRef dataCopyProperty(struct _CFStream *stream, CFStringRef propertyName, void *info) {
    _CFWriteDataStreamContext *dataStream = (_CFWriteDataStreamContext *)info;
    CFIndex size = 0;
    _CFStreamByteBuffer *buf;
    CFAllocatorRef alloc;
    UInt8 *bytes, *currByte;
    if (!CFEqual(propertyName, kCFStreamPropertyDataWritten)) return NULL;
    if (dataStream->bufferAllocator == kCFAllocatorNull)  return NULL;
    alloc = dataStream->bufferAllocator;
    for (buf = dataStream->firstBuf; buf != NULL; buf = buf->next) {
        size += buf->length;
    }
    bytes = (UInt8 *)CFAllocatorAllocate(alloc, size, 0);
    currByte = bytes;
    for (buf = dataStream->firstBuf; buf != NULL; buf = buf->next) {
        memmove(currByte, buf->bytes, buf->length);
        currByte += buf->length;
    }
    return CFDataCreateWithBytesNoCopy(alloc, bytes, size, alloc);
}
开发者ID:nagyistge,项目名称:swift-corelibs-foundation,代码行数:20,代码来源:CFConcreteStreams.c

示例8: imageWithColorSpace

static RetainPtr<CGImageRef> imageWithColorSpace(CGImageRef originalImage, ColorSpace colorSpace)
{
    CGColorSpaceRef originalColorSpace = CGImageGetColorSpace(originalImage);

    // If the image already has a (non-device) color space, we don't want to
    // override it, so return.
    if (!originalColorSpace || !CFEqual(originalColorSpace, deviceRGBColorSpaceRef()))
        return originalImage;

    switch (colorSpace) {
    case DeviceColorSpace:
        return originalImage;
    case sRGBColorSpace:
        return RetainPtr<CGImageRef>(AdoptCF, CGImageCreateCopyWithColorSpace(originalImage, 
            sRGBColorSpaceRef()));
    }

    ASSERT_NOT_REACHED();
    return originalImage;
}
开发者ID:flying-dutchmen,项目名称:3DS_w3Browser,代码行数:20,代码来源:ImageCG.cpp

示例9: writeXMLValue

static void writeXMLValue(CFTypeRef context, void *xmlDomain, CFStringRef key, CFTypeRef value) {
    _CFXMLPreferencesDomain *domain = (_CFXMLPreferencesDomain *)xmlDomain;
    const void *existing = NULL;

    __CFLock(&domain->_lock);
    if (domain->_domainDict == NULL) {
        _loadXMLDomainIfStale((CFURLRef )context, domain);
    }

	// check to see if the value is the same
	// if (1) the key is present AND value is !NULL and equal to existing, do nothing, or
	// if (2) the key is not present AND value is NULL, do nothing
	// these things are no-ops, and should not dirty the domain
    if (CFDictionaryGetValueIfPresent(domain->_domainDict, key, &existing)) {
	if (NULL != value && (existing == value || CFEqual(existing, value))) {
	    __CFUnlock(&domain->_lock);
	    return;
	}
    } else {
	if (NULL == value) {
	    __CFUnlock(&domain->_lock);
	    return;
	}
    }

	// We must append first so key gets another retain (in case we're
	// about to remove it from the dictionary, and that's the sole reference)
    // This should be a set not an array.
    if (!CFArrayContainsValue(domain->_dirtyKeys, CFRangeMake(0, CFArrayGetCount(domain->_dirtyKeys)), key)) {
	CFArrayAppendValue(domain->_dirtyKeys, key);
    }
    if (value) {
        // Must copy for two reasons - we don't want mutable objects in the cache, and we don't want objects allocated from a different allocator in the cache.
        CFTypeRef newValue = CFPropertyListCreateDeepCopy(__CFPreferencesAllocator(), value, kCFPropertyListImmutable);
        CFDictionarySetValue(domain->_domainDict, key, newValue);
        CFRelease(newValue);
    } else {
        CFDictionaryRemoveValue(domain->_domainDict, key);
    }
    __CFUnlock(&domain->_lock);
}
开发者ID:JGiola,项目名称:swift-corelibs-foundation,代码行数:41,代码来源:CFXMLPreferencesDomain.c

示例10: LOG

NativeImagePtr ImageDecoder::createFrameImageAtIndex(size_t index, SubsamplingLevel subsamplingLevel, DecodingMode decodingMode) const
{
    LOG(Images, "ImageDecoder %p createFrameImageAtIndex %lu", this, index);

    RetainPtr<CFDictionaryRef> options = imageSourceOptions(subsamplingLevel, decodingMode);
    RetainPtr<CGImageRef> image;

    if (decodingMode == DecodingMode::OnDemand)
        image = adoptCF(CGImageSourceCreateImageAtIndex(m_nativeDecoder.get(), index, options.get()));
    else
        image = adoptCF(CGImageSourceCreateThumbnailAtIndex(m_nativeDecoder.get(), index, options.get()));
    
#if PLATFORM(IOS)
    // <rdar://problem/7371198> - CoreGraphics changed the default caching behaviour in iOS 4.0 to kCGImageCachingTransient
    // which caused a performance regression for us since the images had to be resampled/recreated every time we called
    // CGContextDrawImage. We now tell CG to cache the drawn images. See also <rdar://problem/14366755> -
    // CoreGraphics needs to un-deprecate kCGImageCachingTemporary since it's still not the default.
#if COMPILER(CLANG)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
    CGImageSetCachingFlags(image.get(), kCGImageCachingTemporary);
#if COMPILER(CLANG)
#pragma clang diagnostic pop
#endif
#endif // PLATFORM(IOS)
    
    CFStringRef imageUTI = CGImageSourceGetType(m_nativeDecoder.get());
    static const CFStringRef xbmUTI = CFSTR("public.xbitmap-image");
    
    if (!imageUTI)
        return image;
    
    if (!CFEqual(imageUTI, xbmUTI))
        return image;
    
    // If it is an xbm image, mask out all the white areas to render them transparent.
    const CGFloat maskingColors[6] = {255, 255,  255, 255, 255, 255};
    RetainPtr<CGImageRef> maskedImage = adoptCF(CGImageCreateWithMaskingColors(image.get(), maskingColors));
    return maskedImage ? maskedImage : image;
}
开发者ID:ollie314,项目名称:webkit,代码行数:41,代码来源:ImageDecoderCG.cpp

示例11: EAPOLClientConfigurationGetSystemProfile

/*
 * Function: EAPOLClientConfigurationGetSystemProfile
 *
 * Purpose:
 *   Return the profile configured for System mode on the
 *   specified BSD network interface (e.g. "en0", "en1").
 *
 * Returns:
 *   NULL if no such profile is defined, non-NULL profile
 *   otherwise.
 */
EAPOLClientProfileRef
EAPOLClientConfigurationGetSystemProfile(EAPOLClientConfigurationRef cfg,
					 CFStringRef if_name)
{
    CFDictionaryRef		dict;
    SCNetworkInterfaceRef 	net_if = NULL;
    EAPOLClientProfileRef	profile = NULL;
    CFStringRef			profileID;

    dict = get_eapol_configuration(get_sc_prefs(cfg), if_name, &net_if);
    if (dict != NULL
	&& !CFEqual(SCNetworkInterfaceGetInterfaceType(net_if),
		    kSCNetworkInterfaceTypeIEEE80211)) {
	profileID = CFDictionaryGetValue(dict, kSystemProfileID);
	if (isA_CFString(profileID) != NULL) {
	    profile = EAPOLClientConfigurationGetProfileWithID(cfg, profileID);
	}
    }
    my_CFRelease(&net_if);
    return (profile);
}
开发者ID:aosm,项目名称:eap8021x,代码行数:32,代码来源:EAPOLClientConfiguration.c

示例12: druDeviceContainsErasableMedia

/*
	druDeviceContainsErasableMedia
	
	Returns TRUE if the device contains blank media.
*/
int
druDeviceContainsErasableMedia(DRDeviceRef device)
{
	CFDictionaryRef		deviceStatus = DRDeviceCopyStatus(device);
	CFStringRef			mediaState = CFDictionaryGetValue(deviceStatus,kDRDeviceMediaStateKey);
	int					result = 0;
	
	/* Check to see if there's media in the device */
	if (mediaState != NULL && CFEqual(mediaState,kDRDeviceMediaStateMediaPresent))
	{
		CFDictionaryRef	mediaInfo = CFDictionaryGetValue(deviceStatus,kDRDeviceMediaInfoKey);
		CFBooleanRef	erasable = CFDictionaryGetValue(mediaInfo,kDRDeviceMediaIsErasableKey);
		
		/* There's media, but is it blank and writable? */
		if (erasable != NULL && CFBooleanGetValue(erasable))
			result = 1;
	}
	
	CFRelease(deviceStatus);
	return result;
}
开发者ID:fruitsamples,项目名称:audioburntest,代码行数:26,代码来源:dru_devices.c

示例13: druMediaIsReserved

/*
	druMediaIsReserved
	
	Returns TRUE if the device contains blank media.
*/
int
druMediaIsReserved(DRDeviceRef device)
{
	CFDictionaryRef		deviceStatus = DRDeviceCopyStatus(device);
	CFStringRef			mediaState = CFDictionaryGetValue(deviceStatus,kDRDeviceMediaStateKey);
	int					result = 0;
	
	/* Check to see if there's media in the device */
	if (mediaState != NULL && CFEqual(mediaState,kDRDeviceMediaStateMediaPresent))
	{
		CFDictionaryRef	mediaInfo = CFDictionaryGetValue(deviceStatus,kDRDeviceMediaInfoKey);
		CFBooleanRef	reserved = CFDictionaryGetValue(mediaInfo,kDRDeviceMediaIsReservedKey);
		
		/* There's media, but do we have the reservation? */
		if (reserved != NULL && CFBooleanGetValue(reserved))
			result = 1;
	}
	
	CFRelease(deviceStatus);
	return result;
}
开发者ID:fruitsamples,项目名称:audioburntest,代码行数:26,代码来源:dru_devices.c

示例14: RemoveEventFromArray

void RemoveEventFromArray(CFMutableArrayRef array, CFNumberRef launchdToken)
{
	CFIndex i;
	CFIndex count = CFArrayGetCount(array);
	// Loop thru looking for us.
	for (i = 0; i < count; )
	{
		CFDictionaryRef eventDict = CFArrayGetValueAtIndex(array, i);
		CFNumberRef token = CFDictionaryGetValue(eventDict, sLaunchdTokenKey);
		
		if (CFEqual(token, launchdToken)) // This is the same event?
		{
			CFArrayRemoveValueAtIndex(array, i);	// Remove the event,
			break; // The token should only exist once, so it make no sense to continue.
		}
		else
		{
			++i; // If it's not us, advance.
		}
	}	
}
开发者ID:benvanik,项目名称:mDNSResponder,代码行数:21,代码来源:BonjourEvents.c

示例15: CFCopyHomeDirectoryURLForUser

CF_EXPORT CFURLRef CFCopyHomeDirectoryURLForUser(CFStringRef uName) {
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_EMBEDDED_MINI || DEPLOYMENT_TARGET_LINUX || DEPLOYMENT_TARGET_FREEBSD
    if (!uName) {
        uid_t euid;
        __CFGetUGIDs(&euid, NULL);
        struct passwd *upwd = getpwuid(euid ? euid : getuid());
        return _CFCopyHomeDirURLForUser(upwd, true);
    } else {
        struct passwd *upwd = NULL;
        char buf[128], *user;
        SInt32 len = CFStringGetLength(uName), size = CFStringGetMaximumSizeForEncoding(len, kCFPlatformInterfaceStringEncoding);
        CFIndex usedSize;
        if (size < 127) {
            user = buf;
        } else {
            user = CFAllocatorAllocate(kCFAllocatorSystemDefault, size+1, 0);
        }
        if (CFStringGetBytes(uName, CFRangeMake(0, len), kCFPlatformInterfaceStringEncoding, 0, true, (uint8_t *)user, size, &usedSize) == len) {
            user[usedSize] = '\0';
            upwd = getpwnam(user);
        }
        if (buf != user) {
            CFAllocatorDeallocate(kCFAllocatorSystemDefault, user);
        }
        return _CFCopyHomeDirURLForUser(upwd, false);
    }
#elif DEPLOYMENT_TARGET_WINDOWS
    // This code can only get the directory for the current user
    CFStringRef userName = uName ? CFCopyUserName() : NULL;
    if (uName && !CFEqual(uName, userName)) {
        CFLog(kCFLogLevelError, CFSTR("CFCopyHomeDirectoryURLForUser(): Unable to get home directory for other user"));
        if (userName) CFRelease(userName);
        return NULL;
    }
    if (userName) CFRelease(userName);
    return CFCopyHomeDirectoryURL();
#else
#error Dont know how to compute users home directories on this platform
#endif
}
开发者ID:mlabbe,项目名称:CoreFoundation,代码行数:40,代码来源:CFPlatform.c


注:本文中的CFEqual函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。