Changeset 1b0b48e0 in mainline for kernel/generic/src/printf/printf_core.c
- Timestamp:
- 2009-04-01T19:01:39Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade
- Children:
- 06b785f
- Parents:
- f25b2819
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/printf/printf_core.c
rf25b2819 r1b0b48e0 253 253 if (str == NULL) 254 254 return printf_putstr(nullstr, ps); 255 256 /* Print leading spaces */257 size_t size= str_length(str);255 256 /* Print leading spaces. */ 257 count_t strw = str_length(str); 258 258 if (precision == 0) 259 precision = s ize;259 precision = strw; 260 260 261 261 count_t counter = 0; … … 269 269 270 270 int retval; 271 size_t bytes = str_lsize(str, min(size, precision));272 if ((retval = printf_putnchars_utf8(str, bytes, ps)) < 0)271 size_t size = str_lsize(str, precision); 272 if ((retval = printf_putnchars_utf8(str, size, ps)) < 0) 273 273 return -counter; 274 274 275 275 counter += retval; 276 276 277 277 while (width-- > 0) { 278 278 if (printf_putchar(' ', ps) == 1) … … 281 281 282 282 return ((int) counter); 283 283 284 } 284 285 … … 292 293 * @return Number of UTF-32 characters printed, negative value on failure. 293 294 */ 294 static int print_utf32(wchar_t * str, int width, unsigned int precision,295 static int print_utf32(wchar_t *wstr, int width, unsigned int precision, 295 296 uint32_t flags, printf_spec_t *ps) 296 297 { 297 if ( str == NULL)298 if (wstr == NULL) 298 299 return printf_putstr(nullstr, ps); 299 300 /* Print leading spaces */301 size_t s ize = wstr_length(str);300 301 /* Print leading spaces. */ 302 size_t strw = wstr_length(wstr); 302 303 if (precision == 0) 303 precision = s ize;304 304 precision = strw; 305 305 306 count_t counter = 0; 306 307 width -= precision; … … 311 312 } 312 313 } 313 314 314 315 int retval; 315 size_t bytes = min(size, precision) * sizeof(wchar_t);316 if ((retval = printf_putnchars_utf32( str, bytes, ps)) < 0)316 size_t size = min(strw, precision) * sizeof(wchar_t); 317 if ((retval = printf_putnchars_utf32(wstr, size, ps)) < 0) 317 318 return -counter; 318 319 319 320 counter += retval; 320 321 321 322 while (width-- > 0) { 322 323 if (printf_putchar(' ', ps) == 1) 323 324 counter++; 324 325 } 325 326 326 327 return ((int) counter); 327 328 } … … 585 586 int printf_core(const char *fmt, printf_spec_t *ps, va_list ap) 586 587 { 587 index_t i = 0; /* Index of the currently processed character from fmt */588 index_t nxt = 0;589 index_t j = 0; /* Index to the first not printed nonformating character */588 size_t i = 0; /* Index of the currently processed character from fmt */ 589 size_t nxt = 0; 590 size_t j = 0; /* Index to the first not printed nonformating character */ 590 591 591 592 wchar_t uc; /* Current UTF-32 character decoded from fmt */
Note:
See TracChangeset
for help on using the changeset viewer.