View Issue Details

IDProjectCategoryView StatusLast Update
0000438LDMud 3.5Efunspublic2019-09-24 08:23
Reporteriago3Assigned ToGnomi  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Summary0000438: Modified efun: capitalize()
Description==Edits to efuns.c===========================================================

#include <wchar.h>
#include <wctype.h>

    size_t orig_len;
    orig_len=mstrsize(sp->u.str);
    if(orig_len>0) {
        wchar_t *wcdest, **wcdest_ptr;
        char *orig_txt, *mbdest, **orig_txt_ptr;
        string_t *result;
        size_t len, fc_len;
        orig_txt=get_txt(sp->u.str);
        orig_txt_ptr=xalloc(sizeof(char *));
        *orig_txt_ptr=orig_txt;
        wcdest=xalloc((orig_len+1)*sizeof(wchar_t));
        wcdest_ptr=xalloc(sizeof(wchar_t *));
        *wcdest_ptr=wcdest;
        mbsrtowcs(wcdest,(const char **)orig_txt_ptr, orig_len, (mbstate_t *)NULL);
        memset(wcdest+sizeof(wchar_t),0,sizeof(wchar_t));
        fc_len=wcsrtombs(NULL,(const wchar_t **)wcdest_ptr,0,(mbstate_t *)NULL);
        if(iswlower(*wcdest)) *wcdest=towupper(*wcdest);
        len=wcsrtombs(NULL,(const wchar_t **)wcdest_ptr,0,(mbstate_t *)NULL);
        mbdest=malloc(len+1);
        memset(mbdest,0,len+1);
        wcsrtombs(mbdest,(const wchar_t **)wcdest_ptr,len,(mbstate_t *)NULL);
        result=mstring_new_n_string(mbdest,len);
        result=mstring_append_txt(result,orig_txt+fc_len,orig_len-fc_len);
        xfree(wcdest);
        xfree(orig_txt_ptr);
        xfree(wcdest_ptr);
        xfree(mbdest);
        free_string_svalue(sp);
        put_string(sp, result);
    }
    return sp;
TagsNo tags attached.

Relationships

child of 0000432 resolvedGnomi LDMud 3.6 Add string efuns with multibyte character support 

Activities

iago3

2006-01-06 19:49

reporter   ~0000469

Explainer: This bug is desinged to add support for multibyte character sets to string efuns, as designed in bug#432

Issue History

Date Modified Username Field Change
2006-01-06 19:43 iago3 New Issue
2006-01-06 19:49 iago3 Note Added: 0000469
2008-07-02 01:15 Gnomi Project LDMud => LDMud 3.5
2008-07-02 01:16 Gnomi Relationship added child of 0000432
2019-09-24 08:23 Gnomi Assigned To => Gnomi
2019-09-24 08:23 Gnomi Status new => closed
2019-09-24 08:23 Gnomi Resolution open => fixed