1
1

Ticket #1990: code cleanup before 4.7.0.2 release.

Fixed warings: local variable shadows a global declaration.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
Этот коммит содержится в:
Andrew Borodin 2010-02-02 10:48:08 +00:00
родитель f7c574b76e
Коммит 0bd03e07f5
23 изменённых файлов: 164 добавлений и 155 удалений

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

@ -48,7 +48,7 @@ int mc_skin_color__cache[MC_SKIN_COLOR_CACHE_COUNT];
static mc_skin_color_t *
mc_skin_color_get_from_hash (mc_skin_t * mc_skin, const gchar * group, const gchar * key)
{
gchar key_name[BUF_TINY];
gchar kname[BUF_TINY];
mc_skin_color_t *mc_skin_color;
if (group == NULL || key == NULL)
@ -57,8 +57,8 @@ mc_skin_color_get_from_hash (mc_skin_t * mc_skin, const gchar * group, const gch
if (mc_skin == NULL)
mc_skin = &mc_skin__default;
g_snprintf (key_name, sizeof (key_name), "%s.%s", group, key);
mc_skin_color = (mc_skin_color_t *) g_hash_table_lookup (mc_skin->colors, (gpointer) key_name);
g_snprintf (kname, sizeof (kname), "%s.%s", group, key);
mc_skin_color = (mc_skin_color_t *) g_hash_table_lookup (mc_skin->colors, (gpointer) kname);
return mc_skin_color;
}
@ -69,15 +69,15 @@ mc_skin_color_get_from_hash (mc_skin_t * mc_skin, const gchar * group, const gch
static void
mc_skin_color_remove_from_hash (mc_skin_t * mc_skin, const gchar * group, const gchar * key)
{
gchar key_name[BUF_TINY];
gchar kname[BUF_TINY];
if (group == NULL || key == NULL)
return;
if (mc_skin == NULL)
mc_skin = &mc_skin__default;
g_snprintf (key_name, sizeof (key_name), "%s.%s", group, key);
g_hash_table_remove (mc_skin->colors, (gpointer) key_name);
g_snprintf (kname, sizeof (kname), "%s.%s", group, key);
g_hash_table_remove (mc_skin->colors, (gpointer) kname);
}
#endif
/* --------------------------------------------------------------------------------------------- */
@ -86,16 +86,15 @@ static void
mc_skin_color_add_to_hash (mc_skin_t * mc_skin, const gchar * group, const gchar * key,
mc_skin_color_t * mc_skin_color)
{
gchar *key_name;
gchar *kname;
key_name = g_strdup_printf ("%s.%s", group, key);
if (key_name == NULL)
return;
kname = g_strdup_printf ("%s.%s", group, key);
if (kname != NULL) {
if (g_hash_table_lookup (mc_skin->colors, (gpointer) kname) != NULL)
g_hash_table_remove (mc_skin->colors, (gpointer) kname);
if (g_hash_table_lookup (mc_skin->colors, (gpointer) key_name) != NULL)
g_hash_table_remove (mc_skin->colors, (gpointer) key_name);
g_hash_table_insert (mc_skin->colors, (gpointer) key_name, (gpointer) mc_skin_color);
g_hash_table_insert (mc_skin->colors, (gpointer) kname, (gpointer) mc_skin_color);
}
}
/* --------------------------------------------------------------------------------------------- */

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

@ -560,7 +560,7 @@ check_selects (fd_set * select_set)
static void
try_channels (int set_timeout)
{
struct timeval timeout;
struct timeval time_out;
static fd_set select_set;
struct timeval *timeptr;
int v;
@ -573,9 +573,9 @@ try_channels (int set_timeout)
timeptr = NULL;
if (set_timeout) {
timeout.tv_sec = 0;
timeout.tv_usec = 100000;
timeptr = &timeout;
time_out.tv_sec = 0;
time_out.tv_usec = 100000;
timeptr = &time_out;
}
v = select (maxfdp + 1, &select_set, NULL, NULL, timeptr);
@ -981,14 +981,14 @@ xgetch_second (void)
{
fd_set Read_FD_Set;
int c;
struct timeval timeout;
struct timeval time_out;
timeout.tv_sec = keyboard_key_timeout / 1000000;
timeout.tv_usec = keyboard_key_timeout % 1000000;
time_out.tv_sec = keyboard_key_timeout / 1000000;
time_out.tv_usec = keyboard_key_timeout % 1000000;
tty_nodelay (TRUE);
FD_ZERO (&Read_FD_Set);
FD_SET (input_fd, &Read_FD_Set);
select (input_fd + 1, &Read_FD_Set, NULL, NULL, &timeout);
select (input_fd + 1, &Read_FD_Set, NULL, NULL, &time_out);
c = tty_lowlevel_getch ();
tty_nodelay (FALSE);
return c;
@ -1268,16 +1268,16 @@ sort_key_name_conv_tab (void)
}
static int
lookup_keyname (const char *keyname, int *lc_index)
lookup_keyname (const char *name, int *idx)
{
if (keyname[0] != '\0') {
const key_code_name_t key = { 0, keyname, NULL, NULL };
if (name[0] != '\0') {
const key_code_name_t key = { 0, name, NULL, NULL };
const key_code_name_t *keyp = &key;
key_code_name_t **res;
if (keyname[1] == '\0') {
*lc_index = -1;
return (int) keyname[0];
if (name[1] == '\0') {
*idx = -1;
return (int) name[0];
}
sort_key_name_conv_tab ();
@ -1288,18 +1288,18 @@ lookup_keyname (const char *keyname, int *lc_index)
key_code_name_comparator);
if (res != NULL) {
*lc_index = (int) (res - (key_code_name_t **) key_name_conv_tab_sorted);
*idx = (int) (res - (key_code_name_t **) key_name_conv_tab_sorted);
return (*res)->code;
}
}
*lc_index = -1;
*idx = -1;
return 0;
}
/* Return the code associated with the symbolic name keyname */
long
lookup_key (const char *keyname, char **label)
lookup_key (const char *name, char **label)
{
char **lc_keys, **p;
int k = -1;
@ -1310,12 +1310,12 @@ lookup_key (const char *keyname, char **label)
int use_ctrl = -1;
int use_shift = -1;
if (keyname == NULL)
if (name == NULL)
return 0;
keyname = g_strstrip (g_strdup (keyname));
p = lc_keys = g_strsplit_set (keyname, "-+ ", -1);
g_free ((char *) keyname);
name = g_strstrip (g_strdup (name));
p = lc_keys = g_strsplit_set (name, "-+ ", -1);
g_free ((char *) name);
while ((p != NULL) && (*p != NULL)) {
if ((*p)[0] != '\0') {
@ -1455,7 +1455,7 @@ is_idle (void)
{
int maxfdp;
fd_set select_set;
struct timeval timeout;
struct timeval time_out;
FD_ZERO (&select_set);
FD_SET (input_fd, &select_set);
@ -1466,9 +1466,9 @@ is_idle (void)
maxfdp = max (maxfdp, gpm_fd);
}
#endif
timeout.tv_sec = 0;
timeout.tv_usec = 0;
return (select (maxfdp + 1, &select_set, 0, 0, &timeout) <= 0);
time_out.tv_sec = 0;
time_out.tv_usec = 0;
return (select (maxfdp + 1, &select_set, 0, 0, &time_out) <= 0);
}
int
@ -1515,20 +1515,20 @@ get_key_code (int no_delay)
tty_nodelay (FALSE);
if (c == -1) {
if (this != NULL && parent != NULL && parent->action == MCKEY_ESCAPE && old_esc_mode) {
struct timeval current, timeout;
struct timeval current, time_out;
if (esctime.tv_sec == -1)
return -1;
GET_TIME (current);
timeout.tv_sec = keyboard_key_timeout / 1000000 + esctime.tv_sec;
timeout.tv_usec = keyboard_key_timeout % 1000000 + esctime.tv_usec;
if (timeout.tv_usec > 1000000) {
timeout.tv_usec -= 1000000;
timeout.tv_sec++;
time_out.tv_sec = keyboard_key_timeout / 1000000 + esctime.tv_sec;
time_out.tv_usec = keyboard_key_timeout % 1000000 + esctime.tv_usec;
if (time_out.tv_usec > 1000000) {
time_out.tv_usec -= 1000000;
time_out.tv_sec++;
}
if (current.tv_sec < timeout.tv_sec)
if (current.tv_sec < time_out.tv_sec)
return -1;
if (current.tv_sec == timeout.tv_sec && current.tv_usec < timeout.tv_usec)
if (current.tv_sec == time_out.tv_sec && current.tv_usec < time_out.tv_usec)
return -1;
this = NULL;
pending_keys = seq_append = NULL;
@ -1643,7 +1643,7 @@ tty_get_event (struct Gpm_Event *event, gboolean redo_event, gboolean block)
#ifdef HAVE_LIBGPM
static struct Gpm_Event ev; /* Mouse event */
#endif
struct timeval timeout;
struct timeval time_out;
struct timeval *time_addr = NULL;
static int dirty = 3;
@ -1689,10 +1689,10 @@ tty_get_event (struct Gpm_Event *event, gboolean redo_event, gboolean block)
#endif
if (redo_event) {
timeout.tv_usec = mou_auto_repeat * 1000;
timeout.tv_sec = 0;
time_out.tv_usec = mou_auto_repeat * 1000;
time_out.tv_sec = 0;
time_addr = &timeout;
time_addr = &time_out;
} else {
int seconds;
@ -1705,16 +1705,16 @@ tty_get_event (struct Gpm_Event *event, gboolean redo_event, gboolean block)
* timeouts in the stamp list.
*/
timeout.tv_sec = seconds;
timeout.tv_usec = 0;
time_addr = &timeout;
time_out.tv_sec = seconds;
time_out.tv_usec = 0;
time_addr = &time_out;
}
}
if (!block || winch_flag) {
time_addr = &timeout;
timeout.tv_sec = 0;
timeout.tv_usec = 0;
time_addr = &time_out;
time_out.tv_sec = 0;
time_out.tv_usec = 0;
}
tty_enable_interrupt_key ();
@ -1795,7 +1795,7 @@ learn_key (void)
fd_set Read_FD_Set;
struct timeval endtime;
struct timeval timeout;
struct timeval time_out;
int c;
char buffer[256];
char *p = buffer;
@ -1814,15 +1814,15 @@ learn_key (void)
tty_nodelay (TRUE);
for (;;) {
while ((c = tty_lowlevel_getch ()) == -1) {
GET_TIME (timeout);
timeout.tv_usec = endtime.tv_usec - timeout.tv_usec;
if (timeout.tv_usec < 0)
timeout.tv_sec++;
timeout.tv_sec = endtime.tv_sec - timeout.tv_sec;
if (timeout.tv_sec >= 0 && timeout.tv_usec > 0) {
GET_TIME (time_out);
time_out.tv_usec = endtime.tv_usec - time_out.tv_usec;
if (time_out.tv_usec < 0)
time_out.tv_sec++;
time_out.tv_sec = endtime.tv_sec - time_out.tv_sec;
if (time_out.tv_sec >= 0 && time_out.tv_usec > 0) {
FD_ZERO (&Read_FD_Set);
FD_SET (input_fd, &Read_FD_Set);
select (input_fd + 1, &Read_FD_Set, NULL, NULL, &timeout);
select (input_fd + 1, &Read_FD_Set, NULL, NULL, &time_out);
} else
break;
}

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

@ -21,7 +21,7 @@ void done_key (void);
typedef void (*move_fn) (void *data, int param);
cb_ret_t check_movement_keys (int key, int page_size, void *data,
move_fn backfn, move_fn forfn, move_fn topfn, move_fn bottomfn);
long lookup_key (const char *keyname, char **label);
long lookup_key (const char *name, char **label);
typedef struct {
int code;

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

@ -1184,16 +1184,16 @@ int
vfs_s_select_on_two (int fd1, int fd2)
{
fd_set set;
struct timeval timeout;
struct timeval time_out;
int v;
int maxfd = (fd1 > fd2 ? fd1 : fd2) + 1;
timeout.tv_sec = 1;
timeout.tv_usec = 0;
time_out.tv_sec = 1;
time_out.tv_usec = 0;
FD_ZERO (&set);
FD_SET (fd1, &set);
FD_SET (fd2, &set);
v = select (maxfd, &set, 0, 0, &timeout);
v = select (maxfd, &set, 0, 0, &time_out);
if (v <= 0)
return v;
if (FD_ISSET (fd1, &set))

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

@ -252,7 +252,7 @@ enter (WInput *lc_cmdline)
for (i = j = 0; i < cmd_len; i++) {
if (cmd[i] == '%') {
i++;
s = expand_format (NULL, cmd[i], 1);
s = expand_format (NULL, cmd[i], TRUE);
command = g_realloc (command, j + strlen (s) + cmd_len - i + 1);
strcpy (command + j, s);
g_free (s);

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

@ -979,20 +979,20 @@ query_callback (Dlg_head *h, Widget *sender,
if (strncmp (&e1->text[end - start], buff, bl) == 0) {
if (need_redraw) {
char *si, *sl;
char *ni, *nl;
char *nexti, *nextl;
si = &(e1->text[end - start]);
sl = &(last_text[end - start]);
for (; si[0] != '\0' && sl[0] != '\0';) {
ni = str_get_next_char (si);
nl = str_get_next_char (sl);
nexti = str_get_next_char (si);
nextl = str_get_next_char (sl);
if (ni - si != nl - sl) break;
if (strncmp (si, sl, ni - si) != 0) break;
if (nexti - si != nextl - sl) break;
if (strncmp (si, sl, nexti - si) != 0) break;
si = ni;
sl = nl;
si = nexti;
sl = nextl;
}
if (low > si - &e1->text[end - start])

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

@ -241,16 +241,16 @@ default_dlg_callback (Dlg_head *h, Widget *sender,
}
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 *colors,
dlg_cb_fn callback, const char *help_ctx, const char *title,
int flags)
{
Dlg_head *new_d;
new_d = g_new0 (Dlg_head, 1);
if (color_set != NULL) {
if (colors != NULL) {
new_d->color = g_new (int, DLG_COLOR_NUM);
memmove (new_d->color, color_set, sizeof (int) * DLG_COLOR_NUM);
memmove (new_d->color, colors, sizeof (int) * DLG_COLOR_NUM);
}
new_d->help_ctx = help_ctx;
new_d->callback = (callback != NULL) ? callback : default_dlg_callback;

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

@ -180,7 +180,7 @@ void draw_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,
const int *colors, dlg_cb_fn callback,
const char *help_ctx, const char *title, int flags);
void dlg_set_default_colors (void);

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

@ -279,7 +279,7 @@ set_zero_dir (dir_list *list)
/* If you change handle_dirent then check also handle_path. */
/* Return values: -1 = failure, 0 = don't add, 1 = add to the list */
static int
handle_dirent (dir_list *list, const char *filter, struct dirent *dp,
handle_dirent (dir_list *list, const char *fltr, struct dirent *dp,
struct stat *buf1, int next_free, int *link_to_dir,
int *stale_link)
{
@ -313,8 +313,8 @@ handle_dirent (dir_list *list, const char *filter, struct dirent *dp,
else
*stale_link = 1;
}
if (!(S_ISDIR (buf1->st_mode) || *link_to_dir) && filter
&& !mc_search(filter, dp->d_name, MC_SEARCH_T_GLOB) )
if (!(S_ISDIR (buf1->st_mode) || *link_to_dir) && (fltr != NULL)
&& !mc_search (fltr, dp->d_name, MC_SEARCH_T_GLOB))
return 0;
/* Need to grow the *list? */
@ -392,7 +392,7 @@ handle_path (dir_list *list, const char *path,
int
do_load_dir (const char *path, dir_list *list, sortfn *sort, int lc_reverse,
int lc_case_sensitive, int exec_ff, const char *filter)
int lc_case_sensitive, int exec_ff, const char *fltr)
{
DIR *dirp;
struct dirent *dp;
@ -422,7 +422,7 @@ do_load_dir (const char *path, dir_list *list, sortfn *sort, int lc_reverse,
while ((dp = mc_readdir (dirp))) {
status =
handle_dirent (list, filter, dp, &st, next_free, &link_to_dir,
handle_dirent (list, fltr, dp, &st, next_free, &link_to_dir,
&stale_link);
if (status == 0)
continue;
@ -492,10 +492,10 @@ alloc_dir_copy (int size)
}
}
/* If filter is null, then it is a match */
/* If fltr is null, then it is a match */
int
do_reload_dir (const char *path, dir_list *list, sortfn *sort, int count,
int rev, int lc_case_sensitive, int exec_ff, const char *filter)
int rev, int lc_case_sensitive, int exec_ff, const char *fltr)
{
DIR *dirp;
struct dirent *dp;
@ -549,7 +549,7 @@ do_reload_dir (const char *path, dir_list *list, sortfn *sort, int count,
while ((dp = mc_readdir (dirp))) {
status =
handle_dirent (list, filter, dp, &st, next_free, &link_to_dir,
handle_dirent (list, fltr, dp, &st, next_free, &link_to_dir,
&stale_link);
if (status == 0)
continue;

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

@ -41,11 +41,11 @@ typedef struct {
typedef int sortfn (const void *, const void *);
int do_load_dir (const char *path, dir_list * list, sortfn * sort, int reverse,
int case_sensitive, int exec_ff, const char *filter);
int case_sensitive, int exec_ff, const char *fltr);
void do_sort (dir_list * list, sortfn * sort, int top, int reverse,
int case_sensitive, int exec_ff);
int do_reload_dir (const char *path, dir_list * list, sortfn * sort, int count,
int reverse, int case_sensitive, int exec_ff, const char *filter);
int reverse, int case_sensitive, int exec_ff, const char *fltr);
void clean_dir (dir_list * list, int count);
gboolean set_zero_dir (dir_list *list);
int handle_path (dir_list *list, const char *path, struct stat *buf1,

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

@ -1833,7 +1833,8 @@ int line_is_blank (WEdit * edit, long line)
/* moves up until a blank line is reached, or until just
before a non-blank line is reached */
static void edit_move_up_paragraph (WEdit * edit, int scroll)
static void
edit_move_up_paragraph (WEdit * edit, int do_scroll)
{
int i = 0;
if (edit->curs_line > 1) {
@ -1855,12 +1856,13 @@ static void edit_move_up_paragraph (WEdit * edit, int scroll)
break;
}
}
edit_move_up (edit, edit->curs_line - i, scroll);
edit_move_up (edit, edit->curs_line - i, do_scroll);
}
/* moves down until a blank line is reached, or until just
before a non-blank line is reached */
static void edit_move_down_paragraph (WEdit * edit, int scroll)
static void
edit_move_down_paragraph (WEdit * edit, int do_scroll)
{
int i;
if (edit->curs_line >= edit->total_lines - 1) {
@ -1884,7 +1886,7 @@ static void edit_move_down_paragraph (WEdit * edit, int scroll)
break;
}
}
edit_move_down (edit, i - edit->curs_line, scroll);
edit_move_down (edit, i - edit->curs_line, do_scroll);
}
static void edit_begin_page (WEdit *edit)
@ -2137,7 +2139,7 @@ static void edit_left_char_move_cmd (WEdit * edit)
= FALSE - move down
*/
static void
edit_move_updown (WEdit * edit, unsigned long i, int scroll, gboolean direction)
edit_move_updown (WEdit * edit, unsigned long i, int do_scroll, gboolean direction)
{
unsigned long p;
unsigned long l = (direction)
@ -2152,7 +2154,7 @@ edit_move_updown (WEdit * edit, unsigned long i, int scroll, gboolean direction)
if (i > 1)
edit->force |= REDRAW_PAGE;
if (scroll) {
if (do_scroll) {
if (direction)
edit_scroll_upward (edit, i);
else
@ -3364,14 +3366,16 @@ edit_stack_free (void)
}
/* move i lines */
void edit_move_up (WEdit * edit, unsigned long i, int scroll)
void
edit_move_up (WEdit * edit, unsigned long i, int do_scroll)
{
edit_move_updown (edit, i, scroll, TRUE);
edit_move_updown (edit, i, do_scroll, TRUE);
}
/* move i lines */
void edit_move_down (WEdit * edit, unsigned long i, int scroll)
void
edit_move_down (WEdit * edit, unsigned long i, int do_scroll)
{
edit_move_updown (edit, i, scroll, FALSE);
edit_move_updown (edit, i, do_scroll, FALSE);
}

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

@ -140,6 +140,8 @@ edit_refresh_cmd (WEdit * edit)
tty_touch_screen ();
mc_refresh ();
#else
(void) edit;
clr_scr ();
repaint_screen ();
#endif /* !HAVE_SLANG */

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

@ -131,7 +131,7 @@ do_execute (const char *lc_shell, const char *command, int flags)
handle_console (CONSOLE_RESTORE);
if (!use_subshell && command && !(flags & EXECUTE_INTERNAL)) {
printf ("%s%s\n", prompt, command);
printf ("%s%s\n", mc_prompt, command);
fflush (stdout);
}
#ifdef HAVE_SUBSHELL_SUPPORT

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

@ -953,9 +953,9 @@ keybind_cmd_bind (GArray *keymap, const char *keybind, unsigned long action)
}
unsigned long
lookup_action (const char *keyname)
lookup_action (const char *name)
{
const name_keymap_t key = { keyname, 0 };
const name_keymap_t key = { name, 0 };
name_keymap_t *res;
sort_command_names ();

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

@ -25,7 +25,7 @@ typedef struct global_keymap_t {
} global_keymap_t;
void keybind_cmd_bind (GArray *keymap, const char *keybind, unsigned long action);
unsigned long lookup_action (const char *keyname);
unsigned long lookup_action (const char *name);
const char *lookup_keymap_shortcut (const global_keymap_t *keymap, unsigned long action);
unsigned long lookup_keymap_command (const global_keymap_t *keymap, long key);

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

@ -601,12 +601,12 @@ mc_refresh (void)
}
static void
panel_do_cols (int lc_index)
panel_do_cols (int idx)
{
if (get_display_type (lc_index) == view_listing)
set_panel_formats ((WPanel *) panels [lc_index].widget);
if (get_display_type (idx) == view_listing)
set_panel_formats ((WPanel *) panels [idx].widget);
else
panel_update_cols (panels [lc_index].widget, frame_half);
panel_update_cols (panels [idx].widget, frame_half);
}
void
@ -653,7 +653,7 @@ setup_panels (void)
panel_do_cols (0);
panel_do_cols (1);
promptl = str_term_width1 (prompt);
promptl = str_term_width1 (mc_prompt);
widget_set_size (&the_menubar->widget, 0, 0, 1, COLS);
@ -909,6 +909,7 @@ set_display_type (int num, panel_view_mode_t type)
}
switch (type) {
case view_nothing:
case view_listing:
new_widget = restore_into_right_dir_panel (num, old_widget);
break;
@ -1062,15 +1063,15 @@ void swap_panels ()
}
panel_view_mode_t
get_display_type (int lc_index)
get_display_type (int idx)
{
return panels [lc_index].type;
return panels [idx].type;
}
struct Widget *
get_panel_widget (int lc_index)
get_panel_widget (int idx)
{
return panels[lc_index].widget;
return panels[idx].widget;
}
int get_current_index (void)
@ -1114,30 +1115,30 @@ get_other_type (void)
/* Save current list_view widget directory into panel */
void
save_panel_dir (int lc_index)
save_panel_dir (int idx)
{
panel_view_mode_t type = get_display_type (lc_index);
Widget *widget = get_panel_widget (lc_index);
panel_view_mode_t type = get_display_type (idx);
Widget *widget = get_panel_widget (idx);
if ((type == view_listing) && (widget != NULL)) {
WPanel *w = (WPanel *) widget;
char *widget_work_dir = w->cwd;
g_free(panels [lc_index].last_saved_dir); /* last path no needed */
g_free(panels [idx].last_saved_dir); /* last path no needed */
/* Because path can be nonlocal */
panels [lc_index].last_saved_dir = vfs_translate_url(widget_work_dir);
panels [idx].last_saved_dir = vfs_translate_url (widget_work_dir);
}
}
/* Save current list_view widget directory into panel */
Widget *
restore_into_right_dir_panel (int lc_index, Widget *from_widget)
restore_into_right_dir_panel (int idx, Widget *from_widget)
{
Widget *new_widget = NULL;
const char *saved_dir = panels [lc_index].last_saved_dir;
const char *saved_dir = panels [idx].last_saved_dir;
gboolean last_was_panel = (from_widget &&
get_display_type(lc_index) != view_listing);
const char *p_name = get_nth_panel_name (lc_index);
get_display_type(idx) != view_listing);
const char *p_name = get_nth_panel_name (idx);
if (last_was_panel)
new_widget = (Widget *) panel_new_with_dir (p_name, saved_dir);

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

@ -16,19 +16,19 @@ void sigwinch_handler (int dummy);
void change_screen_size (void);
void set_display_type (int num, panel_view_mode_t type);
void swap_panels (void);
panel_view_mode_t get_display_type (int index);
panel_view_mode_t get_display_type (int idx);
panel_view_mode_t get_current_type (void);
panel_view_mode_t get_other_type (void);
int get_current_index (void);
int get_other_index (void);
const char *get_nth_panel_name (int num);
struct Widget *get_panel_widget (int index);
struct Widget *get_panel_widget (int idx);
struct WPanel *get_other_panel (void);
void save_panel_dir (int index);
Widget *restore_into_right_dir_panel (int index, Widget *from_widget);
void save_panel_dir (int idx);
Widget *restore_into_right_dir_panel (int idx, Widget *from_widget);
const char *get_panel_dir_for (const WPanel *widget);
void set_hintbar (const char *str);

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

@ -203,7 +203,7 @@ int navigate_with_arrows = 0;
int reset_hp_softkeys = 0;
/* The prompt */
const char *prompt = NULL;
const char *mc_prompt = NULL;
/* The widget where we draw the prompt */
WLabel *the_prompt;
@ -602,8 +602,8 @@ load_prompt (int fd, void *unused)
tmp_prompt[COLS - 8] = '\0';
prompt_len = COLS - 8;
}
prompt = tmp_prompt;
label_set_text (the_prompt, prompt);
mc_prompt = tmp_prompt;
label_set_text (the_prompt, mc_prompt);
winput_set_origin ((WInput *) cmdline, prompt_len,
COLS - prompt_len);
@ -977,7 +977,7 @@ create_panels (void)
/* Create the nice widgets */
cmdline = command_new (0, 0, 0);
the_prompt = label_new (0, 0, prompt);
the_prompt = label_new (0, 0, mc_prompt);
the_prompt->transparent = 1;
the_bar = buttonbar_new (keybar_visible);
@ -2203,12 +2203,12 @@ main (int argc, char *argv[])
#ifdef HAVE_SUBSHELL_SUPPORT
if (use_subshell) {
prompt = strip_ctrl_codes (subshell_prompt);
if (!prompt)
prompt = "";
mc_prompt = strip_ctrl_codes (subshell_prompt);
if (mc_prompt == NULL)
mc_prompt = "";
} else
#endif /* HAVE_SUBSHELL_SUPPORT */
prompt = (geteuid () == 0) ? "# " : "$ ";
mc_prompt = (geteuid () == 0) ? "# " : "$ ";
/* Program main loop */

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

@ -120,7 +120,7 @@ void load_hint (int force);
void print_vfs_message(const char *msg, ...)
__attribute__ ((format (__printf__, 1, 2)));
extern const char *prompt;
extern const char *mc_prompt;
extern const char *edit_one_file;
extern char *mc_home;
extern char *mc_home_alt;

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

@ -178,7 +178,7 @@ strip_ext(char *ss)
}
char *
expand_format (WEdit *edit_widget, char c, int lc_quote)
expand_format (struct WEdit *edit_widget, char c, gboolean do_quote)
{
WPanel *panel = NULL;
char *(*quote_func) (const char *, int);
@ -208,7 +208,7 @@ expand_format (WEdit *edit_widget, char c, int lc_quote)
fname = str_unconst (edit_get_file_name (edit_widget));
#endif
if (lc_quote)
if (do_quote)
quote_func = name_quote;
else
quote_func = fake_name_quote;
@ -610,7 +610,7 @@ execute_menu_command (WEdit *edit_widget, const char *commands)
int cmd_file_fd;
int expand_prefix_found = 0;
char *parameter = 0;
int do_quote = 0;
gboolean do_quote = FALSE;
char lc_prompt [80];
int col;
char *file_name;
@ -658,7 +658,8 @@ execute_menu_command (WEdit *edit_widget, const char *commands)
return;
}
if (do_quote) {
fputs (tmp = name_quote (parameter, 0), cmd_file);
tmp = name_quote (parameter, 0);
fputs (tmp, cmd_file);
g_free (tmp);
} else
fputs (parameter, cmd_file);
@ -672,7 +673,7 @@ execute_menu_command (WEdit *edit_widget, const char *commands)
} else if (expand_prefix_found){
expand_prefix_found = 0;
if (g_ascii_isdigit ((gchar) *commands)) {
do_quote = atoi (commands);
do_quote = (atoi (commands) != 0);
while (g_ascii_isdigit ((gchar) *commands))
commands++;
}
@ -690,7 +691,7 @@ execute_menu_command (WEdit *edit_widget, const char *commands)
commands += i;
run_view = 1;
} else {
do_quote = 1; /* Default: Quote expanded macro */
do_quote = TRUE; /* Default: Quote expanded macro */
expand_prefix_found = 1;
}
} else
@ -747,7 +748,7 @@ menu_file_own(char* path)
* otherwise we are called from the mcedit menu.
*/
void
user_menu_cmd (WEdit *edit_widget)
user_menu_cmd (struct WEdit *edit_widget)
{
char *p;
char *data, **entries;

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

@ -6,12 +6,14 @@
#ifndef MC_USER_H
#define MC_USER_H
#include "src/editor/edit.h"
#include "lib/global.h"
void user_menu_cmd (WEdit *edit_widget);
char *expand_format (WEdit *edit_widget, char c, int quote);
struct WEdit;
void user_menu_cmd (struct WEdit *edit_widget);
char *expand_format (struct WEdit *edit_widget, char c, gboolean do_quote);
int check_format_view (const char *);
int check_format_var (const char *, char **);
int check_format_cd (const char *);
#endif
#endif /* MC_USER_H */

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

@ -1017,9 +1017,9 @@ history_get (const char *input_name)
g_strfreev (keys);
for (i = 0; i < keys_num; i++) {
char key_name[BUF_TINY];
g_snprintf (key_name, sizeof (key_name), "%lu", (unsigned long)i);
this_entry = mc_config_get_string (cfg, input_name, key_name, "");
char key[BUF_TINY];
g_snprintf (key, sizeof (key), "%lu", (unsigned long)i);
this_entry = mc_config_get_string (cfg, input_name, key, "");
if (this_entry != NULL)
hist = list_append_unique (hist, this_entry);
@ -1080,9 +1080,9 @@ history_put (const char *input_name, GList *h)
/* We shouldn't have null entries, but let's be sure */
if (text != NULL) {
char key_name[BUF_TINY];
g_snprintf (key_name, sizeof (key_name), "%d", i++);
mc_config_set_string(cfg,input_name, key_name, text);
char key[BUF_TINY];
g_snprintf (key, sizeof (key), "%d", i++);
mc_config_set_string (cfg, input_name, key, text);
}
}

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

@ -248,7 +248,7 @@ char *listbox_add_item (WListbox *l, enum append_pos pos, int
struct global_keymap_t;
WButtonBar *find_buttonbar (const Dlg_head *h);
void buttonbar_set_label (WButtonBar *bb, int index, const char *text,
void buttonbar_set_label (WButtonBar *bb, int idx, const char *text,
const struct global_keymap_t *keymap, const Widget *receiver);
#define buttonbar_clear_label(bb, idx, recv) buttonbar_set_label (bb, idx, "", NULL, recv)
void buttonbar_set_visible (WButtonBar *bb, gboolean visible);