ICU-1707 use more appropriate error code.

X-SVN-Rev: 7676
This commit is contained in:
Yves Arrouye 2002-02-15 01:46:41 +00:00
parent 867a05adb8
commit 6fdea6ffb4
2 changed files with 16 additions and 4 deletions

View File

@ -423,6 +423,18 @@ u_charType(UChar32 c) {
return (int8_t)GET_CATEGORY(props);
}
/* Gets the Unicode character's general category, as per the UCD.*/
U_CAPI int8_t U_EXPORT2
u_charUCDType(UChar32 c) {
if (IS_ISO_8_CONTROL(c)) {
return U_CONTROL_CHAR;
} else {
uint32_t props;
GET_PROPS(c, props);
return (int8_t)GET_CATEGORY(props);
}
}
/* Enumerate all code points with their general categories. */
struct _EnumTypeCallback {
UCharEnumTypeRange *enumRange;

View File

@ -249,7 +249,7 @@ u_charFromName(UCharNameChoice nameChoice,
}
if(i==sizeof(upper)) {
/* name too long, there is no such character */
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
*pErrorCode = U_ILLEGAL_CHAR_FOUND;
return error;
}
@ -271,7 +271,7 @@ u_charFromName(UCharNameChoice nameChoice,
} else if (lower[i] >= 'a' && lower[i] <= 'f') {
cp = (cp << 4) + lower[i] - 'a' + 10;
} else {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
*pErrorCode = U_ILLEGAL_CHAR_FOUND;
return error;
}
}
@ -293,7 +293,7 @@ u_charFromName(UCharNameChoice nameChoice,
}
}
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
*pErrorCode = U_ILLEGAL_CHAR_FOUND;
return error;
}
@ -325,7 +325,7 @@ u_charFromName(UCharNameChoice nameChoice,
}
if (findName.code == error) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
*pErrorCode = U_ILLEGAL_CHAR_FOUND;
}
return findName.code;
}