svn commit: r281513 - stable/10/sbin/md5
Xin LI
delphij at FreeBSD.org
Tue Apr 14 00:32:04 UTC 2015
Author: delphij
Date: Tue Apr 14 00:32:03 2015
New Revision: 281513
URL: https://svnweb.freebsd.org/changeset/base/281513
Log:
MFC r280716,280767,280914:
- Correct type for checkAgainst.
- Staticify flags that are not used outside the file scope.
- Fix warnings.
- Constify parameters.
Modified:
stable/10/sbin/md5/Makefile
stable/10/sbin/md5/md5.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sbin/md5/Makefile
==============================================================================
--- stable/10/sbin/md5/Makefile Tue Apr 14 00:27:54 2015 (r281512)
+++ stable/10/sbin/md5/Makefile Tue Apr 14 00:32:03 2015 (r281513)
@@ -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
Modified: stable/10/sbin/md5/md5.c
==============================================================================
--- stable/10/sbin/md5/md5.c Tue Apr 14 00:27:54 2015 (r281512)
+++ stable/10/sbin/md5/md5.c Tue Apr 14 00:32:03 2015 (r281513)
@@ -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 *s
* 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[MDTESTC
};
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);
More information about the svn-src-stable-10
mailing list