From 92bd70a3802fb7877f4975069b73db3feec707e4 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 5 Jun 2012 08:04:15 +0000 Subject: 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 --- wiretap/file_wrappers.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3