252,11 → 252,11 |
{ |
if (str == NULL) |
return printf_putstr(nullstr, ps); |
|
/* Print leading spaces. */ |
count_t strw = str_length(str); |
|
/* Print leading spaces */ |
size_t size = str_length(str); |
if (precision == 0) |
precision = strw; |
precision = size; |
|
count_t counter = 0; |
width -= precision; |
268,12 → 268,12 |
} |
|
int retval; |
size_t size = str_lsize(str, precision); |
if ((retval = printf_putnchars_utf8(str, size, ps)) < 0) |
size_t bytes = str_lsize(str, min(size, precision)); |
if ((retval = printf_putnchars_utf8(str, bytes, ps)) < 0) |
return -counter; |
|
|
counter += retval; |
|
|
while (width-- > 0) { |
if (printf_putchar(' ', ps) == 1) |
counter++; |
280,7 → 280,6 |
} |
|
return ((int) counter); |
|
} |
|
/** Print UTF-32 string. |
292,17 → 291,17 |
* |
* @return Number of UTF-32 characters printed, negative value on failure. |
*/ |
static int print_utf32(wchar_t *wstr, int width, unsigned int precision, |
static int print_utf32(wchar_t *str, int width, unsigned int precision, |
uint32_t flags, printf_spec_t *ps) |
{ |
if (wstr == NULL) |
if (str == NULL) |
return printf_putstr(nullstr, ps); |
|
/* Print leading spaces. */ |
size_t strw = wstr_length(wstr); |
|
/* Print leading spaces */ |
size_t size = wstr_length(str); |
if (precision == 0) |
precision = strw; |
|
precision = size; |
|
count_t counter = 0; |
width -= precision; |
if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) { |
311,19 → 310,19 |
counter++; |
} |
} |
|
|
int retval; |
size_t size = min(strw, precision) * sizeof(wchar_t); |
if ((retval = printf_putnchars_utf32(wstr, size, ps)) < 0) |
size_t bytes = min(size, precision) * sizeof(wchar_t); |
if ((retval = printf_putnchars_utf32(str, bytes, ps)) < 0) |
return -counter; |
|
|
counter += retval; |
|
|
while (width-- > 0) { |
if (printf_putchar(' ', ps) == 1) |
counter++; |
} |
|
|
return ((int) counter); |
} |
|
585,9 → 584,9 |
*/ |
int printf_core(const char *fmt, printf_spec_t *ps, va_list ap) |
{ |
size_t i = 0; /* Index of the currently processed character from fmt */ |
size_t nxt = 0; |
size_t j = 0; /* Index to the first not printed nonformating character */ |
index_t i = 0; /* Index of the currently processed character from fmt */ |
index_t nxt = 0; |
index_t j = 0; /* Index to the first not printed nonformating character */ |
|
wchar_t uc; /* Current UTF-32 character decoded from fmt */ |
count_t counter = 0; /* Number of UTF-8 characters printed */ |