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

Changeset dc5aa568 in mainline for uspace/lib/c/generic/str.c


Ignore:
Timestamp:
2012-08-16T15:18:44Z (9 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master
Children:
ebbc8a74
Parents:
80d8885 (diff), 13c4fe0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/str.c

    r80d8885 rdc5aa568  
    397397       
    398398        return len;
     399}
     400
     401/** Get character display width on a character cell display.
     402 *
     403 * @param ch    Character
     404 * @return      Width of character in cells.
     405 */
     406size_t chr_width(wchar_t ch)
     407{
     408        return 1;
     409}
     410
     411/** Get string display width on a character cell display.
     412 *
     413 * @param str   String
     414 * @return      Width of string in cells.
     415 */
     416size_t str_width(const char *str)
     417{
     418        size_t width = 0;
     419        size_t offset = 0;
     420        wchar_t ch;
     421       
     422        while ((ch = str_decode(str, &offset, STR_NO_LIMIT)) != 0)
     423                width += chr_width(ch);
     424       
     425        return width;
    399426}
    400427
Note: See TracChangeset for help on using the changeset viewer.