Rev 4200 | Rev 4213 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4200 | Rev 4206 | ||
---|---|---|---|
Line 43... | Line 43... | ||
43 | 43 | ||
44 | SPINLOCK_INITIALIZE(printf_lock); /**< vprintf spinlock */ |
44 | SPINLOCK_INITIALIZE(printf_lock); /**< vprintf spinlock */ |
45 | 45 | ||
46 | static int vprintf_write_utf8(const char *str, size_t size, void *data) |
46 | static int vprintf_write_utf8(const char *str, size_t size, void *data) |
47 | { |
47 | { |
48 | index_t index = 0; |
48 | size_t offset = 0; |
49 | index_t chars = 0; |
49 | count_t chars = 0; |
50 | 50 | ||
51 | while (index < size) { |
51 | while (offset < size) { |
52 | putchar(chr_decode(str, &index, size)); |
52 | putchar(chr_decode(str, &offset, size)); |
53 | chars++; |
53 | chars++; |
54 | } |
54 | } |
55 | 55 | ||
56 | return chars; |
56 | return chars; |
57 | } |
57 | } |
Line 68... | Line 68... | ||
68 | return index; |
68 | return index; |
69 | } |
69 | } |
70 | 70 | ||
71 | int puts(const char *str) |
71 | int puts(const char *str) |
72 | { |
72 | { |
73 | index_t index = 0; |
73 | size_t offset = 0; |
74 | index_t chars = 0; |
74 | count_t chars = 0; |
75 | wchar_t uc; |
75 | wchar_t uc; |
76 | 76 | ||
77 | while ((uc = chr_decode(str, &index, UTF8_NO_LIMIT)) != 0) { |
77 | while ((uc = chr_decode(str, &offset, UTF8_NO_LIMIT)) != 0) { |
78 | putchar(uc); |
78 | putchar(uc); |
79 | chars++; |
79 | chars++; |
80 | } |
80 | } |
81 | 81 | ||
82 | return chars; |
82 | return chars; |