formatting

SVN revision: 72392
This commit is contained in:
Mike Blumenkrantz 2012-06-18 12:49:07 +00:00
parent 3d5b67d428
commit bd73abaffa
1 changed files with 368 additions and 362 deletions

View File

@ -18,7 +18,7 @@
# ifdef __cplusplus
extern "C"
# endif
void *alloca (size_t);
void *alloca(size_t);
#endif
#include <unistd.h>
@ -47,9 +47,9 @@ void *alloca (size_t);
#define COPYBUFSIZE 16384
#define REMOVECHUNKSIZE 4096
#define FREE(p) do { if (p) {free((void *)p); p = NULL;} } while (0)
#define FREE(p) do { if (p) {free((void *)p); p = NULL; } } while (0)
#define LG(fmt, args...) {\
#define LG(fmt, args ...) { \
FILE *f = fopen("log", "a"); \
if (f) fprintf(f, fmt, ##args); \
if (f) fclose(f); \
@ -62,7 +62,7 @@ static E_Fm_Op_Task *_e_fm_op_task_new();
static void _e_fm_op_task_free(void *t);
static void _e_fm_op_remove_link_task(E_Fm_Op_Task *task);
static Eina_Bool _e_fm_op_stdin_data(void *data, Ecore_Fd_Handler * fd_handler);
static Eina_Bool _e_fm_op_stdin_data(void *data, Ecore_Fd_Handler *fd_handler);
static void _e_fm_op_set_up_idlers();
static void _e_fm_op_delete_idler(int *mark);
static int _e_fm_op_idler_handle_error(int *mark, Eina_List **queue, Eina_List **node, E_Fm_Op_Task *task);
@ -70,24 +70,24 @@ static int _e_fm_op_idler_handle_error(int *mark, Eina_List **queue, Eina_List *
static Eina_Bool _e_fm_op_work_idler(void *data);
static Eina_Bool _e_fm_op_scan_idler(void *data);
static void _e_fm_op_send_error(E_Fm_Op_Task * task, E_Fm_Op_Type type, const char *fmt, ...);
static void _e_fm_op_rollback(E_Fm_Op_Task * task);
static void _e_fm_op_send_error(E_Fm_Op_Task *task, E_Fm_Op_Type type, const char *fmt, ...);
static void _e_fm_op_rollback(E_Fm_Op_Task *task);
static void _e_fm_op_update_progress_report_simple(int percent, const char *src, const char *dst);
static void _e_fm_op_update_progress(E_Fm_Op_Task *task, off_t _plus_e_fm_op_done, off_t _plus_e_fm_op_total);
static void _e_fm_op_copy_stat_info(E_Fm_Op_Task *task);
static int _e_fm_op_handle_overwrite(E_Fm_Op_Task *task);
static int _e_fm_op_copy_dir(E_Fm_Op_Task * task);
static int _e_fm_op_copy_dir(E_Fm_Op_Task *task);
static int _e_fm_op_copy_link(E_Fm_Op_Task *task);
static int _e_fm_op_copy_fifo(E_Fm_Op_Task *task);
static int _e_fm_op_open_files(E_Fm_Op_Task *task);
static int _e_fm_op_copy_chunk(E_Fm_Op_Task *task);
static int _e_fm_op_copy_atom(E_Fm_Op_Task * task);
static int _e_fm_op_scan_atom(E_Fm_Op_Task * task);
static int _e_fm_op_copy_stat_info_atom(E_Fm_Op_Task * task);
static int _e_fm_op_symlink_atom(E_Fm_Op_Task * task);
static int _e_fm_op_remove_atom(E_Fm_Op_Task * task);
static int _e_fm_op_copy_atom(E_Fm_Op_Task *task);
static int _e_fm_op_scan_atom(E_Fm_Op_Task *task);
static int _e_fm_op_copy_stat_info_atom(E_Fm_Op_Task *task);
static int _e_fm_op_symlink_atom(E_Fm_Op_Task *task);
static int _e_fm_op_remove_atom(E_Fm_Op_Task *task);
Ecore_Fd_Handler *_e_fm_op_stdin_handler = NULL;
@ -163,9 +163,12 @@ main(int argc, char **argv)
i = 2;
if (!strcmp(argv[1], "cp")) type = E_FM_OP_COPY;
else if (!strcmp(argv[1], "mv")) type = E_FM_OP_MOVE;
else if (!strcmp(argv[1], "rm")) type = E_FM_OP_REMOVE;
else if (!strcmp(argv[1], "lns")) type = E_FM_OP_SYMLINK;
else if (!strcmp(argv[1], "mv"))
type = E_FM_OP_MOVE;
else if (!strcmp(argv[1], "rm"))
type = E_FM_OP_REMOVE;
else if (!strcmp(argv[1], "lns"))
type = E_FM_OP_SYMLINK;
else return 0;
if ((type == E_FM_OP_COPY) ||
@ -255,7 +258,7 @@ main(int argc, char **argv)
eina_list_append(_e_fm_op_scan_queue, task);
}
skip_arg:
skip_arg:
free(p);
}
@ -414,7 +417,7 @@ _e_fm_op_remove_link_task(E_Fm_Op_Task *task)
* did not actually read enough data.
*/
static Eina_Bool
_e_fm_op_stdin_data(void *data __UNUSED__, Ecore_Fd_Handler * fd_handler)
_e_fm_op_stdin_data(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler)
{
int fd;
static char *buf = NULL;
@ -487,6 +490,7 @@ _e_fm_op_stdin_data(void *data __UNUSED__, Ecore_Fd_Handler * fd_handler)
_e_fm_op_abort = 1;
E_FM_OP_DEBUG("Aborted.\n");
break;
case E_FM_OP_ERROR_RESPONSE_ABORT:
case E_FM_OP_ERROR_RESPONSE_IGNORE_THIS:
case E_FM_OP_ERROR_RESPONSE_IGNORE_ALL:
@ -494,6 +498,7 @@ _e_fm_op_stdin_data(void *data __UNUSED__, Ecore_Fd_Handler * fd_handler)
_e_fm_op_error_response = identity;
_e_fm_op_set_up_idlers();
break;
case E_FM_OP_OVERWRITE_RESPONSE_NO:
case E_FM_OP_OVERWRITE_RESPONSE_NO_ALL:
case E_FM_OP_OVERWRITE_RESPONSE_YES:
@ -520,24 +525,24 @@ _e_fm_op_set_up_idlers()
_e_fm_op_work_idler_p = ecore_idler_add(_e_fm_op_work_idler, NULL);
}
#define _E_FM_OP_ERROR_SEND_SCAN(_task, _e_fm_op_error_type, _fmt, ...)\
do\
{\
int _errno = errno;\
_e_fm_op_scan_error = 1;\
_e_fm_op_send_error(_task, _e_fm_op_error_type, _fmt, __VA_ARGS__, strerror(_errno));\
return 1;\
}\
#define _E_FM_OP_ERROR_SEND_SCAN(_task, _e_fm_op_error_type, _fmt, ...) \
do \
{ \
int _errno = errno; \
_e_fm_op_scan_error = 1; \
_e_fm_op_send_error(_task, _e_fm_op_error_type, _fmt, __VA_ARGS__, strerror(_errno)); \
return 1; \
} \
while (0)
#define _E_FM_OP_ERROR_SEND_WORK(_task, _e_fm_op_error_type, _fmt, ...)\
do\
{\
int _errno = errno;\
_e_fm_op_work_error = 1;\
_e_fm_op_send_error(_task, _e_fm_op_error_type, _fmt, __VA_ARGS__, strerror(_errno));\
return 1;\
}\
#define _E_FM_OP_ERROR_SEND_WORK(_task, _e_fm_op_error_type, _fmt, ...) \
do \
{ \
int _errno = errno; \
_e_fm_op_work_error = 1; \
_e_fm_op_send_error(_task, _e_fm_op_error_type, _fmt, __VA_ARGS__, strerror(_errno)); \
return 1; \
} \
while (0)
static void
@ -627,7 +632,7 @@ _e_fm_op_idler_handle_error(int *mark, Eina_List **queue, Eina_List **node, E_Fm
}
}
}
else if (( _e_fm_op_work_error) || (_e_fm_op_scan_error))
else if ((_e_fm_op_work_error) || (_e_fm_op_scan_error))
return 1;
return 0;
}
@ -798,7 +803,7 @@ _e_fm_op_scan_idler(void *data __UNUSED__)
{
Eina_File_Direct_Info *info;
if (!eina_iterator_next(dir, (void**) &info))
if (!eina_iterator_next(dir, (void **)&info))
{
ntask = _e_fm_op_task_new();
ntask->type = E_FM_OP_COPY_STAT_INFO;
@ -1017,11 +1022,11 @@ _e_fm_op_update_progress(E_Fm_Op_Task *task, off_t _plus_e_fm_op_done, off_t _pl
if (!s_time) s_time = ecore_time_get();
/* Update ETA once a second */
if ((_e_fm_op_done) && (ecore_time_get() - c_time > 1.0 ))
if ((_e_fm_op_done) && (ecore_time_get() - c_time > 1.0))
{
c_time = ecore_time_get();
eta = (c_time - s_time) * (_e_fm_op_total - _e_fm_op_done) / _e_fm_op_done;
eta = (int) (eta + 0.5);
eta = (int)(eta + 0.5);
}
if ((percent != ppercent) || (eta != peta) || ((task) && (task != ptask)))
@ -1110,7 +1115,7 @@ _e_fm_op_handle_overwrite(E_Fm_Op_Task *task)
}
static int
_e_fm_op_copy_dir(E_Fm_Op_Task * task)
_e_fm_op_copy_dir(E_Fm_Op_Task *task)
{
struct stat st;
@ -1313,7 +1318,7 @@ _e_fm_op_copy_chunk(E_Fm_Op_Task *task)
* Return value does not matter. It's there only to _E_FM_OP_ERROR_SEND macro to work correctly. (Well, it works fine, just don't want GCC to produce a warning.)
*/
static int
_e_fm_op_copy_atom(E_Fm_Op_Task * task)
_e_fm_op_copy_atom(E_Fm_Op_Task *task)
{
E_Fm_Op_Copy_Data *data;
@ -1362,7 +1367,7 @@ _e_fm_op_copy_atom(E_Fm_Op_Task * task)
}
static int
_e_fm_op_scan_atom(E_Fm_Op_Task * task)
_e_fm_op_scan_atom(E_Fm_Op_Task *task)
{
E_Fm_Op_Task *ctask, *rtask;
@ -1467,7 +1472,7 @@ _e_fm_op_scan_atom(E_Fm_Op_Task * task)
}
static int
_e_fm_op_copy_stat_info_atom(E_Fm_Op_Task * task)
_e_fm_op_copy_stat_info_atom(E_Fm_Op_Task *task)
{
E_FM_OP_DEBUG("Stat: %s --> %s\n", task->src.name, task->dst.name);
@ -1498,7 +1503,7 @@ _e_fm_op_symlink_atom(E_Fm_Op_Task *task)
}
static int
_e_fm_op_remove_atom(E_Fm_Op_Task * task)
_e_fm_op_remove_atom(E_Fm_Op_Task *task)
{
if (_e_fm_op_abort) return 1;
@ -1530,3 +1535,4 @@ _e_fm_op_remove_atom(E_Fm_Op_Task * task)
return 1;
}