X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fpicsmap.c;h=ad9a351b4504280c751ecb73e9c2fb6a964e7982;hp=4e5b2634d2ca39f2f84a1a84e5941ed98b96ecfe;hb=78b0123661ebab93d5bd5345b89e6e76d6560ec0;hpb=073e4446d2def7ebf1f0ff4f124f0c8d4af0b788 diff --git a/test/picsmap.c b/test/picsmap.c index 4e5b2634..ad9a351b 100644 --- a/test/picsmap.c +++ b/test/picsmap.c @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: picsmap.c,v 1.118 2018/03/24 22:37:42 tom Exp $ + * $Id: picsmap.c,v 1.123 2018/06/16 22:55:45 tom Exp $ * * Author: Thomas E. Dickey * @@ -61,6 +61,10 @@ #if HAVE_TSEARCH #include +#if HAVE_TDESTROY && !defined(_GNU_SOURCE) +#undef HAVE_TDESTROY +#define HAVE_TDESTROY 0 +#endif #endif #undef CUR /* use only the curses interface */ @@ -584,6 +588,7 @@ read_palette(const char *filename) strcpy(s, filename); if (tries & 4) { char *t = s; + char *tc; int num; char chr; int found = 0; @@ -591,7 +596,8 @@ read_palette(const char *filename) if (*t == '-') { if (sscanf(t, "-%d%c", &num, &chr) == 2 && chr == 'c' && - !(strncmp) (strchr(t, chr), "color", 5)) { + (tc = strchr(t, chr)) != 0 && + !(strncmp) (tc, "color", 5)) { found = 1; } break; @@ -1009,6 +1015,8 @@ parse_xbm(char **data) } else if ((t = strstr(buf, "_height")) != 0) { state |= 2; result->high = (short) num; + } else { + break; } *t = '\0'; if (result->name) { @@ -1190,7 +1198,7 @@ parse_xpm(char **data) if (num_colors >= result->colors) { finish_c_values(result); state = 4; - if (list != 0 && list[0] == 0) + if (list[0] == 0) list[0] = strdup("\033"); } break; @@ -1579,6 +1587,8 @@ report_colors(PICS_HEAD * pics) if (j < 10) ++digits; } + if (digits > 8) + digits = 8; logmsg("These colors were used:"); high = (pics->colors + wide - 1) / wide; for (j = 0; j < high && j < pics->colors; ++j) {