Ethereal-dev: Re: [ethereal-dev] Support for reading compressed capture files

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxx>
Date: Tue, 31 Aug 1999 11:05:08 -0700 (PDT)
> The downside of this is that we no longer have a progress bar during
> loading. The reason is that we can't do an fstat() anymore to find out 
> the length of the file, since we don't know the length of the file
> until we decompress.

Define "length of the file".  "fstat()" will tell you how many bytes the
file takes up on disk; it doesn't tell you how many bytes worth of
uncompressed data you'll get from the file, however.

If there's a way to get the current byte offset in the *compressed* file
from zLib (if all else fails, and you have either a file descriptor for
the file or a "FILE *" for it, you can fall back on "ftell()"; with only
100 updates to the progress bar, that might keep us from doing *too*
many "lseek()" calls), then a fraction-complete based on the current
byte offset in the compressed file and the size of the compressed file
might be good enough.

In any case, you presumably still get a progress bar if you're loading
an *uncompressed* file....