diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2015-06-20 00:22:50 -0400 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2015-06-20 10:56:02 -0400 |
commit | 9c2ed42daa8fbbef4a919c21ec564e2db55e8d60 (patch) | |
tree | 3814f79c10d7b490948d8cb7b112ac1dd41ceff1 /src/mongo/util/md5main.cpp | |
parent | 01965cf52bce6976637ecb8f4a622aeb05ab256a (diff) | |
download | mongo-9c2ed42daa8fbbef4a919c21ec564e2db55e8d60.tar.gz |
SERVER-18579: Clang-Format - reformat code, no comment reflow
Diffstat (limited to 'src/mongo/util/md5main.cpp')
-rw-r--r-- | src/mongo/util/md5main.cpp | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/src/mongo/util/md5main.cpp b/src/mongo/util/md5main.cpp index 733b631339b..51291c69686 100644 --- a/src/mongo/util/md5main.cpp +++ b/src/mongo/util/md5main.cpp @@ -53,40 +53,45 @@ * to the MD5 library. Typical compilation: * gcc -o md5main -lm md5main.c md5.c */ -static const char *const usage = +static const char* const usage = "Usage:\n" " md5main --test # run the self-test (A.5 of RFC 1321)\n " " md5main --t-values # print the T values for the library\n " " md5main --version # print the version of the package\n "; -static const char *const version = "2002-04-13"; +static const char* const version = "2002-04-13"; /* modified: not static, renamed */ /* Run the self-test. */ /*static*/ int -//do_test(void) -do_md5_test(void) { - static const char *const test[7*2] = { - "", "d41d8cd98f00b204e9800998ecf8427e", - "a", "0cc175b9c0f1b6a831c399e269772661", - "abc", "900150983cd24fb0d6963f7d28e17f72", - "message digest", "f96b697d7cb7938d525a2f31aaf161d0", - "abcdefghijklmnopqrstuvwxyz", "c3fcd3d76192e4007dfb496cca67e13b", + // do_test(void) + do_md5_test(void) { + static const char* const test[7 * 2] = { + "", + "d41d8cd98f00b204e9800998ecf8427e", + "a", + "0cc175b9c0f1b6a831c399e269772661", + "abc", + "900150983cd24fb0d6963f7d28e17f72", + "message digest", + "f96b697d7cb7938d525a2f31aaf161d0", + "abcdefghijklmnopqrstuvwxyz", + "c3fcd3d76192e4007dfb496cca67e13b", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "d174ab98d277d9f5a5611c2c9f419d9f", - "12345678901234567890123456789012345678901234567890123456789012345678901234567890", "57edf4a22be3c955ac49da2e2107b67a" - }; + "12345678901234567890123456789012345678901234567890123456789012345678901234567890", + "57edf4a22be3c955ac49da2e2107b67a"}; int i; int status = 0; - for (i = 0; i < 7*2; i += 2) { + for (i = 0; i < 7 * 2; i += 2) { md5_state_t state; md5_byte_t digest[16]; - char hex_output[16*2 + 1]; + char hex_output[16 * 2 + 1]; int di; md5_init(&state); - md5_append(&state, (const md5_byte_t *)test[i], strlen(test[i])); + md5_append(&state, (const md5_byte_t*)test[i], strlen(test[i])); md5_finish(&state, digest); for (di = 0; di < 16; ++di) sprintf(hex_output + di * 2, "%02x", digest[di]); @@ -97,14 +102,13 @@ do_md5_test(void) { status = 1; } } -// if (status == 0) + // if (status == 0) /*modified commented out: puts("md5 self-test completed successfully."); */ return status; } /* Print the T values. */ -static int -do_t_values(void) { +static int do_t_values(void) { int i; for (i = 1; i <= 64; ++i) { unsigned long v = (unsigned long)(4294967296.0 * fabs(sin((double)i))); @@ -114,10 +118,11 @@ do_t_values(void) { * "integer constant is unsigned in ANSI C, signed with -traditional". */ if (v >> 31) { - printf("#define T%d /* 0x%08lx */ (T_MASK ^ 0x%08lx)\n", i, - v, (unsigned long)(unsigned int)(~v)); - } - else { + printf("#define T%d /* 0x%08lx */ (T_MASK ^ 0x%08lx)\n", + i, + v, + (unsigned long)(unsigned int)(~v)); + } else { printf("#define T%d 0x%08lx\n", i, v); } } @@ -126,8 +131,7 @@ do_t_values(void) { /* modified from original code changed function name main->md5main */ /* Main program */ -int -md5main(int argc, char *argv[]) { +int md5main(int argc, char* argv[]) { if (argc == 2) { if (!strcmp(argv[1], "--test")) return do_md5_test(); @@ -141,4 +145,3 @@ md5main(int argc, char *argv[]) { puts(usage); return 0; } - |