mirror of https://github.com/MidnightCommander/mc
Added more const-ness to the function arguments.
This commit is contained in:
parent
5d44086ccc
commit
8aeea3256f
|
@ -183,7 +183,7 @@ cb_ret_t default_dlg_callback (Dlg_head *h, dlg_msg_t msg, int parm)
|
|||
|
||||
Dlg_head *
|
||||
create_dlg (int y1, int x1, int lines, int cols, const int *color_set,
|
||||
dlg_cb_fn callback, char *help_ctx, const char *title,
|
||||
dlg_cb_fn callback, const char *help_ctx, const char *title,
|
||||
int flags)
|
||||
{
|
||||
Dlg_head *new_d;
|
||||
|
@ -198,7 +198,7 @@ create_dlg (int y1, int x1, int lines, int cols, const int *color_set,
|
|||
|
||||
new_d = g_new0 (Dlg_head, 1);
|
||||
new_d->color = color_set;
|
||||
new_d->help_ctx = help_ctx;
|
||||
new_d->help_ctx = const_cast(char *, help_ctx);
|
||||
new_d->callback = callback ? callback : default_dlg_callback;
|
||||
new_d->x = x1;
|
||||
new_d->y = y1;
|
||||
|
|
|
@ -143,7 +143,7 @@ void draw_double_box (Dlg_head *h, int y, int x, int ys, int xs);
|
|||
/* Creates a dialog head */
|
||||
Dlg_head *create_dlg (int y1, int x1, int lines, int cols,
|
||||
const int *color_set, dlg_cb_fn callback,
|
||||
char *help_ctx, const char *title, int flags);
|
||||
const char *help_ctx, const char *title, int flags);
|
||||
|
||||
|
||||
/* The flags: */
|
||||
|
|
22
src/wtools.c
22
src/wtools.c
|
@ -39,11 +39,11 @@
|
|||
|
||||
|
||||
Listbox *
|
||||
create_listbox_window (int cols, int lines, char *title, char *help)
|
||||
create_listbox_window (int cols, int lines, const char *title, const char *help)
|
||||
{
|
||||
int xpos, ypos, len;
|
||||
Listbox *listbox = g_new (Listbox, 1);
|
||||
char *cancel_string = _("&Cancel");
|
||||
const char *cancel_string = _("&Cancel");
|
||||
|
||||
/* Adjust sizes */
|
||||
lines = (lines > LINES - 6) ? LINES - 6 : lines;
|
||||
|
@ -68,7 +68,7 @@ create_listbox_window (int cols, int lines, char *title, char *help)
|
|||
|
||||
add_widget (listbox->dlg,
|
||||
button_new (lines + 3, (cols / 2 + 2) - len / 2, B_CANCEL,
|
||||
NORMAL_BUTTON, cancel_string, 0));
|
||||
NORMAL_BUTTON, const_cast(char *, cancel_string), 0));
|
||||
add_widget (listbox->dlg, listbox->list);
|
||||
|
||||
return listbox;
|
||||
|
@ -431,8 +431,8 @@ int quick_dialog (QuickDialog *qd)
|
|||
|
||||
/* Show dialog, not background safe */
|
||||
static char *
|
||||
fg_input_dialog_help (char *header, char *text, char *help,
|
||||
char *def_text)
|
||||
fg_input_dialog_help (const char *header, const char *text, const char *help,
|
||||
const char *def_text)
|
||||
{
|
||||
QuickDialog Quick_input;
|
||||
QuickWidget quick_widgets[] = {
|
||||
|
@ -483,11 +483,11 @@ fg_input_dialog_help (char *header, char *text, char *help,
|
|||
|
||||
Quick_input.xlen = len;
|
||||
Quick_input.xpos = -1;
|
||||
Quick_input.title = header;
|
||||
Quick_input.help = help;
|
||||
Quick_input.title = const_cast(char *, header);
|
||||
Quick_input.help = const_cast(char *, help);
|
||||
Quick_input.i18n = 0;
|
||||
quick_widgets[INPUT_INDEX + 1].text = g_strstrip (g_strdup (text));
|
||||
quick_widgets[INPUT_INDEX].text = def_text;
|
||||
quick_widgets[INPUT_INDEX].text = const_cast(char *, def_text);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
quick_widgets[i].y_divisions = lines + 6;
|
||||
|
@ -510,7 +510,7 @@ fg_input_dialog_help (char *header, char *text, char *help,
|
|||
|
||||
/* Show input dialog, background safe */
|
||||
char *
|
||||
input_dialog_help (char *header, char *text, char *help, char *def_text)
|
||||
input_dialog_help (const char *header, const char *text, const char *help, const char *def_text)
|
||||
{
|
||||
#ifdef WITH_BACKGROUND
|
||||
if (we_are_background)
|
||||
|
@ -524,13 +524,13 @@ input_dialog_help (char *header, char *text, char *help, char *def_text)
|
|||
}
|
||||
|
||||
/* Show input dialog with default help, background safe */
|
||||
char *input_dialog (char *header, char *text, char *def_text)
|
||||
char *input_dialog (const char *header, const char *text, const char *def_text)
|
||||
{
|
||||
return input_dialog_help (header, text, "[Input Line Keys]", def_text);
|
||||
}
|
||||
|
||||
char *
|
||||
input_expand_dialog (char *header, char *text, char *def_text)
|
||||
input_expand_dialog (const char *header, const char *text, const char *def_text)
|
||||
{
|
||||
char *result;
|
||||
char *expanded;
|
||||
|
|
|
@ -10,7 +10,7 @@ typedef struct {
|
|||
struct WListbox *list;
|
||||
} Listbox;
|
||||
|
||||
Listbox *create_listbox_window (int cols, int lines, char *title, char *help);
|
||||
Listbox *create_listbox_window (int cols, int lines, const char *title, const char *help);
|
||||
#define LISTBOX_APPEND_TEXT(l,h,t,d) \
|
||||
listbox_add_item (l->list, 0, h, t, d);
|
||||
|
||||
|
@ -61,9 +61,9 @@ int quick_dialog_skip (QuickDialog *qd, int nskip);
|
|||
/* Pass this as def_text to request a password */
|
||||
#define INPUT_PASSWORD ((char *) -1)
|
||||
|
||||
char *input_dialog (char *header, char *text, char *def_text);
|
||||
char *input_dialog_help (char *header, char *text, char *help, char *def_text);
|
||||
char *input_expand_dialog (char *header, char *text, char *def_text);
|
||||
char *input_dialog (const char *header, const char *text, const char *def_text);
|
||||
char *input_dialog_help (const char *header, const char *text, const char *help, const char *def_text);
|
||||
char *input_expand_dialog (const char *header, const char *text, const char *def_text);
|
||||
|
||||
void query_set_sel (int new_sel);
|
||||
|
||||
|
|
|
@ -857,8 +857,8 @@ vfs_die (const char *m)
|
|||
}
|
||||
|
||||
char *
|
||||
vfs_get_password (char *msg)
|
||||
vfs_get_password (const char *msg)
|
||||
{
|
||||
return (char *) input_dialog (msg, _("Password:"), INPUT_PASSWORD);
|
||||
return input_dialog (msg, _("Password:"), INPUT_PASSWORD);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ int vfs_split_text (char *p);
|
|||
|
||||
int vfs_mkstemps (char **pname, const char *prefix, const char *basename);
|
||||
void vfs_die (const char *msg);
|
||||
char *vfs_get_password (char *msg);
|
||||
char *vfs_get_password (const char *msg);
|
||||
|
||||
int vfs_parse_ls_lga (const char *p, struct stat *s, char **filename,
|
||||
char **linkname);
|
||||
|
|
Loading…
Reference in New Issue