1# ncurses 6.1 - patch 20190824 - Thomas E. Dickey 2# 3# ------------------------------------------------------------------------------ 4# 5# Ncurses 6.1 is at 6# ftp.gnu.org:/pub/gnu 7# 8# Patches for ncurses 6.1 can be found at 9# ftp://ftp.invisible-island.net/ncurses/6.1 10# http://invisible-mirror.net/archives/ncurses/6.1 11# 12# ------------------------------------------------------------------------------ 13# ftp://ftp.invisible-island.net/ncurses/6.1/ncurses-6.1-20190824.patch.gz 14# patch by Thomas E. Dickey <dickey@invisible-island.net> 15# created Sun Aug 25 01:15:21 UTC 2019 16# ------------------------------------------------------------------------------ 17# NEWS | 5 +- 18# VERSION | 2 19# dist.mk | 4 - 20# package/debian-mingw/changelog | 4 - 21# package/debian-mingw64/changelog | 4 - 22# package/debian/changelog | 4 - 23# package/mingw-ncurses.nsi | 4 - 24# package/mingw-ncurses.spec | 2 25# package/ncurses.spec | 2 26# package/ncursest.spec | 2 27# test/demo_menus.c | 5 +- 28# test/demo_panels.c | 35 +++++++++------ 29# test/demo_termcap.c | 12 ++--- 30# test/demo_terminfo.c | 12 ++--- 31# test/dots.c | 16 +++--- 32# test/dots_curses.c | 16 +++--- 33# test/dots_mvcur.c | 16 +++--- 34# test/dots_termcap.c | 20 ++++---- 35# test/dots_xcurses.c | 14 ++---- 36# test/echochar.c | 14 +++--- 37# test/extended_color.c | 6 +- 38# test/filter.c | 6 +- 39# test/foldkeys.c | 14 +++--- 40# test/gdc.c | 10 ++-- 41# test/inch_wide.c | 7 +-- 42# test/inchs.c | 7 +-- 43# test/insdelln.c | 6 +- 44# test/knight.c | 28 +++++------- 45# test/list_keys.c | 14 +++--- 46# test/ncurses.c | 86 ++++++++++++++++++++----------------- 47# test/newdemo.c | 14 +++--- 48# test/pair_content.c | 4 - 49# test/picsmap.c | 35 +++++++++------ 50# test/railroad.c | 8 +-- 51# 34 files changed, 237 insertions(+), 201 deletions(-) 52# ------------------------------------------------------------------------------ 53Index: NEWS 54Prereq: 1.3364 55--- ncurses-6.1-20190817+/NEWS 2019-08-17 21:47:27.000000000 +0000 56+++ ncurses-6.1-20190824/NEWS 2019-08-24 23:16:29.000000000 +0000 57@@ -25,7 +25,7 @@ 58 -- sale, use or other dealings in this Software without prior written -- 59 -- authorization. -- 60 ------------------------------------------------------------------------------- 61--- $Id: NEWS,v 1.3364 2019/08/17 21:47:27 tom Exp $ 62+-- $Id: NEWS,v 1.3366 2019/08/24 23:16:29 tom Exp $ 63 ------------------------------------------------------------------------------- 64 65 This is a log of changes that ncurses has gone through since Zeyd started 66@@ -45,6 +45,9 @@ 67 Changes through 1.9.9e did not credit all contributions; 68 it is not possible to add this information. 69 70+20190824 71+ + fix some cppcheck warnings, mostly style, in ncurses test-programs. 72+ 73 20190817 74 + amend 20181208 changes for wbkgd() and wbkgrnd(), fixing a few 75 details where it still differed from SVr4. 76Index: VERSION 77--- ncurses-6.1-20190817+/VERSION 2019-08-17 13:26:39.000000000 +0000 78+++ ncurses-6.1-20190824/VERSION 2019-08-24 13:12:23.000000000 +0000 79@@ -1 +1 @@ 80-5:0:10 6.1 20190817 81+5:0:10 6.1 20190824 82Index: dist.mk 83Prereq: 1.1301 84--- ncurses-6.1-20190817+/dist.mk 2019-08-17 13:26:39.000000000 +0000 85+++ ncurses-6.1-20190824/dist.mk 2019-08-24 13:12:23.000000000 +0000 86@@ -25,7 +25,7 @@ 87 # use or other dealings in this Software without prior written # 88 # authorization. # 89 ############################################################################## 90-# $Id: dist.mk,v 1.1301 2019/08/17 13:26:39 tom Exp $ 91+# $Id: dist.mk,v 1.1302 2019/08/24 13:12:23 tom Exp $ 92 # Makefile for creating ncurses distributions. 93 # 94 # This only needs to be used directly as a makefile by developers, but 95@@ -37,7 +37,7 @@ 96 # These define the major/minor/patch versions of ncurses. 97 NCURSES_MAJOR = 6 98 NCURSES_MINOR = 1 99-NCURSES_PATCH = 20190817 100+NCURSES_PATCH = 20190824 101 102 # We don't append the patch to the version, since this only applies to releases 103 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) 104Index: package/debian-mingw/changelog 105--- ncurses-6.1-20190817+/package/debian-mingw/changelog 2019-08-17 13:26:39.000000000 +0000 106+++ ncurses-6.1-20190824/package/debian-mingw/changelog 2019-08-24 13:12:23.000000000 +0000 107@@ -1,8 +1,8 @@ 108-ncurses6 (6.1+20190817) unstable; urgency=low 109+ncurses6 (6.1+20190824) unstable; urgency=low 110 111 * latest weekly patch 112 113- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 17 Aug 2019 09:26:39 -0400 114+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 24 Aug 2019 09:12:23 -0400 115 116 ncurses6 (5.9-20131005) unstable; urgency=low 117 118Index: package/debian-mingw64/changelog 119--- ncurses-6.1-20190817+/package/debian-mingw64/changelog 2019-08-17 13:26:39.000000000 +0000 120+++ ncurses-6.1-20190824/package/debian-mingw64/changelog 2019-08-24 13:12:23.000000000 +0000 121@@ -1,8 +1,8 @@ 122-ncurses6 (6.1+20190817) unstable; urgency=low 123+ncurses6 (6.1+20190824) unstable; urgency=low 124 125 * latest weekly patch 126 127- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 17 Aug 2019 09:26:39 -0400 128+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 24 Aug 2019 09:12:23 -0400 129 130 ncurses6 (5.9-20131005) unstable; urgency=low 131 132Index: package/debian/changelog 133--- ncurses-6.1-20190817+/package/debian/changelog 2019-08-17 13:26:39.000000000 +0000 134+++ ncurses-6.1-20190824/package/debian/changelog 2019-08-24 13:12:23.000000000 +0000 135@@ -1,8 +1,8 @@ 136-ncurses6 (6.1+20190817) unstable; urgency=low 137+ncurses6 (6.1+20190824) unstable; urgency=low 138 139 * latest weekly patch 140 141- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 17 Aug 2019 09:26:39 -0400 142+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 24 Aug 2019 09:12:23 -0400 143 144 ncurses6 (5.9-20120608) unstable; urgency=low 145 146Index: package/mingw-ncurses.nsi 147Prereq: 1.347 148--- ncurses-6.1-20190817+/package/mingw-ncurses.nsi 2019-08-17 13:26:39.000000000 +0000 149+++ ncurses-6.1-20190824/package/mingw-ncurses.nsi 2019-08-24 13:12:23.000000000 +0000 150@@ -1,4 +1,4 @@ 151-; $Id: mingw-ncurses.nsi,v 1.347 2019/08/17 13:26:39 tom Exp $ 152+; $Id: mingw-ncurses.nsi,v 1.348 2019/08/24 13:12:23 tom Exp $ 153 154 ; TODO add examples 155 ; TODO bump ABI to 6 156@@ -10,7 +10,7 @@ 157 !define VERSION_MAJOR "6" 158 !define VERSION_MINOR "1" 159 !define VERSION_YYYY "2019" 160-!define VERSION_MMDD "0817" 161+!define VERSION_MMDD "0824" 162 !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} 163 164 !define MY_ABI "5" 165Index: package/mingw-ncurses.spec 166--- ncurses-6.1-20190817+/package/mingw-ncurses.spec 2019-08-17 13:26:39.000000000 +0000 167+++ ncurses-6.1-20190824/package/mingw-ncurses.spec 2019-08-24 13:12:23.000000000 +0000 168@@ -3,7 +3,7 @@ 169 Summary: shared libraries for terminal handling 170 Name: mingw32-ncurses6 171 Version: 6.1 172-Release: 20190817 173+Release: 20190824 174 License: X11 175 Group: Development/Libraries 176 Source: ncurses-%{version}-%{release}.tgz 177Index: package/ncurses.spec 178--- ncurses-6.1-20190817+/package/ncurses.spec 2019-08-17 13:26:39.000000000 +0000 179+++ ncurses-6.1-20190824/package/ncurses.spec 2019-08-24 13:12:23.000000000 +0000 180@@ -1,7 +1,7 @@ 181 Summary: shared libraries for terminal handling 182 Name: ncurses6 183 Version: 6.1 184-Release: 20190817 185+Release: 20190824 186 License: X11 187 Group: Development/Libraries 188 Source: ncurses-%{version}-%{release}.tgz 189Index: package/ncursest.spec 190--- ncurses-6.1-20190817+/package/ncursest.spec 2019-08-17 13:26:39.000000000 +0000 191+++ ncurses-6.1-20190824/package/ncursest.spec 2019-08-24 13:12:23.000000000 +0000 192@@ -1,7 +1,7 @@ 193 Summary: Curses library with POSIX thread support. 194 Name: ncursest6 195 Version: 6.1 196-Release: 20190817 197+Release: 20190824 198 License: X11 199 Group: Development/Libraries 200 Source: ncurses-%{version}-%{release}.tgz 201Index: test/demo_menus.c 202Prereq: 1.68 203--- ncurses-6.1-20190817+/test/demo_menus.c 2019-08-17 21:45:32.000000000 +0000 204+++ ncurses-6.1-20190824/test/demo_menus.c 2019-08-24 21:41:50.000000000 +0000 205@@ -26,7 +26,7 @@ 206 * authorization. * 207 ****************************************************************************/ 208 /* 209- * $Id: demo_menus.c,v 1.68 2019/08/17 21:45:32 tom Exp $ 210+ * $Id: demo_menus.c,v 1.69 2019/08/24 21:41:50 tom Exp $ 211 * 212 * Demonstrate a variety of functions from the menu library. 213 * Thomas Dickey - 2005/4/9 214@@ -586,13 +586,14 @@ 215 update_trace_menu(MENU * m) 216 { 217 ITEM **items; 218- ITEM *i, **p; 219+ ITEM *i; 220 bool changed = FALSE; 221 222 items = menu_items(m); 223 i = current_item(m); 224 if (i == items[0]) { 225 if (item_value(i)) { 226+ ITEM **p; 227 for (p = items + 1; *p != 0; p++) 228 if (item_value(*p)) { 229 set_item_value(*p, FALSE); 230Index: test/demo_panels.c 231Prereq: 1.42 232--- ncurses-6.1-20190817+/test/demo_panels.c 2018-05-20 19:21:18.000000000 +0000 233+++ ncurses-6.1-20190824/test/demo_panels.c 2019-08-24 23:11:01.000000000 +0000 234@@ -1,5 +1,5 @@ 235 /**************************************************************************** 236- * Copyright (c) 2007-2017,2018 Free Software Foundation, Inc. * 237+ * Copyright (c) 2007-2018,2019 Free Software Foundation, Inc. * 238 * * 239 * Permission is hereby granted, free of charge, to any person obtaining a * 240 * copy of this software and associated documentation files (the * 241@@ -26,7 +26,7 @@ 242 * authorization. * 243 ****************************************************************************/ 244 /* 245- * $Id: demo_panels.c,v 1.42 2018/05/20 19:21:18 tom Exp $ 246+ * $Id: demo_panels.c,v 1.43 2019/08/24 23:11:01 tom Exp $ 247 * 248 * Demonstrate a variety of functions from the panel library. 249 */ 250@@ -250,7 +250,6 @@ 251 static void 252 my_create_panel(PANEL **pans, int which, FillPanel myFill) 253 { 254- PANEL *pan = 0; 255 int code; 256 short pair = (short) which; 257 short fg = (short) ((pair == COLOR_BLUE) ? COLOR_WHITE : COLOR_BLACK); 258@@ -281,7 +280,10 @@ 259 if (code > 0) { 260 int tly = MIN(y0, y1); 261 int tlx = MIN(x0, x1); 262- pan = mkpanel(pair, ABS(y1 - y0) + 1, ABS(x1 - x0) + 1, tly, tlx); 263+ PANEL *pan = mkpanel(pair, 264+ ABS(y1 - y0) + 1, 265+ ABS(x1 - x0) + 1, 266+ tly, tlx); 267 /* finish */ 268 myFill(pan); 269 pans[which] = pan; 270@@ -465,7 +467,7 @@ 271 } 272 273 static void 274-show_panels(PANEL *px[MAX_PANELS + 1]) 275+show_help(WINDOW *win) 276 { 277 static const char *help[] = 278 { 279@@ -481,7 +483,17 @@ 280 " s - show the panel", 281 " t - put the panel on the top of the stack" 282 }; 283+ int j; 284+ 285+ for (j = 0; j < (int) SIZEOF(help); ++j) { 286+ if (wprintw(win, "%s\n", help[j]) == ERR) 287+ break; 288+ } 289+} 290 291+static void 292+show_panels(PANEL *px[MAX_PANELS + 1]) 293+{ 294 struct { 295 bool valid; 296 bool hidden; 297@@ -490,7 +502,6 @@ 298 } table[MAX_PANELS + 1]; 299 300 WINDOW *win; 301- PANEL *pan; 302 int j; 303 304 memset(table, 0, sizeof(table)); 305@@ -504,6 +515,8 @@ 306 } 307 308 if ((win = newwin(LINES - 1, COLS, 0, 0)) != 0) { 309+ PANEL *pan; 310+ 311 keypad(win, TRUE); 312 if ((pan = new_panel(win)) != 0) { 313 werase(win); 314@@ -527,10 +540,7 @@ 315 waddch(win, '\n'); 316 } 317 } 318- for (j = 0; j < (int) SIZEOF(help); ++j) { 319- if (wprintw(win, "%s\n", help[j]) == ERR) 320- break; 321- } 322+ show_help(win); 323 wgetch(win); 324 del_panel(pan); 325 pflush(); 326@@ -626,7 +636,6 @@ 327 { 328 int length = 0; 329 int y0, x0; 330- int c0, ch; 331 WINDOW *win; 332 333 getyx(stdscr, y0, x0); 334@@ -645,9 +654,9 @@ 335 } 336 (void) wgetch(win); 337 } else { 338- c0 = 0; 339+ int c0 = 0; 340 for (;;) { 341- ch = wgetch(win); 342+ int ch = wgetch(win); 343 if (ch == ERR || ch == QUIT || ch == ESCAPE) { 344 buffer[0] = '\0'; 345 break; 346Index: test/demo_termcap.c 347Prereq: 1.57 348--- ncurses-6.1-20190817+/test/demo_termcap.c 2019-01-21 22:50:46.000000000 +0000 349+++ ncurses-6.1-20190824/test/demo_termcap.c 2019-08-24 21:47:19.000000000 +0000 350@@ -29,7 +29,7 @@ 351 /* 352 * Author: Thomas E. Dickey 353 * 354- * $Id: demo_termcap.c,v 1.57 2019/01/21 22:50:46 tom Exp $ 355+ * $Id: demo_termcap.c,v 1.58 2019/08/24 21:47:19 tom Exp $ 356 * 357 * A simple demo of the termcap interface. 358 */ 359@@ -159,7 +159,8 @@ 360 db_item++; 361 } 362 } 363- printf("** %s\n", result); 364+ if (result != 0) 365+ printf("** %s\n", result); 366 return result; 367 } 368 369@@ -327,8 +328,6 @@ 370 static void 371 demo_termcap(NCURSES_CONST char *name) 372 { 373- unsigned n; 374- NCURSES_CONST char *cap; 375 char buffer[1024]; 376 377 if (db_list) { 378@@ -337,6 +336,8 @@ 379 if (!q_opt) 380 printf("Terminal type \"%s\"\n", name); 381 if (tgetent(buffer, name) >= 0) { 382+ NCURSES_CONST char *cap; 383+ unsigned n; 384 385 if (b_opt) { 386 for (n = 0;; ++n) { 387@@ -698,7 +699,6 @@ 388 size_t count; 389 size_t length = 1; 390 char **result = 0; 391- char *blob = 0; 392 char *unused = 0; 393 394 for (pass = 0; pass < 2; ++pass) { 395@@ -713,7 +713,7 @@ 396 } 397 } 398 if (pass == 0) { 399- blob = malloc(length); 400+ char *blob = malloc(length); 401 result = typeCalloc(char *, count + 1); 402 unused = blob; 403 if (blob == 0 || result == 0) 404Index: test/demo_terminfo.c 405Prereq: 1.48 406--- ncurses-6.1-20190817+/test/demo_terminfo.c 2017-11-24 20:49:11.000000000 +0000 407+++ ncurses-6.1-20190824/test/demo_terminfo.c 2019-08-24 23:11:01.000000000 +0000 408@@ -1,5 +1,5 @@ 409 /**************************************************************************** 410- * Copyright (c) 2009-2016,2017 Free Software Foundation, Inc. * 411+ * Copyright (c) 2009-2017,2019 Free Software Foundation, Inc. * 412 * * 413 * Permission is hereby granted, free of charge, to any person obtaining a * 414 * copy of this software and associated documentation files (the * 415@@ -29,7 +29,7 @@ 416 /* 417 * Author: Thomas E. Dickey 418 * 419- * $Id: demo_terminfo.c,v 1.48 2017/11/24 20:49:11 tom Exp $ 420+ * $Id: demo_terminfo.c,v 1.49 2019/08/24 23:11:01 tom Exp $ 421 * 422 * A simple demo of the terminfo interface. 423 */ 424@@ -150,7 +150,8 @@ 425 db_item++; 426 } 427 } 428- printf("** %s\n", result); 429+ if (result != 0) 430+ printf("** %s\n", result); 431 return result; 432 } 433 434@@ -362,7 +363,6 @@ 435 } 436 #ifdef NCURSES_VERSION 437 if (x_opt && (my_blob == 0)) { 438- int mod; 439 if (y_opt) { 440 #if NCURSES_XNAMES 441 TERMTYPE *term = (TERMTYPE *) cur_term; 442@@ -389,6 +389,7 @@ 443 "kLFT", "kNXT", "kPRV", "kRIT", "kUP", 444 }; 445 for (n = 0; n < SIZEOF(xterm_keys); ++n) { 446+ int mod; 447 for (mod = 0; mod < 8; ++mod) { 448 if (mod == 0) { 449 /* these happen to be standard - avoid duplicates */ 450@@ -728,7 +729,6 @@ 451 size_t count; 452 size_t length = 1; 453 char **result = 0; 454- char *blob = 0; 455 char *unused = 0; 456 457 for (pass = 0; pass < 2; ++pass) { 458@@ -743,7 +743,7 @@ 459 } 460 } 461 if (pass == 0) { 462- blob = malloc(length); 463+ char *blob = malloc(length); 464 result = typeCalloc(char *, count + 1); 465 unused = blob; 466 if (blob == 0 || result == 0) 467Index: test/dots.c 468Prereq: 1.34 469--- ncurses-6.1-20190817+/test/dots.c 2019-01-21 14:20:18.000000000 +0000 470+++ ncurses-6.1-20190824/test/dots.c 2019-08-24 21:49:50.000000000 +0000 471@@ -29,7 +29,7 @@ 472 /* 473 * Author: Thomas E. Dickey <dickey@clark.net> 1999 474 * 475- * $Id: dots.c,v 1.34 2019/01/21 14:20:18 tom Exp $ 476+ * $Id: dots.c,v 1.35 2019/08/24 21:49:50 tom Exp $ 477 * 478 * A simple demo of the terminfo interface. 479 */ 480@@ -136,7 +136,7 @@ 481 main(int argc, 482 char *argv[]) 483 { 484- int x, y, z, p; 485+ int ch; 486 double r; 487 double c; 488 int my_colors; 489@@ -146,8 +146,8 @@ 490 size_t need; 491 char *my_env; 492 493- while ((x = getopt(argc, argv, "T:efm:s:")) != -1) { 494- switch (x) { 495+ while ((ch = getopt(argc, argv, "T:efm:s:")) != -1) { 496+ switch (ch) { 497 case 'T': 498 need = 6 + strlen(optarg); 499 my_env = malloc(need); 500@@ -195,13 +195,13 @@ 501 started = time((time_t *) 0); 502 503 while (!interrupted) { 504- x = (int) (c * ranf()) + m_option; 505- y = (int) (r * ranf()) + m_option; 506- p = (ranf() > 0.9) ? '*' : ' '; 507+ int x = (int) (c * ranf()) + m_option; 508+ int y = (int) (r * ranf()) + m_option; 509+ int p = (ranf() > 0.9) ? '*' : ' '; 510 511 tputs(tparm3(cursor_address, y, x), 1, outc); 512 if (my_colors > 0) { 513- z = (int) (ranf() * my_colors); 514+ int z = (int) (ranf() * my_colors); 515 if (ranf() > 0.01) { 516 tputs(tparm2(set_a_foreground, z), 1, outc); 517 } else { 518Index: test/dots_curses.c 519Prereq: 1.14 520--- ncurses-6.1-20190817+/test/dots_curses.c 2019-01-21 14:20:18.000000000 +0000 521+++ ncurses-6.1-20190824/test/dots_curses.c 2019-08-24 21:50:35.000000000 +0000 522@@ -29,7 +29,7 @@ 523 /* 524 * Author: Thomas E. Dickey 525 * 526- * $Id: dots_curses.c,v 1.14 2019/01/21 14:20:18 tom Exp $ 527+ * $Id: dots_curses.c,v 1.15 2019/08/24 21:50:35 tom Exp $ 528 * 529 * A simple demo of the curses interface used for comparison with termcap. 530 */ 531@@ -113,7 +113,7 @@ 532 int 533 main(int argc, char *argv[]) 534 { 535- int x, y, z, p; 536+ int ch; 537 int fg, bg; 538 double r; 539 double c; 540@@ -125,8 +125,8 @@ 541 size_t need; 542 char *my_env; 543 544- while ((x = getopt(argc, argv, "T:dem:s:")) != -1) { 545- switch (x) { 546+ while ((ch = getopt(argc, argv, "T:dem:s:")) != -1) { 547+ switch (ch) { 548 case 'T': 549 need = 6 + strlen(optarg); 550 my_env = malloc(need); 551@@ -185,13 +185,13 @@ 552 fg = COLOR_WHITE; 553 bg = COLOR_BLACK; 554 while (!interrupted) { 555- x = (int) (c * ranf()) + m_option; 556- y = (int) (r * ranf()) + m_option; 557- p = (ranf() > 0.9) ? '*' : ' '; 558+ int x = (int) (c * ranf()) + m_option; 559+ int y = (int) (r * ranf()) + m_option; 560+ int p = (ranf() > 0.9) ? '*' : ' '; 561 562 move(y, x); 563 if (has_colors()) { 564- z = (int) (ranf() * COLORS); 565+ int z = (int) (ranf() * COLORS); 566 if (ranf() > 0.01) { 567 set_colors(fg = z, bg); 568 attron(COLOR_PAIR(mypair(fg, bg))); 569Index: test/dots_mvcur.c 570Prereq: 1.20 571--- ncurses-6.1-20190817+/test/dots_mvcur.c 2019-01-21 14:20:18.000000000 +0000 572+++ ncurses-6.1-20190824/test/dots_mvcur.c 2019-08-24 22:19:28.000000000 +0000 573@@ -29,7 +29,7 @@ 574 /* 575 * Author: Thomas E. Dickey - 2007 576 * 577- * $Id: dots_mvcur.c,v 1.20 2019/01/21 14:20:18 tom Exp $ 578+ * $Id: dots_mvcur.c,v 1.21 2019/08/24 22:19:28 tom Exp $ 579 * 580 * A simple demo of the terminfo interface, and mvcur. 581 */ 582@@ -138,7 +138,7 @@ 583 char *argv[]GCC_UNUSED) 584 { 585 int x0 = 1, y0 = 1; 586- int x, y, z, p; 587+ int ch; 588 double r; 589 double c; 590 SCREEN *sp; 591@@ -149,8 +149,8 @@ 592 size_t need; 593 char *my_env; 594 595- while ((x = getopt(argc, argv, "T:efm:s:")) != -1) { 596- switch (x) { 597+ while ((ch = getopt(argc, argv, "T:efm:s:")) != -1) { 598+ switch (ch) { 599 case 'T': 600 need = 6 + strlen(optarg); 601 my_env = malloc(need); 602@@ -205,9 +205,9 @@ 603 started = time((time_t *) 0); 604 605 while (!interrupted) { 606- x = (int) (c * ranf()) + m_option; 607- y = (int) (r * ranf()) + m_option; 608- p = (ranf() > 0.9) ? '*' : ' '; 609+ int x = (int) (c * ranf()) + m_option; 610+ int y = (int) (r * ranf()) + m_option; 611+ int p = (ranf() > 0.9) ? '*' : ' '; 612 613 if (mvcur(y0, x0, y, x) != ERR) { 614 x0 = x; 615@@ -215,7 +215,7 @@ 616 } 617 618 if (my_colors > 0) { 619- z = (int) (ranf() * my_colors); 620+ int z = (int) (ranf() * my_colors); 621 if (ranf() > 0.01) { 622 tputs(tparm2(set_a_foreground, z), 1, outc); 623 } else { 624Index: test/dots_termcap.c 625Prereq: 1.18 626--- ncurses-6.1-20190817+/test/dots_termcap.c 2019-01-21 14:20:18.000000000 +0000 627+++ ncurses-6.1-20190824/test/dots_termcap.c 2019-08-24 22:25:55.000000000 +0000 628@@ -29,7 +29,7 @@ 629 /* 630 * Author: Thomas E. Dickey 631 * 632- * $Id: dots_termcap.c,v 1.18 2019/01/21 14:20:18 tom Exp $ 633+ * $Id: dots_termcap.c,v 1.19 2019/08/24 22:25:55 tom Exp $ 634 * 635 * A simple demo of the termcap interface. 636 */ 637@@ -201,7 +201,7 @@ 638 int 639 main(int argc, char *argv[]) 640 { 641- int x, y, z, p; 642+ int ch; 643 int num_colors; 644 int num_lines; 645 int num_columns; 646@@ -216,8 +216,8 @@ 647 size_t need; 648 char *my_env; 649 650- while ((x = getopt(argc, argv, "T:em:s:")) != -1) { 651- switch (x) { 652+ while ((ch = getopt(argc, argv, "T:em:s:")) != -1) { 653+ switch (ch) { 654 case 'T': 655 need = 6 + strlen(optarg); 656 my_env = malloc(need); 657@@ -246,8 +246,8 @@ 658 659 srand((unsigned) time(0)); 660 661- InitAndCatch(z = tgetent(buffer, name), onsig); 662- if (z < 0) { 663+ InitAndCatch(ch = tgetent(buffer, name), onsig); 664+ if (ch < 0) { 665 fprintf(stderr, "terminal description not found\n"); 666 ExitProgram(EXIT_FAILURE); 667 } else { 668@@ -278,13 +278,13 @@ 669 started = time((time_t *) 0); 670 671 while (!interrupted) { 672- x = (int) (c * ranf()) + m_option; 673- y = (int) (r * ranf()) + m_option; 674- p = (ranf() > 0.9) ? '*' : ' '; 675+ int x = (int) (c * ranf()) + m_option; 676+ int y = (int) (r * ranf()) + m_option; 677+ int p = (ranf() > 0.9) ? '*' : ' '; 678 679 tputs(tgoto(t_cm, x, y), 1, outc); 680 if (num_colors > 0) { 681- z = (int) (ranf() * num_colors); 682+ int z = (int) (ranf() * num_colors); 683 if (ranf() > 0.01) { 684 tputs(tgoto(t_AF, 0, z), 1, outc); 685 } else { 686Index: test/dots_xcurses.c 687Prereq: 1.17 688--- ncurses-6.1-20190817+/test/dots_xcurses.c 2019-01-21 14:20:18.000000000 +0000 689+++ ncurses-6.1-20190824/test/dots_xcurses.c 2019-08-24 22:31:43.000000000 +0000 690@@ -29,7 +29,7 @@ 691 /* 692 * Author: Thomas E. Dickey 693 * 694- * $Id: dots_xcurses.c,v 1.17 2019/01/21 14:20:18 tom Exp $ 695+ * $Id: dots_xcurses.c,v 1.18 2019/08/24 22:31:43 tom Exp $ 696 * 697 * A simple demo of the wide-curses interface used for comparison with termcap. 698 */ 699@@ -139,10 +139,8 @@ 700 int 701 main(int argc, char *argv[]) 702 { 703- int x, y, z, p; 704 int fg, bg, ch; 705 wchar_t wch[2]; 706- int pair; 707 double r; 708 double c; 709 #if HAVE_USE_DEFAULT_COLORS 710@@ -205,6 +203,7 @@ 711 { 712 for (fg = 0; fg < COLORS; fg++) { 713 for (bg = 0; bg < COLORS; bg++) { 714+ int pair; 715 if (interrupted) { 716 cleanup(); 717 ExitProgram(EXIT_FAILURE); 718@@ -224,16 +223,15 @@ 719 720 fg = COLOR_WHITE; 721 bg = COLOR_BLACK; 722- pair = 0; 723 wch[1] = 0; 724 while (!interrupted) { 725- x = (int) (c * ranf()) + m_option; 726- y = (int) (r * ranf()) + m_option; 727- p = (ranf() > 0.9) ? '*' : ' '; 728+ int x = (int) (c * ranf()) + m_option; 729+ int y = (int) (r * ranf()) + m_option; 730+ int p = (ranf() > 0.9) ? '*' : ' '; 731 732 move(y, x); 733 if (has_colors()) { 734- z = (int) (ranf() * COLORS); 735+ int z = (int) (ranf() * COLORS); 736 if (ranf() > 0.01) { 737 set_colors(fg = z, bg); 738 } else { 739Index: test/echochar.c 740Prereq: 1.18 741--- ncurses-6.1-20190817+/test/echochar.c 2017-10-18 23:04:52.000000000 +0000 742+++ ncurses-6.1-20190824/test/echochar.c 2019-08-24 23:11:01.000000000 +0000 743@@ -1,5 +1,5 @@ 744 /**************************************************************************** 745- * Copyright (c) 2006-2014,2017 Free Software Foundation, Inc. * 746+ * Copyright (c) 2006-2017,2019 Free Software Foundation, Inc. * 747 * * 748 * Permission is hereby granted, free of charge, to any person obtaining a * 749 * copy of this software and associated documentation files (the * 750@@ -26,7 +26,7 @@ 751 * authorization. * 752 ****************************************************************************/ 753 /* 754- * $Id: echochar.c,v 1.18 2017/10/18 23:04:52 tom Exp $ 755+ * $Id: echochar.c,v 1.19 2019/08/24 23:11:01 tom Exp $ 756 * 757 * Demonstrate the echochar function (compare to dots.c). 758 * Thomas Dickey - 2006/11/4 759@@ -81,7 +81,7 @@ 760 main(int argc GCC_UNUSED, 761 char *argv[]GCC_UNUSED) 762 { 763- int ch, x, y, z, p; 764+ int ch; 765 double r; 766 double c; 767 bool use_colors; 768@@ -121,13 +121,13 @@ 769 started = time((time_t *) 0); 770 771 while (!interrupted) { 772- x = (int) (c * ranf()) + 2; 773- y = (int) (r * ranf()) + 2; 774- p = (ranf() > 0.9) ? '*' : ' '; 775+ int x = (int) (c * ranf()) + 2; 776+ int y = (int) (r * ranf()) + 2; 777+ int p = (ranf() > 0.9) ? '*' : ' '; 778 779 move(y, x); 780 if (use_colors > 0) { 781- z = (int) (ranf() * COLORS); 782+ int z = (int) (ranf() * COLORS); 783 if (ranf() > 0.01) { 784 set_color(my_pairs, z, last_bg); 785 last_fg = z; 786Index: test/extended_color.c 787Prereq: 1.13 788--- ncurses-6.1-20190817+/test/extended_color.c 2019-01-21 14:59:34.000000000 +0000 789+++ ncurses-6.1-20190824/test/extended_color.c 2019-08-24 23:09:18.000000000 +0000 790@@ -26,7 +26,7 @@ 791 * authorization. * 792 ****************************************************************************/ 793 /* 794- * $Id: extended_color.c,v 1.13 2019/01/21 14:59:34 tom Exp $ 795+ * $Id: extended_color.c,v 1.14 2019/08/24 23:09:18 tom Exp $ 796 */ 797 798 #include <test.priv.h> 799@@ -209,8 +209,8 @@ 800 801 printw("Drawing soft-key tabs with pair 2\n"); 802 slk_attrset(A_BOLD); /* reverse-video is hard to see */ 803- i = if_opt_s(extended_slk_color_sp(sp, 2), 804- extended_slk_color(2)); 805+ (void) if_opt_s(extended_slk_color_sp(sp, 2), 806+ extended_slk_color(2)); 807 for (i = 1; i <= 8; ++i) { 808 char temp[80]; 809 _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "(SLK-%d)", i); 810Index: test/filter.c 811Prereq: 1.32 812--- ncurses-6.1-20190817+/test/filter.c 2017-09-28 23:40:39.000000000 +0000 813+++ ncurses-6.1-20190824/test/filter.c 2019-08-24 23:11:01.000000000 +0000 814@@ -1,5 +1,5 @@ 815 /**************************************************************************** 816- * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. * 817+ * Copyright (c) 1998-2017,2019 Free Software Foundation, Inc. * 818 * * 819 * Permission is hereby granted, free of charge, to any person obtaining a * 820 * copy of this software and associated documentation files (the * 821@@ -29,7 +29,7 @@ 822 /* 823 * Author: Thomas E. Dickey 1998 824 * 825- * $Id: filter.c,v 1.32 2017/09/28 23:40:39 tom Exp $ 826+ * $Id: filter.c,v 1.33 2019/08/24 23:11:01 tom Exp $ 827 * 828 * An example of the 'filter()' function in ncurses, this program prompts 829 * for commands and executes them (like a command shell). It illustrates 830@@ -100,7 +100,6 @@ 831 new_command(char *buffer, int length, int underline, bool clocked, bool polled) 832 { 833 int code = OK; 834- int limit; 835 836 if (polled) { 837 bool done = FALSE; 838@@ -113,6 +112,7 @@ 839 840 timeout(20); /* no one types 50CPS... */ 841 while (!done) { 842+ int limit; 843 int ch = getch(); 844 845 buffer[used] = '\0'; 846Index: test/foldkeys.c 847Prereq: 1.7 848--- ncurses-6.1-20190817+/test/foldkeys.c 2018-12-29 17:53:03.000000000 +0000 849+++ ncurses-6.1-20190824/test/foldkeys.c 2019-08-24 23:11:01.000000000 +0000 850@@ -1,5 +1,5 @@ 851 /**************************************************************************** 852- * Copyright (c) 2006-2017,2018 Free Software Foundation, Inc. * 853+ * Copyright (c) 2006-2018,2019 Free Software Foundation, Inc. * 854 * * 855 * Permission is hereby granted, free of charge, to any person obtaining a * 856 * copy of this software and associated documentation files (the * 857@@ -29,7 +29,7 @@ 858 /* 859 * Author: Thomas E. Dickey, 2006 860 * 861- * $Id: foldkeys.c,v 1.7 2018/12/29 17:53:03 tom Exp $ 862+ * $Id: foldkeys.c,v 1.8 2019/08/24 23:11:01 tom Exp $ 863 * 864 * Demonstrate a method for altering key definitions at runtime. 865 * 866@@ -53,10 +53,10 @@ 867 log_last_line(WINDOW *win) 868 { 869 FILE *fp; 870- int y, x, n; 871- char temp[256]; 872 873 if ((fp = fopen(MY_LOGFILE, "a")) != 0) { 874+ char temp[256]; 875+ int y, x, n; 876 int need = sizeof(temp) - 1; 877 if (need > COLS) 878 need = COLS; 879@@ -195,8 +195,7 @@ 880 { 881 int ch; 882 #if HAVE_GETTIMEOFDAY 883- int secs, msecs; 884- struct timeval current, previous; 885+ struct timeval previous; 886 #endif 887 888 if (newterm(0, stdout, stdin) == 0) { 889@@ -224,6 +223,9 @@ 890 const char *name = keyname(escaped ? (ch - MY_KEYS) : ch); 891 892 #if HAVE_GETTIMEOFDAY 893+ int secs, msecs; 894+ struct timeval current; 895+ 896 gettimeofday(¤t, 0); 897 secs = (int) (current.tv_sec - previous.tv_sec); 898 msecs = (int) ((current.tv_usec - previous.tv_usec) / 1000); 899Index: test/gdc.c 900Prereq: 1.51 901--- ncurses-6.1-20190817+/test/gdc.c 2017-09-30 18:10:05.000000000 +0000 902+++ ncurses-6.1-20190824/test/gdc.c 2019-08-24 23:11:01.000000000 +0000 903@@ -1,5 +1,5 @@ 904 /**************************************************************************** 905- * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. * 906+ * Copyright (c) 1998-2017,2019 Free Software Foundation, Inc. * 907 * * 908 * Permission is hereby granted, free of charge, to any person obtaining a * 909 * copy of this software and associated documentation files (the * 910@@ -33,7 +33,7 @@ 911 * modified 10-18-89 for curses (jrl) 912 * 10-18-89 added signal handling 913 * 914- * $Id: gdc.c,v 1.51 2017/09/30 18:10:05 tom Exp $ 915+ * $Id: gdc.c,v 1.52 2019/08/24 23:11:01 tom Exp $ 916 */ 917 918 #include <test.priv.h> 919@@ -86,7 +86,6 @@ 920 drawbox(bool scrolling) 921 { 922 chtype bottom[XLENGTH + 1]; 923- int n; 924 925 if (hascolor) 926 (void) attrset(AttrArg(COLOR_PAIR(PAIR_FRAMES), 0)); 927@@ -97,6 +96,7 @@ 928 929 MvAddCh(YBASE + YDEPTH, XBASE - 1, ACS_LLCORNER); 930 if ((mvinchnstr(YBASE + YDEPTH, XBASE, bottom, XLENGTH)) != ERR) { 931+ int n; 932 for (n = 0; n < XLENGTH; n++) { 933 if (!scrolling) 934 bottom[n] &= ~A_COLOR; 935@@ -251,9 +251,9 @@ 936 if (optind < argc) { 937 count = atoi(argv[optind++]); 938 assert(count >= 0); 939+ if (optind < argc) 940+ usage(); 941 } 942- if (optind < argc) 943- usage(); 944 945 InitAndCatch({ 946 if (redirected) { 947Index: test/inch_wide.c 948Prereq: 1.9 949--- ncurses-6.1-20190817+/test/inch_wide.c 2017-04-29 22:03:21.000000000 +0000 950+++ ncurses-6.1-20190824/test/inch_wide.c 2019-08-24 23:11:01.000000000 +0000 951@@ -1,5 +1,5 @@ 952 /**************************************************************************** 953- * Copyright (c) 2007-2010,2017 Free Software Foundation, Inc. * 954+ * Copyright (c) 2007-2017,2019 Free Software Foundation, Inc. * 955 * * 956 * Permission is hereby granted, free of charge, to any person obtaining a * 957 * copy of this software and associated documentation files (the * 958@@ -26,7 +26,7 @@ 959 * authorization. * 960 ****************************************************************************/ 961 /* 962- * $Id: inch_wide.c,v 1.9 2017/04/29 22:03:21 tom Exp $ 963+ * $Id: inch_wide.c,v 1.10 2019/08/24 23:11:01 tom Exp $ 964 */ 965 /* 966 int in_wch(cchar_t *wcval); 967@@ -78,7 +78,6 @@ 968 int j; 969 int txt_x = 0, txt_y = 0; 970 int base_y; 971- int limit; 972 cchar_t ch; 973 cchar_t text[MAX_COLS]; 974 975@@ -122,6 +121,8 @@ 976 } 977 978 while (!Quit(j = mvwgetch(txtwin, txt_y, txt_x))) { 979+ int limit; 980+ 981 switch (j) { 982 case KEY_DOWN: 983 case 'j': 984Index: test/inchs.c 985Prereq: 1.16 986--- ncurses-6.1-20190817+/test/inchs.c 2017-09-06 09:20:42.000000000 +0000 987+++ ncurses-6.1-20190824/test/inchs.c 2019-08-24 23:11:01.000000000 +0000 988@@ -1,5 +1,5 @@ 989 /**************************************************************************** 990- * Copyright (c) 2007-2012,2017 Free Software Foundation, Inc. * 991+ * Copyright (c) 2007-2017,2019 Free Software Foundation, Inc. * 992 * * 993 * Permission is hereby granted, free of charge, to any person obtaining a * 994 * copy of this software and associated documentation files (the * 995@@ -26,7 +26,7 @@ 996 * authorization. * 997 ****************************************************************************/ 998 /* 999- * $Id: inchs.c,v 1.16 2017/09/06 09:20:42 tom Exp $ 1000+ * $Id: inchs.c,v 1.17 2019/08/24 23:11:01 tom Exp $ 1001 * 1002 * Author: Thomas E Dickey 1003 */ 1004@@ -87,7 +87,6 @@ 1005 int ch, j; 1006 int txt_x = 0, txt_y = 0; 1007 int base_y; 1008- int limit; 1009 chtype text[MAX_COLS]; 1010 1011 if (argv[level] == 0) { 1012@@ -132,6 +131,8 @@ 1013 } 1014 1015 while (!Quit(j = mvwgetch(txtwin, txt_y, txt_x))) { 1016+ int limit; 1017+ 1018 switch (j) { 1019 case KEY_DOWN: 1020 case 'j': 1021Index: test/insdelln.c 1022Prereq: 1.12 1023--- ncurses-6.1-20190817+/test/insdelln.c 2017-09-07 08:24:24.000000000 +0000 1024+++ ncurses-6.1-20190824/test/insdelln.c 2019-08-24 23:11:01.000000000 +0000 1025@@ -1,5 +1,5 @@ 1026 /**************************************************************************** 1027- * Copyright (c) 2008-2014,2017 Free Software Foundation, Inc. * 1028+ * Copyright (c) 2008-2017,2019 Free Software Foundation, Inc. * 1029 * * 1030 * Permission is hereby granted, free of charge, to any person obtaining a * 1031 * copy of this software and associated documentation files (the * 1032@@ -26,7 +26,7 @@ 1033 * authorization. * 1034 ****************************************************************************/ 1035 /* 1036- * $Id: insdelln.c,v 1.12 2017/09/07 08:24:24 tom Exp $ 1037+ * $Id: insdelln.c,v 1.13 2019/08/24 23:11:01 tom Exp $ 1038 * 1039 * test-driver for deleteln, wdeleteln, insdelln, winsdelln, insertln, winsertln 1040 */ 1041@@ -70,10 +70,10 @@ 1042 }; 1043 /* *INDENT-ON* */ 1044 1045- static bool first = TRUE; 1046 const char *result = 0; 1047 1048 if (has_colors()) { 1049+ static bool first = TRUE; 1050 if (first) { 1051 unsigned n; 1052 1053Index: test/knight.c 1054Prereq: 1.45 1055--- ncurses-6.1-20190817+/test/knight.c 2019-04-20 20:34:55.000000000 +0000 1056+++ ncurses-6.1-20190824/test/knight.c 2019-08-24 22:40:52.000000000 +0000 1057@@ -33,7 +33,7 @@ 1058 * Eric S. Raymond <esr@snark.thyrsus.com> July 22 1995. Mouse support 1059 * added September 20th 1995. 1060 * 1061- * $Id: knight.c,v 1.45 2019/04/20 20:34:55 tom Exp $ 1062+ * $Id: knight.c,v 1.46 2019/08/24 22:40:52 tom Exp $ 1063 */ 1064 1065 #include <test.priv.h> 1066@@ -328,21 +328,20 @@ 1067 static bool 1068 find_next_move(SQUARES squares, HISTORY * doneData, int doneSize, int *y, int *x) 1069 { 1070- unsigned j, k; 1071- int found = -1; 1072- int first = -1; 1073- int next = -1; 1074- int oldy, oldx; 1075- int newy, newx; 1076 bool result = FALSE; 1077 1078 if (doneSize > 1) { 1079- oldy = doneData[doneSize - 1].y; 1080- oldx = doneData[doneSize - 1].x; 1081+ unsigned j; 1082+ int oldy = doneData[doneSize - 1].y; 1083+ int oldx = doneData[doneSize - 1].x; 1084+ int found = -1; 1085+ int first = -1; 1086+ int next = -1; 1087+ 1088 for (j = 0; j < MAX_OFFSET * 2; j++) { 1089- k = j % MAX_OFFSET; 1090- newy = oldy + offsets[k].y; 1091- newx = oldx + offsets[k].x; 1092+ unsigned k = j % MAX_OFFSET; 1093+ int newy = oldy + offsets[k].y; 1094+ int newx = oldx + offsets[k].x; 1095 if (isUnusedYX(squares, newy, newx)) { 1096 if (first < 0) 1097 first = (int) k; 1098@@ -502,12 +501,11 @@ 1099 int result; 1100 1101 if (total < maxmoves) { 1102- int try_x, try_y; 1103 unsigned k; 1104 1105 for (k = 0; k < MAX_OFFSET; k++) { 1106- try_x = x + offsets[k].x; 1107- try_y = y + offsets[k].y; 1108+ int try_x = x + offsets[k].x; 1109+ int try_y = y + offsets[k].y; 1110 if (isUnusedYX(squares, try_y, try_x)) { 1111 ++test_test; 1112 squares[try_y][try_x] = total + 1; 1113Index: test/list_keys.c 1114Prereq: 1.24 1115--- ncurses-6.1-20190817+/test/list_keys.c 2018-05-20 18:56:56.000000000 +0000 1116+++ ncurses-6.1-20190824/test/list_keys.c 2019-08-24 23:11:01.000000000 +0000 1117@@ -1,5 +1,5 @@ 1118 /**************************************************************************** 1119- * Copyright (c) 2016-2017,2018 Free Software Foundation, Inc. * 1120+ * Copyright (c) 2016-2018,2019 Free Software Foundation, Inc. * 1121 * * 1122 * Permission is hereby granted, free of charge, to any person obtaining a * 1123 * copy of this software and associated documentation files (the * 1124@@ -26,7 +26,7 @@ 1125 * authorization. * 1126 ****************************************************************************/ 1127 /* 1128- * $Id: list_keys.c,v 1.24 2018/05/20 18:56:56 tom Exp $ 1129+ * $Id: list_keys.c,v 1.25 2019/08/24 23:11:01 tom Exp $ 1130 * 1131 * Author: Thomas E Dickey 1132 * 1133@@ -88,7 +88,6 @@ 1134 show_key(const char *name, bool show) 1135 { 1136 int width = 0; 1137- char buffer[10]; 1138 NCURSES_CONST char *value = tigetstr((NCURSES_CONST char *) name); 1139 1140 if (show && t_opt) 1141@@ -96,6 +95,7 @@ 1142 1143 if (value != 0 && value != (char *) -1) { 1144 while (*value != 0) { 1145+ char buffer[10]; 1146 int ch = UChar(*value++); 1147 switch (ch) { 1148 case '\177': 1149@@ -197,8 +197,8 @@ 1150 static void 1151 draw_line(int width) 1152 { 1153- int j; 1154 if (!t_opt) { 1155+ int j; 1156 for (j = 0; j < width; ++j) { 1157 printf("-"); 1158 } 1159@@ -285,8 +285,8 @@ 1160 } 1161 #if NCURSES_XNAMES 1162 if (x_opt) { 1163- TERMTYPE *term; 1164 for (k = 0; k < count; ++k) { 1165+ TERMTYPE *term; 1166 set_curterm(terms[k]); 1167 term = (TERMTYPE *) cur_term; 1168 total += (size_t) (NUM_STRINGS(term) - STRCOUNT); 1169@@ -305,9 +305,11 @@ 1170 } 1171 #if NCURSES_XNAMES 1172 if (x_opt) { 1173- TERMTYPE *term; 1174 int m, n; 1175+ 1176 for (k = 0; k < count; ++k) { 1177+ TERMTYPE *term; 1178+ 1179 set_curterm(terms[k]); 1180 term = (TERMTYPE *) cur_term; 1181 for (n = STRCOUNT; n < NUM_STRINGS(term); ++n) { 1182Index: test/ncurses.c 1183Prereq: 1.516 1184--- ncurses-6.1-20190817+/test/ncurses.c 2019-08-10 19:38:41.000000000 +0000 1185+++ ncurses-6.1-20190824/test/ncurses.c 2019-08-24 23:09:03.000000000 +0000 1186@@ -40,7 +40,7 @@ 1187 Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993 1188 Thomas E. Dickey (beginning revision 1.27 in 1996). 1189 1190-$Id: ncurses.c,v 1.516 2019/08/10 19:38:41 tom Exp $ 1191+$Id: ncurses.c,v 1.517 2019/08/24 23:09:03 tom Exp $ 1192 1193 ***************************************************************************/ 1194 1195@@ -226,7 +226,7 @@ 1196 static void 1197 wGetstring(WINDOW *win, char *buffer, int limit) 1198 { 1199- int y0, x0, x, ch; 1200+ int y0, x0, x; 1201 bool done = FALSE; 1202 1203 echo(); 1204@@ -235,6 +235,7 @@ 1205 1206 x = (int) strlen(buffer); 1207 while (!done) { 1208+ int ch; 1209 if (x > (int) strlen(buffer)) 1210 x = (int) strlen(buffer); 1211 wmove(win, y0, x0); 1212@@ -579,7 +580,6 @@ 1213 static void 1214 show_mouse(WINDOW *win) 1215 { 1216- int y, x; 1217 MEVENT event; 1218 bool outside; 1219 bool show_loc; 1220@@ -602,6 +602,7 @@ 1221 show_loc = wmouse_trafo(win, &event.y, &event.x, FALSE); 1222 1223 if (show_loc) { 1224+ int y, x; 1225 getyx(win, y, x); 1226 wmove(win, event.y, event.x); 1227 waddch(win, '*'); 1228@@ -818,7 +819,6 @@ 1229 { 1230 char buf[BUFSIZ]; 1231 int first_y, first_x; 1232- int c; 1233 int incount = 0; 1234 GetchFlags flags; 1235 1236@@ -832,6 +832,8 @@ 1237 scrollok(win, TRUE); 1238 1239 for (;;) { 1240+ int c; 1241+ 1242 while ((c = wGetchar(win)) == ERR) { 1243 incount++; 1244 if (blocking_getch(flags, delay)) { 1245@@ -1076,7 +1078,6 @@ 1246 wint_t c; 1247 int incount = 0; 1248 GetchFlags flags; 1249- int code; 1250 char *temp; 1251 1252 init_getch(win, flags, delay); 1253@@ -1089,6 +1090,8 @@ 1254 scrollok(win, TRUE); 1255 1256 for (;;) { 1257+ int code; 1258+ 1259 while ((code = wGet_wchar(win, &c)) == ERR) { 1260 incount++; 1261 if (blocking_getch(flags, delay)) { 1262@@ -1385,9 +1388,10 @@ 1263 { 1264 char save = attr_test_string[0]; 1265 int first = ((int) UChar(save)) + adjust; 1266- int j, k; 1267 1268 if (first >= ATTRSTRING_1ST) { 1269+ int j, k; 1270+ 1271 for (j = 0, k = first; j < MAX_ATTRSTRING; ++j, ++k) { 1272 if (k > ATTRSTRING_END) 1273 break; 1274@@ -1451,10 +1455,9 @@ 1275 werase(win); 1276 if (attr & A_ALTCHARSET) { 1277 const char *s; 1278- chtype ch; 1279 1280 for (s = attr_test_string; *s != '\0'; ++s) { 1281- ch = UChar(*s); 1282+ chtype ch = UChar(*s); 1283 (void) waddch(win, ch | attr); 1284 } 1285 } else { 1286@@ -1662,12 +1665,13 @@ 1287 NCURSES_COLOR_T bg = COLOR_BLACK; 1288 NCURSES_COLOR_T tx = -1; 1289 int ac = 0; 1290- unsigned j, k; 1291 WINDOW *my_wins[SIZEOF(attrs_to_test)]; 1292 ATTR_TBL my_list[SIZEOF(attrs_to_test)]; 1293 unsigned my_size = init_attr_list(my_list, termattrs()); 1294 1295 if (my_size > 1) { 1296+ unsigned j, k; 1297+ 1298 for (j = 0; j < my_size; ++j) { 1299 my_wins[j] = subwin(stdscr, 1300 1, LEN_ATTRSTRING, 1301@@ -1791,9 +1795,10 @@ 1302 { 1303 wchar_t save = wide_attr_test_string[0]; 1304 int first = ((int) normal_wchar(save)) + adjust; 1305- int j, k; 1306 1307 if (first >= ATTRSTRING_1ST) { 1308+ int j, k; 1309+ 1310 for (j = 0, k = first; j < MAX_ATTRSTRING; ++j, ++k) { 1311 if (k > ATTRSTRING_END) 1312 break; 1313@@ -1843,10 +1848,11 @@ 1314 attr_t attr; 1315 cchar_t ch; 1316 NCURSES_PAIRS_T pair; 1317- wchar_t wch[CCHARW_MAX]; 1318 1319 memset(&ch, 0, sizeof(ch)); 1320 if (getbkgrnd(&ch) != ERR) { 1321+ wchar_t wch[CCHARW_MAX]; 1322+ 1323 if (getcchar(&ch, wch, &attr, &pair, 0) != ERR) { 1324 result = attr; 1325 } 1326@@ -2022,12 +2028,13 @@ 1327 NCURSES_COLOR_T bg = COLOR_BLACK; 1328 NCURSES_COLOR_T tx = -1; 1329 int ac = 0; 1330- unsigned j, k; 1331 W_ATTR_TBL my_list[SIZEOF(w_attrs_to_test)]; 1332 WINDOW *my_wins[SIZEOF(w_attrs_to_test)]; 1333 unsigned my_size = init_w_attr_list(my_list, term_attrs()); 1334 1335 if (my_size > 1) { 1336+ unsigned j, k; 1337+ 1338 for (j = 0; j < my_size; ++j) { 1339 my_wins[j] = subwin(stdscr, 1340 1, LEN_ATTRSTRING, 1341@@ -2133,13 +2140,11 @@ 1342 int width = 8; 1343 1344 if (wide || zoom) { 1345- int have; 1346- 1347 _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) 1348 "%02d", color); 1349 if (wide) 1350 width = 4; 1351- if ((have = (int) strlen(temp)) >= width) { 1352+ if ((int) strlen(temp) >= width) { 1353 int pwr2 = 0; 1354 while ((1 << pwr2) < color) 1355 ++pwr2; 1356@@ -2516,7 +2521,7 @@ 1357 int base_row = 0; 1358 int grid_top = top + 3; 1359 int page_size = (LINES - grid_top); 1360- int pairs_max = (unsigned short) (-1); 1361+ int pairs_max; 1362 int colors_max = COLORS; 1363 int col_limit; 1364 int row_limit; 1365@@ -2839,14 +2844,16 @@ 1366 */ 1367 if (xterm_colors) { 1368 int n; 1369- int got; 1370 char result[BUFSIZ]; 1371 int check_n; 1372 unsigned check_r, check_g, check_b; 1373 1374 raw(); 1375 noecho(); 1376+ 1377 for (n = 0; n < MaxColors; ++n) { 1378+ int got; 1379+ 1380 fprintf(stderr, "\033]4;%d;?\007", n); 1381 got = (int) read(0, result, sizeof(result) - 1); 1382 if (got < 0) 1383@@ -3500,14 +3507,15 @@ 1384 char *temp = strdup(s); 1385 size_t used = strlen(temp); 1386 size_t want = SLKLEN; 1387- size_t test; 1388 #ifndef state_unused 1389 mbstate_t state; 1390 #endif 1391 1392 buf[0] = L'\0'; 1393 while (want > 0 && used != 0) { 1394+ size_t test; 1395 const char *base = s; 1396+ 1397 reset_mbytes(state); 1398 test = count_mbytes(base, 0, &state); 1399 if (test == (size_t) -1) { 1400@@ -3923,15 +3931,14 @@ 1401 static cchar_t * 1402 merge_wide_attr(cchar_t *dst, const cchar_t *src, attr_t attr, NCURSES_PAIRS_T pair) 1403 { 1404- int count; 1405 1406 *dst = *src; 1407 do { 1408+ int count; 1409 TEST_CCHAR(src, count, { 1410 attr |= (test_attrs & A_ALTCHARSET); 1411 setcchar(dst, test_wch, attr, pair, NULL); 1412- } 1413- , { 1414+ }, { 1415 ; 1416 }); 1417 } while (0); 1418@@ -4003,7 +4010,6 @@ 1419 wchar_t codes[10]; 1420 char tmp[80]; 1421 int count = repeat; 1422- int y, x; 1423 1424 _nc_SPRINTF(tmp, _nc_SLIMIT(sizeof(tmp)) 1425 "%3ld (0x%lx)", (long) code, (long) code); 1426@@ -4014,6 +4020,8 @@ 1427 setcchar(&temp, codes, attr, pair, 0); 1428 1429 do { 1430+ int y, x; 1431+ 1432 /* 1433 * Give non-spacing characters something to combine with. If we 1434 * don't, they'll bunch up in a heap on the space after the ":". 1435@@ -4653,13 +4661,15 @@ 1436 }; 1437 #undef DATA 1438 size_t n; 1439- int x; 1440 bool do_keypad = HaveKeypad(curp); 1441 bool do_scroll = HaveScroll(curp); 1442 char buf[BUFSIZ]; 1443 1444 move(LINES - 4, 0); 1445+ 1446 for (n = 0; n < SIZEOF(legend); n++) { 1447+ int x; 1448+ 1449 switch (legend[n].code) { 1450 default: 1451 _nc_STRCPY(buf, legend[n].msg, sizeof(buf)); 1452@@ -5003,7 +5013,7 @@ 1453 case CTRL('X'): /* resize window */ 1454 if (current) { 1455 pair *tmp, ul, lr; 1456- int i, mx, my; 1457+ int mx, my; 1458 1459 move(0, 0); 1460 clrtoeol(); 1461@@ -5032,11 +5042,13 @@ 1462 wclrtobot(current->wind); 1463 wmove(current->wind, lr.y, lr.x); 1464 } 1465- if (mx > tmp->x - ul.x) 1466+ if (mx > tmp->x - ul.x) { 1467+ int i; 1468 for (i = 0; i < my; i++) { 1469 wmove(current->wind, i, tmp->x - ul.x + 1); 1470 wclrtoeol(current->wind); 1471 } 1472+ } 1473 wnoutrefresh(current->wind); 1474 1475 memcpy(&lr, tmp, sizeof(pair)); 1476@@ -5850,13 +5862,13 @@ 1477 { 1478 static int count; 1479 static int last; 1480- int c; 1481 1482 if ((pending_pan = (count > 0)) != FALSE) { 1483 count--; 1484 pending_pan = (count != 0); 1485 } else { 1486 for (;;) { 1487+ int c; 1488 switch (c = wGetchar(win)) { 1489 case '!': 1490 ShellOut(FALSE); 1491@@ -6210,10 +6222,10 @@ 1492 tracetrace(unsigned tlevel) 1493 { 1494 static char *buf; 1495- static size_t need = 12; 1496 int n; 1497 1498 if (buf == 0) { 1499+ static size_t need = 12; 1500 for (n = 0; t_tbl[n].name != 0; n++) 1501 need += strlen(t_tbl[n].name) + 2; 1502 buf = typeMalloc(char, need); 1503@@ -6425,9 +6437,9 @@ 1504 size_t have = (source ? strlen(source) : 0) + 1; 1505 size_t need = 80 + have; 1506 char *temp = malloc(need); 1507- size_t len; 1508 1509 if (temp != 0) { 1510+ size_t len; 1511 _nc_STRNCPY(temp, source ? source : "", have + 1); 1512 len = (size_t) (char *) field_userptr(me); 1513 if (c <= KEY_MAX) { 1514@@ -6530,7 +6542,6 @@ 1515 1516 static int mode = REQ_INS_MODE; 1517 int c = wGetchar(w); 1518- unsigned n; 1519 FIELD *me = current_field(f); 1520 bool current = TRUE; 1521 1522@@ -6542,6 +6553,7 @@ 1523 } 1524 c = mode; 1525 } else { 1526+ unsigned n; 1527 for (n = 0; n < SIZEOF(lookup); n++) { 1528 if (lookup[n].code == c) { 1529 c = lookup[n].result; 1530@@ -6676,12 +6688,11 @@ 1531 static int 1532 form_test(bool recur GCC_UNUSED) 1533 { 1534- WINDOW *w; 1535 FORM *form; 1536 FIELD *f[12], *secure; 1537 FIELDTYPE *fty_middle = new_fieldtype(mi_field_check, mi_char_check); 1538 FIELDTYPE *fty_passwd = new_fieldtype(pw_field_check, pw_char_check); 1539- int finished = 0, c; 1540+ int c; 1541 unsigned n = 0; 1542 1543 #ifdef NCURSES_MOUSE_VERSION 1544@@ -6731,6 +6742,8 @@ 1545 f[n] = (FIELD *) 0; 1546 1547 if ((form = new_form(f)) != 0) { 1548+ WINDOW *w; 1549+ int finished = 0; 1550 1551 display_form(form); 1552 1553@@ -7024,11 +7037,8 @@ 1554 static int 1555 overlap_help(int state, int flavors[OVERLAP_FLAVORS]) 1556 { 1557- int row; 1558- int col; 1559 int item; 1560 int limit[OVERLAP_FLAVORS]; 1561- const char *ths, *tht; 1562 char msg[80]; 1563 1564 if (state < 0) 1565@@ -7037,10 +7047,10 @@ 1566 assert(state >= 0 && state < OVERLAP_FLAVORS); 1567 1568 for (item = 0; item < (2 * OVERLAP_FLAVORS); ++item) { 1569- row = item / 2; 1570- col = item % 2; 1571- ths = col ? "B" : "A"; 1572- tht = col ? "A" : "B"; 1573+ int row = item / 2; 1574+ int col = item % 2; 1575+ const char *ths = col ? "B" : "A"; 1576+ const char *tht = col ? "A" : "B"; 1577 1578 switch ((otBASE) row) { 1579 case otBASE_refresh: 1580Index: test/newdemo.c 1581Prereq: 1.45 1582--- ncurses-6.1-20190817+/test/newdemo.c 2017-09-30 15:43:08.000000000 +0000 1583+++ ncurses-6.1-20190824/test/newdemo.c 2019-08-24 23:02:49.000000000 +0000 1584@@ -2,7 +2,7 @@ 1585 * newdemo.c - A demo program using PDCurses. The program illustrate 1586 * the use of colours for text output. 1587 * 1588- * $Id: newdemo.c,v 1.45 2017/09/30 15:43:08 tom Exp $ 1589+ * $Id: newdemo.c,v 1.46 2019/08/24 23:02:49 tom Exp $ 1590 */ 1591 1592 #include <test.priv.h> 1593@@ -61,11 +61,12 @@ 1594 WaitForUser(WINDOW *win) 1595 { 1596 time_t t; 1597- chtype key; 1598 1599 nodelay(win, TRUE); 1600 t = time((time_t *) 0); 1601+ 1602 while (1) { 1603+ chtype key; 1604 if ((int) (key = (chtype) wgetch(win)) != ERR) { 1605 if (key == 'q' || key == 'Q') 1606 return 1; 1607@@ -221,12 +222,10 @@ 1608 main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) 1609 { 1610 WINDOW *win; 1611- int w, x, y, i, j, k; 1612+ int x, y, i, k; 1613 char buffer[SIZEOF(messages) * 80]; 1614- const char *message; 1615 int width, height; 1616 chtype save[80]; 1617- chtype c; 1618 1619 setlocale(LC_ALL, ""); 1620 1621@@ -244,6 +243,11 @@ 1622 } 1623 1624 while (1) { 1625+ int w; 1626+ int j; 1627+ chtype c; 1628+ const char *message; 1629+ 1630 set_colors(win, 1, COLOR_WHITE, COLOR_BLUE); 1631 werase(win); 1632 1633Index: test/pair_content.c 1634Prereq: 1.12 1635--- ncurses-6.1-20190817+/test/pair_content.c 2019-01-21 01:05:22.000000000 +0000 1636+++ ncurses-6.1-20190824/test/pair_content.c 2019-08-24 23:02:49.000000000 +0000 1637@@ -26,7 +26,7 @@ 1638 * authorization. * 1639 ****************************************************************************/ 1640 /* 1641- * $Id: pair_content.c,v 1.12 2019/01/21 01:05:22 tom Exp $ 1642+ * $Id: pair_content.c,v 1.13 2019/08/24 23:02:49 tom Exp $ 1643 */ 1644 1645 #define NEED_TIME_H 1646@@ -237,7 +237,6 @@ 1647 main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) 1648 { 1649 int i; 1650- int repeat; 1651 1652 while ((i = getopt(argc, argv, "f:il:npr:sx")) != -1) { 1653 switch (i) { 1654@@ -291,6 +290,7 @@ 1655 } 1656 } 1657 } else { 1658+ int repeat; 1659 1660 for (repeat = 0; repeat < r_opt; ++repeat) { 1661 run_test(); 1662Index: test/picsmap.c 1663Prereq: 1.129 1664--- ncurses-6.1-20190817+/test/picsmap.c 2019-04-20 20:33:51.000000000 +0000 1665+++ ncurses-6.1-20190824/test/picsmap.c 2019-08-24 23:07:34.000000000 +0000 1666@@ -26,7 +26,7 @@ 1667 * authorization. * 1668 ****************************************************************************/ 1669 /* 1670- * $Id: picsmap.c,v 1.129 2019/04/20 20:33:51 tom Exp $ 1671+ * $Id: picsmap.c,v 1.130 2019/08/24 23:07:34 tom Exp $ 1672 * 1673 * Author: Thomas E. Dickey 1674 * 1675@@ -430,9 +430,7 @@ 1676 if (is_file(filename, &sb)) { 1677 size_t size = (size_t) sb.st_size; 1678 char *blob = typeCalloc(char, size + 1); 1679- bool had_line = TRUE; 1680 bool binary = FALSE; 1681- unsigned j; 1682 unsigned k = 0; 1683 1684 result = typeCalloc(char *, size + 1); 1685@@ -442,7 +440,11 @@ 1686 FILE *fp = fopen(filename, "r"); 1687 if (fp != 0) { 1688 logmsg("opened %s", filename); 1689+ 1690 if (fread(blob, sizeof(char), size, fp) == size) { 1691+ bool had_line = TRUE; 1692+ unsigned j; 1693+ 1694 for (j = 0; (size_t) j < size; ++j) { 1695 if (blob[j] == '\0' || 1696 (UChar(blob[j]) < 32 && 1697@@ -683,9 +685,9 @@ 1698 if ((power2 != COLORS) || ((shift % 3) != 0)) { 1699 if (all_colors == 0) { 1700 init_palette(getenv("TERM")); 1701- } 1702- if (all_colors == 0) { 1703- giveup("With %d colors, you need a palette-file", COLORS); 1704+ if (all_colors == 0) { 1705+ giveup("With %d colors, you need a palette-file", COLORS); 1706+ } 1707 } 1708 } 1709 } 1710@@ -876,7 +878,6 @@ 1711 arg1[cpp] = '\0'; 1712 result = 1; 1713 } else { 1714- char *t; 1715 const char *s = skip_cs(source); 1716 size_t have = strlen(source); 1717 1718@@ -884,6 +885,7 @@ 1719 memcpy(arg1, s, (size_t) cpp); 1720 s += cpp; 1721 while (*s++ == '\t') { 1722+ char *t; 1723 for (t = arg2; (*s != '\0') && strchr("\t\"", *s) == 0;) { 1724 if (*s == ' ') { 1725 s = skip_cs(s); 1726@@ -1333,9 +1335,9 @@ 1727 /* subsequent lines begin "col,row: (r,g,b,a) #RGB" */ 1728 int r, g, b, nocolor; 1729 unsigned check; 1730- int which, c; 1731 char *t; 1732 char *s = t = strchr(buffer, '#'); 1733+ 1734 if (s != 0) { 1735 /* after the "#RGB", there are differences - just ignore */ 1736 while (*s != '\0' && !isspace(UChar(*s))) 1737@@ -1347,6 +1349,8 @@ 1738 &col, &row, 1739 &r, &g, &b, &nocolor, 1740 &check)) { 1741+ int which, c; 1742+ 1743 if ((s - t) > 8) /* 6 hex digits vs 8 */ 1744 check /= 256; 1745 if (r > MaxRGB || 1746@@ -1474,7 +1478,6 @@ 1747 { 1748 int y, x; 1749 int n; 1750- int my_pair, my_color; 1751 1752 debugmsg("called show_picture"); 1753 logmsg("...using %dx%d screen", LINES, COLS); 1754@@ -1487,8 +1490,8 @@ 1755 if (has_colors()) { 1756 logmsg("...using %d colors", pics->colors); 1757 for (n = 0; n < pics->colors; ++n) { 1758- my_pair = (n + 1); 1759- my_color = map_color(fg_color(pics, n)); 1760+ int my_pair = (n + 1); 1761+ int my_color = map_color(fg_color(pics, n)); 1762 #if USE_EXTENDED_COLORS 1763 if (use_extended_pairs) { 1764 init_extended_pair(my_pair, my_color, my_color); 1765@@ -1507,7 +1510,10 @@ 1766 if (y >= LINES) 1767 break; 1768 move(y, 0); 1769+ 1770 for (x = 0; x < pics->wide; ++x) { 1771+ int my_pair; 1772+ 1773 if (x >= COLS) 1774 break; 1775 n = (y * pics->wide + x); 1776@@ -1557,11 +1563,9 @@ 1777 static void 1778 report_colors(PICS_HEAD * pics) 1779 { 1780- int j, k; 1781- int high; 1782- int wide = 4; 1783 int accum; 1784 double level; 1785+ int j; 1786 int shift; 1787 int total; 1788 char buffer[256]; 1789@@ -1575,6 +1579,8 @@ 1790 */ 1791 if (debugging && (pics->colors < 1000)) { 1792 int digits = 0; 1793+ int high; 1794+ int wide = 4; 1795 for (j = pics->colors; j != 0; j /= 10) { 1796 ++digits; 1797 if (j < 10) 1798@@ -1585,6 +1591,7 @@ 1799 logmsg("These colors were used:"); 1800 high = (pics->colors + wide - 1) / wide; 1801 for (j = 0; j < high && j < pics->colors; ++j) { 1802+ int k; 1803 char *s = buffer; 1804 *s = '\0'; 1805 for (k = 0; k < wide; ++k) { 1806Index: test/railroad.c 1807Prereq: 1.22 1808--- ncurses-6.1-20190817+/test/railroad.c 2017-09-30 17:55:22.000000000 +0000 1809+++ ncurses-6.1-20190824/test/railroad.c 2019-08-24 23:11:01.000000000 +0000 1810@@ -1,5 +1,5 @@ 1811 /**************************************************************************** 1812- * Copyright (c) 2000-2013,2017 Free Software Foundation, Inc. * 1813+ * Copyright (c) 2000-2017,2019 Free Software Foundation, Inc. * 1814 * * 1815 * Permission is hereby granted, free of charge, to any person obtaining a * 1816 * copy of this software and associated documentation files (the * 1817@@ -29,7 +29,7 @@ 1818 /* 1819 * Author: Thomas E. Dickey - 2000 1820 * 1821- * $Id: railroad.c,v 1.22 2017/09/30 17:55:22 tom Exp $ 1822+ * $Id: railroad.c,v 1.23 2019/08/24 23:11:01 tom Exp $ 1823 * 1824 * A simple demo of the termcap interface. 1825 */ 1826@@ -113,7 +113,7 @@ 1827 ShowSign(char *string) 1828 { 1829 char *base = string; 1830- int ch, first, last; 1831+ int first, last; 1832 1833 if (moveit != 0) { 1834 tputs(tgoto(moveit, 0, height - 1), 1, outc); 1835@@ -121,7 +121,7 @@ 1836 } 1837 1838 while (*string != 0) { 1839- ch = *string; 1840+ int ch = *string; 1841 if (ch != ' ') { 1842 if (moveit != 0) { 1843 for (first = length - 2; first >= (string - base); first--) { 1844