]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/picsmap.c
ncurses 6.1 - patch 20180616
[ncurses.git] / test / picsmap.c
index 4e5b2634d2ca39f2f84a1a84e5941ed98b96ecfe..ad9a351b4504280c751ecb73e9c2fb6a964e7982 100644 (file)
@@ -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
  *
 
 #if HAVE_TSEARCH
 #include <search.h>
+#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) {