diff --git a/src/ChangeLog b/src/ChangeLog index 993bfc7ee..db91275b2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,8 @@ 2004-09-17 Andrew V. Samoilov * hotlist.c (add_new_entry_input): Fix warnings. + * wtools.h (QuickWidget): Make text const. + * wtools.c (fg_input_dialog_help): Fix warning. 2004-09-14 Leonard den Ottolander diff --git a/src/wtools.c b/src/wtools.c index f68b296de..f5fb4e2a5 100644 --- a/src/wtools.c +++ b/src/wtools.c @@ -450,6 +450,7 @@ fg_input_dialog_help (const char *header, const char *text, const char *help, int ret; char *my_str; char histname[64] = "inp|"; + char *p_text; /* we need a unique name for histname because widget.c:history_tool() needs a unique name for each dialog - using the header is ideal */ @@ -482,11 +483,12 @@ fg_input_dialog_help (const char *header, const char *text, const char *help, Quick_input.xlen = len; Quick_input.xpos = -1; - Quick_input.title = const_cast(char *, header); - Quick_input.help = const_cast(char *, help); + Quick_input.title = header; + Quick_input.help = help; Quick_input.i18n = 0; - quick_widgets[INPUT_INDEX + 1].text = g_strstrip (g_strdup (text)); - quick_widgets[INPUT_INDEX].text = const_cast(char *, def_text); + p_text = g_strstrip (g_strdup (text)); + quick_widgets[INPUT_INDEX + 1].text = p_text; + quick_widgets[INPUT_INDEX].text = def_text; for (i = 0; i < 4; i++) quick_widgets[i].y_divisions = lines + 6; @@ -499,10 +501,10 @@ fg_input_dialog_help (const char *header, const char *text, const char *help, Quick_input.widgets = quick_widgets; ret = quick_dialog (&Quick_input); - g_free (quick_widgets[INPUT_INDEX + 1].text); + g_free (p_text); if (ret != B_CANCEL) { - return *(quick_widgets[INPUT_INDEX].str_result); + return my_str; } else return 0; } diff --git a/src/wtools.h b/src/wtools.h index f2713975e..4b04b7437 100644 --- a/src/wtools.h +++ b/src/wtools.h @@ -35,7 +35,7 @@ typedef struct { int relative_y; int y_divisions; - char *text; /* Text */ + const char *text; /* Text */ int hotkey_pos; /* the hotkey position */ int value; /* Buttons only: value of button */ int *result; /* Checkbutton: where to store result */