ICU-122 add capacity to uprv_itou
X-SVN-Rev: 10908
This commit is contained in:
parent
8779d38c34
commit
78c4cb87f9
@ -191,7 +191,7 @@ UnicodeString&
|
||||
LocaleKey::prefix(UnicodeString& result) const {
|
||||
if (_kind != KIND_ANY) {
|
||||
UChar buffer[64];
|
||||
uprv_itou(buffer, _kind, 10, 0);
|
||||
uprv_itou(buffer, 64, _kind, 10, 0);
|
||||
UnicodeString temp(buffer);
|
||||
result.append(temp);
|
||||
}
|
||||
|
@ -199,8 +199,7 @@ UCNV_FROM_U_CALLBACK_ESCAPE (
|
||||
{
|
||||
valueString[valueStringLength++] = (UChar) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
|
||||
valueString[valueStringLength++] = (UChar) UNICODE_U_CODEPOINT; /* adding U */
|
||||
uprv_itou (valueString + valueStringLength, codeUnits[i++], 16, 4);
|
||||
valueStringLength += 4;
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codeUnits[i++], 16, 4);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -212,8 +211,7 @@ UCNV_FROM_U_CALLBACK_ESCAPE (
|
||||
{
|
||||
valueString[valueStringLength++] = (UChar) UNICODE_RS_CODEPOINT; /* adding \ */
|
||||
valueString[valueStringLength++] = (UChar) UNICODE_U_LOW_CODEPOINT; /* adding u */
|
||||
uprv_itou (valueString + valueStringLength, codeUnits[i++], 16, 4);
|
||||
valueStringLength += 4;
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codeUnits[i++], 16, 4);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -222,12 +220,12 @@ UCNV_FROM_U_CALLBACK_ESCAPE (
|
||||
|
||||
if(length==2){
|
||||
valueString[valueStringLength++] = (UChar) UNICODE_U_CODEPOINT; /* adding U */
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, codePoint, 16, 8);
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 16, 8);
|
||||
|
||||
}
|
||||
else{
|
||||
valueString[valueStringLength++] = (UChar) UNICODE_U_LOW_CODEPOINT; /* adding u */
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, codeUnits[0], 16, 4);
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codeUnits[0], 16, 4);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -236,10 +234,10 @@ UCNV_FROM_U_CALLBACK_ESCAPE (
|
||||
valueString[valueStringLength++] = (UChar) UNICODE_AMP_CODEPOINT; /* adding & */
|
||||
valueString[valueStringLength++] = (UChar) UNICODE_HASH_CODEPOINT; /* adding # */
|
||||
if(length==2){
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, codePoint, 10, 0);
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 10, 0);
|
||||
}
|
||||
else{
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, codeUnits[0], 10, 0);
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codeUnits[0], 10, 0);
|
||||
}
|
||||
valueString[valueStringLength++] = (UChar) UNICODE_SEMICOLON_CODEPOINT; /* adding ; */
|
||||
break;
|
||||
@ -250,10 +248,10 @@ UCNV_FROM_U_CALLBACK_ESCAPE (
|
||||
valueString[valueStringLength++] = (UChar) UNICODE_HASH_CODEPOINT; /* adding # */
|
||||
valueString[valueStringLength++] = (UChar) UNICODE_X_LOW_CODEPOINT; /* adding x */
|
||||
if(length==2){
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, codePoint, 16, 0);
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 16, 0);
|
||||
}
|
||||
else{
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, codeUnits[0], 16, 0);
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codeUnits[0], 16, 0);
|
||||
}
|
||||
valueString[valueStringLength++] = (UChar) UNICODE_SEMICOLON_CODEPOINT; /* adding ; */
|
||||
break;
|
||||
@ -263,9 +261,9 @@ UCNV_FROM_U_CALLBACK_ESCAPE (
|
||||
valueString[valueStringLength++] = (UChar) UNICODE_U_CODEPOINT; /* adding U */
|
||||
valueString[valueStringLength++] = (UChar) UNICODE_PLUS_CODEPOINT; /* adding + */
|
||||
if (length == 2) {
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, codePoint, 16, 4);
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 16, 4);
|
||||
} else {
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, codeUnits[0], 16, 4);
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codeUnits[0], 16, 4);
|
||||
}
|
||||
valueString[valueStringLength++] = (UChar) UNICODE_RIGHT_CURLY_CODEPOINT; /* adding } */
|
||||
break;
|
||||
@ -275,8 +273,7 @@ UCNV_FROM_U_CALLBACK_ESCAPE (
|
||||
{
|
||||
valueString[valueStringLength++] = (UChar) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
|
||||
valueString[valueStringLength++] = (UChar) UNICODE_U_CODEPOINT; /* adding U */
|
||||
uprv_itou (valueString + valueStringLength, codeUnits[i++], 16, 4);
|
||||
valueStringLength += 4;
|
||||
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codeUnits[i++], 16, 4);
|
||||
}
|
||||
}
|
||||
|
||||
@ -406,8 +403,7 @@ UCNV_TO_U_CALLBACK_ESCAPE (
|
||||
{
|
||||
uniValueString[valueStringLength++] = (UChar) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
|
||||
uniValueString[valueStringLength++] = (UChar) UNICODE_X_CODEPOINT; /* adding X */
|
||||
uprv_itou (uniValueString + valueStringLength, (uint8_t) codeUnits[i++], 16, 2);
|
||||
valueStringLength += 2;
|
||||
valueStringLength += uprv_itou (uniValueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint8_t) codeUnits[i++], 16, 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -419,7 +415,7 @@ UCNV_TO_U_CALLBACK_ESCAPE (
|
||||
{
|
||||
uniValueString[valueStringLength++] = (UChar) UNICODE_AMP_CODEPOINT; /* adding & */
|
||||
uniValueString[valueStringLength++] = (UChar) UNICODE_HASH_CODEPOINT; /* adding # */
|
||||
valueStringLength += uprv_itou (uniValueString + valueStringLength, codeUnits[i++], 10, 0);
|
||||
valueStringLength += uprv_itou (uniValueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codeUnits[i++], 10, 0);
|
||||
uniValueString[valueStringLength++] = (UChar) UNICODE_SEMICOLON_CODEPOINT; /* adding ; */
|
||||
}
|
||||
break;
|
||||
@ -430,7 +426,7 @@ UCNV_TO_U_CALLBACK_ESCAPE (
|
||||
uniValueString[valueStringLength++] = (UChar) UNICODE_AMP_CODEPOINT; /* adding & */
|
||||
uniValueString[valueStringLength++] = (UChar) UNICODE_HASH_CODEPOINT; /* adding # */
|
||||
uniValueString[valueStringLength++] = (UChar) UNICODE_X_LOW_CODEPOINT; /* adding x */
|
||||
valueStringLength += uprv_itou (uniValueString + valueStringLength, codeUnits[i++], 16, 0);
|
||||
valueStringLength += uprv_itou (uniValueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codeUnits[i++], 16, 0);
|
||||
uniValueString[valueStringLength++] = (UChar) UNICODE_SEMICOLON_CODEPOINT; /* adding ; */
|
||||
}
|
||||
break;
|
||||
@ -439,7 +435,7 @@ UCNV_TO_U_CALLBACK_ESCAPE (
|
||||
{
|
||||
uniValueString[valueStringLength++] = (UChar) UNICODE_RS_CODEPOINT; /* adding \ */
|
||||
uniValueString[valueStringLength++] = (UChar) UNICODE_X_LOW_CODEPOINT; /* adding x */
|
||||
valueStringLength += uprv_itou (uniValueString + valueStringLength, codeUnits[i++], 16, 2);
|
||||
valueStringLength += uprv_itou (uniValueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codeUnits[i++], 16, 2);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -447,7 +443,7 @@ UCNV_TO_U_CALLBACK_ESCAPE (
|
||||
{
|
||||
uniValueString[valueStringLength++] = (UChar) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
|
||||
uniValueString[valueStringLength++] = (UChar) UNICODE_X_CODEPOINT; /* adding X */
|
||||
uprv_itou (uniValueString + valueStringLength, (uint8_t) codeUnits[i++], 16, 2);
|
||||
uprv_itou (uniValueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint8_t) codeUnits[i++], 16, 2);
|
||||
valueStringLength += 2;
|
||||
}
|
||||
}
|
||||
|
@ -497,8 +497,8 @@ static UBool convertFile(const char *pname,
|
||||
|
||||
if (parse.line >= 0) {
|
||||
UChar linebuf[20], offsetbuf[20];
|
||||
uprv_itou(linebuf, parse.line, 10, 0);
|
||||
uprv_itou(offsetbuf, parse.offset, 10, 0);
|
||||
uprv_itou(linebuf, 20, parse.line, 10, 0);
|
||||
uprv_itou(offsetbuf, 20, parse.offset, 10, 0);
|
||||
u_wmsg(stderr, "cantCreateTranslitParseErr", str.getBuffer(),
|
||||
u_wmsg_errorName(err), linebuf, offsetbuf);
|
||||
} else {
|
||||
|
@ -587,7 +587,7 @@ static void printOutBundle(FILE *out, UConverter *converter, UResourceBundle *re
|
||||
printCString(out, converter, key, -1);
|
||||
}
|
||||
printString(out, converter, open, (int32_t)(sizeof(open) / sizeof(*open)));
|
||||
uprv_itou(num, ures_getInt(resource, status), 10, 0);
|
||||
uprv_itou(num, 20, ures_getInt(resource, status), 10, 0);
|
||||
printString(out, converter, num, u_strlen(num));
|
||||
printString(out, converter, close, (int32_t)(sizeof(close) / sizeof(*close)));
|
||||
|
||||
@ -645,14 +645,14 @@ static void printOutBundle(FILE *out, UConverter *converter, UResourceBundle *re
|
||||
}
|
||||
printString(out, converter, open, (int32_t)(sizeof(open) / sizeof(*open)));
|
||||
for(i = 0; i < len - 1; i++) {
|
||||
int32_t numLen = uprv_itou(num, data[i], 10, 0);
|
||||
int32_t numLen = uprv_itou(num, 20, data[i], 10, 0);
|
||||
num[numLen++] = 0x002C; /* ',' */
|
||||
num[numLen++] = 0x0020; /* ' ' */
|
||||
num[numLen] = 0;
|
||||
printString(out, converter, num, u_strlen(num));
|
||||
}
|
||||
if(len > 0) {
|
||||
uprv_itou(num, data[len - 1], 10, 0);
|
||||
uprv_itou(num, 20, data[len - 1], 10, 0);
|
||||
printString(out, converter, num, u_strlen(num));
|
||||
}
|
||||
printString(out, converter, close, (int32_t)(sizeof(close) / sizeof(*close)));
|
||||
|
@ -530,9 +530,9 @@ ucbuf_ungetc(int32_t c,UCHARBUF* buf){
|
||||
UChar escaped[8] ={'\0'};
|
||||
int32_t len =0;
|
||||
if(c > 0xFFFF){
|
||||
len = uprv_itou(escaped,c,16,8);
|
||||
len = uprv_itou(escaped,8,c,16,8);
|
||||
}else{
|
||||
len=uprv_itou(escaped,c,16,4);
|
||||
len=uprv_itou(escaped,8,c,16,4);
|
||||
}
|
||||
if(buf->currentPos!=buf->buffer){
|
||||
if(*(buf->currentPos-1)==c){
|
||||
|
Loading…
Reference in New Issue
Block a user