aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/file_wrappers.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2011-04-08 01:55:25 +0000
committerGuy Harris <guy@alum.mit.edu>2011-04-08 01:55:25 +0000
commitf3873931ec72ce8d8d65666e4c8bfafcc8fa97ba (patch)
tree92b18b2f36cc46e4105cb83e0dfc439c76904d9c /wiretap/file_wrappers.c
parentab261a32813b2bd6b5c12fc081aed71bc5b0c833 (diff)
To squelch some compiler warnings, temporarily cast the argument to
ws_lseek() to the appropriate type for the second argument to _lseek() for Windows or lseek() for UN*X; ultimately, we want to call the appropriate 64-bit-offset seek routine if available, otherwise cast the value down and hand it to the 32-bit-offset seek routine. svn path=/trunk/; revision=36514
Diffstat (limited to 'wiretap/file_wrappers.c')
-rw-r--r--wiretap/file_wrappers.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/wiretap/file_wrappers.c b/wiretap/file_wrappers.c
index fce6d1b9a7..124a0a1952 100644
--- a/wiretap/file_wrappers.c
+++ b/wiretap/file_wrappers.c
@@ -482,7 +482,12 @@ 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) {
- if (ws_lseek(file->fd, offset - file->have, SEEK_CUR) == -1) {
+ /* 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
*err = errno;
return -1;
}
@@ -505,7 +510,12 @@ file_seek(FILE_T file, gint64 offset, int whence, int *err)
/* rewind, then skip to offset */
/* back up and start over */
- if (ws_lseek(file->fd, file->start, SEEK_SET) == -1) {
+ /* 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
*err = errno;
return -1;
}