light tidying

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39568 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2016-03-20 11:53:01 +00:00
parent bc2927bd2d
commit 1ee226b495
2 changed files with 37 additions and 32 deletions

View file

@ -856,8 +856,9 @@ static NSRecursiveLock *classLock = nil;
- (BOOL) isEqual: (id)obj - (BOOL) isEqual: (id)obj
{ {
if ([obj isKindOfClass: [self class]]) if ([obj isKindOfClass: [self class]])
{
return [_localeId isEqual: [obj localeIdentifier]]; return [_localeId isEqual: [obj localeIdentifier]];
}
return NO; return NO;
} }
@ -1057,7 +1058,6 @@ static NSRecursiveLock *classLock = nil;
[nFor setLocale: self]; [nFor setLocale: self];
[nFor setNumberStyle: NSNumberFormatterDecimalStyle]; [nFor setNumberStyle: NSNumberFormatterDecimalStyle];
result = [nFor decimalSeparator]; result = [nFor decimalSeparator];
RELEASE(nFor); RELEASE(nFor);
return result; return result;
} }
@ -1071,7 +1071,6 @@ static NSRecursiveLock *classLock = nil;
[nFor setLocale: self]; [nFor setLocale: self];
[nFor setNumberStyle: NSNumberFormatterDecimalStyle]; [nFor setNumberStyle: NSNumberFormatterDecimalStyle];
result = [nFor groupingSeparator]; result = [nFor groupingSeparator];
RELEASE(nFor); RELEASE(nFor);
return result; return result;
} }

View file

@ -1523,17 +1523,18 @@ static NSUInteger _defaultBehavior = NSNumberFormatterBehavior10_4;
return internal->_genDecimal; // FIXME return internal->_genDecimal; // FIXME
} }
- (void) setLocale: (NSLocale *)locale - (void) setLocale: (NSLocale *)locale
{ {
RELEASE(internal->_locale); if (nil == locale)
{
if (locale == nil)
locale = [NSLocale currentLocale]; locale = [NSLocale currentLocale];
internal->_locale = RETAIN(locale); }
if (NO == [locale isEqual: internal->_locale])
{
ASSIGN(internal->_locale, locale);
[self _resetUNumberFormat]; [self _resetUNumberFormat];
} }
}
- (NSLocale *) locale - (NSLocale *) locale
{ {
@ -2143,15 +2144,16 @@ static NSUInteger _defaultBehavior = NSNumberFormatterBehavior10_4;
int32_t idx; int32_t idx;
if (internal->_formatter) if (internal->_formatter)
{
unum_close(internal->_formatter); unum_close(internal->_formatter);
}
cLocaleId = [[internal->_locale localeIdentifier] UTF8String]; cLocaleId = [[internal->_locale localeIdentifier] UTF8String];
style = NSToICUFormatStyle (internal->_style); style = NSToICUFormatStyle (internal->_style);
internal->_formatter = unum_open (style, NULL, 0, cLocaleId, NULL, &err); internal->_formatter = unum_open (style, NULL, 0, cLocaleId, NULL, &err);
if (U_FAILURE(err)) if (U_FAILURE(err))
{
internal->_formatter = NULL; internal->_formatter = NULL;
}
// Reset all properties // Reset all properties
for (idx = 0; idx < MAX_SYMBOLS; ++idx) for (idx = 0; idx < MAX_SYMBOLS; ++idx)
{ {
@ -2159,7 +2161,9 @@ static NSUInteger _defaultBehavior = NSNumberFormatterBehavior10_4;
{ {
length = [internal->_symbols[idx] length]; length = [internal->_symbols[idx] length];
if (length > BUFFER_SIZE) if (length > BUFFER_SIZE)
{
length = BUFFER_SIZE; length = BUFFER_SIZE;
}
[internal->_symbols[idx] getCharacters: buffer [internal->_symbols[idx] getCharacters: buffer
range: NSMakeRange (0, length)]; range: NSMakeRange (0, length)];
unum_setSymbol (internal->_formatter, idx, buffer, length, &err); unum_setSymbol (internal->_formatter, idx, buffer, length, &err);
@ -2172,7 +2176,9 @@ static NSUInteger _defaultBehavior = NSNumberFormatterBehavior10_4;
{ {
length = [internal->_textAttributes[idx] length]; length = [internal->_textAttributes[idx] length];
if (length > BUFFER_SIZE) if (length > BUFFER_SIZE)
{
length = BUFFER_SIZE; length = BUFFER_SIZE;
}
[internal->_textAttributes[idx] getCharacters: buffer [internal->_textAttributes[idx] getCharacters: buffer
range: NSMakeRange (0, length)]; range: NSMakeRange (0, length)];
unum_setTextAttribute unum_setTextAttribute