#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_screen.c,v 1.70 2015/03/29 00:16:00 tom Exp $")
+MODULE_ID("$Id: lib_screen.c,v 1.72 2015/03/29 15:25:29 tom Exp $")
#define MAX_SIZE 0x3fff /* 16k is big enough for a window or pad */
T(("decode_chtype '%s'", source));
source = decode_attr(source, &attr, &color);
source = decode_char(source, &value);
- *target = ChCharOf(value) | attr | COLOR_PAIR(color);
+ *target = (ChCharOf(value) | attr | (chtype) COLOR_PAIR(color));
/* FIXME - ignore combining characters */
return source;
}
attr_t attr = fillin->attr;
wchar_t chars[CCHARW_MAX];
int append = 0;
+ int value = 0;
T(("decode_cchar '%s'", source));
*target = blank;
#endif
source = decode_attr(source, &attr, &color);
memset(chars, 0, sizeof(chars));
- source = decode_char(source, &chars[0]);
+ source = decode_char(source, &value);
+ chars[0] = (wchar_t) value;
/* handle combining characters */
while (source[0] == MARKER && source[1] == APPEND) {
- int value;
source += 2;
source = decode_char(source, &value);
if (append++ < CCHARW_MAX) {
- chars[append] = value;
+ chars[append] = (wchar_t) value;
}
}
setcchar(target, chars, attr, (short) color, NULL);
}
#endif
for (n = 0; n < SIZEOF(source->chars); ++n) {
- if (source->chars[n] == 0)
+ unsigned uch = source->chars[n];
+ if (uch == 0)
continue;
if (n) {
*target++ = MARKER;
*target++ = APPEND;
}
*target++ = MARKER;
- if (source->chars[n] > 0xffff) {
- sprintf(target, "U%08x", source->chars[n]);
- } else if (source->chars[n] > 0xff) {
- sprintf(target, "u%04x", source->chars[n]);
- } else if (source->chars[n] < 32 || source->chars[n] >= 127) {
- sprintf(target, "%03o", source->chars[n] & 0xff);
+ if (uch > 0xffff) {
+ sprintf(target, "U%08x", uch);
+ } else if (uch > 0xff) {
+ sprintf(target, "u%04x", uch);
+ } else if (uch < 32 || uch >= 127) {
+ sprintf(target, "%03o", uch & 0xff);
} else {
- switch (source->chars[n]) {
+ switch (uch) {
case ' ':
strcpy(target, "s");
break;
*target = '\0';
break;
default:
- sprintf(--target, "%c", source->chars[n]);
+ sprintf(--target, "%c", uch);
break;
}
}