Add a hack to reset formatter properties along with the formatter itself. This can't be the best way to go about this so feel free to provide input for a better solution. Also added 2 missing unlocks in NSLocale.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32535 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Stefan Bidigaray 2011-03-12 14:22:21 +00:00
parent 98c6309213
commit 0b402994bb
3 changed files with 336 additions and 222 deletions

View file

@ -1,3 +1,9 @@
2011-03-12 Stefan Bidigaray <stefanbidi@gmail.com>
* Source/NSNumberFormatter.m: Cache property values and reset them
along with the formatter.
* Source/NSLocale.m: Add 2 missing unlocks.
2011-03-11 Richard Frith-Macdonald <rfm@gnu.org> 2011-03-11 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSBlocks.m: Added header * Source/GSBlocks.m: Added header

View file

@ -475,22 +475,23 @@ static NSRecursiveLock *classLock = nil;
if (nil == countries) if (nil == countries)
{ {
#if GS_USE_ICU == 1
[classLock lock]; [classLock lock];
if (nil == countries) if (nil == countries)
{ {
#if GS_USE_ICU == 1 NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity: 10];
NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity: 10]; const char *const *codes = uloc_getISOCountries ();
const char *const *codes = uloc_getISOCountries ();
while (codes != NULL) while (codes != NULL)
{ {
[array addObject: [NSString stringWithUTF8String: *codes]]; [array addObject: [NSString stringWithUTF8String: *codes]];
++codes; ++codes;
} }
countries = [[NSArray alloc] initWithArray: array]; countries = [[NSArray alloc] initWithArray: array];
[array release]; [array release];
}
[classLock unlock];
#endif #endif
}
} }
return [[countries copy] autorelease]; return [[countries copy] autorelease];
} }
@ -501,22 +502,23 @@ static NSRecursiveLock *classLock = nil;
if (nil == languages) if (nil == languages)
{ {
#if GS_USE_ICU == 1
[classLock lock]; [classLock lock];
if (nil == languages) if (nil == languages)
{ {
#if GS_USE_ICU == 1 NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity: 10];
NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity: 10]; const char *const *codes = uloc_getISOCountries ();
const char *const *codes = uloc_getISOCountries ();
while (codes != NULL) while (codes != NULL)
{ {
[array addObject: [NSString stringWithUTF8String: *codes]]; [array addObject: [NSString stringWithUTF8String: *codes]];
++codes; ++codes;
} }
languages = [[NSArray alloc] initWithArray: array]; languages = [[NSArray alloc] initWithArray: array];
[array release]; [array release];
}
[classLock unlock];
#endif #endif
}
} }
return [[languages copy] autorelease]; return [[languages copy] autorelease];
} }

File diff suppressed because it is too large Load diff