aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/file_wrappers.h
AgeCommit message (Collapse)AuthorFilesLines
2011-06-04Fix wiretap headers to allow error-free ABI dumping.rbalint1-0/+4
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37543 f5534014-38df-0310-8fa8-9805f1628bb7
2011-05-09Get rid of the fd member of a wth structure; the FILE_T's in thatguy1-1/+1
structure include a file descriptor. Add a wtap_fstat() for the file readers that use file times to generate time stamps (we really need a way to say "this file has no time stamps" or "this file has only relative time stamps). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37026 f5534014-38df-0310-8fa8-9805f1628bb7
2011-05-09From Jakub Zawadzki: for file read progress bars, use the raw offset inguy1-0/+1
the file, rather than the offset in the uncompressed data stream. That way we don't get the "hey, we're more than 100% into the file, better refigure this" surprise. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37025 f5534014-38df-0310-8fa8-9805f1628bb7
2011-04-21Add a new WTAP_ERR_DECOMPRESS error, and use that for errors discoveredguy1-1/+1
by the gunzipping code. Have it also supply a err_info string, and report it. Have file_error() supply an err_info string. Put "the file" - or, for WTAP_ERR_DECOMPRESS, "the compressed file", to suggest a decompression error - into the rawshark and tshark errors, along the lines of what other programs print. Fix a case in the Netscaler code where we weren't fetching the error code on a read failure. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@36748 f5534014-38df-0310-8fa8-9805f1628bb7
2011-04-12From Jakub Zawadzki: speed up random access to gzipped files, as per theguy1-0/+2
zran.c example in the zlib source. This means that problems in the file's contents might not be reported when a packet is read, as long as there's no problem in the contents of the file up to the last bit of compressed data for the packet; we now check for errors after finishing the sequential read of the file, at least in some programs, so that shouldn't be an issue (the other programs need to be changed to do so as well). This is necessary in order to be able to read all the packets we saw in the sequential pass; it also lets us get a few more packets from truncated files in some cases. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@36577 f5534014-38df-0310-8fa8-9805f1628bb7
2011-04-11Don't use the zlib I/O routines for writing compressed files, either;guy1-0/+10
this frees us from worrying about zlib large file issues on the write side, and also lets us clean up a few other things. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@36563 f5534014-38df-0310-8fa8-9805f1628bb7
2011-04-08From Jakub Zawadzki:guy1-27/+10
Steal file_wrappers functions from zlib v2. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@36513 f5534014-38df-0310-8fa8-9805f1628bb7
2011-04-07From Jakub Zawadzki:guy1-0/+5
Introduce file_clearerr I'm unsure of this patch, gzclearerr() is used to clear the end-of-file mark, but for FILE there's function which do the same (clearerr). I created test program if clearerr() is needed for tailing file. and it seems to work without it (at least on Linux, so for !HAVE_LIBZ I commented it out). For now this patch introduce file_clearerr macro, and define it only when EOF marking must be cleared (i.e. when HAVE_LIBZ and HAVE_GZCLEARERR are defined). So everything works like before, patch just to keep same prefix for file interface :) git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@36510 f5534014-38df-0310-8fa8-9805f1628bb7
2011-04-06From Jakub Zawadzki:guy1-4/+4
file-wrappers.[ch] is used only for reading files, and mode is always "rb". Attached patch removes 'mode' argument from file_open() & filed_open(). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@36493 f5534014-38df-0310-8fa8-9805f1628bb7
2011-04-06From Jakub Zawadzki:guy1-4/+2
file_read(buf, bsize, count, file) macro is compilant with fread function and takes elements count+ size of each element, however to make it compilant with gzread() it always returns number of bytes. In wiretap file_read() this is not really used, file_read is called either with bsize set to 1 or count to 1. Attached patch remove bsize argument from macro. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@36491 f5534014-38df-0310-8fa8-9805f1628bb7
2010-06-06Get rid of file_write(); nobody uses it, and file writers should useguy1-3/+1
wtap_dump_file_write() (it does the right error checking for you, and returns FALSE on failure and gives you the right error code). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@33117 f5534014-38df-0310-8fa8-9805f1628bb7
2009-03-09Convert a bunch of ints to size_t in ngsniffer.c, and make sure file_readgerald1-1/+1
can accept size_t's. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27684 f5534014-38df-0310-8fa8-9805f1628bb7
2008-09-15Fix for bug 2875:jake1-1/+1
Fix a final eth_fopen -> ws_fopen When configuring with --without-zlib these functions need to have some parameters tagged _U_ git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@26212 f5534014-38df-0310-8fa8-9805f1628bb7
2007-11-28Fixes for Windows build w/o ZLIB wmeier1-2/+4
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23651 f5534014-38df-0310-8fa8-9805f1628bb7
2007-01-12Win32: MSVC > 6 doesn't work well with Unicode filenames!ulfl1-1/+1
fix this, by providing required functions in the new file file_util.c - it's mostly copied from GLib (g_open alike - that take UTF8 as filename format but don't use msvcrt.dll V6 for this as the glib files do) "link" to these functions in file_util.h: #define eth_open eth_stdio_open revert changes (from SVN 20282) throughout the code related to these file functions which were introduced with the first tries of MSVC 2005 ... Hopefully I've done everything right with the new file_util.c ... git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20402 f5534014-38df-0310-8fa8-9805f1628bb7
2006-11-05change all file offsets from long to gint64 so we can - theoretically - ↵ulfl1-6/+5
handle files > 2GB correct. Please distclean Win32 builds! git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@19814 f5534014-38df-0310-8fa8-9805f1628bb7
2005-11-07If we're using libz, make file_open() construct the open() flagguy1-2/+2
argument, rather than requiring the caller to get the open() flag and the fopen() flag in sync. That also means that if we're *not* using libz, it can just be a wrapper around eth_fopen(). We need to include <fcntl.h>, at least on UN*X, to get open() declared and the O_ flags defined. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16409 f5534014-38df-0310-8fa8-9805f1628bb7
2005-11-06replace *a lot* of file related calls by their GLib counterparts. This is ↵ulfl1-2/+2
necessary for the switch to GTK 2.6 (at least on WIN32). to do this, I've added file_util.h to wiretap (would file_compat.h be a better name?), and provide compat_macros like eth_open() instead of open(). While at it, move other file related things there, like #include <io.h>, definition of O_BINARY and alike, so it's all in one place. deleted related things from config.h.win32 As of these massive changes, I'm almost certain that this will break the Unix build. I'll keep an eye on the buildbot so hopefully everything is working again soon. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16403 f5534014-38df-0310-8fa8-9805f1628bb7
2004-07-18Set the svn:eol-style property on all text files to "native", so thatguy1-1/+1
they have LF at the end of the line on UN*X and CR/LF on Windows; hopefully this means that if a CR/LF version is checked in on Windows, the CRs will be stripped so that they show up only when checked out on Windows, not on UN*X. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@11400 f5534014-38df-0310-8fa8-9805f1628bb7
2002-08-28Removed trailing whitespaces from .h and .c files using thejmayer1-4/+4
winapi_cleanup tool written by Patrik Stridvall for the wine project. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@6115 f5534014-38df-0310-8fa8-9805f1628bb7
2002-06-07Graeme Hewson noted that zlib has a bug wherein "gzseek()" doesn't setguy1-3/+3
the internal z_err value for the stream if an "fseek()" call it makes fails, so that if "gzerror()" is subsequently called, it returns Z_OK rather than an error. To work around this, we pass "file_seek()" an "int *err", and have the with-zlib version of "file_seek()" check, if "gzseek()" fails, whether the return value of "file_error()" is 0 and, if so, have it return "errno" instead. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@5642 f5534014-38df-0310-8fa8-9805f1628bb7
2002-03-04Check for errors in seeks, "tell"s, and "stat()"s/"fstat()"s.guy1-1/+5
For file types where we allocate private data, add "close" routines where they were missing, to free the private data. Also fix up the code to clean up after some errors by freeing private data where that wasn't being done. Get rid of unused arguments to "wtap_dump_open_finish()". Fix indentation. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4857 f5534014-38df-0310-8fa8-9805f1628bb7
2002-02-06zlib 1.0.8 - the version that comes with X11 - does have "gzseek()",guy1-5/+3
even if it doesn't have "gzgets()", so one might think we could use it by using our own replacement for "gzgets()". One would be wrong to think so, however, as the "gzseek()" it has doesn't actually work when reading uncompressed files. zlib 1.0.9 has "gzgets()", and fixes that bug, so we rever to checking for "gzgets()" rather than "gzseek()", so that we don't accept pre-1.0.9 versions of zlib, and we get rid of our "gzgets()" replacement. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4702 f5534014-38df-0310-8fa8-9805f1628bb7
2001-11-13Hopefully the last time I have to change my e-mail address.gram1-2/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4199 f5534014-38df-0310-8fa8-9805f1628bb7
2001-09-20Removed the dependency on gzgetc and gzgets by implementing internalashokn1-3/+5
versions of these commands in file_wrappers.c. This allows us to compile successfully even on platforms where X has an older zlib built in. Removed this restriction from acinclude.m4 git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@3948 f5534014-38df-0310-8fa8-9805f1628bb7
2000-01-26Always declare, and define, "file_seek()" to return a "long", as it'sguy1-3/+3
supposed to look like "ftell()". If you don't have zlib, just define "file_seek" as an alias for "fseek", rather than defining it as a routine. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@1571 f5534014-38df-0310-8fa8-9805f1628bb7
2000-01-25"gztell()" is also affected by the libz mess on platforms where "off_t"guy1-2/+2
is bigger than a "long"; this is itojun's fix for that, turning "file_tell()" into a wrapper function in "file_wrappers.c", just like "file_seek()". git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@1554 f5534014-38df-0310-8fa8-9805f1628bb7
2000-01-22Fix files that had Gilbert's old e-mail address or that didn't have myguy1-2/+2
forwarding e-mail address. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@1522 f5534014-38df-0310-8fa8-9805f1628bb7
2000-01-13We are obliged to define HAVE_UNISTD_H in "config.h"; to avoid theguy1-0/+52
hideous problem on FreeBSD 3.[23] (and perhaps other BSDs) if HAVE_UNISTD_H is defined before "zlib.h" is included, turn "file_seek()" into a subroutine defined in a file that *undefines* HAVE_UNISTD_H before including "zlib.h", so that the *only* call to "gzseek()" is made from a file that does not have HAVE_UNISTD_H defined when it includes "zlib.h". Move "file_error()" to that file while you're at it, so it holds all the wrappers that hide the presence or absence of zlib from routines to read capture files. Turn "file.h", which declared those wrapper functions as well as wrapper macros, into "file_wrapper.h" - it belongs with the "file_wrapper.c" file that defines the wrapper functions, not with "file.c" which handles higher-layer file access functions. Remove the comment in "configure.in" that explained why defining HAVE_UNISTD_H was a bad idea, as we're not obliged to define it and work around the problem. (The comment in "file_wrapper.c" explains the workaround.) git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@1463 f5534014-38df-0310-8fa8-9805f1628bb7