summaryrefslogtreecommitdiff
path: root/src/nautilus-file-operations.c
diff options
context:
space:
mode:
authorErnestas Kulik <ernestask@gnome.org>2018-02-27 22:03:33 +0200
committerCarlos Soriano <csoriano1618@gmail.com>2018-03-01 08:37:50 +0000
commit6286e0a07959f171a4bc8d6c4e3dabd52d8ad8ee (patch)
tree0b91426fa70efeeb90b679f8e8f1d75d74752983 /src/nautilus-file-operations.c
parent72df1bb3bbefc48c77b0f532cbf3f5db386c7237 (diff)
downloadnautilus-6286e0a07959f171a4bc8d6c4e3dabd52d8ad8ee.tar.gz
general: don’t shadow variables
Shadowing variables is error-prone, since one might mean to refer to a variable that was declared earlier, but has the same name. Additionally, being more strict about variable scoping can help make the code more readable.
Diffstat (limited to 'src/nautilus-file-operations.c')
-rw-r--r--src/nautilus-file-operations.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index 1f3ff7967..4d84b98be 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -5044,9 +5044,8 @@ copy_move_file (CopyMoveJob *copy_job,
GError *error;
GFileCopyFlags flags;
char *primary, *secondary, *details;
- int response;
ProgressData pdata;
- gboolean would_recurse, is_merge;
+ gboolean would_recurse;
CommonJob *job;
gboolean res;
int unique_name_nr;
@@ -5088,6 +5087,8 @@ copy_move_file (CopyMoveJob *copy_job,
* detect and report it at this level) */
if (test_dir_is_parent (dest_dir, src))
{
+ int response;
+
if (job->skip_all_error)
{
goto out;
@@ -5128,6 +5129,8 @@ copy_move_file (CopyMoveJob *copy_job,
*/
if (test_dir_is_parent (src, dest))
{
+ int response;
+
if (job->skip_all_error)
{
goto out;
@@ -5375,6 +5378,8 @@ retry:
else if (IS_IO_ERROR (error, WOULD_RECURSE) ||
IS_IO_ERROR (error, WOULD_MERGE))
{
+ gboolean is_merge;
+
is_merge = error->code == G_IO_ERROR_WOULD_MERGE;
would_recurse = error->code == G_IO_ERROR_WOULD_RECURSE;
g_error_free (error);
@@ -5389,6 +5394,7 @@ retry:
{
g_autofree gchar *basename = NULL;
g_autofree gchar *filename = NULL;
+ int response;
if (job->skip_all_error)
{
@@ -5483,6 +5489,7 @@ retry:
{
g_autofree gchar *basename = NULL;
g_autofree gchar *filename = NULL;
+ int response;
if (job->skip_all_error)
{
@@ -5853,7 +5860,6 @@ move_file_prepare (CopyMoveJob *move_job,
CommonJob *job;
gboolean overwrite;
char *primary, *secondary, *details;
- int response;
GFileCopyFlags flags;
MoveFileCopyFallback *fallback;
gboolean handled_invalid_filename;
@@ -5871,6 +5877,8 @@ move_file_prepare (CopyMoveJob *move_job,
* detect and report it at this level) */
if (test_dir_is_parent (dest_dir, src))
{
+ int response;
+
if (job->skip_all_error)
{
goto out;
@@ -6067,6 +6075,7 @@ retry:
{
g_autofree gchar *basename = NULL;
g_autofree gchar *filename = NULL;
+ int response;
if (job->skip_all_error)
{
@@ -7421,7 +7430,7 @@ retry:
else
{
g_autofree gchar *basename = NULL;
- g_autofree gchar *filename = NULL;
+ g_autofree gchar *parse_name = NULL;
basename = get_basename (dest);
if (job->make_dir)
@@ -7434,9 +7443,9 @@ retry:
primary = g_strdup_printf (_("Error while creating file %s."),
basename);
}
- filename = get_truncated_parse_name (job->dest_dir);
+ parse_name = get_truncated_parse_name (job->dest_dir);
secondary = g_strdup_printf (_("There was an error creating the directory in %s."),
- filename);
+ parse_name);
details = error->message;