mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-01 22:56:17 +00:00
Fixed: Encoding a [CPDecimalNumber zero] causes a corrupt CPDecimalNumber after decoding
Previously, CPNumber and CPDecimalNumber shared the same method UID and CPNumberUIDs-Dictionary. This leads to some unexpected errors for example a [CPDecimalNumber zero] which refers to itself after decoding. CPDecimalNumber now overwrites the method UID and has its own UID-Dictionary. Fixes #2332
This commit is contained in:
@@ -28,6 +28,8 @@
|
||||
// The default global behavior class, created lazily
|
||||
var CPDefaultDcmHandler = nil;
|
||||
|
||||
var CPDecimalNumberUIDs = new CFMutableDictionary();
|
||||
|
||||
/*!
|
||||
@class CPDecimalNumberHandler
|
||||
@ingroup foundation
|
||||
@@ -531,6 +533,20 @@ var CPDecimalNumberHandlerRoundingModeKey = @"CPDecimalNumberHandlerRoundi
|
||||
}
|
||||
|
||||
// instance methods
|
||||
|
||||
- (CPString)UID
|
||||
{
|
||||
var UID = CPDecimalNumberUIDs.valueForKey(self);
|
||||
|
||||
if (!UID)
|
||||
{
|
||||
UID = objj_generateObjectUID();
|
||||
CPDecimalNumberUIDs.setValueForKey(self, UID);
|
||||
}
|
||||
|
||||
return UID + "";
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a new CPDecimalNumber object with the result of the summation of
|
||||
the receiver object and \c decimalNumber. If overflow occurs then the
|
||||
|
||||
Reference in New Issue
Block a user