On 12/7/13 3:35 PM, Ken Thomases wrote:
Can anyone tell me if the latter use of CFArraySortValues() is correct?
It is. Your analysis is correct.
It doesn't feel right to cast an int option to (void *) but the
documentation simply doesn't say it will pass on a dereferenced value.
The docs for CFArraySortValues() describes the context parameter as "[a]
pointer-sized program-defined value". It is declared as a pointer only to
guarantee that it's large enough to hold a pointer even on architectures
where a pointer is larger than, say, an int. But semantically, it's just a
"value". It may have been better for Apple to have used uintptr_t.
The fact that the leak went away tells me I'm on the right track.
Well, I can't explain why passing the pointer to the context variable would
have caused a leak. In theory, CFStringCompare() would simply have
interpreted it as a option bit mask with an arbitrary variety of options set.
I wouldn't expect any such options to cause a leak.
But you're right that the original call was incorrect.
Thanks Ken for the quick confirmation!
In that case, a word of warning to all AquaticPrime users - that's where this
code comes from. The function you're looking for is
APCreateDictionaryForLicenseData().
Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]