Does anyone see a problem with storing a CFRange value as a CFNumber. I thought it was a bit cumbersome and *seems* less efficient to read the CFRange into a CFDataRef to store in a CFDictionary. It also takes more code to read the data back out. Since CFRange is a struct of two longs, I thought why not store it as a 64 bit CFNumber. I ran into a head scratcher. If I use "@inRange as ptr to CFRange" in AddRangeToDictionary, I get the below warning. I can not guess why I'm getting the error. It works but since I am getting a warning, I change the parameter to "@inRange as ptr " and the error understandably goes away /* local fn AddRangeToDictionary( theDict as CFMutableDictionaryRef, @inRange as ptr to CFRange ) warning: incompatible pointer types passing 'CFRange *' to parameter of type 'UInt8 const *' rangeCFData = (void*)( CFDataCreate( (void*)(kCFAllocatorDefault), inRange, sizeof( CFRange ) ) ); */ Thanks, W. include "ConsoleWindow" dim as CFStringRef kRangeAsCFDataType, kRangeAsCFNumberType kRangeAsCFDataType = @"kRangeAsCFDataType" kRangeAsCFNumberType = @"kRangeAsCFNumberType" end globals local fn ConsoleCFPrint( typeRef as CFTypeRef ) '~'1 dim as CFStringRef oldText, newText oldText = fn HIViewCopyText( sConsoleHITextView ) newText = fn CFStringCreateWithFormat( _kCFAllocatorDefault, #0, @"%@%@\r", oldText, typeRef ) CFRelease( oldText ) fn HIViewSetText( sConsoleHITextView, newText ) CFRelease( newText ) end fn local fn CreateDictionary as CFMutableDictionaryRef '~'1 end fn = fn CFDictionaryCreateMutable( _kCFAllocatorDefault, 0, @kCFCopyStringDictionaryKeyCallBacks, @kCFTypeDictionaryValueCallBacks ) local fn AddRangeToDictionary( theDict as CFMutableDictionaryRef, @inRange as ptr ) '~'1 dim as CFDataRef rangeCFData dim as CFNumberRef rangeCFNumber // A CFRange type is a 64 bit value, as struct of two longs rangeCFData = fn CFDataCreate( _kCFAllocatorDefault, inRange, sizeof( CFRange ) ) rangeCFNumber = fn CFNumberCreate( _kCFAllocatorDefault, _kCFNumberSInt64Type , inRange ) //CFDictionaryAddValue( theDict, kRangeAsCFDataType, rangeCFData ) //CFDictionaryAddValue( theDict, kRangeAsCFNumberType, rangeCFNumber ) CFDictionarySetValue( theDict, kRangeAsCFDataType, rangeCFData ) CFDictionarySetValue( theDict, kRangeAsCFNumberType, rangeCFNumber ) CFRelease( rangeCFData ) CFRelease( rangeCFNumber ) end fn local fn GetRangeFromDictionary( theDict as CFMutableDictionaryRef ) '~'1 dim as CFRange rangeFromCFDataRef, rangeFromCFNumber dim as CFDataRef rangeDataRef fn CFNumberGetValue( fn CFDictionaryGetValue( theDict, kRangeAsCFNumberType ), _kCFNumberSInt64Type, @rangeFromCFNumber ) rangeDataRef = fn CFDictionaryGetValue( theDict, kRangeAsCFDataType ) CFDataGetBytes( rangeDataRef, fn CFRangeMake( 0, fn CFDataGetLength( rangeDataRef ) ), @rangeFromCFDataRef ) print print rangeFromCFNumber.location, rangeFromCFNumber.length, " --rangeFromCFNumber" print rangeFromCFDataRef.location, rangeFromCFDataRef.length, " --rangeFromCFDataRef" print end fn local fn TestDictionary '~'1 dim as CFRange inRange dim as CFMutableDictionaryRef theDict theDict = fn CreateDictionary inRange = fn CFRangeMake( 20,11 ) fn AddRangeToDictionary( theDict, inRange ) fn ConsoleCFPrint( theDict ) fn GetRangeFromDictionary( theDict ) inRange = fn CFRangeMake( -_maxLong,_maxLong ) fn AddRangeToDictionary( theDict, inRange ) fn ConsoleCFPrint( theDict ) fn GetRangeFromDictionary( theDict ) end fn fn TestDictionary