X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftrace%2Flib_traceatr.c;h=6bbcc6230d114cac346d03ffb2cee79fa4b60003;hp=02560403f92def9d2be4e648deebcfe830027694;hb=d1a026123ac051716cdc16278345c1fb5c843b79;hpb=582d14ba03080cfa0bd9c745fbae8c21089bc936 diff --git a/ncurses/trace/lib_traceatr.c b/ncurses/trace/lib_traceatr.c index 02560403..6bbcc623 100644 --- a/ncurses/trace/lib_traceatr.c +++ b/ncurses/trace/lib_traceatr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2011 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 * @@ -43,7 +43,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_traceatr.c,v 1.67 2009/11/21 23:06:40 tom Exp $") +MODULE_ID("$Id: lib_traceatr.c,v 1.75 2011/05/28 22:56:56 tom Exp $") #define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name)) @@ -132,11 +132,11 @@ _traceattr2(int bufnum, chtype newmode) for (n = 0; n < SIZEOF(names); n++) { if ((newmode & names[n].val) != 0) { if (result[1] != '\0') - result = _nc_trace_bufcat(bufnum, "|"); + (void) _nc_trace_bufcat(bufnum, "|"); result = _nc_trace_bufcat(bufnum, names[n].name); if (names[n].val == A_COLOR) { - short pairnum = PAIR_NUMBER(newmode); + short pairnum = (short) PairNumber(newmode); #ifdef USE_TERMLIB /* pair_content lives in libncurses */ (void) sprintf(temp, "{%d}", pairnum); @@ -176,6 +176,14 @@ _traceattr(attr_t newmode) } /* Trace 'int' return-values */ +NCURSES_EXPORT(int) +_nc_retrace_int_attr_t(attr_t code) +{ + T((T_RETURN("%s"), _traceattr(code))); + return (int) code; +} + +/* Trace 'attr_t' return-values */ NCURSES_EXPORT(attr_t) _nc_retrace_attr_t(attr_t code) { @@ -235,20 +243,20 @@ _nc_altcharset_name(attr_t attr, chtype ch) #if NCURSES_SP_FUNCS (void) sp; #endif - if ((attr & A_ALTCHARSET) && (acs_chars != 0)) { + if (SP_PARM != 0 && (attr & A_ALTCHARSET) && (acs_chars != 0)) { char *cp; char *found = 0; const ALT_NAMES *strp; for (cp = acs_chars; cp[0] && cp[1]; cp += 2) { - if (ChCharOf(cp[1]) == ChCharOf(ch)) { + if (ChCharOf(UChar(cp[1])) == ChCharOf(ch)) { found = cp; /* don't exit from loop - there may be redefinitions */ } } if (found != 0) { - ch = ChCharOf(*found); + ch = ChCharOf(UChar(*found)); for (strp = names; strp->val; strp++) if (strp->val == ch) { result = strp->name; @@ -325,9 +333,12 @@ _tracecchar_t2(int bufnum, const cchar_t *ch) (void) _nc_trace_bufcat(bufnum, "{ "); for (PUTC_i = 0; PUTC_i < CCHARW_MAX; ++PUTC_i) { PUTC_ch = ch->chars[PUTC_i]; - if (PUTC_ch == L'\0') + if (PUTC_ch == L'\0') { + if (PUTC_i == 0) + (void) _nc_trace_bufcat(bufnum, "\\000"); break; - PUTC_n = wcrtomb(PUTC_buf, ch->chars[PUTC_i], &PUT_st); + } + PUTC_n = (int) wcrtomb(PUTC_buf, ch->chars[PUTC_i], &PUT_st); if (PUTC_n <= 0) { if (PUTC_ch != L'\0') { /* it could not be a multibyte sequence */