mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +00:00
Actually initialize _components dictionary before adding things to it.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31734 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
01bf8ae772
commit
168e5962a9
2 changed files with 17 additions and 13 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2010-12-14 Stefan Bidigaray <stefanbidi@gmail.com>
|
||||||
|
|
||||||
|
* Source/NSLocale.m: Initialize _components before using it and initilize
|
||||||
|
allLocales class variable in +initialize. Also stop adding blank entries
|
||||||
|
to _components dictionary.
|
||||||
|
|
||||||
2010-12-12 Stefan Bidigaray <stefanbidi@gmail.com>
|
2010-12-12 Stefan Bidigaray <stefanbidi@gmail.com>
|
||||||
|
|
||||||
* Headers/Foundation/NSLocale.h: Added missing constant.
|
* Headers/Foundation/NSLocale.h: Added missing constant.
|
||||||
|
|
|
@ -307,6 +307,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
||||||
if (self == [NSLocale class])
|
if (self == [NSLocale class])
|
||||||
{
|
{
|
||||||
classLock = [GSLazyRecursiveLock new];
|
classLock = [GSLazyRecursiveLock new];
|
||||||
|
allLocales = [[NSMutableDictionary alloc] initWithCapacity: 0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,7 +399,7 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
||||||
|
|
||||||
strLength =
|
strLength =
|
||||||
uloc_getLanguage (cLocaleId, buffer, ULOC_LANG_CAPACITY, &error);
|
uloc_getLanguage (cLocaleId, buffer, ULOC_LANG_CAPACITY, &error);
|
||||||
if (U_SUCCESS(error))
|
if (U_SUCCESS(error) && strLength)
|
||||||
{
|
{
|
||||||
[tmpDict setValue: [NSString stringWithUTF8String: buffer]
|
[tmpDict setValue: [NSString stringWithUTF8String: buffer]
|
||||||
forKey: NSLocaleLanguageCode];
|
forKey: NSLocaleLanguageCode];
|
||||||
|
@ -407,27 +408,27 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
||||||
|
|
||||||
strLength =
|
strLength =
|
||||||
uloc_getCountry (cLocaleId, buffer, ULOC_COUNTRY_CAPACITY, &error);
|
uloc_getCountry (cLocaleId, buffer, ULOC_COUNTRY_CAPACITY, &error);
|
||||||
if (U_SUCCESS(error))
|
if (U_SUCCESS(error) && strLength)
|
||||||
{
|
{
|
||||||
[tmpDict setObject: [NSString stringWithUTF8String: buffer]
|
[tmpDict setValue: [NSString stringWithUTF8String: buffer]
|
||||||
forKey: NSLocaleCountryCode];
|
forKey: NSLocaleCountryCode];
|
||||||
}
|
}
|
||||||
error = U_ZERO_ERROR;
|
error = U_ZERO_ERROR;
|
||||||
|
|
||||||
strLength =
|
strLength =
|
||||||
uloc_getScript (cLocaleId, buffer, ULOC_SCRIPT_CAPACITY, &error);
|
uloc_getScript (cLocaleId, buffer, ULOC_SCRIPT_CAPACITY, &error);
|
||||||
if (U_SUCCESS(error))
|
if (U_SUCCESS(error) && strLength)
|
||||||
{
|
{
|
||||||
[tmpDict setObject: [NSString stringWithUTF8String: buffer]
|
[tmpDict setValue: [NSString stringWithUTF8String: buffer]
|
||||||
forKey: NSLocaleScriptCode];
|
forKey: NSLocaleScriptCode];
|
||||||
}
|
}
|
||||||
error = U_ZERO_ERROR;
|
error = U_ZERO_ERROR;
|
||||||
|
|
||||||
strLength =
|
strLength =
|
||||||
uloc_getVariant (cLocaleId, buffer, ULOC_LANG_CAPACITY, &error);
|
uloc_getVariant (cLocaleId, buffer, ULOC_LANG_CAPACITY, &error);
|
||||||
if (U_SUCCESS(error))
|
if (U_SUCCESS(error) && strLength)
|
||||||
{
|
{
|
||||||
[tmpDict setObject: [NSString stringWithUTF8String: buffer]
|
[tmpDict setValue: [NSString stringWithUTF8String: buffer]
|
||||||
forKey: NSLocaleVariantCode];
|
forKey: NSLocaleVariantCode];
|
||||||
}
|
}
|
||||||
error = U_ZERO_ERROR;
|
error = U_ZERO_ERROR;
|
||||||
|
@ -614,7 +615,6 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
||||||
char buffer[ULOC_FULLNAME_CAPACITY];
|
char buffer[ULOC_FULLNAME_CAPACITY];
|
||||||
UErrorCode status = U_ZERO_ERROR;
|
UErrorCode status = U_ZERO_ERROR;
|
||||||
|
|
||||||
int32_t length =
|
|
||||||
uloc_getLocaleForLCID (lcid, buffer, ULOC_FULLNAME_CAPACITY, &status);
|
uloc_getLocaleForLCID (lcid, buffer, ULOC_FULLNAME_CAPACITY, &status);
|
||||||
if (U_FAILURE(status))
|
if (U_FAILURE(status))
|
||||||
return nil;
|
return nil;
|
||||||
|
@ -726,10 +726,6 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
[classLock lock];
|
[classLock lock];
|
||||||
if (nil == allLocales)
|
|
||||||
{
|
|
||||||
allLocales = [[NSMutableDictionary alloc] initWithCapacity: 0];
|
|
||||||
}
|
|
||||||
newLocale = [allLocales objectForKey: localeId];
|
newLocale = [allLocales objectForKey: localeId];
|
||||||
if (nil == newLocale)
|
if (nil == newLocale)
|
||||||
{
|
{
|
||||||
|
@ -743,6 +739,8 @@ static NSArray *_currencyCodesWithType (uint32_t currType)
|
||||||
}
|
}
|
||||||
[classLock unlock];
|
[classLock unlock];
|
||||||
|
|
||||||
|
_components = [[NSMutableDictionary alloc] initWithCapacity: 0];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue