1
1

Added more const-ness to the function arguments.

Этот коммит содержится в:
Roland Illig 2004-08-16 15:45:05 +00:00
родитель 5d44086ccc
Коммит 8aeea3256f
6 изменённых файлов: 21 добавлений и 21 удалений

Просмотреть файл

@ -183,7 +183,7 @@ cb_ret_t default_dlg_callback (Dlg_head *h, dlg_msg_t msg, int parm)
Dlg_head * Dlg_head *
create_dlg (int y1, int x1, int lines, int cols, const int *color_set, 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) int flags)
{ {
Dlg_head *new_d; 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 = g_new0 (Dlg_head, 1);
new_d->color = color_set; 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->callback = callback ? callback : default_dlg_callback;
new_d->x = x1; new_d->x = x1;
new_d->y = y1; 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 */ /* Creates a dialog head */
Dlg_head *create_dlg (int y1, int x1, int lines, int cols, Dlg_head *create_dlg (int y1, int x1, int lines, int cols,
const int *color_set, dlg_cb_fn callback, 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: */ /* The flags: */

Просмотреть файл

@ -39,11 +39,11 @@
Listbox * 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; int xpos, ypos, len;
Listbox *listbox = g_new (Listbox, 1); Listbox *listbox = g_new (Listbox, 1);
char *cancel_string = _("&Cancel"); const char *cancel_string = _("&Cancel");
/* Adjust sizes */ /* Adjust sizes */
lines = (lines > LINES - 6) ? LINES - 6 : lines; 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, add_widget (listbox->dlg,
button_new (lines + 3, (cols / 2 + 2) - len / 2, B_CANCEL, 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); add_widget (listbox->dlg, listbox->list);
return listbox; return listbox;
@ -431,8 +431,8 @@ int quick_dialog (QuickDialog *qd)
/* Show dialog, not background safe */ /* Show dialog, not background safe */
static char * static char *
fg_input_dialog_help (char *header, char *text, char *help, fg_input_dialog_help (const char *header, const char *text, const char *help,
char *def_text) const char *def_text)
{ {
QuickDialog Quick_input; QuickDialog Quick_input;
QuickWidget quick_widgets[] = { QuickWidget quick_widgets[] = {
@ -483,11 +483,11 @@ fg_input_dialog_help (char *header, char *text, char *help,
Quick_input.xlen = len; Quick_input.xlen = len;
Quick_input.xpos = -1; Quick_input.xpos = -1;
Quick_input.title = header; Quick_input.title = const_cast(char *, header);
Quick_input.help = help; Quick_input.help = const_cast(char *, help);
Quick_input.i18n = 0; Quick_input.i18n = 0;
quick_widgets[INPUT_INDEX + 1].text = g_strstrip (g_strdup (text)); 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++) for (i = 0; i < 4; i++)
quick_widgets[i].y_divisions = lines + 6; 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 */ /* Show input dialog, background safe */
char * 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 #ifdef WITH_BACKGROUND
if (we_are_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 */ /* 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); return input_dialog_help (header, text, "[Input Line Keys]", def_text);
} }
char * 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 *result;
char *expanded; char *expanded;

Просмотреть файл

@ -10,7 +10,7 @@ typedef struct {
struct WListbox *list; struct WListbox *list;
} Listbox; } 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) \ #define LISTBOX_APPEND_TEXT(l,h,t,d) \
listbox_add_item (l->list, 0, 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 */ /* Pass this as def_text to request a password */
#define INPUT_PASSWORD ((char *) -1) #define INPUT_PASSWORD ((char *) -1)
char *input_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 (char *header, char *text, char *help, char *def_text); char *input_dialog_help (const char *header, const char *text, const char *help, const char *def_text);
char *input_expand_dialog (char *header, char *text, char *def_text); char *input_expand_dialog (const char *header, const char *text, const char *def_text);
void query_set_sel (int new_sel); void query_set_sel (int new_sel);

Просмотреть файл

@ -857,8 +857,8 @@ vfs_die (const char *m)
} }
char * 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); int vfs_mkstemps (char **pname, const char *prefix, const char *basename);
void vfs_die (const char *msg); 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, int vfs_parse_ls_lga (const char *p, struct stat *s, char **filename,
char **linkname); char **linkname);