ICU-738 Eliminate extra space by offseting position argument by 1.
X-SVN-Rev: 22947
This commit is contained in:
parent
c07f6c1836
commit
ad499a6c4b
@ -1087,9 +1087,9 @@ ufmt_args* parseArguments(const UChar *alias, va_list ap) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* create the parsed argument list */
|
/* create the parsed argument list */
|
||||||
typelist = (ufmt_type_info*)uprv_malloc(sizeof(ufmt_type_info*) * size + 1);
|
typelist = (ufmt_type_info*)uprv_malloc(sizeof(ufmt_type_info) * size);
|
||||||
islonglong = (UBool*)uprv_malloc(sizeof(UBool*) * size + 1);
|
islonglong = (UBool*)uprv_malloc(sizeof(UBool) * size);
|
||||||
arglist = (ufmt_args*)uprv_malloc(sizeof(ufmt_args*) * size + 1);
|
arglist = (ufmt_args*)uprv_malloc(sizeof(ufmt_args) * size);
|
||||||
|
|
||||||
/* reset alias back to the beginning */
|
/* reset alias back to the beginning */
|
||||||
alias = aliasStart;
|
alias = aliasStart;
|
||||||
@ -1115,6 +1115,8 @@ ufmt_args* parseArguments(const UChar *alias, va_list ap) {
|
|||||||
pos += (int) (*alias++ - DIGIT_ZERO);
|
pos += (int) (*alias++ - DIGIT_ZERO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* offset position by 1 */
|
||||||
|
pos--;
|
||||||
|
|
||||||
/* skip over everything except for the type */
|
/* skip over everything except for the type */
|
||||||
while (ISMOD(*alias) || ISFLAG(*alias) || ISDIGIT(*alias) ||
|
while (ISMOD(*alias) || ISFLAG(*alias) || ISDIGIT(*alias) ||
|
||||||
@ -1140,7 +1142,7 @@ ufmt_args* parseArguments(const UChar *alias, va_list ap) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* store argument in arglist */
|
/* store argument in arglist */
|
||||||
for (pos = 1; pos <= size; pos++) {
|
for (pos = 0; pos < size; pos++) {
|
||||||
switch (typelist[pos]) {
|
switch (typelist[pos]) {
|
||||||
case ufmt_string:
|
case ufmt_string:
|
||||||
case ufmt_ustring:
|
case ufmt_ustring:
|
||||||
@ -1470,6 +1472,8 @@ u_printf_parse(const u_printf_stream_handler *streamHandler,
|
|||||||
|
|
||||||
/* goto the correct argument on arg_list if position is specified */
|
/* goto the correct argument on arg_list if position is specified */
|
||||||
if (spec.fArgPos > 0) {
|
if (spec.fArgPos > 0) {
|
||||||
|
/* offset position by 1 */
|
||||||
|
spec.fArgPos--;
|
||||||
switch(argType) {
|
switch(argType) {
|
||||||
case ufmt_count:
|
case ufmt_count:
|
||||||
/* set the spec's width to the # of chars written */
|
/* set the spec's width to the # of chars written */
|
||||||
|
Loading…
Reference in New Issue
Block a user