]> granicus.if.org Git - nethack/commitdiff
Fix X11 warnings
authorDean Luick <dean@nethack.org>
Mon, 18 Jan 2021 00:17:13 +0000 (18:17 -0600)
committerDean Luick <dean@nethack.org>
Fri, 29 Jan 2021 03:12:06 +0000 (21:12 -0600)
include/winX.h
win/X11/winX.c
win/X11/winmap.c
win/X11/winmisc.c

index 79a11f66700b01d5bf2b4fda1c63a93e69e8e49e..97375fae2e8ec0358240055c933d304b33b9ee8a 100644 (file)
@@ -327,7 +327,7 @@ extern void get_widget_window_geometry(Widget, int *, int *, int *, int *);
 extern char *fontname_boldify(const char *);
 extern Dimension nhFontHeight(Widget);
 extern char key_event_to_char(XKeyEvent *);
-extern void msgkey(Widget, XtPointer, XEvent *);
+extern void msgkey(Widget, XtPointer, XEvent *, Boolean *);
 extern void highlight_yn(boolean);
 extern void nh_XtPopup(Widget, int, Widget);
 extern void nh_XtPopdown(Widget);
index 0ded103aef8f4ec29e8c5dfb9e84340b4f2fdbbc..daa06622fb58080318492c738f178037528203ee 100644 (file)
@@ -942,7 +942,7 @@ X11_putstr(winid window, int attr, const char *str)
         X11_destroy_nhwindow(window);
         *wp = window_list[new_win];
         window_list[new_win].type = NHW_NONE; /* allow re-use */
-    /* fall though to add text */
+        /* fall through */
     case NHW_TEXT:
         add_to_text_window(wp, attr, str);
         break;
@@ -1437,6 +1437,21 @@ panic_on_error(Display *display, XErrorEvent *error)
     return 0;
 }
 
+static void
+X11_error_handler(String str)
+{
+    nhUse(str);
+    hangup(1);
+}
+
+static int
+X11_io_error_handler(Display *display)
+{
+    nhUse(display);
+    hangup(1);
+    return 0;
+}
+
 void
 X11_init_nhwindows(int *argcp, char **argv)
 {
@@ -1465,7 +1480,7 @@ X11_init_nhwindows(int *argcp, char **argv)
     savuid = geteuid();
     (void) seteuid(getuid());
 
-    XSetIOErrorHandler((XIOErrorHandler) hangup);
+    XSetIOErrorHandler((XIOErrorHandler) X11_io_error_handler);
 
     num_args = 0;
     XtSetArg(args[num_args], XtNallowShellResize, True); num_args++;
@@ -2248,12 +2263,13 @@ input_event(int exit_condition)
 
 /*ARGSUSED*/
 void
-msgkey(Widget w, XtPointer data, XEvent *event)
+msgkey(Widget w, XtPointer data, XEvent *event, Boolean *continue_to_dispatch)
 {
     Cardinal num = 0;
 
     nhUse(w);
     nhUse(data);
+    nhUse(continue_to_dispatch);
 
     map_input(window_list[WIN_MAP].w, event, (String *) 0, &num);
 }
@@ -2513,7 +2529,7 @@ init_standard_windows(void)
     set_message_slider(&window_list[message_win]);
 
     /* attempt to catch fatal X11 errors before the program quits */
-    (void) XtAppSetErrorHandler(app_context, (XtErrorHandler) hangup);
+    (void) XtAppSetErrorHandler(app_context, X11_error_handler);
 
     highlight_yn(TRUE); /* switch foreground and background */
 
index 748b2b161c4cde5749524ad1483aeca10f211a07..853dcb6a6e611dbee4d00e3e143a97ba1ad8964b 100644 (file)
@@ -1225,7 +1225,6 @@ map_exposed(Widget w, XtPointer client_data, /* unused */
 static void
 map_update(struct xwindow *wp, int start_row, int stop_row, int start_col, int stop_col, boolean inverted)
 {
-    int win_start_row, win_start_col;
     struct map_info_t *map_info = wp->map_information;
     int row;
     register int count;
@@ -1243,8 +1242,6 @@ map_update(struct xwindow *wp, int start_row, int stop_row, int start_col, int s
     printf("update: [0x%x] %d %d %d %d\n",
            (int) wp->w, start_row, stop_row, start_col, stop_col);
 #endif
-    win_start_row = start_row;
-    win_start_col = start_col;
 
     if (map_info->is_tile) {
         struct tile_map_info_t *tile_map = &map_info->tile_map;
@@ -1371,6 +1368,10 @@ map_update(struct xwindow *wp, int start_row, int stop_row, int start_col, int s
 #else   /* !TEXTCOLOR */
         {
             int win_row, win_xstart;
+            int win_start_row, win_start_col;
+
+            win_start_row = start_row;
+            win_start_col = start_col;
 
             /* We always start at the same x window position and have
                the same character count. */
index 16c5a4e592420849fd321b12a43032491cfa7c5d..7987dbcba49892b2510f4a43e50d42680826ecf0 100644 (file)
@@ -474,7 +474,7 @@ X11_player_selection_randomize(void)
     int nrole = plsel_n_roles;
     int nrace = plsel_n_races;
     int ro, ra, al, ge;
-    boolean fully_specified_role, choose_race_first;
+    boolean choose_race_first;
     boolean picksomething = (flags.initrole == ROLE_NONE
                              || flags.initrace == ROLE_NONE
                              || flags.initgend == ROLE_NONE
@@ -497,15 +497,11 @@ X11_player_selection_randomize(void)
     ro = flags.initrole;
     if (ro == ROLE_NONE || ro == ROLE_RANDOM) {
         ro = rn2(nrole);
-        if (flags.initrole != ROLE_RANDOM) {
-            fully_specified_role = FALSE;
-        }
     }
     ra = flags.initrace;
     if (ra == ROLE_NONE || ra == ROLE_RANDOM) {
         ra = rn2(nrace);
         if (flags.initrace != ROLE_RANDOM) {
-            fully_specified_role = FALSE;
         }
     }
 
@@ -519,21 +515,14 @@ X11_player_selection_randomize(void)
     while (!validrace(ro, ra)) {
         if (choose_race_first) {
             ro = rn2(nrole);
-            if (flags.initrole != ROLE_RANDOM) {
-                fully_specified_role = FALSE;
-            }
         } else {
             ra = rn2(nrace);
-            if (flags.initrace != ROLE_RANDOM) {
-                fully_specified_role = FALSE;
-            }
         }
     }
 
     ge = flags.initgend;
     if (ge == ROLE_NONE) {
         ge = rn2(ROLE_GENDERS);
-        fully_specified_role = FALSE;
     }
     while (!validgend(ro, ra, ge)) {
         ge = rn2(ROLE_GENDERS);
@@ -542,7 +531,6 @@ X11_player_selection_randomize(void)
     al = flags.initalign;
     if (al == ROLE_NONE) {
         al = rn2(ROLE_ALIGNS);
-        fully_specified_role = FALSE;
     }
     while (!validalign(ro, ra, al)) {
         al = rn2(ROLE_ALIGNS);