tools/hash: style

This commit is contained in:
Danny Robson 2016-06-17 14:58:39 +10:00
parent e62af110b6
commit 38cb91fcb5

View File

@ -12,7 +12,7 @@
* limitations under the License. * limitations under the License.
* *
* Copyright: * Copyright:
* 2014, Danny Robson <danny@nerdcruft.net> * 2014-2016, Danny Robson <danny@nerdcruft.net>
*/ */
#include <iostream> #include <iostream>
@ -35,7 +35,9 @@
#include "hash/sha2.hpp" #include "hash/sha2.hpp"
static const char* NAMES[] = { ///////////////////////////////////////////////////////////////////////////////
static
const char* NAMES[] = {
"adler32", "adler32",
"bsdsum", "bsdsum",
"crc32", "crc32",
@ -49,8 +51,11 @@ static const char* NAMES[] = {
}; };
static void ///////////////////////////////////////////////////////////////////////////////
compute (std::istream &is, const char *name) { static
void
compute (std::istream &is, const char *name)
{
std::vector<uint8_t> data { std::vector<uint8_t> data {
std::istream_iterator<uint8_t> (is), std::istream_iterator<uint8_t> (is),
std::istream_iterator<uint8_t> ( ) std::istream_iterator<uint8_t> ( )
@ -95,6 +100,7 @@ compute (std::istream &is, const char *name) {
} }
///////////////////////////////////////////////////////////////////////////////
enum { enum {
ARG_CMD, ARG_CMD,
ARG_HASH, ARG_HASH,
@ -119,7 +125,8 @@ print_usage (int argc, char **argv)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int int
main (int argc, char **argv) { main (int argc, char **argv)
{
if (argc != NUM_ARGS) { if (argc != NUM_ARGS) {
print_usage (argc, argv); print_usage (argc, argv);
return EXIT_FAILURE; return EXIT_FAILURE;