#endif /* U_DEBUG */
-#define uprv_lengthof(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
+/**
+ * \def UPRV_LENGTHOF
+ * Convenience macro to determine the length of a fixed array at compile-time.
+ * @param array A fixed length array
+ * @return The length of the array, in elements
+ * @internal
+ */
+#define UPRV_LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
#define uprv_memset(buffer, mark, size) U_STANDARD_CPP_NAMESPACE memset(buffer, mark, size)
#define uprv_memcmp(buffer1, buffer2, size) U_STANDARD_CPP_NAMESPACE memcmp(buffer1, buffer2,size)
int32_t start = (int32_t)utext_getNativeIndex(text);
if (start != offset) {
offset = start;
- count = dict->matches(text, rangeEnd-start, uprv_lengthof(cuLengths), cuLengths, cpLengths, NULL, &prefix);
+ count = dict->matches(text, rangeEnd-start, UPRV_LENGTHOF(cuLengths), cuLengths, cpLengths, NULL, &prefix);
// Dictionary leaves text after longest prefix, not longest word. Back up.
if (count <= 0) {
utext_setNativeIndex(text, start);
int32_t offsets[2];
pat.format(
params,
- uprv_lengthof(params),
+ UPRV_LENGTHOF(params),
result,
offsets,
- uprv_lengthof(offsets),
+ UPRV_LENGTHOF(offsets),
errorCode);
if (U_FAILURE(errorCode)) {
return;
#ifdef DEBUG_TZNAME
fprintf(stderr, "TZ=%s std=%s dst=%s daylight=%d offset=%d\n", getenv("TZ"), stdID, dstID, daylightType, offset);
#endif
- for (idx = 0; idx < uprv_lengthof(OFFSET_ZONE_MAPPINGS); idx++)
+ for (idx = 0; idx < UPRV_LENGTHOF(OFFSET_ZONE_MAPPINGS); idx++)
{
if (offset == OFFSET_ZONE_MAPPINGS[idx].offsetSeconds
&& daylightType == OFFSET_ZONE_MAPPINGS[idx].daylightType
if (tableEl->fCharClass >= 128 && tableEl->fCharClass < 240 && // Table specs a char class &&
fC.fEscaped == FALSE && // char is not escaped &&
fC.fChar != (UChar32)-1) { // char is not EOF
- U_ASSERT((tableEl->fCharClass-128) < uprv_lengthof(fRuleSets));
+ U_ASSERT((tableEl->fCharClass-128) < UPRV_LENGTHOF(fRuleSets));
if (fRuleSets[tableEl->fCharClass-128].contains(fC.fChar)) {
// Table row specified a character class, or set of characters,
// and the current char matches it.
const UnicodeString *params[] = {&arg0};
return format(
params,
- uprv_lengthof(params),
+ UPRV_LENGTHOF(params),
appendTo,
NULL,
0,
const UnicodeString *params[] = {&arg0, &arg1};
return format(
params,
- uprv_lengthof(params),
+ UPRV_LENGTHOF(params),
appendTo,
NULL,
0,
const UnicodeString *params[] = {&arg0, &arg1, &arg2};
return format(
params,
- uprv_lengthof(params),
+ UPRV_LENGTHOF(params),
appendTo,
NULL,
0,
}
/* try all the other possible charsets */
- for(i = 0; i < uprv_lengthof(jpCharsetPref); ++i) {
+ for(i = 0; i < UPRV_LENGTHOF(jpCharsetPref); ++i) {
cs = (int8_t)jpCharsetPref[i];
if(CSM(cs) & csm) {
choices[choiceCount++] = cs;
}
gCommonDataCacheInitOnce.reset();
- for (i = 0; i < uprv_lengthof(gCommonICUDataArray) && gCommonICUDataArray[i] != NULL; ++i) {
+ for (i = 0; i < UPRV_LENGTHOF(gCommonICUDataArray) && gCommonICUDataArray[i] != NULL; ++i) {
udata_close(gCommonICUDataArray[i]);
gCommonICUDataArray[i] = NULL;
}
if (pData == NULL)
return FALSE;
- for (i = 0; i < uprv_lengthof(gCommonICUDataArray); ++i) {
+ for (i = 0; i < UPRV_LENGTHOF(gCommonICUDataArray); ++i) {
if ((gCommonICUDataArray[i] != NULL) && (gCommonICUDataArray[i]->pHeader == pData->pHeader)) {
/* The data pointer is already in the array. */
found = TRUE;
/* their locals. */
UDatamemory_assign(newCommonData, pData);
umtx_lock(NULL);
- for (i = 0; i < uprv_lengthof(gCommonICUDataArray); ++i) {
+ for (i = 0; i < UPRV_LENGTHOF(gCommonICUDataArray); ++i) {
if (gCommonICUDataArray[i] == NULL) {
gCommonICUDataArray[i] = newCommonData;
didUpdate = TRUE;
}
umtx_unlock(NULL);
- if (i == uprv_lengthof(gCommonICUDataArray) && warn) {
+ if (i == UPRV_LENGTHOF(gCommonICUDataArray) && warn) {
*pErr = U_USING_DEFAULT_WARNING;
}
if (didUpdate) {
/* ??????? TODO revisit this */
if (commonDataIndex >= 0) {
/* "mini-cache" for common ICU data */
- if(commonDataIndex >= uprv_lengthof(gCommonICUDataArray)) {
+ if(commonDataIndex >= UPRV_LENGTHOF(gCommonICUDataArray)) {
return NULL;
}
if(gCommonICUDataArray[commonDataIndex] == NULL) {
reslen += LANG_UND_LEN;
} else {
/* resolve deprecated */
- for (i = 0; i < uprv_lengthof(DEPRECATEDLANGS); i += 2) {
+ for (i = 0; i < UPRV_LENGTHOF(DEPRECATEDLANGS); i += 2) {
if (uprv_compareInvCharsAsAscii(buf, DEPRECATEDLANGS[i]) == 0) {
uprv_strcpy(buf, DEPRECATEDLANGS[i + 1]);
len = (int32_t)uprv_strlen(buf);
/* Return unknown if the table of names above is not up to
date. */
- if (cat >= uprv_lengthof(charCatNames)) {
+ if (cat >= UPRV_LENGTHOF(charCatNames)) {
return "unknown";
} else {
return charCatNames[cat];
calcExtNameSetsLengths(int32_t maxNameLength) {
int32_t i, length;
- for(i=0; i<uprv_lengthof(charCatNames); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(charCatNames); ++i) {
/*
* for each category, count the length of the category name
* plus 9=
We could use a binary search, or a trie, if
we really wanted to. */
- for (lower[i] = 0, cIdx = 0; cIdx < uprv_lengthof(charCatNames); ++cIdx) {
+ for (lower[i] = 0, cIdx = 0; cIdx < UPRV_LENGTHOF(charCatNames); ++cIdx) {
if (!uprv_strcmp(lower + 1, charCatNames[cIdx])) {
if (getCharCat(cp) == cIdx) {
/* guess some large but stack-friendly capacity */
UChar dest[2*UCASE_MAX_STRING_LENGTH];
int32_t destLength;
- destLength=u_strFoldCase(dest, uprv_lengthof(dest),
+ destLength=u_strFoldCase(dest, UPRV_LENGTHOF(dest),
nfd.getBuffer(), nfd.length(),
U_FOLD_CASE_DEFAULT, &errorCode);
return (UBool)(U_SUCCESS(errorCode) &&
static int32_t getHangulSyllableType(const IntProperty &/*prop*/, UChar32 c, UProperty /*which*/) {
/* see comments on gcbToHst[] above */
int32_t gcb=(int32_t)(u_getUnicodeProperties(c, 2)&UPROPS_GCB_MASK)>>UPROPS_GCB_SHIFT;
- if(gcb<uprv_lengthof(gcbToHst)) {
+ if(gcb<UPRV_LENGTHOF(gcbToHst)) {
return gcbToHst[gcb];
} else {
return U_HST_NOT_APPLICABLE;
(key!=gUnknownKey ?
/* its table key string is "%%CollationBin" */
0==ds->compareInvChars(ds, key, -1,
- gCollationBinKey, uprv_lengthof(gCollationBinKey)-1) :
+ gCollationBinKey, UPRV_LENGTHOF(gCollationBinKey)-1) :
/* its table key string is unknown but it looks like a collation binary */
ucol_looksLikeCollationBinary(ds, p+1, count))
) {
};
int32_t getScriptProps(UScriptCode script) {
- if (0 <= script && script < uprv_lengthof(SCRIPT_PROPS)) {
+ if (0 <= script && script < UPRV_LENGTHOF(SCRIPT_PROPS)) {
return SCRIPT_PROPS[script];
} else {
return 0;
}
/* Start of Arabic letter shaping part */
- if(outputSize<=uprv_lengthof(buffer)) {
- outputSize=uprv_lengthof(buffer);
+ if(outputSize<=UPRV_LENGTHOF(buffer)) {
+ outputSize=UPRV_LENGTHOF(buffer);
tempbuffer=buffer;
} else {
tempbuffer = (UChar *)uprv_malloc(outputSize*U_SIZEOF_UCHAR);
(dest>=src && dest<(src+srcLength)))
) {
/* overlap: provide a temporary destination buffer and later copy the result */
- if(destCapacity<=uprv_lengthof(buffer)) {
+ if(destCapacity<=UPRV_LENGTHOF(buffer)) {
/* the stack buffer is large enough */
temp=buffer;
} else {
/* correct sequence - all trail bytes have (b7..b6)==(10)? */
/* illegal is also set if count>=4 */
- U_ASSERT(illegal || count<uprv_lengthof(utf8_minLegal));
+ U_ASSERT(illegal || count<UPRV_LENGTHOF(utf8_minLegal));
if(illegal || c<utf8_minLegal[count] || U_IS_SURROGATE(c)) {
/* error handling */
/* don't go beyond this sequence */
newBlock=trie->index2Length;
newTop=newBlock+UTRIE2_INDEX_2_BLOCK_LENGTH;
- if(newTop>uprv_lengthof(trie->index2)) {
+ if(newTop>UPRV_LENGTHOF(trie->index2)) {
/*
* Should never occur.
* Either UTRIE2_MAX_BUILD_TIME_INDEX_LENGTH is incorrect,
char stackArray[256];
int32_t destCapacity;
char *destArray=dest.GetAppendBuffer(srcLength, srcLength+20,
- stackArray, uprv_lengthof(stackArray), &destCapacity);
+ stackArray, UPRV_LENGTHOF(stackArray), &destCapacity);
UBool disallowNonLDHDot=(options&UIDNA_USE_STD3_RULES)!=0;
int32_t i;
for(i=0;; ++i) {
int8_t i, length, errorLength;
UErrorCode localError = U_ZERO_ERROR;
- errorLength = (int8_t)uprv_lengthof(errorUChars);
+ errorLength = (int8_t)UPRV_LENGTHOF(errorUChars);
ucnv_getInvalidUChars(convto, errorUChars, &errorLength, &localError);
if (U_FAILURE(localError) || errorLength == 0) {
// need at least 1 so that we don't access beyond the length of fromoffsets[]
va_list ap;
#endif
UChar result[4096];
- int32_t resultLength = uprv_lengthof(result);
+ int32_t resultLength = UPRV_LENGTHOF(result);
if(gBundle == NULL)
{
#if UCONFIG_NO_FORMATTING
resultLength = sizeof(gNoFormatting) / U_SIZEOF_UCHAR;
- if((msgLen + resultLength) <= uprv_lengthof(result)) {
+ if((msgLen + resultLength) <= UPRV_LENGTHOF(result)) {
memcpy(result, msg, msgLen * U_SIZEOF_UCHAR);
memcpy(result + msgLen, gNoFormatting, resultLength);
resultLength += msgLen;
};
int32_t getReorderCode(const char *s) {
- for (int32_t i = 0; i < uprv_lengthof(collReorderCodes); ++i) {
+ for (int32_t i = 0; i < UPRV_LENGTHOF(collReorderCodes); ++i) {
if (uprv_stricmp(s, collReorderCodes[i]) == 0) {
return UCOL_REORDER_CODE_FIRST + i;
}
char value[1024]; // The reordering value could be long.
// Check for collation keywords that were already deprecated
// before any were supported in createInstance() (except for "collation").
- int32_t length = loc.getKeywordValue("colHiraganaQuaternary", value, uprv_lengthof(value), errorCode);
+ int32_t length = loc.getKeywordValue("colHiraganaQuaternary", value, UPRV_LENGTHOF(value), errorCode);
if (U_FAILURE(errorCode)) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return;
errorCode = U_UNSUPPORTED_ERROR;
return;
}
- length = loc.getKeywordValue("variableTop", value, uprv_lengthof(value), errorCode);
+ length = loc.getKeywordValue("variableTop", value, UPRV_LENGTHOF(value), errorCode);
if (U_FAILURE(errorCode)) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return;
if (errorCode == U_STRING_NOT_TERMINATED_WARNING) {
errorCode = U_ZERO_ERROR;
}
- for (int32_t i = 0; i < uprv_lengthof(collAttributes); ++i) {
- length = loc.getKeywordValue(collAttributes[i].name, value, uprv_lengthof(value), errorCode);
+ for (int32_t i = 0; i < UPRV_LENGTHOF(collAttributes); ++i) {
+ length = loc.getKeywordValue(collAttributes[i].name, value, UPRV_LENGTHOF(value), errorCode);
if (U_FAILURE(errorCode) || errorCode == U_STRING_NOT_TERMINATED_WARNING) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
if (length == 0) { continue; }
for (int32_t j = 0;; ++j) {
- if (j == uprv_lengthof(collAttributeValues)) {
+ if (j == UPRV_LENGTHOF(collAttributeValues)) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
}
}
}
- length = loc.getKeywordValue("colReorder", value, uprv_lengthof(value), errorCode);
+ length = loc.getKeywordValue("colReorder", value, UPRV_LENGTHOF(value), errorCode);
if (U_FAILURE(errorCode) || errorCode == U_STRING_NOT_TERMINATED_WARNING) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return;
int32_t codesLength = 0;
char *scriptName = value;
for (;;) {
- if (codesLength == uprv_lengthof(codes)) {
+ if (codesLength == UPRV_LENGTHOF(codes)) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
}
coll.setReorderCodes(codes, codesLength, errorCode);
}
- length = loc.getKeywordValue("kv", value, uprv_lengthof(value), errorCode);
+ length = loc.getKeywordValue("kv", value, UPRV_LENGTHOF(value), errorCode);
if (U_FAILURE(errorCode) || errorCode == U_STRING_NOT_TERMINATED_WARNING) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return;
if(U_FAILURE(errorCode)) { return NULL; }
ownedSettings.fastLatinOptions = CollationFastLatin::getOptions(
tailoring->data, ownedSettings,
- ownedSettings.fastLatinPrimaries, uprv_lengthof(ownedSettings.fastLatinPrimaries));
+ ownedSettings.fastLatinPrimaries, UPRV_LENGTHOF(ownedSettings.fastLatinPrimaries));
tailoring->rules = ruleString;
tailoring->rules.getTerminatedBuffer(); // ensure NUL-termination
tailoring->setVersion(base->version, rulesVersion);
int32_t options = inIndexes[IX_OPTIONS] & 0xffff;
uint16_t fastLatinPrimaries[CollationFastLatin::LATIN_LIMIT];
int32_t fastLatinOptions = CollationFastLatin::getOptions(
- tailoring.data, ts, fastLatinPrimaries, uprv_lengthof(fastLatinPrimaries));
+ tailoring.data, ts, fastLatinPrimaries, UPRV_LENGTHOF(fastLatinPrimaries));
if(options == ts.options && ts.variableTop != 0 &&
reorderCodesLength == ts.reorderCodesLength &&
uprv_memcmp(reorderCodes, ts.reorderCodes, reorderCodesLength * 4) == 0 &&
settings->fastLatinOptions = CollationFastLatin::getOptions(
tailoring.data, *settings,
- settings->fastLatinPrimaries, uprv_lengthof(settings->fastLatinPrimaries));
+ settings->fastLatinPrimaries, UPRV_LENGTHOF(settings->fastLatinPrimaries));
}
UBool U_CALLCONV
int32_t j = readWords(i + 1, raw);
if(j > i && rules->charAt(j) == 0x5d && !raw.isEmpty()) { // words end with ]
++j;
- for(int32_t pos = 0; pos < uprv_lengthof(positions); ++pos) {
+ for(int32_t pos = 0; pos < UPRV_LENGTHOF(positions); ++pos) {
if(raw == UnicodeString(positions[pos], -1, US_INV)) {
str.setTo((UChar)POS_LEAD).append((UChar)(POS_BASE + pos));
return j;
int32_t
CollationRuleParser::getReorderCode(const char *word) {
- for(int32_t i = 0; i < uprv_lengthof(gSpecialReorderCodes); ++i) {
+ for(int32_t i = 0; i < UPRV_LENGTHOF(gSpecialReorderCodes); ++i) {
if(uprv_stricmp(word, gSpecialReorderCodes[i]) == 0) {
return UCOL_REORDER_CODE_FIRST + i;
}
if (U_FAILURE(status)) {
return 0;
}
- int32_t firstIdx = formatStr.indexOf(kZero, uprv_lengthof(kZero), 0);
+ int32_t firstIdx = formatStr.indexOf(kZero, UPRV_LENGTHOF(kZero), 0);
// We must have 0's in format string.
if (firstIdx == -1) {
status = U_INTERNAL_PROGRAM_ERROR;
return 0;
}
- int32_t lastIdx = formatStr.lastIndexOf(kZero, uprv_lengthof(kZero), firstIdx);
+ int32_t lastIdx = formatStr.lastIndexOf(kZero, UPRV_LENGTHOF(kZero), firstIdx);
CDFUnit* unit = createCDFUnit(variant, log10Value, result, status);
if (U_FAILURE(status)) {
return 0;
const char *key=NULL;
int32_t i;
- UnicodeString defaultItemFormat(TRUE, UDATPG_ItemFormat, uprv_lengthof(UDATPG_ItemFormat)-1); // Read-only alias.
+ UnicodeString defaultItemFormat(TRUE, UDATPG_ItemFormat, UPRV_LENGTHOF(UDATPG_ItemFormat)-1); // Read-only alias.
err = U_ZERO_ERROR;
fNumerics->add(cp - (UChar32)u_getNumericValue(cp));
}
UScriptCode extensions[500];
- int32_t extensionsCount = uscript_getScriptExtensions(cp, extensions, uprv_lengthof(extensions), &status);
+ int32_t extensionsCount = uscript_getScriptExtensions(cp, extensions, UPRV_LENGTHOF(extensions), &status);
if (U_FAILURE(status)) {
return *this;
}
};
MeasureFormatCacheData::MeasureFormatCacheData() {
- for (int32_t i = 0; i < uprv_lengthof(currencyFormats); ++i) {
+ for (int32_t i = 0; i < UPRV_LENGTHOF(currencyFormats); ++i) {
currencyFormats[i] = NULL;
}
integerFormat = NULL;
}
MeasureFormatCacheData::~MeasureFormatCacheData() {
- for (int32_t i = 0; i < uprv_lengthof(currencyFormats); ++i) {
+ for (int32_t i = 0; i < UPRV_LENGTHOF(currencyFormats); ++i) {
delete currencyFormats[i];
}
delete integerFormat;
if (U_FAILURE(errorCode)) {
return 0;
}
- if (destCapacity < uprv_lengthof(gSubTypes)) {
+ if (destCapacity < UPRV_LENGTHOF(gSubTypes)) {
errorCode = U_BUFFER_OVERFLOW_ERROR;
- return uprv_lengthof(gSubTypes);
+ return UPRV_LENGTHOF(gSubTypes);
}
int32_t idx = 0;
- for (int32_t typeIdx = 0; typeIdx < uprv_lengthof(gTypes); ++typeIdx) {
+ for (int32_t typeIdx = 0; typeIdx < UPRV_LENGTHOF(gTypes); ++typeIdx) {
int32_t len = gOffsets[typeIdx + 1] - gOffsets[typeIdx];
for (int32_t subTypeIdx = 0; subTypeIdx < len; ++subTypeIdx) {
dest[idx].setTo(typeIdx, subTypeIdx);
++idx;
}
}
- U_ASSERT(idx == uprv_lengthof(gSubTypes));
- return uprv_lengthof(gSubTypes);
+ U_ASSERT(idx == UPRV_LENGTHOF(gSubTypes));
+ return UPRV_LENGTHOF(gSubTypes);
}
int32_t MeasureUnit::getAvailable(
if (U_FAILURE(errorCode)) {
return 0;
}
- int32_t typeIdx = binarySearch(gTypes, 0, uprv_lengthof(gTypes), type);
+ int32_t typeIdx = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), type);
if (typeIdx == -1) {
return 0;
}
StringEnumeration* MeasureUnit::getAvailableTypes(UErrorCode &errorCode) {
UEnumeration *uenum = uenum_openCharStringsEnumeration(
- gTypes, uprv_lengthof(gTypes), &errorCode);
+ gTypes, UPRV_LENGTHOF(gTypes), &errorCode);
if (U_FAILURE(errorCode)) {
uenum_close(uenum);
return NULL;
}
int32_t MeasureUnit::getIndexCount() {
- return gIndexes[uprv_lengthof(gIndexes) - 1];
+ return gIndexes[UPRV_LENGTHOF(gIndexes) - 1];
}
MeasureUnit *MeasureUnit::create(int typeId, int subTypeId, UErrorCode &status) {
}
void MeasureUnit::initTime(const char *timeId) {
- int32_t result = binarySearch(gTypes, 0, uprv_lengthof(gTypes), "duration");
+ int32_t result = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), "duration");
U_ASSERT(result != -1);
fTypeId = result;
result = binarySearch(gSubTypes, gOffsets[fTypeId], gOffsets[fTypeId + 1], timeId);
}
void MeasureUnit::initCurrency(const char *isoCurrency) {
- int32_t result = binarySearch(gTypes, 0, uprv_lengthof(gTypes), "currency");
+ int32_t result = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), "currency");
U_ASSERT(result != -1);
fTypeId = result;
result = binarySearch(
if (result != -1) {
fSubTypeId = result - gOffsets[fTypeId];
} else {
- uprv_strncpy(fCurrency, isoCurrency, uprv_lengthof(fCurrency));
+ uprv_strncpy(fCurrency, isoCurrency, UPRV_LENGTHOF(fCurrency));
}
}
"other", "zero", "one", "two", "few", "many"};
static int32_t getPluralIndex(const char *pluralForm) {
- int32_t len = uprv_lengthof(gPluralForms);
+ int32_t len = UPRV_LENGTHOF(gPluralForms);
for (int32_t i = 0; i < len; ++i) {
if (uprv_strcmp(pluralForm, gPluralForms[i]) == 0) {
return i;
}
QuantityFormatter::QuantityFormatter() {
- for (int32_t i = 0; i < uprv_lengthof(formatters); ++i) {
+ for (int32_t i = 0; i < UPRV_LENGTHOF(formatters); ++i) {
formatters[i] = NULL;
}
}
QuantityFormatter::QuantityFormatter(const QuantityFormatter &other) {
- for (int32_t i = 0; i < uprv_lengthof(formatters); ++i) {
+ for (int32_t i = 0; i < UPRV_LENGTHOF(formatters); ++i) {
if (other.formatters[i] == NULL) {
formatters[i] = NULL;
} else {
if (this == &other) {
return *this;
}
- for (int32_t i = 0; i < uprv_lengthof(formatters); ++i) {
+ for (int32_t i = 0; i < UPRV_LENGTHOF(formatters); ++i) {
delete formatters[i];
if (other.formatters[i] == NULL) {
formatters[i] = NULL;
}
QuantityFormatter::~QuantityFormatter() {
- for (int32_t i = 0; i < uprv_lengthof(formatters); ++i) {
+ for (int32_t i = 0; i < UPRV_LENGTHOF(formatters); ++i) {
delete formatters[i];
}
}
void QuantityFormatter::reset() {
- for (int32_t i = 0; i < uprv_lengthof(formatters); ++i) {
+ for (int32_t i = 0; i < UPRV_LENGTHOF(formatters); ++i) {
delete formatters[i];
formatters[i] = NULL;
}
fmt.format(quantity, formattedNumber, fpos, status);
const UnicodeString *params[1] = {&formattedNumber};
int32_t offsets[1];
- pattern->format(params, uprv_lengthof(params), appendTo, offsets, uprv_lengthof(offsets), status);
+ pattern->format(params, UPRV_LENGTHOF(params), appendTo, offsets, UPRV_LENGTHOF(offsets), status);
if (offsets[0] != -1) {
if (fpos.getBeginIndex() != 0 || fpos.getEndIndex() != 0) {
pos.setBeginIndex(fpos.getBeginIndex() + offsets[0]);
RuleBasedCollator::setFastLatinOptions(CollationSettings &ownedSettings) const {
ownedSettings.fastLatinOptions = CollationFastLatin::getOptions(
data, ownedSettings,
- ownedSettings.fastLatinPrimaries, uprv_lengthof(ownedSettings.fastLatinPrimaries));
+ ownedSettings.fastLatinPrimaries, UPRV_LENGTHOF(ownedSettings.fastLatinPrimaries));
}
UCollationResult
appendAttribute(result, 'F', getAttribute(UCOL_FRENCH_COLLATION, errorCode), errorCode);
}
// Note: UCOL_HIRAGANA_QUATERNARY_MODE is deprecated and never changes away from default.
- length = uloc_getKeywordValue(resultLocale, "collation", subtag, uprv_lengthof(subtag), &errorCode);
+ length = uloc_getKeywordValue(resultLocale, "collation", subtag, UPRV_LENGTHOF(subtag), &errorCode);
appendSubtag(result, 'K', subtag, length, errorCode);
- length = uloc_getLanguage(resultLocale, subtag, uprv_lengthof(subtag), &errorCode);
+ length = uloc_getLanguage(resultLocale, subtag, UPRV_LENGTHOF(subtag), &errorCode);
appendSubtag(result, 'L', subtag, length, errorCode);
if(attributeHasBeenSetExplicitly(UCOL_NORMALIZATION_MODE)) {
appendAttribute(result, 'N', getAttribute(UCOL_NORMALIZATION_MODE, errorCode), errorCode);
}
- length = uloc_getCountry(resultLocale, subtag, uprv_lengthof(subtag), &errorCode);
+ length = uloc_getCountry(resultLocale, subtag, UPRV_LENGTHOF(subtag), &errorCode);
appendSubtag(result, 'R', subtag, length, errorCode);
if(attributeHasBeenSetExplicitly(UCOL_STRENGTH)) {
appendAttribute(result, 'S', getAttribute(UCOL_STRENGTH, errorCode), errorCode);
}
- length = uloc_getVariant(resultLocale, subtag, uprv_lengthof(subtag), &errorCode);
+ length = uloc_getVariant(resultLocale, subtag, UPRV_LENGTHOF(subtag), &errorCode);
appendSubtag(result, 'V', subtag, length, errorCode);
- length = uloc_getScript(resultLocale, subtag, uprv_lengthof(subtag), &errorCode);
+ length = uloc_getScript(resultLocale, subtag, UPRV_LENGTHOF(subtag), &errorCode);
appendSubtag(result, 'Z', subtag, length, errorCode);
if(U_FAILURE(errorCode)) { return 0; }
//
//----------------------------------------------------------------------------
ScriptSet::ScriptSet() {
- for (uint32_t i=0; i<uprv_lengthof(bits); i++) {
+ for (uint32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
bits[i] = 0;
}
}
ScriptSet & ScriptSet::operator =(const ScriptSet &other) {
- for (uint32_t i=0; i<uprv_lengthof(bits); i++) {
+ for (uint32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
bits[i] = other.bits[i];
}
return *this;
UBool ScriptSet::operator == (const ScriptSet &other) const {
- for (uint32_t i=0; i<uprv_lengthof(bits); i++) {
+ for (uint32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
if (bits[i] != other.bits[i]) {
return FALSE;
}
ScriptSet &ScriptSet::Union(const ScriptSet &other) {
- for (uint32_t i=0; i<uprv_lengthof(bits); i++) {
+ for (uint32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
bits[i] |= other.bits[i];
}
return *this;
}
ScriptSet &ScriptSet::intersect(const ScriptSet &other) {
- for (uint32_t i=0; i<uprv_lengthof(bits); i++) {
+ for (uint32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
bits[i] &= other.bits[i];
}
return *this;
}
UBool ScriptSet::intersects(const ScriptSet &other) const {
- for (uint32_t i=0; i<uprv_lengthof(bits); i++) {
+ for (uint32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
if ((bits[i] & other.bits[i]) != 0) {
return true;
}
ScriptSet &ScriptSet::setAll() {
- for (uint32_t i=0; i<uprv_lengthof(bits); i++) {
+ for (uint32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
bits[i] = 0xffffffffu;
}
return *this;
ScriptSet &ScriptSet::resetAll() {
- for (uint32_t i=0; i<uprv_lengthof(bits); i++) {
+ for (uint32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
bits[i] = 0;
}
return *this;
// This bit counter is good for sparse numbers of '1's, which is
// very much the case that we will usually have.
int32_t count = 0;
- for (uint32_t i=0; i<uprv_lengthof(bits); i++) {
+ for (uint32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
uint32_t x = bits[i];
while (x > 0) {
count++;
int32_t ScriptSet::hashCode() const {
int32_t hash = 0;
- for (int32_t i=0; i<uprv_lengthof(bits); i++) {
+ for (int32_t i=0; i<UPRV_LENGTHOF(bits); i++) {
hash ^= bits[i];
}
return hash;
// Copy the type for lowercasing.
char type[16];
int32_t typeLength = uprv_strlen(collationType);
- if(typeLength >= uprv_lengthof(type)) {
+ if(typeLength >= UPRV_LENGTHOF(type)) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
// Fetch the collation type from the locale ID.
int32_t typeLength = requested.getKeywordValue("collation",
- type, uprv_lengthof(type) - 1, errorCode);
+ type, UPRV_LENGTHOF(type) - 1, errorCode);
if(U_FAILURE(errorCode)) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return;
ures_getByKeyWithFallback(collations, "default", NULL, &internalErrorCode));
int32_t length;
const UChar *s = ures_getString(def.getAlias(), &length, &internalErrorCode);
- if(U_SUCCESS(internalErrorCode) && 0 < length && length < uprv_lengthof(defaultType)) {
+ if(U_SUCCESS(internalErrorCode) && 0 < length && length < UPRV_LENGTHOF(defaultType)) {
u_UCharsToChars(s, defaultType, length + 1);
} else {
uprv_strcpy(defaultType, "standard");
&internalErrorCode));
int32_t length;
const UChar *s = ures_getString(def.getAlias(), &length, &internalErrorCode);
- if(U_SUCCESS(internalErrorCode) && length < uprv_lengthof(defaultType)) {
+ if(U_SUCCESS(internalErrorCode) && length < UPRV_LENGTHOF(defaultType)) {
u_UCharsToChars(s, defaultType, length + 1);
} else {
uprv_strcpy(defaultType, "standard");
static const char* const KEYWORDS[] = { "collation" };
-#define KEYWORD_COUNT uprv_lengthof(KEYWORDS)
+#define KEYWORD_COUNT UPRV_LENGTHOF(KEYWORDS)
U_CAPI UEnumeration* U_EXPORT2
ucol_getKeywords(UErrorCode *status) {
{
buffer = defaultBuffer;
bufferIndex = 0;
- bufferSize = uprv_lengthof(defaultBuffer);
+ bufferSize = UPRV_LENGTHOF(defaultBuffer);
}
RCEBuffer::~RCEBuffer()
{
buffer = defaultBuffer;
bufferIndex = 0;
- bufferSize = uprv_lengthof(defaultBuffer);
+ bufferSize = UPRV_LENGTHOF(defaultBuffer);
}
PCEBuffer::~PCEBuffer()
// If not, resolve CLDR canonical ID with resource data
UBool isInputCanonical = FALSE;
char id[ZID_KEY_MAX + 1];
- tzid.extract(0, 0x7fffffff, id, uprv_lengthof(id), US_INV);
+ tzid.extract(0, 0x7fffffff, id, UPRV_LENGTHOF(id), US_INV);
// replace '/' with ':'
char *p = id;
int32_t i;
- for(i=0; i<uprv_lengthof(currencyMap); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(currencyMap); ++i) {
if(strcmp(currency, currencyMap[i].currency)==0) {
break;
}
}
- if(i==uprv_lengthof(currencyMap)) {
+ if(i==UPRV_LENGTHOF(currencyMap)) {
// a more specific error code would be useful in a real application
errorCode=U_UNSUPPORTED_ERROR;
return;
// TODO: Using printf() here assumes that the runtime encoding is ASCII-friendly
// and can therefore be mixed with UTF-8
- for(i=0; i<uprv_lengthof(sampleLocaleIDs); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(sampleLocaleIDs); ++i) {
printf("show currency formatting (method for %s) in the locale \"%s\"\n",
useICU26API ? "ICU 2.6" : "before ICU 2.6",
sampleLocaleIDs[i]);
continue;
}
- for(j=0; j<uprv_lengthof(sampleCurrencies); ++j) {
+ for(j=0; j<UPRV_LENGTHOF(sampleCurrencies); ++j) {
printf(" - format currency \"%s\": ", sampleCurrencies[j]);
// set the actual currency to be formatted
compareIterators(&iter1, "UTF16Iterator", &iter2, "Lenient8Iterator_1");
/* test get/set state */
- length=uprv_lengthof(text)-1;
+ length=UPRV_LENGTHOF(text)-1;
uiter_setLenient8(&iter1, (const char*)bytes, -1);
testIteratorState(&iter1, &iter2, "Lenient8IteratorState", length/2);
testIteratorState(&iter1, &iter2, "Lenient8IteratorStatePlus1", length/2+1);
printf("\n* demo_utf_h_macros() -------------- ***\n\n");
- printUString("iterate forward through: ", input, uprv_lengthof(input));
- for(i=0; i<uprv_lengthof(input); /* U16_NEXT post-increments */) {
+ printUString("iterate forward through: ", input, UPRV_LENGTHOF(input));
+ for(i=0; i<UPRV_LENGTHOF(input); /* U16_NEXT post-increments */) {
/* Iterating forwards
Codepoint at offset 0: U+0061
Codepoint at offset 1: U+10000
Codepoint at offset 5: U+0062
*/
printf("Codepoint at offset %d: U+", i);
- U16_NEXT(input, i, uprv_lengthof(input), c);
+ U16_NEXT(input, i, UPRV_LENGTHOF(input), c);
printf("%04x\n", c);
}
isError=FALSE;
i=1; /* write position, gets post-incremented so needs to be in an l-value */
- U16_APPEND(input, i, uprv_lengthof(input), 0x0062, isError);
+ U16_APPEND(input, i, UPRV_LENGTHOF(input), 0x0062, isError);
- printUString("iterate backward through: ", input, uprv_lengthof(input));
- for(i=uprv_lengthof(input); i>0; /* U16_PREV pre-decrements */) {
+ printUString("iterate backward through: ", input, UPRV_LENGTHOF(input));
+ for(i=UPRV_LENGTHOF(input); i>0; /* U16_PREV pre-decrements */) {
U16_PREV(input, 0, i, c);
/* Iterating backwards
Codepoint at offset 5: U+0062
/* uppercase */
isError=FALSE;
- for(i=j=0; j<uprv_lengthof(buffer) && !isError; /* U16_NEXT post-increments */) {
+ for(i=j=0; j<UPRV_LENGTHOF(buffer) && !isError; /* U16_NEXT post-increments */) {
U16_NEXT(input, i, INT32_MAX, c); /* without length because NUL-terminated */
if(c==0) {
break; /* stop at terminating NUL, no need to terminate buffer */
}
c=u_toupper(c);
- U16_APPEND(buffer, j, uprv_lengthof(buffer), c, isError);
+ U16_APPEND(buffer, j, UPRV_LENGTHOF(buffer), c, isError);
}
printUString("simple-uppercased: ", buffer, j);
/* lowercase */
isError=FALSE;
- for(i=j=0; j<uprv_lengthof(buffer) && !isError; /* U16_NEXT post-increments */) {
+ for(i=j=0; j<UPRV_LENGTHOF(buffer) && !isError; /* U16_NEXT post-increments */) {
U16_NEXT(input, i, INT32_MAX, c); /* without length because NUL-terminated */
if(c==0) {
break; /* stop at terminating NUL, no need to terminate buffer */
}
c=u_tolower(c);
- U16_APPEND(buffer, j, uprv_lengthof(buffer), c, isError);
+ U16_APPEND(buffer, j, UPRV_LENGTHOF(buffer), c, isError);
}
printUString("simple-lowercased: ", buffer, j);
/* titlecase */
isError=FALSE;
- for(i=j=0; j<uprv_lengthof(buffer) && !isError; /* U16_NEXT post-increments */) {
+ for(i=j=0; j<UPRV_LENGTHOF(buffer) && !isError; /* U16_NEXT post-increments */) {
U16_NEXT(input, i, INT32_MAX, c); /* without length because NUL-terminated */
if(c==0) {
break; /* stop at terminating NUL, no need to terminate buffer */
}
c=u_totitle(c);
- U16_APPEND(buffer, j, uprv_lengthof(buffer), c, isError);
+ U16_APPEND(buffer, j, UPRV_LENGTHOF(buffer), c, isError);
}
printUString("simple-titlecased: ", buffer, j);
/* case-fold/default */
isError=FALSE;
- for(i=j=0; j<uprv_lengthof(buffer) && !isError; /* U16_NEXT post-increments */) {
+ for(i=j=0; j<UPRV_LENGTHOF(buffer) && !isError; /* U16_NEXT post-increments */) {
U16_NEXT(input, i, INT32_MAX, c); /* without length because NUL-terminated */
if(c==0) {
break; /* stop at terminating NUL, no need to terminate buffer */
}
c=u_foldCase(c, U_FOLD_CASE_DEFAULT);
- U16_APPEND(buffer, j, uprv_lengthof(buffer), c, isError);
+ U16_APPEND(buffer, j, UPRV_LENGTHOF(buffer), c, isError);
}
printUString("simple-case-folded/default: ", buffer, j);
/* case-fold/Turkic */
isError=FALSE;
- for(i=j=0; j<uprv_lengthof(buffer) && !isError; /* U16_NEXT post-increments */) {
+ for(i=j=0; j<UPRV_LENGTHOF(buffer) && !isError; /* U16_NEXT post-increments */) {
U16_NEXT(input, i, INT32_MAX, c); /* without length because NUL-terminated */
if(c==0) {
break; /* stop at terminating NUL, no need to terminate buffer */
}
c=u_foldCase(c, U_FOLD_CASE_EXCLUDE_SPECIAL_I);
- U16_APPEND(buffer, j, uprv_lengthof(buffer), c, isError);
+ U16_APPEND(buffer, j, UPRV_LENGTHOF(buffer), c, isError);
}
printUString("simple-case-folded/Turkic: ", buffer, j);
/* lowercase/English */
errorCode=U_ZERO_ERROR;
- length=u_strToLower(buffer, uprv_lengthof(buffer), input, -1, "en", &errorCode);
+ length=u_strToLower(buffer, UPRV_LENGTHOF(buffer), input, -1, "en", &errorCode);
if(U_SUCCESS(errorCode)) {
printUString("full-lowercased/en: ", buffer, length);
} else {
}
/* lowercase/Turkish */
errorCode=U_ZERO_ERROR;
- length=u_strToLower(buffer, uprv_lengthof(buffer), input, -1, "tr", &errorCode);
+ length=u_strToLower(buffer, UPRV_LENGTHOF(buffer), input, -1, "tr", &errorCode);
if(U_SUCCESS(errorCode)) {
printUString("full-lowercased/tr: ", buffer, length);
} else {
}
/* uppercase/English */
errorCode=U_ZERO_ERROR;
- length=u_strToUpper(buffer, uprv_lengthof(buffer), input, -1, "en", &errorCode);
+ length=u_strToUpper(buffer, UPRV_LENGTHOF(buffer), input, -1, "en", &errorCode);
if(U_SUCCESS(errorCode)) {
printUString("full-uppercased/en: ", buffer, length);
} else {
}
/* uppercase/Turkish */
errorCode=U_ZERO_ERROR;
- length=u_strToUpper(buffer, uprv_lengthof(buffer), input, -1, "tr", &errorCode);
+ length=u_strToUpper(buffer, UPRV_LENGTHOF(buffer), input, -1, "tr", &errorCode);
if(U_SUCCESS(errorCode)) {
printUString("full-uppercased/tr: ", buffer, length);
} else {
}
/* titlecase/English */
errorCode=U_ZERO_ERROR;
- length=u_strToTitle(buffer, uprv_lengthof(buffer), input, -1, NULL, "en", &errorCode);
+ length=u_strToTitle(buffer, UPRV_LENGTHOF(buffer), input, -1, NULL, "en", &errorCode);
if(U_SUCCESS(errorCode)) {
printUString("full-titlecased/en: ", buffer, length);
} else {
}
/* titlecase/Turkish */
errorCode=U_ZERO_ERROR;
- length=u_strToTitle(buffer, uprv_lengthof(buffer), input, -1, NULL, "tr", &errorCode);
+ length=u_strToTitle(buffer, UPRV_LENGTHOF(buffer), input, -1, NULL, "tr", &errorCode);
if(U_SUCCESS(errorCode)) {
printUString("full-titlecased/tr: ", buffer, length);
} else {
}
/* case-fold/default */
errorCode=U_ZERO_ERROR;
- length=u_strFoldCase(buffer, uprv_lengthof(buffer), input, -1, U_FOLD_CASE_DEFAULT, &errorCode);
+ length=u_strFoldCase(buffer, UPRV_LENGTHOF(buffer), input, -1, U_FOLD_CASE_DEFAULT, &errorCode);
if(U_SUCCESS(errorCode)) {
printUString("full-case-folded/default: ", buffer, length);
} else {
}
/* case-fold/Turkic */
errorCode=U_ZERO_ERROR;
- length=u_strFoldCase(buffer, uprv_lengthof(buffer), input, -1, U_FOLD_CASE_EXCLUDE_SPECIAL_I, &errorCode);
+ length=u_strFoldCase(buffer, UPRV_LENGTHOF(buffer), input, -1, U_FOLD_CASE_EXCLUDE_SPECIAL_I, &errorCode);
if(U_SUCCESS(errorCode)) {
printUString("full-case-folded/Turkic: ", buffer, length);
} else {
printf("length of short string copy: %d\n", two.length());
// set "one" to contain the 3 UChars from readonly
// this setTo() variant copies the characters
- one.setTo(readonly, uprv_lengthof(readonly));
+ one.setTo(readonly, UPRV_LENGTHOF(readonly));
// * UnicodeString with allocated contents
// build a longer string that will not fit into the object's buffer
- one+=UnicodeString(writeable, uprv_lengthof(writeable));
+ one+=UnicodeString(writeable, UPRV_LENGTHOF(writeable));
one+=one;
one+=one;
printf("length of longer string: %d\n", one.length());
// * UnicodeString using readonly-alias to a const UChar array
// construct a string that aliases a readonly buffer
- UnicodeString three(FALSE, readonly, uprv_lengthof(readonly));
+ UnicodeString three(FALSE, readonly, UPRV_LENGTHOF(readonly));
printUnicodeString("readonly-alias string: ", three);
// copy-on-write: any modification to the string results in
// a copy to either the internal buffer or to a newly allocated one
i, readonly[i]);
}
// setTo() readonly alias
- one.setTo(FALSE, writeable, uprv_lengthof(writeable));
+ one.setTo(FALSE, writeable, UPRV_LENGTHOF(writeable));
// copying the readonly-alias object with fastCopyFrom() (new in ICU 2.4)
// will readonly-alias the same buffer
two.fastCopyFrom(one);
one.getBuffer()==two.getBuffer());
// * UnicodeString using writeable-alias to a non-const UChar array
- UnicodeString four(writeable, uprv_lengthof(writeable), uprv_lengthof(writeable));
+ UnicodeString four(writeable, UPRV_LENGTHOF(writeable), UPRV_LENGTHOF(writeable));
printUnicodeString("writeable-alias string: ", four);
// a modification writes through to the buffer
four.setCharAt(1, 0x39);
"modification of string copy\n", i, writeable[i]);
}
// setTo() writeable alias, capacity==length
- one.setTo(writeable, uprv_lengthof(writeable), uprv_lengthof(writeable));
+ one.setTo(writeable, UPRV_LENGTHOF(writeable), UPRV_LENGTHOF(writeable));
// grow the string - it will not fit into the backing buffer any more
// and will get copied before modification
one.append((UChar)0x40);
// if we need it in the original buffer, then extract() to it
// extract() does not do anything if the string aliases that same buffer
// i=min(one.length(), length of array)
- if(one.length()<uprv_lengthof(writeable)) {
+ if(one.length()<UPRV_LENGTHOF(writeable)) {
i=one.length();
} else {
- i=uprv_lengthof(writeable);
+ i=UPRV_LENGTHOF(writeable);
}
one.extract(0, i, writeable);
- for(i=0; i<uprv_lengthof(writeable); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(writeable); ++i) {
printf("writeable-alias backing buffer[%d]=0x%lx after re-extract\n",
i, writeable[i]);
}
int32_t length;
length=u_unescape(
"Sch\\u00f6nes Auto: \\u20ac 11240.\\fPrivates Zeichen: \\U00102345\\n",
- buffer, uprv_lengthof(buffer));
+ buffer, UPRV_LENGTHOF(buffer));
printf("german C Unicode string from char * unescaping: (length %d)\n ", length);
printUnicodeString("", UnicodeString(buffer));
}
const UChar *s;
int32_t length;
} strings[]={
- { feff, uprv_lengthof(feff) },
- { ascii, uprv_lengthof(ascii) },
- { crlf, uprv_lengthof(crlf) },
- { nul, uprv_lengthof(nul) },
- { latin, uprv_lengthof(latin) },
- { devanagari, uprv_lengthof(devanagari) },
- { hiragana, uprv_lengthof(hiragana) },
- { unihan, uprv_lengthof(unihan) },
- { hangul, uprv_lengthof(hangul) },
- { surrogates, uprv_lengthof(surrogates) },
- { plane1, uprv_lengthof(plane1) },
- { plane2, uprv_lengthof(plane2) },
- { plane15, uprv_lengthof(plane15) },
- { plane16, uprv_lengthof(plane16) },
- { c0, uprv_lengthof(c0) }
+ { feff, UPRV_LENGTHOF(feff) },
+ { ascii, UPRV_LENGTHOF(ascii) },
+ { crlf, UPRV_LENGTHOF(crlf) },
+ { nul, UPRV_LENGTHOF(nul) },
+ { latin, UPRV_LENGTHOF(latin) },
+ { devanagari, UPRV_LENGTHOF(devanagari) },
+ { hiragana, UPRV_LENGTHOF(hiragana) },
+ { unihan, UPRV_LENGTHOF(unihan) },
+ { hangul, UPRV_LENGTHOF(hangul) },
+ { surrogates, UPRV_LENGTHOF(surrogates) },
+ { plane1, UPRV_LENGTHOF(plane1) },
+ { plane2, UPRV_LENGTHOF(plane2) },
+ { plane15, UPRV_LENGTHOF(plane15) },
+ { plane16, UPRV_LENGTHOF(plane16) },
+ { c0, UPRV_LENGTHOF(c0) }
};
/*
/* text 1: each of strings[] once */
length=0;
- for(i=0; i<uprv_lengthof(strings); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(strings); ++i) {
u_memcpy(text+length, strings[i].s, strings[i].length);
length+=strings[i].length;
}
/* text 2: each of strings[] twice */
length=0;
- for(i=0; i<uprv_lengthof(strings); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(strings); ++i) {
u_memcpy(text+length, strings[i].s, strings[i].length);
length+=strings[i].length;
u_memcpy(text+length, strings[i].s, strings[i].length);
/* text 3: each of strings[] many times (set step vs. |strings| so that all strings are used) */
length=0;
for(i=1; length<5000; i+=7) {
- if(i>=uprv_lengthof(strings)) {
- i-=uprv_lengthof(strings);
+ if(i>=UPRV_LENGTHOF(strings)) {
+ i-=UPRV_LENGTHOF(strings);
}
u_memcpy(text+length, strings[i].s, strings[i].length);
length+=strings[i].length;
int32_t buffLen = 0;
USet *set = NULL;
- for(i = 0; i < uprv_lengthof(setTest); i++) {
+ for(i = 0; i < UPRV_LENGTHOF(setTest); i++) {
buffLen = u_unescape(setTest[i].rules, buff, 1024);
coll = ucol_openRules(buff, buffLen, UCOL_DEFAULT, UCOL_DEFAULT, &pError, &status);
if(U_SUCCESS(status)) {
if(!uset_containsAll(ref, set)) {
log_err("%s: Some stuff from %s is not present in the set\n", locale, inSet);
uset_removeAll(set, ref);
- bufLen = uset_toPattern(set, buffer, uprv_lengthof(buffer), TRUE, status);
+ bufLen = uset_toPattern(set, buffer, UPRV_LENGTHOF(buffer), TRUE, status);
log_info(" missing: %s\n", aescstrdup(buffer, bufLen));
- bufLen = uset_toPattern(ref, buffer, uprv_lengthof(buffer), TRUE, status);
+ bufLen = uset_toPattern(ref, buffer, UPRV_LENGTHOF(buffer), TRUE, status);
log_info(" total: size=%i %s\n", uset_getItemCount(ref), aescstrdup(buffer, bufLen));
}
const char *locale = NULL, *value = NULL;
UBool errorOccurred = FALSE;
- for (i = 0; i < uprv_lengthof(PREFERRED) && !errorOccurred; i++) {
+ for (i = 0; i < UPRV_LENGTHOF(PREFERRED) && !errorOccurred; i++) {
locale = PREFERRED[i][0];
value = NULL;
valueLength = 0;
log_verbose("\nEntering TestReorder\n\n");
- for(i=0;i<uprv_lengthof(logicalOrder);i++){
+ for(i=0;i<UPRV_LENGTHOF(logicalOrder);i++){
int32_t srcSize = (int32_t)strlen(logicalOrder[i]);
int32_t destSize = srcSize*2;
UChar src[MAXLEN];
checkWhatYouCan(bidi, logicalOrder[i], chars);
}
- for(i=0;i<uprv_lengthof(logicalOrder);i++){
+ for(i=0;i<UPRV_LENGTHOF(logicalOrder);i++){
int32_t srcSize = (int32_t)strlen(logicalOrder[i]);
int32_t destSize = srcSize*2;
UChar src[MAXLEN];
}
}
- for(i=0;i<uprv_lengthof(logicalOrder);i++){
+ for(i=0;i<UPRV_LENGTHOF(logicalOrder);i++){
int32_t srcSize = (int32_t)strlen(logicalOrder[i]);
int32_t destSize = srcSize*2;
UChar src[MAXLEN];
}
}
/* Max Explicit level */
- for(i=0;i<uprv_lengthof(logicalOrder);i++){
+ for(i=0;i<UPRV_LENGTHOF(logicalOrder);i++){
int32_t srcSize = (int32_t)strlen(logicalOrder[i]);
int32_t destSize = srcSize*2;
UChar src[MAXLEN];
logicalOrder[i],visualOrder3[i],chars,formatLevels(bidi, formatChars),i);
}
}
- for(i=0;i<uprv_lengthof(logicalOrder);i++){
+ for(i=0;i<UPRV_LENGTHOF(logicalOrder);i++){
int32_t srcSize = (int32_t)strlen(logicalOrder[i]);
int32_t destSize = srcSize*2;
UChar src[MAXLEN];
log_verbose("\nEntering TestReorderArabicMathSymbols\n\n");
- for(i=0;i<uprv_lengthof(logicalOrder);i++){
+ for(i=0;i<UPRV_LENGTHOF(logicalOrder);i++){
int32_t srcSize = u_strlen(logicalOrder[i]);
int32_t destSize = srcSize*2;
UChar dest[MAXLEN];
return; \
} \
-#define STRING_TEST_CASE(s) { (s), uprv_lengthof(s) }
+#define STRING_TEST_CASE(s) { (s), UPRV_LENGTHOF(s) }
static void testGetBaseDirection(void) {
UBiDiDirection dir;
};
log_verbose("testGetBaseDirection() with %u test cases ---\n",
- uprv_lengthof(testCases));
+ UPRV_LENGTHOF(testCases));
/* Run Tests */
- for(i=0; i<uprv_lengthof(testCases); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(testCases); ++i) {
dir = ubidi_getBaseDirection(testCases[i].s, testCases[i].length );
log_verbose("Testing case %d\tReceived dir %d\n", i, dir);
if (dir != expectedDir[i])
*/
pBidi = ubidi_open();
errorCode = U_ZERO_ERROR;
- ubidi_setPara(pBidi, multiparaTestString, uprv_lengthof(multiparaTestString),
+ ubidi_setPara(pBidi, multiparaTestString, UPRV_LENGTHOF(multiparaTestString),
UBIDI_DEFAULT_LTR, NULL, &errorCode);
if (U_FAILURE(errorCode)) {
log_err("ubidi_setPara failed for multiparaTestString\n");
ubidi_close(pBidi);
return;
}
- for (i = 0; i < uprv_lengthof(multiparaTestString); i++) {
+ for (i = 0; i < UPRV_LENGTHOF(multiparaTestString); i++) {
if (gotLevels[i] != multiparaTestLevels[i]) {
log_err("Error on level for multiparaTestString at index %d, "
"expected=%d, actual=%d\n",
static int countRoundtrips=0, countNonRoundtrips=0;
-#define STRING_TEST_CASE(s) { (s), uprv_lengthof(s) }
+#define STRING_TEST_CASE(s) { (s), UPRV_LENGTHOF(s) }
static void
testInverse(void) {
return;
}
- log_verbose("inverse Bidi: testInverse(L) with %u test cases ---\n", uprv_lengthof(testCases));
- for(i=0; i<uprv_lengthof(testCases); ++i) {
+ log_verbose("inverse Bidi: testInverse(L) with %u test cases ---\n", UPRV_LENGTHOF(testCases));
+ for(i=0; i<UPRV_LENGTHOF(testCases); ++i) {
log_verbose("Testing case %d\n", i);
errorCode=U_ZERO_ERROR;
_testInverseBidi(pBiDi, testCases[i].s, testCases[i].length, 0, &errorCode);
}
- log_verbose("inverse Bidi: testInverse(R) with %u test cases ---\n", uprv_lengthof(testCases));
- for(i=0; i<uprv_lengthof(testCases); ++i) {
+ log_verbose("inverse Bidi: testInverse(R) with %u test cases ---\n", UPRV_LENGTHOF(testCases));
+ for(i=0; i<UPRV_LENGTHOF(testCases); ++i) {
log_verbose("Testing case %d\n", i);
errorCode=U_ZERO_ERROR;
_testInverseBidi(pBiDi, testCases[i].s, testCases[i].length, 1, &errorCode);
if (src != ubidi_getText(pBiDi)) {
log_err("Wrong value returned by ubidi_getText\n");
}
- logicalLength=ubidi_writeReordered(pBiDi, logicalDest, uprv_lengthof(logicalDest),
+ logicalLength=ubidi_writeReordered(pBiDi, logicalDest, UPRV_LENGTHOF(logicalDest),
UBIDI_DO_MIRRORING|UBIDI_INSERT_LRM_FOR_NUMERIC, pErrorCode);
log_verbose(" v ");
printUnicode(src, srcLength, ubidi_getLevels(pBiDi, pErrorCode));
log_err("Error while doing ubidi_setInverse(FALSE)\n");
}
ubidi_setPara(pBiDi, logicalDest, logicalLength, 0, NULL, pErrorCode);
- visualLength=ubidi_writeReordered(pBiDi, visualDest, uprv_lengthof(visualDest),
+ visualLength=ubidi_writeReordered(pBiDi, visualDest, UPRV_LENGTHOF(visualDest),
UBIDI_DO_MIRRORING|UBIDI_REMOVE_BIDI_CONTROLS, pErrorCode);
} else {
log_verbose("inverse Bidi: testInverse(R)\n");
/* reverse visual from RTL to LTR */
- ltrLength=ubidi_writeReverse(src, srcLength, visualLTR, uprv_lengthof(visualLTR), 0, pErrorCode);
+ ltrLength=ubidi_writeReverse(src, srcLength, visualLTR, UPRV_LENGTHOF(visualLTR), 0, pErrorCode);
log_verbose(" vr");
printUnicode(src, srcLength, NULL);
log_verbose("\n");
/* convert visual RTL to logical */
ubidi_setInverse(pBiDi, TRUE);
ubidi_setPara(pBiDi, visualLTR, ltrLength, 0, NULL, pErrorCode);
- logicalLength=ubidi_writeReordered(pBiDi, logicalDest, uprv_lengthof(logicalDest),
+ logicalLength=ubidi_writeReordered(pBiDi, logicalDest, UPRV_LENGTHOF(logicalDest),
UBIDI_DO_MIRRORING|UBIDI_INSERT_LRM_FOR_NUMERIC, pErrorCode);
log_verbose(" vl");
printUnicode(visualLTR, ltrLength, ubidi_getLevels(pBiDi, pErrorCode));
/* convert back to visual RTL */
ubidi_setInverse(pBiDi, FALSE);
ubidi_setPara(pBiDi, logicalDest, logicalLength, 0, NULL, pErrorCode);
- visualLength=ubidi_writeReordered(pBiDi, visualDest, uprv_lengthof(visualDest),
+ visualLength=ubidi_writeReordered(pBiDi, visualDest, UPRV_LENGTHOF(visualDest),
UBIDI_DO_MIRRORING|UBIDI_REMOVE_BIDI_CONTROLS|UBIDI_OUTPUT_REVERSE, pErrorCode);
}
log_verbose(" l ");
/* test ubidi_writeReverse() with "interesting" options */
errorCode=U_ZERO_ERROR;
- length=ubidi_writeReverse(forward, uprv_lengthof(forward),
- reverse, uprv_lengthof(reverse),
+ length=ubidi_writeReverse(forward, UPRV_LENGTHOF(forward),
+ reverse, UPRV_LENGTHOF(reverse),
UBIDI_KEEP_BASE_COMBINING,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(reverseKeepCombining) || memcmp(reverse, reverseKeepCombining, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(reverseKeepCombining) || memcmp(reverse, reverseKeepCombining, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in ubidi_writeReverse(UBIDI_KEEP_BASE_COMBINING): length=%d (should be %d), error code %s\n",
- length, uprv_lengthof(reverseKeepCombining), u_errorName(errorCode));
+ length, UPRV_LENGTHOF(reverseKeepCombining), u_errorName(errorCode));
}
- memset(reverse, 0xa5, uprv_lengthof(reverse)*U_SIZEOF_UCHAR);
+ memset(reverse, 0xa5, UPRV_LENGTHOF(reverse)*U_SIZEOF_UCHAR);
errorCode=U_ZERO_ERROR;
- length=ubidi_writeReverse(forward, uprv_lengthof(forward),
- reverse, uprv_lengthof(reverse),
+ length=ubidi_writeReverse(forward, UPRV_LENGTHOF(forward),
+ reverse, UPRV_LENGTHOF(reverse),
UBIDI_REMOVE_BIDI_CONTROLS|UBIDI_DO_MIRRORING|UBIDI_KEEP_BASE_COMBINING,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(reverseRemoveControlsKeepCombiningDoMirror) || memcmp(reverse, reverseRemoveControlsKeepCombiningDoMirror, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(reverseRemoveControlsKeepCombiningDoMirror) || memcmp(reverse, reverseRemoveControlsKeepCombiningDoMirror, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in ubidi_writeReverse(UBIDI_REMOVE_BIDI_CONTROLS|UBIDI_DO_MIRRORING|UBIDI_KEEP_BASE_COMBINING):\n"
" length=%d (should be %d), error code %s\n",
- length, uprv_lengthof(reverseRemoveControlsKeepCombiningDoMirror), u_errorName(errorCode));
+ length, UPRV_LENGTHOF(reverseRemoveControlsKeepCombiningDoMirror), u_errorName(errorCode));
}
}
UBiDi *bidi = ubidi_open();
UChar text[90], dest[MAXLEN], expected[120];
int destLen, i;
- for (i = 0; i < uprv_lengthof(text); i+=3) {
+ for (i = 0; i < UPRV_LENGTHOF(text); i+=3) {
text[i] = 0x0061; /* 'a' */
text[i+1] = 0x05d0;
text[i+2] = 0x0033; /* '3' */
}
ubidi_setReorderingMode(bidi, UBIDI_REORDER_INVERSE_LIKE_DIRECT);
ubidi_setReorderingOptions(bidi, UBIDI_OPTION_INSERT_MARKS);
- ubidi_setPara(bidi, text, uprv_lengthof(text), UBIDI_LTR, NULL, &errorCode);
+ ubidi_setPara(bidi, text, UPRV_LENGTHOF(text), UBIDI_LTR, NULL, &errorCode);
destLen = ubidi_writeReordered(bidi, dest, MAXLEN, 0, &errorCode);
- for (i = 0; i < uprv_lengthof(expected); i+=4) {
+ for (i = 0; i < UPRV_LENGTHOF(expected); i+=4) {
expected[i] = 0x0061; /* 'a' */
expected[i+1] = 0x05d0;
expected[i+2] = 0x200e;
if (memcmp(dest, expected, destLen * sizeof(UChar))) {
log_err("\nInvalid output with many added points, "
"expected '%s', got '%s'\n",
- aescstrdup(expected, uprv_lengthof(expected)),
+ aescstrdup(expected, UPRV_LENGTHOF(expected)),
aescstrdup(dest, destLen));
}
ubidi_close(bidi);
int destLen;
ubidi_setInverse(bidi, TRUE);
src[0] = src[1] = src[2] = 0x0020;
- ubidi_setPara(bidi, src, uprv_lengthof(src), UBIDI_RTL, NULL, &errorCode);
+ ubidi_setPara(bidi, src, UPRV_LENGTHOF(src), UBIDI_RTL, NULL, &errorCode);
destLen = ubidi_writeReordered(bidi, dest, MAXLEN,
UBIDI_OUTPUT_REVERSE | UBIDI_INSERT_LRM_FOR_NUMERIC,
&errorCode);
if (memcmp(dest, expected, destLen * sizeof(UChar))) {
log_err("\nInvalid output with RLM at both sides, "
"expected '%s', got '%s'\n",
- aescstrdup(expected, uprv_lengthof(expected)),
+ aescstrdup(expected, UPRV_LENGTHOF(expected)),
aescstrdup(dest, destLen));
}
ubidi_close(bidi);
/* european->arabic */
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_DIGITS_EN2AN|U_SHAPE_DIGIT_TYPE_AN,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(source) || memcmp(dest, en2an, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(source) || memcmp(dest, en2an, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(en2an)\n");
}
/* arabic->european */
errorCode=U_ZERO_ERROR;
length=u_shapeArabic(source, -1,
- dest, uprv_lengthof(dest),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_DIGITS_AN2EN|U_SHAPE_DIGIT_TYPE_AN_EXTENDED,
&errorCode);
if(U_FAILURE(errorCode) || length!=u_strlen(source) || memcmp(dest, an2en, length*U_SIZEOF_UCHAR)!=0) {
/* european->arabic with context, logical order, initial state not AL */
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_DIGITS_ALEN2AN_INIT_LR|U_SHAPE_DIGIT_TYPE_AN,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(source) || memcmp(dest, logical_alen2an_init_lr, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(source) || memcmp(dest, logical_alen2an_init_lr, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(logical_alen2an_init_lr)\n");
}
/* european->arabic with context, logical order, initial state AL */
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_DIGITS_ALEN2AN_INIT_AL|U_SHAPE_DIGIT_TYPE_AN_EXTENDED,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(source) || memcmp(dest, logical_alen2an_init_al, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(source) || memcmp(dest, logical_alen2an_init_al, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(logical_alen2an_init_al)\n");
}
/* european->arabic with context, reverse order, initial state not AL */
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_DIGITS_ALEN2AN_INIT_LR|U_SHAPE_DIGIT_TYPE_AN|U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(source) || memcmp(dest, reverse_alen2an_init_lr, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(source) || memcmp(dest, reverse_alen2an_init_lr, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(reverse_alen2an_init_lr)\n");
}
/* european->arabic with context, reverse order, initial state AL */
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_DIGITS_ALEN2AN_INIT_AL|U_SHAPE_DIGIT_TYPE_AN_EXTENDED|U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(source) || memcmp(dest, reverse_alen2an_init_al, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(source) || memcmp(dest, reverse_alen2an_init_al, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(reverse_alen2an_init_al)\n");
}
/* test noop */
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
0,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(source) || memcmp(dest, source, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(source) || memcmp(dest, source, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(noop)\n");
}
errorCode=U_ZERO_ERROR;
length=u_shapeArabic(source, 0,
- dest, uprv_lengthof(dest),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_DIGITS_EN2AN|U_SHAPE_DIGIT_TYPE_AN,
&errorCode);
if(U_FAILURE(errorCode) || length!=0) {
- log_err("failure in u_shapeArabic(en2an, sourceLength=0), returned %d/%s\n", u_errorName(errorCode), uprv_lengthof(source));
+ log_err("failure in u_shapeArabic(en2an, sourceLength=0), returned %d/%s\n", u_errorName(errorCode), UPRV_LENGTHOF(source));
}
/* preflight digit shaping */
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
NULL, 0,
U_SHAPE_DIGITS_EN2AN|U_SHAPE_DIGIT_TYPE_AN,
&errorCode);
- if(errorCode!=U_BUFFER_OVERFLOW_ERROR || length!=uprv_lengthof(source)) {
+ if(errorCode!=U_BUFFER_OVERFLOW_ERROR || length!=UPRV_LENGTHOF(source)) {
log_err("failure in u_shapeArabic(en2an preflighting), returned %d/%s instead of %d/U_BUFFER_OVERFLOW_ERROR\n",
- length, u_errorName(errorCode), uprv_lengthof(source));
+ length, u_errorName(errorCode), UPRV_LENGTHOF(source));
}
/* test illegal arguments */
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(NULL, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(NULL, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_DIGITS_EN2AN|U_SHAPE_DIGIT_TYPE_AN,
&errorCode);
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR) {
errorCode=U_ZERO_ERROR;
length=u_shapeArabic(source, -2,
- dest, uprv_lengthof(dest),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_DIGITS_EN2AN|U_SHAPE_DIGIT_TYPE_AN,
&errorCode);
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR) {
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- NULL, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ NULL, UPRV_LENGTHOF(dest),
U_SHAPE_DIGITS_EN2AN|U_SHAPE_DIGIT_TYPE_AN,
&errorCode);
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR) {
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
dest, -1,
U_SHAPE_DIGITS_EN2AN|U_SHAPE_DIGIT_TYPE_AN,
&errorCode);
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_DIGITS_RESERVED|U_SHAPE_DIGIT_TYPE_AN,
&errorCode);
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR) {
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_DIGITS_EN2AN|U_SHAPE_DIGIT_TYPE_RESERVED,
&errorCode);
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR) {
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- (UChar *)(source+2), uprv_lengthof(dest), /* overlap source and destination */
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ (UChar *)(source+2), UPRV_LENGTHOF(dest), /* overlap source and destination */
U_SHAPE_DIGITS_EN2AN|U_SHAPE_DIGIT_TYPE_AN,
&errorCode);
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR) {
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(lamalef, uprv_lengthof(lamalef),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(lamalef, UPRV_LENGTHOF(lamalef),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_LETTERS_UNSHAPE | U_SHAPE_LENGTH_GROW_SHRINK | U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
&errorCode);
- if(U_FAILURE(errorCode) || length == uprv_lengthof(lamalef)) {
+ if(U_FAILURE(errorCode) || length == UPRV_LENGTHOF(lamalef)) {
log_err("failure in u_shapeArabic(U_SHAPE_LETTERS_UNSHAPE | U_SHAPE_LENGTH_GROW_SHRINK | U_SHAPE_TEXT_DIRECTION_VISUAL_LTR)\n");
log_err("returned %s instead of U_ZERO_ERROR or returned length %d instead of 3\n", u_errorName(errorCode), length);
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_LETTERS_SHAPE|U_SHAPE_LENGTH_FIXED_SPACES_NEAR|
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(shape_near) || memcmp(dest, shape_near, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(shape_near) || memcmp(dest, shape_near, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(LAMALEF shape_near)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_LETTERS_SHAPE|U_SHAPE_LENGTH_FIXED_SPACES_AT_END|
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(shape_at_end) || memcmp(dest, shape_at_end, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(shape_at_end) || memcmp(dest, shape_at_end, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(LAMALEF shape_at_end)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_LETTERS_SHAPE|U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING|
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(shape_at_begin) || memcmp(dest, shape_at_begin, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(shape_at_begin) || memcmp(dest, shape_at_begin, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(LAMALEF shape_at_begin)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_LETTERS_SHAPE|U_SHAPE_LENGTH_GROW_SHRINK|
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
&errorCode);
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED|U_SHAPE_LENGTH_FIXED_SPACES_NEAR|
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(shape_excepttashkeel_near) || memcmp(dest, shape_excepttashkeel_near, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(shape_excepttashkeel_near) || memcmp(dest, shape_excepttashkeel_near, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(LAMALEF shape_excepttashkeel_near)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED|U_SHAPE_LENGTH_FIXED_SPACES_AT_END|
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(shape_excepttashkeel_at_end) || memcmp(dest,shape_excepttashkeel_at_end , length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(shape_excepttashkeel_at_end) || memcmp(dest,shape_excepttashkeel_at_end , length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(LAMALEF shape_excepttashkeel_at_end)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED|U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING|
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(shape_excepttashkeel_at_begin) || memcmp(dest, shape_excepttashkeel_at_begin, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(shape_excepttashkeel_at_begin) || memcmp(dest, shape_excepttashkeel_at_begin, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(LAMALEF shape_excepttashkeel_at_begin)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED|U_SHAPE_LENGTH_GROW_SHRINK|
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
&errorCode);
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_LETTERS_SHAPE|U_SHAPE_LENGTH_FIXED_SPACES_NEAR|
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(shape_near) || memcmp(dest, shape_near, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(shape_near) || memcmp(dest, shape_near, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(TASHKEEL shape_near)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED|U_SHAPE_LENGTH_FIXED_SPACES_NEAR|
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(shape_excepttashkeel_near) || memcmp(dest, shape_excepttashkeel_near, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(shape_excepttashkeel_near) || memcmp(dest, shape_excepttashkeel_near, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(TASHKEEL shape_excepttashkeel_near)\n");
}
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_LETTERS_UNSHAPE|U_SHAPE_LENGTH_FIXED_SPACES_NEAR|
U_SHAPE_TEXT_DIRECTION_LOGICAL,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(unshape_near) || memcmp(dest, unshape_near, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(unshape_near) || memcmp(dest, unshape_near, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(unshape_near)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_LETTERS_UNSHAPE|U_SHAPE_LENGTH_FIXED_SPACES_AT_END|
U_SHAPE_TEXT_DIRECTION_LOGICAL,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(unshape_at_end) || memcmp(dest, unshape_at_end, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(unshape_at_end) || memcmp(dest, unshape_at_end, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(unshape_at_end)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_LETTERS_UNSHAPE|U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING|
U_SHAPE_TEXT_DIRECTION_LOGICAL,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(unshape_at_begin) || memcmp(dest, unshape_at_begin, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(unshape_at_begin) || memcmp(dest, unshape_at_begin, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(unshape_at_begin)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(source, uprv_lengthof(source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(source, UPRV_LENGTHOF(source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_LETTERS_UNSHAPE|U_SHAPE_LENGTH_GROW_SHRINK|
U_SHAPE_TEXT_DIRECTION_LOGICAL,
&errorCode);
log_verbose("Trying old tail\n");
status = U_ZERO_ERROR;
- length = u_shapeArabic(src, -1, dst, uprv_lengthof(dst),
+ length = u_shapeArabic(src, -1, dst, UPRV_LENGTHOF(dst),
U_SHAPE_LETTERS_SHAPE|U_SHAPE_SEEN_TWOCELL_NEAR, &status);
if(U_FAILURE(status)) {
log_err("Fail: status %s\n", u_errorName(status));
} else if(length!=2) {
log_err("Fail: len %d expected 3\n", length);
- } else if(u_strncmp(dst,dst_old,uprv_lengthof(dst))) {
+ } else if(u_strncmp(dst,dst_old,UPRV_LENGTHOF(dst))) {
log_err("Fail: got U+%04X U+%04X expected U+%04X U+%04X\n",
dst[0],dst[1],dst_old[0],dst_old[1]);
} else {
log_verbose("Trying new tail\n");
status = U_ZERO_ERROR;
- length = u_shapeArabic(src, -1, dst, uprv_lengthof(dst),
+ length = u_shapeArabic(src, -1, dst, UPRV_LENGTHOF(dst),
U_SHAPE_LETTERS_SHAPE|U_SHAPE_SEEN_TWOCELL_NEAR|U_SHAPE_TAIL_NEW_UNICODE, &status);
if(U_FAILURE(status)) {
log_err("Fail: status %s\n", u_errorName(status));
} else if(length!=2) {
log_err("Fail: len %d expected 3\n", length);
- } else if(u_strncmp(dst,dst_new,uprv_lengthof(dst))) {
+ } else if(u_strncmp(dst,dst_new,UPRV_LENGTHOF(dst))) {
log_err("Fail: got U+%04X U+%04X expected U+%04X U+%04X\n",
dst[0],dst[1],dst_new[0],dst_new[1]);
} else {
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(persian_letters_source, uprv_lengthof(persian_letters_source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(persian_letters_source, UPRV_LENGTHOF(persian_letters_source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_LETTERS_SHAPE|U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(persian_letters) || memcmp(dest, persian_letters, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(persian_letters) || memcmp(dest, persian_letters, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(persian_letters)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(tashkeel_aggregation_source, uprv_lengthof(tashkeel_aggregation_source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(tashkeel_aggregation_source, UPRV_LENGTHOF(tashkeel_aggregation_source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_AGGREGATE_TASHKEEL|U_SHAPE_PRESERVE_PRESENTATION|
U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED|U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(tashkeel_aggregation) || memcmp(dest, tashkeel_aggregation, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(tashkeel_aggregation) || memcmp(dest, tashkeel_aggregation, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(tashkeel_aggregation)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(untouched_presentation_source, uprv_lengthof(untouched_presentation_source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(untouched_presentation_source, UPRV_LENGTHOF(untouched_presentation_source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_PRESERVE_PRESENTATION|
U_SHAPE_LETTERS_SHAPE|U_SHAPE_TEXT_DIRECTION_VISUAL_LTR,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(untouched_presentation) || memcmp(dest, untouched_presentation, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(untouched_presentation) || memcmp(dest, untouched_presentation, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(untouched_presentation)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(untouched_presentation_r_source, uprv_lengthof(untouched_presentation_r_source),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(untouched_presentation_r_source, UPRV_LENGTHOF(untouched_presentation_r_source),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_PRESERVE_PRESENTATION|
U_SHAPE_LETTERS_SHAPE|U_SHAPE_TEXT_DIRECTION_LOGICAL,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(untouched_presentation_r) || memcmp(dest, untouched_presentation_r, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(untouched_presentation_r) || memcmp(dest, untouched_presentation_r, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(untouched_presentation_r)\n");
}
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(letters_source1, uprv_lengthof(letters_source1),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(letters_source1, UPRV_LENGTHOF(letters_source1),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_TEXT_DIRECTION_VISUAL_RTL | U_SHAPE_TASHKEEL_BEGIN | U_SHAPE_LETTERS_SHAPE,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(letters_dest1) || memcmp(dest, letters_dest1, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(letters_dest1) || memcmp(dest, letters_dest1, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(letters_source1)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(letters_source2, uprv_lengthof(letters_source2),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(letters_source2, UPRV_LENGTHOF(letters_source2),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_TEXT_DIRECTION_VISUAL_RTL | U_SHAPE_TASHKEEL_END | U_SHAPE_LETTERS_SHAPE,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(letters_dest2) || memcmp(dest, letters_dest2, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(letters_dest2) || memcmp(dest, letters_dest2, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(letters_source2)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(letters_source3, uprv_lengthof(letters_source3),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(letters_source3, UPRV_LENGTHOF(letters_source3),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_TEXT_DIRECTION_VISUAL_RTL | U_SHAPE_TASHKEEL_RESIZE | U_SHAPE_LETTERS_SHAPE,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(letters_dest3) || memcmp(dest, letters_dest3, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(letters_dest3) || memcmp(dest, letters_dest3, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(letters_source3)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(letters_source4, uprv_lengthof(letters_source4),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(letters_source4, UPRV_LENGTHOF(letters_source4),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_TEXT_DIRECTION_VISUAL_RTL | U_SHAPE_TASHKEEL_REPLACE_BY_TATWEEL | U_SHAPE_LETTERS_SHAPE,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(letters_dest4) || memcmp(dest, letters_dest4, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(letters_dest4) || memcmp(dest, letters_dest4, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(letters_source4)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(letters_source5, uprv_lengthof(letters_source5),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(letters_source5, UPRV_LENGTHOF(letters_source5),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR | U_SHAPE_TASHKEEL_BEGIN | U_SHAPE_LETTERS_SHAPE,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(letters_dest5) || memcmp(dest, letters_dest5, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(letters_dest5) || memcmp(dest, letters_dest5, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(letters_source5)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(letters_source6, uprv_lengthof(letters_source6),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(letters_source6, UPRV_LENGTHOF(letters_source6),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR | U_SHAPE_TASHKEEL_END | U_SHAPE_LETTERS_SHAPE,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(letters_dest6) || memcmp(dest, letters_dest6, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(letters_dest6) || memcmp(dest, letters_dest6, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(letters_source6)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(letters_source7, uprv_lengthof(letters_source7),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(letters_source7, UPRV_LENGTHOF(letters_source7),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR | U_SHAPE_TASHKEEL_RESIZE | U_SHAPE_LETTERS_SHAPE,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(letters_dest7) || memcmp(dest, letters_dest7, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(letters_dest7) || memcmp(dest, letters_dest7, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(letters_source7)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(letters_source8, uprv_lengthof(letters_source8),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(letters_source8, UPRV_LENGTHOF(letters_source8),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR | U_SHAPE_TASHKEEL_REPLACE_BY_TATWEEL | U_SHAPE_LETTERS_SHAPE,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(letters_dest8) || memcmp(dest, letters_dest8, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(letters_dest8) || memcmp(dest, letters_dest8, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(letters_source8)\n");
}
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(letters_source1, uprv_lengthof(letters_source1),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(letters_source1, UPRV_LENGTHOF(letters_source1),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_TEXT_DIRECTION_VISUAL_RTL | U_SHAPE_TASHKEEL_BEGIN | U_SHAPE_LETTERS_SHAPE,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(letters_dest1) || memcmp(dest, letters_dest1, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(letters_dest1) || memcmp(dest, letters_dest1, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(letters_source1)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(letters_source2, uprv_lengthof(letters_source2),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(letters_source2, UPRV_LENGTHOF(letters_source2),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_TEXT_DIRECTION_VISUAL_RTL | U_SHAPE_TASHKEEL_END | U_SHAPE_LETTERS_SHAPE,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(letters_dest2) || memcmp(dest, letters_dest2, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(letters_dest2) || memcmp(dest, letters_dest2, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(letters_source2)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(letters_source3, uprv_lengthof(letters_source3),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(letters_source3, UPRV_LENGTHOF(letters_source3),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_TEXT_DIRECTION_VISUAL_RTL | U_SHAPE_TASHKEEL_RESIZE | U_SHAPE_LETTERS_SHAPE,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(letters_dest3) || memcmp(dest, letters_dest3, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(letters_dest3) || memcmp(dest, letters_dest3, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(letters_source3)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(letters_source4, uprv_lengthof(letters_source4),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(letters_source4, UPRV_LENGTHOF(letters_source4),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_TEXT_DIRECTION_VISUAL_RTL | U_SHAPE_TASHKEEL_REPLACE_BY_TATWEEL | U_SHAPE_LETTERS_SHAPE,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(letters_dest4) || memcmp(dest, letters_dest4, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(letters_dest4) || memcmp(dest, letters_dest4, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(letters_source4)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(letters_source5, uprv_lengthof(letters_source5),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(letters_source5, UPRV_LENGTHOF(letters_source5),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR | U_SHAPE_TASHKEEL_BEGIN | U_SHAPE_LETTERS_SHAPE,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(letters_dest5) || memcmp(dest, letters_dest5, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(letters_dest5) || memcmp(dest, letters_dest5, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(letters_source5)\n");
}
errorCode=U_ZERO_ERROR;
- length=u_shapeArabic(letters_source6, uprv_lengthof(letters_source6),
- dest, uprv_lengthof(dest),
+ length=u_shapeArabic(letters_source6, UPRV_LENGTHOF(letters_source6),
+ dest, UPRV_LENGTHOF(dest),
U_SHAPE_TEXT_DIRECTION_VISUAL_LTR | U_SHAPE_TASHKEEL_END | U_SHAPE_LETTERS_SHAPE,
&errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(letters_dest6) || memcmp(dest, letters_dest6, length*U_SIZEOF_UCHAR)!=0) {
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(letters_dest6) || memcmp(dest, letters_dest6, length*U_SIZEOF_UCHAR)!=0) {
log_err("failure in u_shapeArabic(letters_source6)\n");
}
{ 0x06D2, 0xFBAE, 0xFBAF, 0, 0, }, /* YEH BARREE */
{ 0x06D3, 0xFBB0, 0xFBB1, 0, 0, }}; /* YEH BARREE WITH HAMZA ABOVE */
int32_t i;
- for (i = 0; i < uprv_lengthof(letterForms); ++i) {
+ for (i = 0; i < UPRV_LENGTHOF(letterForms); ++i) {
_testPresentationForms(letterForms[i]);
}
}
{ MAKE_ITEMS(0) }
};
-#define TC_COUNT uprv_lengthof(textIn)
-#define MODES_COUNT uprv_lengthof(modes)
-#define OPTIONS_COUNT uprv_lengthof(options)
-#define LEVELS_COUNT uprv_lengthof(paraLevels)
+#define TC_COUNT UPRV_LENGTHOF(textIn)
+#define MODES_COUNT UPRV_LENGTHOF(modes)
+#define OPTIONS_COUNT UPRV_LENGTHOF(options)
+#define LEVELS_COUNT UPRV_LENGTHOF(paraLevels)
static const char* const textIn[] = {
/* (0) 123 */
for (option = 0; option < 2; option++) {
ubidi_setReorderingOptions(pBiDi, option==0 ? UBIDI_OPTION_REMOVE_CONTROLS
: UBIDI_OPTION_INSERT_MARKS);
- for (i = 0, nCases = uprv_lengthof(testCases); i < nCases; i++) {
+ for (i = 0, nCases = UPRV_LENGTHOF(testCases); i < nCases; i++) {
srcLen = strlen(testCases[i].textIn);
pseudoToU16(srcLen, testCases[i].textIn, src);
for(j = 0; j < 2; j++) {
int32_t srcLen, processedLen, chunk, len, nPortions;
int i, j, levelIndex;
UBiDiLevel level;
- int nTests = uprv_lengthof(testData), nLevels = uprv_lengthof(paraLevels);
+ int nTests = UPRV_LENGTHOF(testData), nLevels = UPRV_LENGTHOF(paraLevels);
UBool mismatch, testOK = TRUE;
char processedLenStr[MAXPORTIONS * 5];
DEF, DEF, DEF, DEF, DEF, DEF, DEF, DEF, /* 70-77 */
DEF, DEF, DEF, LRO, B, RLO, BN, DEF /* 78-7F */
};
- static const int nEntries = uprv_lengthof(customClasses);
+ static const int nEntries = UPRV_LENGTHOF(customClasses);
const char *dummy = context; /* just to avoid a compiler warning */
dummy++;
/*24*/ {"x|G", ".-=", "", "=-.", UBIDI_DEFAULT_LTR},
/*25*/ {"x|G", ".-=|-+*", "", "=-.|-+*", UBIDI_DEFAULT_LTR},
};
-#define CONTEXT_COUNT uprv_lengthof(contextData)
+#define CONTEXT_COUNT UPRV_LENGTHOF(contextData)
static void
testContext(void) {
};
/* store the actual sizes of each converter */
- int32_t actualSizes[uprv_lengthof(names)];
+ int32_t actualSizes[UPRV_LENGTHOF(names)];
static const int32_t bufferSizes[] = {
U_CNV_SAFECLONE_BUFFERSIZE,
/* Do these cloned converters work at all - shuffle UChars to chars & back again..*/
- for(j = 0; j < uprv_lengthof(bufferSizes); ++j) {
- for (idx = 0; idx < uprv_lengthof(names); idx++)
+ for(j = 0; j < UPRV_LENGTHOF(bufferSizes); ++j) {
+ for (idx = 0; idx < UPRV_LENGTHOF(names); idx++)
{
err = U_ZERO_ERROR;
cnv = ucnv_open(names[idx], &err);
memcpy(utf8, charUTF8, charUTF8Length);
- for(i=0; i<uprv_lengthof(badUTF8); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(badUTF8); ++i) {
/* truncated sequence? */
int32_t length=strlen(badUTF8[i]);
if(length>=(1+U8_COUNT_TRAIL_BYTES(badUTF8[i][0]))) {
ucnv_convertEx(cnv, utf8Cnv,
&target, output+sizeof(output),
&source, utf8+utf8Length,
- pivotBuffer, &pivotSource, &pivotTarget, pivotBuffer+uprv_lengthof(pivotBuffer),
+ pivotBuffer, &pivotSource, &pivotTarget, pivotBuffer+UPRV_LENGTHOF(pivotBuffer),
TRUE, TRUE, /* reset & flush */
&errorCode);
outputLength=(int32_t)(target-output);
memcpy(expect, char0, char0Length);
expectLength=char0Length;
- for(i=0; i<uprv_lengthof(badUTF8); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(badUTF8); ++i) {
int32_t length=strlen(badUTF8[i]);
memcpy(utf8+utf8Length, badUTF8[i], length);
utf8Length+=length;
return;
}
- for(i=0; i<uprv_lengthof(converterNames); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(converterNames); ++i) {
errorCode=U_ZERO_ERROR;
cnv=ucnv_open(converterNames[i], &errorCode);
if(U_FAILURE(errorCode)) {
return;
}
- for(i=0; i<uprv_lengthof(converterNames); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(converterNames); ++i) {
errorCode=U_ZERO_ERROR;
cnv=ucnv_open(converterNames[i], &errorCode);
ucnv_setFromUCallBack(cnv, UCNV_FROM_U_CALLBACK_ESCAPE, UCNV_ESCAPE_XML_DEC,
src=bad_utf8;
target=dest;
uprv_memset(dest, 9, sizeof(dest));
- if(i==uprv_lengthof(converterNames)-1) {
+ if(i==UPRV_LENGTHOF(converterNames)-1) {
/* conversion to UTF-8 yields two U+FFFD directly */
expected=twoFFFD;
expectedLength=6;
cnv, utf8Cnv,
&target, dest+expectedLength,
&src, bad_utf8+sizeof(bad_utf8),
- pivotBuffer, &pivotSource, &pivotTarget, pivotBuffer+uprv_lengthof(pivotBuffer),
+ pivotBuffer, &pivotSource, &pivotTarget, pivotBuffer+UPRV_LENGTHOF(pivotBuffer),
TRUE, TRUE, &errorCode);
if( errorCode!=U_STRING_NOT_TERMINATED_WARNING || src!=bad_utf8+2 ||
target!=dest+expectedLength || 0!=uprv_memcmp(dest, expected, expectedLength) ||
};
int32_t idx;
- for (idx = 0; idx < uprv_lengthof(converter); idx++) {
+ for (idx = 0; idx < UPRV_LENGTHOF(converter); idx++) {
UErrorCode status = U_ZERO_ERROR;
UConverter *cnv = cnv_open(converter[idx].name, &status);
if (U_FAILURE(status)) {
/* convert to EBCDIC */
pcu=text;
pc=normal;
- ucnv_fromUnicode(cnv, &pc, normal+uprv_lengthof(normal), &pcu, text+uprv_lengthof(text), NULL, TRUE, &errorCode);
+ ucnv_fromUnicode(cnv, &pc, normal+UPRV_LENGTHOF(normal), &pcu, text+UPRV_LENGTHOF(text), NULL, TRUE, &errorCode);
normalLength=(int32_t)(pc-normal);
pcu=text;
pc=swapped;
- ucnv_fromUnicode(swapCnv, &pc, swapped+uprv_lengthof(swapped), &pcu, text+uprv_lengthof(text), NULL, TRUE, &errorCode);
+ ucnv_fromUnicode(swapCnv, &pc, swapped+UPRV_LENGTHOF(swapped), &pcu, text+UPRV_LENGTHOF(text), NULL, TRUE, &errorCode);
swappedLength=(int32_t)(pc-swapped);
if(U_FAILURE(errorCode)) {
/* convert back to Unicode (may not roundtrip) */
pc=normal;
pu=uNormal;
- ucnv_toUnicode(cnv, &pu, uNormal+uprv_lengthof(uNormal), (const char **)&pc, normal+normalLength, NULL, TRUE, &errorCode);
+ ucnv_toUnicode(cnv, &pu, uNormal+UPRV_LENGTHOF(uNormal), (const char **)&pc, normal+normalLength, NULL, TRUE, &errorCode);
normalLength=(int32_t)(pu-uNormal);
pc=normal;
pu=uSwapped;
- ucnv_toUnicode(swapCnv, &pu, uSwapped+uprv_lengthof(uSwapped), (const char **)&pc, normal+swappedLength, NULL, TRUE, &errorCode);
+ ucnv_toUnicode(swapCnv, &pu, uSwapped+UPRV_LENGTHOF(uSwapped), (const char **)&pc, normal+swappedLength, NULL, TRUE, &errorCode);
swappedLength=(int32_t)(pu-uSwapped);
if(U_FAILURE(errorCode)) {
int i;
- for(i=0; i<uprv_lengthof(tests); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(tests); ++i) {
testSwap(tests[i].name, tests[i].swap);
}
}
log_data_err("Could not create converter for test3. Error: %s\n", u_errorName(status));
return;
}
- for(i=0; i<uprv_lengthof(fromUnicodeTests); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(fromUnicodeTests); ++i) {
char tgt[10];
char* target = tgt;
char* targetLimit = target + 10;
return;
}
ucnv_setToUCallBack(cnv, UCNV_TO_U_CALLBACK_STOP, NULL, oldToUAction, NULL, &status);
- for(i=0; i<uprv_lengthof(toUnicodeTests); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(toUnicodeTests); ++i) {
UChar tgt[20];
UChar* target = tgt;
UChar* targetLimit = target + 20;
log_data_err("ucnv_open(ISO-8859-1) failed - %s\n", u_errorName(errorCode));
return;
}
- ucnv_setSubstString(cnv, sub, uprv_lengthof(sub), &errorCode);
+ ucnv_setSubstString(cnv, sub, UPRV_LENGTHOF(sub), &errorCode);
if(U_FAILURE(errorCode)) {
log_err("ucnv_setSubstString(ISO-8859-1, sub[5]) failed - %s\n", u_errorName(errorCode));
} else {
log_data_err("ucnv_open(HZ) failed - %s\n", u_errorName(errorCode));
return;
}
- ucnv_setSubstString(cnv, sub, uprv_lengthof(sub), &errorCode);
+ ucnv_setSubstString(cnv, sub, UPRV_LENGTHOF(sub), &errorCode);
if(U_FAILURE(errorCode)) {
log_err("ucnv_setSubstString(HZ, sub[5]) failed - %s\n", u_errorName(errorCode));
} else {
"x-UTF-16LE-BOM", "UTF-16LE,version=1"
};
int32_t i;
- for(i = 0; i < uprv_lengthof(names); i += 2) {
+ for(i = 0; i < UPRV_LENGTHOF(names); i += 2) {
UErrorCode errorCode = U_ZERO_ERROR;
UConverter *cnv = ucnv_open(names[i], &errorCode);
if(U_SUCCESS(errorCode)) {
char bytes[10];
int32_t i;
- for(i = 0; i < uprv_lengthof(names); ++i) {
+ for(i = 0; i < UPRV_LENGTHOF(names); ++i) {
UErrorCode errorCode = U_ZERO_ERROR;
UConverter *cnv = ucnv_open(names[i], &errorCode);
int32_t length = 0;
const UChar *defRules;
int32_t i, rlen, j, n;
log_verbose("Testing ucol_openRules for all the locales\n");
- for (i = 0; i < uprv_lengthof(locales); i++)
+ for (i = 0; i < UPRV_LENGTHOF(locales); i++)
{
const char *locale = locales[i];
status = U_ZERO_ERROR;
log_err_status(status, "Fail to create UGenderInfo - %s (Are you missing data?)", u_errorName(status));
return;
}
- actual = ugender_getListGender(actual_gi, kAllFemale, uprv_lengthof(kAllFemale), &status);
+ actual = ugender_getListGender(actual_gi, kAllFemale, UPRV_LENGTHOF(kAllFemale), &status);
if (U_FAILURE(status)) {
log_err("Fail to get gender of list - %s\n", u_errorName(status));
return;
/* test that the default locale has a display name for its own language */
errorCode=U_ZERO_ERROR;
- length=uloc_getDisplayLanguage(NULL, NULL, buffer, uprv_lengthof(buffer), &errorCode);
+ length=uloc_getDisplayLanguage(NULL, NULL, buffer, UPRV_LENGTHOF(buffer), &errorCode);
if(U_FAILURE(errorCode) || (length<=3 && buffer[0]<=0x7f)) {
/* check <=3 to reject getting the language code as a display name */
log_data_err("unable to get a display string for the language of the default locale - %s (Are you missing data?)\n", u_errorName(errorCode));
/* test that we get the language code itself for an unknown language, and a default warning */
errorCode=U_ZERO_ERROR;
- length=uloc_getDisplayLanguage("qq", "rr", buffer, uprv_lengthof(buffer), &errorCode);
+ length=uloc_getDisplayLanguage("qq", "rr", buffer, UPRV_LENGTHOF(buffer), &errorCode);
if(errorCode!=U_USING_DEFAULT_WARNING || length!=2 || buffer[0]!=0x71 || buffer[1]!=0x71) {
log_err("error getting the display string for an unknown language - %s\n", u_errorName(errorCode));
}
/* test that we get a default warning for a display name where one component is unknown (4255) */
errorCode=U_ZERO_ERROR;
- length=uloc_getDisplayName("qq_US_POSIX", "en_US", buffer, uprv_lengthof(buffer), &errorCode);
+ length=uloc_getDisplayName("qq_US_POSIX", "en_US", buffer, UPRV_LENGTHOF(buffer), &errorCode);
if(errorCode!=U_USING_DEFAULT_WARNING) {
log_err("error getting the display name for a locale with an unknown language - %s\n", u_errorName(errorCode));
}
"\\u0399\\u03c3\\u03c0\\u03b1\\u03bd\\u03b9\\u03ba\\u03ac (\\u0397\\u03bc\\u03b5\\u03c1\\u03bf\\u03bb\\u03cc\\u03b3\\u03b9\\u03bf=\\u0399\\u03b1\\u03c0\\u03c9\\u03bd\\u03b9\\u03ba\\u03cc \\u03b7\\u03bc\\u03b5\\u03c1\\u03bf\\u03bb\\u03cc\\u03b3\\u03b9\\u03bf, \\u03a3\\u03b5\\u03b9\\u03c1\\u03ac \\u03c4\\u03b1\\u03be\\u03b9\\u03bd\\u03cc\\u03bc\\u03b7\\u03c3\\u03b7\\u03c2=\\u03a0\\u03b1\\u03c1\\u03b1\\u03b4\\u03bf\\u03c3\\u03b9\\u03b1\\u03ba\\u03ae \\u03c3\\u03b5\\u03b9\\u03c1\\u03ac \\u03c4\\u03b1\\u03be\\u03b9\\u03bd\\u03cc\\u03bc\\u03b7\\u03c3\\u03b7\\u03c2)" };
UChar *expectBuffer;
- for(i=0;i<uprv_lengthof(testL);i++) {
+ for(i=0;i<UPRV_LENGTHOF(testL);i++) {
errorCode = U_ZERO_ERROR;
- uloc_getDisplayName(aLocale, testL[i], buffer, uprv_lengthof(buffer), &errorCode);
+ uloc_getDisplayName(aLocale, testL[i], buffer, UPRV_LENGTHOF(buffer), &errorCode);
if(U_FAILURE(errorCode)) {
log_err("FAIL in uloc_getDisplayName(%s,%s,..) -> %s\n", aLocale, testL[i], u_errorName(errorCode));
} else {
if(ec==U_BUFFER_OVERFLOW_ERROR) {
ec=U_ZERO_ERROR;
}
- len=uloc_getDisplayName(locale, displayLocale, result, uprv_lengthof(result), &ec);
+ len=uloc_getDisplayName(locale, displayLocale, result, UPRV_LENGTHOF(result), &ec);
if(U_FAILURE(ec)) {
log_err("uloc_getDisplayName(%s, %s...) returned error: %s",
locale, displayLocale, u_errorName(ec));
log_err_status(status, "Could not open res_index.res. Exiting. Error: %s\n", u_errorName(status));
return;
}
- for (i=0; i<uprv_lengthof(LOCALE_ALIAS); i++) {
+ for (i=0; i<UPRV_LENGTHOF(LOCALE_ALIAS); i++) {
const char* oldLoc = LOCALE_ALIAS[i][0];
const char* newLoc = LOCALE_ALIAS[i][1];
UCalendar* c1 = NULL;
log_err_status(status, "Could not open res_index.res. Exiting. Error: %s\n", u_errorName(status));
return;
}
- for (i=0; i<uprv_lengthof(LOCALE_ALIAS); i++) {
+ for (i=0; i<UPRV_LENGTHOF(LOCALE_ALIAS); i++) {
const char* oldLoc = LOCALE_ALIAS[i][0];
const char* newLoc = LOCALE_ALIAS[i][1];
UDateFormat* df1 = NULL;
log_err_status(status, "Could not open res_index.res. Exiting. Error: %s\n", u_errorName(status));
return;
}
- for (i=0; i<uprv_lengthof(LOCALE_ALIAS); i++) {
+ for (i=0; i<UPRV_LENGTHOF(LOCALE_ALIAS); i++) {
const char* oldLoc = LOCALE_ALIAS[i][0];
const char* newLoc = LOCALE_ALIAS[i][1];
UCollator* c1 = NULL;
log_err_status(status, "Could not open res_index.res. Exiting. Error: %s\n", u_errorName(status));
return;
}
- for (i=0; i<uprv_lengthof(LOCALE_ALIAS); i++) {
+ for (i=0; i<UPRV_LENGTHOF(LOCALE_ALIAS); i++) {
const char* oldLoc = LOCALE_ALIAS[i][0];
const char* newLoc = LOCALE_ALIAS[i][1];
UChar name1[256], name2[256];
return;
}
resIndex = ures_open(NULL,"res_index", &status);
- for (i=0; i<uprv_lengthof(LOCALE_ALIAS); i++) {
+ for (i=0; i<UPRV_LENGTHOF(LOCALE_ALIAS); i++) {
const char* oldLoc = LOCALE_ALIAS[i][0];
const char* newLoc = LOCALE_ALIAS[i][1];
int32_t capacity = 256;
int i =0;
int j=0;
- for (i=0; i<uprv_lengthof(LOCALE_ALIAS); i++) {
+ for (i=0; i<UPRV_LENGTHOF(LOCALE_ALIAS); i++) {
const char* oldLoc = LOCALE_ALIAS[i][0];
const char* newLoc = LOCALE_ALIAS[i][1];
UErrorCode status = U_ZERO_ERROR;
U_STRING_INIT(pattern, "abc {1} def", 11);
U_STRING_INIT(expected, "abc y def", 9);
- length = u_formatMessage("en", pattern, -1, result, uprv_lengthof(result), &errorCode, x, y);
+ length = u_formatMessage("en", pattern, -1, result, UPRV_LENGTHOF(result), &errorCode, x, y);
if (U_FAILURE(errorCode) || length != u_strlen(expected) || u_strcmp(result, expected) != 0) {
log_err("u_formatMessage(pattern with only {1}, 2 args) failed: result length %d, UErrorCode %s \n",
(int)length, u_errorName(errorCode));
{
status=U_ZERO_ERROR;
}
- length2=unorm_normalize(source, u_strlen(source), mode, 0, result, uprv_lengthof(result), &status);
+ length2=unorm_normalize(source, u_strlen(source), mode, 0, result, UPRV_LENGTHOF(result), &status);
if(U_FAILURE(status) || neededLen!=length2) {
log_data_err("ERROR in unorm_normalize(%s/NUL) at %s: %s - (Are you missing data?)\n",
modeStrings[mode], austrdup(source), myErrorName(status));
} else {
assertEqual(result, cases[x][expIndex], x);
}
- length2=unorm_normalize(source, -1, mode, 0, result, uprv_lengthof(result), &status);
+ length2=unorm_normalize(source, -1, mode, 0, result, UPRV_LENGTHOF(result), &status);
if(U_FAILURE(status) || neededLen!=length2) {
log_data_err("ERROR in unorm_normalize(%s/srcLength) at %s: %s - (Are you missing data?)\n",
modeStrings[mode], austrdup(source), myErrorName(status));
}
void TestDecomp() {
- TestNormCases(UNORM_NFD, canonTests, uprv_lengthof(canonTests));
+ TestNormCases(UNORM_NFD, canonTests, UPRV_LENGTHOF(canonTests));
}
void TestCompatDecomp() {
- TestNormCases(UNORM_NFKD, compatTests, uprv_lengthof(compatTests));
+ TestNormCases(UNORM_NFKD, compatTests, UPRV_LENGTHOF(compatTests));
}
void TestCanonDecompCompose() {
- TestNormCases(UNORM_NFC, canonTests, uprv_lengthof(canonTests));
+ TestNormCases(UNORM_NFC, canonTests, UPRV_LENGTHOF(canonTests));
}
void TestCompatDecompCompose() {
- TestNormCases(UNORM_NFKC, compatTests, uprv_lengthof(compatTests));
+ TestNormCases(UNORM_NFKC, compatTests, UPRV_LENGTHOF(compatTests));
}
void TestFCD() {
- TestNormCases(UNORM_FCD, fcdTests, uprv_lengthof(fcdTests));
+ TestNormCases(UNORM_FCD, fcdTests, UPRV_LENGTHOF(fcdTests));
}
static void assertEqual(const UChar* result, const char* expected, int32_t index)
UChar *c = NULL;
UErrorCode error = U_ZERO_ERROR;
- for (count = 0; count < uprv_lengthof(canonTests); count ++)
+ for (count = 0; count < UPRV_LENGTHOF(canonTests); count ++)
{
d = CharsToUChars(canonTests[count][1]);
c = CharsToUChars(canonTests[count][2]);
free(c);
}
- for (count = 0; count < uprv_lengthof(compatTests); count ++)
+ for (count = 0; count < UPRV_LENGTHOF(compatTests); count ++)
{
d = CharsToUChars(compatTests[count][1]);
c = CharsToUChars(compatTests[count][2]);
}
/* specific cases */
- for(i=0; i<uprv_lengthof(notNFC); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(notNFC); ++i) {
errorCode=U_ZERO_ERROR;
if(unorm_isNormalized(notNFC[i], -1, UNORM_NFC, &errorCode) || U_FAILURE(errorCode)) {
log_data_err("error: isNormalized(notNFC[%d], NFC) is wrong (%s) - (Are you missing data?)\n", i, u_errorName(errorCode));
log_data_err("error: isNormalized(notNFC[%d], NFKC) is wrong (%s) - (Are you missing data?)\n", i, u_errorName(errorCode));
}
}
- for(i=0; i<uprv_lengthof(notNFKC); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(notNFKC); ++i) {
errorCode=U_ZERO_ERROR;
if(unorm_isNormalized(notNFKC[i], -1, UNORM_NFKC, &errorCode) || U_FAILURE(errorCode)) {
log_data_err("error: isNormalized(notNFKC[%d], NFKC) is wrong (%s) - (Are you missing data?)\n", i, u_errorName(errorCode));
UErrorCode errorCode;
int32_t i, length;
- for(i=0; i<uprv_lengthof(tests); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(tests); ++i) {
errorCode=U_ZERO_ERROR;
- length=u_getFC_NFKC_Closure(tests[i].c, buffer, uprv_lengthof(buffer), &errorCode);
+ length=u_getFC_NFKC_Closure(tests[i].c, buffer, UPRV_LENGTHOF(buffer), &errorCode);
if(U_FAILURE(errorCode) || length!=u_strlen(buffer) || 0!=u_strcmp(tests[i].s, buffer)) {
log_data_err("u_getFC_NFKC_Closure(U+%04lx) is wrong (%s) - (Are you missing data?)\n", tests[i].c, u_errorName(errorCode));
}
/* error handling */
errorCode=U_ZERO_ERROR;
- length=u_getFC_NFKC_Closure(0x5c, NULL, uprv_lengthof(buffer), &errorCode);
+ length=u_getFC_NFKC_Closure(0x5c, NULL, UPRV_LENGTHOF(buffer), &errorCode);
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR) {
log_err("u_getFC_NFKC_Closure(dest=NULL) is wrong (%s)\n", u_errorName(errorCode));
}
- length=u_getFC_NFKC_Closure(0x5c, buffer, uprv_lengthof(buffer), &errorCode);
+ length=u_getFC_NFKC_Closure(0x5c, buffer, UPRV_LENGTHOF(buffer), &errorCode);
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR) {
log_err("u_getFC_NFKC_Closure(U_FAILURE) is wrong (%s)\n", u_errorName(errorCode));
}
log_data_err("u_getIntPropertyValue(NFKD)=%d != %d=unorm_quickCheck(NFKD) for U+%04x - (Are you missing data?)\n", qc1, qc2, c);
}
- length=unorm_normalize(s, length, UNORM_NFD, 0, nfd, uprv_lengthof(nfd), &errorCode);
+ length=unorm_normalize(s, length, UNORM_NFD, 0, nfd, UPRV_LENGTHOF(nfd), &errorCode);
/* length-length == 0 is used to get around a compiler warning. */
U16_GET(nfd, 0, length-length, length, lead);
U16_GET(nfd, 0, length-1, length, trail);
UErrorCode errorCode;
int32_t i, length;
- for(i=0; i<uprv_lengthof(cases); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(cases); ++i) {
errorCode=U_ZERO_ERROR;
length=unorm_normalize(
cases[i].input, -1,
cases[i].mode, cases[i].options,
- output, uprv_lengthof(output),
+ output, UPRV_LENGTHOF(output),
&errorCode);
if( U_FAILURE(errorCode) ||
length!=u_strlen(cases[i].expect) ||
return;
}
- length=unorm2_getDecomposition(n2, 0x20, decomp, uprv_lengthof(decomp), &errorCode);
+ length=unorm2_getDecomposition(n2, 0x20, decomp, UPRV_LENGTHOF(decomp), &errorCode);
if(U_FAILURE(errorCode) || length>=0) {
log_err("unorm2_getDecomposition(fcc, space) failed\n");
}
errorCode=U_ZERO_ERROR;
- length=unorm2_getDecomposition(n2, 0xe4, decomp, uprv_lengthof(decomp), &errorCode);
+ length=unorm2_getDecomposition(n2, 0xe4, decomp, UPRV_LENGTHOF(decomp), &errorCode);
if(U_FAILURE(errorCode) || length!=2 || decomp[0]!=0x61 || decomp[1]!=0x308 || decomp[2]!=0) {
log_err("unorm2_getDecomposition(fcc, a-umlaut) failed\n");
}
errorCode=U_ZERO_ERROR;
- length=unorm2_getDecomposition(n2, 0xac01, decomp, uprv_lengthof(decomp), &errorCode);
+ length=unorm2_getDecomposition(n2, 0xac01, decomp, UPRV_LENGTHOF(decomp), &errorCode);
if(U_FAILURE(errorCode) || length!=3 || decomp[0]!=0x1100 || decomp[1]!=0x1161 || decomp[2]!=0x11a8 || decomp[3]!=0) {
log_err("unorm2_getDecomposition(fcc, Hangul syllable U+AC01) failed\n");
}
* without recursive decomposition.
*/
- length=unorm2_getRawDecomposition(n2, 0x20, decomp, uprv_lengthof(decomp), &errorCode);
+ length=unorm2_getRawDecomposition(n2, 0x20, decomp, UPRV_LENGTHOF(decomp), &errorCode);
if(U_FAILURE(errorCode) || length>=0) {
log_err("unorm2_getDecomposition(nfkc, space) failed\n");
}
errorCode=U_ZERO_ERROR;
- length=unorm2_getRawDecomposition(n2, 0xe4, decomp, uprv_lengthof(decomp), &errorCode);
+ length=unorm2_getRawDecomposition(n2, 0xe4, decomp, UPRV_LENGTHOF(decomp), &errorCode);
if(U_FAILURE(errorCode) || length!=2 || decomp[0]!=0x61 || decomp[1]!=0x308 || decomp[2]!=0) {
log_err("unorm2_getDecomposition(nfkc, a-umlaut) failed\n");
}
/* U+1E08 LATIN CAPITAL LETTER C WITH CEDILLA AND ACUTE */
errorCode=U_ZERO_ERROR;
- length=unorm2_getRawDecomposition(n2, 0x1e08, decomp, uprv_lengthof(decomp), &errorCode);
+ length=unorm2_getRawDecomposition(n2, 0x1e08, decomp, UPRV_LENGTHOF(decomp), &errorCode);
if(U_FAILURE(errorCode) || length!=2 || decomp[0]!=0xc7 || decomp[1]!=0x301 || decomp[2]!=0) {
log_err("unorm2_getDecomposition(nfkc, c-cedilla-acute) failed\n");
}
/* U+212B ANGSTROM SIGN */
errorCode=U_ZERO_ERROR;
- length=unorm2_getRawDecomposition(n2, 0x212b, decomp, uprv_lengthof(decomp), &errorCode);
+ length=unorm2_getRawDecomposition(n2, 0x212b, decomp, UPRV_LENGTHOF(decomp), &errorCode);
if(U_FAILURE(errorCode) || length!=1 || decomp[0]!=0xc5 || decomp[1]!=0) {
log_err("unorm2_getDecomposition(nfkc, angstrom sign) failed\n");
}
errorCode=U_ZERO_ERROR;
- length=unorm2_getRawDecomposition(n2, 0xac00, decomp, uprv_lengthof(decomp), &errorCode);
+ length=unorm2_getRawDecomposition(n2, 0xac00, decomp, UPRV_LENGTHOF(decomp), &errorCode);
if(U_FAILURE(errorCode) || length!=2 || decomp[0]!=0x1100 || decomp[1]!=0x1161 || decomp[2]!=0) {
log_err("unorm2_getDecomposition(nfkc, Hangul syllable U+AC00) failed\n");
}
/* A Hangul LVT syllable has a raw decomposition of an LV syllable + T. */
errorCode=U_ZERO_ERROR;
- length=unorm2_getRawDecomposition(n2, 0xac01, decomp, uprv_lengthof(decomp), &errorCode);
+ length=unorm2_getRawDecomposition(n2, 0xac01, decomp, UPRV_LENGTHOF(decomp), &errorCode);
if(U_FAILURE(errorCode) || length!=2 || decomp[0]!=0xac00 || decomp[1]!=0x11a8 || decomp[2]!=0) {
log_err("unorm2_getDecomposition(nfkc, Hangul syllable U+AC01) failed\n");
}
* (Let it modify the destination buffer before reallocating internally.)
*/
length=unorm2_append(n2, a, -1, 6, b, -1, &errorCode);
- if(errorCode!=U_BUFFER_OVERFLOW_ERROR || length!=uprv_lengthof(expected)) {
+ if(errorCode!=U_BUFFER_OVERFLOW_ERROR || length!=UPRV_LENGTHOF(expected)) {
log_err("unorm2_append(preflight) returned wrong length of %d\n", (int)length);
return;
}
return;
}
errorCode=U_ZERO_ERROR;
- length=unorm2_append(n2, a, -1, uprv_lengthof(a), b, -1, &errorCode);
- if(U_FAILURE(errorCode) || length!=uprv_lengthof(expected) || 0!=u_memcmp(a, expected, length)) {
+ length=unorm2_append(n2, a, -1, UPRV_LENGTHOF(a), b, -1, &errorCode);
+ if(U_FAILURE(errorCode) || length!=UPRV_LENGTHOF(expected) || 0!=u_memcmp(a, expected, length)) {
log_err("unorm2_append(real) failed - %s, length %d\n", u_errorName(errorCode), (int)length);
return;
}
log_err_status(errorCode, "unorm2_getNFCInstance() failed: %s\n", u_errorName(errorCode));
return;
}
- length=unorm2_normalize(n2, in, uprv_lengthof(in), out, uprv_lengthof(out), &errorCode);
+ length=unorm2_normalize(n2, in, UPRV_LENGTHOF(in), out, UPRV_LENGTHOF(out), &errorCode);
if(U_FAILURE(errorCode) || length!=2 || out[0]!=0xa0 || out[1]!=0x1e08) {
log_err("unorm2_getNFCInstance() did not return an NFC instance (normalized length=%d; %s)\n",
(int)length, u_errorName(errorCode));
log_err_status(errorCode, "unorm2_getNFDInstance() failed: %s\n", u_errorName(errorCode));
return;
}
- length=unorm2_normalize(n2, in, uprv_lengthof(in), out, uprv_lengthof(out), &errorCode);
+ length=unorm2_normalize(n2, in, UPRV_LENGTHOF(in), out, UPRV_LENGTHOF(out), &errorCode);
if(U_FAILURE(errorCode) || length!=4 || out[0]!=0xa0 || out[1]!=0x43 || out[2]!=0x327 || out[3]!=0x301) {
log_err("unorm2_getNFDInstance() did not return an NFD instance (normalized length=%d; %s)\n",
(int)length, u_errorName(errorCode));
log_err_status(errorCode, "unorm2_getNFKCInstance() failed: %s\n", u_errorName(errorCode));
return;
}
- length=unorm2_normalize(n2, in, uprv_lengthof(in), out, uprv_lengthof(out), &errorCode);
+ length=unorm2_normalize(n2, in, UPRV_LENGTHOF(in), out, UPRV_LENGTHOF(out), &errorCode);
if(U_FAILURE(errorCode) || length!=2 || out[0]!=0x20 || out[1]!=0x1e08) {
log_err("unorm2_getNFKCInstance() did not return an NFKC instance (normalized length=%d; %s)\n",
(int)length, u_errorName(errorCode));
log_err_status(errorCode, "unorm2_getNFKDInstance() failed: %s\n", u_errorName(errorCode));
return;
}
- length=unorm2_normalize(n2, in, uprv_lengthof(in), out, uprv_lengthof(out), &errorCode);
+ length=unorm2_normalize(n2, in, UPRV_LENGTHOF(in), out, UPRV_LENGTHOF(out), &errorCode);
if(U_FAILURE(errorCode) || length!=4 || out[0]!=0x20 || out[1]!=0x43 || out[2]!=0x327 || out[3]!=0x301) {
log_err("unorm2_getNFKDInstance() did not return an NFKD instance (normalized length=%d; %s)\n",
(int)length, u_errorName(errorCode));
log_err_status(errorCode, "unorm2_getNFKCCasefoldInstance() failed: %s\n", u_errorName(errorCode));
return;
}
- length=unorm2_normalize(n2, in, uprv_lengthof(in), out, uprv_lengthof(out), &errorCode);
+ length=unorm2_normalize(n2, in, UPRV_LENGTHOF(in), out, UPRV_LENGTHOF(out), &errorCode);
if(U_FAILURE(errorCode) || length!=2 || out[0]!=0x20 || out[1]!=0x1e09) {
log_err("unorm2_getNFKCCasefoldInstance() did not return an NFKC_Casefold instance (normalized length=%d; %s)\n",
(int)length, u_errorName(errorCode));
}
/* search for some items by key */
- for(i=0; i<uprv_lengthof(testcases); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(testcases); ++i) {
item=ures_getByKey(res, testcases[i].key, item, &errorCode);
if(U_FAILURE(errorCode)) {
log_err("unable to find the key \"%s\" in testdata/testtable32.res - %s\n",
}
/* Use default UBreakIterator: Word breaks. */
- length=ucasemap_toTitle(csm, buffer, uprv_lengthof(buffer), beforeTitle, uprv_lengthof(beforeTitle), &errorCode);
+ length=ucasemap_toTitle(csm, buffer, UPRV_LENGTHOF(buffer), beforeTitle, UPRV_LENGTHOF(beforeTitle), &errorCode);
if( U_FAILURE(errorCode) ||
- length!=uprv_lengthof(titleWord) ||
+ length!=UPRV_LENGTHOF(titleWord) ||
0!=u_memcmp(buffer, titleWord, length) ||
buffer[length]!=0
) {
return;
}
- length=ucasemap_toTitle(csm, buffer, uprv_lengthof(buffer), beforeTitle, uprv_lengthof(beforeTitle), &errorCode);
+ length=ucasemap_toTitle(csm, buffer, UPRV_LENGTHOF(buffer), beforeTitle, UPRV_LENGTHOF(beforeTitle), &errorCode);
if( U_FAILURE(errorCode) ||
- length!=uprv_lengthof(titleWordNoAdjust) ||
+ length!=UPRV_LENGTHOF(titleWordNoAdjust) ||
0!=u_memcmp(buffer, titleWordNoAdjust, length) ||
buffer[length]!=0
) {
}
/* Use the sentence break iterator with the option. Preflight first. */
- length=ucasemap_toTitle(csm, NULL, 0, beforeTitle, uprv_lengthof(beforeTitle), &errorCode);
+ length=ucasemap_toTitle(csm, NULL, 0, beforeTitle, UPRV_LENGTHOF(beforeTitle), &errorCode);
if( errorCode!=U_BUFFER_OVERFLOW_ERROR ||
- length!=uprv_lengthof(titleSentNoLower)
+ length!=UPRV_LENGTHOF(titleSentNoLower)
) {
log_err("ucasemap_toTitle(preflight sentence break iterator, no lowercasing)=%ld failed - %s\n", (long)length, u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
buffer[0]=0;
- length=ucasemap_toTitle(csm, buffer, uprv_lengthof(buffer), beforeTitle, uprv_lengthof(beforeTitle), &errorCode);
+ length=ucasemap_toTitle(csm, buffer, UPRV_LENGTHOF(buffer), beforeTitle, UPRV_LENGTHOF(beforeTitle), &errorCode);
if( U_FAILURE(errorCode) ||
- length!=uprv_lengthof(titleSentNoLower) ||
+ length!=UPRV_LENGTHOF(titleSentNoLower) ||
0!=u_memcmp(buffer, titleSentNoLower, length) ||
buffer[length]!=0
) {
int32_t utf8BeforeTitleLength, utf8TitleSentNoLowerLength;
errorCode=U_ZERO_ERROR;
- u_strToUTF8(utf8BeforeTitle, (int32_t)sizeof(utf8BeforeTitle), &utf8BeforeTitleLength, beforeTitle, uprv_lengthof(beforeTitle), &errorCode);
- u_strToUTF8(utf8TitleSentNoLower, (int32_t)sizeof(utf8TitleSentNoLower), &utf8TitleSentNoLowerLength, titleSentNoLower, uprv_lengthof(titleSentNoLower), &errorCode);
+ u_strToUTF8(utf8BeforeTitle, (int32_t)sizeof(utf8BeforeTitle), &utf8BeforeTitleLength, beforeTitle, UPRV_LENGTHOF(beforeTitle), &errorCode);
+ u_strToUTF8(utf8TitleSentNoLower, (int32_t)sizeof(utf8TitleSentNoLower), &utf8TitleSentNoLowerLength, titleSentNoLower, UPRV_LENGTHOF(titleSentNoLower), &errorCode);
length=ucasemap_utf8ToTitle(csm, utf8, (int32_t)sizeof(utf8), utf8BeforeTitle, utf8BeforeTitleLength, &errorCode);
if( U_FAILURE(errorCode) ||
}
errorCode=U_ZERO_ERROR;
- length=ucnv_toUChars(cnv, us, uprv_lengthof(us), invariantChars, -1, &errorCode);
+ length=ucnv_toUChars(cnv, us, UPRV_LENGTHOF(us), invariantChars, -1, &errorCode);
if(U_FAILURE(errorCode)) {
log_err("ucnv_toUChars(invariantChars) failed - %s\n", u_errorName(errorCode));
- } else if(length!=uprv_lengthof(invariantUChars)-1 || u_strcmp(us, invariantUChars)!=0) {
+ } else if(length!=UPRV_LENGTHOF(invariantUChars)-1 || u_strcmp(us, invariantUChars)!=0) {
log_err("ucnv_toUChars(invariantChars) failed\n");
}
}
}
- for(i=0; i<uprv_lengthof(nonASCIIUChars); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(nonASCIIUChars); ++i) {
if(uprv_isInvariantUString(nonASCIIUChars+i, 1)) {
log_err("uprv_isInvariantUString(nonASCIIUChars[%d]) failed\n", i);
}
{ "\x81\x81\x82", "aab" }
};
int32_t i;
- for(i=1; i<uprv_lengthof(invStrings); ++i) {
+ for(i=1; i<UPRV_LENGTHOF(invStrings); ++i) {
int32_t diff1, diff2;
/* compare previous vs. current */
diff1=getSign(uprv_compareInvEbcdicAsAscii(invStrings[i-1][0], invStrings[i][0]));
UErrorCode status = U_ZERO_ERROR;
UBool passed = TRUE;
- for(i=0; i<uprv_lengthof(codepoints); ++i){
+ for(i=0; i<UPRV_LENGTHOF(codepoints); ++i){
code = uscript_getScript(codepoints[i],&status);
if(U_SUCCESS(status)){
if( code != expected[i] ||
"Ahom", "Hatr", "Modi", "Mult", "Pauc", "Sidd"
};
int32_t j = 0;
- if(uprv_lengthof(expectedLong)!=(USCRIPT_CODE_LIMIT-USCRIPT_BALINESE)) {
+ if(UPRV_LENGTHOF(expectedLong)!=(USCRIPT_CODE_LIMIT-USCRIPT_BALINESE)) {
log_err("need to add new script codes in cucdapi.c!\n");
return;
}
log_err("uscript_getShortName failed for code %i: %s!=%s\n", i, name, expectedShort[j]);
}
}
- for(i=0; i<uprv_lengthof(expectedLong); i++){
+ for(i=0; i<UPRV_LENGTHOF(expectedLong); i++){
UScriptCode fillIn[5] = {USCRIPT_INVALID_CODE};
UErrorCode status = U_ZERO_ERROR;
int32_t len = 0;
- len = uscript_getCode(expectedShort[i], fillIn, uprv_lengthof(fillIn), &status);
+ len = uscript_getCode(expectedShort[i], fillIn, UPRV_LENGTHOF(fillIn), &status);
if(U_FAILURE(status)){
log_err("uscript_getCode failed for script name %s. Error: %s\n",expectedShort[i], u_errorName(status));
}
/* errors and overflows */
errorCode=U_PARSE_ERROR;
- length=uscript_getScriptExtensions(0x0640, scripts, uprv_lengthof(scripts), &errorCode);
+ length=uscript_getScriptExtensions(0x0640, scripts, UPRV_LENGTHOF(scripts), &errorCode);
if(errorCode!=U_PARSE_ERROR) {
log_err("uscript_getScriptExtensions(U+0640, U_PARSE_ERROR) did not preserve the UErrorCode - %s\n",
u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
- length=uscript_getScriptExtensions(0x0640, NULL, uprv_lengthof(scripts), &errorCode);
+ length=uscript_getScriptExtensions(0x0640, NULL, UPRV_LENGTHOF(scripts), &errorCode);
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR) {
log_err("uscript_getScriptExtensions(U+0640, NULL) did not set U_ILLEGAL_ARGUMENT_ERROR - %s\n",
u_errorName(errorCode));
/* invalid code points */
errorCode=U_ZERO_ERROR;
- length=uscript_getScriptExtensions(-1, scripts, uprv_lengthof(scripts), &errorCode);
+ length=uscript_getScriptExtensions(-1, scripts, UPRV_LENGTHOF(scripts), &errorCode);
if(U_FAILURE(errorCode) || length!=1 || scripts[0]!=USCRIPT_UNKNOWN) {
log_err("uscript_getScriptExtensions(-1)=%d does not return {UNKNOWN} - %s\n",
(int)length, u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
- length=uscript_getScriptExtensions(0x110000, scripts, uprv_lengthof(scripts), &errorCode);
+ length=uscript_getScriptExtensions(0x110000, scripts, UPRV_LENGTHOF(scripts), &errorCode);
if(U_FAILURE(errorCode) || length!=1 || scripts[0]!=USCRIPT_UNKNOWN) {
log_err("uscript_getScriptExtensions(0x110000)=%d does not return {UNKNOWN} - %s\n",
(int)length, u_errorName(errorCode));
(int)length, u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
- length=uscript_getScriptExtensions(0x0640, scripts, uprv_lengthof(scripts), &errorCode);
+ length=uscript_getScriptExtensions(0x0640, scripts, UPRV_LENGTHOF(scripts), &errorCode);
if(U_FAILURE(errorCode) || length<3 ||
!scriptsContain(scripts, length, USCRIPT_ARABIC) ||
!scriptsContain(scripts, length, USCRIPT_SYRIAC) ||
(int)length, u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
- length=uscript_getScriptExtensions(0xfdf2, scripts, uprv_lengthof(scripts), &errorCode);
+ length=uscript_getScriptExtensions(0xfdf2, scripts, UPRV_LENGTHOF(scripts), &errorCode);
if(U_FAILURE(errorCode) || length!=2 || scripts[0]!=USCRIPT_ARABIC || scripts[1]!=USCRIPT_THAANA) {
log_err("uscript_getScriptExtensions(U+FDF2)=%d failed - %s\n",
(int)length, u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
- length=uscript_getScriptExtensions(0xff65, scripts, uprv_lengthof(scripts), &errorCode);
+ length=uscript_getScriptExtensions(0xff65, scripts, UPRV_LENGTHOF(scripts), &errorCode);
if(U_FAILURE(errorCode) || length!=6 || scripts[0]!=USCRIPT_BOPOMOFO || scripts[5]!=USCRIPT_YI) {
log_err("uscript_getScriptExtensions(U+FF65)=%d failed - %s\n",
(int)length, u_errorName(errorCode));
UErrorCode errorCode=U_ZERO_ERROR;
UChar sample[8];
- if(uscript_getSampleString(USCRIPT_LATIN, sample, uprv_lengthof(sample), &errorCode)!=1 ||
+ if(uscript_getSampleString(USCRIPT_LATIN, sample, UPRV_LENGTHOF(sample), &errorCode)!=1 ||
U_FAILURE(errorCode) ||
uscript_getScript(sample[0], &errorCode)!=USCRIPT_LATIN ||
sample[1]!=0) {
log_err("uscript_getSampleString(Latn, capacity=0) failed - %s\n", u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
- if(uscript_getSampleString(USCRIPT_INVALID_CODE, sample, uprv_lengthof(sample), &errorCode)!=0 ||
+ if(uscript_getSampleString(USCRIPT_INVALID_CODE, sample, UPRV_LENGTHOF(sample), &errorCode)!=0 ||
U_FAILURE(errorCode) ||
sample[0]!=0) {
log_err("uscript_getSampleString(invalid) failed - %s\n", u_errorName(errorCode));
static const char *const falseValues[]={ "N", "No", "F", "False" };
static const char *const trueValues[]={ "Y", "Yes", "T", "True" };
int32_t i;
- for(i=0; i<uprv_lengthof(falseValues); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(falseValues); ++i) {
if(FALSE!=u_getPropertyValueEnum(UCHAR_ALPHABETIC, falseValues[i])) {
log_data_err("u_getPropertyValueEnum(UCHAR_ALPHABETIC, \"%s\")!=FALSE (Are you missing data?)\n", falseValues[i]);
}
}
- for(i=0; i<uprv_lengthof(trueValues); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(trueValues); ++i) {
if(TRUE!=u_getPropertyValueEnum(UCHAR_ALPHABETIC, trueValues[i])) {
log_data_err("u_getPropertyValueEnum(UCHAR_ALPHABETIC, \"%s\")!=TRUE (Are you missing data?)\n", trueValues[i]);
}
memset(icuVersion, 0, U_MAX_VERSION_STRING_LENGTH);
- testSampleCharProps(u_isspace, "u_isspace", sampleSpaces, uprv_lengthof(sampleSpaces), TRUE);
- testSampleCharProps(u_isspace, "u_isspace", sampleNonSpaces, uprv_lengthof(sampleNonSpaces), FALSE);
+ testSampleCharProps(u_isspace, "u_isspace", sampleSpaces, UPRV_LENGTHOF(sampleSpaces), TRUE);
+ testSampleCharProps(u_isspace, "u_isspace", sampleNonSpaces, UPRV_LENGTHOF(sampleNonSpaces), FALSE);
testSampleCharProps(u_isJavaSpaceChar, "u_isJavaSpaceChar",
- sampleSpaces, uprv_lengthof(sampleSpaces), TRUE);
+ sampleSpaces, UPRV_LENGTHOF(sampleSpaces), TRUE);
testSampleCharProps(u_isJavaSpaceChar, "u_isJavaSpaceChar",
- sampleNonSpaces, uprv_lengthof(sampleNonSpaces), FALSE);
+ sampleNonSpaces, UPRV_LENGTHOF(sampleNonSpaces), FALSE);
testSampleCharProps(u_isWhitespace, "u_isWhitespace",
- sampleWhiteSpaces, uprv_lengthof(sampleWhiteSpaces), TRUE);
+ sampleWhiteSpaces, UPRV_LENGTHOF(sampleWhiteSpaces), TRUE);
testSampleCharProps(u_isWhitespace, "u_isWhitespace",
- sampleNonWhiteSpaces, uprv_lengthof(sampleNonWhiteSpaces), FALSE);
+ sampleNonWhiteSpaces, UPRV_LENGTHOF(sampleNonWhiteSpaces), FALSE);
testSampleCharProps(u_isdefined, "u_isdefined",
- sampleDefined, uprv_lengthof(sampleDefined), TRUE);
+ sampleDefined, UPRV_LENGTHOF(sampleDefined), TRUE);
testSampleCharProps(u_isdefined, "u_isdefined",
- sampleUndefined, uprv_lengthof(sampleUndefined), FALSE);
+ sampleUndefined, UPRV_LENGTHOF(sampleUndefined), FALSE);
- testSampleCharProps(u_isbase, "u_isbase", sampleBase, uprv_lengthof(sampleBase), TRUE);
- testSampleCharProps(u_isbase, "u_isbase", sampleNonBase, uprv_lengthof(sampleNonBase), FALSE);
+ testSampleCharProps(u_isbase, "u_isbase", sampleBase, UPRV_LENGTHOF(sampleBase), TRUE);
+ testSampleCharProps(u_isbase, "u_isbase", sampleNonBase, UPRV_LENGTHOF(sampleNonBase), FALSE);
- testSampleCharProps(u_isdigit, "u_isdigit", sampleDigits, uprv_lengthof(sampleDigits), TRUE);
- testSampleCharProps(u_isdigit, "u_isdigit", sampleNonDigits, uprv_lengthof(sampleNonDigits), FALSE);
+ testSampleCharProps(u_isdigit, "u_isdigit", sampleDigits, UPRV_LENGTHOF(sampleDigits), TRUE);
+ testSampleCharProps(u_isdigit, "u_isdigit", sampleNonDigits, UPRV_LENGTHOF(sampleNonDigits), FALSE);
- for (i = 0; i < uprv_lengthof(sampleDigits); i++) {
+ for (i = 0; i < UPRV_LENGTHOF(sampleDigits); i++) {
if (u_charDigitValue(sampleDigits[i]) != sampleDigitValues[i]) {
log_err("error: u_charDigitValue(U+04x)=%d != %d\n",
sampleDigits[i], u_charDigitValue(sampleDigits[i]), sampleDigitValues[i]);
{ 0xff3a, 37, -1 }
};
- for(i=0; i<uprv_lengthof(data); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(data); ++i) {
if(u_digit(data[i].c, data[i].radix)!=data[i].value) {
log_err("u_digit(U+%04x, %d)=%d expected %d\n",
data[i].c,
mask=1;
for(cl=0; cl<12; ++cl) {
- for(i=0; i<uprv_lengthof(posixData); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(posixData); ++i) {
expect=(UBool)((posixData[i].posixResults&mask)!=0);
if(posixClasses[cl].fn(posixData[i].c)!=expect) {
log_err("u_%s(U+%04x)=%s is wrong\n",
const UChar32 sampleNonPrintable[] = {0x200c, 0x009f, 0x001b};
UChar32 c;
- testSampleCharProps(u_iscntrl, "u_iscntrl", sampleControl, uprv_lengthof(sampleControl), TRUE);
- testSampleCharProps(u_iscntrl, "u_iscntrl", sampleNonControl, uprv_lengthof(sampleNonControl), FALSE);
+ testSampleCharProps(u_iscntrl, "u_iscntrl", sampleControl, UPRV_LENGTHOF(sampleControl), TRUE);
+ testSampleCharProps(u_iscntrl, "u_iscntrl", sampleNonControl, UPRV_LENGTHOF(sampleNonControl), FALSE);
testSampleCharProps(u_isprint, "u_isprint",
- samplePrintable, uprv_lengthof(samplePrintable), TRUE);
+ samplePrintable, UPRV_LENGTHOF(samplePrintable), TRUE);
testSampleCharProps(u_isprint, "u_isprint",
- sampleNonPrintable, uprv_lengthof(sampleNonPrintable), FALSE);
+ sampleNonPrintable, UPRV_LENGTHOF(sampleNonPrintable), FALSE);
/* test all ISO 8 controls */
for(c=0; c<=0x9f; ++c) {
const UChar32 sampleNonIDIgnore[] = {0x0075, 0x00a3, 0x0061};
testSampleCharProps(u_isJavaIDStart, "u_isJavaIDStart",
- sampleJavaIDStart, uprv_lengthof(sampleJavaIDStart), TRUE);
+ sampleJavaIDStart, UPRV_LENGTHOF(sampleJavaIDStart), TRUE);
testSampleCharProps(u_isJavaIDStart, "u_isJavaIDStart",
- sampleNonJavaIDStart, uprv_lengthof(sampleNonJavaIDStart), FALSE);
+ sampleNonJavaIDStart, UPRV_LENGTHOF(sampleNonJavaIDStart), FALSE);
testSampleCharProps(u_isJavaIDPart, "u_isJavaIDPart",
- sampleJavaIDPart, uprv_lengthof(sampleJavaIDPart), TRUE);
+ sampleJavaIDPart, UPRV_LENGTHOF(sampleJavaIDPart), TRUE);
testSampleCharProps(u_isJavaIDPart, "u_isJavaIDPart",
- sampleNonJavaIDPart, uprv_lengthof(sampleNonJavaIDPart), FALSE);
+ sampleNonJavaIDPart, UPRV_LENGTHOF(sampleNonJavaIDPart), FALSE);
/* IDPart should imply IDStart */
testSampleCharProps(u_isJavaIDPart, "u_isJavaIDPart",
- sampleJavaIDStart, uprv_lengthof(sampleJavaIDStart), TRUE);
+ sampleJavaIDStart, UPRV_LENGTHOF(sampleJavaIDStart), TRUE);
testSampleCharProps(u_isIDStart, "u_isIDStart",
- sampleUnicodeIDStart, uprv_lengthof(sampleUnicodeIDStart), TRUE);
+ sampleUnicodeIDStart, UPRV_LENGTHOF(sampleUnicodeIDStart), TRUE);
testSampleCharProps(u_isIDStart, "u_isIDStart",
- sampleNonUnicodeIDStart, uprv_lengthof(sampleNonUnicodeIDStart), FALSE);
+ sampleNonUnicodeIDStart, UPRV_LENGTHOF(sampleNonUnicodeIDStart), FALSE);
testSampleCharProps(u_isIDPart, "u_isIDPart",
- sampleUnicodeIDPart, uprv_lengthof(sampleUnicodeIDPart), TRUE);
+ sampleUnicodeIDPart, UPRV_LENGTHOF(sampleUnicodeIDPart), TRUE);
testSampleCharProps(u_isIDPart, "u_isIDPart",
- sampleNonUnicodeIDPart, uprv_lengthof(sampleNonUnicodeIDPart), FALSE);
+ sampleNonUnicodeIDPart, UPRV_LENGTHOF(sampleNonUnicodeIDPart), FALSE);
/* IDPart should imply IDStart */
testSampleCharProps(u_isIDPart, "u_isIDPart",
- sampleUnicodeIDStart, uprv_lengthof(sampleUnicodeIDStart), TRUE);
+ sampleUnicodeIDStart, UPRV_LENGTHOF(sampleUnicodeIDStart), TRUE);
testSampleCharProps(u_isIDIgnorable, "u_isIDIgnorable",
- sampleIDIgnore, uprv_lengthof(sampleIDIgnore), TRUE);
+ sampleIDIgnore, UPRV_LENGTHOF(sampleIDIgnore), TRUE);
testSampleCharProps(u_isIDIgnorable, "u_isIDIgnorable",
- sampleNonIDIgnore, uprv_lengthof(sampleNonIDIgnore), FALSE);
+ sampleNonIDIgnore, UPRV_LENGTHOF(sampleNonIDIgnore), FALSE);
}
/* for each line of UnicodeData.txt, check some of the properties */
return FALSE;
}
- count=uprv_lengthof(test);
+ count=UPRV_LENGTHOF(test);
for(i=0; i<count; ++i) {
if(start<=test[i][0] && test[i][0]<limit) {
if(type!=(UCharCategory)test[i][1]) {
if(type==U_UNASSIGNED || type==U_PRIVATE_USE_CHAR) {
/* enumerate the intersections of defaultBidi ranges with [start..limit[ */
c=start;
- for(i=0; i<uprv_lengthof(defaultBidi) && c<limit; ++i) {
+ for(i=0; i<UPRV_LENGTHOF(defaultBidi) && c<limit; ++i) {
if((int32_t)c<defaultBidi[i][0]) {
while(c<limit && (int32_t)c<defaultBidi[i][0]) {
if(U_IS_UNICODE_NONCHAR(c) || u_hasBinaryProperty(c, UCHAR_DEFAULT_IGNORABLE_CODE_POINT)) {
const RunTestData *testData;
int32_t nRuns;
} testDataEntries[] = {
- {testData1, uprv_lengthof(testData1)},
- {testData2, uprv_lengthof(testData2)}
+ {testData1, UPRV_LENGTHOF(testData1)},
+ {testData2, UPRV_LENGTHOF(testData2)}
};
- static const int32_t nTestEntries = uprv_lengthof(testDataEntries);
+ static const int32_t nTestEntries = UPRV_LENGTHOF(testDataEntries);
int32_t testEntry;
for (testEntry = 0; testEntry < nTestEntries; testEntry += 1) {
UChar32 c;
int32_t i, type;
- for(i=0; i<uprv_lengthof(values); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(values); ++i) {
c=values[i].c;
type=u_getIntPropertyValue(c, UCHAR_NUMERIC_TYPE);
nv=u_getNumericValue(c);
log_err("u_foldCase(U+%04lx, default)=U+%04lx != U+%04lx\n", (long)c, (long)c2, (long)simple);
}
if((which&CF_FULL)!=0) {
- length2=u_strFoldCase(t, uprv_lengthof(t), s, length, 0, &errorCode);
+ length2=u_strFoldCase(t, UPRV_LENGTHOF(t), s, length, 0, &errorCode);
if(length2!=fullLength || 0!=u_memcmp(t, full, fullLength)) {
log_err("u_strFoldCase(U+%04lx, default) does not fold properly\n", (long)c);
}
log_err("u_foldCase(U+%04lx, turkic)=U+%04lx != U+%04lx\n", (long)c, (long)c2, (long)simple);
}
- length2=u_strFoldCase(t, uprv_lengthof(t), s, length, U_FOLD_CASE_EXCLUDE_SPECIAL_I, &errorCode);
+ length2=u_strFoldCase(t, UPRV_LENGTHOF(t), s, length, U_FOLD_CASE_EXCLUDE_SPECIAL_I, &errorCode);
if(length2!=turkicFullLength || 0!=u_memcmp(t, turkicFull, length2)) {
log_err("u_strFoldCase(U+%04lx, turkic) does not fold properly\n", (long)c);
}
/* first with length */
u32DestLen = -2;
- u_strToUTF32(u32Target, 0, &u32DestLen, src16, uprv_lengthof(src16),&err);
- if(err != U_BUFFER_OVERFLOW_ERROR || u32DestLen != uprv_lengthof(src32)) {
+ u_strToUTF32(u32Target, 0, &u32DestLen, src16, UPRV_LENGTHOF(src16),&err);
+ if(err != U_BUFFER_OVERFLOW_ERROR || u32DestLen != UPRV_LENGTHOF(src32)) {
log_err("u_strToUTF32(preflight with length): "
"length %ld != %ld and %s != U_BUFFER_OVERFLOW_ERROR\n",
- (long)u32DestLen, (long)uprv_lengthof(src32), u_errorName(err));
+ (long)u32DestLen, (long)UPRV_LENGTHOF(src32), u_errorName(err));
return;
}
err = U_ZERO_ERROR;
u32DestLen = -2;
- u_strToUTF32(u32Target, uprv_lengthof(src32)+1, &u32DestLen, src16, uprv_lengthof(src16),&err);
- if(err != U_ZERO_ERROR || u32DestLen != uprv_lengthof(src32)) {
+ u_strToUTF32(u32Target, UPRV_LENGTHOF(src32)+1, &u32DestLen, src16, UPRV_LENGTHOF(src16),&err);
+ if(err != U_ZERO_ERROR || u32DestLen != UPRV_LENGTHOF(src32)) {
log_err("u_strToUTF32(with length): "
"length %ld != %ld and %s != U_ZERO_ERROR\n",
- (long)u32DestLen, (long)uprv_lengthof(src32), u_errorName(err));
+ (long)u32DestLen, (long)UPRV_LENGTHOF(src32), u_errorName(err));
return;
}
/*for(i=0; i< u32DestLen; i++){
printf("\n");
}
}*/
- for(i=0; i< uprv_lengthof(src32); i++){
+ for(i=0; i< UPRV_LENGTHOF(src32); i++){
if(u32Target[i] != src32[i]){
log_verbose("u_strToUTF32(with length) failed expected: %04X got: %04X at index: %i \n", src32[i], u32Target[i],i);
}
/* now NUL-terminated */
u32DestLen = -2;
u_strToUTF32(NULL,0, &u32DestLen, src16, -1,&err);
- if(err != U_BUFFER_OVERFLOW_ERROR || u32DestLen != uprv_lengthof(src32)-1) {
+ if(err != U_BUFFER_OVERFLOW_ERROR || u32DestLen != UPRV_LENGTHOF(src32)-1) {
log_err("u_strToUTF32(preflight with NUL-termination): "
"length %ld != %ld and %s != U_BUFFER_OVERFLOW_ERROR\n",
- (long)u32DestLen, (long)uprv_lengthof(src32)-1, u_errorName(err));
+ (long)u32DestLen, (long)UPRV_LENGTHOF(src32)-1, u_errorName(err));
return;
}
err = U_ZERO_ERROR;
u32DestLen = -2;
- u_strToUTF32(u32Target, uprv_lengthof(src32), &u32DestLen, src16, -1,&err);
- if(err != U_ZERO_ERROR || u32DestLen != uprv_lengthof(src32)-1) {
+ u_strToUTF32(u32Target, UPRV_LENGTHOF(src32), &u32DestLen, src16, -1,&err);
+ if(err != U_ZERO_ERROR || u32DestLen != UPRV_LENGTHOF(src32)-1) {
log_err("u_strToUTF32(with NUL-termination): "
"length %ld != %ld and %s != U_ZERO_ERROR\n",
- (long)u32DestLen, (long)uprv_lengthof(src32)-1, u_errorName(err));
+ (long)u32DestLen, (long)UPRV_LENGTHOF(src32)-1, u_errorName(err));
return;
}
- for(i=0; i< uprv_lengthof(src32); i++){
+ for(i=0; i< UPRV_LENGTHOF(src32); i++){
if(u32Target[i] != src32[i]){
log_verbose("u_strToUTF32(NUL-termination) failed expected: %04X got: %04X \n", src32[i], u32Target[i]);
}
static const UChar32 expected[] = { 0x5a, 0x50000, 0x7a, 0 };
static const UChar32 expected_FFFD[] = { 0x41, 0xfffd, 0x61, 0xfffd, 0x5a, 0x50000, 0x7a, 0 };
static const UChar32 expected_12345[] = { 0x41, 0x12345, 0x61, 0x12345, 0x5a, 0x50000, 0x7a, 0 };
- len16 = uprv_lengthof(surr16);
+ len16 = UPRV_LENGTHOF(surr16);
for(i = 0; i < 4; ++i) {
err = U_ZERO_ERROR;
u_strToUTF32(u32Target, 0, &u32DestLen, surr16+i, len16-i, &err);
}
err = U_ZERO_ERROR;
- u_strToUTF32(u32Target, uprv_lengthof(u32Target), &u32DestLen, surr16+i, len16-i, &err);
+ u_strToUTF32(u32Target, UPRV_LENGTHOF(u32Target), &u32DestLen, surr16+i, len16-i, &err);
if(err != U_INVALID_CHAR_FOUND) {
log_err("u_strToUTF32(surr16+%ld) sets %s != U_INVALID_CHAR_FOUND\n",
(long)i, u_errorName(err));
}
err = U_ZERO_ERROR;
- u_strToUTF32(u32Target, uprv_lengthof(u32Target), &u32DestLen, surr16+i, -1, &err);
+ u_strToUTF32(u32Target, UPRV_LENGTHOF(u32Target), &u32DestLen, surr16+i, -1, &err);
if(err != U_INVALID_CHAR_FOUND) {
log_err("u_strToUTF32(surr16+%ld/NUL) sets %s != U_INVALID_CHAR_FOUND\n",
(long)i, u_errorName(err));
}
err = U_ZERO_ERROR;
- u_strToUTF32(u32Target, uprv_lengthof(u32Target), &u32DestLen, surr16+4, len16-4-1, &err);
+ u_strToUTF32(u32Target, UPRV_LENGTHOF(u32Target), &u32DestLen, surr16+4, len16-4-1, &err);
if(err != U_ZERO_ERROR || u32DestLen != 3 || uprv_memcmp(u32Target, expected, 4*4)) {
log_err("u_strToUTF32(surr16+4) sets %s != U_ZERO_ERROR or does not produce the expected string\n",
u_errorName(err));
}
err = U_ZERO_ERROR;
- u_strToUTF32(u32Target, uprv_lengthof(u32Target), &u32DestLen, surr16+4, -1, &err);
+ u_strToUTF32(u32Target, UPRV_LENGTHOF(u32Target), &u32DestLen, surr16+4, -1, &err);
if(err != U_ZERO_ERROR || u32DestLen != 3 || uprv_memcmp(u32Target, expected, 4*4)) {
log_err("u_strToUTF32(surr16+4/NUL) sets %s != U_ZERO_ERROR or does not produce the expected string\n",
u_errorName(err));
}
err = U_ZERO_ERROR;
- u_strToUTF32WithSub(u32Target, uprv_lengthof(u32Target), &u32DestLen, surr16, len16-1, 0xfffd, &numSubstitutions, &err);
+ u_strToUTF32WithSub(u32Target, UPRV_LENGTHOF(u32Target), &u32DestLen, surr16, len16-1, 0xfffd, &numSubstitutions, &err);
if(err != U_ZERO_ERROR || u32DestLen != 7 || numSubstitutions != 2 || uprv_memcmp(u32Target, expected_FFFD, 8*4)) {
log_err("u_strToUTF32WithSub(surr16) sets %s != U_ZERO_ERROR or does not produce the expected string\n",
u_errorName(err));
}
err = U_ZERO_ERROR;
- u_strToUTF32WithSub(u32Target, uprv_lengthof(u32Target), &u32DestLen, surr16, -1, 0x12345, &numSubstitutions, &err);
+ u_strToUTF32WithSub(u32Target, UPRV_LENGTHOF(u32Target), &u32DestLen, surr16, -1, 0x12345, &numSubstitutions, &err);
if(err != U_ZERO_ERROR || u32DestLen != 7 || numSubstitutions != 2 || uprv_memcmp(u32Target, expected_12345, 8*4)) {
log_err("u_strToUTF32WithSub(surr16/NUL) sets %s != U_ZERO_ERROR or does not produce the expected string\n",
u_errorName(err));
/* first with length */
uDestLen = -2;
- u_strFromUTF32(uTarget,0,&uDestLen,src32,uprv_lengthof(src32),&err);
- if(err != U_BUFFER_OVERFLOW_ERROR || uDestLen != uprv_lengthof(src16)) {
+ u_strFromUTF32(uTarget,0,&uDestLen,src32,UPRV_LENGTHOF(src32),&err);
+ if(err != U_BUFFER_OVERFLOW_ERROR || uDestLen != UPRV_LENGTHOF(src16)) {
log_err("u_strFromUTF32(preflight with length): "
"length %ld != %ld and %s != U_BUFFER_OVERFLOW_ERROR\n",
- (long)uDestLen, (long)uprv_lengthof(src16), u_errorName(err));
+ (long)uDestLen, (long)UPRV_LENGTHOF(src16), u_errorName(err));
return;
}
err = U_ZERO_ERROR;
uDestLen = -2;
- u_strFromUTF32(uTarget, uprv_lengthof(src16)+1,&uDestLen,src32,uprv_lengthof(src32),&err);
- if(err != U_ZERO_ERROR || uDestLen != uprv_lengthof(src16)) {
+ u_strFromUTF32(uTarget, UPRV_LENGTHOF(src16)+1,&uDestLen,src32,UPRV_LENGTHOF(src32),&err);
+ if(err != U_ZERO_ERROR || uDestLen != UPRV_LENGTHOF(src16)) {
log_err("u_strFromUTF32(with length): "
"length %ld != %ld and %s != U_ZERO_ERROR\n",
- (long)uDestLen, (long)uprv_lengthof(src16), u_errorName(err));
+ (long)uDestLen, (long)UPRV_LENGTHOF(src16), u_errorName(err));
return;
}
/*for(i=0; i< uDestLen; i++){
/* now NUL-terminated */
uDestLen = -2;
u_strFromUTF32(NULL,0,&uDestLen,src32,-1,&err);
- if(err != U_BUFFER_OVERFLOW_ERROR || uDestLen != uprv_lengthof(src16)-1) {
+ if(err != U_BUFFER_OVERFLOW_ERROR || uDestLen != UPRV_LENGTHOF(src16)-1) {
log_err("u_strFromUTF32(preflight with NUL-termination): "
"length %ld != %ld and %s != U_BUFFER_OVERFLOW_ERROR\n",
- (long)uDestLen, (long)uprv_lengthof(src16)-1, u_errorName(err));
+ (long)uDestLen, (long)UPRV_LENGTHOF(src16)-1, u_errorName(err));
return;
}
err = U_ZERO_ERROR;
uDestLen = -2;
- u_strFromUTF32(uTarget, uprv_lengthof(src16),&uDestLen,src32,-1,&err);
- if(err != U_ZERO_ERROR || uDestLen != uprv_lengthof(src16)-1) {
+ u_strFromUTF32(uTarget, UPRV_LENGTHOF(src16),&uDestLen,src32,-1,&err);
+ if(err != U_ZERO_ERROR || uDestLen != UPRV_LENGTHOF(src16)-1) {
log_err("u_strFromUTF32(with NUL-termination): "
"length %ld != %ld and %s != U_ZERO_ERROR\n",
- (long)uDestLen, (long)uprv_lengthof(src16)-1, u_errorName(err));
+ (long)uDestLen, (long)UPRV_LENGTHOF(src16)-1, u_errorName(err));
return;
}
static const UChar expected_FFFD[] = { 0x41, 0xfffd, 0x61, 0xfffd, 0xfffd, 0xfffd, 0x5a, 0xd900, 0xdc00, 0x7a, 0 };
static const UChar expected_12345[] = { 0x41, 0xd808, 0xdf45, 0x61, 0xd808, 0xdf45, 0xd808, 0xdf45, 0xd808, 0xdf45,
0x5a, 0xd900, 0xdc00, 0x7a, 0 };
- len32 = uprv_lengthof(surr32);
+ len32 = UPRV_LENGTHOF(surr32);
for(i = 0; i < 6; ++i) {
err = U_ZERO_ERROR;
u_strFromUTF32(uTarget, 0, &uDestLen, surr32+i, len32-i, &err);
}
err = U_ZERO_ERROR;
- u_strFromUTF32(uTarget, uprv_lengthof(uTarget), &uDestLen, surr32+i, len32-i, &err);
+ u_strFromUTF32(uTarget, UPRV_LENGTHOF(uTarget), &uDestLen, surr32+i, len32-i, &err);
if(err != U_INVALID_CHAR_FOUND) {
log_err("u_strFromUTF32(surr32+%ld) sets %s != U_INVALID_CHAR_FOUND\n",
(long)i, u_errorName(err));
}
err = U_ZERO_ERROR;
- u_strFromUTF32(uTarget, uprv_lengthof(uTarget), &uDestLen, surr32+i, -1, &err);
+ u_strFromUTF32(uTarget, UPRV_LENGTHOF(uTarget), &uDestLen, surr32+i, -1, &err);
if(err != U_INVALID_CHAR_FOUND) {
log_err("u_strFromUTF32(surr32+%ld/NUL) sets %s != U_INVALID_CHAR_FOUND\n",
(long)i, u_errorName(err));
}
err = U_ZERO_ERROR;
- u_strFromUTF32(uTarget, uprv_lengthof(uTarget), &uDestLen, surr32+6, len32-6-1, &err);
+ u_strFromUTF32(uTarget, UPRV_LENGTHOF(uTarget), &uDestLen, surr32+6, len32-6-1, &err);
if(err != U_ZERO_ERROR || uDestLen != 4 || u_memcmp(uTarget, expected, 5)) {
log_err("u_strFromUTF32(surr32+6) sets %s != U_ZERO_ERROR or does not produce the expected string\n",
u_errorName(err));
}
err = U_ZERO_ERROR;
- u_strFromUTF32(uTarget, uprv_lengthof(uTarget), &uDestLen, surr32+6, -1, &err);
+ u_strFromUTF32(uTarget, UPRV_LENGTHOF(uTarget), &uDestLen, surr32+6, -1, &err);
if(err != U_ZERO_ERROR || uDestLen != 4 || u_memcmp(uTarget, expected, 5)) {
log_err("u_strFromUTF32(surr32+6/NUL) sets %s != U_ZERO_ERROR or does not produce the expected string\n",
u_errorName(err));
}
err = U_ZERO_ERROR;
- u_strFromUTF32WithSub(uTarget, uprv_lengthof(uTarget), &uDestLen, surr32, len32-1, 0xfffd, &numSubstitutions, &err);
+ u_strFromUTF32WithSub(uTarget, UPRV_LENGTHOF(uTarget), &uDestLen, surr32, len32-1, 0xfffd, &numSubstitutions, &err);
if(err != U_ZERO_ERROR || uDestLen != 10 || numSubstitutions != 4 || u_memcmp(uTarget, expected_FFFD, 11)) {
log_err("u_strFromUTF32WithSub(surr32) sets %s != U_ZERO_ERROR or does not produce the expected string\n",
u_errorName(err));
}
err = U_ZERO_ERROR;
- u_strFromUTF32WithSub(uTarget, uprv_lengthof(uTarget), &uDestLen, surr32, -1, 0x12345, &numSubstitutions, &err);
+ u_strFromUTF32WithSub(uTarget, UPRV_LENGTHOF(uTarget), &uDestLen, surr32, -1, 0x12345, &numSubstitutions, &err);
if(err != U_ZERO_ERROR || uDestLen != 14 || numSubstitutions != 4 || u_memcmp(uTarget, expected_12345, 15)) {
log_err("u_strFromUTF32WithSub(surr32/NUL) sets %s != U_ZERO_ERROR or does not produce the expected string\n",
u_errorName(err));
char out8[10];
if(
- (err=U_ZERO_ERROR, u_strToUTF8(out8, uprv_lengthof(out8), NULL, withLead16, uprv_lengthof(withLead16), &err), err!=U_INVALID_CHAR_FOUND) ||
- (err=U_ZERO_ERROR, u_strToUTF8(out8, uprv_lengthof(out8), NULL, withTrail16, -1, &err), err!=U_INVALID_CHAR_FOUND) ||
- (err=U_ZERO_ERROR, u_strFromUTF8(out16, uprv_lengthof(out16), NULL, (const char *)withLead8, uprv_lengthof(withLead8), &err), err!=U_INVALID_CHAR_FOUND) ||
- (err=U_ZERO_ERROR, u_strFromUTF8(out16, uprv_lengthof(out16), NULL, (const char *)withTrail8, -1, &err), err!=U_INVALID_CHAR_FOUND)
+ (err=U_ZERO_ERROR, u_strToUTF8(out8, UPRV_LENGTHOF(out8), NULL, withLead16, UPRV_LENGTHOF(withLead16), &err), err!=U_INVALID_CHAR_FOUND) ||
+ (err=U_ZERO_ERROR, u_strToUTF8(out8, UPRV_LENGTHOF(out8), NULL, withTrail16, -1, &err), err!=U_INVALID_CHAR_FOUND) ||
+ (err=U_ZERO_ERROR, u_strFromUTF8(out16, UPRV_LENGTHOF(out16), NULL, (const char *)withLead8, UPRV_LENGTHOF(withLead8), &err), err!=U_INVALID_CHAR_FOUND) ||
+ (err=U_ZERO_ERROR, u_strFromUTF8(out16, UPRV_LENGTHOF(out16), NULL, (const char *)withTrail8, -1, &err), err!=U_INVALID_CHAR_FOUND)
) {
log_err("error: u_strTo/FromUTF8(string with single surrogate) fails to report error\n");
}
numSubstitutions=-1;
out16[0]=0x55aa;
uDestLen=0;
- u_strFromUTF8WithSub(out16, uprv_lengthof(out16), &uDestLen,
+ u_strFromUTF8WithSub(out16, UPRV_LENGTHOF(out16), &uDestLen,
(const char *)withTrail8, uprv_strlen((const char *)withTrail8),
0x50005, &numSubstitutions,
&err);
numSubstitutions=-1;
out16[0]=0x55aa;
uDestLen=0;
- u_strFromUTF8WithSub(out16, uprv_lengthof(out16), &uDestLen,
+ u_strFromUTF8WithSub(out16, UPRV_LENGTHOF(out16), &uDestLen,
(const char *)withTrail8, -1,
0xfffd, &numSubstitutions,
&err);
numSubstitutions=-1;
out8[0]=(char)0xf5;
u8DestLen=0;
- u_strToUTF8WithSub(out8, uprv_lengthof(out8), &u8DestLen,
+ u_strToUTF8WithSub(out8, UPRV_LENGTHOF(out8), &u8DestLen,
withTrail16, u_strlen(withTrail16),
0xfffd, &numSubstitutions,
&err);
numSubstitutions=-1;
out8[0]=(char)0xf5;
u8DestLen=0;
- u_strToUTF8WithSub(out8, uprv_lengthof(out8), &u8DestLen,
+ u_strToUTF8WithSub(out8, UPRV_LENGTHOF(out8), &u8DestLen,
withTrail16, -1,
0x1a, &numSubstitutions,
&err);
numSubstitutions=-1;
out16[0]=0x55aa;
uDestLen=0;
- u_strFromUTF8WithSub(out16, uprv_lengthof(out16), &uDestLen,
+ u_strFromUTF8WithSub(out16, UPRV_LENGTHOF(out16), &uDestLen,
(const char *)withTrail8, 3,
0x50005, &numSubstitutions,
&err);
numSubstitutions=-1;
out8[0]=(char)0xf5;
u8DestLen=0;
- u_strToUTF8WithSub(out8, uprv_lengthof(out8), &u8DestLen,
+ u_strToUTF8WithSub(out8, UPRV_LENGTHOF(out8), &u8DestLen,
withTrail16, 1,
0xfffd, &numSubstitutions,
&err);
numSubstitutions=-1;
out16[0]=0x55aa;
uDestLen=0;
- u_strFromUTF8WithSub(out16, uprv_lengthof(out16), &uDestLen,
+ u_strFromUTF8WithSub(out16, UPRV_LENGTHOF(out16), &uDestLen,
(const char *)withTrail8, 3,
U_SENTINEL, &numSubstitutions,
&err);
numSubstitutions=-1;
out8[0]=(char)0xf5;
u8DestLen=0;
- u_strToUTF8WithSub(out8, uprv_lengthof(out8), &u8DestLen,
+ u_strToUTF8WithSub(out8, UPRV_LENGTHOF(out8), &u8DestLen,
withTrail16, 1,
U_SENTINEL, &numSubstitutions,
&err);
static const char src[1]={ (char)0xf8 };
UChar out16[10];
err=U_ZERO_ERROR;
- u_strFromUTF8(out16, uprv_lengthof(out16), NULL, src, 1, &err);
+ u_strFromUTF8(out16, UPRV_LENGTHOF(out16), NULL, src, 1, &err);
if(err!=U_INVALID_CHAR_FOUND) {
log_err("error: u_strFromUTF8(5-byte lead byte) failed\n");
}
errorCode=U_ZERO_ERROR;
dest[0]=dest[1]=99;
destLength=-99;
- destPointer=u_strFromUTF8(dest, uprv_lengthof(dest), &destLength, (const char *)bytes, 3, &errorCode);
+ destPointer=u_strFromUTF8(dest, UPRV_LENGTHOF(dest), &destLength, (const char *)bytes, 3, &errorCode);
if(U_FAILURE(errorCode) || destPointer!=dest || destLength!=1 || dest[0]!=0x95c || dest[1]!=0) {
log_err("error: u_strFromUTF8(transform srcLength=3) fails: destLength=%ld - %s\n",
(long)destLength, u_errorName(errorCode));
dest[0]=dest[destLength0]=0x1234;
destLength=-1;
errorCode=U_ZERO_ERROR;
- pDest=u_strFromUTF8Lenient(dest, uprv_lengthof(dest), &destLength, pb, -1, &errorCode);
+ pDest=u_strFromUTF8Lenient(dest, UPRV_LENGTHOF(dest), &destLength, pb, -1, &errorCode);
if (errorCode!=U_ZERO_ERROR ||
pDest!=dest || dest[destLength0]!=0 ||
destLength!=destLength0 || !equalAnyFFFD(dest, pu, destLength)
dest[0]=dest[destLength0]=0x1234;
destLength=-1;
errorCode=U_ZERO_ERROR;
- pDest=u_strFromUTF8Lenient(dest, uprv_lengthof(dest), &destLength, pb, srcLength, &errorCode);
+ pDest=u_strFromUTF8Lenient(dest, UPRV_LENGTHOF(dest), &destLength, pb, srcLength, &errorCode);
if (errorCode!=U_ZERO_ERROR ||
pDest!=dest || dest[destLength0]!=0 ||
destLength!=destLength0 || !equalAnyFFFD(dest, pu, destLength)
err=U_ZERO_ERROR;
buffer[3]=0x20ac;
- wDestLen=u_terminateWChars(buffer, uprv_lengthof(buffer), 3, &err);
+ wDestLen=u_terminateWChars(buffer, UPRV_LENGTHOF(buffer), 3, &err);
if(err!=U_ZERO_ERROR || wDestLen!=3 || buffer[3]!=0) {
log_err("u_terminateWChars(buffer, all, 3, zero) failed: %s length %d [3]==U+%04x\n",
u_errorName(err), wDestLen, buffer[3]);
err=U_STRING_NOT_TERMINATED_WARNING;
buffer[3]=0x20ac;
- wDestLen=u_terminateWChars(buffer, uprv_lengthof(buffer), 3, &err);
+ wDestLen=u_terminateWChars(buffer, UPRV_LENGTHOF(buffer), 3, &err);
if(err!=U_ZERO_ERROR || wDestLen!=3 || buffer[3]!=0) {
log_err("u_terminateWChars(buffer, all, 3, not-terminated) failed: %s length %d [3]==U+%04x\n",
u_errorName(err), wDestLen, buffer[3]);
errorCode=U_ZERO_ERROR;
length=-5;
p=u_strToJavaModifiedUTF8(dest, (int32_t)sizeof(dest), &length,
- src, uprv_lengthof(src), &errorCode);
+ src, UPRV_LENGTHOF(src), &errorCode);
if( U_FAILURE(errorCode) || p!=dest ||
- length!=uprv_lengthof(expected) || 0!=memcmp(dest, expected, length) ||
+ length!=UPRV_LENGTHOF(expected) || 0!=memcmp(dest, expected, length) ||
dest[length]!=0
) {
log_err("u_strToJavaModifiedUTF8(normal) failed - %s\n", u_errorName(errorCode));
errorCode=U_ZERO_ERROR;
length=-5;
p=u_strToJavaModifiedUTF8(dest, (int32_t)sizeof(dest), NULL,
- src, uprv_lengthof(src), &errorCode);
+ src, UPRV_LENGTHOF(src), &errorCode);
if( U_FAILURE(errorCode) || p!=dest ||
- 0!=memcmp(dest, expected, uprv_lengthof(expected)) ||
- dest[uprv_lengthof(expected)]!=0
+ 0!=memcmp(dest, expected, UPRV_LENGTHOF(expected)) ||
+ dest[UPRV_LENGTHOF(expected)]!=0
) {
log_err("u_strToJavaModifiedUTF8(normal, pLength=NULL) failed - %s\n", u_errorName(errorCode));
}
memset(dest, 0xff, sizeof(dest));
errorCode=U_ZERO_ERROR;
length=-5;
- p=u_strToJavaModifiedUTF8(dest, uprv_lengthof(expected), &length,
- src, uprv_lengthof(src), &errorCode);
+ p=u_strToJavaModifiedUTF8(dest, UPRV_LENGTHOF(expected), &length,
+ src, UPRV_LENGTHOF(src), &errorCode);
if( errorCode!=U_STRING_NOT_TERMINATED_WARNING || p!=dest ||
- length!=uprv_lengthof(expected) || 0!=memcmp(dest, expected, length) ||
+ length!=UPRV_LENGTHOF(expected) || 0!=memcmp(dest, expected, length) ||
dest[length]!=(char)0xff
) {
log_err("u_strToJavaModifiedUTF8(tight) failed - %s\n", u_errorName(errorCode));
memset(dest, 0xff, sizeof(dest));
errorCode=U_ZERO_ERROR;
length=-5;
- p=u_strToJavaModifiedUTF8(dest, uprv_lengthof(expected)/2, &length,
- src, uprv_lengthof(src), &errorCode);
+ p=u_strToJavaModifiedUTF8(dest, UPRV_LENGTHOF(expected)/2, &length,
+ src, UPRV_LENGTHOF(src), &errorCode);
if( errorCode!=U_BUFFER_OVERFLOW_ERROR ||
- length!=uprv_lengthof(expected) || dest[uprv_lengthof(expected)/2]!=(char)0xff
+ length!=UPRV_LENGTHOF(expected) || dest[UPRV_LENGTHOF(expected)/2]!=(char)0xff
) {
log_err("u_strToJavaModifiedUTF8(overflow) failed - %s\n", u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
length=-5;
p=u_strToJavaModifiedUTF8(NULL, 0, &length,
- src, uprv_lengthof(src), &errorCode);
+ src, UPRV_LENGTHOF(src), &errorCode);
if( errorCode!=U_BUFFER_OVERFLOW_ERROR ||
- length!=uprv_lengthof(expected) || dest[0]!=(char)0xff
+ length!=UPRV_LENGTHOF(expected) || dest[0]!=(char)0xff
) {
log_err("u_strToJavaModifiedUTF8(pure preflighting) failed - %s\n", u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
length=-5;
p=u_strToJavaModifiedUTF8(dest, (int32_t)sizeof(dest), &length,
- shortSrc, uprv_lengthof(shortSrc), &errorCode);
+ shortSrc, UPRV_LENGTHOF(shortSrc), &errorCode);
if( U_FAILURE(errorCode) || p!=dest ||
- length!=uprv_lengthof(shortExpected) || 0!=memcmp(dest, shortExpected, length) ||
+ length!=UPRV_LENGTHOF(shortExpected) || 0!=memcmp(dest, shortExpected, length) ||
dest[length]!=0
) {
log_err("u_strToJavaModifiedUTF8(short) failed - %s\n", u_errorName(errorCode));
p=u_strToJavaModifiedUTF8(dest, (int32_t)sizeof(dest), &length,
asciiNul, -1, &errorCode);
if( U_FAILURE(errorCode) || p!=dest ||
- length!=uprv_lengthof(asciiNulExpected) || 0!=memcmp(dest, asciiNulExpected, length) ||
+ length!=UPRV_LENGTHOF(asciiNulExpected) || 0!=memcmp(dest, asciiNulExpected, length) ||
dest[length]!=0
) {
log_err("u_strToJavaModifiedUTF8(asciiNul) failed - %s\n", u_errorName(errorCode));
errorCode=U_ZERO_ERROR;
length=-5;
p=u_strToJavaModifiedUTF8(NULL, sizeof(dest), &length,
- src, uprv_lengthof(src), &errorCode);
+ src, UPRV_LENGTHOF(src), &errorCode);
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR || dest[0]!=(char)0xff) {
log_err("u_strToJavaModifiedUTF8(dest=NULL) failed - %s\n", u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
length=-5;
p=u_strToJavaModifiedUTF8(dest, -1, &length,
- src, uprv_lengthof(src), &errorCode);
+ src, UPRV_LENGTHOF(src), &errorCode);
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR || dest[0]!=(char)0xff) {
log_err("u_strToJavaModifiedUTF8(destCapacity<0) failed - %s\n", u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
length=-5;
p=u_strToJavaModifiedUTF8(dest, sizeof(dest), &length,
- NULL, uprv_lengthof(src), &errorCode);
+ NULL, UPRV_LENGTHOF(src), &errorCode);
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR || dest[0]!=(char)0xff) {
log_err("u_strToJavaModifiedUTF8(src=NULL) failed - %s\n", u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
length=numSubstitutions=-5;
p=u_strFromJavaModifiedUTF8WithSub(dest, (int32_t)sizeof(dest), &length,
- (const char *)src, uprv_lengthof(src),
+ (const char *)src, UPRV_LENGTHOF(src),
0xfffd, &numSubstitutions, &errorCode);
if( U_FAILURE(errorCode) || p!=dest ||
- length!=uprv_lengthof(expected) || 0!=memcmp(dest, expected, length) ||
+ length!=UPRV_LENGTHOF(expected) || 0!=memcmp(dest, expected, length) ||
dest[length]!=0 ||
- numSubstitutions!=uprv_lengthof(invalidExpectedFFFD)
+ numSubstitutions!=UPRV_LENGTHOF(invalidExpectedFFFD)
) {
log_err("u_strFromJavaModifiedUTF8WithSub(normal) failed - %s\n", u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
length=numSubstitutions=-5;
p=u_strFromJavaModifiedUTF8WithSub(dest, (int32_t)sizeof(dest), NULL,
- (const char *)src, uprv_lengthof(src),
+ (const char *)src, UPRV_LENGTHOF(src),
0xfffd, &numSubstitutions, &errorCode);
if( U_FAILURE(errorCode) || p!=dest ||
- 0!=memcmp(dest, expected, uprv_lengthof(expected)) ||
- dest[uprv_lengthof(expected)]!=0 ||
- numSubstitutions!=uprv_lengthof(invalidExpectedFFFD)
+ 0!=memcmp(dest, expected, UPRV_LENGTHOF(expected)) ||
+ dest[UPRV_LENGTHOF(expected)]!=0 ||
+ numSubstitutions!=UPRV_LENGTHOF(invalidExpectedFFFD)
) {
log_err("u_strFromJavaModifiedUTF8WithSub(normal, pLength=NULL) failed - %s\n", u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
length=numSubstitutions=-5;
p=u_strFromJavaModifiedUTF8WithSub(dest, (int32_t)sizeof(dest), &length,
- (const char *)src, uprv_lengthof(src),
+ (const char *)src, UPRV_LENGTHOF(src),
0xfffd, NULL, &errorCode);
if( U_FAILURE(errorCode) || p!=dest ||
- length!=uprv_lengthof(expected) || 0!=memcmp(dest, expected, length) ||
+ length!=UPRV_LENGTHOF(expected) || 0!=memcmp(dest, expected, length) ||
dest[length]!=0
) {
log_err("u_strFromJavaModifiedUTF8WithSub(normal, pNumSubstitutions=NULL) failed - %s\n", u_errorName(errorCode));
memset(dest, 0xff, sizeof(dest));
errorCode=U_ZERO_ERROR;
length=numSubstitutions=-5;
- p=u_strFromJavaModifiedUTF8WithSub(dest, uprv_lengthof(expected), &length,
- (const char *)src, uprv_lengthof(src),
+ p=u_strFromJavaModifiedUTF8WithSub(dest, UPRV_LENGTHOF(expected), &length,
+ (const char *)src, UPRV_LENGTHOF(src),
0xfffd, &numSubstitutions, &errorCode);
if( errorCode!=U_STRING_NOT_TERMINATED_WARNING || p!=dest ||
- length!=uprv_lengthof(expected) || 0!=memcmp(dest, expected, length) ||
+ length!=UPRV_LENGTHOF(expected) || 0!=memcmp(dest, expected, length) ||
dest[length]!=0xffff ||
- numSubstitutions!=uprv_lengthof(invalidExpectedFFFD)
+ numSubstitutions!=UPRV_LENGTHOF(invalidExpectedFFFD)
) {
log_err("u_strFromJavaModifiedUTF8WithSub(tight) failed - %s\n", u_errorName(errorCode));
}
memset(dest, 0xff, sizeof(dest));
errorCode=U_ZERO_ERROR;
length=numSubstitutions=-5;
- p=u_strFromJavaModifiedUTF8WithSub(dest, uprv_lengthof(expected)/2, &length,
- (const char *)src, uprv_lengthof(src),
+ p=u_strFromJavaModifiedUTF8WithSub(dest, UPRV_LENGTHOF(expected)/2, &length,
+ (const char *)src, UPRV_LENGTHOF(src),
0xfffd, &numSubstitutions, &errorCode);
if( errorCode!=U_BUFFER_OVERFLOW_ERROR ||
- length!=uprv_lengthof(expected) || dest[uprv_lengthof(expected)/2]!=0xffff
+ length!=UPRV_LENGTHOF(expected) || dest[UPRV_LENGTHOF(expected)/2]!=0xffff
) {
log_err("u_strFromJavaModifiedUTF8WithSub(overflow) failed - %s\n", u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
length=numSubstitutions=-5;
p=u_strFromJavaModifiedUTF8WithSub(NULL, 0, &length,
- (const char *)src, uprv_lengthof(src),
+ (const char *)src, UPRV_LENGTHOF(src),
0xfffd, &numSubstitutions, &errorCode);
if( errorCode!=U_BUFFER_OVERFLOW_ERROR ||
- length!=uprv_lengthof(expected) || dest[0]!=0xffff
+ length!=UPRV_LENGTHOF(expected) || dest[0]!=0xffff
) {
log_err("u_strFromJavaModifiedUTF8WithSub(pure preflighting) failed - %s\n", u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
length=numSubstitutions=-5;
p=u_strFromJavaModifiedUTF8WithSub(dest, (int32_t)sizeof(dest), &length,
- (const char *)shortSrc, uprv_lengthof(shortSrc),
+ (const char *)shortSrc, UPRV_LENGTHOF(shortSrc),
0xfffd, &numSubstitutions, &errorCode);
if( U_FAILURE(errorCode) || p!=dest ||
- length!=uprv_lengthof(shortExpected) || 0!=memcmp(dest, shortExpected, length) ||
+ length!=UPRV_LENGTHOF(shortExpected) || 0!=memcmp(dest, shortExpected, length) ||
dest[length]!=0 ||
numSubstitutions!=0
) {
(const char *)asciiNul, -1,
0xfffd, &numSubstitutions, &errorCode);
if( U_FAILURE(errorCode) || p!=dest ||
- length!=uprv_lengthof(asciiNulExpected) || 0!=memcmp(dest, asciiNulExpected, length) ||
+ length!=UPRV_LENGTHOF(asciiNulExpected) || 0!=memcmp(dest, asciiNulExpected, length) ||
dest[length]!=0 ||
numSubstitutions!=0
) {
errorCode=U_ZERO_ERROR;
length=numSubstitutions=-5;
p=u_strFromJavaModifiedUTF8WithSub(dest, (int32_t)sizeof(dest), &length,
- (const char *)invalid, uprv_lengthof(invalid),
+ (const char *)invalid, UPRV_LENGTHOF(invalid),
0xfffd, &numSubstitutions, &errorCode);
if( U_FAILURE(errorCode) || p!=dest ||
- length!=uprv_lengthof(invalidExpectedFFFD) || 0!=memcmp(dest, invalidExpectedFFFD, length) ||
+ length!=UPRV_LENGTHOF(invalidExpectedFFFD) || 0!=memcmp(dest, invalidExpectedFFFD, length) ||
dest[length]!=0 ||
- numSubstitutions!=uprv_lengthof(invalidExpectedFFFD)
+ numSubstitutions!=UPRV_LENGTHOF(invalidExpectedFFFD)
) {
log_err("u_strFromJavaModifiedUTF8WithSub(invalid->fffd) failed - %s\n", u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
length=numSubstitutions=-5;
p=u_strFromJavaModifiedUTF8WithSub(dest, (int32_t)sizeof(dest), &length,
- (const char *)invalid, uprv_lengthof(invalid),
+ (const char *)invalid, UPRV_LENGTHOF(invalid),
0x50000, &numSubstitutions, &errorCode);
if( U_FAILURE(errorCode) || p!=dest ||
- length!=uprv_lengthof(invalidExpected50000) || 0!=memcmp(dest, invalidExpected50000, length) ||
+ length!=UPRV_LENGTHOF(invalidExpected50000) || 0!=memcmp(dest, invalidExpected50000, length) ||
dest[length]!=0 ||
- numSubstitutions!=uprv_lengthof(invalidExpectedFFFD) /* not ...50000 */
+ numSubstitutions!=UPRV_LENGTHOF(invalidExpectedFFFD) /* not ...50000 */
) {
log_err("u_strFromJavaModifiedUTF8WithSub(invalid->50000) failed - %s\n", u_errorName(errorCode));
}
errorCode=U_ZERO_ERROR;
length=numSubstitutions=-5;
p=u_strFromJavaModifiedUTF8WithSub(dest, (int32_t)sizeof(dest), &length,
- (const char *)invalid, uprv_lengthof(invalid),
+ (const char *)invalid, UPRV_LENGTHOF(invalid),
U_SENTINEL, &numSubstitutions, &errorCode);
if(errorCode!=U_INVALID_CHAR_FOUND || dest[0]!=0xffff || numSubstitutions!=0) {
log_err("u_strFromJavaModifiedUTF8WithSub(invalid->error) failed - %s\n", u_errorName(errorCode));
errorCode=U_ZERO_ERROR;
length=numSubstitutions=-5;
p=u_strFromJavaModifiedUTF8WithSub(dest, (int32_t)sizeof(dest), &length,
- (const char *)src, uprv_lengthof(src),
+ (const char *)src, UPRV_LENGTHOF(src),
U_SENTINEL, &numSubstitutions, &errorCode);
if( errorCode!=U_INVALID_CHAR_FOUND ||
- length>=uprv_lengthof(expected) || dest[uprv_lengthof(expected)-1]!=0xffff ||
+ length>=UPRV_LENGTHOF(expected) || dest[UPRV_LENGTHOF(expected)-1]!=0xffff ||
numSubstitutions!=0
) {
log_err("u_strFromJavaModifiedUTF8WithSub(normal->error) failed - %s\n", u_errorName(errorCode));
errorCode=U_ZERO_ERROR;
length=numSubstitutions=-5;
p=u_strFromJavaModifiedUTF8WithSub(NULL, sizeof(dest), &length,
- (const char *)src, uprv_lengthof(src),
+ (const char *)src, UPRV_LENGTHOF(src),
0xfffd, &numSubstitutions, &errorCode);
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR || dest[0]!=0xffff) {
log_err("u_strFromJavaModifiedUTF8WithSub(dest=NULL) failed - %s\n", u_errorName(errorCode));
errorCode=U_ZERO_ERROR;
length=numSubstitutions=-5;
p=u_strFromJavaModifiedUTF8WithSub(dest, -1, &length,
- (const char *)src, uprv_lengthof(src),
+ (const char *)src, UPRV_LENGTHOF(src),
0xfffd, &numSubstitutions, &errorCode);
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR || dest[0]!=0xffff) {
log_err("u_strFromJavaModifiedUTF8WithSub(destCapacity<0) failed - %s\n", u_errorName(errorCode));
errorCode=U_ZERO_ERROR;
length=numSubstitutions=-5;
p=u_strFromJavaModifiedUTF8WithSub(dest, sizeof(dest), &length,
- NULL, uprv_lengthof(src),
+ NULL, UPRV_LENGTHOF(src),
0xfffd, &numSubstitutions, &errorCode);
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR || dest[0]!=0xffff) {
log_err("u_strFromJavaModifiedUTF8WithSub(src=NULL) failed - %s\n", u_errorName(errorCode));
errorCode=U_ZERO_ERROR;
length=numSubstitutions=-5;
p=u_strFromJavaModifiedUTF8WithSub(dest, sizeof(dest), &length,
- (const char *)src, uprv_lengthof(src),
+ (const char *)src, UPRV_LENGTHOF(src),
0x110000, &numSubstitutions, &errorCode);
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR || dest[0]!=0xffff) {
log_err("u_strFromJavaModifiedUTF8WithSub(subchar=U_SENTINEL) failed - %s\n", u_errorName(errorCode));
errorCode=U_ZERO_ERROR;
length=numSubstitutions=-5;
p=u_strFromJavaModifiedUTF8WithSub(dest, sizeof(dest), &length,
- (const char *)src, uprv_lengthof(src),
+ (const char *)src, UPRV_LENGTHOF(src),
0xdfff, &numSubstitutions, &errorCode);
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR || dest[0]!=0xffff) {
log_err("u_strFromJavaModifiedUTF8WithSub(subchar is surrogate) failed - %s\n", u_errorName(errorCode));
dest16[0]=3;
length=3;
errorCode=U_ZERO_ERROR;
- u_strFromUTF8(dest16, uprv_lengthof(dest16), &length, NULL, 0, &errorCode);
+ u_strFromUTF8(dest16, UPRV_LENGTHOF(dest16), &length, NULL, 0, &errorCode);
if(errorCode!=U_ZERO_ERROR || length!=0 || dest16[0]!=0 || dest16[1]!=3) {
log_err("u_strFromUTF8(source=NULL, sourceLength=0) failed\n");
}
dest16[0]=3;
length=3;
errorCode=U_ZERO_ERROR;
- u_strFromUTF8WithSub(dest16, uprv_lengthof(dest16), &length, NULL, 0, 0xfffd, NULL, &errorCode);
+ u_strFromUTF8WithSub(dest16, UPRV_LENGTHOF(dest16), &length, NULL, 0, 0xfffd, NULL, &errorCode);
if(errorCode!=U_ZERO_ERROR || length!=0 || dest16[0]!=0 || dest16[1]!=3) {
log_err("u_strFromUTF8WithSub(source=NULL, sourceLength=0) failed\n");
}
dest16[0]=3;
length=3;
errorCode=U_ZERO_ERROR;
- u_strFromUTF8Lenient(dest16, uprv_lengthof(dest16), &length, NULL, 0, &errorCode);
+ u_strFromUTF8Lenient(dest16, UPRV_LENGTHOF(dest16), &length, NULL, 0, &errorCode);
if(errorCode!=U_ZERO_ERROR || length!=0 || dest16[0]!=0 || dest16[1]!=3) {
log_err("u_strFromUTF8Lenient(source=NULL, sourceLength=0) failed\n");
}
dest16[0]=3;
length=3;
errorCode=U_ZERO_ERROR;
- u_strFromUTF32(dest16, uprv_lengthof(dest16), &length, NULL, 0, &errorCode);
+ u_strFromUTF32(dest16, UPRV_LENGTHOF(dest16), &length, NULL, 0, &errorCode);
if(errorCode!=U_ZERO_ERROR || length!=0 || dest16[0]!=0 || dest16[1]!=3) {
log_err("u_strFromUTF32(source=NULL, sourceLength=0) failed\n");
}
dest16[0]=3;
length=3;
errorCode=U_ZERO_ERROR;
- u_strFromUTF32WithSub(dest16, uprv_lengthof(dest16), &length, NULL, 0, 0xfffd, NULL, &errorCode);
+ u_strFromUTF32WithSub(dest16, UPRV_LENGTHOF(dest16), &length, NULL, 0, 0xfffd, NULL, &errorCode);
if(errorCode!=U_ZERO_ERROR || length!=0 || dest16[0]!=0 || dest16[1]!=3) {
log_err("u_strFromUTF32WithSub(source=NULL, sourceLength=0) failed\n");
}
dest16[0]=3;
length=3;
errorCode=U_ZERO_ERROR;
- u_strFromJavaModifiedUTF8WithSub(dest16, uprv_lengthof(dest16), &length, NULL, 0, 0xfffd, NULL, &errorCode);
+ u_strFromJavaModifiedUTF8WithSub(dest16, UPRV_LENGTHOF(dest16), &length, NULL, 0, 0xfffd, NULL, &errorCode);
if(errorCode!=U_ZERO_ERROR || length!=0 || dest16[0]!=0 || dest16[1]!=3) {
log_err("u_strFromJavaModifiedUTF8WithSub(source=NULL, sourceLength=0) failed\n");
}
dest8[0]=3;
length=3;
errorCode=U_ZERO_ERROR;
- u_strToUTF8(dest8, uprv_lengthof(dest8), &length, NULL, 0, &errorCode);
+ u_strToUTF8(dest8, UPRV_LENGTHOF(dest8), &length, NULL, 0, &errorCode);
if(errorCode!=U_ZERO_ERROR || length!=0 || dest8[0]!=0 || dest8[1]!=3) {
log_err("u_strToUTF8(source=NULL, sourceLength=0) failed\n");
}
dest8[0]=3;
length=3;
errorCode=U_ZERO_ERROR;
- u_strToUTF8WithSub(dest8, uprv_lengthof(dest8), &length, NULL, 0, 0xfffd, NULL, &errorCode);
+ u_strToUTF8WithSub(dest8, UPRV_LENGTHOF(dest8), &length, NULL, 0, 0xfffd, NULL, &errorCode);
if(errorCode!=U_ZERO_ERROR || length!=0 || dest8[0]!=0 || dest8[1]!=3) {
log_err("u_strToUTF8(source=NULL, sourceLength=0) failed\n");
}
dest32[0]=3;
length=3;
errorCode=U_ZERO_ERROR;
- u_strToUTF32(dest32, uprv_lengthof(dest32), &length, NULL, 0, &errorCode);
+ u_strToUTF32(dest32, UPRV_LENGTHOF(dest32), &length, NULL, 0, &errorCode);
if(errorCode!=U_ZERO_ERROR || length!=0 || dest32[0]!=0 || dest32[1]!=3) {
log_err("u_strToUTF32(source=NULL, sourceLength=0) failed\n");
}
dest32[0]=3;
length=3;
errorCode=U_ZERO_ERROR;
- u_strToUTF32WithSub(dest32, uprv_lengthof(dest32), &length, NULL, 0, 0xfffd, NULL, &errorCode);
+ u_strToUTF32WithSub(dest32, UPRV_LENGTHOF(dest32), &length, NULL, 0, 0xfffd, NULL, &errorCode);
if(errorCode!=U_ZERO_ERROR || length!=0 || dest32[0]!=0 || dest32[1]!=3) {
log_err("u_strToUTF32WithSub(source=NULL, sourceLength=0) failed\n");
}
dest8[0]=3;
length=3;
errorCode=U_ZERO_ERROR;
- u_strToJavaModifiedUTF8(dest8, uprv_lengthof(dest8), &length, NULL, 0, &errorCode);
+ u_strToJavaModifiedUTF8(dest8, UPRV_LENGTHOF(dest8), &length, NULL, 0, &errorCode);
if(errorCode!=U_ZERO_ERROR || length!=0 || dest8[0]!=0 || dest8[1]!=3) {
log_err("u_strToJavaModifiedUTF8(source=NULL, sourceLength=0) failed\n");
}
dest16[0]=3;
length=3;
errorCode=U_ZERO_ERROR;
- u_strFromWCS(dest16, uprv_lengthof(dest16), &length, NULL, 0, &errorCode);
+ u_strFromWCS(dest16, UPRV_LENGTHOF(dest16), &length, NULL, 0, &errorCode);
if(errorCode!=U_ZERO_ERROR || length!=0 || dest16[0]!=0 || dest16[1]!=3) {
log_err("u_strFromWCS(source=NULL, sourceLength=0) failed\n");
}
destW[0]=3;
length=3;
errorCode=U_ZERO_ERROR;
- u_strToWCS(destW, uprv_lengthof(destW), &length, NULL, 0, &errorCode);
+ u_strToWCS(destW, UPRV_LENGTHOF(destW), &length, NULL, 0, &errorCode);
if(errorCode!=U_ZERO_ERROR || length!=0 || destW[0]!=0 || destW[1]!=3) {
log_err("u_strToWCS(source=NULL, sourceLength=0) failed\n");
}
if(
first!=u_strchr(s, nul) ||
first!=u_strchr32(s, nul) ||
- first!=u_memchr(s, nul, uprv_lengthof(s)) ||
- first!=u_memchr32(s, nul, uprv_lengthof(s)) ||
+ first!=u_memchr(s, nul, UPRV_LENGTHOF(s)) ||
+ first!=u_memchr32(s, nul, UPRV_LENGTHOF(s)) ||
first!=u_strrchr(s, nul) ||
first!=u_strrchr32(s, nul) ||
- first!=u_memrchr(s, nul, uprv_lengthof(s)) ||
- first!=u_memrchr32(s, nul, uprv_lengthof(s))
+ first!=u_memrchr(s, nul, UPRV_LENGTHOF(s)) ||
+ first!=u_memrchr32(s, nul, UPRV_LENGTHOF(s))
) {
log_err("error: one of the u_str[|mem][r]chr[32](s, nul) does not find the terminator of s\n");
}
s!=u_strstr(s, &nul) ||
s!=u_strFindFirst(s, -1, &nul, -1) ||
s!=u_strFindFirst(s, -1, &nul, 0) ||
- s!=u_strFindFirst(s, uprv_lengthof(s), &nul, -1) ||
- s!=u_strFindFirst(s, uprv_lengthof(s), &nul, 0) ||
+ s!=u_strFindFirst(s, UPRV_LENGTHOF(s), &nul, -1) ||
+ s!=u_strFindFirst(s, UPRV_LENGTHOF(s), &nul, 0) ||
s!=u_strrstr(s, &nul) ||
s!=u_strFindLast(s, -1, &nul, -1) ||
s!=u_strFindLast(s, -1, &nul, 0) ||
- s!=u_strFindLast(s, uprv_lengthof(s), &nul, -1) ||
- s!=u_strFindLast(s, uprv_lengthof(s), &nul, 0)
+ s!=u_strFindLast(s, UPRV_LENGTHOF(s), &nul, -1) ||
+ s!=u_strFindLast(s, UPRV_LENGTHOF(s), &nul, 0)
) {
log_err("error: one of the u_str[str etc](s, \"\") does not find s itself\n");
}
int32_t i, length, number;
/* test u_strHasMoreChar32Than() with length>=0 */
- length=uprv_lengthof(string);
+ length=UPRV_LENGTHOF(string);
while(length>=0) {
for(i=0; i<=length; ++i) {
for(number=-1; number<=((length-i)+2); ++number) {
}
/* test u_strHasMoreChar32Than() with NUL-termination (length=-1) */
- length=uprv_lengthof(string);
+ length=UPRV_LENGTHOF(string);
u_memcpy(buffer, string, length);
while(length>=0) {
buffer[length]=0;
}
/* test get/set state */
- length=uprv_lengthof(text)-1;
+ length=UPRV_LENGTHOF(text)-1;
uiter_setString(&iter1, text, -1);
uiter_setString(&iter2, text, length);
testIteratorState(&iter1, &iter2, "UTF16IteratorState", length/2);
compareIterators(&iter1, "UTF16Iterator", &iter2, "UTF8Iterator_1");
/* test get/set state */
- length=uprv_lengthof(text)-1;
+ length=UPRV_LENGTHOF(text)-1;
uiter_setUTF8(&iter1, bytes, -1);
testIteratorState(&iter1, &iter2, "UTF8IteratorState", length/2);
testIteratorState(&iter1, &iter2, "UTF8IteratorStatePlus1", length/2+1);
0xFE0F, 0xFEFF, 0x0000
};
- int32_t len1 = uprv_lengthof(ul1)-1/*remove the null termination*/;
- int32_t destLen = uprv_lengthof(dest);
+ int32_t len1 = UPRV_LENGTHOF(ul1)-1/*remove the null termination*/;
+ int32_t destLen = UPRV_LENGTHOF(dest);
UErrorCode status = U_ZERO_ERROR;
UParseError ps;
int32_t len = (int32_t)strlen(cl);
}
status = U_ZERO_ERROR;
- destLen = uprv_lengthof(dest);
+ destLen = UPRV_LENGTHOF(dest);
len = -1;
destLen = uidna_toUnicode(ul, len, dest, destLen, UIDNA_DEFAULT, &ps, &status);
if(status != U_ZERO_ERROR){
log_err_status(status, "uidna_toUnicode failed with error %s.\n", u_errorName(status));
}
status = U_ZERO_ERROR;
- destLen = uprv_lengthof(dest);
+ destLen = UPRV_LENGTHOF(dest);
len = (int32_t)strlen(cl);
destLen = uidna_toASCII(ul, len, dest, destLen, UIDNA_DEFAULT, &ps, &status);
if(status != U_IDNA_LABEL_TOO_LONG_ERROR){
}
status = U_ZERO_ERROR;
- destLen = uprv_lengthof(dest);
+ destLen = UPRV_LENGTHOF(dest);
len = -1;
destLen = uidna_toASCII(ul, len, dest, destLen, UIDNA_DEFAULT, &ps, &status);
if(status != U_IDNA_LABEL_TOO_LONG_ERROR){
}
status = U_ZERO_ERROR;
- destLen = uprv_lengthof(dest);
+ destLen = UPRV_LENGTHOF(dest);
destLen = uidna_toASCII(ul1, len1, dest, destLen, UIDNA_DEFAULT, &ps, &status);
if(status != U_ZERO_ERROR){
log_err_status(status, "uidna_toASCII failed with error %s.\n", u_errorName(status));
}
status = U_ZERO_ERROR;
- destLen = uprv_lengthof(dest);
+ destLen = UPRV_LENGTHOF(dest);
len1 = -1;
destLen = uidna_toASCII(ul1, len1, dest, destLen, UIDNA_DEFAULT, &ps, &status);
if(status != U_ZERO_ERROR){
static const char* cl = "my_very_very_long_and_incredibly_uncreative_domain_label.my_very_very_long_and_incredibly_uncreative_domain_label.my_very_very_long_and_incredibly_uncreative_domain_label.my_very_very_long_and_incredibly_uncreative_domain_label.my_very_very_long_and_incredibly_uncreative_domain_label.my_very_very_long_and_incredibly_uncreative_domain_label.ibm.com";
UChar ul[400] = {'\0'};
UChar dest[400] = {'\0'};
- int32_t destLen = uprv_lengthof(dest);
+ int32_t destLen = UPRV_LENGTHOF(dest);
UErrorCode status = U_ZERO_ERROR;
UParseError ps;
int32_t len = (int32_t)strlen(cl);
}
status = U_ZERO_ERROR;
- destLen = uprv_lengthof(dest);
+ destLen = UPRV_LENGTHOF(dest);
len = -1;
destLen = uidna_IDNToUnicode(ul, len, dest, destLen, UIDNA_DEFAULT, &ps, &status);
if(status != U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR){
}
status = U_ZERO_ERROR;
- destLen = uprv_lengthof(dest);
+ destLen = UPRV_LENGTHOF(dest);
len = (int32_t)strlen(cl);
destLen = uidna_IDNToASCII(ul, len, dest, destLen, UIDNA_DEFAULT, &ps, &status);
if(status != U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR){
}
status = U_ZERO_ERROR;
- destLen = uprv_lengthof(dest);
+ destLen = UPRV_LENGTHOF(dest);
len = -1;
destLen = uidna_IDNToASCII(ul, len, dest, destLen, UIDNA_DEFAULT, &ps, &status);
if(status != U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR){
/* These calls should succeed. */
length = uidna_labelToASCII(uts46, fA_sharps16, -1,
- dest16, uprv_lengthof(dest16), &info, &errorCode);
+ dest16, UPRV_LENGTHOF(dest16), &info, &errorCode);
if( U_FAILURE(errorCode) || length != 4 || 0 != u_memcmp(dest16, fass16, 5) ||
!info.isTransitionalDifferent || info.errors != 0
) {
}
errorCode = U_ZERO_ERROR;
length = uidna_labelToUnicode(uts46, fA_sharps16, u_strlen(fA_sharps16),
- dest16, uprv_lengthof(dest16), &info, &errorCode);
+ dest16, UPRV_LENGTHOF(dest16), &info, &errorCode);
if( U_FAILURE(errorCode) || length != 3 || 0 != u_memcmp(dest16, fa_sharps16, 4) ||
!info.isTransitionalDifferent || info.errors != 0
) {
errorCode = U_ZERO_ERROR;
length = uidna_labelToASCII_UTF8(uts46, fA_sharps8, -1,
- dest8, uprv_lengthof(dest8), &info, &errorCode);
+ dest8, UPRV_LENGTHOF(dest8), &info, &errorCode);
if( U_FAILURE(errorCode) || length != 4 || 0 != memcmp(dest8, fass8, 5) ||
!info.isTransitionalDifferent || info.errors != 0
) {
}
errorCode = U_ZERO_ERROR;
length = uidna_labelToUnicodeUTF8(uts46, fA_sharps8, strlen(fA_sharps8),
- dest8, uprv_lengthof(dest8), &info, &errorCode);
+ dest8, UPRV_LENGTHOF(dest8), &info, &errorCode);
if( U_FAILURE(errorCode) || length != 4 || 0 != memcmp(dest8, fa_sharps8, 5) ||
!info.isTransitionalDifferent || info.errors != 0
) {
/* These calls should fail. */
errorCode = U_USELESS_COLLATOR_ERROR;
length = uidna_labelToASCII(uts46, fA_sharps16, -1,
- dest16, uprv_lengthof(dest16), &info, &errorCode);
+ dest16, UPRV_LENGTHOF(dest16), &info, &errorCode);
if(errorCode != U_USELESS_COLLATOR_ERROR) {
log_err("uidna_labelToASCII(failure) failed: %s\n", u_errorName(errorCode));
}
errorCode = U_ZERO_ERROR;
length = uidna_labelToUnicode(uts46, fA_sharps16, u_strlen(fA_sharps16),
- dest16, uprv_lengthof(dest16), NULL, &errorCode);
+ dest16, UPRV_LENGTHOF(dest16), NULL, &errorCode);
if(errorCode != U_ILLEGAL_ARGUMENT_ERROR) {
log_err("uidna_labelToUnicode(UIDNAInfo=NULL) failed: %s\n", u_errorName(errorCode));
}
errorCode = U_ZERO_ERROR;
length = uidna_labelToASCII_UTF8(uts46, fA_sharps8, -1,
- NULL, uprv_lengthof(dest8), &info, &errorCode);
+ NULL, UPRV_LENGTHOF(dest8), &info, &errorCode);
if(errorCode != U_ILLEGAL_ARGUMENT_ERROR) {
log_err("uidna_labelToASCII_UTF8(dest=NULL) failed: %s\n", u_errorName(errorCode));
}
source=(const char *)bytes;
sourceLimit=source+length;
target=buffer;
- targetLimit=buffer+uprv_lengthof(buffer);
+ targetLimit=buffer+UPRV_LENGTHOF(buffer);
/* 1. input bytes with flush=FALSE, then input nothing with flush=TRUE */
ucnv_toUnicode(cnv, &target, targetLimit, &source, sourceLimit, NULL, FALSE, &errorCode);
};
int32_t i;
- for(i=0; i<uprv_lengthof(testCases); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(testCases); ++i) {
doTestTruncated(testCases[i].cnvName, testCases[i].bytes, testCases[i].length);
}
}
}
/* test converters that are known to convert all of Unicode (except maybe for surrogates) */
- for(i=0; i<uprv_lengthof(completeSetNames); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(completeSetNames); ++i) {
errorCode=U_ZERO_ERROR;
name=completeSetNames[i];
cnv=ucnv_open(name, &errorCode);
#if !UCONFIG_NO_LEGACY_CONVERSION
/* test LMBCS variants which convert all of Unicode except for U+F6xx */
- for(i=0; i<uprv_lengthof(lmbcsNames); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(lmbcsNames); ++i) {
errorCode=U_ZERO_ERROR;
name=lmbcsNames[i];
cnv=ucnv_open(name, &errorCode);
#endif
/* test specific sets */
- for(i=0; i<uprv_lengthof(nameRanges); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(nameRanges); ++i) {
errorCode=U_ZERO_ERROR;
name=nameRanges[i].name;
cnv=ucnv_open(name, &errorCode);
*prefixLen = i;
*suffixLen = srcLength - i;
/* special prefixes must not be followed by suffixes! */
- if((findStringIndex(special_prefixes,uprv_lengthof(special_prefixes), *prefix, *prefixLen-1) != -1) && (*suffix != NULL)){
+ if((findStringIndex(special_prefixes,UPRV_LENGTHOF(special_prefixes), *prefix, *prefixLen-1) != -1) && (*suffix != NULL)){
*status = U_PARSE_ERROR;
return;
}
"UTF16"
};
- for (i = 0; i < uprv_lengthof(fixedWidth); i++) {
+ for (i = 0; i < UPRV_LENGTHOF(fixedWidth); i++) {
cnv = ucnv_open(fixedWidth[i], &status);
if (cnv == NULL || U_FAILURE(status)) {
log_data_err("Error open converter: %s - %s \n", fixedWidth[i], u_errorName(status));
ucnv_close(cnv);
}
- for (i = 0; i < uprv_lengthof(notFixedWidth); i++) {
+ for (i = 0; i < UPRV_LENGTHOF(notFixedWidth); i++) {
cnv = ucnv_open(notFixedWidth[i], &status);
if (cnv == NULL || U_FAILURE(status)) {
log_data_err("Error open converter: %s - %s \n", notFixedWidth[i], u_errorName(status));
/* sort small array (stable) */
errorCode=U_ZERO_ERROR;
- uprv_sortArray(small, uprv_lengthof(small), sizeof(small[0]), uprv_uint16Comparator, NULL, TRUE, &errorCode);
+ uprv_sortArray(small, UPRV_LENGTHOF(small), sizeof(small[0]), uprv_uint16Comparator, NULL, TRUE, &errorCode);
if(U_FAILURE(errorCode)) {
log_err("uprv_sortArray(small) failed - %s\n", u_errorName(errorCode));
return;
}
- for(i=1; i<uprv_lengthof(small); ++i) {
+ for(i=1; i<UPRV_LENGTHOF(small); ++i) {
if(small[i-1]>small[i]) {
log_err("uprv_sortArray(small) mis-sorted [%d]=%u > [%d]=%u\n", i-1, small[i-1], i, small[i]);
return;
}
/* for medium, add bits that will not be compared, to test stability */
- for(i=0; i<uprv_lengthof(medium); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(medium); ++i) {
medium[i]=(medium[i]<<4)|i;
}
/* sort medium array (stable) */
- uprv_sortArray(medium, uprv_lengthof(medium), sizeof(medium[0]), uprv_int32Comparator, NULL, TRUE, &errorCode);
+ uprv_sortArray(medium, UPRV_LENGTHOF(medium), sizeof(medium[0]), uprv_int32Comparator, NULL, TRUE, &errorCode);
if(U_FAILURE(errorCode)) {
log_err("uprv_sortArray(medium) failed - %s\n", u_errorName(errorCode));
return;
}
- for(i=1; i<uprv_lengthof(medium); ++i) {
+ for(i=1; i<UPRV_LENGTHOF(medium); ++i) {
if(medium[i-1]>=medium[i]) {
log_err("uprv_sortArray(medium) mis-sorted [%d]=%u > [%d]=%u\n", i-1, medium[i-1], i, medium[i]);
return;
/* sort large array (not stable) */
errorCode=U_ZERO_ERROR;
- uprv_sortArray(large, uprv_lengthof(large), sizeof(large[0]), uprv_uint32Comparator, NULL, FALSE, &errorCode);
+ uprv_sortArray(large, UPRV_LENGTHOF(large), sizeof(large[0]), uprv_uint32Comparator, NULL, FALSE, &errorCode);
if(U_FAILURE(errorCode)) {
log_err("uprv_sortArray(large) failed - %s\n", u_errorName(errorCode));
return;
}
- for(i=1; i<uprv_lengthof(large); ++i) {
+ for(i=1; i<UPRV_LENGTHOF(large); ++i) {
if(large[i-1]>large[i]) {
log_err("uprv_sortArray(large) mis-sorted [%d]=%u > [%d]=%u\n", i-1, large[i-1], i, large[i]);
return;
char src[MAX_BUFFER_SIZE];
int32_t srcLen;
- for(i=0; i< uprv_lengthof(mixed_prep_data); i++){
+ for(i=0; i< UPRV_LENGTHOF(mixed_prep_data); i++){
int32_t destLen=0;
char* dest = NULL;
UErrorCode status = U_ZERO_ERROR;
int32_t i, testNum = 0;
UStringPrepProfile *sprep = NULL;
- for (i = 0; i < uprv_lengthof(profile_test_case); i++) {
+ for (i = 0; i < UPRV_LENGTHOF(profile_test_case); i++) {
if (uprv_strstr(profile_test_case[i], "RFC")) {
if (sprep != NULL) {
usprep_close(sprep);
static void
TrieTest(void) {
testTrieRanges("set1", FALSE,
- setRanges1, uprv_lengthof(setRanges1),
- checkRanges1, uprv_lengthof(checkRanges1));
+ setRanges1, UPRV_LENGTHOF(setRanges1),
+ checkRanges1, UPRV_LENGTHOF(checkRanges1));
testTrieRanges("set2-overlap", FALSE,
- setRanges2, uprv_lengthof(setRanges2),
- checkRanges2, uprv_lengthof(checkRanges2));
+ setRanges2, UPRV_LENGTHOF(setRanges2),
+ checkRanges2, UPRV_LENGTHOF(checkRanges2));
testTrieRanges("set3-initial-9", FALSE,
- setRanges3, uprv_lengthof(setRanges3),
- checkRanges3, uprv_lengthof(checkRanges3));
+ setRanges3, UPRV_LENGTHOF(setRanges3),
+ checkRanges3, UPRV_LENGTHOF(checkRanges3));
testTrieRanges("set-empty", FALSE,
setRangesEmpty, 0,
- checkRangesEmpty, uprv_lengthof(checkRangesEmpty));
+ checkRangesEmpty, UPRV_LENGTHOF(checkRangesEmpty));
testTrieRanges("set-single-value", FALSE,
- setRangesSingleValue, uprv_lengthof(setRangesSingleValue),
- checkRangesSingleValue, uprv_lengthof(checkRangesSingleValue));
+ setRangesSingleValue, UPRV_LENGTHOF(setRangesSingleValue),
+ checkRangesSingleValue, UPRV_LENGTHOF(checkRangesSingleValue));
testTrieRanges("set2-overlap.withClone", TRUE,
- setRanges2, uprv_lengthof(setRanges2),
- checkRanges2, uprv_lengthof(checkRanges2));
+ setRanges2, UPRV_LENGTHOF(setRanges2),
+ checkRanges2, UPRV_LENGTHOF(checkRanges2));
}
static void
EnumNewTrieForLeadSurrogateTest(void) {
static const char *const testName="enum-for-lead";
UTrie2 *trie=makeTrieWithRanges(testName, FALSE,
- setRanges2, uprv_lengthof(setRanges2),
- checkRanges2, uprv_lengthof(checkRanges2));
+ setRanges2, UPRV_LENGTHOF(setRanges2),
+ checkRanges2, UPRV_LENGTHOF(checkRanges2));
while(trie!=NULL) {
const CheckRange *checkRanges;
return;
}
- testFrozenTrie(testName, trie, valueBits, checkRanges, uprv_lengthof(checkRanges));
+ testFrozenTrie(testName, trie, valueBits, checkRanges, UPRV_LENGTHOF(checkRanges));
utrie2_close(trie);
}
}
trie=testTrieSerializeAllValueBits(testName, trie, FALSE,
- checkRanges, uprv_lengthof(checkRanges));
+ checkRanges, UPRV_LENGTHOF(checkRanges));
utrie2_close(trie);
}
}
trie=testTrieSerializeAllValueBits(testName, trie, FALSE,
- checkRanges, uprv_lengthof(checkRanges));
+ checkRanges, UPRV_LENGTHOF(checkRanges));
utrie2_close(trie);
}
static void
Trie12ConversionTest(void) {
testTrie2FromTrie1("trie1->trie2",
- setRanges2, uprv_lengthof(setRanges2),
- checkRanges2, uprv_lengthof(checkRanges2));
+ setRanges2, UPRV_LENGTHOF(setRanges2),
+ checkRanges2, UPRV_LENGTHOF(checkRanges2));
}
void
excluded_sets[i] = uset_open(i*30, i*30+500);
}
- for(testCaseIdx = 0; testCaseIdx < uprv_lengthof(getEncodingsFns); testCaseIdx++)
+ for(testCaseIdx = 0; testCaseIdx < UPRV_LENGTHOF(getEncodingsFns); testCaseIdx++)
{
int32_t excluded_set_id;
int32_t num_encodings;
* The handling of the exclusion set is independent of the
* set of encodings, so there is no need to test every combination.
*/
- excluded_set_id = testCaseIdx % uprv_lengthof(excluded_sets);
+ excluded_set_id = testCaseIdx % UPRV_LENGTHOF(excluded_sets);
{
UConverterSelector *sel_rt, *sel_fb;
char *buffer_fb = NULL;
verifyResult(ucnvsel_selectForUTF8(sel_rt, s, -1, &status), manual_rt);
verifyResult(ucnvsel_selectForUTF8(sel_fb, s, -1, &status), manual_fb);
- u_strFromUTF8(utf16, uprv_lengthof(utf16), &length16, s, length8, &status);
+ u_strFromUTF8(utf16, UPRV_LENGTHOF(utf16), &length16, s, length8, &status);
if (U_FAILURE(status)) {
log_err("error converting the test text (string %ld) to UTF-16 - %s\n",
(long)text.number, u_errorName(status));
errorCode=U_ZERO_ERROR;
#endif
- for(i=0; i<uprv_lengthof(swapCases); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(swapCases); ++i) {
/* build the name for logging */
errorCode=U_ZERO_ERROR;
if(swapCases[i].name[0]=='*') {
return;
}
- length=uset_serialize(set, buffer, uprv_lengthof(buffer), &errorCode);
+ length=uset_serialize(set, buffer, UPRV_LENGTHOF(buffer), &errorCode);
if(U_FAILURE(errorCode)) {
log_err("unable to uset_serialize([:Cf:]) - %s\n", u_errorName(errorCode));
uset_close(set);
UBool isError, expectIsError, wrongIsError;
length=0;
- for(i=0; i<uprv_lengthof(codePoints); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(codePoints); ++i) {
c=codePoints[i];
if(c<0 || 0x10ffff<c) {
continue; /* skip non-code points for U16_APPEND_UNSAFE */
U16_APPEND_UNSAFE(buffer, length, c);
}
- if(length!=uprv_lengthof(expectUnsafe) || 0!=memcmp(buffer, expectUnsafe, length*U_SIZEOF_UCHAR)) {
+ if(length!=UPRV_LENGTHOF(expectUnsafe) || 0!=memcmp(buffer, expectUnsafe, length*U_SIZEOF_UCHAR)) {
log_err("U16_APPEND_UNSAFE did not generate the expected output\n");
}
length=0;
wrongIsError=FALSE;
- for(i=0; i<uprv_lengthof(codePoints); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(codePoints); ++i) {
c=codePoints[i];
expectIsError= c<0 || 0x10ffff<c; /* || U_IS_SURROGATE(c); */ /* surrogates in UTF-32 shouldn't be used, but it's okay to pass them around internally. */
isError=FALSE;
- U16_APPEND(buffer, length, uprv_lengthof(buffer), c, isError);
+ U16_APPEND(buffer, length, UPRV_LENGTHOF(buffer), c, isError);
wrongIsError|= isError!=expectIsError;
}
if(wrongIsError) {
log_err("U16_APPEND did not set isError correctly\n");
}
- if(length!=uprv_lengthof(expectSafe) || 0!=memcmp(buffer, expectSafe, length*U_SIZEOF_UCHAR)) {
+ if(length!=UPRV_LENGTHOF(expectSafe) || 0!=memcmp(buffer, expectSafe, length*U_SIZEOF_UCHAR)) {
log_err("U16_APPEND did not generate the expected output\n");
}
}
static const uint8_t codeunit[]={0x00, 0x65, 0x7e, 0x7f, 0xc0, 0xc4, 0xf0, 0xfd, 0x80, 0x81, 0xbc, 0xbe,};
int16_t i;
- for(i=0; i<uprv_lengthof(codeunit); i++){
+ for(i=0; i<UPRV_LENGTHOF(codeunit); i++){
uint8_t c=codeunit[i];
log_verbose("Testing code unit value of %x\n", c);
if(i<4){
int16_t i;
UBool multiple;
- for(i=0; i<uprv_lengthof(codepoint); i=(int16_t)(i+2)){
+ for(i=0; i<UPRV_LENGTHOF(codepoint); i=(int16_t)(i+2)){
UChar32 c=codepoint[i+1];
if(UTF8_CHAR_LENGTH(c) != (uint16_t)codepoint[i] || U8_LENGTH(c) != (uint16_t)codepoint[i]){
log_err("The no: of code units for %lx:- Expected: %d Got: %d\n", c, codepoint[i], UTF8_CHAR_LENGTH(c));
}
}
- for(i=uprv_lengthof(codePoints)-1, offset=sizeof(input); offset > 0; --i){
+ for(i=UPRV_LENGTHOF(codePoints)-1, offset=sizeof(input); offset > 0; --i){
UTF8_PREV_CHAR_UNSAFE(input, offset, c);
if(c != codePoints[i]){
log_err("ERROR: UTF8_PREV_CHAR_UNSAFE failed for offset=%ld. Expected:%lx Got:%lx\n",
offset, codePoints[i], c);
}
}
- for(i=uprv_lengthof(codePoints)-1, offset=sizeof(input); offset > 0; --i){
+ for(i=UPRV_LENGTHOF(codePoints)-1, offset=sizeof(input); offset > 0; --i){
U8_PREV_UNSAFE(input, offset, c);
if(c != codePoints[i]){
log_err("ERROR: U8_PREV_UNSAFE failed for offset=%ld. Expected:%lx Got:%lx\n",
}
offsafe=0;
- for(i=0; i<uprv_lengthof(Nvalue); i++){
+ for(i=0; i<UPRV_LENGTHOF(Nvalue); i++){
UTF8_FWD_N_SAFE(input, offsafe, sizeof(input), Nvalue[i]);
if(offsafe != fwd_N_safe[i]){
log_err("ERROR: Forward_N_safe offset=%d expected:%d, Got:%d\n", i, fwd_N_safe[i], offsafe);
}
offsafe=0;
- for(i=0; i<uprv_lengthof(Nvalue); i++){
+ for(i=0; i<UPRV_LENGTHOF(Nvalue); i++){
U8_FWD_N(input, offsafe, sizeof(input), Nvalue[i]);
if(offsafe != fwd_N_safe[i]){
log_err("ERROR: U8_FWD_N offset=%d expected:%d, Got:%d\n", i, fwd_N_safe[i], offsafe);
}
offsafe=sizeof(input);
- for(i=0; i<uprv_lengthof(Nvalue); i++){
+ for(i=0; i<UPRV_LENGTHOF(Nvalue); i++){
UTF8_BACK_N_SAFE(input, 0, offsafe, Nvalue[i]);
if(offsafe != back_N_safe[i]){
log_err("ERROR: backward_N_safe offset=%d expected:%d, Got:%ld\n", i, back_N_safe[i], offsafe);
}
offsafe=sizeof(input);
- for(i=0; i<uprv_lengthof(Nvalue); i++){
+ for(i=0; i<UPRV_LENGTHOF(Nvalue); i++){
U8_BACK_N(input, 0, offsafe, Nvalue[i]);
if(offsafe != back_N_safe[i]){
log_err("ERROR: U8_BACK_N offset=%d expected:%d, Got:%ld\n", i, back_N_safe[i], offsafe);
int32_t offset;
int32_t i;
- for(i=1, offset=0; offset<uprv_lengthof(input); ++i) {
+ for(i=1, offset=0; offset<UPRV_LENGTHOF(input); ++i) {
UTF8_FWD_1_UNSAFE(input, offset);
if(offset != boundaries[i]){
log_err("ERROR: UTF8_FWD_1_UNSAFE offset expected:%d, Got:%d\n", boundaries[i], offset);
}
}
- for(i=1, offset=0; offset<uprv_lengthof(input); ++i) {
+ for(i=1, offset=0; offset<UPRV_LENGTHOF(input); ++i) {
U8_FWD_1_UNSAFE(input, offset);
if(offset != boundaries[i]){
log_err("ERROR: U8_FWD_1_UNSAFE offset expected:%d, Got:%d\n", boundaries[i], offset);
}
}
- for(i=uprv_lengthof(boundaries)-2, offset=uprv_lengthof(input); offset>0; --i) {
+ for(i=UPRV_LENGTHOF(boundaries)-2, offset=UPRV_LENGTHOF(input); offset>0; --i) {
UTF8_BACK_1_UNSAFE(input, offset);
if(offset != boundaries[i]){
log_err("ERROR: UTF8_BACK_1_UNSAFE offset expected:%d, Got:%d\n", boundaries[i], offset);
}
}
- for(i=uprv_lengthof(boundaries)-2, offset=uprv_lengthof(input); offset>0; --i) {
+ for(i=UPRV_LENGTHOF(boundaries)-2, offset=UPRV_LENGTHOF(input); offset>0; --i) {
U8_BACK_1_UNSAFE(input, offset);
if(offset != boundaries[i]){
log_err("ERROR: U8_BACK_1_UNSAFE offset expected:%d, Got:%d\n", boundaries[i], offset);
}
}
- for(i=0; i<uprv_lengthof(boundaries); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(boundaries); ++i) {
offset=0;
UTF8_FWD_N_UNSAFE(input, offset, i);
if(offset != boundaries[i]) {
log_err("ERROR: UTF8_FWD_N_UNSAFE offset expected:%d, Got:%d\n", boundaries[i], offset);
}
}
- for(i=0; i<uprv_lengthof(boundaries); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(boundaries); ++i) {
offset=0;
U8_FWD_N_UNSAFE(input, offset, i);
if(offset != boundaries[i]) {
}
}
- for(i=0; i<uprv_lengthof(boundaries); ++i) {
- int32_t j=uprv_lengthof(boundaries)-1-i;
- offset=uprv_lengthof(input);
+ for(i=0; i<UPRV_LENGTHOF(boundaries); ++i) {
+ int32_t j=UPRV_LENGTHOF(boundaries)-1-i;
+ offset=UPRV_LENGTHOF(input);
UTF8_BACK_N_UNSAFE(input, offset, i);
if(offset != boundaries[j]) {
log_err("ERROR: UTF8_BACK_N_UNSAFE offset expected:%d, Got:%d\n", boundaries[j], offset);
}
}
- for(i=0; i<uprv_lengthof(boundaries); ++i) {
- int32_t j=uprv_lengthof(boundaries)-1-i;
- offset=uprv_lengthof(input);
+ for(i=0; i<UPRV_LENGTHOF(boundaries); ++i) {
+ int32_t j=UPRV_LENGTHOF(boundaries)-1-i;
+ offset=UPRV_LENGTHOF(input);
U8_BACK_N_UNSAFE(input, offset, i);
if(offset != boundaries[j]) {
log_err("ERROR: U8_BACK_N_UNSAFE offset expected:%d, Got:%d\n", boundaries[j], offset);
uint32_t i=0;
int32_t offset=0, setOffset=0;
- for(offset=0; offset<=uprv_lengthof(input); offset++){
- if (offset<uprv_lengthof(input)){
+ for(offset=0; offset<=UPRV_LENGTHOF(input); offset++){
+ if (offset<UPRV_LENGTHOF(input)){
setOffset=offset;
UTF8_SET_CHAR_START_SAFE(input, 0, setOffset);
if(setOffset != start_safe[i]){
uint32_t i=0;
int32_t offset=0, setOffset=0;
- for(offset=0; offset<=uprv_lengthof(input); offset++){
- if (offset<uprv_lengthof(input)){
+ for(offset=0; offset<=UPRV_LENGTHOF(input); offset++){
+ if (offset<UPRV_LENGTHOF(input)){
setOffset=offset;
UTF8_SET_CHAR_START_UNSAFE(input, setOffset);
if(setOffset != start_unsafe[i]){
uint8_t str[12];
uint32_t offset;
/* UChar32 c=0;*/
- uint16_t size=uprv_lengthof(s);
- for(i=0; i<uprv_lengthof(test); i=(uint16_t)(i+2)){
+ uint16_t size=UPRV_LENGTHOF(s);
+ for(i=0; i<UPRV_LENGTHOF(test); i=(uint16_t)(i+2)){
uprv_memcpy(str, s, size);
offset=test[i];
if(count<13){
UBool isError, expectIsError, wrongIsError;
length=0;
- for(i=0; i<uprv_lengthof(codePoints); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(codePoints); ++i) {
c=codePoints[i];
if(c<0 || 0x10ffff<c) {
continue; /* skip non-code points for U8_APPEND_UNSAFE */
U8_APPEND_UNSAFE(buffer, length, c);
}
- if(length!=uprv_lengthof(expectUnsafe) || 0!=memcmp(buffer, expectUnsafe, length)) {
+ if(length!=UPRV_LENGTHOF(expectUnsafe) || 0!=memcmp(buffer, expectUnsafe, length)) {
log_err("U8_APPEND_UNSAFE did not generate the expected output\n");
}
length=0;
wrongIsError=FALSE;
- for(i=0; i<uprv_lengthof(codePoints); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(codePoints); ++i) {
c=codePoints[i];
expectIsError= c<0 || 0x10ffff<c || U_IS_SURROGATE(c);
isError=FALSE;
- U8_APPEND(buffer, length, uprv_lengthof(buffer), c, isError);
+ U8_APPEND(buffer, length, UPRV_LENGTHOF(buffer), c, isError);
wrongIsError|= isError!=expectIsError;
}
if(wrongIsError) {
log_err("U8_APPEND did not set isError correctly\n");
}
- if(length!=uprv_lengthof(expectSafe) || 0!=memcmp(buffer, expectSafe, length)) {
+ if(length!=UPRV_LENGTHOF(expectSafe) || 0!=memcmp(buffer, expectSafe, length)) {
log_err("U8_APPEND did not generate the expected output\n");
}
}
int32_t i, j, k, iu, is, il, length;
k=0; /* index into cp[] */
- length=uprv_lengthof(b);
+ length=UPRV_LENGTHOF(b);
for(i=0; i<length;) {
j=i;
U8_NEXT_UNSAFE(b, j, cu);
ucal_close(cal);
return;
}
- for(i = 0; i < uprv_lengthof(dotNetDateTimeTicks); ++i) {
+ for(i = 0; i < UPRV_LENGTHOF(dotNetDateTimeTicks); ++i) {
/* Test conversion from .Net/Universal time to ICU time. */
dt = dotNetDateTimeTicks + i;
millis = utmscale_toInt64(dt->ticks, UDTS_ICU4C_TIME, &errorCode);
// if Russian sorts Cyrillic first.
int32_t reorderCodes[20];
int32_t expectedLatinIndex = 0;
- if (index->getCollator().getReorderCodes(reorderCodes, uprv_lengthof(reorderCodes), status) > 0) {
+ if (index->getCollator().getReorderCodes(reorderCodes, UPRV_LENGTHOF(reorderCodes), status) > 0) {
expectedLatinIndex = index->getBucketCount(status) - 1;
}
n = index->getBucketIndex(adam, status);
void AlphabeticIndexTest::TestIndexCharactersList() {
UErrorCode status = U_ZERO_ERROR;
- for (int32_t i = 0; i < uprv_lengthof(localeAndIndexCharactersLists); ++i) {
+ for (int32_t i = 0; i < UPRV_LENGTHOF(localeAndIndexCharactersLists); ++i) {
const char *(&localeAndIndexCharacters)[2] = localeAndIndexCharactersLists[i];
const char *locale = localeAndIndexCharacters[0];
UnicodeString expectedIndexCharacters
return;
}
int32_t reorderCodes[] = { USCRIPT_HAN };
- coll->setReorderCodes(reorderCodes, uprv_lengthof(reorderCodes), status);
+ coll->setReorderCodes(reorderCodes, UPRV_LENGTHOF(reorderCodes), status);
TEST_CHECK_STATUS;
AlphabeticIndex index(coll.orphan(), status);
TEST_CHECK_STATUS;
return;
}
int32_t reorderCodes[] = { USCRIPT_HAN };
- coll->setReorderCodes(reorderCodes, uprv_lengthof(reorderCodes), status);
+ coll->setReorderCodes(reorderCodes, UPRV_LENGTHOF(reorderCodes), status);
TEST_CHECK_STATUS;
AlphabeticIndex index(coll.orphan(), status);
TEST_CHECK_STATUS;
{ "Steiff", 22, "St" },
{ "Thomas", 23, "T" }
};
- for (int32_t i = 0; i < uprv_lengthof(testCases); ++i) {
+ for (int32_t i = 0; i < UPRV_LENGTHOF(testCases); ++i) {
const TestCase &testCase = testCases[i];
UnicodeString name = UnicodeString(testCase.name).unescape();
UnicodeString label = UnicodeString(testCase.bucketLabel).unescape();
void AlphabeticIndexTest::TestChineseZhuyin() {
UErrorCode status = U_ZERO_ERROR;
char loc[100];
- uloc_forLanguageTag("zh-u-co-zhuyin", loc, uprv_lengthof(loc), NULL, &status);
+ uloc_forLanguageTag("zh-u-co-zhuyin", loc, UPRV_LENGTHOF(loc), NULL, &status);
AlphabeticIndex index(loc, status);
LocalPointer<AlphabeticIndex::ImmutableIndex> immIndex(index.buildImmutableIndex(status));
TEST_CHECK_STATUS;
// They should all go into the overflow bucket.
static const UChar32 kanji[] = { 0x4E9C, 0x95C7, 0x4E00, 0x58F1 };
int32_t overflowIndex = immIndex->getBucketCount() - 1;
- for(int32_t i = 0; i < uprv_lengthof(kanji); ++i) {
+ for(int32_t i = 0; i < UPRV_LENGTHOF(kanji); ++i) {
char msg[40];
sprintf(msg, "kanji[%d]=U+%04lX in overflow bucket", (int)i, (long)kanji[i]);
assertEquals(msg, overflowIndex, immIndex->getBucketIndex(UnicodeString(kanji[i]), status));
// 2 bytes for the Cyrillic i, 1 byte for the primary-compression terminator,
// 2 bytes for the Greek phi, and 1 byte for the NUL terminator.
uint8_t sortKey[12];
- int32_t length = col->getSortKey(i_and_phi, 2, sortKey, uprv_lengthof(sortKey));
+ int32_t length = col->getSortKey(i_and_phi, 2, sortKey, UPRV_LENGTHOF(sortKey));
uint8_t sortKey2[12];
for (int32_t capacity = 0; capacity < length; ++capacity) {
- uprv_memset(sortKey2, 2, uprv_lengthof(sortKey2));
+ uprv_memset(sortKey2, 2, UPRV_LENGTHOF(sortKey2));
int32_t length2 = col->getSortKey(i_and_phi, 2, sortKey2, capacity);
if (length2 != length || 0 != uprv_memcmp(sortKey, sortKey2, capacity)) {
errln("getSortKey(i_and_phi, capacity=%d) failed to write proper prefix", capacity);
u_unescape(rules, rlz, 256);
/* test opening collators for different locales */
- for(i = 0; i<(int32_t)uprv_lengthof(testStruct); i++) {
+ for(i = 0; i<(int32_t)UPRV_LENGTHOF(testStruct); i++) {
status = U_ZERO_ERROR;
coll = Collator::createInstance(testStruct[i].requestedLocale, status);
if(U_FAILURE(status)) {
UnicodeString buff;
UnicodeSet *set = NULL;
- for(i = 0; i < uprv_lengthof(setTest); i++) {
+ for(i = 0; i < UPRV_LENGTHOF(setTest); i++) {
buff = UnicodeString(setTest[i].rules, -1, US_INV).unescape();
RuleBasedCollator coll(buff, status);
if(U_SUCCESS(status)) {
UnicodeString ue = UNICODE_STRING_SIMPLE("ue");
assertEquals("rbc/primary: u-umlaut==ue", UCOL_EQUAL, rbc->compare(uUmlaut, ue, errorCode));
uint8_t bin[25000];
- int32_t binLength = rbc->cloneBinary(bin, uprv_lengthof(bin), errorCode);
+ int32_t binLength = rbc->cloneBinary(bin, UPRV_LENGTHOF(bin), errorCode);
if(errorCode.logDataIfFailureAndReset("rbc->cloneBinary()")) {
return;
}
assertEquals("rbc2: u-umlaut==ue", UCOL_EQUAL, rbc2.compare(uUmlaut, ue, errorCode));
assertTrue("rbc==rbc2", *rbc == rbc2);
uint8_t bin2[25000];
- int32_t bin2Length = rbc2.cloneBinary(bin2, uprv_lengthof(bin2), errorCode);
+ int32_t bin2Length = rbc2.cloneBinary(bin2, UPRV_LENGTHOF(bin2), errorCode);
assertEquals("len(rbc binary)==len(rbc2 binary)", binLength, bin2Length);
assertTrue("rbc binary==rbc2 binary", binLength == bin2Length && memcmp(bin, bin2, binLength) == 0);
static const StringAndValue data[]={
{ "", 0 }
};
- checkData(data, uprv_lengthof(data));
+ checkData(data, UPRV_LENGTHOF(data));
}
void BytesTrieTest::Test_a() {
static const StringAndValue data[]={
{ "a", 1 }
};
- checkData(data, uprv_lengthof(data));
+ checkData(data, UPRV_LENGTHOF(data));
}
void BytesTrieTest::Test_a_ab() {
{ "a", 1 },
{ "ab", 100 }
};
- checkData(data, uprv_lengthof(data));
+ checkData(data, UPRV_LENGTHOF(data));
}
void BytesTrieTest::TestShortestBranch() {
{ "a", 1000 },
{ "b", 2000 }
};
- checkData(data, uprv_lengthof(data));
+ checkData(data, UPRV_LENGTHOF(data));
}
void BytesTrieTest::TestBranches() {
{ "vv", 0x7fffffff },
{ "zz", (int32_t)0x80000000 }
};
- for(int32_t length=2; length<=uprv_lengthof(data); ++length) {
+ for(int32_t length=2; length<=UPRV_LENGTHOF(data); ++length) {
logln("TestBranches length=%d", (int)length);
checkData(data, length);
}
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", -3 }
};
- checkData(data, uprv_lengthof(data));
+ checkData(data, UPRV_LENGTHOF(data));
}
void BytesTrieTest::TestLongBranch() {
{ "t234567890", 0x77777777 },
{ "z", (int32_t)0x80000001 }
};
- checkData(data, uprv_lengthof(data));
+ checkData(data, UPRV_LENGTHOF(data));
}
void BytesTrieTest::TestValuesForState() {
{ "abcde", -5 },
{ "abcdef", -6 }
};
- checkData(data, uprv_lengthof(data));
+ checkData(data, UPRV_LENGTHOF(data));
}
void BytesTrieTest::TestCompact() {
{ "xjuly", 7 },
{ "xjune", 6 }
};
- checkData(data, uprv_lengthof(data));
+ checkData(data, UPRV_LENGTHOF(data));
}
BytesTrie *BytesTrieTest::buildMonthsTrie(UStringTrieBuildOption buildOption) {
{ "jun.", 6 },
{ "june", 6 }
};
- return buildTrie(data, uprv_lengthof(data), buildOption);
+ return buildTrie(data, UPRV_LENGTHOF(data), buildOption);
}
void BytesTrieTest::TestHasUniqueValue() {
return; // buildTrie() reported an error
}
char buffer[40];
- CheckedArrayByteSink sink(buffer, uprv_lengthof(buffer));
+ CheckedArrayByteSink sink(buffer, UPRV_LENGTHOF(buffer));
int32_t count=trie->getNextBytes(sink);
if(count!=2 || sink.NumberOfBytesAppended()!=2 || buffer[0]!='a' || buffer[1]!='j') {
errln("months getNextBytes()!=[aj] at root");
{ "uar", 1 },
{ "uary", 1 }
};
- checkIterator(iter, data, uprv_lengthof(data));
+ checkIterator(iter, data, UPRV_LENGTHOF(data));
// Reset, and we should get the same result.
logln("after iter.reset()");
- checkIterator(iter.reset(), data, uprv_lengthof(data));
+ checkIterator(iter.reset(), data, UPRV_LENGTHOF(data));
}
void BytesTrieTest::TestIteratorFromLinearMatch() {
{ "r", 1 },
{ "ry", 1 }
};
- checkIterator(iter, data, uprv_lengthof(data));
+ checkIterator(iter, data, UPRV_LENGTHOF(data));
// Reset, and we should get the same result.
logln("after iter.reset()");
- checkIterator(iter.reset(), data, uprv_lengthof(data));
+ checkIterator(iter.reset(), data, UPRV_LENGTHOF(data));
}
void BytesTrieTest::TestTruncatingIteratorFromRoot() {
{ "jun.", 6 },
{ "june", 6 }
};
- checkIterator(iter, data, uprv_lengthof(data));
+ checkIterator(iter, data, UPRV_LENGTHOF(data));
// Reset, and we should get the same result.
logln("after iter.reset()");
- checkIterator(iter.reset(), data, uprv_lengthof(data));
+ checkIterator(iter.reset(), data, UPRV_LENGTHOF(data));
}
void BytesTrieTest::TestTruncatingIteratorFromLinearMatchShort() {
{ "abcdepq", 200 },
{ "abcdeyz", 3000 }
};
- LocalPointer<BytesTrie> trie(buildTrie(data, uprv_lengthof(data), USTRINGTRIE_BUILD_FAST));
+ LocalPointer<BytesTrie> trie(buildTrie(data, UPRV_LENGTHOF(data), USTRINGTRIE_BUILD_FAST));
if(trie.isNull()) {
return; // buildTrie() reported an error
}
static const StringAndValue expected[]={
{ "cd", -1 }
};
- checkIterator(iter, expected, uprv_lengthof(expected));
+ checkIterator(iter, expected, UPRV_LENGTHOF(expected));
// Reset, and we should get the same result.
logln("after iter.reset()");
- checkIterator(iter.reset(), expected, uprv_lengthof(expected));
+ checkIterator(iter.reset(), expected, UPRV_LENGTHOF(expected));
}
void BytesTrieTest::TestTruncatingIteratorFromLinearMatchLong() {
{ "abcdepq", 200 },
{ "abcdeyz", 3000 }
};
- LocalPointer<BytesTrie> trie(buildTrie(data, uprv_lengthof(data), USTRINGTRIE_BUILD_FAST));
+ LocalPointer<BytesTrie> trie(buildTrie(data, UPRV_LENGTHOF(data), USTRINGTRIE_BUILD_FAST));
if(trie.isNull()) {
return; // buildTrie() reported an error
}
{ "dep", -1 },
{ "dey", -1 }
};
- checkIterator(iter, expected, uprv_lengthof(expected));
+ checkIterator(iter, expected, UPRV_LENGTHOF(expected));
// Reset, and we should get the same result.
logln("after iter.reset()");
- checkIterator(iter.reset(), expected, uprv_lengthof(expected));
+ checkIterator(iter.reset(), expected, UPRV_LENGTHOF(expected));
}
void BytesTrieTest::TestIteratorFromBytes() {
};
builder_->clear();
IcuTestErrorCode errorCode(*this, "TestIteratorFromBytes()");
- for(int32_t i=0; i<uprv_lengthof(data); ++i) {
+ for(int32_t i=0; i<UPRV_LENGTHOF(data); ++i) {
builder_->add(data[i].s, data[i].value, errorCode);
}
StringPiece trieBytes=builder_->buildStringPiece(USTRINGTRIE_BUILD_FAST, errorCode);
BytesTrie::Iterator iter(trieBytes.data(), 0, errorCode);
- checkIterator(iter, data, uprv_lengthof(data));
+ checkIterator(iter, data, UPRV_LENGTHOF(data));
}
void BytesTrieTest::checkData(const StringAndValue data[], int32_t dataLength) {
public:
// public default constructor, to get coverage of CharacterIterator()
SubCharIter() : CharacterIterator() {
- textLength=end=uprv_lengthof(s);
+ textLength=end=UPRV_LENGTHOF(s);
s[0]=0x61; // 'a'
s[1]=0xd900; // U+50400
s[2]=0xdd00;
// useful stuff, mostly dummy but testing coverage and subclassability
virtual UChar nextPostInc() {
- if(pos<uprv_lengthof(s)) {
+ if(pos<UPRV_LENGTHOF(s)) {
return s[pos++];
} else {
return DONE;
}
virtual UChar32 next32PostInc() {
- if(pos<uprv_lengthof(s)) {
+ if(pos<UPRV_LENGTHOF(s)) {
UChar32 c;
- U16_NEXT(s, pos, uprv_lengthof(s), c);
+ U16_NEXT(s, pos, UPRV_LENGTHOF(s), c);
return c;
} else {
return DONE;
}
virtual UBool hasNext() {
- return pos<uprv_lengthof(s);
+ return pos<UPRV_LENGTHOF(s);
}
virtual UChar first() {
virtual UChar32 first32() {
UChar32 c;
pos=0;
- U16_NEXT(s, pos, uprv_lengthof(s), c);
+ U16_NEXT(s, pos, UPRV_LENGTHOF(s), c);
pos=0;
return c;
}
virtual UChar setIndex(int32_t position) {
- if(0<=position && position<=uprv_lengthof(s)) {
+ if(0<=position && position<=UPRV_LENGTHOF(s)) {
pos=position;
- if(pos<uprv_lengthof(s)) {
+ if(pos<UPRV_LENGTHOF(s)) {
return s[pos];
}
}
}
virtual UChar32 setIndex32(int32_t position) {
- if(0<=position && position<=uprv_lengthof(s)) {
+ if(0<=position && position<=UPRV_LENGTHOF(s)) {
pos=position;
- if(pos<uprv_lengthof(s)) {
+ if(pos<UPRV_LENGTHOF(s)) {
UChar32 c;
- U16_GET(s, 0, pos, uprv_lengthof(s), c);
+ U16_GET(s, 0, pos, UPRV_LENGTHOF(s), c);
return c;
}
}
}
virtual UChar current() const {
- if(pos<uprv_lengthof(s)) {
+ if(pos<UPRV_LENGTHOF(s)) {
return s[pos];
} else {
return DONE;
}
virtual UChar32 current32() const {
- if(pos<uprv_lengthof(s)) {
+ if(pos<UPRV_LENGTHOF(s)) {
UChar32 c;
- U16_GET(s, 0, pos, uprv_lengthof(s), c);
+ U16_GET(s, 0, pos, UPRV_LENGTHOF(s), c);
return c;
} else {
return DONE;
}
virtual UChar next() {
- if(pos<uprv_lengthof(s) && ++pos<uprv_lengthof(s)) {
+ if(pos<UPRV_LENGTHOF(s) && ++pos<UPRV_LENGTHOF(s)) {
return s[pos];
} else {
return DONE;
}
virtual UChar32 next32() {
- if(pos<uprv_lengthof(s)) {
- U16_FWD_1(s, pos, uprv_lengthof(s));
+ if(pos<UPRV_LENGTHOF(s)) {
+ U16_FWD_1(s, pos, UPRV_LENGTHOF(s));
}
- if(pos<uprv_lengthof(s)) {
+ if(pos<UPRV_LENGTHOF(s)) {
UChar32 c;
int32_t i=pos;
- U16_NEXT(s, i, uprv_lengthof(s), c);
+ U16_NEXT(s, i, UPRV_LENGTHOF(s), c);
return c;
} else {
return DONE;
}
virtual void getText(UnicodeString &result) {
- result.setTo(s, uprv_lengthof(s));
+ result.setTo(s, UPRV_LENGTHOF(s));
}
// dummy implementations of other pure virtual base class functions
UChar32 prev = 0;
uint32_t prevPrimary = 0;
UTF16CollationIterator ci(cd, FALSE, NULL, NULL, NULL);
- for(int32_t i = 0; i < uprv_lengthof(sets); ++i) {
+ for(int32_t i = 0; i < UPRV_LENGTHOF(sets); ++i) {
LocalPointer<UnicodeSetIterator> iter(new UnicodeSetIterator(*sets[i]));
while(iter->next()) {
UChar32 c = iter->getCodepoint();
};
StringPiece fffd(strings[0]);
- for(int32_t i = 1; i < uprv_lengthof(strings); ++i) {
+ for(int32_t i = 1; i < UPRV_LENGTHOF(strings); ++i) {
StringPiece illegal(strings[i]);
UCollationResult order = coll->compareUTF8(fffd, illegal, errorCode);
if(order != UCOL_EQUAL) {
if(errorCode.logIfFailureAndReset("FCDUTF16CollationIterator constructor")) {
return;
}
- CodePointIterator cpi(cp, uprv_lengthof(cp));
+ CodePointIterator cpi(cp, UPRV_LENGTHOF(cp));
checkFCD("FCDUTF16CollationIterator", u16ci, cpi);
#if U_HAVE_STD_STRING
cpi.resetToStart();
UCharIterator iter;
- uiter_setString(&iter, s, uprv_lengthof(s) - 1); // -1: without the terminating NUL
+ uiter_setString(&iter, s, UPRV_LENGTHOF(s) - 1); // -1: without the terminating NUL
FCDUIterCollationIterator uici(data, FALSE, iter, 0);
if(errorCode.logIfFailureAndReset("FCDUIterCollationIterator constructor")) {
return;
UColAttribute attr;
for(int32_t i = 0;; ++i) {
- if(i == uprv_lengthof(attributes)) {
+ if(i == UPRV_LENGTHOF(attributes)) {
errln("invalid attribute name on line %d", (int)fileLineNumber);
infoln(fileLine);
errorCode.set(U_PARSE_ERROR);
UColAttributeValue value;
for(int32_t i = 0;; ++i) {
- if(i == uprv_lengthof(attributeValues)) {
+ if(i == UPRV_LENGTHOF(attributeValues)) {
errln("invalid attribute value name on line %d", (int)fileLineNumber);
infoln(fileLine);
errorCode.set(U_PARSE_ERROR);
IcuTestErrorCode &errorCode) {
if(errorCode.isFailure()) { return FALSE; }
uint8_t part[32];
- U_ASSERT(partSize <= uprv_lengthof(part));
+ U_ASSERT(partSize <= UPRV_LENGTHOF(part));
UCharIterator iter;
uiter_setString(&iter, s, length);
uint32_t state[2] = { 0, 0 };
// Check that internalNextSortKeyPart() makes the same key, with several part sizes.
static const int32_t partSizes[] = { 32, 3, 1 };
- for(int32_t psi = 0; psi < uprv_lengthof(partSizes); ++psi) {
+ for(int32_t psi = 0; psi < UPRV_LENGTHOF(partSizes); ++psi) {
int32_t partSize = partSizes[psi];
CharString parts;
if(!getSortKeyParts(s, length, parts, 32, errorCode)) {
}
void CompactDecimalFormatTest::TestEnglishShort() {
- CheckLocale("en", UNUM_SHORT, kEnglishShort, uprv_lengthof(kEnglishShort));
+ CheckLocale("en", UNUM_SHORT, kEnglishShort, UPRV_LENGTHOF(kEnglishShort));
}
void CompactDecimalFormatTest::TestSerbianShort() {
- CheckLocale("sr", UNUM_SHORT, kSerbianShort, uprv_lengthof(kSerbianShort));
+ CheckLocale("sr", UNUM_SHORT, kSerbianShort, UPRV_LENGTHOF(kSerbianShort));
}
void CompactDecimalFormatTest::TestSerbianLong() {
- CheckLocale("sr", UNUM_LONG, kSerbianLong, uprv_lengthof(kSerbianLong));
+ CheckLocale("sr", UNUM_LONG, kSerbianLong, UPRV_LENGTHOF(kSerbianLong));
}
void CompactDecimalFormatTest::TestSerbianLongNegative() {
- CheckLocale("sr", UNUM_LONG, kSerbianLongNegative, uprv_lengthof(kSerbianLongNegative));
+ CheckLocale("sr", UNUM_LONG, kSerbianLongNegative, UPRV_LENGTHOF(kSerbianLongNegative));
}
void CompactDecimalFormatTest::TestJapaneseShort() {
- CheckLocale(Locale::getJapan(), UNUM_SHORT, kJapaneseShort, uprv_lengthof(kJapaneseShort));
+ CheckLocale(Locale::getJapan(), UNUM_SHORT, kJapaneseShort, UPRV_LENGTHOF(kJapaneseShort));
}
void CompactDecimalFormatTest::TestSwahiliShort() {
- CheckLocale("sw", UNUM_SHORT, kSwahiliShort, uprv_lengthof(kSwahiliShort));
+ CheckLocale("sw", UNUM_SHORT, kSwahiliShort, UPRV_LENGTHOF(kSwahiliShort));
}
void CompactDecimalFormatTest::TestFieldPosition() {
}
void CompactDecimalFormatTest::TestCsShort() {
- CheckLocale("cs", UNUM_SHORT, kCsShort, uprv_lengthof(kCsShort));
+ CheckLocale("cs", UNUM_SHORT, kCsShort, UPRV_LENGTHOF(kCsShort));
}
void CompactDecimalFormatTest::TestSkLong() {
// few{"0"}
// one{"0"}
// other{"0"}
- CheckLocale("sk", UNUM_LONG, kSkLong, uprv_lengthof(kSkLong));
+ CheckLocale("sk", UNUM_LONG, kSkLong, UPRV_LENGTHOF(kSkLong));
}
void CompactDecimalFormatTest::TestSwahiliShortNegative() {
- CheckLocale("sw", UNUM_SHORT, kSwahiliShortNegative, uprv_lengthof(kSwahiliShortNegative));
+ CheckLocale("sw", UNUM_SHORT, kSwahiliShortNegative, UPRV_LENGTHOF(kSwahiliShortNegative));
}
void CompactDecimalFormatTest::TestArabicLong() {
- CheckLocale("ar", UNUM_LONG, kArabicLong, uprv_lengthof(kArabicLong));
+ CheckLocale("ar", UNUM_LONG, kArabicLong, UPRV_LENGTHOF(kArabicLong));
}
void CompactDecimalFormatTest::TestSignificantDigits() {
// read a substitution string, separated by an equal sign
p=s.getBuffer()+index+1;
length=s.length()-(index+1);
- if(length<0 || length>=uprv_lengthof(cc.subString)) {
+ if(length<0 || length>=UPRV_LENGTHOF(cc.subString)) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
} else {
u_memcpy(cc.subString, p, length);
if(!diffSet.isEmpty()) {
diffSet.toPattern(s, TRUE);
if(s.length()>100) {
- s.replace(100, 0x7fffffff, ellipsis, uprv_lengthof(ellipsis));
+ s.replace(100, 0x7fffffff, ellipsis, UPRV_LENGTHOF(ellipsis));
}
errln("error: ucnv_getUnicodeSet(\"%s\") is missing items - conversion/getUnicodeSet test case %d",
charset, i);
if(!diffSet.isEmpty()) {
diffSet.toPattern(s, TRUE);
if(s.length()>100) {
- s.replace(100, 0x7fffffff, ellipsis, uprv_lengthof(ellipsis));
+ s.replace(100, 0x7fffffff, ellipsis, UPRV_LENGTHOF(ellipsis));
}
errln("error: ucnv_getUnicodeSet(\"%s\") contains unexpected items - conversion/getUnicodeSet test case %d",
charset, i);
LocalUConverterPointer cnv;
char buffer[1024];
int32_t i;
- for(i=0; i<uprv_lengthof(cnvNames); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(cnvNames); ++i) {
UErrorCode errorCode=U_ZERO_ERROR;
cnv.adoptInstead(cnv_open(cnvNames[i], errorCode));
if(U_FAILURE(errorCode)) {
if(!diffSet.isEmpty()) {
diffSet.toPattern(out, TRUE);
if(out.length()>100) {
- out.replace(100, 0x7fffffff, ellipsis, uprv_lengthof(ellipsis));
+ out.replace(100, 0x7fffffff, ellipsis, UPRV_LENGTHOF(ellipsis));
}
errln("error: ucnv_getUnicodeSet(\"%s\") is missing items - which set: %d",
cnvNames[i], which);
if(!diffSet.isEmpty()) {
diffSet.toPattern(out, TRUE);
if(out.length()>100) {
- out.replace(100, 0x7fffffff, ellipsis, uprv_lengthof(ellipsis));
+ out.replace(100, 0x7fffffff, ellipsis, UPRV_LENGTHOF(ellipsis));
}
errln("error: ucnv_getUnicodeSet(\"%s\") contains unexpected items - which set: %d",
cnvNames[i], which);
int32_t i, step;
ok=TRUE;
- for(i=0; i<uprv_lengthof(steps) && ok; ++i) {
+ for(i=0; i<UPRV_LENGTHOF(steps) && ok; ++i) {
step=steps[i].step;
if(step<0 && !cc.finalFlush) {
// skip ucnv_getNextUChar() if !finalFlush because
cc.offsets=NULL;
}
else {
- memset(resultOffsets, -1, uprv_lengthof(resultOffsets));
+ memset(resultOffsets, -1, UPRV_LENGTHOF(resultOffsets));
}
- memset(result, -1, uprv_lengthof(result));
+ memset(result, -1, UPRV_LENGTHOF(result));
errorCode.reset();
resultLength=stepToUnicode(cc, cnv.getAlias(),
- result, uprv_lengthof(result),
+ result, UPRV_LENGTHOF(result),
step==0 ? resultOffsets : NULL,
step, errorCode);
ok=checkToUnicode(
errorCode.reset();
resultLength=ucnv_toUChars(cnv.getAlias(),
- result, uprv_lengthof(result),
+ result, UPRV_LENGTHOF(result),
(const char *)cc.bytes, cc.bytesLength,
errorCode);
ok=checkToUnicode(
targetLimit=resultLimit;
flush=cc.finalFlush;
- pivotLimit=pivotBuffer+uprv_lengthof(pivotBuffer);
+ pivotLimit=pivotBuffer+UPRV_LENGTHOF(pivotBuffer);
} else {
// start with empty partial buffers
sourceLimit=source;
// convert unicode to utf8
char utf8[256];
cc.utf8=utf8;
- u_strToUTF8(utf8, uprv_lengthof(utf8), &cc.utf8Length,
+ u_strToUTF8(utf8, UPRV_LENGTHOF(utf8), &cc.utf8Length,
cc.unicode, cc.unicodeLength,
&errorCode);
if(U_FAILURE(errorCode)) {
int32_t i, step;
ok=TRUE;
- for(i=0; i<uprv_lengthof(steps) && ok; ++i) {
+ for(i=0; i<UPRV_LENGTHOF(steps) && ok; ++i) {
step=steps[i].step;
- memset(resultOffsets, -1, uprv_lengthof(resultOffsets));
- memset(result, -1, uprv_lengthof(result));
+ memset(resultOffsets, -1, UPRV_LENGTHOF(resultOffsets));
+ memset(result, -1, UPRV_LENGTHOF(result));
errorCode=U_ZERO_ERROR;
resultLength=stepFromUnicode(cc, cnv,
- result, uprv_lengthof(result),
+ result, UPRV_LENGTHOF(result),
step==0 ? resultOffsets : NULL,
step, &errorCode);
ok=checkFromUnicode(
if(cc.utf8Length>=0) {
errorCode=U_ZERO_ERROR;
resultLength=stepFromUTF8(cc, utf8Cnv, cnv,
- result, uprv_lengthof(result),
+ result, UPRV_LENGTHOF(result),
step, &errorCode);
ok=checkFromUnicode(
cc, cnv, steps[i].utf8Name,
errorCode=U_ZERO_ERROR;
resultLength=ucnv_fromUChars(cnv,
- result, uprv_lengthof(result),
+ result, UPRV_LENGTHOF(result),
cc.unicode, cc.unicodeLength,
&errorCode);
ok=checkFromUnicode(
msg=NULL;
errorCode=U_ZERO_ERROR;
- resultInvalidLength=uprv_lengthof(resultInvalidUChars);
+ resultInvalidLength=UPRV_LENGTHOF(resultInvalidUChars);
ucnv_getInvalidUChars(cnv, resultInvalidUChars, &resultInvalidLength, &errorCode);
if(U_FAILURE(errorCode)) {
errln("fromUnicode[%d](%s cb=\"%s\" fb=%d flush=%d %s) ucnv_getInvalidUChars() failed - %s",
UnicodeString percentPattern("#,##0%");
pat.setMaximumFractionDigits(4);
- for(int32_t i=0; i < uprv_lengthof(testData); i++) {
+ for(int32_t i=0; i < UPRV_LENGTHOF(testData); i++) {
if ( i > 2 ) {
pat.applyPattern(percentPattern,status);
}
};
IcuTestErrorCode errorCode(*this, "TestPatterns()");
- for (int32_t i = 0; i < uprv_lengthof(EXPECTED); i++) {
+ for (int32_t i = 0; i < UPRV_LENGTHOF(EXPECTED); i++) {
// Verify that patterns have the correct values
UnicodeString actualPattern(EXPECTED[i].actualPattern, -1, US_INV);
UnicodeString expectedPattern(EXPECTED[i].expectedPattern, -1, US_INV);
// Test for date/time parsing regression with CLDR 22.1/ICU 50 pattern strings.
// For details see http://bugs.icu-project.org/trac/ticket/9789
static const char *locales[] = { "en", "fr" };
- for (int32_t i = 0; i < uprv_lengthof(locales); ++i) {
+ for (int32_t i = 0; i < UPRV_LENGTHOF(locales); ++i) {
Locale locale(locales[i]);
for (DateFormat::EStyle dateStyle = DateFormat::FULL; dateStyle <= DateFormat::SHORT;
Locale("ja", "JP", "")
};
- for (i = 0; i < uprv_lengthof(locales); i++)
+ for (i = 0; i < UPRV_LENGTHOF(locales); i++)
{
UnicodeString dispName;
UErrorCode status = U_ZERO_ERROR;
void GenderInfoTest::TestGetListGender() {
check(UGENDER_OTHER, UGENDER_OTHER, UGENDER_OTHER, NULL, 0);
- check(UGENDER_FEMALE, UGENDER_FEMALE, UGENDER_FEMALE, kSingleFemale, uprv_lengthof(kSingleFemale));
- check(UGENDER_MALE, UGENDER_MALE, UGENDER_MALE, kSingleMale, uprv_lengthof(kSingleMale));
- check(UGENDER_OTHER, UGENDER_OTHER, UGENDER_OTHER, kSingleOther, uprv_lengthof(kSingleOther));
+ check(UGENDER_FEMALE, UGENDER_FEMALE, UGENDER_FEMALE, kSingleFemale, UPRV_LENGTHOF(kSingleFemale));
+ check(UGENDER_MALE, UGENDER_MALE, UGENDER_MALE, kSingleMale, UPRV_LENGTHOF(kSingleMale));
+ check(UGENDER_OTHER, UGENDER_OTHER, UGENDER_OTHER, kSingleOther, UPRV_LENGTHOF(kSingleOther));
- check(UGENDER_OTHER, UGENDER_FEMALE, UGENDER_FEMALE, kAllFemale, uprv_lengthof(kAllFemale));
- check(UGENDER_OTHER, UGENDER_MALE, UGENDER_MALE, kAllMale, uprv_lengthof(kAllMale));
- check(UGENDER_OTHER, UGENDER_OTHER, UGENDER_MALE, kAllOther, uprv_lengthof(kAllOther));
+ check(UGENDER_OTHER, UGENDER_FEMALE, UGENDER_FEMALE, kAllFemale, UPRV_LENGTHOF(kAllFemale));
+ check(UGENDER_OTHER, UGENDER_MALE, UGENDER_MALE, kAllMale, UPRV_LENGTHOF(kAllMale));
+ check(UGENDER_OTHER, UGENDER_OTHER, UGENDER_MALE, kAllOther, UPRV_LENGTHOF(kAllOther));
- check(UGENDER_OTHER, UGENDER_OTHER, UGENDER_MALE, kFemaleMale, uprv_lengthof(kFemaleMale));
- check(UGENDER_OTHER, UGENDER_OTHER, UGENDER_MALE, kFemaleOther, uprv_lengthof(kFemaleOther));
- check(UGENDER_OTHER, UGENDER_OTHER, UGENDER_MALE, kMaleOther, uprv_lengthof(kMaleOther));
+ check(UGENDER_OTHER, UGENDER_OTHER, UGENDER_MALE, kFemaleMale, UPRV_LENGTHOF(kFemaleMale));
+ check(UGENDER_OTHER, UGENDER_OTHER, UGENDER_MALE, kFemaleOther, UPRV_LENGTHOF(kFemaleOther));
+ check(UGENDER_OTHER, UGENDER_OTHER, UGENDER_MALE, kMaleOther, UPRV_LENGTHOF(kMaleOther));
}
void GenderInfoTest::TestFallback() {
};
int testNum;
- for (testNum = 0; testNum < uprv_lengthof(tests); testNum++) {
+ for (testNum = 0; testNum < UPRV_LENGTHOF(tests); testNum++) {
char testNumStr[40];
sprintf(testNumStr, "testNum = %d", testNum);
Test &test = tests[testNum];
status = U_ZERO_ERROR;
IdentifierInfo identifierInfo(status);
- for (testNum=0; testNum<uprv_lengthof(scriptTests); testNum++) {
+ for (testNum=0; testNum<UPRV_LENGTHOF(scriptTests); testNum++) {
ScriptTest &test = scriptTests[testNum];
char msgBuf[100];
sprintf(msgBuf, "testNum = %d ", testNum);
TEST_ASSERT_SUCCESS(status);
idInfo.setIdentifierProfile(*uspoof_getRecommendedUnicodeSet(&status));
TEST_ASSERT_SUCCESS(status);
- for (int32_t testNum=0; testNum < uprv_lengthof(tests); testNum++) {
+ for (int32_t testNum=0; testNum < UPRV_LENGTHOF(tests); testNum++) {
status = U_ZERO_ERROR;
const Test &test = tests[testNum];
UnicodeString testString = UnicodeString(test.fId).unescape();
sprintf(msgBuffer, "testNum = %d ", testNum);
TEST_ASSERT_SUCCESS(status);
TEST_ASSERT_MSG(expectedLevel == idInfo.getRestrictionLevel(status), msgBuffer);
- for (int levelIndex=0; levelIndex<uprv_lengthof(restrictionLevels); levelIndex++) {
+ for (int levelIndex=0; levelIndex<UPRV_LENGTHOF(restrictionLevels); levelIndex++) {
status = U_ZERO_ERROR;
URestrictionLevel levelSetInSpoofChecker = restrictionLevels[levelIndex];
USpoofChecker *sc = uspoof_open(&status);
};
UErrorCode status = U_ZERO_ERROR;
IdentifierInfo idInfo(status);
- for (int32_t testNum=0; testNum < uprv_lengthof(tests); testNum++) {
+ for (int32_t testNum=0; testNum < UPRV_LENGTHOF(tests); testNum++) {
char msgBuf[100];
sprintf(msgBuf, "testNum = %d ", testNum);
Test &test = tests[testNum];
"Feet and inches",
fmtFrFull,
feetAndInches,
- uprv_lengthof(feetAndInches),
+ UPRV_LENGTHOF(feetAndInches),
"70 pieds et 5,3 pouces");
verifyFormatWithPrefix(
"Feet and inches",
fmtFrFull,
"Prefix: ",
feetAndInches,
- uprv_lengthof(feetAndInches),
+ UPRV_LENGTHOF(feetAndInches),
"Prefix: 70 pieds et 5,3 pouces");
verifyFormat(
"Foot and inch",
fmtFrFull,
footAndInch,
- uprv_lengthof(footAndInch),
+ UPRV_LENGTHOF(footAndInch),
"1 pied et 1 pouce");
verifyFormat(
"Foot and inch narrow",
fmtFrNarrow,
footAndInch,
- uprv_lengthof(footAndInch),
+ UPRV_LENGTHOF(footAndInch),
"1\\u2032 1\\u2033");
verifyFormat(
"Inch and feet",
fmtEn,
inchAndFeet,
- uprv_lengthof(inchAndFeet),
+ UPRV_LENGTHOF(inchAndFeet),
"1 inch, 2 feet");
}
}
ExpectedResult fullData[] = {
- {t_1m_59_9996s, uprv_lengthof(t_1m_59_9996s), "1 minute, 59.9996 seconds"},
- {t_19m, uprv_lengthof(t_19m), "19 minutes"},
- {t_1h_23_5s, uprv_lengthof(t_1h_23_5s), "1 hour, 23.5 seconds"},
- {t_1h_23_5m, uprv_lengthof(t_1h_23_5m), "1 hour, 23.5 minutes"},
- {t_1h_0m_23s, uprv_lengthof(t_1h_0m_23s), "1 hour, 0 minutes, 23 seconds"},
- {t_2y_5M_3w_4d, uprv_lengthof(t_2y_5M_3w_4d), "2 years, 5 months, 3 weeks, 4 days"}};
+ {t_1m_59_9996s, UPRV_LENGTHOF(t_1m_59_9996s), "1 minute, 59.9996 seconds"},
+ {t_19m, UPRV_LENGTHOF(t_19m), "19 minutes"},
+ {t_1h_23_5s, UPRV_LENGTHOF(t_1h_23_5s), "1 hour, 23.5 seconds"},
+ {t_1h_23_5m, UPRV_LENGTHOF(t_1h_23_5m), "1 hour, 23.5 minutes"},
+ {t_1h_0m_23s, UPRV_LENGTHOF(t_1h_0m_23s), "1 hour, 0 minutes, 23 seconds"},
+ {t_2y_5M_3w_4d, UPRV_LENGTHOF(t_2y_5M_3w_4d), "2 years, 5 months, 3 weeks, 4 days"}};
ExpectedResult abbrevData[] = {
- {t_1m_59_9996s, uprv_lengthof(t_1m_59_9996s), "1 min, 59.9996 secs"},
- {t_19m, uprv_lengthof(t_19m), "19 mins"},
- {t_1h_23_5s, uprv_lengthof(t_1h_23_5s), "1 hr, 23.5 secs"},
- {t_1h_23_5m, uprv_lengthof(t_1h_23_5m), "1 hr, 23.5 mins"},
- {t_1h_0m_23s, uprv_lengthof(t_1h_0m_23s), "1 hr, 0 mins, 23 secs"},
- {t_2y_5M_3w_4d, uprv_lengthof(t_2y_5M_3w_4d), "2 yrs, 5 mths, 3 wks, 4 days"}};
+ {t_1m_59_9996s, UPRV_LENGTHOF(t_1m_59_9996s), "1 min, 59.9996 secs"},
+ {t_19m, UPRV_LENGTHOF(t_19m), "19 mins"},
+ {t_1h_23_5s, UPRV_LENGTHOF(t_1h_23_5s), "1 hr, 23.5 secs"},
+ {t_1h_23_5m, UPRV_LENGTHOF(t_1h_23_5m), "1 hr, 23.5 mins"},
+ {t_1h_0m_23s, UPRV_LENGTHOF(t_1h_0m_23s), "1 hr, 0 mins, 23 secs"},
+ {t_2y_5M_3w_4d, UPRV_LENGTHOF(t_2y_5M_3w_4d), "2 yrs, 5 mths, 3 wks, 4 days"}};
ExpectedResult narrowData[] = {
- {t_1m_59_9996s, uprv_lengthof(t_1m_59_9996s), "1m 59.9996s"},
- {t_19m, uprv_lengthof(t_19m), "19m"},
- {t_1h_23_5s, uprv_lengthof(t_1h_23_5s), "1h 23.5s"},
- {t_1h_23_5m, uprv_lengthof(t_1h_23_5m), "1h 23.5m"},
- {t_1h_0m_23s, uprv_lengthof(t_1h_0m_23s), "1h 0m 23s"},
- {t_2y_5M_3w_4d, uprv_lengthof(t_2y_5M_3w_4d), "2y 5m 3w 4d"}};
+ {t_1m_59_9996s, UPRV_LENGTHOF(t_1m_59_9996s), "1m 59.9996s"},
+ {t_19m, UPRV_LENGTHOF(t_19m), "19m"},
+ {t_1h_23_5s, UPRV_LENGTHOF(t_1h_23_5s), "1h 23.5s"},
+ {t_1h_23_5m, UPRV_LENGTHOF(t_1h_23_5m), "1h 23.5m"},
+ {t_1h_0m_23s, UPRV_LENGTHOF(t_1h_0m_23s), "1h 0m 23s"},
+ {t_2y_5M_3w_4d, UPRV_LENGTHOF(t_2y_5M_3w_4d), "2y 5m 3w 4d"}};
ExpectedResult numericData[] = {
- {t_1m_59_9996s, uprv_lengthof(t_1m_59_9996s), "1:59.9996"},
- {t_19m, uprv_lengthof(t_19m), "19m"},
- {t_1h_23_5s, uprv_lengthof(t_1h_23_5s), "1:00:23.5"},
- {t_1h_23_5m, uprv_lengthof(t_1h_23_5m), "1:23.5"},
- {t_1h_0m_23s, uprv_lengthof(t_1h_0m_23s), "1:00:23"},
- {t_5h_17m, uprv_lengthof(t_5h_17m), "5:17"},
- {t_neg5h_17m, uprv_lengthof(t_neg5h_17m), "-5h 17m"},
- {t_19m_28s, uprv_lengthof(t_19m_28s), "19:28"},
- {t_2y_5M_3w_4d, uprv_lengthof(t_2y_5M_3w_4d), "2y 5m 3w 4d"},
- {t_0h_0m_9s, uprv_lengthof(t_0h_0m_9s), "0:00:09"},
- {t_6h_56_92m, uprv_lengthof(t_6h_56_92m), "6:56.92"},
- {t_6_7h_56_92m, uprv_lengthof(t_6_7h_56_92m), "6:56.92"},
- {t_3h_4s_5m, uprv_lengthof(t_3h_4s_5m), "3h 4s 5m"},
- {t_3h_5h, uprv_lengthof(t_3h_5h), "3h 5h"}};
+ {t_1m_59_9996s, UPRV_LENGTHOF(t_1m_59_9996s), "1:59.9996"},
+ {t_19m, UPRV_LENGTHOF(t_19m), "19m"},
+ {t_1h_23_5s, UPRV_LENGTHOF(t_1h_23_5s), "1:00:23.5"},
+ {t_1h_23_5m, UPRV_LENGTHOF(t_1h_23_5m), "1:23.5"},
+ {t_1h_0m_23s, UPRV_LENGTHOF(t_1h_0m_23s), "1:00:23"},
+ {t_5h_17m, UPRV_LENGTHOF(t_5h_17m), "5:17"},
+ {t_neg5h_17m, UPRV_LENGTHOF(t_neg5h_17m), "-5h 17m"},
+ {t_19m_28s, UPRV_LENGTHOF(t_19m_28s), "19:28"},
+ {t_2y_5M_3w_4d, UPRV_LENGTHOF(t_2y_5M_3w_4d), "2y 5m 3w 4d"},
+ {t_0h_0m_9s, UPRV_LENGTHOF(t_0h_0m_9s), "0:00:09"},
+ {t_6h_56_92m, UPRV_LENGTHOF(t_6h_56_92m), "6:56.92"},
+ {t_6_7h_56_92m, UPRV_LENGTHOF(t_6_7h_56_92m), "6:56.92"},
+ {t_3h_4s_5m, UPRV_LENGTHOF(t_3h_4s_5m), "3h 4s 5m"},
+ {t_3h_5h, UPRV_LENGTHOF(t_3h_5h), "3h 5h"}};
ExpectedResult fullDataDe[] = {
- {t_1m_59_9996s, uprv_lengthof(t_1m_59_9996s), "1 Minute und 59,9996 Sekunden"},
- {t_19m, uprv_lengthof(t_19m), "19 Minuten"},
- {t_1h_23_5s, uprv_lengthof(t_1h_23_5s), "1 Stunde und 23,5 Sekunden"},
- {t_1h_23_5m, uprv_lengthof(t_1h_23_5m), "1 Stunde und 23,5 Minuten"},
- {t_1h_0m_23s, uprv_lengthof(t_1h_0m_23s), "1 Stunde, 0 Minuten und 23 Sekunden"},
- {t_2y_5M_3w_4d, uprv_lengthof(t_2y_5M_3w_4d), "2 Jahre, 5 Monate, 3 Wochen und 4 Tage"}};
+ {t_1m_59_9996s, UPRV_LENGTHOF(t_1m_59_9996s), "1 Minute und 59,9996 Sekunden"},
+ {t_19m, UPRV_LENGTHOF(t_19m), "19 Minuten"},
+ {t_1h_23_5s, UPRV_LENGTHOF(t_1h_23_5s), "1 Stunde und 23,5 Sekunden"},
+ {t_1h_23_5m, UPRV_LENGTHOF(t_1h_23_5m), "1 Stunde und 23,5 Minuten"},
+ {t_1h_0m_23s, UPRV_LENGTHOF(t_1h_0m_23s), "1 Stunde, 0 Minuten und 23 Sekunden"},
+ {t_2y_5M_3w_4d, UPRV_LENGTHOF(t_2y_5M_3w_4d), "2 Jahre, 5 Monate, 3 Wochen und 4 Tage"}};
ExpectedResult numericDataDe[] = {
- {t_1m_59_9996s, uprv_lengthof(t_1m_59_9996s), "1:59,9996"},
- {t_19m, uprv_lengthof(t_19m), "19 Min."},
- {t_1h_23_5s, uprv_lengthof(t_1h_23_5s), "1:00:23,5"},
- {t_1h_23_5m, uprv_lengthof(t_1h_23_5m), "1:23,5"},
- {t_1h_0m_23s, uprv_lengthof(t_1h_0m_23s), "1:00:23"},
- {t_5h_17m, uprv_lengthof(t_5h_17m), "5:17"},
- {t_19m_28s, uprv_lengthof(t_19m_28s), "19:28"},
- {t_2y_5M_3w_4d, uprv_lengthof(t_2y_5M_3w_4d), "2 J, 5 M, 3 W und 4 T"},
- {t_0h_0m_17s, uprv_lengthof(t_0h_0m_17s), "0:00:17"},
- {t_6h_56_92m, uprv_lengthof(t_6h_56_92m), "6:56,92"},
- {t_3h_5h, uprv_lengthof(t_3h_5h), "3 Std., 5 Std."}};
+ {t_1m_59_9996s, UPRV_LENGTHOF(t_1m_59_9996s), "1:59,9996"},
+ {t_19m, UPRV_LENGTHOF(t_19m), "19 Min."},
+ {t_1h_23_5s, UPRV_LENGTHOF(t_1h_23_5s), "1:00:23,5"},
+ {t_1h_23_5m, UPRV_LENGTHOF(t_1h_23_5m), "1:23,5"},
+ {t_1h_0m_23s, UPRV_LENGTHOF(t_1h_0m_23s), "1:00:23"},
+ {t_5h_17m, UPRV_LENGTHOF(t_5h_17m), "5:17"},
+ {t_19m_28s, UPRV_LENGTHOF(t_19m_28s), "19:28"},
+ {t_2y_5M_3w_4d, UPRV_LENGTHOF(t_2y_5M_3w_4d), "2 J, 5 M, 3 W und 4 T"},
+ {t_0h_0m_17s, UPRV_LENGTHOF(t_0h_0m_17s), "0:00:17"},
+ {t_6h_56_92m, UPRV_LENGTHOF(t_6h_56_92m), "6:56,92"},
+ {t_3h_5h, UPRV_LENGTHOF(t_3h_5h), "3 Std., 5 Std."}};
Locale en(Locale::getEnglish());
LocalPointer<NumberFormat> nf(NumberFormat::createInstance(en, status));
if (!assertSuccess("Error creating measure format en WIDE", status)) {
return;
}
- verifyFormat("en WIDE", mf, fullData, uprv_lengthof(fullData));
+ verifyFormat("en WIDE", mf, fullData, UPRV_LENGTHOF(fullData));
// exercise copy constructor
{
MeasureFormat mf2(mf);
- verifyFormat("en WIDE copy", mf2, fullData, uprv_lengthof(fullData));
+ verifyFormat("en WIDE copy", mf2, fullData, UPRV_LENGTHOF(fullData));
}
// exercise clone
{
MeasureFormat *mf3 = (MeasureFormat *) mf.clone();
- verifyFormat("en WIDE copy", *mf3, fullData, uprv_lengthof(fullData));
+ verifyFormat("en WIDE copy", *mf3, fullData, UPRV_LENGTHOF(fullData));
delete mf3;
}
mf = MeasureFormat(en, UMEASFMT_WIDTH_SHORT, (NumberFormat *) nf->clone(), status);
if (!assertSuccess("Error creating measure format en SHORT", status)) {
return;
}
- verifyFormat("en SHORT", mf, abbrevData, uprv_lengthof(abbrevData));
+ verifyFormat("en SHORT", mf, abbrevData, UPRV_LENGTHOF(abbrevData));
mf = MeasureFormat(en, UMEASFMT_WIDTH_NARROW, (NumberFormat *) nf->clone(), status);
if (!assertSuccess("Error creating measure format en NARROW", status)) {
return;
}
- verifyFormat("en NARROW", mf, narrowData, uprv_lengthof(narrowData));
+ verifyFormat("en NARROW", mf, narrowData, UPRV_LENGTHOF(narrowData));
mf = MeasureFormat(en, UMEASFMT_WIDTH_NUMERIC, (NumberFormat *) nf->clone(), status);
if (!assertSuccess("Error creating measure format en NUMERIC", status)) {
return;
}
- verifyFormat("en NUMERIC", mf, numericData, uprv_lengthof(numericData));
+ verifyFormat("en NUMERIC", mf, numericData, UPRV_LENGTHOF(numericData));
Locale de(Locale::getGerman());
nf.adoptInstead(NumberFormat::createInstance(de, status));
if (!assertSuccess("Error creating measure format de WIDE", status)) {
return;
}
- verifyFormat("de WIDE", mf, fullDataDe, uprv_lengthof(fullDataDe));
+ verifyFormat("de WIDE", mf, fullDataDe, UPRV_LENGTHOF(fullDataDe));
mf = MeasureFormat(de, UMEASFMT_WIDTH_NUMERIC, (NumberFormat *) nf->clone(), status);
if (!assertSuccess("Error creating measure format de NUMERIC", status)) {
return;
}
- verifyFormat("de NUMERIC", mf, numericDataDe, uprv_lengthof(numericDataDe));
+ verifyFormat("de NUMERIC", mf, numericDataDe, UPRV_LENGTHOF(numericDataDe));
}
void MeasureFormatTest::Test10219FractionalPlurals() {
{"1 minute", "1.0 minutes", "1.01 minutes"}
};
UErrorCode status = U_ZERO_ERROR;
- for (int j = 0; j < uprv_lengthof(values); j++) {
- for (int i = 0; i < uprv_lengthof(expected[j]); i++) {
+ for (int j = 0; j < UPRV_LENGTHOF(values); j++) {
+ for (int i = 0; i < UPRV_LENGTHOF(expected[j]); i++) {
DecimalFormat *df =
(DecimalFormat *) NumberFormat::createInstance(en, status);
if (U_FAILURE(status)) {
"7 \\u03AD\\u03C4\\u03B7"};
int32_t counter = 0;
- for (int32_t locIndex = 0; locIndex < uprv_lengthof(locales); ++locIndex ) {
- for( int32_t numIndex = 0; numIndex < uprv_lengthof(numbers); ++numIndex ) {
- for ( int32_t styleIndex = 0; styleIndex < uprv_lengthof(styles); ++styleIndex ) {
- for ( int32_t unitIndex = 0; unitIndex < uprv_lengthof(units); ++unitIndex ) {
+ for (int32_t locIndex = 0; locIndex < UPRV_LENGTHOF(locales); ++locIndex ) {
+ for( int32_t numIndex = 0; numIndex < UPRV_LENGTHOF(numbers); ++numIndex ) {
+ for ( int32_t styleIndex = 0; styleIndex < UPRV_LENGTHOF(styles); ++styleIndex ) {
+ for ( int32_t unitIndex = 0; unitIndex < UPRV_LENGTHOF(units); ++unitIndex ) {
Measure measure(numbers[numIndex], new MeasureUnit(units[unitIndex]), status);
if (!assertSuccess("Error creating Measure", status)) {
return;
return;
}
UnicodeString buffer;
- fmt.formatMeasures(measures, uprv_lengthof(measures), buffer, pos, status);
+ fmt.formatMeasures(measures, UPRV_LENGTHOF(measures), buffer, pos, status);
if (!assertSuccess("Error formatting measures", status)) {
return;
}
fmt,
prefix,
first,
- uprv_lengthof(first),
+ UPRV_LENGTHOF(first),
NumberFormat::kIntegerField,
8,
11);
fmt,
prefix,
second,
- uprv_lengthof(second),
+ UPRV_LENGTHOF(second),
NumberFormat::kDecimalSeparatorField,
23,
24);
fmt,
prefix,
third,
- uprv_lengthof(third),
+ UPRV_LENGTHOF(third),
NumberFormat::kDecimalSeparatorField,
0,
0);
}
nf->setMinimumFractionDigits(2);
nf->setMaximumFractionDigits(2);
- fmt.formatMeasures(measures, uprv_lengthof(measures), appendTo, pos, status);
+ fmt.formatMeasures(measures, UPRV_LENGTHOF(measures), appendTo, pos, status);
if (!assertSuccess("Error formatting", status)) {
return;
}
appendTo);
measures[0] = Measure(-4.7, MeasureUnit::createHour(status), status);
appendTo.remove();
- fmt.formatMeasures(measures, uprv_lengthof(measures), appendTo, pos, status);
+ fmt.formatMeasures(measures, UPRV_LENGTHOF(measures), appendTo, pos, status);
if (!assertSuccess("Error formatting", status)) {
return;
}
UNUM_CURRENCY_PLURAL
};
- for (int32_t i=0; i<uprv_lengthof(DATA); ++i) {
- for (int32_t kIndex = 0; kIndex < uprv_lengthof(currencyStyles); ++kIndex) {
+ for (int32_t i=0; i<UPRV_LENGTHOF(DATA); ++i) {
+ for (int32_t kIndex = 0; kIndex < UPRV_LENGTHOF(currencyStyles); ++kIndex) {
UNumberFormatStyle k = currencyStyles[kIndex];
const char* localeString = DATA[i][0];
double numberToBeFormat = atof(DATA[i][1]);
printf("loop: %d\n", deadloop++);
#endif
for (uint32_t i=0; i< sizeof(DATA)/sizeof(DATA[0]); ++i) { /* i = test case # - should be i=0*/
- for (int32_t kIndex = 2; kIndex < uprv_lengthof(currencyStyles); ++kIndex) {
+ for (int32_t kIndex = 2; kIndex < UPRV_LENGTHOF(currencyStyles); ++kIndex) {
UNumberFormatStyle k = currencyStyles[kIndex]; /* k = style */
const char* localeString = DATA[i][0];
double numberToBeFormat = atof(DATA[i][1]);
}
double fData[] = {-101, -100, -1, -0.0, 0, 0.1, 1, 1.999, 2.0, 100, 100.001 };
UBool isKeywordA[] = {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE };
- for (int32_t i=0; i<uprv_lengthof(fData); i++) {
+ for (int32_t i=0; i<UPRV_LENGTHOF(fData); i++) {
if ((newRules->select(fData[i])== KEYWORD_A) != isKeywordA[i]) {
errln("File %s, Line %d, ERROR: plural rules for decimal fractions test failed!\n"
" number = %g, expected %s", __FILE__, __LINE__, fData[i], isKeywordA[i]?"TRUE":"FALSE");
}
const UnicodeString* keyword;
while (NULL != (keyword = keywords->snext(status))) {
- int32_t count = rules->getSamples(*keyword, values, uprv_lengthof(values), status);
+ int32_t count = rules->getSamples(*keyword, values, UPRV_LENGTHOF(values), status);
if (U_FAILURE(status)) {
errln(UNICODE_STRING_SIMPLE("getSamples() failed for locale ") +
locales[i].getName() +
// TODO: Lots of these.
// errln(UNICODE_STRING_SIMPLE("no samples for keyword ") + *keyword + UNICODE_STRING_SIMPLE(" in locale ") + locales[i].getName() );
}
- if (count > uprv_lengthof(values)) {
+ if (count > UPRV_LENGTHOF(values)) {
errln(UNICODE_STRING_SIMPLE("getSamples()=") + count +
UNICODE_STRING_SIMPLE(", too many values, for locale ") +
locales[i].getName() +
UNICODE_STRING_SIMPLE(", keyword ") + *keyword);
- count = uprv_lengthof(values);
+ count = UPRV_LENGTHOF(values);
}
for (int32_t j = 0; j < count; ++j) {
if (values[j] == UPLRULES_NO_UNIQUE_VALUE) {
"a: n % 37 ! in 3..4"
};
- for (int i=0; i<uprv_lengthof(testCases); i++) {
+ for (int i=0; i<UPRV_LENGTHOF(testCases); i++) {
const char *rules = testCases[i];
UErrorCode status = U_ZERO_ERROR;
PluralRules *pr = PluralRules::createRules(UnicodeString(rules), status);
{100.0001234, 7, 1234}
};
- for (int i=0; i<uprv_lengthof(testCases); ++i) {
+ for (int i=0; i<UPRV_LENGTHOF(testCases); ++i) {
DoubleTestCase &tc = testCases[i];
int32_t numFractionDigits = FixedDecimal::decimals(tc.n);
if (numFractionDigits != tc.fractionDigitCount) {
// It should set an U_REGEX_INVALID_STATE.
UChar buf[100];
- int32_t len = uregex_group(icu_re, 0, buf, uprv_lengthof(buf), &status);
+ int32_t len = uregex_group(icu_re, 0, buf, UPRV_LENGTHOF(buf), &status);
REGEX_ASSERT(status == U_REGEX_INVALID_STATE);
REGEX_ASSERT(len == 0);
void RegionTest::TestKnownRegions() {
- for (int32_t i = 0 ; i < uprv_lengthof(knownRegions) ; i++ ) {
+ for (int32_t i = 0 ; i < UPRV_LENGTHOF(knownRegions) ; i++ ) {
KnownRegion rd = knownRegions[i];
UErrorCode status = U_ZERO_ERROR;
const Region *r = Region::getInstance(rd.code,status);
}
- for (int32_t i = 0 ; i < uprv_lengthof(testData) ; i++ ) {
+ for (int32_t i = 0 ; i < UPRV_LENGTHOF(testData) ; i++ ) {
TestData data = testData[i];
status = U_ZERO_ERROR;
r = Region::getInstance(data.inputID,status);
errcheckln(status, "Calling Region::getInstance(-123) should have triggered an U_ILLEGAL_ARGUMENT_ERROR, but didn't. - %s", u_errorName(status));
}
- for (int32_t i = 0 ; i < uprv_lengthof(testData) ; i++ ) {
+ for (int32_t i = 0 ; i < UPRV_LENGTHOF(testData) ; i++ ) {
TestData data = testData[i];
status = U_ZERO_ERROR;
const Region *r = Region::getInstance(data.inputID,status);
}
void RegionTest::TestGetContainedRegions() {
- for (int32_t i = 0 ; i < uprv_lengthof(knownRegions) ; i++ ) {
+ for (int32_t i = 0 ; i < UPRV_LENGTHOF(knownRegions) ; i++ ) {
KnownRegion rd = knownRegions[i];
UErrorCode status = U_ZERO_ERROR;
}
void RegionTest::TestGetContainedRegionsWithType() {
- for (int32_t i = 0 ; i < uprv_lengthof(knownRegions) ; i++ ) {
+ for (int32_t i = 0 ; i < UPRV_LENGTHOF(knownRegions) ; i++ ) {
KnownRegion rd = knownRegions[i];
UErrorCode status = U_ZERO_ERROR;
}
void RegionTest::TestGetContainingRegion() {
- for (int32_t i = 0 ; i < uprv_lengthof(knownRegions) ; i++ ) {
+ for (int32_t i = 0 ; i < UPRV_LENGTHOF(knownRegions) ; i++ ) {
KnownRegion rd = knownRegions[i];
UErrorCode status = U_ZERO_ERROR;
const Region *r = Region::getInstance(rd.code,status);
}
void RegionTest::TestGetContainingRegionWithType() {
- for (int32_t i = 0 ; i < uprv_lengthof(knownRegions) ; i++ ) {
+ for (int32_t i = 0 ; i < UPRV_LENGTHOF(knownRegions) ; i++ ) {
KnownRegion rd = knownRegions[i];
UErrorCode status = U_ZERO_ERROR;
}
void RegionTest::TestContains() {
- for (int32_t i = 0 ; i < uprv_lengthof(knownRegions) ; i++ ) {
+ for (int32_t i = 0 ; i < UPRV_LENGTHOF(knownRegions) ; i++ ) {
KnownRegion rd = knownRegions[i];
UErrorCode status = U_ZERO_ERROR;
}
void RelativeDateTimeFormatterTest::TestEnglish() {
- RunTest("en", kEnglish, uprv_lengthof(kEnglish));
+ RunTest("en", kEnglish, UPRV_LENGTHOF(kEnglish));
}
void RelativeDateTimeFormatterTest::TestEnglishCaps() {
RelativeDateTimeFormatter fmt2(fmt);
fmt3 = fmt2;
assertSuccess("", status);
- RunTest(fmt3, kEnglishCaps, uprv_lengthof(kEnglishCaps), "en caps");
+ RunTest(fmt3, kEnglishCaps, UPRV_LENGTHOF(kEnglishCaps), "en caps");
}
void RelativeDateTimeFormatterTest::TestEnglishShort() {
- RunTest("en", UDAT_STYLE_SHORT, kEnglishShort, uprv_lengthof(kEnglishShort));
+ RunTest("en", UDAT_STYLE_SHORT, kEnglishShort, UPRV_LENGTHOF(kEnglishShort));
}
void RelativeDateTimeFormatterTest::TestEnglishNarrow() {
- RunTest("en", UDAT_STYLE_NARROW, kEnglishNarrow, uprv_lengthof(kEnglishNarrow));
+ RunTest("en", UDAT_STYLE_NARROW, kEnglishNarrow, UPRV_LENGTHOF(kEnglishNarrow));
}
void RelativeDateTimeFormatterTest::TestSerbian() {
- RunTest("sr", kSerbian, uprv_lengthof(kSerbian));
+ RunTest("sr", kSerbian, UPRV_LENGTHOF(kSerbian));
}
void RelativeDateTimeFormatterTest::TestSerbianFallback() {
- RunTest("sr", UDAT_STYLE_NARROW, kSerbian, uprv_lengthof(kSerbian));
+ RunTest("sr", UDAT_STYLE_NARROW, kSerbian, UPRV_LENGTHOF(kSerbian));
}
void RelativeDateTimeFormatterTest::TestEnglishNoQuantity() {
- RunTest("en", kEnglishNoQuantity, uprv_lengthof(kEnglishNoQuantity));
+ RunTest("en", kEnglishNoQuantity, UPRV_LENGTHOF(kEnglishNoQuantity));
}
void RelativeDateTimeFormatterTest::TestEnglishNoQuantityCaps() {
RunTest(
fmt,
kEnglishNoQuantityCaps,
- uprv_lengthof(kEnglishNoQuantityCaps),
+ UPRV_LENGTHOF(kEnglishNoQuantityCaps),
"en caps no quantity");
}
"en",
UDAT_STYLE_SHORT,
kEnglishNoQuantityShort,
- uprv_lengthof(kEnglishNoQuantityShort));
+ UPRV_LENGTHOF(kEnglishNoQuantityShort));
}
void RelativeDateTimeFormatterTest::TestEnglishNoQuantityNarrow() {
"en",
UDAT_STYLE_NARROW,
kEnglishNoQuantityNarrow,
- uprv_lengthof(kEnglishNoQuantityNarrow));
+ UPRV_LENGTHOF(kEnglishNoQuantityNarrow));
}
void RelativeDateTimeFormatterTest::TestSpanishNoQuantity() {
- RunTest("es", kSpanishNoQuantity, uprv_lengthof(kSpanishNoQuantity));
+ RunTest("es", kSpanishNoQuantity, UPRV_LENGTHOF(kSpanishNoQuantity));
}
void RelativeDateTimeFormatterTest::TestFormatWithQuantityIllegalArgument() {
// Test copy constructor.
RelativeDateTimeFormatter fmt2(fmt);
- RunTest(fmt2, kEnglishDecimal, uprv_lengthof(kEnglishDecimal), "en decimal digits");
+ RunTest(fmt2, kEnglishDecimal, UPRV_LENGTHOF(kEnglishDecimal), "en decimal digits");
// Test assignment
fmt = RelativeDateTimeFormatter("es", status);
- RunTest(fmt, kSpanishNoQuantity, uprv_lengthof(kSpanishNoQuantity), "assignment operator");
+ RunTest(fmt, kSpanishNoQuantity, UPRV_LENGTHOF(kSpanishNoQuantity), "assignment operator");
}
selFmt = NULL;
selFmt = new SelectFormat( SIMPLE_PATTERN , status);
- for (int32_t i = 0; i < uprv_lengthof(keywords); i++ ){
+ for (int32_t i = 0; i < UPRV_LENGTHOF(keywords); i++ ){
status = U_ZERO_ERROR;
selFmt->format( keywords[i], result , ignore , status);
if (!U_FAILURE(status)) {
"Prefix: Templates frogtommy{0} and leg are out of order.",
fmt.format(
params,
- uprv_lengthof(params),
+ UPRV_LENGTHOF(params),
appendTo,
offsets,
- uprv_lengthof(offsets),
+ UPRV_LENGTHOF(offsets),
status));
assertSuccess("Status", status);
- for (int32_t i = 0; i < uprv_lengthof(expectedOffsets); ++i) {
+ for (int32_t i = 0; i < UPRV_LENGTHOF(expectedOffsets); ++i) {
if (expectedOffsets[i] != offsets[i]) {
errln("Expected %d, got %d", expectedOffsets[i], offsets[i]);
}
appendTo.remove();
fmt.format(
params,
- uprv_lengthof(params) - 1,
+ UPRV_LENGTHOF(params) - 1,
appendTo,
offsets,
- uprv_lengthof(offsets),
+ UPRV_LENGTHOF(offsets),
status);
if (status != U_ILLEGAL_ARGUMENT_ERROR) {
errln("Expected U_ILLEGAL_ARGUMENT_ERROR");
}
status = U_ZERO_ERROR;
- offsets[uprv_lengthof(offsets) - 1] = 289;
+ offsets[UPRV_LENGTHOF(offsets) - 1] = 289;
appendTo.remove();
fmt.format(
params,
- uprv_lengthof(params),
+ UPRV_LENGTHOF(params),
appendTo,
offsets,
- uprv_lengthof(offsets) - 1,
+ UPRV_LENGTHOF(offsets) - 1,
status);
- assertEquals("Offsets buffer length", 289, offsets[uprv_lengthof(offsets) - 1]);
+ assertEquals("Offsets buffer length", 289, offsets[UPRV_LENGTHOF(offsets) - 1]);
// Test assignment
SimplePatternFormatter s;
"Templates frogtommy{0} and leg are out of order.",
s.format(
params,
- uprv_lengthof(params),
+ UPRV_LENGTHOF(params),
appendTo,
NULL,
0,
"Templates frogtommy{0} and leg are out of order.",
r.format(
params,
- uprv_lengthof(params),
+ UPRV_LENGTHOF(params),
appendTo,
NULL,
0,
"leg, freddy, frog and by",
fmt.format(
params,
- uprv_lengthof(params),
+ UPRV_LENGTHOF(params),
values[2],
offsets,
- uprv_lengthof(offsets),
+ UPRV_LENGTHOF(offsets),
status));
assertSuccess("Status", status);
- for (int32_t i = 0; i < uprv_lengthof(expectedOffsets); ++i) {
+ for (int32_t i = 0; i < UPRV_LENGTHOF(expectedOffsets); ++i) {
if (expectedOffsets[i] != offsets[i]) {
errln("Expected %d, got %d", expectedOffsets[i], offsets[i]);
}
// or even just { 0 } as boundaries.
static const UChar rules[] = { 0x2e, 0x2a, 0x3b }; // ".*;"
UParseError parseError;
- iter.adoptInstead(ubrk_openRules(rules, uprv_lengthof(rules), NULL, 0, &parseError, &status));
+ iter.adoptInstead(ubrk_openRules(rules, UPRV_LENGTHOF(rules), NULL, 0, &parseError, &status));
}
}
#endif
ucs,
ucs_ptr
};
- const int32_t ft_cnt = uprv_lengthof(ftarray);
+ const int32_t ft_cnt = UPRV_LENGTHOF(ftarray);
Formattable ft_arr( ftarray, ft_cnt );
UnicodeString temp;
if ((ft_arr[0].getType() == Formattable::kDate) && (ft_arr[0].getDate() == 1.0)
"I don't know", "I don't know", "I don''t know",
"I don't know", "I don''t know", "I don''t know"
};
- int32_t tuples_count = uprv_lengthof(tuples);
+ int32_t tuples_count = UPRV_LENGTHOF(tuples);
for (int i = 0; i < tuples_count; i += 3) {
UnicodeString& desired = tuples[i];
IntlTest inteltst = IntlTest();
status = U_ZERO_ERROR;
- length = u_shapeArabic(src, -1, dst, uprv_lengthof(dst),
+ length = u_shapeArabic(src, -1, dst, UPRV_LENGTHOF(dst),
U_SHAPE_LETTERS_SHAPE|U_SHAPE_SEEN_TWOCELL_NEAR, &status);
if(U_FAILURE(status)) {
inteltst.errln("Fail: status %s\n", u_errorName(status));
} else if(length!=2) {
inteltst.errln("Fail: len %d expected 3\n", length);
return FALSE;
- } else if(u_strncmp(dst,dst_old,uprv_lengthof(dst))) {
+ } else if(u_strncmp(dst,dst_old,UPRV_LENGTHOF(dst))) {
inteltst.errln("Fail: got U+%04X U+%04X expected U+%04X U+%04X\n",
dst[0],dst[1],dst_old[0],dst_old[1]);
return FALSE;
//"Trying new tail
status = U_ZERO_ERROR;
- length = u_shapeArabic(src, -1, dst, uprv_lengthof(dst),
+ length = u_shapeArabic(src, -1, dst, UPRV_LENGTHOF(dst),
U_SHAPE_LETTERS_SHAPE|U_SHAPE_SEEN_TWOCELL_NEAR|U_SHAPE_TAIL_NEW_UNICODE, &status);
if(U_FAILURE(status)) {
inteltst.errln("Fail: status %s\n", u_errorName(status));
} else if(length!=2) {
inteltst.errln("Fail: len %d expected 3\n", length);
return FALSE;
- } else if(u_strncmp(dst,dst_new,uprv_lengthof(dst))) {
+ } else if(u_strncmp(dst,dst_new,UPRV_LENGTHOF(dst))) {
inteltst.errln("Fail: got U+%04X U+%04X expected U+%04X U+%04X\n",
dst[0],dst[1],dst_new[0],dst_new[1]);
return FALSE;
gFinishedThreads = 0;
gObjectsCreated = 0;
- UnifiedCacheThread *threads[CACHE_LOAD][uprv_lengthof(gCacheLocales)];
+ UnifiedCacheThread *threads[CACHE_LOAD][UPRV_LENGTHOF(gCacheLocales)];
for (int32_t i=0; i<CACHE_LOAD; ++i) {
- for (int32_t j=0; j<uprv_lengthof(gCacheLocales); ++j) {
+ for (int32_t j=0; j<UPRV_LENGTHOF(gCacheLocales); ++j) {
threads[i][j] = new UnifiedCacheThread(gCacheLocales[j]);
threads[i][j]->start();
}
// Wait on all the threads to complete verify that LENGTHOF(gCacheLocales)
// objects were created.
umtx_lock(&gCTMutex);
- while (gFinishedThreads < CACHE_LOAD*uprv_lengthof(gCacheLocales)) {
+ while (gFinishedThreads < CACHE_LOAD*UPRV_LENGTHOF(gCacheLocales)) {
umtx_condWait(&gCTConditionVar, &gCTMutex);
}
- assertEquals("Objects created", uprv_lengthof(gCacheLocales), gObjectsCreated);
+ assertEquals("Objects created", UPRV_LENGTHOF(gCacheLocales), gObjectsCreated);
umtx_unlock(&gCTMutex);
// clean up threads
for (int32_t i=0; i<CACHE_LOAD; ++i) {
- for (int32_t j=0; j<uprv_lengthof(gCacheLocales); ++j) {
+ for (int32_t j=0; j<UPRV_LENGTHOF(gCacheLocales); ++j) {
delete threads[i][j];
}
}
#include "normalizer2impl.h"
#include "tstnorm.h"
-#define ARRAY_LENGTH(array) uprv_lengthof(array)
+#define ARRAY_LENGTH(array) UPRV_LENGTHOF(array)
#define CASE(id,test) case id: \
name = #test; \
// for both sets of test data
static const char *const moves="0+0+0--0-0-+++0--+++++++0--------";
- TestPreviousNext(src, uprv_lengthof(src),
- expect, uprv_lengthof(expect),
+ TestPreviousNext(src, UPRV_LENGTHOF(src),
+ expect, UPRV_LENGTHOF(expect),
expectIndex,
SRC_MIDDLE, EXPECT_MIDDLE,
moves, UNORM_NFD, "basic");
- TestPreviousNext(src_j2911, uprv_lengthof(src_j2911),
- expect_j2911, uprv_lengthof(expect_j2911),
+ TestPreviousNext(src_j2911, UPRV_LENGTHOF(src_j2911),
+ expect_j2911, UPRV_LENGTHOF(expect_j2911),
expectIndex_j2911,
SRC_MIDDLE, EXPECT_MIDDLE,
moves, UNORM_NFKC, "j2911");
// try again from different "middle" indexes
- TestPreviousNext(src, uprv_lengthof(src),
- expect, uprv_lengthof(expect),
+ TestPreviousNext(src, UPRV_LENGTHOF(src),
+ expect, UPRV_LENGTHOF(expect),
expectIndex,
SRC_MIDDLE_2, EXPECT_MIDDLE_2,
moves, UNORM_NFD, "basic_2");
- TestPreviousNext(src_j2911, uprv_lengthof(src_j2911),
- expect_j2911, uprv_lengthof(expect_j2911),
+ TestPreviousNext(src_j2911, UPRV_LENGTHOF(src_j2911),
+ expect_j2911, UPRV_LENGTHOF(expect_j2911),
expectIndex_j2911,
SRC_MIDDLE_2, EXPECT_MIDDLE_2,
moves, UNORM_NFKC, "j2911_2");
{ UNORM_UNICODE_3_2<<UNORM_COMPARE_NORM_OPTIONS_SHIFT, "Unicode 3.2" }
};
- int32_t i, j, k, count=uprv_lengthof(strings);
+ int32_t i, j, k, count=UPRV_LENGTHOF(strings);
int32_t result, refResult;
UErrorCode errorCode;
// test them each with each other
for(i=0; i<count; ++i) {
for(j=i; j<count; ++j) {
- for(k=0; k<uprv_lengthof(opt); ++k) {
+ for(k=0; k<UPRV_LENGTHOF(opt); ++k) {
// test Normalizer::compare
errorCode=U_ZERO_ERROR;
result=_norm_compare(s[i], s[j], opt[k].options, errorCode);
}
// collect all sets into one for contiguous output
- for(i=0; i<uprv_lengthof(iI); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(iI); ++i) {
if(nfcImpl->getCanonStartSet(iI[i], iSet)) {
set.addAll(iSet);
}
}
s1.setTo(c);
- for(k=0; k<uprv_lengthof(opt); ++k) {
+ for(k=0; k<UPRV_LENGTHOF(opt); ++k) {
// test Normalizer::compare
errorCode=U_ZERO_ERROR;
result=_norm_compare(s1, s2, opt[k].options, errorCode);
if(errorCode.logDataIfFailureAndReset("unable to load testdata/testnorm.nrm")) {
return;
}
- for(int32_t i=0; i<uprv_lengthof(pairs); ++i) {
+ for(int32_t i=0; i<UPRV_LENGTHOF(pairs); ++i) {
const StringPair &pair=pairs[i];
UnicodeString input=UnicodeString(pair.input, -1, US_INV).unescape();
UnicodeString expected=UnicodeString(pair.expected, -1, US_INV).unescape();
if(errorCode.logDataIfFailureAndReset("unable to load testdata/testnorm.nrm")) {
return;
}
- for(int32_t i=0; i<uprv_lengthof(pairs); ++i) {
+ for(int32_t i=0; i<UPRV_LENGTHOF(pairs); ++i) {
const StringPair &pair=pairs[i];
UnicodeString input=UnicodeString(pair.input, -1, US_INV).unescape();
UnicodeString expected=UnicodeString(pair.expected, -1, US_INV).unescape();
dataerrln("generating NumberFormat Object failed: %s", u_errorName(status));
return;
}
- for (int32_t j = 0; j < uprv_lengthof(values); ++j) {
- for (int32_t i = 0; i < uprv_lengthof(expected[j]); ++i) {
+ for (int32_t j = 0; j < UPRV_LENGTHOF(values); ++j) {
+ for (int32_t i = 0; i < UPRV_LENGTHOF(expected[j]); ++i) {
nf->setMinimumFractionDigits(i);
nf->setMaximumFractionDigits(i);
nf->setRoundingMode(DecimalFormat::kRoundDown);
TimeZone *tz;
UDate dt;
int32_t t, i, raw, dst;
- for (t = 0; t < uprv_lengthof(timezones); ++t) {
+ for (t = 0; t < UPRV_LENGTHOF(timezones); ++t) {
tz = timezones[t];
- for (i = 0; i < uprv_lengthof(data); ++i) {
+ for (i = 0; i < UPRV_LENGTHOF(data); ++i) {
gc.set(data[i].year, data[i].month, data[i].day,
data[i].hour, data[i].minute, data[i].second);
dt = gc.getTime(status);
unknownPropertyNames=NULL;
}
// Ignore some property names altogether.
- for(int32_t i=0; i<uprv_lengthof(ignorePropNames); ++i) {
+ for(int32_t i=0; i<UPRV_LENGTHOF(ignorePropNames); ++i) {
unknownPropertyNames->puti(UnicodeString(ignorePropNames[i], -1, US_INV), 1, errorCode);
}
}
UCHAR_CHANGES_WHEN_NFKC_CASEFOLDED
};
-static int32_t numErrors[uprv_lengthof(derivedPropsIndex)]={ 0 };
+static int32_t numErrors[UPRV_LENGTHOF(derivedPropsIndex)]={ 0 };
enum { MAX_ERRORS=50 };
}
/* parse derived binary property name, ignore unknown names */
- i=getTokenIndex(derivedPropsNames, uprv_lengthof(derivedPropsNames), fields[1][0]);
+ i=getTokenIndex(derivedPropsNames, UPRV_LENGTHOF(derivedPropsNames), fields[1][0]);
if(i<0) {
UnicodeString propName(fields[1][0], (int32_t)(fields[1][1]-fields[1][0]));
propName.trim();
void UnicodeTest::TestAdditionalProperties() {
#if !UCONFIG_NO_NORMALIZATION
// test DerivedCoreProperties.txt and DerivedNormalizationProps.txt
- if(uprv_lengthof(derivedProps)<uprv_lengthof(derivedPropsNames)) {
+ if(UPRV_LENGTHOF(derivedProps)<UPRV_LENGTHOF(derivedPropsNames)) {
errln("error: UnicodeTest::derivedProps[] too short, need at least %d UnicodeSets\n",
- uprv_lengthof(derivedPropsNames));
+ UPRV_LENGTHOF(derivedPropsNames));
return;
}
- if(uprv_lengthof(derivedPropsIndex)!=uprv_lengthof(derivedPropsNames)) {
- errln("error in ucdtest.cpp: uprv_lengthof(derivedPropsIndex)!=uprv_lengthof(derivedPropsNames)\n");
+ if(UPRV_LENGTHOF(derivedPropsIndex)!=UPRV_LENGTHOF(derivedPropsNames)) {
+ errln("error in ucdtest.cpp: UPRV_LENGTHOF(derivedPropsIndex)!=UPRV_LENGTHOF(derivedPropsNames)\n");
return;
}
UChar32 start, end;
// test all TRUE properties
- for(i=0; i<uprv_lengthof(derivedPropsNames); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(derivedPropsNames); ++i) {
rangeCount=derivedProps[i].getRangeCount();
for(range=0; range<rangeCount && numErrors[i]<MAX_ERRORS; ++range) {
start=derivedProps[i].getRangeStart(range);
}
// invert all properties
- for(i=0; i<uprv_lengthof(derivedPropsNames); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(derivedPropsNames); ++i) {
derivedProps[i].complement();
}
// test all FALSE properties
- for(i=0; i<uprv_lengthof(derivedPropsNames); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(derivedPropsNames); ++i) {
rangeCount=derivedProps[i].getRangeCount();
for(range=0; range<rangeCount && numErrors[i]<MAX_ERRORS; ++range) {
start=derivedProps[i].getRangeStart(range);
static const char *const falseValues[]={ "N", "No", "F", "False" };
static const char *const trueValues[]={ "Y", "Yes", "T", "True" };
int32_t i;
- for(i=0; i<uprv_lengthof(falseValues); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(falseValues); ++i) {
UnicodeString pattern=UNICODE_STRING_SIMPLE("[:Alphabetic=:]");
pattern.insert(pattern.length()-2, UnicodeString(falseValues[i], -1, US_INV));
errorCode=U_ZERO_ERROR;
errln("UnicodeSet([:Alphabetic=%s:]).complement()!=UnicodeSet([:Alphabetic:])\n", falseValues[i]);
}
}
- for(i=0; i<uprv_lengthof(trueValues); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(trueValues); ++i) {
UnicodeString pattern=UNICODE_STRING_SIMPLE("[:Alphabetic=:]");
pattern.insert(pattern.length()-2, UnicodeString(trueValues[i], -1, US_INV));
errorCode=U_ZERO_ERROR;
static const StringAndValue data[]={
{ "", 0 }
};
- checkData(data, uprv_lengthof(data));
+ checkData(data, UPRV_LENGTHOF(data));
}
void UCharsTrieTest::Test_a() {
static const StringAndValue data[]={
{ "a", 1 }
};
- checkData(data, uprv_lengthof(data));
+ checkData(data, UPRV_LENGTHOF(data));
}
void UCharsTrieTest::Test_a_ab() {
{ "a", 1 },
{ "ab", 100 }
};
- checkData(data, uprv_lengthof(data));
+ checkData(data, UPRV_LENGTHOF(data));
}
void UCharsTrieTest::TestShortestBranch() {
{ "a", 1000 },
{ "b", 2000 }
};
- checkData(data, uprv_lengthof(data));
+ checkData(data, UPRV_LENGTHOF(data));
}
void UCharsTrieTest::TestBranches() {
{ "vv", 0x7fffffff },
{ "zz", (int32_t)0x80000000 }
};
- for(int32_t length=2; length<=uprv_lengthof(data); ++length) {
+ for(int32_t length=2; length<=UPRV_LENGTHOF(data); ++length) {
logln("TestBranches length=%d", (int)length);
checkData(data, length);
}
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", -3 }
};
- checkData(data, uprv_lengthof(data));
+ checkData(data, UPRV_LENGTHOF(data));
}
void UCharsTrieTest::TestLongBranch() {
{ "t234567890", 0x77777777 },
{ "z", (int32_t)0x80000001 }
};
- checkData(data, uprv_lengthof(data));
+ checkData(data, UPRV_LENGTHOF(data));
}
void UCharsTrieTest::TestValuesForState() {
{ "abcde", -5 },
{ "abcdef", -6 }
};
- checkData(data, uprv_lengthof(data));
+ checkData(data, UPRV_LENGTHOF(data));
}
void UCharsTrieTest::TestCompact() {
{ "xjuly", 7 },
{ "xjune", 6 }
};
- checkData(data, uprv_lengthof(data));
+ checkData(data, UPRV_LENGTHOF(data));
}
void UCharsTrieTest::TestFirstForCodePoint() {
{ "\\U00050000xy", 8 },
{ "\\U00050000xyz", 9 }
};
- checkData(data, uprv_lengthof(data));
+ checkData(data, UPRV_LENGTHOF(data));
}
void UCharsTrieTest::TestNextForCodePoint() {
{ "\\u4dff\\U00010000\\u9999\\U00020002", 44444 },
{ "\\u4dff\\U000103ff", 99999 }
};
- LocalPointer<UCharsTrie> trie(buildTrie(data, uprv_lengthof(data), USTRINGTRIE_BUILD_FAST));
+ LocalPointer<UCharsTrie> trie(buildTrie(data, UPRV_LENGTHOF(data), USTRINGTRIE_BUILD_FAST));
if(trie.isNull()) {
return; // buildTrie() reported an error
}
{ "jun.", 6 },
{ "june", 6 }
};
- return buildTrie(data, uprv_lengthof(data), buildOption);
+ return buildTrie(data, UPRV_LENGTHOF(data), buildOption);
}
void UCharsTrieTest::TestHasUniqueValue() {
{ "uar", 1 },
{ "uary", 1 }
};
- checkIterator(iter, data, uprv_lengthof(data));
+ checkIterator(iter, data, UPRV_LENGTHOF(data));
// Reset, and we should get the same result.
logln("after iter.reset()");
- checkIterator(iter.reset(), data, uprv_lengthof(data));
+ checkIterator(iter.reset(), data, UPRV_LENGTHOF(data));
}
void UCharsTrieTest::TestIteratorFromLinearMatch() {
{ "r", 1 },
{ "ry", 1 }
};
- checkIterator(iter, data, uprv_lengthof(data));
+ checkIterator(iter, data, UPRV_LENGTHOF(data));
// Reset, and we should get the same result.
logln("after iter.reset()");
- checkIterator(iter.reset(), data, uprv_lengthof(data));
+ checkIterator(iter.reset(), data, UPRV_LENGTHOF(data));
}
void UCharsTrieTest::TestTruncatingIteratorFromRoot() {
{ "jun.", 6 },
{ "june", 6 }
};
- checkIterator(iter, data, uprv_lengthof(data));
+ checkIterator(iter, data, UPRV_LENGTHOF(data));
// Reset, and we should get the same result.
logln("after iter.reset()");
- checkIterator(iter.reset(), data, uprv_lengthof(data));
+ checkIterator(iter.reset(), data, UPRV_LENGTHOF(data));
}
void UCharsTrieTest::TestTruncatingIteratorFromLinearMatchShort() {
{ "abcdepq", 200 },
{ "abcdeyz", 3000 }
};
- LocalPointer<UCharsTrie> trie(buildTrie(data, uprv_lengthof(data), USTRINGTRIE_BUILD_FAST));
+ LocalPointer<UCharsTrie> trie(buildTrie(data, UPRV_LENGTHOF(data), USTRINGTRIE_BUILD_FAST));
if(trie.isNull()) {
return; // buildTrie() reported an error
}
static const StringAndValue expected[]={
{ "cd", -1 }
};
- checkIterator(iter, expected, uprv_lengthof(expected));
+ checkIterator(iter, expected, UPRV_LENGTHOF(expected));
// Reset, and we should get the same result.
logln("after iter.reset()");
- checkIterator(iter.reset(), expected, uprv_lengthof(expected));
+ checkIterator(iter.reset(), expected, UPRV_LENGTHOF(expected));
}
void UCharsTrieTest::TestTruncatingIteratorFromLinearMatchLong() {
{ "abcdepq", 200 },
{ "abcdeyz", 3000 }
};
- LocalPointer<UCharsTrie> trie(buildTrie(data, uprv_lengthof(data), USTRINGTRIE_BUILD_FAST));
+ LocalPointer<UCharsTrie> trie(buildTrie(data, UPRV_LENGTHOF(data), USTRINGTRIE_BUILD_FAST));
if(trie.isNull()) {
return; // buildTrie() reported an error
}
{ "dep", -1 },
{ "dey", -1 }
};
- checkIterator(iter, expected, uprv_lengthof(expected));
+ checkIterator(iter, expected, UPRV_LENGTHOF(expected));
// Reset, and we should get the same result.
logln("after iter.reset()");
- checkIterator(iter.reset(), expected, uprv_lengthof(expected));
+ checkIterator(iter.reset(), expected, UPRV_LENGTHOF(expected));
}
void UCharsTrieTest::TestIteratorFromUChars() {
};
builder_->clear();
IcuTestErrorCode errorCode(*this, "TestIteratorFromUChars()");
- for(int32_t i=0; i<uprv_lengthof(data); ++i) {
+ for(int32_t i=0; i<UPRV_LENGTHOF(data); ++i) {
builder_->add(data[i].s, data[i].value, errorCode);
}
UnicodeString trieUChars;
builder_->buildUnicodeString(USTRINGTRIE_BUILD_FAST, trieUChars, errorCode);
UCharsTrie::Iterator iter(trieUChars.getBuffer(), 0, errorCode);
- checkIterator(iter, data, uprv_lengthof(data));
+ checkIterator(iter, data, UPRV_LENGTHOF(data));
}
void UCharsTrieTest::checkData(const StringAndValue data[], int32_t dataLength) {
if(iter.getString()!=expectedString) {
char buffer[1000];
UnicodeString invString(prettify(iter.getString()));
- invString.extract(0, invString.length(), buffer, uprv_lengthof(buffer), US_INV);
+ invString.extract(0, invString.length(), buffer, UPRV_LENGTHOF(buffer), US_INV);
errln("trie iterator next().getString()=%s but expected %s for item %d",
buffer, data[i].s, (int)i);
}
const UnicodeString *s;
char *s8=utf8;
int32_t length8, utf8Count=0;
- while(iter.nextRange() && stringsLength<uprv_lengthof(strings)) {
+ while(iter.nextRange() && stringsLength<UPRV_LENGTHOF(strings)) {
if(iter.isString()) {
// Store the pointer to the set's string element
// which we happen to know is a stable pointer.
s, length, isUTF16,
whichSpans,
type, typeName,
- limits, uprv_lengthof(limits), expectCount);
+ limits, UPRV_LENGTHOF(limits), expectCount);
if(typeName[0]==0) {
break; // All types tried.
}
}
if(expectCount<0) {
expectCount=limitsCount;
- if(limitsCount>uprv_lengthof(limits)) {
+ if(limitsCount>UPRV_LENGTHOF(limits)) {
errln("FAIL: %s[0x%lx].%s.%s span count=%ld > %ld capacity - too many spans",
- testName, (long)index, setNames[i], typeName, (long)limitsCount, (long)uprv_lengthof(limits));
+ testName, (long)index, setNames[i], typeName, (long)limitsCount, (long)UPRV_LENGTHOF(limits));
return;
}
memcpy(expectLimits, limits, limitsCount*4);
UChar32 c, first;
for(first=c=0;; c=nextCodePoint(c)) {
- if(c>0x10ffff || length>(uprv_lengthof(s)-U16_MAX_LENGTH)) {
+ if(c>0x10ffff || length>(UPRV_LENGTHOF(s)-U16_MAX_LENGTH)) {
localWhichSpans=whichSpans;
if(stringContainsUnpairedSurrogate(s, length) && inconsistentSurrogates) {
localWhichSpans&=~SPAN_UTF8;
return;
}
testSpan(sets, s, -1, TRUE, (whichSpans&~SPAN_UTF8), testName, 0);
- testSpan(sets, s, uprv_lengthof(s)-1, TRUE, (whichSpans&~SPAN_UTF8), testName, 1);
+ testSpan(sets, s, UPRV_LENGTHOF(s)-1, TRUE, (whichSpans&~SPAN_UTF8), testName, 1);
}
void UnicodeSetTest::testSpanUTF8String(const UnicodeSetWithStrings *sets[4], uint32_t whichSpans, const char *testName) {
return;
}
testSpan(sets, s, -1, FALSE, (whichSpans&~SPAN_UTF16), testName, 0);
- testSpan(sets, s, uprv_lengthof(s)-1, FALSE, (whichSpans&~SPAN_UTF16), testName, 1);
+ testSpan(sets, s, UPRV_LENGTHOF(s)-1, FALSE, (whichSpans&~SPAN_UTF16), testName, 1);
}
// Take a set of span options and multiply them so that
char *testNameLimit=testName;
int32_t i, j;
- for(i=0; i<uprv_lengthof(testdata); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(testdata); ++i) {
const char *s=testdata[i];
if(s[0]=='[') {
// Create new test sets from this pattern.
}
UChar buffer[10]={ 0x61, 0x62, 0x20ac, 0xd900, 0xdc05, 0, 0x62, 0xffff, 0xdbff, 0xdfff };
- UnicodeString s, t(buffer, -1, uprv_lengthof(buffer));
+ UnicodeString s, t(buffer, -1, UPRV_LENGTHOF(buffer));
- if(s.setTo(buffer, -1, uprv_lengthof(buffer)).length()!=u_strlen(buffer)) {
+ if(s.setTo(buffer, -1, UPRV_LENGTHOF(buffer)).length()!=u_strlen(buffer)) {
errln("UnicodeString.setTo(buffer, length, capacity) does not work with length==-1");
}
if(t.length()!=u_strlen(buffer)) {
}
buffer[u_strlen(buffer)]=0xe4;
- UnicodeString u(buffer, -1, uprv_lengthof(buffer));
- if(s.setTo(buffer, -1, uprv_lengthof(buffer)).length()!=uprv_lengthof(buffer)) {
+ UnicodeString u(buffer, -1, UPRV_LENGTHOF(buffer));
+ if(s.setTo(buffer, -1, UPRV_LENGTHOF(buffer)).length()!=UPRV_LENGTHOF(buffer)) {
errln("UnicodeString.setTo(buffer without NUL, length, capacity) does not work with length==-1");
}
- if(u.length()!=uprv_lengthof(buffer)) {
+ if(u.length()!=UPRV_LENGTHOF(buffer)) {
errln("UnicodeString(buffer without NUL, length, capacity) does not work with length==-1");
}
static const UChar utf16[]={ 0x61, 0xE4, 0xDF, 0x4E00 };
UnicodeString from8a = UnicodeString((const char *)utf8);
UnicodeString from8b = UnicodeString((const char *)utf8, (int32_t)sizeof(utf8)-1);
- UnicodeString from16(FALSE, utf16, uprv_lengthof(utf16));
+ UnicodeString from16(FALSE, utf16, UPRV_LENGTHOF(utf16));
if(from8a != from16 || from8b != from16) {
errln("UnicodeString(const char * U_CHARSET_IS_UTF8) failed");
}
0xd804, 0xdc04, 0xd805, 0xdc05,
0x67
};
- UnicodeString string(str, uprv_lengthof(str));
+ UnicodeString string(str, UPRV_LENGTHOF(str));
int32_t start, length, number;
/* test hasMoreChar32Than() */
TestEnumeration() : i(0) {}
virtual int32_t count(UErrorCode& /*status*/) const {
- return uprv_lengthof(testEnumStrings);
+ return UPRV_LENGTHOF(testEnumStrings);
}
virtual const UnicodeString *snext(UErrorCode &status) {
- if(U_SUCCESS(status) && i<uprv_lengthof(testEnumStrings)) {
+ if(U_SUCCESS(status) && i<UPRV_LENGTHOF(testEnumStrings)) {
unistr=UnicodeString(testEnumStrings[i++], "");
return &unistr;
}
const char *pc;
// test the next() default implementation and ensureCharsCapacity()
- for(i=0; i<uprv_lengthof(testEnumStrings); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(testEnumStrings); ++i) {
status=U_ZERO_ERROR;
pc=ten.next(&length, status);
s=UnicodeString(testEnumStrings[i], "");
// test the unext() default implementation
ten.reset(status);
- for(i=0; i<uprv_lengthof(testEnumStrings); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(testEnumStrings); ++i) {
status=U_ZERO_ERROR;
pu=ten.unext(&length, status);
s=UnicodeString(testEnumStrings[i], "");
}
// test uenum_next()
- for(i=0; i<uprv_lengthof(testEnumStrings); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(testEnumStrings); ++i) {
status=U_ZERO_ERROR;
pc=uenum_next(uten, &length, &status);
if(U_FAILURE(status) || pc==NULL || strcmp(pc, testEnumStrings[i]) != 0) {
// test the uenum_unext()
uenum_reset(uten, &status);
- for(i=0; i<uprv_lengthof(testEnumStrings); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(testEnumStrings); ++i) {
status=U_ZERO_ERROR;
pu=uenum_unext(uten, &length, &status);
s=UnicodeString(testEnumStrings[i], "");
0x41, 0xfffd, 0x61, 0xfffd, 0xfffd, 0xfffd, 0x5a, 0xd900, 0xdc00, 0x7a,
0xd800, 0xdc00, 0xd840, 0xdc00, 0xdb40, 0xdc00, 0xdbff, 0xdfff
};
- UnicodeString from32 = UnicodeString::fromUTF32(utf32, uprv_lengthof(utf32));
- UnicodeString expected(FALSE, expected_utf16, uprv_lengthof(expected_utf16));
+ UnicodeString from32 = UnicodeString::fromUTF32(utf32, UPRV_LENGTHOF(utf32));
+ UnicodeString expected(FALSE, expected_utf16, UPRV_LENGTHOF(expected_utf16));
if(from32 != expected) {
errln("UnicodeString::fromUTF32() did not create the expected string.");
}
UChar32 result32[16];
UErrorCode errorCode = U_ZERO_ERROR;
int32_t length32 =
- UnicodeString(FALSE, utf16, uprv_lengthof(utf16)).
- toUTF32(result32, uprv_lengthof(result32), errorCode);
- if( length32 != uprv_lengthof(expected_utf32) ||
+ UnicodeString(FALSE, utf16, UPRV_LENGTHOF(utf16)).
+ toUTF32(result32, UPRV_LENGTHOF(result32), errorCode);
+ if( length32 != UPRV_LENGTHOF(expected_utf32) ||
0 != uprv_memcmp(result32, expected_utf32, length32*4) ||
result32[length32] != 0
) {
0xdb40, 0xdc00, 0xdbff, 0xdfff
};
UnicodeString from8 = UnicodeString::fromUTF8(StringPiece((const char *)utf8, (int32_t)sizeof(utf8)));
- UnicodeString expected(FALSE, expected_utf16, uprv_lengthof(expected_utf16));
+ UnicodeString expected(FALSE, expected_utf16, UPRV_LENGTHOF(expected_utf16));
if(from8 != expected) {
errln("UnicodeString::fromUTF8(StringPiece) did not create the expected string.");
0x41, 0xef, 0xbf, 0xbd, 0x61, 0xef, 0xbf, 0xbd, 0x5a, 0xf1, 0x90, 0x80, 0x80, 0x7a,
0xf0, 0x90, 0x80, 0x80, 0xf4, 0x8f, 0xbf, 0xbf
};
- UnicodeString us(FALSE, utf16, uprv_lengthof(utf16));
+ UnicodeString us(FALSE, utf16, UPRV_LENGTHOF(utf16));
char buffer[64];
TestCheckedArrayByteSink sink(buffer, (int32_t)sizeof(buffer));
}
// UTF-8
char buffer[100];
- TestCheckedArrayByteSink sink(buffer, uprv_lengthof(buffer));
+ TestCheckedArrayByteSink sink(buffer, UPRV_LENGTHOF(buffer));
errorCode=U_ZERO_ERROR;
nontrans->labelToUnicodeUTF8(StringPiece(NULL, 5), sink, info, errorCode);
if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR || sink.NumberOfBytesWritten()!=0) {
UNICODE_STRING_SIMPLE("\\u0000a_2+2=4\\u000A.essen.net").unescape() ||
info.hasErrors()
) {
- prettify(result).extract(0, 0x7fffffff, buffer, uprv_lengthof(buffer));
+ prettify(result).extract(0, 0x7fffffff, buffer, UPRV_LENGTHOF(buffer));
errln("notSTD3.nameToUnicode(non-LDH ASCII) unexpected errors %04lx string %s",
(long)info.getErrors(), buffer);
}
input=UNICODE_STRING_SIMPLE("a\\u2260b\\u226Ec\\u226Fd").unescape();
not3->nameToUnicode(input, result, info, errorCode);
if(result!=input || info.hasErrors()) {
- prettify(result).extract(0, 0x7fffffff, buffer, uprv_lengthof(buffer));
+ prettify(result).extract(0, 0x7fffffff, buffer, UPRV_LENGTHOF(buffer));
errln("notSTD3.nameToUnicode(equiv to non-LDH ASCII) unexpected errors %04lx string %s",
(long)info.getErrors(), buffer);
}
IcuTestErrorCode errorCode(*this, "TestSomeCases");
char buffer[400], buffer2[400];
int32_t i;
- for(i=0; i<uprv_lengthof(testCases); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(testCases); ++i) {
const TestCase &testCase=testCases[i];
UnicodeString input(ctou(testCase.s));
UnicodeString expected(ctou(testCase.u));
continue;
}
if(uN!=expected) {
- prettify(uN).extract(0, 0x7fffffff, buffer, uprv_lengthof(buffer));
+ prettify(uN).extract(0, 0x7fffffff, buffer, UPRV_LENGTHOF(buffer));
errln("N.nameToUnicode([%d] %s) unexpected string %s",
(int)i, testCase.s, buffer);
continue;
continue;
}
if(uT!=expected) {
- prettify(uT).extract(0, 0x7fffffff, buffer, uprv_lengthof(buffer));
+ prettify(uT).extract(0, 0x7fffffff, buffer, UPRV_LENGTHOF(buffer));
errln("T.nameToUnicode([%d] %s) unexpected string %s",
(int)i, testCase.s, buffer);
continue;
}
// ToASCII is all-ASCII if no severe errors
if((aNInfo.getErrors()&severeErrors)==0 && !isASCII(aN)) {
- prettify(aN).extract(0, 0x7fffffff, buffer, uprv_lengthof(buffer));
+ prettify(aN).extract(0, 0x7fffffff, buffer, UPRV_LENGTHOF(buffer));
errln("N.nameToASCII([%d] %s) (errors %04lx) result is not ASCII %s",
(int)i, testCase.s, aNInfo.getErrors(), buffer);
continue;
}
if((aTInfo.getErrors()&severeErrors)==0 && !isASCII(aT)) {
- prettify(aT).extract(0, 0x7fffffff, buffer, uprv_lengthof(buffer));
+ prettify(aT).extract(0, 0x7fffffff, buffer, UPRV_LENGTHOF(buffer));
errln("T.nameToASCII([%d] %s) (errors %04lx) result is not ASCII %s",
(int)i, testCase.s, aTInfo.getErrors(), buffer);
continue;
}
if(verbose) {
char m= mode=='B' ? mode : 'N';
- prettify(aN).extract(0, 0x7fffffff, buffer, uprv_lengthof(buffer));
+ prettify(aN).extract(0, 0x7fffffff, buffer, UPRV_LENGTHOF(buffer));
logln("%c.nameToASCII([%d] %s) (errors %04lx) result string: %s",
m, (int)i, testCase.s, aNInfo.getErrors(), buffer);
if(mode!='B') {
- prettify(aT).extract(0, 0x7fffffff, buffer, uprv_lengthof(buffer));
+ prettify(aT).extract(0, 0x7fffffff, buffer, UPRV_LENGTHOF(buffer));
logln("T.nameToASCII([%d] %s) (errors %04lx) result string: %s",
(int)i, testCase.s, aTInfo.getErrors(), buffer);
}
continue;
}
if(aN!=uNaN) {
- prettify(aN).extract(0, 0x7fffffff, buffer, uprv_lengthof(buffer));
- prettify(uNaN).extract(0, 0x7fffffff, buffer2, uprv_lengthof(buffer2));
+ prettify(aN).extract(0, 0x7fffffff, buffer, UPRV_LENGTHOF(buffer));
+ prettify(uNaN).extract(0, 0x7fffffff, buffer2, UPRV_LENGTHOF(buffer2));
errln("N.nameToASCII([%d] %s)!=N.nameToUnicode().N.nameToASCII() "
"(errors %04lx) %s vs. %s",
(int)i, testCase.s, aNInfo.getErrors(), buffer, buffer2);
continue;
}
if(aT!=uTaN) {
- prettify(aT).extract(0, 0x7fffffff, buffer, uprv_lengthof(buffer));
- prettify(uTaN).extract(0, 0x7fffffff, buffer2, uprv_lengthof(buffer2));
+ prettify(aT).extract(0, 0x7fffffff, buffer, UPRV_LENGTHOF(buffer));
+ prettify(uTaN).extract(0, 0x7fffffff, buffer2, UPRV_LENGTHOF(buffer2));
errln("T.nameToASCII([%d] %s)!=T.nameToUnicode().N.nameToASCII() "
"(errors %04lx) %s vs. %s",
(int)i, testCase.s, aNInfo.getErrors(), buffer, buffer2);
continue;
}
if(uN!=aNuN) {
- prettify(uN).extract(0, 0x7fffffff, buffer, uprv_lengthof(buffer));
- prettify(aNuN).extract(0, 0x7fffffff, buffer2, uprv_lengthof(buffer2));
+ prettify(uN).extract(0, 0x7fffffff, buffer, UPRV_LENGTHOF(buffer));
+ prettify(aNuN).extract(0, 0x7fffffff, buffer2, UPRV_LENGTHOF(buffer2));
errln("N.nameToUnicode([%d] %s)!=N.nameToASCII().N.nameToUnicode() "
"(errors %04lx) %s vs. %s",
(int)i, testCase.s, uNInfo.getErrors(), buffer, buffer2);
continue;
}
if(uT!=aTuN) {
- prettify(uT).extract(0, 0x7fffffff, buffer, uprv_lengthof(buffer));
- prettify(aTuN).extract(0, 0x7fffffff, buffer2, uprv_lengthof(buffer2));
+ prettify(uT).extract(0, 0x7fffffff, buffer, UPRV_LENGTHOF(buffer));
+ prettify(aTuN).extract(0, 0x7fffffff, buffer2, UPRV_LENGTHOF(buffer2));
errln("T.nameToUnicode([%d] %s)!=T.nameToASCII().N.nameToUnicode() "
"(errors %04lx) %s vs. %s",
(int)i, testCase.s, uNInfo.getErrors(), buffer, buffer2);
}
if(aN.indexOf((UChar)0x2e)<0) {
if(aN!=aNL || aNInfo.getErrors()!=aNLInfo.getErrors()) {
- prettify(aN).extract(0, 0x7fffffff, buffer, uprv_lengthof(buffer));
- prettify(aNL).extract(0, 0x7fffffff, buffer2, uprv_lengthof(buffer2));
+ prettify(aN).extract(0, 0x7fffffff, buffer, UPRV_LENGTHOF(buffer));
+ prettify(aNL).extract(0, 0x7fffffff, buffer2, UPRV_LENGTHOF(buffer2));
errln("N.nameToASCII([%d] %s)!=N.labelToASCII() "
"(errors %04lx vs %04lx) %s vs. %s",
(int)i, testCase.s, aNInfo.getErrors(), aNLInfo.getErrors(), buffer, buffer2);
}
if(aT.indexOf((UChar)0x2e)<0) {
if(aT!=aTL || aTInfo.getErrors()!=aTLInfo.getErrors()) {
- prettify(aT).extract(0, 0x7fffffff, buffer, uprv_lengthof(buffer));
- prettify(aTL).extract(0, 0x7fffffff, buffer2, uprv_lengthof(buffer2));
+ prettify(aT).extract(0, 0x7fffffff, buffer, UPRV_LENGTHOF(buffer));
+ prettify(aTL).extract(0, 0x7fffffff, buffer2, UPRV_LENGTHOF(buffer2));
errln("T.nameToASCII([%d] %s)!=T.labelToASCII() "
"(errors %04lx vs %04lx) %s vs. %s",
(int)i, testCase.s, aTInfo.getErrors(), aTLInfo.getErrors(), buffer, buffer2);
}
if(uN.indexOf((UChar)0x2e)<0) {
if(uN!=uNL || uNInfo.getErrors()!=uNLInfo.getErrors()) {
- prettify(uN).extract(0, 0x7fffffff, buffer, uprv_lengthof(buffer));
- prettify(uNL).extract(0, 0x7fffffff, buffer2, uprv_lengthof(buffer2));
+ prettify(uN).extract(0, 0x7fffffff, buffer, UPRV_LENGTHOF(buffer));
+ prettify(uNL).extract(0, 0x7fffffff, buffer2, UPRV_LENGTHOF(buffer2));
errln("N.nameToUnicode([%d] %s)!=N.labelToUnicode() "
"(errors %04lx vs %04lx) %s vs. %s",
(int)i, testCase.s, uNInfo.getErrors(), uNLInfo.getErrors(), buffer, buffer2);
}
if(uT.indexOf((UChar)0x2e)<0) {
if(uT!=uTL || uTInfo.getErrors()!=uTLInfo.getErrors()) {
- prettify(uT).extract(0, 0x7fffffff, buffer, uprv_lengthof(buffer));
- prettify(uTL).extract(0, 0x7fffffff, buffer2, uprv_lengthof(buffer2));
+ prettify(uT).extract(0, 0x7fffffff, buffer, UPRV_LENGTHOF(buffer));
+ prettify(uTL).extract(0, 0x7fffffff, buffer2, UPRV_LENGTHOF(buffer2));
errln("T.nameToUnicode([%d] %s)!=T.labelToUnicode() "
"(errors %04lx vs %04lx) %s vs. %s",
(int)i, testCase.s, uTInfo.getErrors(), uTLInfo.getErrors(), buffer, buffer2);
UPerfFunction* ConverterPerformanceTest::TestICU_UTF8_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("utf-8",utf8_uniSource, uprv_lengthof(utf8_uniSource), status);
+ ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("utf-8",utf8_uniSource, UPRV_LENGTHOF(utf8_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestICU_UTF8_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new ICUToUnicodePerfFunction("utf-8",(char*)utf8_encSource, uprv_lengthof(utf8_encSource), status);
+ UPerfFunction* pf = new ICUToUnicodePerfFunction("utf-8",(char*)utf8_encSource, UPRV_LENGTHOF(utf8_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinIML2_UTF8_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("utf-8",utf8_uniSource, uprv_lengthof(utf8_uniSource), status);
+ UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("utf-8",utf8_uniSource, UPRV_LENGTHOF(utf8_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinIML2_UTF8_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("utf-8",(char*)utf8_encSource, uprv_lengthof(utf8_encSource), status);
+ UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("utf-8",(char*)utf8_encSource, UPRV_LENGTHOF(utf8_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinANSI_UTF8_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("utf-8",utf8_uniSource, uprv_lengthof(utf8_uniSource), status);
+ UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("utf-8",utf8_uniSource, UPRV_LENGTHOF(utf8_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinANSI_UTF8_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinANSIToUnicodePerfFunction("utf-8",(char*)utf8_encSource, uprv_lengthof(utf8_encSource), status);
+ UPerfFunction* pf = new WinANSIToUnicodePerfFunction("utf-8",(char*)utf8_encSource, UPRV_LENGTHOF(utf8_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestICU_Latin1_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("iso-8859-1",latin1_uniSource, uprv_lengthof(latin1_uniSource), status);
+ ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("iso-8859-1",latin1_uniSource, UPRV_LENGTHOF(latin1_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestICU_Latin1_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new ICUToUnicodePerfFunction("iso-8859-1",(char*)latin1_encSource, uprv_lengthof(latin1_encSource), status);
+ UPerfFunction* pf = new ICUToUnicodePerfFunction("iso-8859-1",(char*)latin1_encSource, UPRV_LENGTHOF(latin1_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinIML2_Latin1_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("iso-8859-1",latin1_uniSource, uprv_lengthof(latin1_uniSource), status);
+ UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("iso-8859-1",latin1_uniSource, UPRV_LENGTHOF(latin1_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinIML2_Latin1_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("iso-8859-1",(char*)latin1_encSource, uprv_lengthof(latin1_encSource), status);
+ UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("iso-8859-1",(char*)latin1_encSource, UPRV_LENGTHOF(latin1_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinANSI_Latin1_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("iso-8859-1",latin1_uniSource, uprv_lengthof(latin1_uniSource), status);
+ UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("iso-8859-1",latin1_uniSource, UPRV_LENGTHOF(latin1_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinANSI_Latin1_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinANSIToUnicodePerfFunction("iso-8859-1",(char*)latin1_encSource, uprv_lengthof(latin1_encSource), status);
+ UPerfFunction* pf = new WinANSIToUnicodePerfFunction("iso-8859-1",(char*)latin1_encSource, UPRV_LENGTHOF(latin1_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestICU_Latin8_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("iso-8859-8",latin8_uniSource, uprv_lengthof(latin8_uniSource), status);
+ ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("iso-8859-8",latin8_uniSource, UPRV_LENGTHOF(latin8_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestICU_Latin8_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new ICUToUnicodePerfFunction("iso-8859-8",(char*)latin8_encSource, uprv_lengthof(latin8_encSource), status);
+ UPerfFunction* pf = new ICUToUnicodePerfFunction("iso-8859-8",(char*)latin8_encSource, UPRV_LENGTHOF(latin8_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinIML2_Latin8_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("iso-8859-8",latin8_uniSource, uprv_lengthof(latin8_uniSource), status);
+ UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("iso-8859-8",latin8_uniSource, UPRV_LENGTHOF(latin8_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinIML2_Latin8_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("iso-8859-8",(char*)latin8_encSource, uprv_lengthof(latin8_encSource), status);
+ UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("iso-8859-8",(char*)latin8_encSource, UPRV_LENGTHOF(latin8_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
}
UPerfFunction* ConverterPerformanceTest::TestWinANSI_Latin8_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("iso-8859-8",latin8_uniSource, uprv_lengthof(latin8_uniSource), status);
+ UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("iso-8859-8",latin8_uniSource, UPRV_LENGTHOF(latin8_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinANSI_Latin8_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinANSIToUnicodePerfFunction("iso-8859-8",(char*)latin8_encSource, uprv_lengthof(latin8_encSource), status);
+ UPerfFunction* pf = new WinANSIToUnicodePerfFunction("iso-8859-8",(char*)latin8_encSource, UPRV_LENGTHOF(latin8_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestICU_EBCDIC_Arabic_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("x-EBCDIC-Arabic",ebcdic_arabic_uniSource, uprv_lengthof(ebcdic_arabic_uniSource), status);
+ ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("x-EBCDIC-Arabic",ebcdic_arabic_uniSource, UPRV_LENGTHOF(ebcdic_arabic_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestICU_EBCDIC_Arabic_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new ICUToUnicodePerfFunction("x-EBCDIC-Arabic",(char*)ebcdic_arabic_encSource, uprv_lengthof(ebcdic_arabic_encSource), status);
+ UPerfFunction* pf = new ICUToUnicodePerfFunction("x-EBCDIC-Arabic",(char*)ebcdic_arabic_encSource, UPRV_LENGTHOF(ebcdic_arabic_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinIML2_EBCDIC_Arabic_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("x-EBCDIC-Arabic",ebcdic_arabic_uniSource, uprv_lengthof(ebcdic_arabic_uniSource), status);
+ UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("x-EBCDIC-Arabic",ebcdic_arabic_uniSource, UPRV_LENGTHOF(ebcdic_arabic_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinIML2_EBCDIC_Arabic_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("x-EBCDIC-Arabic",(char*)ebcdic_arabic_encSource, uprv_lengthof(ebcdic_arabic_encSource), status);
+ UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("x-EBCDIC-Arabic",(char*)ebcdic_arabic_encSource, UPRV_LENGTHOF(ebcdic_arabic_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinANSI_EBCDIC_Arabic_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("x-EBCDIC-Arabic",ebcdic_arabic_uniSource, uprv_lengthof(ebcdic_arabic_uniSource), status);
+ UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("x-EBCDIC-Arabic",ebcdic_arabic_uniSource, UPRV_LENGTHOF(ebcdic_arabic_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinANSI_EBCDIC_Arabic_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinANSIToUnicodePerfFunction("x-EBCDIC-Arabic",(char*)ebcdic_arabic_encSource, uprv_lengthof(ebcdic_arabic_encSource), status);
+ UPerfFunction* pf = new WinANSIToUnicodePerfFunction("x-EBCDIC-Arabic",(char*)ebcdic_arabic_encSource, UPRV_LENGTHOF(ebcdic_arabic_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestICU_SJIS_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("sjis",sjis_uniSource, uprv_lengthof(sjis_uniSource), status);
+ ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("sjis",sjis_uniSource, UPRV_LENGTHOF(sjis_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestICU_SJIS_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new ICUToUnicodePerfFunction("sjis",(char*)sjis_encSource, uprv_lengthof(sjis_encSource), status);
+ UPerfFunction* pf = new ICUToUnicodePerfFunction("sjis",(char*)sjis_encSource, UPRV_LENGTHOF(sjis_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinIML2_SJIS_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("sjis",sjis_uniSource, uprv_lengthof(sjis_uniSource), status);
+ UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("sjis",sjis_uniSource, UPRV_LENGTHOF(sjis_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinIML2_SJIS_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("sjis",(char*)sjis_encSource, uprv_lengthof(sjis_encSource), status);
+ UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("sjis",(char*)sjis_encSource, UPRV_LENGTHOF(sjis_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinANSI_SJIS_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("sjis",sjis_uniSource, uprv_lengthof(sjis_uniSource), status);
+ UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("sjis",sjis_uniSource, UPRV_LENGTHOF(sjis_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinANSI_SJIS_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinANSIToUnicodePerfFunction("sjis",(char*)sjis_encSource, uprv_lengthof(sjis_encSource), status);
+ UPerfFunction* pf = new WinANSIToUnicodePerfFunction("sjis",(char*)sjis_encSource, UPRV_LENGTHOF(sjis_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestICU_EUCJP_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("euc-jp",eucjp_uniSource, uprv_lengthof(eucjp_uniSource), status);
+ ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("euc-jp",eucjp_uniSource, UPRV_LENGTHOF(eucjp_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestICU_EUCJP_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new ICUToUnicodePerfFunction("euc-jp",(char*)eucjp_encSource, uprv_lengthof(eucjp_encSource), status);
+ UPerfFunction* pf = new ICUToUnicodePerfFunction("euc-jp",(char*)eucjp_encSource, UPRV_LENGTHOF(eucjp_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinIML2_EUCJP_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("euc-jp",eucjp_uniSource, uprv_lengthof(eucjp_uniSource), status);
+ UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("euc-jp",eucjp_uniSource, UPRV_LENGTHOF(eucjp_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinIML2_EUCJP_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("euc-jp",(char*)eucjp_encSource, uprv_lengthof(eucjp_encSource), status);
+ UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("euc-jp",(char*)eucjp_encSource, UPRV_LENGTHOF(eucjp_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinANSI_EUCJP_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("euc-jp",eucjp_uniSource, uprv_lengthof(eucjp_uniSource), status);
+ UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("euc-jp",eucjp_uniSource, UPRV_LENGTHOF(eucjp_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinANSI_EUCJP_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinANSIToUnicodePerfFunction("euc-jp",(char*)eucjp_encSource, uprv_lengthof(eucjp_encSource), status);
+ UPerfFunction* pf = new WinANSIToUnicodePerfFunction("euc-jp",(char*)eucjp_encSource, UPRV_LENGTHOF(eucjp_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestICU_GB2312_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("gb2312",gb2312_uniSource, uprv_lengthof(gb2312_uniSource), status);
+ ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("gb2312",gb2312_uniSource, UPRV_LENGTHOF(gb2312_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestICU_GB2312_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new ICUToUnicodePerfFunction("gb2312",(char*)gb2312_encSource, uprv_lengthof(gb2312_encSource), status);
+ UPerfFunction* pf = new ICUToUnicodePerfFunction("gb2312",(char*)gb2312_encSource, UPRV_LENGTHOF(gb2312_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinIML2_GB2312_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("gb2312",gb2312_uniSource, uprv_lengthof(gb2312_uniSource), status);
+ UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("gb2312",gb2312_uniSource, UPRV_LENGTHOF(gb2312_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinIML2_GB2312_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("gb2312",(char*)gb2312_encSource, uprv_lengthof(gb2312_encSource), status);
+ UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("gb2312",(char*)gb2312_encSource, UPRV_LENGTHOF(gb2312_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinANSI_GB2312_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("gb2312",gb2312_uniSource, uprv_lengthof(gb2312_uniSource), status);
+ UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("gb2312",gb2312_uniSource, UPRV_LENGTHOF(gb2312_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinANSI_GB2312_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinANSIToUnicodePerfFunction("gb2312",(char*)gb2312_encSource, uprv_lengthof(gb2312_encSource), status);
+ UPerfFunction* pf = new WinANSIToUnicodePerfFunction("gb2312",(char*)gb2312_encSource, UPRV_LENGTHOF(gb2312_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestICU_ISO2022KR_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("iso-2022-kr",iso2022kr_uniSource, uprv_lengthof(iso2022kr_uniSource), status);
+ ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("iso-2022-kr",iso2022kr_uniSource, UPRV_LENGTHOF(iso2022kr_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestICU_ISO2022KR_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new ICUToUnicodePerfFunction("iso-2022-kr",(char*)iso2022kr_encSource, uprv_lengthof(iso2022kr_encSource), status);
+ UPerfFunction* pf = new ICUToUnicodePerfFunction("iso-2022-kr",(char*)iso2022kr_encSource, UPRV_LENGTHOF(iso2022kr_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinIML2_ISO2022KR_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("iso-2022-kr",iso2022kr_uniSource, uprv_lengthof(iso2022kr_uniSource), status);
+ UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("iso-2022-kr",iso2022kr_uniSource, UPRV_LENGTHOF(iso2022kr_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinIML2_ISO2022KR_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("iso-2022-kr",(char*)iso2022kr_encSource, uprv_lengthof(iso2022kr_encSource), status);
+ UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("iso-2022-kr",(char*)iso2022kr_encSource, UPRV_LENGTHOF(iso2022kr_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinANSI_ISO2022KR_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("iso-2022-kr",iso2022kr_uniSource, uprv_lengthof(iso2022kr_uniSource), status);
+ UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("iso-2022-kr",iso2022kr_uniSource, UPRV_LENGTHOF(iso2022kr_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinANSI_ISO2022KR_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinANSIToUnicodePerfFunction("iso-2022-kr",(char*)iso2022kr_encSource, uprv_lengthof(iso2022kr_encSource), status);
+ UPerfFunction* pf = new WinANSIToUnicodePerfFunction("iso-2022-kr",(char*)iso2022kr_encSource, UPRV_LENGTHOF(iso2022kr_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestICU_ISO2022JP_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("iso-2022-jp",iso2022jp_uniSource, uprv_lengthof(iso2022jp_uniSource), status);
+ ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("iso-2022-jp",iso2022jp_uniSource, UPRV_LENGTHOF(iso2022jp_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestICU_ISO2022JP_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new ICUToUnicodePerfFunction("iso-2022-jp",(char*)iso2022jp_encSource, uprv_lengthof(iso2022jp_encSource), status);
+ UPerfFunction* pf = new ICUToUnicodePerfFunction("iso-2022-jp",(char*)iso2022jp_encSource, UPRV_LENGTHOF(iso2022jp_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinIML2_ISO2022JP_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("iso-2022-jp",iso2022jp_uniSource, uprv_lengthof(iso2022jp_uniSource), status);
+ UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("iso-2022-jp",iso2022jp_uniSource, UPRV_LENGTHOF(iso2022jp_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinIML2_ISO2022JP_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("iso-2022-jp",(char*)iso2022jp_encSource, uprv_lengthof(iso2022jp_encSource), status);
+ UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("iso-2022-jp",(char*)iso2022jp_encSource, UPRV_LENGTHOF(iso2022jp_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinANSI_ISO2022JP_FromUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("iso-2022-jp",iso2022jp_uniSource, uprv_lengthof(iso2022jp_uniSource), status);
+ UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("iso-2022-jp",iso2022jp_uniSource, UPRV_LENGTHOF(iso2022jp_uniSource), status);
if(U_FAILURE(status)){
return NULL;
}
UPerfFunction* ConverterPerformanceTest::TestWinANSI_ISO2022JP_ToUnicode(){
UErrorCode status = U_ZERO_ERROR;
- UPerfFunction* pf = new WinANSIToUnicodePerfFunction("iso-2022-jp",(char*)iso2022jp_encSource, uprv_lengthof(iso2022jp_encSource), status);
+ UPerfFunction* pf = new WinANSIToUnicodePerfFunction("iso-2022-jp",(char*)iso2022jp_encSource, UPRV_LENGTHOF(iso2022jp_encSource), status);
if(U_FAILURE(status)){
return NULL;
}
return pf;
-}
\ No newline at end of file
+}
name = cpName;
src = pszIn;
srcLen = szLen;
- dstLen = uprv_lengthof(dest);
+ dstLen = UPRV_LENGTHOF(dest);
unsigned short bEnc[30]={'\0'};
const char* tenc=name;
for(int i=0;*tenc!='\0';i++){
name = cpName;
src = pszIn;
srcLen = szLen;
- dstLen = uprv_lengthof(dest);
+ dstLen = UPRV_LENGTHOF(dest);
lpUsedDefaultChar=FALSE;
unsigned short bEnc[30]={'\0'};
const char* tenc=name;
getErr(err,status);
src = source;
srcLen = sourceLen;
- dstLen = uprv_lengthof(dst);
+ dstLen = UPRV_LENGTHOF(dst);
cpName = name;
}
getErr(err,status);
src = source;
srcLen = sourceLen;
- dstLen = uprv_lengthof(dst);
+ dstLen = UPRV_LENGTHOF(dst);
cpName = name;
}
src = source;
srcLen = sourceLen;
- dstLen = uprv_lengthof(dst);
+ dstLen = UPRV_LENGTHOF(dst);
cpName = name;
unsigned short bEnc[30]={'\0'};
const char* tenc=name;
}
src = source;
srcLen = sourceLen;
- dstLen = uprv_lengthof(dst);
+ dstLen = UPRV_LENGTHOF(dst);
cpName = name;
/* get the charset info */
MIMECSETINFO mimeInfo;
utext_openUChars(&text, lines[i].name, lines[i].len, pErrorCode);
int32_t count=0;
ucharsTrieMatches(*trie, &text, lines[i].len,
- lengths, count, uprv_lengthof(lengths));
+ lengths, count, UPRV_LENGTHOF(lengths));
if(count==0 || lengths[count-1]!=lines[i].len) {
fprintf(stderr, "word %ld (0-based) not found\n", (long)i);
}
utext_openUChars(&text, lines[i].name, lines[i].len, pErrorCode);
int32_t count=0;
bytesTrieMatches(*trie, &text, lines[i].len,
- lengths, count, uprv_lengthof(lengths));
+ lengths, count, UPRV_LENGTHOF(lengths));
if(count==0 || lengths[count-1]!=lines[i].len) {
fprintf(stderr, "word %ld (0-based) not found\n", (long)i);
}
return;
}
- _remainingArgc = u_parseArgs(_remainingArgc, (char **)argv, (int32_t)(uprv_lengthof(cmdLineOptions)), cmdLineOptions);
+ _remainingArgc = u_parseArgs(_remainingArgc, (char **)argv, (int32_t)(UPRV_LENGTHOF(cmdLineOptions)), cmdLineOptions);
if(cmdLineOptions[0].doesOccur && cmdLineOptions[0].value!=NULL) {
options=(int32_t)strtol(cmdLineOptions[0].value, NULL, 16);
}
prevIndex=j;
}
- if(bitHash->countKeys()>uprv_lengthof(shortBits)) {
+ if(bitHash->countKeys()>UPRV_LENGTHOF(shortBits)) {
bits=(int64_t *)uprv_malloc(bitHash->countKeys()*8);
}
if(bits!=NULL) {
class UnicodeSetPerformanceTest : public UPerfTest {
public:
UnicodeSetPerformanceTest(int32_t argc, const char *argv[], UErrorCode &status)
- : UPerfTest(argc, argv, options, uprv_lengthof(options), unisetperf_usage, status),
+ : UPerfTest(argc, argv, options, UPRV_LENGTHOF(options), unisetperf_usage, status),
utf8(NULL), utf8Length(0), countInputCodePoints(0), spanCount(0) {
if (U_SUCCESS(status)) {
UnicodeString pattern=UnicodeString(options[SET_PATTERN].value, -1, US_INV).unescape();
class UtfPerformanceTest : public UPerfTest{
public:
UtfPerformanceTest(int32_t argc, const char *argv[], UErrorCode &status)
- : UPerfTest(argc, argv, options, uprv_lengthof(options), utfperf_usage, status) {
+ : UPerfTest(argc, argv, options, UPRV_LENGTHOF(options), utfperf_usage, status) {
if (U_SUCCESS(status)) {
charset = options[CHARSET].value;
}
if(*delimiter=='=' || *delimiter=='>') {
UChar uchars[Normalizer2Impl::MAPPING_LENGTH_MASK];
- int32_t length=u_parseString(delimiter+1, uchars, uprv_lengthof(uchars), NULL, errorCode);
+ int32_t length=u_parseString(delimiter+1, uchars, UPRV_LENGTHOF(uchars), NULL, errorCode);
if(errorCode.isFailure()) {
fprintf(stderr, "gennorm2 error: parsing mapping string from %s\n", line);
exit(errorCode.reset());
HangulIterator() : rangeIndex(0) {}
const Range *nextRange() {
- if(rangeIndex<uprv_lengthof(ranges)) {
+ if(rangeIndex<UPRV_LENGTHOF(ranges)) {
return ranges+rangeIndex++;
} else {
return NULL;
/* get the program basename */
pname=findBasename(argv[0]);
- argc=u_parseArgs(argc, argv, uprv_lengthof(options), options);
+ argc=u_parseArgs(argc, argv, UPRV_LENGTHOF(options), options);
isHelp=options[OPT_HELP_H].doesOccur || options[OPT_HELP_QUESTION_MARK].doesOccur;
if(isHelp) {
printUsage(pname, TRUE);
pname=argv[0];
}
- argc=u_parseArgs(argc, argv, uprv_lengthof(options), options);
+ argc=u_parseArgs(argc, argv, UPRV_LENGTHOF(options), options);
ishelp=options[OPT_HELP_H].doesOccur || options[OPT_HELP_QUESTION_MARK].doesOccur;
if(ishelp || argc!=3) {
return printUsage(pname, ishelp);
extData->stage1[i1]=(uint16_t)newBlock;
extData->stage2Top=newBlock+MBCS_STAGE_2_BLOCK_SIZE;
- if(extData->stage2Top>uprv_lengthof(extData->stage2)) {
+ if(extData->stage2Top>UPRV_LENGTHOF(extData->stage2)) {
fprintf(stderr, "error: too many stage 2 entries at U+%04x\n", (int)c);
exit(U_MEMORY_ALLOCATION_ERROR);
}
extData->stage2[i2]=(uint16_t)(newBlock>>UCNV_EXT_STAGE_2_LEFT_SHIFT);
extData->stage3Top=newBlock+MBCS_STAGE_3_BLOCK_SIZE;
- if(extData->stage3Top>uprv_lengthof(extData->stage3)) {
+ if(extData->stage3Top>UPRV_LENGTHOF(extData->stage3)) {
fprintf(stderr, "error: too many stage 3 entries at U+%04x\n", (int)c);
exit(U_MEMORY_ALLOCATION_ERROR);
}
}
}
} else {
- if((i3b=extData->stage3bTop++)>=uprv_lengthof(extData->stage3b)) {
+ if((i3b=extData->stage3bTop++)>=UPRV_LENGTHOF(extData->stage3b)) {
fprintf(stderr, "error: too many stage 3b entries at U+%04x\n", (int)c);
exit(U_MEMORY_ALLOCATION_ERROR);
}
/* preset then read command line options */
options[OPT_DESTDIR].value=u_getDataDirectory();
- argc=u_parseArgs(argc, argv, uprv_lengthof(options), options);
+ argc=u_parseArgs(argc, argv, UPRV_LENGTHOF(options), options);
/* error handling, printing usage message */
if(argc<0) {
exit(U_INVALID_FORMAT_ERROR);
}
prefixLength=(int32_t)(prefixLimit-s);
- if(prefixLength==0 || prefixLength>=uprv_lengthof(pkgPrefix)) {
+ if(prefixLength==0 || prefixLength>=UPRV_LENGTHOF(pkgPrefix)) {
fprintf(stderr,
"icupkg: --auto_toc_prefix[_with_type] but "
"the prefix of the first entry \"%s\" is empty or too long\n",
const char *listNameEnd=strchr(listname, 0);
const char *suffix;
int32_t i, length;
- for(i=0; i<uprv_lengthof(listFileSuffixes); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(listFileSuffixes); ++i) {
suffix=listFileSuffixes[i].suffix;
length=listFileSuffixes[i].length;
if((listNameEnd-listname)>length && 0==memcmp(listNameEnd-length, suffix, length)) {
int32_t prop=pnames->getPropertyEnum(p);
if(prop<0) {
for(int32_t i=0;; ++i) {
- if(i==uprv_lengthof(ppucdProperties)) {
+ if(i==UPRV_LENGTHOF(ppucdProperties)) {
// Ignore unknown property names.
return TRUE;
}
}
/* dispatch to the swap function for the dataFormat */
- for(i=0; i<uprv_lengthof(swapFns); ++i) {
+ for(i=0; i<UPRV_LENGTHOF(swapFns); ++i) {
if(0==memcmp(swapFns[i].dataFormat, pInfo->dataFormat, 4)) {
swappedLength=swapFns[i].swapFn(ds, inData, length, outData, pErrorCode);