ICU-2821 changes based on alan's review

X-SVN-Rev: 12229
This commit is contained in:
Doug Felt 2003-06-02 22:25:08 +00:00
parent 265ed564e0
commit 7259965261
3 changed files with 30 additions and 13 deletions

View file

@ -434,8 +434,9 @@ getService(void)
}
if (newservice) {
delete newservice;
} else {
ucln_i18n_registerCleanup();
}
ucln_i18n_registerCleanup();
}
return gService;
}
@ -458,7 +459,12 @@ NumberFormat::createInstance(const Locale& loc, EStyles kind, UErrorCode& status
URegistryKey
NumberFormat::registerFactory(NumberFormatFactory* toAdopt, UErrorCode& status)
{
return getService()->registerFactory(new NFFactory(toAdopt), status);
ICULocaleService *service = getService();
if (service) {
return service->registerFactory(new NFFactory(toAdopt), status);
}
status = U_MEMORY_ALLOCATION_ERROR;
return NULL;
}
// -------------------------------------
@ -479,7 +485,11 @@ NumberFormat::unregister(URegistryKey key, UErrorCode& status)
StringEnumeration*
NumberFormat::getAvailableLocales(void)
{
return getService()->getAvailableLocales();
ICULocaleService *service = getService();
if (service) {
return service->getAvailableLocales();
}
return NULL; // no way to return error condition
}
// -------------------------------------

View file

@ -129,12 +129,10 @@ _findMetaData(const UChar* currency) {
// don't use ICUService since we don't need fallback
struct CReg;
static UMTX gCRegLock = 0;
static CReg* gCRegHead = 0;
struct CReg : public UMemory {
static UMTX gCRegLock;
static CReg* gCRegHead;
CReg *next;
UChar iso[4];
char id[12];
@ -211,8 +209,12 @@ struct CReg : public UMemory {
}
umtx_destroy(&gCRegLock);
}
};
UMTX CReg::gCRegLock = 0;
CReg* CReg:: gCRegHead = 0;
// -------------------------------------
static void

View file

@ -4,7 +4,7 @@
* Corporation and others. All Rights Reserved.
**********************************************************************
* $Source: /xsrl/Nsvn/icu/icu/source/i18n/unicode/ucurr.h,v $
* $Revision: 1.7 $
* $Revision: 1.8 $
**********************************************************************
*/
#ifndef _UCURR_H_
@ -70,10 +70,13 @@ typedef enum UCurrNameStyle {
/**
* Register an (existing) ISO 4217 currency code for the given locale.
* Only the country code and the two variants EURO and PRE_EURO are
* recognized.
* @param isoCode the three-letter ISO 4217 currency code
* @param locale the locale for which to register this currency code
* @param status the in/out status code, no special meanings are assigned
* @return a registry key that can be used to unregister this currency code
* @param status the in/out status code
* @return a registry key that can be used to unregister this currency code, or NULL
* if there was an error.
* @draft ICU 2.6
*/
U_CAPI UCurrRegistryKey U_EXPORT2
@ -83,8 +86,10 @@ U_CAPI UCurrRegistryKey U_EXPORT2
/**
* Unregister the previously-registered currency definitions using the
* URegistryKey returned from ucurr_register. Key becomes invalid after
* a successful call and should not be used again.
* @param key the retgistry key returned by a previous call to ucurr_register
* a successful call and should not be used again. Any currency
* that might have been hidden by the original ucurr_register call is
* restored.
* @param key the registry key returned by a previous call to ucurr_register
* @param status the in/out status code, no special meanings are assigned
* @return TRUE if the currency for this key was successfully unregistered
*/