mirror of
https://github.com/MidnightCommander/mc
synced 2025-03-26 17:53:18 +03:00
Code cleanup: removed unused variables amd removed unnedeed code.
Signed-off-by: Slava Zanko <slavazanko@gmail.com> Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
71ebcc5896
commit
23c95d36ac
@ -99,7 +99,6 @@ static void
|
||||
load_codepages_list_from_file (GPtrArray ** list, const char *fname)
|
||||
{
|
||||
FILE *f;
|
||||
guint i;
|
||||
char buf[BUF_MEDIUM];
|
||||
char *default_codepage = NULL;
|
||||
|
||||
@ -107,7 +106,7 @@ load_codepages_list_from_file (GPtrArray ** list, const char *fname)
|
||||
if (f == NULL)
|
||||
return;
|
||||
|
||||
for (i = 0; fgets (buf, sizeof buf, f) != NULL;)
|
||||
while (fgets (buf, sizeof buf, f) != NULL)
|
||||
{
|
||||
/* split string into id and cpname */
|
||||
char *p = buf;
|
||||
@ -141,6 +140,8 @@ load_codepages_list_from_file (GPtrArray ** list, const char *fname)
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
/* whether id is already present in list */
|
||||
/* if yes, overwrite description */
|
||||
for (i = 0; i < (*list)->len; i++)
|
||||
|
@ -319,7 +319,6 @@ str_8bit_fit_to_term (const char *text, int width, align_crt_t just_mode)
|
||||
goto finally;
|
||||
memset (actual, ' ', width - length - ident);
|
||||
actual += width - length - ident;
|
||||
remain -= width - length - ident;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -393,7 +392,6 @@ str_8bit_term_trim (const char *text, int width)
|
||||
{
|
||||
memset (actual, '.', width);
|
||||
actual += width;
|
||||
remain -= width;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -260,7 +260,6 @@ str_ascii_fit_to_term (const char *text, int width, align_crt_t just_mode)
|
||||
goto finally;
|
||||
memset (actual, ' ', width - length - ident);
|
||||
actual += width - length - ident;
|
||||
remain -= width - length - ident;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -340,7 +339,6 @@ str_ascii_term_trim (const char *text, int width)
|
||||
{
|
||||
memset (actual, '.', width);
|
||||
actual += width;
|
||||
remain -= width;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -104,13 +104,11 @@ mc_def_getlocalcopy (const vfs_path_t * filename_vpath)
|
||||
fdin = -1;
|
||||
if (i == -1)
|
||||
goto fail;
|
||||
|
||||
i = close (fdout);
|
||||
fdout = -1;
|
||||
if (i == -1)
|
||||
{
|
||||
fdout = -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (mc_stat (filename_vpath, &mystat) != -1)
|
||||
mc_chmod (tmp_vpath, mystat.st_mode);
|
||||
|
@ -114,14 +114,12 @@ draw_history_button (WInput * in)
|
||||
|
||||
widget_move (&in->widget, 0, in->field_width - HISTORY_BUTTON_WIDTH);
|
||||
tty_setcolor (disabled ? DISABLED_COLOR : in->color[WINPUTC_HISTORY]);
|
||||
|
||||
#ifdef LARGE_HISTORY_BUTTON
|
||||
{
|
||||
Dlg_head *h;
|
||||
h = in->widget.owner;
|
||||
tty_print_string ("[ ]");
|
||||
widget_move (&in->widget, 0, in->field_width - HISTORY_BUTTON_WIDTH + 1);
|
||||
}
|
||||
tty_print_string ("[ ]");
|
||||
widget_move (&in->widget, 0, in->field_width - HISTORY_BUTTON_WIDTH + 1);
|
||||
#endif
|
||||
|
||||
tty_print_char (c);
|
||||
}
|
||||
|
||||
@ -1137,8 +1135,6 @@ input_handle_char (WInput * in, int key)
|
||||
cb_ret_t v;
|
||||
unsigned long command;
|
||||
|
||||
v = MSG_NOT_HANDLED;
|
||||
|
||||
if (quote != 0)
|
||||
{
|
||||
input_free_completions (in);
|
||||
|
@ -86,7 +86,9 @@ static gboolean parse_mc_v_argument (const gchar * option_name, const gchar * va
|
||||
|
||||
static GOptionContext *context;
|
||||
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
static gboolean mc_args__nouse_subshell = FALSE;
|
||||
#endif /* HAVE_SUBSHELL_SUPPORT */
|
||||
static gboolean mc_args__show_datadirs = FALSE;
|
||||
static gboolean mc_args__show_datadirs_extended = FALSE;
|
||||
static gboolean mc_args__show_configure_opts = FALSE;
|
||||
|
@ -592,31 +592,22 @@ dview_get_utf (char *str, int *char_width, gboolean * result)
|
||||
if (str == NULL)
|
||||
{
|
||||
*result = FALSE;
|
||||
width = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
res = g_utf8_get_char_validated (str, -1);
|
||||
|
||||
if (res < 0)
|
||||
{
|
||||
ch = *str;
|
||||
width = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ch = res;
|
||||
/* Calculate UTF-8 char width */
|
||||
next_ch = g_utf8_next_char (str);
|
||||
if (next_ch)
|
||||
{
|
||||
if (next_ch != NULL)
|
||||
width = next_ch - str;
|
||||
}
|
||||
else
|
||||
{
|
||||
ch = 0;
|
||||
width = 0;
|
||||
}
|
||||
}
|
||||
*char_width = width;
|
||||
return ch;
|
||||
|
@ -555,7 +555,7 @@ edit_block_delete (WEdit * edit)
|
||||
{
|
||||
long count;
|
||||
long start_mark, end_mark;
|
||||
int curs_pos, line_width;
|
||||
int curs_pos;
|
||||
long curs_line, c1, c2;
|
||||
|
||||
if (eval_marks (edit, &start_mark, &end_mark))
|
||||
@ -583,9 +583,6 @@ edit_block_delete (WEdit * edit)
|
||||
|
||||
curs_line = edit->curs_line;
|
||||
|
||||
/* calculate line width and cursor position before cut */
|
||||
line_width = edit_move_forward3 (edit, edit_bol (edit, edit->curs1), 0,
|
||||
edit_eol (edit, edit->curs1));
|
||||
curs_pos = edit->curs_col + edit->over_col;
|
||||
|
||||
/* move cursor to start of selection */
|
||||
@ -596,12 +593,14 @@ edit_block_delete (WEdit * edit)
|
||||
{
|
||||
if (edit->column_highlight)
|
||||
{
|
||||
int line_width;
|
||||
|
||||
if (edit->mark2 < 0)
|
||||
edit_mark_cmd (edit, 0);
|
||||
edit_delete_column_of_text (edit);
|
||||
/* move cursor to the saved position */
|
||||
edit_move_to_line (edit, curs_line);
|
||||
/* calculate line width after cut */
|
||||
/* calculate line width and cursor position before cut */
|
||||
line_width = edit_move_forward3 (edit, edit_bol (edit, edit->curs1), 0,
|
||||
edit_eol (edit, edit->curs1));
|
||||
if (option_cursor_beyond_eol && curs_pos > line_width)
|
||||
|
@ -258,15 +258,13 @@ do_chown (uid_t u, gid_t g)
|
||||
static void
|
||||
apply_chowns (uid_t u, gid_t g)
|
||||
{
|
||||
char *fname;
|
||||
|
||||
need_update = end_chown = 1;
|
||||
do_chown (u, g);
|
||||
|
||||
do
|
||||
{
|
||||
fname = next_file ();
|
||||
|
||||
next_file ();
|
||||
do_chown (u, g);
|
||||
}
|
||||
while (current_panel->marked);
|
||||
|
@ -236,7 +236,7 @@ select_unselect_cmd (const char *title, const char *history_name, gboolean do_se
|
||||
if (quick_dialog (&quick_dlg) == B_CANCEL)
|
||||
return;
|
||||
|
||||
if (!reg_exp)
|
||||
if (reg_exp == NULL)
|
||||
return;
|
||||
if (!*reg_exp)
|
||||
{
|
||||
|
@ -631,10 +631,7 @@ create_panels (void)
|
||||
|
||||
/* 3. Create active panel */
|
||||
if (current_dir == NULL)
|
||||
{
|
||||
current_dir = vfs_path_to_str (original_dir);
|
||||
mc_chdir (original_dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
vfs_path_t *vpath;
|
||||
|
@ -3015,6 +3015,8 @@ subshell_chdir (const vfs_path_t * vpath)
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
if (mc_global.tty.use_subshell && vfs_current_is_local ())
|
||||
do_subshell_chdir (vpath, FALSE, TRUE);
|
||||
#else /* HAVE_SUBSHELL_SUPPORT */
|
||||
(void) vpath;
|
||||
#endif /* HAVE_SUBSHELL_SUPPORT */
|
||||
}
|
||||
|
||||
|
@ -408,7 +408,7 @@ tree_store_add_entry (const vfs_path_t * name)
|
||||
abort ();
|
||||
|
||||
/* Search for the correct place */
|
||||
while (current && (flag = pathcmp (current->name, name)) < 0)
|
||||
while (current != NULL && (flag = pathcmp (current->name, name)) < 0)
|
||||
{
|
||||
old = current;
|
||||
current = current->next;
|
||||
@ -430,7 +430,8 @@ tree_store_add_entry (const vfs_path_t * name)
|
||||
}
|
||||
else
|
||||
{
|
||||
old->next = new;
|
||||
if (old != NULL)
|
||||
old->next = new;
|
||||
new->prev = old;
|
||||
}
|
||||
new->next = NULL;
|
||||
@ -440,7 +441,7 @@ tree_store_add_entry (const vfs_path_t * name)
|
||||
{
|
||||
/* Insert in to the middle of the list */
|
||||
new->prev = old;
|
||||
if (old)
|
||||
if (old != NULL)
|
||||
{
|
||||
/* Yes, in the middle */
|
||||
new->next = old->next;
|
||||
|
@ -710,18 +710,24 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
||||
char *temp;
|
||||
char *data_start = buffer + 1;
|
||||
char *filename = data_start;
|
||||
char *linkname = data_start;
|
||||
char *filename_bound = filename + strlen (filename);
|
||||
char *linkname_bound = filename_bound;
|
||||
char *filename_bound;
|
||||
|
||||
filename_bound = filename + strlen (filename);
|
||||
|
||||
if (!strcmp (data_start, "\".\"") || !strcmp (data_start, "\"..\""))
|
||||
break; /* We'll do "." and ".." ourselves */
|
||||
|
||||
if (S_ISLNK (ST.st_mode))
|
||||
{
|
||||
char *linkname;
|
||||
char *linkname_bound;
|
||||
/* we expect: "escaped-name" -> "escaped-name"
|
||||
// -> cannot occur in filenames,
|
||||
// because it will be escaped to -\> */
|
||||
|
||||
|
||||
linkname_bound = filename_bound;
|
||||
|
||||
if (*filename == '"')
|
||||
++filename;
|
||||
|
||||
|
@ -2488,7 +2488,8 @@ ftpfs_netrc_lookup (const char *host, char **login, char **pass)
|
||||
}
|
||||
|
||||
/* Ignore unsafe passwords */
|
||||
if (strcmp (*login, "anonymous") && strcmp (*login, "ftp")
|
||||
if (*login != NULL &&
|
||||
strcmp (*login, "anonymous") != 0 && strcmp (*login, "ftp") != 0
|
||||
&& ftpfs_netrc_bad_mode (netrcname))
|
||||
{
|
||||
need_break = 1;
|
||||
|
@ -190,7 +190,9 @@ sfs_vfmake (const vfs_path_t * vpath, vfs_path_t * cache_vpath)
|
||||
COPY_CHAR;
|
||||
continue;
|
||||
}
|
||||
COPY_STRING (ptr);
|
||||
if (ptr != NULL) {
|
||||
COPY_STRING (ptr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -811,10 +811,9 @@ tar_open_archive (struct vfs_s_super *archive, const vfs_path_t * vpath,
|
||||
}
|
||||
|
||||
/* Record of zeroes */
|
||||
case STATUS_EOFMARK:
|
||||
status = prev_status; /* If error after 0's */
|
||||
case STATUS_EOFMARK: /* If error after 0's */
|
||||
/* FALL THRU */
|
||||
|
||||
/* exit from loop */
|
||||
case STATUS_EOF: /* End of archive */
|
||||
break;
|
||||
}
|
||||
|
@ -88,31 +88,22 @@ utf8_to_int (char *str, int *char_width, gboolean * result)
|
||||
if (str == NULL)
|
||||
{
|
||||
*result = FALSE;
|
||||
width = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
res = g_utf8_get_char_validated (str, -1);
|
||||
|
||||
if (res < 0)
|
||||
{
|
||||
ch = *str;
|
||||
width = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ch = res;
|
||||
/* Calculate UTF-8 char width */
|
||||
next_ch = g_utf8_next_char (str);
|
||||
if (next_ch)
|
||||
{
|
||||
width = next_ch - str;
|
||||
}
|
||||
else
|
||||
{
|
||||
ch = 0;
|
||||
width = 0;
|
||||
}
|
||||
}
|
||||
*char_width = width;
|
||||
return ch;
|
||||
|
Loading…
x
Reference in New Issue
Block a user