Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4347 → Rev 4348

/branches/dynload/kernel/generic/src/printf/vprintf.c
43,14 → 43,13
 
SPINLOCK_INITIALIZE(printf_lock); /**< vprintf spinlock */
 
static int vprintf_write_utf8(const char *str, size_t size, void *data)
static int vprintf_str_write(const char *str, size_t size, void *data)
{
index_t index = 0;
index_t chars = 0;
size_t offset = 0;
count_t chars = 0;
while (index < size) {
putchar(utf8_decode(str, &index, size - 1));
index++;
while (offset < size) {
putchar(str_decode(str, &offset, size));
chars++;
}
57,27 → 56,28
return chars;
}
 
static int vprintf_write_utf32(const wchar_t *str, size_t size, void *data)
static int vprintf_wstr_write(const wchar_t *str, size_t size, void *data)
{
index_t index = 0;
size_t offset = 0;
count_t chars = 0;
while (index < (size / sizeof(wchar_t))) {
putchar(str[index]);
index++;
while (offset < size) {
putchar(str[chars]);
chars++;
offset += sizeof(wchar_t);
}
return index;
return chars;
}
 
int puts(const char *str)
{
index_t index = 0;
index_t chars = 0;
size_t offset = 0;
count_t chars = 0;
wchar_t uc;
while ((uc = utf8_decode(str, &index, UTF8_NO_LIMIT)) != 0) {
while ((uc = str_decode(str, &offset, STR_NO_LIMIT)) != 0) {
putchar(uc);
index++;
chars++;
}
87,8 → 87,8
int vprintf(const char *fmt, va_list ap)
{
printf_spec_t ps = {
vprintf_write_utf8,
vprintf_write_utf32,
vprintf_str_write,
vprintf_wstr_write,
NULL
};