mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 08:53:20 +00:00
ICU-353 use better names to replace index, depending on what the func/
method actually does with it (for example: n to get the nth element, offset within a buffer, etc.). X-SVN-Rev: 1131
This commit is contained in:
parent
c4c3fe0ffd
commit
bff1b2e05c
15 changed files with 73 additions and 73 deletions
|
@ -687,10 +687,10 @@ uprv_timezone()
|
|||
}
|
||||
|
||||
char*
|
||||
uprv_tzname(int idx)
|
||||
uprv_tzname(int n)
|
||||
{
|
||||
#ifdef POSIX
|
||||
return tzname[idx];
|
||||
return tzname[n];
|
||||
#endif
|
||||
|
||||
#if defined(OS400) || defined(XP_MAC)
|
||||
|
|
|
@ -4922,7 +4922,7 @@ u_charDirection(UChar32 ch )
|
|||
UCharScript
|
||||
u_charScript(UChar32 ch)
|
||||
{
|
||||
int32_t idx, j;
|
||||
int32_t i, j;
|
||||
UCharScript returnValue = U_NO_SCRIPT;
|
||||
|
||||
/* surrogate support is still incomplete */
|
||||
|
@ -4930,18 +4930,18 @@ u_charScript(UChar32 ch)
|
|||
return U_NO_SCRIPT;
|
||||
}
|
||||
|
||||
idx = -1;
|
||||
for( j = 0; idx == -1 && fScriptIndex[j].fFirstCode != 0xFFFF; ++j )
|
||||
i = -1;
|
||||
for( j = 0; i == -1 && fScriptIndex[j].fFirstCode != 0xFFFF; ++j )
|
||||
if( fScriptIndex[j].fFirstCode <= ch && ch <= fScriptIndex[j].fLastCode ) {
|
||||
idx = j;
|
||||
i = j;
|
||||
if(j == U_CHAR_SCRIPT_COUNT) /* "U_SPECIALS 2" */
|
||||
idx = U_SPECIALS;
|
||||
i = U_SPECIALS;
|
||||
}
|
||||
if(idx >= U_CHAR_SCRIPT_COUNT) {
|
||||
if(i >= U_CHAR_SCRIPT_COUNT) {
|
||||
returnValue = U_NO_SCRIPT;
|
||||
}
|
||||
else if( idx != -1 ) {
|
||||
returnValue = (UCharScript)idx;
|
||||
else if( i != -1 ) {
|
||||
returnValue = (UCharScript)i;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
* @see CompactIntArray
|
||||
* @see CompactCharArray
|
||||
* @see CompactStringArray
|
||||
* @version $Revision: 1.7 $ 8/25/98
|
||||
* @version $Revision: 1.8 $ 8/25/98
|
||||
* @author Helena Shih
|
||||
*/
|
||||
|
||||
|
@ -146,11 +146,11 @@ U_CAPI bool_t U_EXPORT2 ucmp16_isBogus(const CompactShortArray* array);
|
|||
/**
|
||||
* Set a new value for a Unicode character.
|
||||
* Set automatically expands the array if it is compacted.
|
||||
* @param index the character to set the mapped value with
|
||||
* @param character the character to set the mapped value with
|
||||
* @param value the new mapped value
|
||||
*/
|
||||
U_CAPI void U_EXPORT2 ucmp16_set(CompactShortArray *array,
|
||||
UChar idx,
|
||||
UChar character,
|
||||
int16_t value);
|
||||
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
* @see CompactIntArray
|
||||
* @see CompactCharArray
|
||||
* @see CompactStringArray
|
||||
* @version $Revision: 1.7 $ 8/25/98
|
||||
* @version $Revision: 1.8 $ 8/25/98
|
||||
* @author Helena Shih
|
||||
*/
|
||||
/*====================================*/
|
||||
|
@ -141,11 +141,11 @@ U_CAPI bool_t U_EXPORT2 ucmp32_isBogus(const CompactIntArray* array);
|
|||
/**
|
||||
* Set a new value for a Unicode character.
|
||||
* Set automatically expands the array if it is compacted.
|
||||
* @param index the character to set the mapped value with
|
||||
* @param character the character to set the mapped value with
|
||||
* @param value the new mapped value
|
||||
*/
|
||||
U_CAPI void U_EXPORT2 ucmp32_set(CompactIntArray *array,
|
||||
UChar idx,
|
||||
UChar character,
|
||||
int32_t value);
|
||||
|
||||
/**
|
||||
|
|
|
@ -59,7 +59,7 @@ U_CAPI bool_t U_EXPORT2 isBogus(const CompactByteArray* array);
|
|||
|
||||
|
||||
U_CAPI void U_EXPORT2 ucmp8_set(CompactByteArray* array,
|
||||
UChar idx,
|
||||
UChar character,
|
||||
int8_t value);
|
||||
|
||||
U_CAPI void U_EXPORT2 ucmp8_setRange(CompactByteArray* array,
|
||||
|
|
|
@ -168,11 +168,11 @@ int32_t ucnv_flushCache ()
|
|||
|
||||
/*returns a single Name from the list, will return NULL if out of bounds
|
||||
*/
|
||||
const char* ucnv_getAvailableName (int32_t idx)
|
||||
const char* ucnv_getAvailableName (int32_t n)
|
||||
{
|
||||
if (0 <= idx && idx <= 0xffff) {
|
||||
if (0 <= n && n <= 0xffff) {
|
||||
UErrorCode err = U_ZERO_ERROR;
|
||||
const char *name = ucnv_io_getAvailableConverter((uint16_t)idx, &err);
|
||||
const char *name = ucnv_io_getAvailableConverter((uint16_t)n, &err);
|
||||
if (U_SUCCESS(err)) {
|
||||
return name;
|
||||
}
|
||||
|
@ -194,8 +194,8 @@ ucnv_countAliases(const char *alias, UErrorCode *pErrorCode) {
|
|||
|
||||
|
||||
U_CAPI const char *
|
||||
ucnv_getAlias(const char *alias, uint16_t idx, UErrorCode *pErrorCode) {
|
||||
return ucnv_io_getAlias(alias, idx, pErrorCode);
|
||||
ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode) {
|
||||
return ucnv_io_getAlias(alias, n, pErrorCode);
|
||||
}
|
||||
|
||||
U_CAPI void
|
||||
|
@ -1092,18 +1092,18 @@ void ucnv_fixFileSeparator(const UConverter *cnv,
|
|||
int32_t sourceLength)
|
||||
{
|
||||
int32_t i = 0;
|
||||
int32_t idx = 0;
|
||||
int32_t offset = 0;
|
||||
if ((source == NULL) || (cnv == NULL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ((idx = ucnv_getAmbiguousCCSID(cnv)) != -1)
|
||||
if ((offset = ucnv_getAmbiguousCCSID(cnv)) != -1)
|
||||
{
|
||||
for (i = 0; i < sourceLength; i++)
|
||||
{
|
||||
if (source[i] == UCNV_AMBIGUOUSCONVERTERS[idx].mismapped)
|
||||
if (source[i] == UCNV_AMBIGUOUSCONVERTERS[offset].mismapped)
|
||||
{
|
||||
source[i] = UCNV_AMBIGUOUSCONVERTERS[idx].replacement;
|
||||
source[i] = UCNV_AMBIGUOUSCONVERTERS[offset].replacement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -237,17 +237,17 @@ ucnv_io_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCo
|
|||
}
|
||||
|
||||
U_CFUNC const char *
|
||||
ucnv_io_getAlias(const char *alias, uint16_t idx, UErrorCode *pErrorCode) {
|
||||
ucnv_io_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode) {
|
||||
if(haveAliasData(pErrorCode) && isAlias(alias, pErrorCode)) {
|
||||
const uint16_t *p=findAlias(alias);
|
||||
if(p!=NULL) {
|
||||
uint16_t count=*(p+1);
|
||||
if(idx<count) {
|
||||
if(n<count) {
|
||||
const char *aliases=(const char *)aliasTable+*p;
|
||||
while(idx>0) {
|
||||
while(n>0) {
|
||||
/* skip a name, first the canonical converter name */
|
||||
aliases+=uprv_strlen(aliases)+1;
|
||||
--idx;
|
||||
--n;
|
||||
}
|
||||
return aliases;
|
||||
}
|
||||
|
@ -265,11 +265,11 @@ ucnv_io_countAvailableConverters(UErrorCode *pErrorCode) {
|
|||
}
|
||||
|
||||
U_CFUNC const char *
|
||||
ucnv_io_getAvailableConverter(uint16_t idx, UErrorCode *pErrorCode) {
|
||||
ucnv_io_getAvailableConverter(uint16_t n, UErrorCode *pErrorCode) {
|
||||
if(haveAliasData(pErrorCode)) {
|
||||
const uint16_t *p=aliasTable+1+2*(*aliasTable);
|
||||
if(idx<*p) {
|
||||
return (const char *)aliasTable+p[1+2*idx];
|
||||
if(n<*p) {
|
||||
return (const char *)aliasTable+p[1+2*n];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
@ -297,9 +297,9 @@ ucnv_io_countAvailableAliases(UErrorCode *pErrorCode) {
|
|||
}
|
||||
|
||||
U_CFUNC const char *
|
||||
ucnv_io_getAvailableAlias(uint16_t idx, UErrorCode *pErrorCode) {
|
||||
if(haveAliasData(pErrorCode) && idx<*aliasTable) {
|
||||
return (const char *)aliasTable+*(aliasTable+1+idx);
|
||||
ucnv_io_getAvailableAlias(uint16_t n, UErrorCode *pErrorCode) {
|
||||
if(haveAliasData(pErrorCode) && n<*aliasTable) {
|
||||
return (const char *)aliasTable+*(aliasTable+1+n);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -38,11 +38,11 @@ ucnv_io_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCo
|
|||
|
||||
/**
|
||||
* Search case-insensitively for a converter alias and return
|
||||
* the (index)th alias.
|
||||
* the (n)th alias.
|
||||
* Returns NULL if the alias is not found.
|
||||
*/
|
||||
U_CFUNC const char *
|
||||
ucnv_io_getAlias(const char *alias, uint16_t idx, UErrorCode *pErrorCode);
|
||||
ucnv_io_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Return the number of all converter names.
|
||||
|
@ -51,12 +51,12 @@ U_CFUNC uint16_t
|
|||
ucnv_io_countAvailableConverters(UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Return the (index)th converter name in mixed case, or NULL
|
||||
* Return the (n)th converter name in mixed case, or NULL
|
||||
* if there is none (typically, if the data cannot be loaded).
|
||||
* 0<=index<ucnv_io_countAvailableConverters().
|
||||
*/
|
||||
U_CFUNC const char *
|
||||
ucnv_io_getAvailableConverter(uint16_t idx, UErrorCode *pErrorCode);
|
||||
ucnv_io_getAvailableConverter(uint16_t n, UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Fill an array const char *aliases[ucnv_io_countAvailableConverters()]
|
||||
|
@ -72,12 +72,12 @@ U_CFUNC uint16_t
|
|||
ucnv_io_countAvailableAliases(UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Return the (index)th alias or converter name in mixed case, or NULL
|
||||
* Return the (n)th alias or converter name in mixed case, or NULL
|
||||
* if there is none (typically, if the data cannot be loaded).
|
||||
* 0<=index<ucnv_io_countAvailableAliases().
|
||||
*/
|
||||
U_CFUNC const char *
|
||||
ucnv_io_getAvailableAlias(uint16_t idx, UErrorCode *pErrorCode);
|
||||
ucnv_io_getAvailableAlias(uint16_t n, UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Fill an array const char *aliases[ucnv_io_countAvailableAliases()]
|
||||
|
|
|
@ -669,18 +669,18 @@ _uhash_find(const UHashtable *hash, const void* key,
|
|||
int32_t hashcode) {
|
||||
|
||||
int32_t firstDeleted = -1; /* assume invalid index */
|
||||
int32_t idx, startIndex;
|
||||
int32_t theIndex, startIndex;
|
||||
int32_t jump = 0; /* lazy evaluate */
|
||||
int32_t tableHash;
|
||||
|
||||
hashcode &= 0x7FFFFFFF; /* must be positive */
|
||||
startIndex = idx = (hashcode ^ 0x4000000) % hash->length;
|
||||
startIndex = theIndex = (hashcode ^ 0x4000000) % hash->length;
|
||||
|
||||
do {
|
||||
tableHash = hash->elements[idx].hashcode;
|
||||
tableHash = hash->elements[theIndex].hashcode;
|
||||
if (tableHash == hashcode) { /* quick check */
|
||||
if ((*hash->keyComparator)(key, hash->elements[idx].key)) {
|
||||
return &(hash->elements[idx]);
|
||||
if ((*hash->keyComparator)(key, hash->elements[theIndex].key)) {
|
||||
return &(hash->elements[theIndex]);
|
||||
}
|
||||
} else if (!IS_EMPTY_OR_DELETED(tableHash)) {
|
||||
/* We have hit a slot which contains a key-value pair,
|
||||
|
@ -690,7 +690,7 @@ _uhash_find(const UHashtable *hash, const void* key,
|
|||
} else if (tableHash == HASH_EMPTY) { /* empty, end o' the line */
|
||||
break;
|
||||
} else if (firstDeleted < 0) { /* remember first deleted */
|
||||
firstDeleted = idx;
|
||||
firstDeleted = theIndex;
|
||||
}
|
||||
if (jump == 0) { /* lazy compute jump */
|
||||
/* The jump value must be relatively prime to the table
|
||||
|
@ -699,11 +699,11 @@ _uhash_find(const UHashtable *hash, const void* key,
|
|||
*/
|
||||
jump = (hashcode % (hash->length - 1)) + 1;
|
||||
}
|
||||
idx = (idx + jump) % hash->length;
|
||||
} while (idx != startIndex);
|
||||
theIndex = (theIndex + jump) % hash->length;
|
||||
} while (theIndex != startIndex);
|
||||
|
||||
if (firstDeleted >= 0) {
|
||||
idx = firstDeleted; /* reset if had deleted slot */
|
||||
theIndex = firstDeleted; /* reset if had deleted slot */
|
||||
} else if (tableHash != HASH_EMPTY) {
|
||||
/* We get to this point if the hashtable is full (no empty or
|
||||
* deleted slots), and we've failed to find a match. THIS
|
||||
|
@ -713,7 +713,7 @@ _uhash_find(const UHashtable *hash, const void* key,
|
|||
assert(FALSE);
|
||||
return NULL; /* Never happens if uhash_put() behaves */
|
||||
}
|
||||
return &(hash->elements[idx]);
|
||||
return &(hash->elements[theIndex]);
|
||||
}
|
||||
|
||||
static void*
|
||||
|
|
|
@ -465,31 +465,31 @@ int32_t uloc_getName(const char* localeID,
|
|||
|
||||
const char* uloc_getISO3Language(const char* localeID)
|
||||
{
|
||||
int16_t idx;
|
||||
int16_t offset;
|
||||
char lang[TEMPBUFSIZE];
|
||||
UErrorCode err = U_ZERO_ERROR;
|
||||
|
||||
if (localeID == NULL) localeID = uloc_getDefault();
|
||||
uloc_getLanguage(localeID, lang, TEMPBUFSIZE, &err);
|
||||
if (U_FAILURE(err)) return "";
|
||||
idx = _findIndex(_languages, sizeof(_languages),lang);
|
||||
if (idx < 0) return "";
|
||||
return &(_languages3[idx * 4]);
|
||||
offset = _findIndex(_languages, sizeof(_languages),lang);
|
||||
if (offset < 0) return "";
|
||||
return &(_languages3[offset * 4]);
|
||||
}
|
||||
|
||||
const char* uloc_getISO3Country(const char* localeID)
|
||||
{
|
||||
int16_t idx;
|
||||
int16_t offset;
|
||||
char cntry[TEMPBUFSIZE];
|
||||
UErrorCode err = U_ZERO_ERROR;
|
||||
|
||||
if (localeID == NULL) localeID = uloc_getDefault();
|
||||
uloc_getCountry(localeID, cntry, TEMPBUFSIZE, &err);
|
||||
if (U_FAILURE(err)) return "";
|
||||
idx = _findIndex(_countries, sizeof(_countries), cntry);
|
||||
if (idx < 0) return "";
|
||||
offset = _findIndex(_countries, sizeof(_countries), cntry);
|
||||
if (offset < 0) return "";
|
||||
|
||||
return &(_countries3[idx * 4]);
|
||||
return &(_countries3[offset * 4]);
|
||||
}
|
||||
|
||||
uint32_t uloc_getLCID(const char* localeID)
|
||||
|
@ -1016,13 +1016,13 @@ int32_t uloc_getDisplayName(const char* locale,
|
|||
U_CAPI UnicodeString** T_ResourceBundle_listInstalledLocales(const char* path, int32_t* numInstalledLocales);
|
||||
|
||||
const char*
|
||||
uloc_getAvailable(int32_t idx)
|
||||
uloc_getAvailable(int32_t offset)
|
||||
{
|
||||
|
||||
if (_installedLocales == NULL) _lazyEvaluate_installedLocales();
|
||||
|
||||
if (idx > _installedLocalesCount) return NULL;
|
||||
else return _installedLocales[idx];
|
||||
if (offset > _installedLocalesCount) return NULL;
|
||||
else return _installedLocales[offset];
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ U_CAPI int32_t U_EXPORT2 uprv_digitsAfterDecimal(double x);
|
|||
*/
|
||||
U_CAPI void U_EXPORT2 uprv_tzset(void);
|
||||
U_CAPI int32_t U_EXPORT2 uprv_timezone(void);
|
||||
U_CAPI char* U_EXPORT2 uprv_tzname(int idx);
|
||||
U_CAPI char* U_EXPORT2 uprv_tzname(int n);
|
||||
|
||||
/**
|
||||
* Get UTC (GMT) time measured in seconds since 0:00 on 1/1/70.
|
||||
|
|
|
@ -599,13 +599,13 @@ U_CAPI int32_t U_EXPORT2 ucnv_flushCache (void);
|
|||
/**
|
||||
* provides a string containing the internal name (based on the alias file) of the converter.
|
||||
* given an index.
|
||||
* @param index the number of converters available on the system (<TT>[0..ucnv_countAvaiable()]</TT>)
|
||||
* @param n the number of converters available on the system (<TT>[0..ucnv_countAvaiable()]</TT>)
|
||||
* @return a pointer a string (library owned), or <TT>NULL</TT> if the index is out of bounds.
|
||||
* @see ucnv_countAvailable
|
||||
* @stable
|
||||
*/
|
||||
U_CAPI
|
||||
const char * U_EXPORT2 ucnv_getAvailableName (int32_t idx);
|
||||
const char * U_EXPORT2 ucnv_getAvailableName (int32_t n);
|
||||
|
||||
/**
|
||||
* returns the number of available converters.
|
||||
|
@ -630,13 +630,13 @@ ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
|
|||
/**
|
||||
* Gives the name of the alias at given index of alias list
|
||||
* @param alias alias name
|
||||
* @param index indes in alias list
|
||||
* @param n index in alias list
|
||||
* @param pErrorCode result of operation
|
||||
* @return returns the name of the alias at given index
|
||||
* @stable
|
||||
*/
|
||||
U_CAPI const char *
|
||||
ucnv_getAlias(const char *alias, uint16_t idx, UErrorCode *pErrorCode);
|
||||
ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Fill-up the list of alias names for the given alias
|
||||
|
|
|
@ -419,12 +419,12 @@ uloc_getDisplayName(const char* localeID,
|
|||
* a locale name array. Both this array and the pointers
|
||||
* it contains are owned by ICU and should not be deleted or written through
|
||||
* by the caller. The locale name is terminated by a null pointer.
|
||||
* @param index the specific locale name index of the available locale list
|
||||
* @param n the specific locale name index of the available locale list
|
||||
* @return a specified locale name of all available locales
|
||||
* @stable
|
||||
*/
|
||||
U_CAPI const char* U_EXPORT2
|
||||
uloc_getAvailable(int32_t idx);
|
||||
uloc_getAvailable(int32_t n);
|
||||
|
||||
/**
|
||||
* Gets the size of the all available locale list.
|
||||
|
|
|
@ -2496,7 +2496,7 @@ int32_t RuleBasedCollator::getMaxExpansion(int32_t order) const
|
|||
/**
|
||||
* Get the entry of hash table of the expanding string in the collation
|
||||
* table.
|
||||
* @param idx the index of the expanding string value list
|
||||
* @param offset the index of the expanding string value list
|
||||
*/
|
||||
VectorOfInt *RuleBasedCollator::getExpandValueList(int32_t order) const
|
||||
{
|
||||
|
|
|
@ -162,9 +162,9 @@ ParsePosition::getIndex() const
|
|||
}
|
||||
|
||||
inline void
|
||||
ParsePosition::setIndex(UTextOffset idx)
|
||||
ParsePosition::setIndex(UTextOffset offset)
|
||||
{
|
||||
this->index = idx;
|
||||
this->index = offset;
|
||||
}
|
||||
|
||||
inline UTextOffset
|
||||
|
|
Loading…
Add table
Reference in a new issue