Author | Jamozed <[email protected]> |
Date | 2020-08-09 02:07:40 |
Commit | a6d059a185f9f70a4dd6027bca43ce91d01b2cf5 |
Parent | b4ec1a976aa427e37b56281c9b857f690df5253c |
crc32: Fix inconsistencies
Diffstat
M | src/crc32.c | | | 21 | +++++++++------------ |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/crc32.c b/src/crc32.c index 9234a09..ff38aa1 100644 --- a/src/crc32.c +++ b/src/crc32.c @@ -1,4 +1,4 @@ -// crc32.c, version 1.0.4 +// crc32.c, version 1.0.5 // OMKOV cryptutils crc32 // Copyright (C) 2020, Jakob Wakeling // All rights reserved. @@ -6,9 +6,6 @@ /* OMKOV Permissive Licence, version 1.0 -Copyright (C) 2020, Jakob Wakeling -All rights reserved. - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal with the Software without restriction, including without limitation the rights to @@ -40,7 +37,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. #include <stdint.h> #include <stdio.h> -#define VERSION "1.0.4" +#define VERSION "1.0.5" static const uint32_t CRC32[] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, @@ -90,8 +87,8 @@ static const uint32_t CRC32[] = { static inline int crc32(const char *file); -static void help(void); -static void version(void); +static void hlp(void); +static void ver(void); int main(int ac, char *av[]) { A0 = av[0]; lop_t lops[] = { @@ -102,8 +99,8 @@ int main(int ac, char *av[]) { A0 = av[0]; opt_t opt = OPTGET_INIT; opt.str = ""; opt.lops = lops; int o; while((o = optget(&opt, av, 1)) != -1) switch (o) { - case 256: { help(); return 0; } - case 257: { version(); return 0; } + case 256: { hlp(); return 0; } + case 257: { ver(); return 0; } default: { return 1; } } @@ -118,7 +115,7 @@ int main(int ac, char *av[]) { A0 = av[0]; } static inline int crc32(const char *file) { - char stdbuf[BUFSIZ * 16]; FILE *fi; + uint8_t stdbuf[BUFSIZ * 16]; FILE *fi; register size_t fl = 0; register uint32_t crc = (uint32_t)~0; if (!file || (file[0] == '-' && file[1] == 0)) { fi = stdin; } @@ -136,7 +133,7 @@ static inline int crc32(const char *file) { if (fi != stdin) { fclose(fi); } return 0; } -static void help(void) { +static void hlp(void) { puts("crc32 - compute the CRC-32 for a file\n"); puts("usage: crc32 [file...]\n"); puts("options:"); @@ -145,7 +142,7 @@ static void help(void) { return; } -static void version() { +static void ver(void) { puts("OMKOV cryptutils crc32, version " VERSION); puts("Copyright (C) 2020, Jakob Wakeling"); puts("All rights reserved.");