View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000433 | LDMud 3.5 | Efuns | public | 2006-01-06 19:36 | 2019-09-24 08:26 |
Reporter | Assigned To | Gnomi | |||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Summary | 0000433: New efun: wcslen() | ||||
Description | ==Edits to func_spec========================================================= int wcslen(string|int*); ==Edits to efuns.c=========================================================== #include <wchar.h> #include <wctype.h> /*-------------------------------------------------------------------------*/ svalue_t * f_wcslen (svalue_t * sp) /* EFUN wcslen() * * int wcslen(string str|int *wchars) * * Returns the number of wide characters in a string or array of wide characters */ { size_t wcdest_len; wcdest_len=0; if (sp->type == T_STRING) { size_t orig_len, len; wchar_t *wcdest; char *orig_txt, *tmp_txt, **orig_txt_ptr; orig_len=mstrsize(sp->u.str); orig_txt=get_txt(sp->u.str); orig_txt_ptr=xalloc(sizeof(char *)); wcdest=xalloc((orig_len+1)*sizeof(wchar_t)); memset(wcdest,0,(orig_len+1)*sizeof(wchar_t)); len=0; tmp_txt=orig_txt; *orig_txt_ptr=orig_txt; while(len<orig_len) { wcdest_len+=mbsrtowcs(wcdest+wcdest_len, (const char **)orig_txt_ptr, orig_len-len, (mbstate_t *)NULL); len+=strlen(tmp_txt); if(len<orig_len) { len++; wcdest_len++; tmp_txt=orig_txt+len; *orig_txt_ptr=tmp_txt; } } xfree(wcdest); xfree(orig_txt_ptr); free_string_svalue(sp); put_number(sp, (p_int)wcdest_len); } else if(sp->type == T_POINTER) { wcdest_len=VEC_SIZE(sp->u.vec); free_svalue(sp); put_number(sp,wcdest_len); } return sp; } /* f_wcslen() */ | ||||
Tags | No tags attached. | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
2006-01-06 19:36 |
|
New Issue | |
2006-01-06 19:47 |
|
Note Added: 0000464 | |
2008-07-02 01:15 | Gnomi | Project | LDMud => LDMud 3.5 |
2008-07-02 01:18 | Gnomi | Relationship added | child of 0000432 |
2019-09-24 08:26 | Gnomi | Assigned To | => Gnomi |
2019-09-24 08:26 | Gnomi | Status | new => closed |
2019-09-24 08:26 | Gnomi | Resolution | open => fixed |
2019-09-24 08:26 | Gnomi | Note Added: 0002481 |