diff options
author | Guy Harris <guy@alum.mit.edu> | 2005-08-19 19:40:00 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2005-08-19 19:40:00 +0000 |
commit | 38ec1644e68721d6b5afb84dce1684b943b1aee0 (patch) | |
tree | 8ffe4f642463b43885354f4dd755e59b4daf3823 /merge.c | |
parent | 06823cdce8a0e63cf888c449a1b37071d622f1c3 (diff) |
Add APIs to Wiretap to return the file of the size as supplied by the OS
(so if the file's gzipped, it's *NOT* the size of the file after
uncompressing), and an approximation of the amount of that data read
sequentially so far.
Use those for various progress bars and the like.
Make the fstat() in the Ascend trace reader directly use wth->fd, as
it's inside Wiretap; that gets rid of the last caller of wtap_fd() (as
we're no longer directly using fstat() or lseek() in Ethereal), so get
rid of wtap_fd().
svn path=/trunk/; revision=15437
Diffstat (limited to 'merge.c')
-rw-r--r-- | merge.c | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -24,10 +24,6 @@ #include <sys/time.h> #endif -#ifdef HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif - #include <string.h> #include "wtap.h" #include "merge.h" @@ -43,7 +39,7 @@ merge_open_in_files(int in_file_count, char *const *in_file_names, int i, j; int files_size = in_file_count * sizeof(merge_in_file_t); merge_in_file_t *files; - struct stat statb; + gint64 size; files = g_malloc(files_size); *in_files = files; @@ -60,14 +56,14 @@ merge_open_in_files(int in_file_count, char *const *in_file_names, *err_fileno = i; return FALSE; } - if (fstat(wtap_fd(files[i].wth), &statb) < 0) { - *err = errno; + size = wtap_file_size(files[i].wth, err); + if (size == -1) { for (j = 0; j <= i; j++) wtap_close(files[j].wth); *err_fileno = i; return FALSE; } - files[i].size = statb.st_size; + files[i].size = size; } return TRUE; } |