* cmd.c: Change all "long" variables to "off_t" whenever they
are used to store file sizes. * file.c: Likewise. * file.h: Likewise. * fileopctx.h: Likewise. * tree.c: Likewise. * filegui.c: Likewise. (show_bar): Take "double" arguments. Normalize arguments of gauge_set_value() before converting them to "int".
Этот коммит содержится в:
родитель
9ce4c8d71a
Коммит
5e3bb68e26
@ -1,3 +1,15 @@
|
||||
2001-09-21 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* cmd.c: Change all "long" variables to "off_t" whenever they
|
||||
are used to store file sizes.
|
||||
* file.c: Likewise.
|
||||
* file.h: Likewise.
|
||||
* fileopctx.h: Likewise.
|
||||
* tree.c: Likewise.
|
||||
* filegui.c: Likewise.
|
||||
(show_bar): Take "double" arguments. Normalize arguments of
|
||||
gauge_set_value() before converting them to "int".
|
||||
|
||||
2001-09-17 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* mouse.h: Major cleanup and interface change. init_mouse()
|
||||
|
@ -593,7 +593,7 @@ void unselect_cmd (void)
|
||||
int check_for_default(char *default_file, char *file)
|
||||
{
|
||||
struct stat s;
|
||||
long count = 0;
|
||||
off_t count = 0;
|
||||
double bytes = 0;
|
||||
FileOpContext *ctx;
|
||||
|
||||
@ -714,7 +714,7 @@ void reselect_vfs (void)
|
||||
}
|
||||
#endif /* USE_VFS */
|
||||
|
||||
static int compare_files (char *name1, char *name2, long size)
|
||||
static int compare_files (char *name1, char *name2, off_t size)
|
||||
{
|
||||
int file1, file2;
|
||||
int result = -1; /* Different by default */
|
||||
@ -1357,7 +1357,7 @@ dirsizes_cmd (void)
|
||||
{
|
||||
WPanel *panel = cpanel;
|
||||
int i;
|
||||
long marked;
|
||||
off_t marked;
|
||||
double total;
|
||||
|
||||
for (i = 0; i < panel->count; i++)
|
||||
|
32
src/file.c
32
src/file.c
@ -147,7 +147,7 @@ char *op_names [3] = {
|
||||
};
|
||||
|
||||
static int recursive_erase (FileOpContext *ctx, char *s,
|
||||
long *progress_count, double *progress_bytes);
|
||||
off_t *progress_count, double *progress_bytes);
|
||||
|
||||
/* }}} */
|
||||
|
||||
@ -437,7 +437,7 @@ make_symlink (FileOpContext *ctx, char *src_path, char *dst_path)
|
||||
|
||||
static int
|
||||
progress_update_one (FileOpContext *ctx,
|
||||
long *progress_count,
|
||||
off_t *progress_count,
|
||||
double *progress_bytes,
|
||||
int add,
|
||||
int is_toplevel_file)
|
||||
@ -460,7 +460,7 @@ progress_update_one (FileOpContext *ctx,
|
||||
|
||||
int
|
||||
copy_file_file (FileOpContext *ctx, char *src_path, char *dst_path, int ask_overwrite,
|
||||
long *progress_count, double *progress_bytes,
|
||||
off_t *progress_count, double *progress_bytes,
|
||||
int is_toplevel_file)
|
||||
{
|
||||
#ifndef OS2_NT
|
||||
@ -475,7 +475,7 @@ copy_file_file (FileOpContext *ctx, char *src_path, char *dst_path, int ask_over
|
||||
struct stat sb, sb2;
|
||||
struct utimbuf utb;
|
||||
int dst_exists = 0, appending = 0;
|
||||
long n_read_total = 0, file_size = -1;
|
||||
off_t n_read_total = 0, file_size = -1;
|
||||
int return_status, temp_status;
|
||||
struct timeval tv_transfer_start;
|
||||
|
||||
@ -845,7 +845,7 @@ int
|
||||
copy_dir_dir (FileOpContext *ctx, char *s, char *d, int toplevel,
|
||||
int move_over, int delete,
|
||||
struct link *parent_dirs,
|
||||
long *progress_count,
|
||||
off_t *progress_count,
|
||||
double *progress_bytes)
|
||||
{
|
||||
#ifdef __os2__
|
||||
@ -1070,7 +1070,8 @@ ret:
|
||||
/* {{{ Move routines */
|
||||
|
||||
int
|
||||
move_file_file (FileOpContext *ctx, char *s, char *d, long *progress_count, double *progress_bytes)
|
||||
move_file_file (FileOpContext *ctx, char *s, char *d,
|
||||
off_t *progress_count, double *progress_bytes)
|
||||
{
|
||||
struct stat src_stats, dst_stats;
|
||||
int return_status = FILE_CONT;
|
||||
@ -1198,7 +1199,8 @@ move_file_file (FileOpContext *ctx, char *s, char *d, long *progress_count, doub
|
||||
}
|
||||
|
||||
int
|
||||
move_dir_dir (FileOpContext *ctx, char *s, char *d, long *progress_count, double *progress_bytes)
|
||||
move_dir_dir (FileOpContext *ctx, char *s, char *d,
|
||||
off_t *progress_count, double *progress_bytes)
|
||||
{
|
||||
struct stat sbuf, dbuf, destbuf;
|
||||
struct link *lp;
|
||||
@ -1328,7 +1330,7 @@ move_dir_dir (FileOpContext *ctx, char *s, char *d, long *progress_count, double
|
||||
/* {{{ Erase routines */
|
||||
/* Don't update progress status if progress_count==NULL */
|
||||
int
|
||||
erase_file (FileOpContext *ctx, char *s, long *progress_count, double *progress_bytes,
|
||||
erase_file (FileOpContext *ctx, char *s, off_t *progress_count, double *progress_bytes,
|
||||
int is_toplevel_file)
|
||||
{
|
||||
int return_status;
|
||||
@ -1359,7 +1361,7 @@ erase_file (FileOpContext *ctx, char *s, long *progress_count, double *progress_
|
||||
}
|
||||
|
||||
static int
|
||||
recursive_erase (FileOpContext *ctx, char *s, long *progress_count, double *progress_bytes)
|
||||
recursive_erase (FileOpContext *ctx, char *s, off_t *progress_count, double *progress_bytes)
|
||||
{
|
||||
struct dirent *next;
|
||||
struct stat buf;
|
||||
@ -1442,7 +1444,7 @@ check_dir_is_empty(char *path)
|
||||
}
|
||||
|
||||
int
|
||||
erase_dir (FileOpContext *ctx, char *s, long *progress_count, double *progress_bytes)
|
||||
erase_dir (FileOpContext *ctx, char *s, off_t *progress_count, double *progress_bytes)
|
||||
{
|
||||
int error;
|
||||
|
||||
@ -1568,7 +1570,7 @@ is_wildcarded (char *p)
|
||||
* Computes the number of bytes used by the files in a directory
|
||||
*/
|
||||
void
|
||||
compute_dir_size (char *dirname, long *ret_marked, double *ret_total)
|
||||
compute_dir_size (char *dirname, off_t *ret_marked, double *ret_total)
|
||||
{
|
||||
DIR *dir;
|
||||
struct dirent *dirent;
|
||||
@ -1598,7 +1600,7 @@ compute_dir_size (char *dirname, long *ret_marked, double *ret_total)
|
||||
}
|
||||
|
||||
if (S_ISDIR (s.st_mode)){
|
||||
long subdir_count = 0;
|
||||
off_t subdir_count = 0;
|
||||
double subdir_bytes = 0;
|
||||
|
||||
compute_dir_size (fullname, &subdir_count, &subdir_bytes);
|
||||
@ -1624,7 +1626,7 @@ compute_dir_size (char *dirname, long *ret_marked, double *ret_total)
|
||||
* overwrite any files by doing the copy.
|
||||
*/
|
||||
static void
|
||||
panel_compute_totals (WPanel *panel, long *ret_marked, double *ret_total)
|
||||
panel_compute_totals (WPanel *panel, off_t *ret_marked, double *ret_total)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1641,7 +1643,7 @@ panel_compute_totals (WPanel *panel, long *ret_marked, double *ret_total)
|
||||
|
||||
if (S_ISDIR (s->st_mode)){
|
||||
char *dir_name;
|
||||
long subdir_count = 0;
|
||||
off_t subdir_count = 0;
|
||||
double subdir_bytes = 0;
|
||||
|
||||
dir_name = concat_dir_and_file (panel->cwd, panel->dir.list [i].fname);
|
||||
@ -1832,7 +1834,7 @@ panel_operate (void *source_panel, FileOperation operation, char *thedefault, in
|
||||
int i, value;
|
||||
FileOpContext *ctx;
|
||||
|
||||
long count = 0;
|
||||
off_t count = 0;
|
||||
double bytes = 0;
|
||||
|
||||
int dst_result;
|
||||
|
17
src/file.h
17
src/file.h
@ -9,17 +9,17 @@ extern int know_not_what_am_i_doing;
|
||||
struct link;
|
||||
|
||||
int copy_file_file (FileOpContext *ctx, char *s, char *d, int ask_overwrite,
|
||||
long *progres_count, double *progress_bytes,
|
||||
off_t *progress_count, double *progress_bytes,
|
||||
int is_toplevel_file);
|
||||
int move_file_file (FileOpContext *ctx, char *s, char *d,
|
||||
long *progres_count, double *progress_bytes);
|
||||
off_t *progress_count, double *progress_bytes);
|
||||
int move_dir_dir (FileOpContext *ctx, char *s, char *d,
|
||||
long *progres_count, double *progress_bytes);
|
||||
off_t *progress_count, double *progress_bytes);
|
||||
int copy_dir_dir (FileOpContext *ctx, char *s, char *d, int toplevel, int move_over,
|
||||
int delete, struct link *parent_dirs,
|
||||
long *progres_count, double *progress_bytes);
|
||||
int erase_dir (FileOpContext *ctx, char *s, long *progres_count, double *progress_bytes);
|
||||
int erase_file (FileOpContext *ctx, char *s, long *progress_count, double *progress_bytes,
|
||||
off_t *progress_count, double *progress_bytes);
|
||||
int erase_dir (FileOpContext *ctx, char *s, off_t *progress_count, double *progress_bytes);
|
||||
int erase_file (FileOpContext *ctx, char *s, off_t *progress_count, double *progress_bytes,
|
||||
int is_toplevel_file);
|
||||
int erase_dir_iff_empty (FileOpContext *ctx, char *s);
|
||||
|
||||
@ -42,7 +42,6 @@ extern int file_op_compute_totals;
|
||||
extern int background_wait;
|
||||
|
||||
int is_wildcarded (char *p);
|
||||
void compute_dir_size (char *dirname, long *ret_marked, double *ret_total);
|
||||
#endif
|
||||
|
||||
void compute_dir_size (char *dirname, off_t *ret_marked, double *ret_total);
|
||||
|
||||
#endif /* !__FILE_H */
|
||||
|
@ -309,7 +309,7 @@ show_no_bar (FileOpContext *ctx, int n)
|
||||
}
|
||||
|
||||
static FileProgressStatus
|
||||
show_bar (FileOpContext *ctx, int n, long done, long total)
|
||||
show_bar (FileOpContext *ctx, int n, double done, double total)
|
||||
{
|
||||
FileOpContextUI *ui;
|
||||
|
||||
@ -318,7 +318,11 @@ show_bar (FileOpContext *ctx, int n, long done, long total)
|
||||
|
||||
ui = ctx->ui;
|
||||
|
||||
gauge_set_value (ui->progress_gauge[n], (int) total, (int) done);
|
||||
/*
|
||||
* Gauge needs integers, so give it with integers between 0 and 1023.
|
||||
* This precision should be quite reasonable.
|
||||
*/
|
||||
gauge_set_value (ui->progress_gauge[n], 1024, (int) (1024 * done / total));
|
||||
gauge_show (ui->progress_gauge[n], 1);
|
||||
return check_progress_buttons (ctx);
|
||||
}
|
||||
@ -376,7 +380,7 @@ file_bps_show (FileOpContext *ctx)
|
||||
}
|
||||
|
||||
FileProgressStatus
|
||||
file_progress_show (FileOpContext *ctx, long done, long total)
|
||||
file_progress_show (FileOpContext *ctx, off_t done, off_t total)
|
||||
{
|
||||
FileOpContextUI *ui;
|
||||
|
||||
@ -399,7 +403,7 @@ file_progress_show (FileOpContext *ctx, long done, long total)
|
||||
}
|
||||
|
||||
FileProgressStatus
|
||||
file_progress_show_count (FileOpContext *ctx, long done, long total)
|
||||
file_progress_show_count (FileOpContext *ctx, off_t done, off_t total)
|
||||
{
|
||||
FileOpContextUI *ui;
|
||||
|
||||
|
@ -31,7 +31,7 @@ typedef struct {
|
||||
int progress_totals_computed;
|
||||
|
||||
/* Counters for progress indicators */
|
||||
long progress_count;
|
||||
off_t progress_count;
|
||||
double progress_bytes;
|
||||
|
||||
/* The value of the "preserve Attributes" checkbox in the copy file dialog.
|
||||
@ -139,8 +139,8 @@ enum OperationMode {
|
||||
void file_op_context_create_ui (FileOpContext *ctx, FileOperation op, int with_eta);
|
||||
void file_op_context_destroy_ui (FileOpContext *ctx);
|
||||
|
||||
FileProgressStatus file_progress_show (FileOpContext *ctx, long done, long total);
|
||||
FileProgressStatus file_progress_show_count (FileOpContext *ctx, long done, long total);
|
||||
FileProgressStatus file_progress_show (FileOpContext *ctx, off_t done, off_t total);
|
||||
FileProgressStatus file_progress_show_count (FileOpContext *ctx, off_t done, off_t total);
|
||||
FileProgressStatus file_progress_show_bytes (FileOpContext *ctx, double done, double total);
|
||||
FileProgressStatus file_progress_show_source (FileOpContext *ctx, char *path);
|
||||
FileProgressStatus file_progress_show_target (FileOpContext *ctx, char *path);
|
||||
|
@ -630,7 +630,7 @@ static int tree_forget_cmd (WTree *tree)
|
||||
static void tree_copy (WTree *tree, char *default_dest)
|
||||
{
|
||||
char *dest;
|
||||
long count = 0;
|
||||
off_t count = 0;
|
||||
double bytes = 0;
|
||||
FileOpContext *ctx;
|
||||
|
||||
@ -672,7 +672,7 @@ static void tree_move (WTree *tree, char *default_dest)
|
||||
char *dest;
|
||||
struct stat buf;
|
||||
double bytes = 0;
|
||||
long count = 0;
|
||||
off_t count = 0;
|
||||
FileOpContext *ctx;
|
||||
|
||||
if (!tree->selected_ptr)
|
||||
@ -738,7 +738,7 @@ static void
|
||||
tree_rmdir_cmd (WTree *tree)
|
||||
{
|
||||
char old_dir [MC_MAXPATHLEN];
|
||||
long count = 0;
|
||||
off_t count = 0;
|
||||
double bytes = 0;
|
||||
FileOpContext *ctx;
|
||||
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user