Ignore:
Timestamp:
2009-04-03T07:54:27Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d1dabe1f
Parents:
b888d5f
Message:

cleanup, string changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/printf/vsnprintf.c

    rb888d5f r043eca0  
    4545} vsnprintf_data_t;
    4646
    47 /** Write UTF-8 string to given buffer.
     47/** Write string to given buffer.
    4848 *
    4949 * Write at most data->size plain characters including trailing zero.
     
    5353 * but size of the input string.
    5454 *
    55  * @param str  Source UTF-8 string to print.
     55 * @param str  Source string to print.
    5656 * @param size Number of plain characters in str.
    5757 * @param data Structure describing destination string, counter
    5858 *             of used space and total string size.
    5959 *
    60  * @return Number of UTF-8 characters to print (not characters actually
     60 * @return Number of characters to print (not characters actually
    6161 *         printed).
    6262 *
    6363 */
    64 static int vsnprintf_write_utf8(const char *str, size_t size, vsnprintf_data_t *data)
     64static int vsnprintf_str_write(const char *str, size_t size, vsnprintf_data_t *data)
    6565{
    6666        size_t left = data->size - data->len;
     
    8686               
    8787                while (index < size) {
    88                         wchar_t uc = chr_decode(str, &index, size);
    89 
     88                        wchar_t uc = str_decode(str, &index, size);
     89                       
    9090                        if (chr_encode(uc, data->dst, &data->len, data->size - 1) != EOK)
    9191                                break;
     
    112112}
    113113
    114 /** Write UTF-32 string to given buffer.
     114/** Write wide string to given buffer.
    115115 *
    116116 * Write at most data->size plain characters including trailing zero.
     
    120120 * but size of the input string.
    121121 *
    122  * @param str  Source UTF-32 string to print.
     122 * @param str  Source wide string to print.
    123123 * @param size Number of bytes in str.
    124124 * @param data Structure describing destination string, counter
    125125 *             of used space and total string size.
    126126 *
    127  * @return Number of UTF-8 characters to print (not characters actually
     127 * @return Number of wide characters to print (not characters actually
    128128 *         printed).
    129129 *
    130130 */
    131 static int vsnprintf_write_utf32(const wchar_t *str, size_t size, vsnprintf_data_t *data)
     131static int vsnprintf_wstr_write(const wchar_t *str, size_t size, vsnprintf_data_t *data)
    132132{
    133133        index_t index = 0;
     
    170170        };
    171171        printf_spec_t ps = {
    172                 (int(*) (const char *, size_t, void *)) vsnprintf_write_utf8,
    173                 (int(*) (const wchar_t *, size_t, void *)) vsnprintf_write_utf32,
     172                (int(*) (const char *, size_t, void *)) vsnprintf_str_write,
     173                (int(*) (const wchar_t *, size_t, void *)) vsnprintf_wstr_write,
    174174                &data
    175175        };
Note: See TracChangeset for help on using the changeset viewer.