Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/generic/string.c

    rda2bd08 rdd2cfa7  
    583583}
    584584
    585 /** Convert string to wide string.
    586  *
    587  * Convert string @a src to wide string. The output is written to the
    588  * buffer specified by @a dest and @a size, which must have non-zero
    589  * size. The output will always be null-terminated.
    590  *
    591  * @param dest  Destination buffer.
    592  * @param dlen  Length of destination buffer (number of wchars).
    593  * @param src   Source string.
    594  */
    595 void str_to_wstr(wchar_t *dest, size_t dlen, const char *src)
    596 {
    597         size_t offset;
    598         size_t di;
    599         wchar_t c;
    600 
    601         assert(dlen > 0);
    602 
    603         offset = 0;
    604         di = 0;
    605 
    606         do {
    607                 if (di >= dlen - 1)
    608                         break;
    609 
    610                 c = str_decode(src, &offset, STR_NO_LIMIT);
    611                 dest[di++] = c;
    612         } while (c != '\0');
    613 
    614         dest[dlen - 1] = '\0';
    615 }
    616 
    617585/** Find first occurence of character in string.
    618586 *
Note: See TracChangeset for help on using the changeset viewer.