]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/ncurses.c
ncurses 5.7 - patch 20090829
[ncurses.git] / test / ncurses.c
index c99485b7b180e9e039569fed64f71dfcc67acd16..42670c31438eb15bc5a5ce2889ed3f08c70b6387 100644 (file)
@@ -40,7 +40,7 @@ AUTHOR
    Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
            Thomas E. Dickey (beginning revision 1.27 in 1996).
 
-$Id: ncurses.c,v 1.339 2009/04/04 22:46:11 juergen Exp $
+$Id: ncurses.c,v 1.345 2009/08/29 20:24:57 tom Exp $
 
 ***************************************************************************/
 
@@ -232,7 +232,7 @@ wGetstring(WINDOW *win, char *buffer, int limit)
 
     echo();
     getyx(win, y0, x0);
-    wattrset(win, A_REVERSE);
+    (void) wattrset(win, A_REVERSE);
 
     x = (int) strlen(buffer);
     while (!done) {
@@ -318,6 +318,7 @@ make_narrow_text(wchar_t *target, const char *source)
     *target = 0;
 }
 
+#if USE_LIBPANEL
 static void
 make_fullwidth_digit(cchar_t *target, int digit)
 {
@@ -327,6 +328,7 @@ make_fullwidth_digit(cchar_t *target, int digit)
     source[1] = 0;
     setcchar(target, source, A_NORMAL, 0, 0);
 }
+#endif
 
 static int
 wGet_wchar(WINDOW *win, wint_t *result)
@@ -363,7 +365,7 @@ wGet_wstring(WINDOW *win, wchar_t *buffer, int limit)
 
     echo();
     getyx(win, y0, x0);
-    wattrset(win, A_REVERSE);
+    (void) wattrset(win, A_REVERSE);
 
     x = (int) wcslen(buffer);
     while (!done) {
@@ -627,12 +629,12 @@ wgetch_help(WINDOW *win, GetchFlags flags)
        int flg = ((strstr(help[n], "toggle") != 0)
                   && (flags[UChar(*help[n])] != FALSE));
        if (flg)
-           standout();
+           (void) standout();
        mvprintw(row, col, "%s", help[n]);
        if (col == 0)
            clrtoeol();
        if (flg)
-           standend();
+           (void) standend();
     }
     wrefresh(stdscr);
     wmove(win, y, x);
@@ -674,7 +676,7 @@ remember_boxes(unsigned level, WINDOW *txt_win, WINDOW *box_win)
 {
     unsigned need = (level + 1) * 2;
 
-    assert(level < COLS);
+    assert(level < (unsigned) COLS);
 
     if (winstack == 0) {
        len_winstack = 20;
@@ -1356,7 +1358,7 @@ show_attr(int row, int skip, bool arrow, chtype attr, const char *name)
            addch(ch | attr);
        }
     } else {
-       attrset(attr);
+       (void) attrset(attr);
        addstr(attr_test_string);
        attroff(attr);
     }
@@ -2008,7 +2010,7 @@ color_test(void)
                    hello = numbered;
                }
                printw("%-*.*s", width, width, hello);
-               attrset(A_NORMAL);
+               (void) attrset(A_NORMAL);
 
                if ((i % per_row) == 0 && InxToFG(i) == min_colors) {
                    show_color_name(row, 0, InxToBG(i), opt_wide);
@@ -2393,9 +2395,9 @@ color_edit(void)
                     (i == current ? '>' : ' '),
                     (i < (int) SIZEOF(the_color_names)
                      ? the_color_names[i] : numeric));
-           attrset(COLOR_PAIR(i));
+           (void) attrset(COLOR_PAIR(i));
            addstr("        ");
-           attrset(A_NORMAL);
+           (void) attrset(A_NORMAL);
 
            color_content((short) i, &red, &green, &blue);
            addstr("   R = ");
@@ -2403,20 +2405,20 @@ color_edit(void)
                attron(A_STANDOUT);
            printw("%04d", red);
            if (current == i && field == 0)
-               attrset(A_NORMAL);
+               (void) attrset(A_NORMAL);
            addstr(", G = ");
            if (current == i && field == 1)
                attron(A_STANDOUT);
            printw("%04d", green);
            if (current == i && field == 1)
-               attrset(A_NORMAL);
+               (void) attrset(A_NORMAL);
            addstr(", B = ");
            if (current == i && field == 2)
                attron(A_STANDOUT);
            printw("%04d", blue);
            if (current == i && field == 2)
-               attrset(A_NORMAL);
-           attrset(A_NORMAL);
+               (void) attrset(A_NORMAL);
+           (void) attrset(A_NORMAL);
            printw(" ( %3d %3d %3d )",
                   scaled_rgb(red),
                   scaled_rgb(green),
@@ -2888,7 +2890,7 @@ cycle_attr(int ch, unsigned *at_code, chtype *attr)
            *at_code = 0;
        break;
     case 'V':
-       if (*at_code == 1)
+       if (*at_code == 0)
            *at_code = SIZEOF(attrs_to_cycle) - 1;
        else
            *at_code -= 1;
@@ -3239,21 +3241,18 @@ acs_display(void)
 static cchar_t *
 merge_wide_attr(cchar_t *dst, const cchar_t *src, attr_t attr, short pair)
 {
-    int count = getcchar(src, NULL, NULL, NULL, 0);
-    wchar_t *wch = 0;
-    attr_t ignore_attr;
-    short ignore_pair;
+    int count;
 
     *dst = *src;
-    if (count > 0) {
-       if ((wch = typeMalloc(wchar_t, (unsigned) count + 1)) != 0) {
-           if (getcchar(src, wch, &ignore_attr, &ignore_pair, 0) != ERR) {
-               attr |= (ignore_attr & A_ALTCHARSET);
-               setcchar(dst, wch, attr, pair, 0);
-           }
-           free(wch);
+    do {
+       TEST_CCHAR(src, count, {
+           attr |= (test_attrs & A_ALTCHARSET);
+           setcchar(dst, test_wch, attr, pair, NULL);
        }
-    }
+       , {
+           ;
+       });
+    } while (0);
     return dst;
 }
 
@@ -5038,7 +5037,7 @@ flushinp_test(WINDOW *win)
        wbkgd(subWin, COLOR_PAIR(2) | ' ');
     }
 #endif
-    wattrset(subWin, A_BOLD);
+    (void) wattrset(subWin, A_BOLD);
     box(subWin, ACS_VLINE, ACS_HLINE);
     mvwaddstr(subWin, 2, 1, "This is a subwindow");
     wrefresh(win);
@@ -5858,18 +5857,18 @@ overlap_test_1_attr(WINDOW *win, int flavor, int col)
 
     switch (flavor) {
     case 0:
-       wattrset(win, A_NORMAL);
+       (void) wattrset(win, A_NORMAL);
        break;
     case 1:
-       wattrset(win, A_BOLD);
+       (void) wattrset(win, A_BOLD);
        break;
     case 2:
        init_pair(cpair, COLOR_BLUE, COLOR_WHITE);
-       wattrset(win, COLOR_PAIR(cpair) | A_NORMAL);
+       (void) wattrset(win, COLOR_PAIR(cpair) | A_NORMAL);
        break;
     case 3:
        init_pair(cpair, COLOR_WHITE, COLOR_BLUE);
-       wattrset(win, COLOR_PAIR(cpair) | A_BOLD);
+       (void) wattrset(win, COLOR_PAIR(cpair) | A_BOLD);
        break;
     }
 }
@@ -5974,7 +5973,7 @@ overlap_help(int state, int flavors[OVERLAP_FLAVORS])
            break;
        }
        overlap_helpitem(state, item, msg);
-       wattrset(stdscr, A_NORMAL);
+       (void) wattrset(stdscr, A_NORMAL);
        wbkgdset(stdscr, ' ' | A_NORMAL);
     }
     move(LINES - 1, 0);
@@ -5999,7 +5998,7 @@ overlap_test_1(int flavor, int col, WINDOW *a, char fill)
 {
     overlap_test_1_attr(a, flavor, col);
     fillwin(a, fill);
-    wattrset(a, A_NORMAL);
+    (void) wattrset(a, A_NORMAL);
 }
 
 static void
@@ -6581,7 +6580,7 @@ main(int argc, char *argv[])
            min_colors = -1;
        }
 #if NCURSES_VERSION_PATCH >= 20000708
-       else if (assumed_colors)
+       if (assumed_colors)
            assume_default_colors(default_fg, default_bg);
 #endif
 #endif