X-Git-Url: https://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=ncurses%2Fwidechar%2Flib_cchar.c;h=679dd7171626eb8447c9acd98f1011c6b968a00e;hb=4204d0154d2ee2d272807a0023d38ed9035ea555;hp=67b1aa4397b9f20ffa79ebf1f5c31571a0a45dcb;hpb=d1a026123ac051716cdc16278345c1fb5c843b79;p=ncurses.git diff --git a/ncurses/widechar/lib_cchar.c b/ncurses/widechar/lib_cchar.c index 67b1aa43..679dd717 100644 --- a/ncurses/widechar/lib_cchar.c +++ b/ncurses/widechar/lib_cchar.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2001-2010,2011 Free Software Foundation, Inc. * + * Copyright (c) 2001-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -35,7 +35,7 @@ #include -MODULE_ID("$Id: lib_cchar.c,v 1.22 2011/05/28 21:15:43 tom Exp $") +MODULE_ID("$Id: lib_cchar.c,v 1.26 2012/03/24 18:37:17 tom Exp $") /* * The SuSv2 description leaves some room for interpretation. We'll assume wch @@ -60,7 +60,7 @@ setcchar(cchar_t *wcval, if (opts != NULL || wch == NULL - || ((len = wcslen(wch)) > 1 && wcwidth(wch[0]) < 0)) { + || ((len = (unsigned) wcslen(wch)) > 1 && wcwidth(wch[0]) < 0)) { code = ERR; } else { if (len > CCHARW_MAX) @@ -80,7 +80,7 @@ setcchar(cchar_t *wcval, memset(wcval, 0, sizeof(*wcval)); if (len != 0) { - SetAttr(*wcval, attrs | (attr_t) ColorPair(color_pair)); + SetAttr(*wcval, attrs); SetPair(CHDEREF(wcval), color_pair); memcpy(&wcval->chars, wch, len * sizeof(wchar_t)); TR(TRACE_CCALLS, ("copy %d wchars, first is %s", len, @@ -111,7 +111,7 @@ getcchar(const cchar_t *wcval, opts)); if (opts == NULL && wcval != NULL) { - len = ((wp = wmemchr(wcval->chars, L'\0', CCHARW_MAX)) + len = ((wp = wmemchr(wcval->chars, L'\0', (size_t) CCHARW_MAX)) ? (int) (wp - wcval->chars) : CCHARW_MAX); @@ -126,7 +126,7 @@ getcchar(const cchar_t *wcval, } else if (len >= 0) { *attrs = AttrOf(*wcval) & A_ATTRIBUTES; *color_pair = (short) GetPair(*wcval); - wmemcpy(wch, wcval->chars, (unsigned) len); + wmemcpy(wch, wcval->chars, (size_t) len); wch[len] = L'\0'; code = OK; }