diff options
author | Guy Harris <guy@alum.mit.edu> | 2012-06-05 08:04:15 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2012-06-05 08:04:15 +0000 |
commit | 92bd70a3802fb7877f4975069b73db3feec707e4 (patch) | |
tree | f44035c168d36b87b7ee38cda30aee977474129a /wiretap | |
parent | 7ed3d0e959c466d46c2e8328c9cfa553c09ccd56 (diff) |
Making "had" a ptrdiff_t caused warnings, even if it eliminated a
warning about assigning the difference between two (64-bit) pointers to
a (32-bit) variable. That difference is guaranteed to fit in an
unsigned int; make "had" an unsigned int, and cast the difference to
unsigned int before assigning it to "had".
svn path=/trunk/; revision=43103
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/file_wrappers.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/wiretap/file_wrappers.c b/wiretap/file_wrappers.c index 443bd5ce6d..3f5e5e23f0 100644 --- a/wiretap/file_wrappers.c +++ b/wiretap/file_wrappers.c @@ -921,7 +921,12 @@ file_seek(FILE_T file, gint64 offset, int whence, int *err) file->seek = 0; if (offset < 0 && file->next) { - ptrdiff_t had = file->next - file->out; + /* + * This is guaranteed to fit in an unsigned int. + * To squelch compiler warnings, we cast the + * result. + */ + unsigned had = (unsigned)(file->next - file->out); if (-offset <= had) { file->have -= offset; file->next += offset; |