New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-439] Cached floating-point CF values do not bridge #4183
Comments
This may be a simpler demonstration: var floatVal : Double = 1.0
let cf = CFNumberCreate(kCFAllocatorSystemDefault, kCFNumberFloat64Type, &floatVal)!
print("\(cf)")
print("\(cf.dynamicType)") returns: <CFNumber 0x7f4197cbbff8 [0x7f4197cbb848]>{value = +1.00000000000000000000, type = kCFNumberFloat64Type}
__NSCFType changing floatVal to 1.01 returns: 1.01
NSNumber |
Also an issue for 32-bit floats. |
Ah, it's not to do with integer-ness, it's caching – kCFNumberFloat32Zero/kCFNumberFloat32One are not being bridged correctly. CFGetTypeID() returns 0. |
I'm going to take a punt on the problem being that the cached objects are created before Obviously a quick workaround would be to add explicit bridges for floating point 0/1 in |
Patch in #207 |
integrated in c9e528a |
Additional Detail from JIRA
md5: 2aa412194ae7a2adb1b033486a975c53
relates to:
Issue Description:
Noticed this whilst working on NSKeyedUnarchiver.
Decoding <real> values that are integers is stomping on a CFNumber somewhere (looks like the isa pointer is invalid, as a result it fails to cast to a NSNumber and
_expensivePropertyListConversion()
fails).The text was updated successfully, but these errors were encountered: