mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
Revert "Try fix of compile warnings about assigned but unused variables"
This reverts commit 6505f7d6fa
.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
03916ee15b
commit
acdac76a49
@ -208,8 +208,9 @@ mc_util_write_backup_content (const char *from_file_name, const char *to_file_na
|
||||
if (fwrite ((const void *) contents, 1, length, backup_fd) != length)
|
||||
ret1 = FALSE;
|
||||
{
|
||||
(void) fflush (backup_fd);
|
||||
(void) fclose (backup_fd);
|
||||
int ret2;
|
||||
ret2 = fflush (backup_fd);
|
||||
ret2 = fclose (backup_fd);
|
||||
}
|
||||
g_free (contents);
|
||||
return ret1;
|
||||
|
@ -1523,8 +1523,10 @@ vfs_s_get_line (struct vfs_class *me, int sock, char *buf, int buf_len, char ter
|
||||
{
|
||||
if (logfile)
|
||||
{
|
||||
(void) fwrite (&c, 1, 1, logfile);
|
||||
(void) fflush (logfile);
|
||||
size_t ret1;
|
||||
int ret2;
|
||||
ret1 = fwrite (&c, 1, 1, logfile);
|
||||
ret2 = fflush (logfile);
|
||||
}
|
||||
if (c == '\n')
|
||||
return 1;
|
||||
|
@ -200,7 +200,7 @@ background_attention (int fd, void *closure)
|
||||
/* void *routine; */
|
||||
int argc, i, result, status;
|
||||
char *data[MAXCALLARGS];
|
||||
ssize_t bytes;
|
||||
ssize_t bytes, ret;
|
||||
struct TaskList *p;
|
||||
int to_child_fd = -1;
|
||||
enum ReturnType type;
|
||||
@ -330,9 +330,9 @@ background_attention (int fd, void *closure)
|
||||
}
|
||||
|
||||
/* Send the result code and the value for shared variables */
|
||||
(void) write (to_child_fd, &result, sizeof (int));
|
||||
ret = write (to_child_fd, &result, sizeof (int));
|
||||
if (have_ctx && to_child_fd != -1)
|
||||
(void) write (to_child_fd, ctx, sizeof (FileOpContext));
|
||||
ret = write (to_child_fd, ctx, sizeof (FileOpContext));
|
||||
}
|
||||
else if (type == Return_String)
|
||||
{
|
||||
@ -365,15 +365,15 @@ background_attention (int fd, void *closure)
|
||||
if (resstr)
|
||||
{
|
||||
len = strlen (resstr);
|
||||
(void) write (to_child_fd, &len, sizeof (len));
|
||||
ret = write (to_child_fd, &len, sizeof (len));
|
||||
if (len != 0)
|
||||
(void) write (to_child_fd, resstr, len);
|
||||
ret = write (to_child_fd, resstr, len);
|
||||
g_free (resstr);
|
||||
}
|
||||
else
|
||||
{
|
||||
len = 0;
|
||||
(void) write (to_child_fd, &len, sizeof (len));
|
||||
ret = write (to_child_fd, &len, sizeof (len));
|
||||
}
|
||||
}
|
||||
for (i = 0; i < argc; i++)
|
||||
@ -398,16 +398,17 @@ static void
|
||||
parent_call_header (void *routine, int argc, enum ReturnType type, FileOpContext * ctx)
|
||||
{
|
||||
int have_ctx;
|
||||
ssize_t ret;
|
||||
|
||||
have_ctx = (ctx != NULL);
|
||||
|
||||
(void) write (parent_fd, &routine, sizeof (routine));
|
||||
(void) write (parent_fd, &argc, sizeof (int));
|
||||
(void) write (parent_fd, &type, sizeof (type));
|
||||
(void) write (parent_fd, &have_ctx, sizeof (have_ctx));
|
||||
ret = write (parent_fd, &routine, sizeof (routine));
|
||||
ret = write (parent_fd, &argc, sizeof (int));
|
||||
ret = write (parent_fd, &type, sizeof (type));
|
||||
ret = write (parent_fd, &have_ctx, sizeof (have_ctx));
|
||||
|
||||
if (have_ctx)
|
||||
(void) write (parent_fd, ctx, sizeof (FileOpContext));
|
||||
ret = write (parent_fd, ctx, sizeof (FileOpContext));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -416,6 +417,7 @@ static int
|
||||
parent_va_call (void *routine, gpointer data, int argc, va_list ap)
|
||||
{
|
||||
int i;
|
||||
ssize_t ret;
|
||||
struct FileOpContext *ctx = (struct FileOpContext *) data;
|
||||
|
||||
parent_call_header (routine, argc, Return_Integer, ctx);
|
||||
@ -426,13 +428,13 @@ parent_va_call (void *routine, gpointer data, int argc, va_list ap)
|
||||
|
||||
len = va_arg (ap, int);
|
||||
value = va_arg (ap, void *);
|
||||
(void) write (parent_fd, &len, sizeof (int));
|
||||
(void) write (parent_fd, value, len);
|
||||
ret = write (parent_fd, &len, sizeof (int));
|
||||
ret = write (parent_fd, value, len);
|
||||
}
|
||||
|
||||
(void) read (from_parent_fd, &i, sizeof (int));
|
||||
ret = read (from_parent_fd, &i, sizeof (int));
|
||||
if (ctx)
|
||||
(void) read (from_parent_fd, ctx, sizeof (FileOpContext));
|
||||
ret = read (from_parent_fd, ctx, sizeof (FileOpContext));
|
||||
|
||||
return i;
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ clipboard_file_to_ext_clip (const gchar * event_group_name, const gchar * event_
|
||||
gpointer init_data, gpointer data)
|
||||
{
|
||||
char *tmp, *cmd;
|
||||
int res = 0;
|
||||
const char *d = getenv ("DISPLAY");
|
||||
|
||||
(void) event_group_name;
|
||||
@ -80,7 +81,7 @@ clipboard_file_to_ext_clip (const gchar * event_group_name, const gchar * event_
|
||||
cmd = g_strconcat (clipboard_store_path, " ", tmp, " 2>/dev/null", (char *) NULL);
|
||||
|
||||
if (cmd != NULL)
|
||||
(void) my_system (EXECUTE_AS_SHELL, shell, cmd);
|
||||
res = my_system (EXECUTE_AS_SHELL, shell, cmd);
|
||||
|
||||
g_free (cmd);
|
||||
g_free (tmp);
|
||||
@ -126,6 +127,7 @@ clipboard_text_to_file (const gchar * event_group_name, const gchar * event_name
|
||||
{
|
||||
int file;
|
||||
vfs_path_t *fname_vpath = NULL;
|
||||
ssize_t ret;
|
||||
size_t str_len;
|
||||
const char *text = (const char *) data;
|
||||
|
||||
@ -145,7 +147,7 @@ clipboard_text_to_file (const gchar * event_group_name, const gchar * event_name
|
||||
return TRUE;
|
||||
|
||||
str_len = strlen (text);
|
||||
(void) mc_write (file, (char *) text, str_len);
|
||||
ret = mc_write (file, (char *) text, str_len);
|
||||
mc_close (file);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -90,6 +90,7 @@ show_console_contents_linux (int starty, unsigned char begin_line, unsigned char
|
||||
unsigned char message = 0;
|
||||
unsigned short bytes = 0;
|
||||
int i;
|
||||
ssize_t ret;
|
||||
|
||||
/* Is tty console? */
|
||||
if (mc_global.tty.console_flag == '\0')
|
||||
@ -104,29 +105,29 @@ show_console_contents_linux (int starty, unsigned char begin_line, unsigned char
|
||||
|
||||
/* Send command to the console handler */
|
||||
message = CONSOLE_CONTENTS;
|
||||
(void) write (pipefd1[1], &message, 1);
|
||||
ret = write (pipefd1[1], &message, 1);
|
||||
/* Check for outdated cons.saver */
|
||||
(void) read (pipefd2[0], &message, 1);
|
||||
ret = read (pipefd2[0], &message, 1);
|
||||
if (message != CONSOLE_CONTENTS)
|
||||
return;
|
||||
|
||||
/* Send the range of lines that we want */
|
||||
(void) write (pipefd1[1], &begin_line, 1);
|
||||
(void) write (pipefd1[1], &end_line, 1);
|
||||
ret = write (pipefd1[1], &begin_line, 1);
|
||||
ret = write (pipefd1[1], &end_line, 1);
|
||||
/* Read the corresponding number of bytes */
|
||||
(void) read (pipefd2[0], &bytes, 2);
|
||||
ret = read (pipefd2[0], &bytes, 2);
|
||||
|
||||
/* Read the bytes and output them */
|
||||
for (i = 0; i < bytes; i++)
|
||||
{
|
||||
if ((i % COLS) == 0)
|
||||
tty_gotoyx (starty + (i / COLS), 0);
|
||||
(void) read (pipefd2[0], &message, 1);
|
||||
ret = read (pipefd2[0], &message, 1);
|
||||
tty_print_char (message);
|
||||
}
|
||||
|
||||
/* Read the value of the mc_global.tty.console_flag */
|
||||
(void) read (pipefd2[0], &message, 1);
|
||||
ret = read (pipefd2[0], &message, 1);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -239,9 +240,10 @@ handle_console_linux (console_action_t action)
|
||||
if (action == CONSOLE_DONE || mc_global.tty.console_flag == '\0')
|
||||
{
|
||||
/* We are done -> Let's clean up */
|
||||
pid_t ret;
|
||||
close (pipefd1[1]);
|
||||
close (pipefd2[0]);
|
||||
(void) waitpid (cons_saver_pid, &status, 0);
|
||||
ret = waitpid (cons_saver_pid, &status, 0);
|
||||
mc_global.tty.console_flag = '\0';
|
||||
}
|
||||
break;
|
||||
|
@ -143,7 +143,8 @@ send_contents (char *buffer, unsigned int columns, unsigned int rows)
|
||||
static void __attribute__ ((noreturn)) die (void)
|
||||
{
|
||||
unsigned char zero = 0;
|
||||
(void) write (1, &zero, 1);
|
||||
ssize_t ret;
|
||||
ret = write (1, &zero, 1);
|
||||
exit (3);
|
||||
}
|
||||
|
||||
|
@ -2148,6 +2148,7 @@ static void
|
||||
do_merge_hunk (WDiff * dview)
|
||||
{
|
||||
int from1, to1, from2, to2;
|
||||
int res;
|
||||
int hunk;
|
||||
|
||||
hunk = get_current_hunk (dview, &from1, &to1, &from2, &to2);
|
||||
@ -2194,7 +2195,7 @@ do_merge_hunk (WDiff * dview)
|
||||
}
|
||||
fflush (merge_file);
|
||||
fclose (merge_file);
|
||||
rewrite_backup_content (merge_file_name_vpath, dview->file[0]);
|
||||
res = rewrite_backup_content (merge_file_name_vpath, dview->file[0]);
|
||||
mc_unlink (merge_file_name_vpath);
|
||||
vfs_path_free (merge_file_name_vpath);
|
||||
}
|
||||
@ -2976,7 +2977,7 @@ dview_ok_to_exit (WDiff * dview)
|
||||
break;
|
||||
case 1: /* No */
|
||||
if (mc_util_restore_from_backup_if_possible (dview->file[0], "~~~"))
|
||||
mc_util_unlink_backup_if_possible (dview->file[0], "~~~");
|
||||
res = mc_util_unlink_backup_if_possible (dview->file[0], "~~~");
|
||||
/* fall through */
|
||||
default:
|
||||
res = TRUE;
|
||||
|
@ -1694,9 +1694,10 @@ do_find (const char *start_dir, ssize_t start_dir_len, const char *ignore_dirs,
|
||||
/* absolute path */
|
||||
if (start_dir_len < 0)
|
||||
{
|
||||
int ret;
|
||||
vfs_path_free (current_panel->cwd_vpath);
|
||||
current_panel->cwd_vpath = vfs_path_from_str (PATH_SEP_STR);
|
||||
chdir (PATH_SEP_STR);
|
||||
ret = chdir (PATH_SEP_STR);
|
||||
}
|
||||
panelize_save_panel (current_panel);
|
||||
}
|
||||
|
@ -4123,7 +4123,7 @@ panel_new_with_dir (const char *panel_name, const char *wpath)
|
||||
vfs_path_t *vpath;
|
||||
|
||||
vpath = vfs_path_from_str (curdir);
|
||||
mc_chdir (vpath);
|
||||
err = mc_chdir (vpath);
|
||||
vfs_path_free (vpath);
|
||||
}
|
||||
g_free (curdir);
|
||||
|
@ -388,8 +388,9 @@ do_external_panelize (char *command)
|
||||
current_panel->count = next_free;
|
||||
if (list->list[0].fname[0] == PATH_SEP)
|
||||
{
|
||||
int ret;
|
||||
panel_set_cwd (current_panel, PATH_SEP_STR);
|
||||
chdir (PATH_SEP_STR);
|
||||
ret = chdir (PATH_SEP_STR);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -739,6 +739,7 @@ static void
|
||||
tree_rescan (void *data)
|
||||
{
|
||||
WTree *tree = data;
|
||||
int ret;
|
||||
vfs_path_t *old_vpath;
|
||||
|
||||
old_vpath = vfs_path_clone (vfs_get_raw_current_dir ());
|
||||
@ -748,7 +749,7 @@ tree_rescan (void *data)
|
||||
if (tree->selected_ptr != NULL && mc_chdir (tree->selected_ptr->name) == 0)
|
||||
{
|
||||
tree_store_rescan (tree->selected_ptr->name);
|
||||
mc_chdir (old_vpath);
|
||||
ret = mc_chdir (old_vpath);
|
||||
}
|
||||
vfs_path_free (old_vpath);
|
||||
}
|
||||
|
@ -603,8 +603,10 @@ main (int argc, char *argv[])
|
||||
S_IRUSR | S_IWUSR);
|
||||
if (last_wd_fd != -1)
|
||||
{
|
||||
(void) write (last_wd_fd, last_wd_string, strlen (last_wd_string));
|
||||
(void) close (last_wd_fd);
|
||||
ssize_t ret1;
|
||||
int ret2;
|
||||
ret1 = write (last_wd_fd, last_wd_string, strlen (last_wd_string));
|
||||
ret2 = close (last_wd_fd);
|
||||
}
|
||||
}
|
||||
g_free (last_wd_string);
|
||||
|
@ -252,7 +252,10 @@ init_subshell_child (const char *pty_name)
|
||||
|
||||
/* It simplifies things to change to our home directory here, */
|
||||
/* and the user's startup file may do a `cd' command anyway */
|
||||
chdir (mc_config_get_home_dir ()); /* FIXME? What about when we re-run the subshell? */
|
||||
{
|
||||
int ret;
|
||||
ret = chdir (mc_config_get_home_dir ()); /* FIXME? What about when we re-run the subshell? */
|
||||
}
|
||||
|
||||
/* Set MC_SID to prevent running one mc from another */
|
||||
mc_sid = getsid (0);
|
||||
|
@ -251,8 +251,9 @@ fish_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply, c
|
||||
|
||||
if (logfile)
|
||||
{
|
||||
(void) fwrite (str, strlen (str), 1, logfile);
|
||||
(void) fflush (logfile);
|
||||
size_t ret;
|
||||
ret = fwrite (str, strlen (str), 1, logfile);
|
||||
ret = fflush (logfile);
|
||||
}
|
||||
|
||||
tty_enable_interrupt_key ();
|
||||
@ -329,13 +330,13 @@ fish_pipeopen (struct vfs_s_super *super, const char *path, const char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
(void) dup2 (fileset1[0], 0);
|
||||
res = dup2 (fileset1[0], 0);
|
||||
close (fileset1[0]);
|
||||
close (fileset1[1]);
|
||||
(void) dup2 (fileset2[1], 1);
|
||||
res = dup2 (fileset2[1], 1);
|
||||
close (2);
|
||||
/* stderr to /dev/null */
|
||||
(void) open ("/dev/null", O_WRONLY);
|
||||
res = open ("/dev/null", O_WRONLY);
|
||||
close (fileset2[0]);
|
||||
close (fileset2[1]);
|
||||
execvp (path, const_cast (char **, argv));
|
||||
|
@ -477,7 +477,8 @@ ftpfs_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply,
|
||||
}
|
||||
else
|
||||
{
|
||||
(void) fwrite (cmdstr, cmdlen, 1, MEDATA->logfile);
|
||||
size_t ret;
|
||||
ret = fwrite (cmdstr, cmdlen, 1, MEDATA->logfile);
|
||||
}
|
||||
|
||||
fflush (MEDATA->logfile);
|
||||
|
Loading…
Reference in New Issue
Block a user