summaryrefslogtreecommitdiffstats
path: root/sbin/md5
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2015-04-14 00:32:03 +0000
committerdelphij <delphij@FreeBSD.org>2015-04-14 00:32:03 +0000
commitedfb89679048b8f6629f8a931375c42d835f2823 (patch)
treed6deb0c53b66d5d42010afd3ffb3e6dc4c1e35c8 /sbin/md5
parent0f18b563c9e34f14aa27943ac4e0b46a590a82fe (diff)
downloadFreeBSD-src-edfb89679048b8f6629f8a931375c42d835f2823.zip
FreeBSD-src-edfb89679048b8f6629f8a931375c42d835f2823.tar.gz
MFC r280716,280767,280914:
- Correct type for checkAgainst. - Staticify flags that are not used outside the file scope. - Fix warnings. - Constify parameters.
Diffstat (limited to 'sbin/md5')
-rw-r--r--sbin/md5/Makefile3
-rw-r--r--sbin/md5/md5.c34
2 files changed, 17 insertions, 20 deletions
diff --git a/sbin/md5/Makefile b/sbin/md5/Makefile
index eabf129..c39aaa7 100644
--- a/sbin/md5/Makefile
+++ b/sbin/md5/Makefile
@@ -13,9 +13,6 @@ MLINKS= md5.1 rmd160.1 \
md5.1 sha256.1 \
md5.1 sha512.1
-NO_WMISSING_VARIABLE_DECLARATIONS=
-WFORMAT?= 1
-
DPADD= ${LIBMD}
LDADD= -lmd
diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c
index 823d09b..f4c56ac 100644
--- a/sbin/md5/md5.c
+++ b/sbin/md5/md5.c
@@ -42,11 +42,11 @@ __FBSDID("$FreeBSD$");
#define TEST_BLOCK_COUNT 100000
#define MDTESTCOUNT 8
-int qflag;
-int rflag;
-int sflag;
-unsigned char* checkAgainst;
-int checksFailed;
+static int qflag;
+static int rflag;
+static int sflag;
+static char* checkAgainst;
+static int checksFailed;
typedef void (DIGEST_Init)(void *);
typedef void (DIGEST_Update)(void *, const unsigned char *, size_t);
@@ -70,11 +70,11 @@ typedef struct Algorithm_t {
} Algorithm_t;
static void MD5_Update(MD5_CTX *, const unsigned char *, size_t);
-static void MDString(Algorithm_t *, const char *);
-static void MDTimeTrial(Algorithm_t *);
-static void MDTestSuite(Algorithm_t *);
-static void MDFilter(Algorithm_t *, int);
-static void usage(Algorithm_t *);
+static void MDString(const Algorithm_t *, const char *);
+static void MDTimeTrial(const Algorithm_t *);
+static void MDTestSuite(const Algorithm_t *);
+static void MDFilter(const Algorithm_t *, int);
+static void usage(const Algorithm_t *);
typedef union {
MD5_CTX md5;
@@ -91,7 +91,7 @@ typedef union {
/* algorithm function table */
-struct Algorithm_t Algorithm[] = {
+static const struct Algorithm_t Algorithm[] = {
{ "md5", "MD5", &MD5TestOutput, (DIGEST_Init*)&MD5Init,
(DIGEST_Update*)&MD5_Update, (DIGEST_End*)&MD5End,
&MD5Data, &MD5File },
@@ -216,7 +216,7 @@ main(int argc, char *argv[])
* Digests a string and prints the result.
*/
static void
-MDString(Algorithm_t *alg, const char *string)
+MDString(const Algorithm_t *alg, const char *string)
{
size_t len = strlen(string);
char buf[HEX_DIGEST_LENGTH];
@@ -240,7 +240,7 @@ MDString(Algorithm_t *alg, const char *string)
* Measures the time to digest TEST_BLOCK_COUNT TEST_BLOCK_LEN-byte blocks.
*/
static void
-MDTimeTrial(Algorithm_t *alg)
+MDTimeTrial(const Algorithm_t *alg)
{
DIGEST_CTX context;
struct rusage before, after;
@@ -282,7 +282,7 @@ MDTimeTrial(Algorithm_t *alg)
* Digests a reference suite of strings and prints the results.
*/
-const char *MDTestInput[MDTESTCOUNT] = {
+static const char *MDTestInput[MDTESTCOUNT] = {
"",
"a",
"abc",
@@ -350,7 +350,7 @@ const char *RIPEMD160_TestOutput[MDTESTCOUNT] = {
};
static void
-MDTestSuite(Algorithm_t *alg)
+MDTestSuite(const Algorithm_t *alg)
{
int i;
char buffer[HEX_DIGEST_LENGTH];
@@ -370,7 +370,7 @@ MDTestSuite(Algorithm_t *alg)
* Digests the standard input and prints the result.
*/
static void
-MDFilter(Algorithm_t *alg, int tee)
+MDFilter(const Algorithm_t *alg, int tee)
{
DIGEST_CTX context;
unsigned int len;
@@ -387,7 +387,7 @@ MDFilter(Algorithm_t *alg, int tee)
}
static void
-usage(Algorithm_t *alg)
+usage(const Algorithm_t *alg)
{
fprintf(stderr, "usage: %s [-pqrtx] [-c string] [-s string] [files ...]\n", alg->progname);
OpenPOWER on IntegriCloud