本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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, ¤tItemURL, NULL);
if(currentItemURL && CFEqual(currentItemURL, findUrl)) {
// found
CFRelease(currentItemURL);
return item;
}
if(currentItemURL) {
CFRelease(currentItemURL);
}
}
return NULL;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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.
}
}
}
示例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
}