Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset a78d001 in mainline


Ignore:
Timestamp:
2009-04-06T14:56:52Z (12 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master
Children:
5b7f418
Parents:
482c86f
Message:

ignore leading byte-order mark while printing wide strings
(GCC sometimes generates constant UTF-32 strings with BOM)

Location:
kernel/generic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/string.h

    r482c86f ra78d001  
    5858#define U_CURSOR       0x2588
    5959
     60#define U_BOM          0xfeff
     61
    6062/**< No size limit constant */
    6163#define STR_NO_LIMIT  ((size_t) -1)
  • kernel/generic/src/printf/printf_core.c

    r482c86f ra78d001  
    250250 */
    251251static int print_str(char *str, int width, unsigned int precision,
    252         uint32_t flags, printf_spec_t *ps)
     252    uint32_t flags, printf_spec_t *ps)
    253253{
    254254        if (str == NULL)
     
    298298 */
    299299static int print_wstr(wchar_t *str, int width, unsigned int precision,
    300         uint32_t flags, printf_spec_t *ps)
     300    uint32_t flags, printf_spec_t *ps)
    301301{
    302302        if (str == NULL)
    303303                return printf_putstr(nullstr, ps);
    304 
     304       
     305        if (*str == U_BOM)
     306                str++;
     307       
    305308        /* Print leading spaces. */
    306309        size_t strw = wstr_length(str);
    307310        if (precision == 0)
    308311                precision = strw;
    309 
     312       
    310313        /* Left padding */
    311314        count_t counter = 0;
     
    317320                }
    318321        }
    319 
     322       
    320323        /* Part of @a wstr fitting into the alloted space. */
    321324        int retval;
     
    323326        if ((retval = printf_wputnchars(str, size, ps)) < 0)
    324327                return -counter;
    325 
     328       
    326329        counter += retval;
    327 
     330       
    328331        /* Right padding */
    329332        while (width-- > 0) {
Note: See TracChangeset for help on using the changeset viewer.