From 33bb54a9452f4be53377a185195a63194016241a Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Fri, 4 May 2012 16:56:18 +0000 Subject: file_seek() used to be a wrapper around fseek() or gzseek(), both of which could use lseek() and were thus expensive due to system call overhead. To avoid making a system call for every packet on a sequential read, we maintained a data_offset field in the wtap structure for sequential reads. It's now a routine that just returns information from the FILE_T data structure, so it's cheap. Use it, rather than maintaining the data_offset field. Readers for some file formats need to maintain file offset themselves; have them do so in their private data structures. svn path=/trunk/; revision=42423 --- wiretap/mpeg.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'wiretap/mpeg.c') diff --git a/wiretap/mpeg.c b/wiretap/mpeg.c index fc7f126a6e..321f45a69a 100644 --- a/wiretap/mpeg.c +++ b/wiretap/mpeg.c @@ -225,13 +225,12 @@ mpeg_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) return FALSE; } } - *data_offset = wth->data_offset; + *data_offset = file_tell(wth->fh); buffer_assure_space(wth->frame_buffer, packet_size); if (!mpeg_read_rec_data(wth->fh, buffer_start_ptr(wth->frame_buffer), packet_size, err, err_info)) return FALSE; - wth->data_offset += packet_size; /* XXX - relative, not absolute, time stamps */ wth->phdr.presence_flags = WTAP_HAS_TS; wth->phdr.ts = ts; -- cgit v1.2.1