From 38d618baa9cb563ff86bda46fcabd992255afadd Mon Sep 17 00:00:00 2001 From: marshmellow42 Date: Sun, 14 Feb 2016 14:43:19 -0500 Subject: [PATCH] remove redundant llx prix64 defines remove unused commented out #includes coverity indicates compressed_fpga_stream.opaque needs to be initialized to Z_NULL fgetc returns int define llu --- client/cmdhficlass.c | 4 +--- client/cmdlfem4x.c | 4 +--- client/cmdlft55xx.c | 3 --- client/fpga_compress.c | 8 +++++--- client/loclass/elite_crack.c | 4 ++-- client/proxmark3.h | 1 + 6 files changed, 10 insertions(+), 14 deletions(-) diff --git a/client/cmdhficlass.c b/client/cmdhficlass.c index 4cf9d3ea..134ca21e 100644 --- a/client/cmdhficlass.c +++ b/client/cmdhficlass.c @@ -33,8 +33,6 @@ #include "usb_cmd.h" #include "cmdhfmfu.h" -#define llX PRIx64 - static int CmdHelp(const char *Cmd); #define ICLASS_KEYS_MAX 8 @@ -1350,7 +1348,7 @@ uint64_t hexarray_to_uint64(uint8_t *key) { for (int i = 0;i < 8;i++) sprintf(&temp[(i *2)],"%02X",key[i]); temp[16] = '\0'; - if (sscanf(temp,"%016"llX,&uint_key) < 1) + if (sscanf(temp,"%016"llx,&uint_key) < 1) return 0; return uint_key; } diff --git a/client/cmdlfem4x.c b/client/cmdlfem4x.c index 7ff8037b..aa0fc856 100644 --- a/client/cmdlfem4x.c +++ b/client/cmdlfem4x.c @@ -21,8 +21,6 @@ #include "cmdlfem4x.h" #include "lfdemod.h" -#define llx PRIx64 - char *global_em410xId; static int CmdHelp(const char *Cmd); @@ -58,7 +56,7 @@ int CmdEM410xRead(const char *Cmd) return 0; } char id[12] = {0x00}; - sprintf(id, "%010llx",lo); + sprintf(id, "%010"PRIx64,lo); global_em410xId = id; return 1; diff --git a/client/cmdlft55xx.c b/client/cmdlft55xx.c index 5d797edc..dfee9aa6 100644 --- a/client/cmdlft55xx.c +++ b/client/cmdlft55xx.c @@ -10,7 +10,6 @@ #include #include #include -//#include //not used - marshmellow #include "proxmark3.h" #include "ui.h" #include "graph.h" @@ -22,8 +21,6 @@ #include "util.h" #include "data.h" #include "lfdemod.h" -//#include "../common/crc.h" //not used - marshmellow -//#include "../common/iso14443crc.h" //not used - marshmellow #include "cmdhf14a.h" //for getTagInfo #define T55x7_CONFIGURATION_BLOCK 0x00 diff --git a/client/fpga_compress.c b/client/fpga_compress.c index 2779e835..0c40f22f 100644 --- a/client/fpga_compress.c +++ b/client/fpga_compress.c @@ -91,6 +91,7 @@ int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile) for(uint16_t j = 0; j < num_infiles; j++) { fclose(infile[j]); } + free(fpga_config); return(EXIT_FAILURE); } @@ -112,7 +113,7 @@ int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile) compressed_fpga_stream.avail_in = i; compressed_fpga_stream.zalloc = fpga_deflate_malloc; compressed_fpga_stream.zfree = fpga_deflate_free; - + compressed_fpga_stream.opaque = Z_NULL; ret = deflateInit2(&compressed_fpga_stream, COMPRESS_LEVEL, Z_DEFLATED, @@ -187,6 +188,7 @@ int zlib_decompress(FILE *infile, FILE *outfile) compressed_fpga_stream.avail_out = DECOMPRESS_BUF_SIZE; compressed_fpga_stream.zalloc = fpga_deflate_malloc; compressed_fpga_stream.zfree = fpga_deflate_free; + compressed_fpga_stream.opaque = Z_NULL; ret = inflateInit2(&compressed_fpga_stream, 0); @@ -195,9 +197,9 @@ int zlib_decompress(FILE *infile, FILE *outfile) compressed_fpga_stream.next_in = inbuf; uint16_t i = 0; do { - uint8_t c = fgetc(infile); + int c = fgetc(infile); if (!feof(infile)) { - inbuf[i++] = c; + inbuf[i++] = c & 0xFF; compressed_fpga_stream.avail_in++; } else { break; diff --git a/client/loclass/elite_crack.c b/client/loclass/elite_crack.c index 5dd8bf6d..e9814e95 100644 --- a/client/loclass/elite_crack.c +++ b/client/loclass/elite_crack.c @@ -522,8 +522,8 @@ int bruteforceDump(uint8_t dump[], size_t dumpsize, uint16_t keytable[]) errors += bruteforceItem(*attack, keytable); } free(attack); - clock_t t2 = clock(); - float diff = (((float)t2 - (float)t1) / CLOCKS_PER_SEC ); + t1 = clock() - t1; + float diff = ((float)t1 / CLOCKS_PER_SEC ); prnlog("\nPerformed full crack in %f seconds",diff); // Pick out the first 16 bytes of the keytable. diff --git a/client/proxmark3.h b/client/proxmark3.h index 8236bfe7..616d9c70 100644 --- a/client/proxmark3.h +++ b/client/proxmark3.h @@ -16,6 +16,7 @@ #include #define llx PRIx64 #define lli PRIi64 +#define llu PRIu64 #define hhu PRIu8 #include "usb_cmd.h" -- 2.39.2