summaryrefslogtreecommitdiff
path: root/ext/zip/lib/zip_filerange_crc.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/zip/lib/zip_filerange_crc.c')
-rw-r--r--ext/zip/lib/zip_filerange_crc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/zip/lib/zip_filerange_crc.c b/ext/zip/lib/zip_filerange_crc.c
index 4d1ad56692..c7bd1e8a4a 100644
--- a/ext/zip/lib/zip_filerange_crc.c
+++ b/ext/zip/lib/zip_filerange_crc.c
@@ -1,6 +1,6 @@
/*
zip_filerange_crc.c -- compute CRC32 for a range of a file
- Copyright (C) 2008 Dieter Baron and Thomas Klausner
+ Copyright (C) 2008-2014 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <libzip@nih.at>
@@ -56,13 +56,13 @@ _zip_filerange_crc(FILE *fp, off_t start, off_t len, uLong *crcp,
}
while (len > 0) {
- n = len > BUFSIZE ? BUFSIZE : len;
- if ((n=fread(buf, 1, n, fp)) <= 0) {
+ n = len > BUFSIZE ? BUFSIZE : (size_t)len;
+ if ((n=fread(buf, 1, n, fp)) == 0) {
_zip_error_set(errp, ZIP_ER_READ, errno);
return -1;
}
- *crcp = crc32(*crcp, buf, n);
+ *crcp = crc32(*crcp, buf, (uInt)n);
len-= n;
}