ICU-4156 Test and fix getAvailableLocales for service registration.

X-SVN-Rev: 16622
This commit is contained in:
George Rhoten 2004-10-25 23:38:08 +00:00
parent 5c97ee7892
commit fd0d950183
3 changed files with 10 additions and 7 deletions

View File

@ -616,7 +616,7 @@ ICUService::getVisibleIDs(UVector& result, const UnicodeString* matchID, UErrorC
if (map != NULL) {
ICUServiceKey* fallbackKey = createKey(matchID, status);
for (int32_t pos = 0;;) {
for (int32_t pos = -1;;) {
const UHashElement* e = map->nextElement(pos);
if (e == NULL) {
break;

View File

@ -71,12 +71,15 @@
* to 2.18; the inverse ratio ranges from 0.459 to 0.552.) If this
* ratio is changed, the low and high water ratios should also be
* adjusted to suit.
*
* These prime numbers were also chosen so that they are the largest
* prime number while being less than a power of two.
*/
static const int32_t PRIMES[] = {
17, 37, 67, 131, 257, 521, 1031, 2053, 4099, 8209, 16411, 32771,
65537, 131101, 262147, 524309, 1048583, 2097169, 4194319, 8388617,
16777259, 33554467, 67108879, 134217757, 268435459, 536870923,
1073741827, 2147483647
13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749,
65521, 131071, 262139, 524287, 1048573, 2097143, 4194301, 8388593,
16777213, 33554393, 67108859, 134217689, 268435399, 536870909,
1073741789, 2147483647 /*, 4294967291 */
};
#define PRIMES_LENGTH (sizeof(PRIMES) / sizeof(PRIMES[0]))
@ -457,7 +460,7 @@ uhash_tokp(void* p) {
int32_t hash = 0; \
const TYPE *p = (const TYPE*) STR; \
if (p != NULL) { \
int32_t len = (int32_t)(STRLEN); \
int32_t len = (int32_t)(STRLEN); \
int32_t inc = ((len - 32) / 32) + 1; \
const TYPE *limit = p + len; \
while (p<limit) { \

View File

@ -1164,7 +1164,7 @@ void ICUServiceTest::testLocale() {
UErrorCode status = U_ZERO_ERROR;
StringEnumeration* locales = service.getAvailableLocales();
if (locales) {
confirmIdentical("test available locales", locales->count(status), 5);
confirmIdentical("test available locales", locales->count(status), 6);
logln("locales: ");
{
const char* p;