X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/249c4c5ea9376c24572daf9c2effa7484a282f14..3d1f044b704633e2e541231cd17ae9ecf9ad5c7a:/icuSources/common/locavailable.cpp diff --git a/icuSources/common/locavailable.cpp b/icuSources/common/locavailable.cpp index 8782d0c7..5f06aff3 100644 --- a/icuSources/common/locavailable.cpp +++ b/icuSources/common/locavailable.cpp @@ -125,8 +125,6 @@ static UBool U_CALLCONV uloc_cleanup(void) { // via the initOnce mechanism. static void U_CALLCONV loadInstalledLocales() { - UResourceBundle *indexLocale = NULL; - UResourceBundle installed; UErrorCode status = U_ZERO_ERROR; int32_t i = 0; int32_t localeCount; @@ -135,25 +133,25 @@ static void U_CALLCONV loadInstalledLocales() { U_ASSERT(_installedLocalesCount == 0); _installedLocalesCount = 0; - ures_initStackObject(&installed); - indexLocale = ures_openDirect(NULL, _kIndexLocaleName, &status); - ures_getByKey(indexLocale, _kIndexTag, &installed, &status); - + + icu::LocalUResourceBundlePointer indexLocale(ures_openDirect(NULL, _kIndexLocaleName, &status)); + icu::StackUResourceBundle installed; + + ures_getByKey(indexLocale.getAlias(), _kIndexTag, installed.getAlias(), &status); + if(U_SUCCESS(status)) { - localeCount = ures_getSize(&installed); + localeCount = ures_getSize(installed.getAlias()); _installedLocales = (char **) uprv_malloc(sizeof(char*) * (localeCount+1)); if (_installedLocales != NULL) { - ures_resetIterator(&installed); - while(ures_hasNext(&installed)) { - ures_getNextString(&installed, NULL, (const char **)&_installedLocales[i++], &status); + ures_resetIterator(installed.getAlias()); + while(ures_hasNext(installed.getAlias())) { + ures_getNextString(installed.getAlias(), NULL, (const char **)&_installedLocales[i++], &status); } _installedLocales[i] = NULL; _installedLocalesCount = localeCount; ucln_common_registerCleanup(UCLN_COMMON_ULOC, uloc_cleanup); } } - ures_close(&installed); - ures_close(indexLocale); } static void _load_installedLocales()