forked from enlightenment/enlightenment
E17: Patch from Maxime Villard (rustyBSD)
I. (strncmp(p, p2, PATH_MAX) == 0) && ((p[p2_len] == '/') || (p[p2_len] == '\0'))) Here we want to know if p and p2 are the same. It's easier to do a simple 'strcmp(p, p2)', and it's useless to check the value of p[p2_len], because if p = p2, p[p2_len] will always be \0. II. Check the string as for E_FM_OP_MOVE. III. Just a simplification. it was something like: if (type == E_FM_OP_COPY) X; if (type == E_FM_OP_COPY) Y; else ... I just replaced by if (type == E_FM_OP_COPY) { X; Y; } else ... SVN revision: 77015
This commit is contained in:
parent
0698d74a6a
commit
7f93d7305b
|
@ -235,12 +235,11 @@ main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
p = argv[i];
|
p = argv[i];
|
||||||
const char *name;
|
const char *name;
|
||||||
int name_len;
|
size_t name_len;
|
||||||
|
|
||||||
/* Don't move a dir into itself */
|
/* Don't move a dir into itself */
|
||||||
if (ecore_file_is_dir(p) &&
|
if (ecore_file_is_dir(p) &&
|
||||||
(strncmp(p, p2, PATH_MAX) == 0) &&
|
(strcmp(p, p2) == 0))
|
||||||
((p[p2_len] == '/') || (p[p2_len] == '\0')))
|
|
||||||
goto skip_arg;
|
goto skip_arg;
|
||||||
|
|
||||||
name = ecore_file_file_get(p);
|
name = ecore_file_file_get(p);
|
||||||
|
@ -258,7 +257,16 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (type == E_FM_OP_MOVE)
|
if (type == E_FM_OP_RENAME)
|
||||||
|
{
|
||||||
|
if (!strcmp(argv[i],buf))
|
||||||
|
goto skip_arg;
|
||||||
|
|
||||||
|
if (buf[0]!='/')
|
||||||
|
_E_FM_OP_ERROR_SEND_SCAN(0, E_FM_OP_ERROR,
|
||||||
|
"Unknown destination '%s': %s.", buf);
|
||||||
|
}
|
||||||
|
else if (type == E_FM_OP_MOVE)
|
||||||
{
|
{
|
||||||
if (!strcmp(argv[i],buf))
|
if (!strcmp(argv[i],buf))
|
||||||
goto skip_arg;
|
goto skip_arg;
|
||||||
|
@ -962,11 +970,9 @@ _e_fm_op_rollback(E_Fm_Op_Task *task)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
E_FREE(task->data);
|
E_FREE(task->data);
|
||||||
|
_e_fm_op_update_progress(task, -task->dst.done,
|
||||||
|
-task->src.st.st_size - (task->link ? REMOVECHUNKSIZE : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (task->type == E_FM_OP_COPY)
|
|
||||||
_e_fm_op_update_progress(task, -task->dst.done,
|
|
||||||
-task->src.st.st_size - (task->link ? REMOVECHUNKSIZE : 0));
|
|
||||||
else
|
else
|
||||||
_e_fm_op_update_progress(task, -REMOVECHUNKSIZE, -REMOVECHUNKSIZE);
|
_e_fm_op_update_progress(task, -REMOVECHUNKSIZE, -REMOVECHUNKSIZE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue