OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * Copyright (C) 2009-2011, International Business Machines Corporation and | 3 * Copyright (C) 2009-2014, International Business Machines Corporation and |
4 * others. All Rights Reserved. | 4 * others. All Rights Reserved. |
5 ******************************************************************************* | 5 ******************************************************************************* |
6 */ | 6 */ |
7 | 7 |
8 #include "unicode/currpinf.h" | 8 #include "unicode/currpinf.h" |
9 | 9 |
10 #if !UCONFIG_NO_FORMATTING | 10 #if !UCONFIG_NO_FORMATTING |
11 | 11 |
12 //#define CURRENCY_PLURAL_INFO_DEBUG 1 | 12 //#define CURRENCY_PLURAL_INFO_DEBUG 1 |
13 | 13 |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 } | 331 } |
332 | 332 |
333 | 333 |
334 | 334 |
335 void | 335 void |
336 CurrencyPluralInfo::deleteHash(Hashtable* hTable) | 336 CurrencyPluralInfo::deleteHash(Hashtable* hTable) |
337 { | 337 { |
338 if ( hTable == NULL ) { | 338 if ( hTable == NULL ) { |
339 return; | 339 return; |
340 } | 340 } |
341 int32_t pos = -1; | 341 int32_t pos = UHASH_FIRST; |
342 const UHashElement* element = NULL; | 342 const UHashElement* element = NULL; |
343 while ( (element = hTable->nextElement(pos)) != NULL ) { | 343 while ( (element = hTable->nextElement(pos)) != NULL ) { |
344 const UHashTok valueTok = element->value; | 344 const UHashTok valueTok = element->value; |
345 const UnicodeString* value = (UnicodeString*)valueTok.pointer; | 345 const UnicodeString* value = (UnicodeString*)valueTok.pointer; |
346 delete value; | 346 delete value; |
347 } | 347 } |
348 delete hTable; | 348 delete hTable; |
349 hTable = NULL; | 349 hTable = NULL; |
350 } | 350 } |
351 | 351 |
(...skipping 17 matching lines...) Expand all Loading... |
369 } | 369 } |
370 | 370 |
371 | 371 |
372 void | 372 void |
373 CurrencyPluralInfo::copyHash(const Hashtable* source, | 373 CurrencyPluralInfo::copyHash(const Hashtable* source, |
374 Hashtable* target, | 374 Hashtable* target, |
375 UErrorCode& status) { | 375 UErrorCode& status) { |
376 if ( U_FAILURE(status) ) { | 376 if ( U_FAILURE(status) ) { |
377 return; | 377 return; |
378 } | 378 } |
379 int32_t pos = -1; | 379 int32_t pos = UHASH_FIRST; |
380 const UHashElement* element = NULL; | 380 const UHashElement* element = NULL; |
381 if ( source ) { | 381 if ( source ) { |
382 while ( (element = source->nextElement(pos)) != NULL ) { | 382 while ( (element = source->nextElement(pos)) != NULL ) { |
383 const UHashTok keyTok = element->key; | 383 const UHashTok keyTok = element->key; |
384 const UnicodeString* key = (UnicodeString*)keyTok.pointer; | 384 const UnicodeString* key = (UnicodeString*)keyTok.pointer; |
385 const UHashTok valueTok = element->value; | 385 const UHashTok valueTok = element->value; |
386 const UnicodeString* value = (UnicodeString*)valueTok.pointer; | 386 const UnicodeString* value = (UnicodeString*)valueTok.pointer; |
387 UnicodeString* copy = new UnicodeString(*value); | 387 UnicodeString* copy = new UnicodeString(*value); |
388 target->put(UnicodeString(*key), copy, status); | 388 target->put(UnicodeString(*key), copy, status); |
389 if ( U_FAILURE(status) ) { | 389 if ( U_FAILURE(status) ) { |
390 return; | 390 return; |
391 } | 391 } |
392 } | 392 } |
393 } | 393 } |
394 } | 394 } |
395 | 395 |
396 | 396 |
397 U_NAMESPACE_END | 397 U_NAMESPACE_END |
398 | 398 |
399 #endif | 399 #endif |
OLD | NEW |