Permalink
Browse files

- use size_t where appropriate.

- check for <= 0 in gzread; it returns -1 on error.
From christos@netbsd; ok millert@
  • Loading branch information...
omoerbeek authored and howardjp committed Apr 25, 2005
1 parent ae3e6e4 commit 218c3f0e61d3461dde1d863dda3aa15157039496
Showing with 4 additions and 4 deletions.
  1. +4 −4 binary.c
View
@@ -1,4 +1,4 @@
-/* $OpenBSD: binary.c,v 1.13 2004/09/15 22:35:36 deraadt Exp $ */
+/* $OpenBSD: binary.c,v 1.14 2005/02/07 08:47:18 otto Exp $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
@@ -39,13 +39,13 @@ int
bin_file(FILE *f)
{
char buf[BUFSIZ];
- int i, m;
+ size_t i, m;
int ret = 0;
if (fseek(f, 0L, SEEK_SET) == -1)
return 0;
- if ((m = (int)fread(buf, 1, BUFSIZ, f)) == 0)
+ if ((m = fread(buf, 1, BUFSIZ, f)) == 0)
return 0;
for (i = 0; i < m; i++)
@@ -69,7 +69,7 @@ gzbin_file(gzFile *f)
if (gzseek(f, (z_off_t)0, SEEK_SET) == -1)
return 0;
- if ((m = gzread(f, buf, BUFSIZ)) == 0)
+ if ((m = gzread(f, buf, BUFSIZ)) <= 0)
return 0;
for (i = 0; i < m; i++)

0 comments on commit 218c3f0

Please sign in to comment.