]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/demo_forms.c
ncurses 5.9 - patch 20150321
[ncurses.git] / test / demo_forms.c
index 585ddb90275b176693eb71f5888ed54c6f7a3fec..97125e396e5fc0720069a08117ef9a6075588b32 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2003-2012,2013 Free Software Foundation, Inc.              *
+ * Copyright (c) 2003-2013,2014 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            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: demo_forms.c,v 1.45 2013/09/21 22:51:50 tom Exp $
+ * $Id: demo_forms.c,v 1.50 2014/10/10 00:38:00 tom Exp $
  *
  * Demonstrate a variety of functions from the form library.
  * Thomas Dickey - 2003/4/26
@@ -139,7 +139,7 @@ read_data(const char *filename)
        int more = 0;
        int item = 0;
 
-       my_data = typeCalloc(MY_DATA, 100);     /* FIXME */
+       my_data = typeCalloc(MY_DATA, (size_t) 100);    /* FIXME */
        while (fgets(buffer, sizeof(buffer), fp) != 0) {
            chomp(buffer);
            if (more) {
@@ -172,6 +172,7 @@ read_data(const char *filename)
                failed("expected a colon");
            }
        }
+       fclose(fp);
     } else {
        failed(filename);
     }
@@ -208,7 +209,7 @@ make_field(const char *label, int frow, int fcol, int rows, int cols)
        if (d_option) {
            if (has_colors()) {
                set_field_fore(f, (chtype) COLOR_PAIR(2));
-               set_field_back(f, A_UNDERLINE | COLOR_PAIR(3));
+               set_field_back(f, (A_UNDERLINE | (chtype) COLOR_PAIR(3)));
            } else {
                set_field_fore(f, A_BOLD);
            }
@@ -398,13 +399,13 @@ show_current_field(WINDOW *win, FORM * form)
        }
 
        waddch(win, ' ');
-       (void) wattrset(win, (int) field_fore(field));
+       (void) wattrset(win, AttrArg(field_fore(field), 0));
        waddstr(win, "fore");
        wattroff(win, (int) field_fore(field));
 
        waddch(win, '/');
 
-       (void) wattrset(win, (int) field_back(field));
+       (void) wattrset(win, AttrArg(field_back(field), 0));
        waddstr(win, "back");
        wattroff(win, (int) field_back(field));