Changeset 043eca0 in mainline for kernel/generic/src/printf/vsnprintf.c
- Timestamp:
- 2009-04-03T07:54:27Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade
- Children:
- d1dabe1f
- Parents:
- b888d5f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/printf/vsnprintf.c
rb888d5f r043eca0 45 45 } vsnprintf_data_t; 46 46 47 /** Write UTF-8string to given buffer.47 /** Write string to given buffer. 48 48 * 49 49 * Write at most data->size plain characters including trailing zero. … … 53 53 * but size of the input string. 54 54 * 55 * @param str Source UTF-8string to print.55 * @param str Source string to print. 56 56 * @param size Number of plain characters in str. 57 57 * @param data Structure describing destination string, counter 58 58 * of used space and total string size. 59 59 * 60 * @return Number of UTF-8characters to print (not characters actually60 * @return Number of characters to print (not characters actually 61 61 * printed). 62 62 * 63 63 */ 64 static int vsnprintf_ write_utf8(const char *str, size_t size, vsnprintf_data_t *data)64 static int vsnprintf_str_write(const char *str, size_t size, vsnprintf_data_t *data) 65 65 { 66 66 size_t left = data->size - data->len; … … 86 86 87 87 while (index < size) { 88 wchar_t uc = chr_decode(str, &index, size);89 88 wchar_t uc = str_decode(str, &index, size); 89 90 90 if (chr_encode(uc, data->dst, &data->len, data->size - 1) != EOK) 91 91 break; … … 112 112 } 113 113 114 /** Write UTF-32string to given buffer.114 /** Write wide string to given buffer. 115 115 * 116 116 * Write at most data->size plain characters including trailing zero. … … 120 120 * but size of the input string. 121 121 * 122 * @param str Source UTF-32string to print.122 * @param str Source wide string to print. 123 123 * @param size Number of bytes in str. 124 124 * @param data Structure describing destination string, counter 125 125 * of used space and total string size. 126 126 * 127 * @return Number of UTF-8characters to print (not characters actually127 * @return Number of wide characters to print (not characters actually 128 128 * printed). 129 129 * 130 130 */ 131 static int vsnprintf_w rite_utf32(const wchar_t *str, size_t size, vsnprintf_data_t *data)131 static int vsnprintf_wstr_write(const wchar_t *str, size_t size, vsnprintf_data_t *data) 132 132 { 133 133 index_t index = 0; … … 170 170 }; 171 171 printf_spec_t ps = { 172 (int(*) (const char *, size_t, void *)) vsnprintf_ write_utf8,173 (int(*) (const wchar_t *, size_t, void *)) vsnprintf_w rite_utf32,172 (int(*) (const char *, size_t, void *)) vsnprintf_str_write, 173 (int(*) (const wchar_t *, size_t, void *)) vsnprintf_wstr_write, 174 174 &data 175 175 };
Note:
See TracChangeset
for help on using the changeset viewer.