Rev 4201 | Rev 4296 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4201 | Rev 4221 | ||
|---|---|---|---|
| Line 252... | Line 252... | ||
| 252 | { |
252 | { |
| 253 | if (str == NULL) |
253 | if (str == NULL) |
| 254 | return printf_putstr(nullstr, ps); |
254 | return printf_putstr(nullstr, ps); |
| 255 | 255 | ||
| 256 | /* Print leading spaces */ |
256 | /* Print leading spaces */ |
| 257 | size_t size = strlen_utf8(str); |
257 | size_t size = str_length(str); |
| 258 | if (precision == 0) |
258 | if (precision == 0) |
| 259 | precision = size; |
259 | precision = size; |
| 260 | 260 | ||
| 261 | count_t counter = 0; |
261 | count_t counter = 0; |
| 262 | width -= precision; |
262 | width -= precision; |
| Line 266... | Line 266... | ||
| 266 | counter++; |
266 | counter++; |
| 267 | } |
267 | } |
| 268 | } |
268 | } |
| 269 | 269 | ||
| 270 | int retval; |
270 | int retval; |
| 271 | size_t bytes = utf8_count_bytes(str, min(size, precision)); |
271 | size_t bytes = str_lsize(str, min(size, precision)); |
| 272 | if ((retval = printf_putnchars_utf8(str, bytes, ps)) < 0) |
272 | if ((retval = printf_putnchars_utf8(str, bytes, ps)) < 0) |
| 273 | return -counter; |
273 | return -counter; |
| 274 | 274 | ||
| 275 | counter += retval; |
275 | counter += retval; |
| 276 | 276 | ||
| Line 296... | Line 296... | ||
| 296 | { |
296 | { |
| 297 | if (str == NULL) |
297 | if (str == NULL) |
| 298 | return printf_putstr(nullstr, ps); |
298 | return printf_putstr(nullstr, ps); |
| 299 | 299 | ||
| 300 | /* Print leading spaces */ |
300 | /* Print leading spaces */ |
| 301 | size_t size = strlen_utf32(str); |
301 | size_t size = wstr_length(str); |
| 302 | if (precision == 0) |
302 | if (precision == 0) |
| 303 | precision = size; |
303 | precision = size; |
| 304 | 304 | ||
| 305 | count_t counter = 0; |
305 | count_t counter = 0; |
| 306 | width -= precision; |
306 | width -= precision; |