summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hill <dhill@cvs.openbsd.org>2006-03-15 03:15:08 +0000
committerDavid Hill <dhill@cvs.openbsd.org>2006-03-15 03:15:08 +0000
commit10e08d32a63fc63176250470c0ebd3addeed0fb0 (patch)
treefe86fc4350ee01337a1e56f2009ec7280435a6e3
parentb6b490f04ec7dccdda066e8488baf639d80a661a (diff)
Fix signed/unsigned comparisons by using size_t
Sprinkle some const ok ray@ jaredy@
-rw-r--r--bin/md5/md5.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/bin/md5/md5.c b/bin/md5/md5.c
index d877c827995..69e66984fd0 100644
--- a/bin/md5/md5.c
+++ b/bin/md5/md5.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: md5.c,v 1.34 2005/12/20 02:09:23 millert Exp $ */
+/* $OpenBSD: md5.c,v 1.35 2006/03/15 03:15:07 dhill Exp $ */
/*
* Copyright (c) 2001, 2003, 2005 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -57,8 +57,8 @@ union ANY_CTX {
#define NHASHES 10
struct hash_functions {
- char *name;
- int digestlen;
+ const char *name;
+ size_t digestlen;
int style;
void *ctx; /* XXX - only used by digest_file() */
void (*init)(void *);
@@ -147,7 +147,7 @@ struct hash_functions {
(char *(*)(void *, char *))SHA512_End
}, {
NULL,
- },
+ }
};
void usage(void) __attribute__((__noreturn__));
@@ -364,8 +364,9 @@ int
digest_filelist(const char *file, struct hash_functions *defhash)
{
int fd, found, error;
- int algorithm_max, algorithm_min;
- char *algorithm, *filename, *checksum, *buf, *p;
+ size_t algorithm_max, algorithm_min;
+ const char *algorithm;
+ char *filename, *checksum, *buf, *p;
char digest[MAX_DIGEST_LEN + 1];
char *lbuf = NULL;
FILE *fp;
@@ -549,7 +550,7 @@ digest_test(struct hash_functions **hashes)
int i;
char digest[MAX_DIGEST_LEN + 1];
unsigned char buf[1000];
- unsigned char *test_strings[] = {
+ unsigned const char *test_strings[] = {
"",
"a",
"abc",