aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/file_wrappers.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2011-04-10 18:22:47 +0000
committerGuy Harris <guy@alum.mit.edu>2011-04-10 18:22:47 +0000
commitc349caf925ce533d403a6c3dd4380c30d6552ea7 (patch)
tree47be42075ef0ca489ee8fb4e6427977c9d2fefd9 /wiretap/file_wrappers.c
parentd7d45f8072523ecca0c6823bf3f55b7f61134d92 (diff)
Use AC_SYS_LARGEFILE to turn on large file support on platforms that
support it. Rename ws_lseek to ws_lseek64, as it should be given a 64-bit offset, and have it use _lseeki64 on Windows, to try to get 64-bit offset support; AC_SYS_LARGEFILE should cause lseek() to support 64-bit offsets on UN*X if possible. svn path=/trunk/; revision=36542
Diffstat (limited to 'wiretap/file_wrappers.c')
-rw-r--r--wiretap/file_wrappers.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/wiretap/file_wrappers.c b/wiretap/file_wrappers.c
index daaec5d51b..2bb2ce78f3 100644
--- a/wiretap/file_wrappers.c
+++ b/wiretap/file_wrappers.c
@@ -106,8 +106,6 @@ struct wtap_reader {
#define ZLIB 2 /* decompress a zlib stream */
#endif
-/* XXX, lseek64() instead of ws_lseek()? */
-
static int /* gz_load */
raw_read(FILE_T state, unsigned char *buf, unsigned int count, unsigned *have)
{
@@ -415,7 +413,7 @@ filed_open(int fd)
state->fd = fd;
/* save the current position for rewinding (only if reading) */
- state->start = ws_lseek(state->fd, 0, SEEK_CUR);
+ state->start = ws_lseek64(state->fd, 0, SEEK_CUR);
if (state->start == -1) state->start = 0;
/* initialize stream */
@@ -517,12 +515,7 @@ file_seek(FILE_T file, gint64 offset, int whence, int *err)
/* if within raw area while reading, just go there */
if (file->compression == UNCOMPRESSED && file->pos + offset >= file->raw) {
- /* XXX - handle 64-bit offsets better */
-#ifdef _WIN32
- if (ws_lseek(file->fd, (long)(offset - file->have), SEEK_CUR) == -1) {
-#else
- if (ws_lseek(file->fd, (off_t)(offset - file->have), SEEK_CUR) == -1) {
-#endif
+ if (ws_lseek64(file->fd, offset - file->have, SEEK_CUR) == -1) {
*err = errno;
return -1;
}
@@ -545,12 +538,7 @@ file_seek(FILE_T file, gint64 offset, int whence, int *err)
/* rewind, then skip to offset */
/* back up and start over */
- /* XXX - handle 64-bit offsets better */
-#ifdef _WIN32
- if (ws_lseek(file->fd, (long)file->start, SEEK_SET) == -1) {
-#else
- if (ws_lseek(file->fd, (off_t)file->start, SEEK_SET) == -1) {
-#endif
+ if (ws_lseek64(file->fd, file->start, SEEK_SET) == -1) {
*err = errno;
return -1;
}