How can I compare two CFUUIDRefs from the CoreFoundation Carbon framework in Mac OS X? Is there an easier way to check if two CFUUIDs are equal other than converting them to strings and then comparing those?
How do I compare two CFUUIDs (Mac OS X Carbon/CoreFoundation)?
1.3k Views Asked by Jake Petroules At
2
There are 2 best solutions below
1
Aidan Steele
On
I'm not sure if there is a canonical or recommended method per se, but would the following suffice?
#define CompareUUIDs(u1, u2) memcmp(CFUUIDGetUUIDBytes(u1), CFUUIDGetUUIDBytes(u2))
It would be used as follows:
if (CompareUUIDs(u1, u2) == 0) {
// UUIDs are equal
} // etc..
Alternatively, as you're only really interested in whether they are equal or not:
#define UUIDsAreEqual(u1, u2) (memcmp(CFUUIDGetUUIDBytes(u1), CFUUIDGetUUIDBytes(u2)) == 0)
It would be used as follows:
if (UUIDsAreEqual(u1, u2)) {
// UUIDs are equal
} // etc..
Related Questions in OBJECTIVE-C
- How do I customize NSOutlineView to have border color?
- UIWebView Screen Fitting Issue
- How to hide "Now playing url" in control center
- CloudKit: Preventing Duplicate Records
- Image and Text locations in UIButton
- setting OpenGL version in objective-C
- Setup code for xibs in iOS. -awakFromNb:
- realm db, get parent link of object
- CFBundleDocumentType is not working in myproject-Info.plist file
- UIPopoverPresentationController not rendering properly
- Using Storyboard Reference
- Pass Data between two view controllers using 'Delegation' : Objective-C
- Unexpected CALayer Vertical Flipping on 3D Rotation 'Bounce'
- Setting View orientation to portrait is ignored
- UITextField append / between dates while enforcing character limit
Related Questions in MACOS
- How do I customize NSOutlineView to have border color?
- Force sublime text to use PATH from the shell value
- Do executable files always open a terminal window on MacOS?
- setting OpenGL version in objective-C
- C std library don't appear to be linked in object file
- Cross compile simple standard C program on Linux for Mac
- How to generate request format for WCF web service method for Mac and iPhone
- Bundle Multiple Xamarin apps in one pkg installer
- How to Handle Command Line Prompt from a Cocoa App
- AVFoundation - Process each image separately
- CMYK NSImage get pixel data
- how i get the mac of ibeacon or BLE
- Set JAVA_HOME on Mac
- Finding active IPv6 interfaces under Mac OS (using Python)
- OSX: Why is my launchd agent running my script twice?
Related Questions in MACOS-CARBON
- HIDictionaryWindowShow usage in Swift
- How to get Cocoa to detect USB webcam device
- How to create a FullScreen NSWindow which should show the dock but hide menu bar?
- Am I using wxPython carbon or cocoa?
- Getting Mac NPAPI plugin to support high resolution windows for retina displays
- How to display an input box in Mac OSX using c++
- Callback function with carbon API
- SGNewChannel error -9405 on Mac 10.9.1
- What is the Cocoa method for doing the Carbon FSExchangeObjectsCompat call?
- Detecting what frameworks application is using
- How do I compare two CFUUIDs (Mac OS X Carbon/CoreFoundation)?
- Add Item to Finder Sidebar
- Getting unresolved carbon functions - mac qt 10.4 build
- Setting the type/creator code programmatically
- how can I fire up carbon emacs (as editor instead of emacs in default) to edit a file under terminal.app?
Related Questions in UUID
- wmic csproduct get UUID equivalent for Unix and Mac?
- How deploy an large number iBeacons
- MongoDB insert UUID only using middleware?
- AltBeacon's Android Beacon Library getting major, minor and UUID
- Sortable UUIDs and overriding ActiveRecord::Base
- identifierForVendor changes on reinstall
- Guid as PK of Sql Server Table
- android device.getUuids returns null
- Does two device will have the same 'UUID'
- How to identify iOS device uniquely instead of using UUID and UDID
- How to covert time based java.util.UUID to DateTIme
- cast uuid to varchar in postgres when I use sequelize
- Issues with GRAILS UUID and PSQL
- How to generate a random UUID which is reproducible (with a seed) in Python
- Alternative to bitwise operators in uuid creation
Related Questions in CORE-FOUNDATION
- Calling CFRelease for a CFHostRef will sometimes crash
- CoreFoundation UTF-16 un-paired surrogate
- Why is there no counterpart to cf_consumed for the Clang static analyzer that marks an argument as being retained?
- case insensitive comparison of "i" and "I" fails with Dutch locale settings on OSX Yosemite
- Can a login item depend on the Core Foundation framework?
- How to get all CFTree Siblings on same depth?
- Nested bridge transfer call with ARC
- respondsToSelector: equivalent for CoreFoundation?
- How to draw a presentable tree using CFTree?
- Core foundation vs Foundation or Core foundation+ Foundation
- Why does NSURL parse strings with a double forward slash after the scheme differently to a string with a single forward slash?
- __attribute__((NSObject)) auto-synthesized property doesn't get released in dealloc
- Command-line Objective-C++ tool has started crashing in [NSApplication sharedApplication]
- Does Foundation use Core Foundation?
- How do I compare two CFUUIDs (Mac OS X Carbon/CoreFoundation)?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
A CFUUID is a kind of CFType, so you would use the same CFEqual function you use for any other CF objects.