[PATCH] type accuracy in listbox routines
- From: Andrew Borodin <aborodin vmail ru>
- To: mc-devel gnome org
- Subject: [PATCH] type accuracy in listbox routines
- Date: Tue, 03 Feb 2009 11:36:46 +0300
Greetings!
Since trac is still locked, I'm sending patch here.
Changelog:
src/dialog.h: set definitely values of cb_ret_t emum type.
src/widget.c: cb_ret_t type accuracy in listbox routines.
--
Regards,
Andrew
diff --git a/src/dialog.h b/src/dialog.h
index d0f797b..16ffc4f 100644
--- a/src/dialog.h
+++ b/src/dialog.h
@@ -49,8 +49,8 @@ typedef enum {
} widget_msg_t;
typedef enum {
- MSG_NOT_HANDLED,
- MSG_HANDLED
+ MSG_NOT_HANDLED = 0,
+ MSG_HANDLED = 1
} cb_ret_t;
/* Widgets are expected to answer to the following messages:
diff --git a/src/widget.c b/src/widget.c
index f85cc2a..24d196d 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -1025,7 +1025,7 @@ show_hist (GList *history, int widget_x, int widget_y)
listbox_add_item (query_list, 0, 0, (char *) hi->data, NULL);
hi = g_list_next (hi);
}
- while (listbox_fwd (query_list));
+ while (listbox_fwd (query_list) != MSG_NOT_HANDLED);
} else {
/* traverse backwards */
hi = g_list_last (history);
@@ -1965,11 +1965,11 @@ static cb_ret_t
listbox_key (WListbox *l, int key)
{
int i;
- int j = 0;
+ cb_ret_t j = MSG_NOT_HANDLED;
if (!l->list)
return MSG_NOT_HANDLED;
-
+
switch (key){
case KEY_HOME:
case KEY_A1:
@@ -1999,15 +1999,15 @@ listbox_key (WListbox *l, int key)
case KEY_NPAGE:
case XCTRL('v'):
- for (i = 0; i < l->height-1; i++)
+ for (i = 0; i < l->height - 1; i++)
j |= listbox_fwd (l);
- return (j > 0) ? MSG_HANDLED : MSG_NOT_HANDLED;
+ return (j != MSG_NOT_HANDLED) ? MSG_HANDLED : MSG_NOT_HANDLED;
case KEY_PPAGE:
case ALT('v'):
- for (i = 0; i < l->height-1; i++)
+ for (i = 0; i < l->height - 1; i++)
j |= listbox_back (l);
- return (j > 0) ? MSG_HANDLED : MSG_NOT_HANDLED;
+ return (j != MSG_NOT_HANDLED) ? MSG_HANDLED : MSG_NOT_HANDLED;
}
return MSG_NOT_HANDLED;
}
@@ -2058,7 +2058,7 @@ listbox_callback (Widget *w, widget_msg_t msg, int parm)
return MSG_NOT_HANDLED;
case WIDGET_KEY:
- if ((ret_code = listbox_key (l, parm)))
+ if ((ret_code = listbox_key (l, parm)) != MSG_NOT_HANDLED)
listbox_draw (l, 1);
return ret_code;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]