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

Changeset 81e9cb3 in mainline


Ignore:
Timestamp:
2011-08-24T21:51:57Z (10 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
26ad20b
Parents:
980311e
Message:

Make wstr_to_str() and str_to_wstr() void functions again.

Location:
uspace/lib/c
Files:
2 edited

Legend:

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

    r980311e r81e9cb3  
    620620 * @param size  Size of the destination buffer.
    621621 * @param src   Source wide string.
    622  *
    623  * @return EOK, if success, negative otherwise.
    624  */
    625 int wstr_to_str(char *dest, size_t size, const wchar_t *src)
    626 {
    627         int rc;
     622 */
     623void wstr_to_str(char *dest, size_t size, const wchar_t *src)
     624{
    628625        wchar_t ch;
    629626        size_t src_idx;
     
    637634
    638635        while ((ch = src[src_idx++]) != 0) {
    639                 rc = chr_encode(ch, dest, &dest_off, size - 1);
    640                 if (rc != EOK)
     636                if (chr_encode(ch, dest, &dest_off, size - 1) != EOK)
    641637                        break;
    642638        }
    643639
    644640        dest[dest_off] = '\0';
    645         return rc;
    646641}
    647642
     
    782777 * @param dlen  Length of destination buffer (number of wchars).
    783778 * @param src   Source string.
    784  *
    785  * @return EOK, if success, negative otherwise.
    786  */
    787 int str_to_wstr(wchar_t *dest, size_t dlen, const char *src)
    788 {
    789         int rc=EOK;
     779 */
     780void str_to_wstr(wchar_t *dest, size_t dlen, const char *src)
     781{
    790782        size_t offset;
    791783        size_t di;
     
    798790
    799791        do {
    800                 if (di >= dlen - 1) {
    801                         rc = EOVERFLOW;
     792                if (di >= dlen - 1)
    802793                        break;
    803                 }
    804794
    805795                c = str_decode(src, &offset, STR_NO_LIMIT);
     
    808798
    809799        dest[dlen - 1] = '\0';
    810         return rc;
    811800}
    812801
  • uspace/lib/c/include/str.h

    r980311e r81e9cb3  
    8080extern void str_append(char *dest, size_t size, const char *src);
    8181
    82 extern int wstr_to_str(char *dest, size_t size, const wchar_t *src);
    8382extern int spascii_to_str(char *dest, size_t size, const uint8_t *src, size_t n);
     83extern void wstr_to_str(char *dest, size_t size, const wchar_t *src);
    8484extern char *wstr_to_astr(const wchar_t *src);
     85extern void str_to_wstr(wchar_t *dest, size_t dlen, const char *src);
    8586extern wchar_t *str_to_awstr(const char *src);
    86 extern int str_to_wstr(wchar_t *dest, size_t dlen, const char *src);
    8787extern int utf16_to_str(char *dest, size_t size, const uint16_t *src);
    8888extern int str_to_utf16(uint16_t *dest, size_t size, const char *src);
Note: See TracChangeset for help on using the changeset viewer.