Even more const-ification.
Этот коммит содержится в:
родитель
5c74367969
Коммит
207f7d126c
14
src/boxes.c
14
src/boxes.c
@ -71,7 +71,7 @@ static int current_mode;
|
||||
static char **displays_status;
|
||||
|
||||
/* Controls whether the array strings have been translated */
|
||||
static char *displays [LIST_TYPES] = {
|
||||
static const char *displays [LIST_TYPES] = {
|
||||
N_("&Full file list"),
|
||||
N_("&Brief file list"),
|
||||
N_("&Long file list"),
|
||||
@ -264,7 +264,7 @@ display_box (WPanel *panel, char **userp, char **minip, int *use_msformat, int n
|
||||
|
||||
static int SORT_X = 40, SORT_Y = 14;
|
||||
|
||||
static char *sort_orders_names [SORT_TYPES];
|
||||
static const char *sort_orders_names [SORT_TYPES];
|
||||
|
||||
sortfn *
|
||||
sort_box (sortfn *sort_fn, int *reverse, int *case_sensitive)
|
||||
@ -273,11 +273,11 @@ sort_box (sortfn *sort_fn, int *reverse, int *case_sensitive)
|
||||
sortfn *result;
|
||||
WCheck *c, *case_sense;
|
||||
|
||||
char *ok_button = _("&OK");
|
||||
char *cancel_button = _("&Cancel");
|
||||
char *reverse_label = _("&Reverse");
|
||||
char *case_label = _("case sensi&tive");
|
||||
char *sort_title = _("Sort order");
|
||||
const char *ok_button = _("&OK");
|
||||
const char *cancel_button = _("&Cancel");
|
||||
const char *reverse_label = _("&Reverse");
|
||||
const char *case_label = _("case sensi&tive");
|
||||
const char *sort_title = _("Sort order");
|
||||
|
||||
static int i18n_sort_flag = 0, check_pos = 0, button_pos = 0;
|
||||
|
||||
|
@ -147,7 +147,7 @@ static int height;
|
||||
|
||||
static Dlg_head *layout_dlg;
|
||||
|
||||
static char *s_split_direction [2] = {
|
||||
static const char *s_split_direction [2] = {
|
||||
N_("&Vertical"),
|
||||
N_("&Horizontal")
|
||||
};
|
||||
@ -155,7 +155,7 @@ static char *s_split_direction [2] = {
|
||||
static WRadio *radio_widget;
|
||||
|
||||
static struct {
|
||||
char *text;
|
||||
const char *text;
|
||||
int *variable;
|
||||
WCheck *widget;
|
||||
} check_options [] = {
|
||||
|
@ -81,7 +81,7 @@ static struct {
|
||||
|
||||
static WRadio *pause_radio;
|
||||
|
||||
static char *pause_options [3] = {
|
||||
static const char *pause_options [3] = {
|
||||
N_("&Never"),
|
||||
N_("on dumb &Terminals"),
|
||||
N_("Alwa&ys") };
|
||||
|
@ -504,7 +504,7 @@ void *profile_iterator_next (void *s, char **key, char **value)
|
||||
return keys;
|
||||
}
|
||||
|
||||
void profile_clean_section (char *appname, char *file)
|
||||
void profile_clean_section (const char *appname, char *file)
|
||||
{
|
||||
TSecHeader *section;
|
||||
|
||||
|
@ -35,7 +35,7 @@ void *profile_init_iterator (char *appname, char *file);
|
||||
void *profile_iterator_next (void *s, char **key, char **value);
|
||||
|
||||
/* Removes all the definitions from section appname on file */
|
||||
void profile_clean_section (char *appname, char *file);
|
||||
void profile_clean_section (const char *appname, char *file);
|
||||
int profile_has_section (char *section_name, char *profile);
|
||||
|
||||
/* Forgets about a .ini file, to disable updating of it */
|
||||
|
31
src/widget.c
31
src/widget.c
@ -213,7 +213,7 @@ button_scan_hotkey (WButton *b)
|
||||
}
|
||||
|
||||
WButton *
|
||||
button_new (int y, int x, int action, int flags, char *text,
|
||||
button_new (int y, int x, int action, int flags, const char *text,
|
||||
bcback callback)
|
||||
{
|
||||
WButton *b = g_new (WButton, 1);
|
||||
@ -236,7 +236,7 @@ button_new (int y, int x, int action, int flags, char *text,
|
||||
}
|
||||
|
||||
void
|
||||
button_set_text (WButton *b, char *text)
|
||||
button_set_text (WButton *b, const char *text)
|
||||
{
|
||||
g_free (b->text);
|
||||
b->text = g_strdup (text);
|
||||
@ -356,7 +356,7 @@ radio_event (Gpm_Event *event, WRadio *r)
|
||||
}
|
||||
|
||||
WRadio *
|
||||
radio_new (int y, int x, int count, char **texts, int use_hotkey)
|
||||
radio_new (int y, int x, int count, const char **texts, int use_hotkey)
|
||||
{
|
||||
WRadio *r = g_new (WRadio, 1);
|
||||
int i, max, m;
|
||||
@ -375,7 +375,7 @@ radio_new (int y, int x, int count, char **texts, int use_hotkey)
|
||||
r->pos = 0;
|
||||
r->sel = 0;
|
||||
r->count = count;
|
||||
r->texts = texts;
|
||||
r->texts = const_cast(char **, texts);
|
||||
r->upper_letter_is_hotkey = use_hotkey;
|
||||
widget_want_hotkey (r->widget, 1);
|
||||
|
||||
@ -456,10 +456,11 @@ check_event (Gpm_Event *event, WCheck *c)
|
||||
}
|
||||
|
||||
WCheck *
|
||||
check_new (int y, int x, int state, char *text)
|
||||
check_new (int y, int x, int state, const char *text)
|
||||
{
|
||||
WCheck *c = g_new (WCheck, 1);
|
||||
char *s, *t;
|
||||
const char *s;
|
||||
char *t;
|
||||
|
||||
init_widget (&c->widget, y, x, 1, strlen (text),
|
||||
(callback_fn)check_callback,
|
||||
@ -547,7 +548,7 @@ label_callback (WLabel *l, int msg, int parm)
|
||||
}
|
||||
|
||||
void
|
||||
label_set_text (WLabel *label, char *text)
|
||||
label_set_text (WLabel *label, const char *text)
|
||||
{
|
||||
int newcols = label->widget.cols;
|
||||
|
||||
@ -806,7 +807,7 @@ int num_history_items_recorded = 60;
|
||||
*/
|
||||
|
||||
GList *
|
||||
history_get (char *input_name)
|
||||
history_get (const char *input_name)
|
||||
{
|
||||
int i;
|
||||
GList *hist;
|
||||
@ -841,7 +842,7 @@ history_get (char *input_name)
|
||||
}
|
||||
|
||||
void
|
||||
history_put (char *input_name, GList *h)
|
||||
history_put (const char *input_name, GList *h)
|
||||
{
|
||||
int i;
|
||||
char *profile;
|
||||
@ -1042,7 +1043,7 @@ input_enable_update (WInput *in)
|
||||
#define ELEMENTS(a) (sizeof(a)/sizeof(a[0]))
|
||||
|
||||
int
|
||||
push_history (WInput *in, char *text)
|
||||
push_history (WInput *in, const char *text)
|
||||
{
|
||||
static int i18n;
|
||||
/* input widget where urls with passwords are entered without any
|
||||
@ -1053,7 +1054,7 @@ push_history (WInput *in, char *text)
|
||||
N_(" SMB link to machine ")
|
||||
};
|
||||
char *t;
|
||||
char *p;
|
||||
const char *p;
|
||||
size_t i;
|
||||
|
||||
if (!i18n) {
|
||||
@ -1330,7 +1331,7 @@ kill_line (WInput *in)
|
||||
}
|
||||
|
||||
void
|
||||
assign_text (WInput *in, char *text)
|
||||
assign_text (WInput *in, const char *text)
|
||||
{
|
||||
free_completions (in);
|
||||
g_free (in->buffer);
|
||||
@ -1506,7 +1507,7 @@ handle_char (WInput *in, int c_code)
|
||||
|
||||
/* Inserts text in input line */
|
||||
void
|
||||
stuff (WInput *in, char *text, int insert_extra_space)
|
||||
stuff (WInput *in, const char *text, int insert_extra_space)
|
||||
{
|
||||
input_disable_update (in);
|
||||
while (*text)
|
||||
@ -1599,7 +1600,7 @@ input_event (Gpm_Event * event, WInput * in)
|
||||
|
||||
WInput *
|
||||
input_new (int y, int x, int color, int len, const char *def_text,
|
||||
char *histname)
|
||||
const char *histname)
|
||||
{
|
||||
WInput *in = g_new (WInput, 1);
|
||||
int initial_buffer_len;
|
||||
@ -2337,7 +2338,7 @@ define_label_data (Dlg_head *h, int idx, const char *text, buttonbarfn cback,
|
||||
}
|
||||
|
||||
void
|
||||
define_label (Dlg_head *h, int idx, char *text, void (*cback) (void))
|
||||
define_label (Dlg_head *h, int idx, const char *text, void (*cback) (void))
|
||||
{
|
||||
define_label_data (h, idx, text, (buttonbarfn) cback, 0);
|
||||
}
|
||||
|
28
src/widget.h
28
src/widget.h
@ -52,8 +52,8 @@ typedef struct WGauge {
|
||||
int current;
|
||||
} WGauge;
|
||||
|
||||
GList *history_get (char *input_name);
|
||||
void history_put (char *input_name, GList *h);
|
||||
GList *history_get (const char *input_name);
|
||||
void history_put (const char *input_name, GList *h);
|
||||
char *show_hist (GList *history, int widget_y, int widget_x);
|
||||
|
||||
typedef struct {
|
||||
@ -137,11 +137,11 @@ typedef struct {
|
||||
} WButtonBar;
|
||||
|
||||
/* Constructors */
|
||||
WButton *button_new (int y, int x, int action, int flags, char *text,
|
||||
WButton *button_new (int y, int x, int action, int flags, const char *text,
|
||||
bcback callback);
|
||||
WRadio *radio_new (int y, int x, int count, char **text, int use_hotkey);
|
||||
WCheck *check_new (int y, int x, int state, char *text);
|
||||
WInput *input_new (int y, int x, int color, int len, const char *text, char *histname);
|
||||
WRadio *radio_new (int y, int x, int count, const char **text, int use_hotkey);
|
||||
WCheck *check_new (int y, int x, int state, const char *text);
|
||||
WInput *input_new (int y, int x, int color, int len, const char *text, const char *histname);
|
||||
WLabel *label_new (int y, int x, const char *text);
|
||||
WGauge *gauge_new (int y, int x, int shown, int max, int current);
|
||||
WListbox *listbox_new (int x, int y, int width, int height, lcback callback);
|
||||
@ -153,25 +153,25 @@ cb_ret_t handle_char (WInput *in, int c_code);
|
||||
int is_in_input_map (WInput *in, int c_code);
|
||||
void update_input (WInput *in, int clear_first);
|
||||
void new_input (WInput *in);
|
||||
int push_history (WInput *in, char *text);
|
||||
void stuff (WInput *in, char *text, int insert_extra_space);
|
||||
int push_history (WInput *in, const char *text);
|
||||
void stuff (WInput *in, const char *text, int insert_extra_space);
|
||||
void input_disable_update (WInput *in);
|
||||
void input_set_prompt (WInput *in, int field_len, char *prompt);
|
||||
void input_set_prompt (WInput *in, int field_len, const char *prompt);
|
||||
void input_enable_update (WInput *in);
|
||||
void input_set_point (WInput *in, int pos);
|
||||
void input_show_cursor (WInput *in);
|
||||
void assign_text (WInput *in, char *text);
|
||||
void assign_text (WInput *in, const char *text);
|
||||
cb_ret_t input_callback (WInput *in, widget_msg_t msg, int parm);
|
||||
|
||||
/* Labels */
|
||||
void label_set_text (WLabel *label, char *text);
|
||||
void label_set_text (WLabel *label, const char *text);
|
||||
|
||||
/* Gauges */
|
||||
void gauge_set_value (WGauge *g, int max, int current);
|
||||
void gauge_show (WGauge *g, int shown);
|
||||
|
||||
/* Buttons */
|
||||
void button_set_text (WButton *b, char *text);
|
||||
void button_set_text (WButton *b, const char *text);
|
||||
|
||||
/* Listbox manager */
|
||||
WLEntry *listbox_get_data (WListbox *l, int pos);
|
||||
@ -200,10 +200,10 @@ char *listbox_add_item (WListbox *l, enum append_pos pos, int
|
||||
WButtonBar *buttonbar_new (int visible);
|
||||
WButtonBar *find_buttonbar (Dlg_head *h);
|
||||
typedef void (*voidfn)(void);
|
||||
void define_label (Dlg_head *, int index, char *text, voidfn);
|
||||
void define_label (Dlg_head *, int index, const char *text, voidfn);
|
||||
void define_label_data (Dlg_head *h, int idx, const char *text,
|
||||
buttonbarfn cback, void *data);
|
||||
void redraw_labels (Dlg_head *h);
|
||||
void buttonbar_hint (WButtonBar *bb, char *s);
|
||||
void buttonbar_hint (WButtonBar *bb, const char *s);
|
||||
|
||||
#endif /* __WIDGET_H */
|
||||
|
@ -344,7 +344,7 @@ quick_dialog_skip (QuickDialog *qd, int nskip)
|
||||
break;
|
||||
|
||||
case quick_radio:
|
||||
r = radio_new (ypos, xpos, qw->hotkey_pos, qw->str_result, 1);
|
||||
r = radio_new (ypos, xpos, qw->hotkey_pos, const_cast(const char **, qw->str_result), 1);
|
||||
r->pos = r->sel = qw->value;
|
||||
widget = r;
|
||||
break;
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user