diff --git a/ChangeLog b/ChangeLog index e60c7741f..dc27e5309 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-26 Eric Wasylishen + + * Source/NSNumberFormatter.m: Move the body of -init to a method called + -_NSNumberFormatterInit, and call this in -initWithCoder: so that + instances created with -initWithCoder: are initialized correctly. + 2011-04-26 Eric Wasylishen * Headers/Foundation/NSObjCRuntime.h: Add CGFLOAT_MIN and CGFLOAT_MAX diff --git a/Source/NSNumberFormatter.m b/Source/NSNumberFormatter.m index 0165ec7a5..e716cd529 100644 --- a/Source/NSNumberFormatter.m +++ b/Source/NSNumberFormatter.m @@ -613,14 +613,12 @@ static NSUInteger _defaultBehavior = NSNumberFormatterBehavior10_4; return _hasThousandSeparators; } -- (id) init +- (id) _NSNumberFormatterInit { id o; int idx; NSZone *z = [self zone]; - GS_CREATE_INTERNAL(NSNumberFormatter) - _allowsFloats = YES; _decimalSeparator = '.'; _thousandSeparator = ','; @@ -660,6 +658,14 @@ static NSUInteger _defaultBehavior = NSNumberFormatterBehavior10_4; #endif [self setMaximumFractionDigits: 0]; + return self; +} + +- (id) init +{ + GS_CREATE_INTERNAL(NSNumberFormatter) + + self = [self _NSNumberFormatterInit]; return self; } @@ -668,6 +674,8 @@ static NSUInteger _defaultBehavior = NSNumberFormatterBehavior10_4; { GS_CREATE_INTERNAL(NSNumberFormatter) + self = [self _NSNumberFormatterInit]; + if ([decoder allowsKeyedCoding]) { if ([decoder containsValueForKey: @"NS.allowsfloats"])