X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fhashtest.c;h=9a3300b26b9b64fda5d90e6212f07ef7deafcd62;hp=6e1b00b5785b7a55627608ec396741248c21b7ff;hb=19e522ff96ce25dbb06b42c6e7c7680ecb12a277;hpb=11ca5f62994c7a14c4e500510bd242e1e721f8be diff --git a/test/hashtest.c b/test/hashtest.c index 6e1b00b5..9a3300b2 100644 --- a/test/hashtest.c +++ b/test/hashtest.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * + * Copyright (c) 1998-2013,2017 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 * @@ -30,7 +30,7 @@ * * Generate timing statistics for vertical-motion optimization. * - * $Id: hashtest.c,v 1.29 2008/08/16 17:26:44 tom Exp $ + * $Id: hashtest.c,v 1.34 2017/09/30 15:42:53 tom Exp $ */ #include @@ -54,7 +54,7 @@ cleanup(void) endwin(); } -static RETSIGTYPE +static void finish(int sig GCC_UNUSED) { cleanup(); @@ -82,20 +82,21 @@ genlines(int base) move(0, 0); for (i = 0; i < head_lines; i++) for (j = 0; j < COLS; j++) - addch(UChar((j % 8 == 0) ? ('A' + j / 8) : '-')); + AddCh(UChar((j % 8 == 0) ? ('A' + j / 8) : '-')); move(head_lines, 0); for (i = head_lines; i < LINES - foot_lines; i++) { - chtype c = (base - LO_CHAR + i) % (HI_CHAR - LO_CHAR + 1) + LO_CHAR; + chtype c = (chtype) ((base - LO_CHAR + i) % (HI_CHAR - LO_CHAR + 1) + + LO_CHAR); int hi = (extend_corner || (i < LINES - 1)) ? COLS : COLS - 1; for (j = 0; j < hi; j++) - addch(c); + AddCh(c); } for (i = LINES - foot_lines; i < LINES; i++) { move(i, 0); for (j = 0; j < (extend_corner ? COLS : COLS - 1); j++) - addch(UChar((j % 8 == 0) ? ('A' + j / 8) : '-')); + AddCh(UChar((j % 8 == 0) ? ('A' + j / 8) : '-')); } scrollok(stdscr, TRUE); @@ -140,10 +141,10 @@ run_test(bool optimized GCC_UNUSED) #endif if (reverse_loops) - for (ch = hi; ch >= lo; ch--) + for (ch = (char) hi; ch >= lo; ch--) one_cycle(ch); else - for (ch = lo; ch <= hi; ch++) + for (ch = (char) lo; ch <= hi; ch++) one_cycle(ch); } @@ -224,9 +225,7 @@ main(int argc, char *argv[]) trace(TRACE_TIMES); #endif - CATCHALL(finish); /* arrange interrupts to terminate */ - - (void) initscr(); /* initialize the curses library */ + InitAndCatch(initscr(), finish); keypad(stdscr, TRUE); /* enable keyboard mapping */ (void) nonl(); /* tell curses not to do NL->CR/NL on output */ (void) cbreak(); /* take input chars one at a time, no wait for \n */