diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2005-04-25 08:21:21 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2005-04-25 08:21:21 +0000 |
commit | d05fe5f5f918318cdfd233ae8f24cd2e2ea45bd6 (patch) | |
tree | f6f5fd355fdd827dde16039a7567c3fe7b9c22db | |
parent | 24e9d680e2ca037842a619f22736f7eb4d5fc026 (diff) |
- use size_t where appropriate.
- check for <= 0 in gzread; it returns -1 on error.
From christos@netbsd; ok millert@
-rw-r--r-- | usr.bin/grep/binary.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/grep/binary.c b/usr.bin/grep/binary.c index fcc15419a02..80ecc798aff 100644 --- a/usr.bin/grep/binary.c +++ b/usr.bin/grep/binary.c @@ -1,4 +1,4 @@ -/* $OpenBSD: binary.c,v 1.14 2005/02/07 08:47:18 otto Exp $ */ +/* $OpenBSD: binary.c,v 1.15 2005/04/25 08:21:20 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++) |