mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
locale tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32006 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
54a0b3c49a
commit
bb1e98913d
2 changed files with 22 additions and 5 deletions
|
@ -1,3 +1,10 @@
|
|||
2011-02-07 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSLocale.m: Fix canonical identifiers to return the input
|
||||
string if no other value is found. Refrain from putting nil locale
|
||||
identifier in dictionary. Fix leak of components dictionary when
|
||||
returning an existing locale by id.
|
||||
|
||||
2011-02-04 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSConcretePointerFunctions.m: objects with weak memory should
|
||||
|
|
|
@ -273,9 +273,15 @@ static NSRecursiveLock *classLock = nil;
|
|||
[self _updateCanonicalLocales];
|
||||
|
||||
localeId = [canonicalLocales objectForKey: string];
|
||||
localeComps = [localeId componentsSeparatedByString: @"_"];
|
||||
result = [localeComps objectAtIndex: 0];
|
||||
|
||||
if (nil == localeId)
|
||||
{
|
||||
result = string;
|
||||
}
|
||||
else
|
||||
{
|
||||
localeComps = [localeId componentsSeparatedByString: @"_"];
|
||||
result = [localeComps objectAtIndex: 0];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -736,12 +742,18 @@ static NSRecursiveLock *classLock = nil;
|
|||
#else
|
||||
localeId = [NSLocale canonicalLocaleIdentifierFromString: string];
|
||||
#endif
|
||||
if (nil == localeId)
|
||||
{
|
||||
[self release];
|
||||
return nil;
|
||||
}
|
||||
|
||||
[classLock lock];
|
||||
newLocale = [allLocales objectForKey: localeId];
|
||||
if (nil == newLocale)
|
||||
{
|
||||
_localeId = [localeId copy];
|
||||
_components = [[NSMutableDictionary alloc] initWithCapacity: 0];
|
||||
[allLocales setObject: self forKey: localeId];
|
||||
}
|
||||
else
|
||||
|
@ -750,8 +762,6 @@ static NSRecursiveLock *classLock = nil;
|
|||
self = [newLocale retain];
|
||||
}
|
||||
[classLock unlock];
|
||||
|
||||
_components = [[NSMutableDictionary alloc] initWithCapacity: 0];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue