mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-21569 Remove extra LocalUResourceBundlePointer
Remove LocalUResourceBundlePointer fDictRes which shadowed the real UUResourceBundle*. ICU-21569 fix assert
This commit is contained in:
parent
cfefa03539
commit
b96a806c8f
1 changed files with 7 additions and 6 deletions
|
@ -408,18 +408,19 @@ LSTMData::LSTMData(UResourceBundle* rb, UErrorCode &status)
|
|||
int32_t data_len = 0;
|
||||
const int32_t* data = ures_getIntVector(fDataRes, &data_len, &status);
|
||||
if (U_FAILURE(status)) return;
|
||||
LocalUResourceBundlePointer fDictRes(
|
||||
ures_getByKey(rb, "dict", nullptr, &status));
|
||||
int32_t num_index = ures_getSize(fDictRes.getAlias());
|
||||
fDictRes = ures_getByKey(rb, "dict", nullptr, &status);
|
||||
if (U_FAILURE(status)) return;
|
||||
U_ASSERT(fDictRes != nullptr);
|
||||
int32_t num_index = ures_getSize(fDictRes);
|
||||
fDict = uhash_open(uhash_hashUChars, uhash_compareUChars, nullptr, &status);
|
||||
if (U_FAILURE(status)) return;
|
||||
|
||||
ures_resetIterator(fDictRes.getAlias());
|
||||
ures_resetIterator(fDictRes);
|
||||
int32_t idx = 0;
|
||||
// put dict into hash
|
||||
while(ures_hasNext(fDictRes.getAlias())) {
|
||||
while(ures_hasNext(fDictRes)) {
|
||||
const char *tempKey = nullptr;
|
||||
const UChar* str = ures_getNextString(fDictRes.getAlias(), nullptr, &tempKey, &status);
|
||||
const UChar* str = ures_getNextString(fDictRes, nullptr, &tempKey, &status);
|
||||
if (U_FAILURE(status)) return;
|
||||
uhash_putiAllowZero(fDict, (void*)str, idx++, &status);
|
||||
if (U_FAILURE(status)) return;
|
||||
|
|
Loading…
Add table
Reference in a new issue