mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-12 18:25:07 +08:00
styles
This commit is contained in:
parent
eae370fc3d
commit
f50566225c
2 changed files with 23 additions and 13 deletions
|
@ -41,9 +41,13 @@
|
|||
#define TOHEX(v) ((v) < 10 ? (v) + '0' : (v) - 10 + 'a')
|
||||
|
||||
static ssize_t emv_pk_read_bin(char *buf, unsigned char *bin, size_t size, size_t *read) {
|
||||
|
||||
if ( buf == NULL )
|
||||
return 0;
|
||||
|
||||
size_t left = size;
|
||||
char *p = buf;
|
||||
while (p != NULL && *p == ' ')
|
||||
while (*p == ' ')
|
||||
p++;
|
||||
|
||||
while (left > 0) {
|
||||
|
@ -70,7 +74,7 @@ static ssize_t emv_pk_read_bin(char *buf, unsigned char *bin, size_t size, size_
|
|||
return -(p - buf);
|
||||
}
|
||||
|
||||
while (p != NULL && *p == ' ')
|
||||
while (*p == ' ')
|
||||
p++;
|
||||
|
||||
p--;
|
||||
|
@ -79,13 +83,17 @@ static ssize_t emv_pk_read_bin(char *buf, unsigned char *bin, size_t size, size_
|
|||
}
|
||||
|
||||
static ssize_t emv_pk_read_ymv(char *buf, unsigned *ymv) {
|
||||
|
||||
if ( buf == NULL )
|
||||
return 0;
|
||||
|
||||
int i;
|
||||
unsigned char temp[3];
|
||||
char *p = buf;
|
||||
|
||||
*ymv = 0;
|
||||
|
||||
while (p != NULL && *p == ' ')
|
||||
while (*p == ' ')
|
||||
p++;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
|
@ -101,7 +109,7 @@ static ssize_t emv_pk_read_ymv(char *buf, unsigned *ymv) {
|
|||
temp[i] = (c1 * 16 + c2);
|
||||
}
|
||||
|
||||
while (p != NULL && *p == ' ')
|
||||
while (*p == ' ')
|
||||
p++;
|
||||
|
||||
p--;
|
||||
|
@ -115,8 +123,12 @@ static ssize_t emv_pk_read_ymv(char *buf, unsigned *ymv) {
|
|||
}
|
||||
|
||||
static ssize_t emv_pk_read_string(char *buf, char *str, size_t size) {
|
||||
|
||||
if ( buf == NULL )
|
||||
return 0;
|
||||
|
||||
char *p = buf;
|
||||
while (p != NULL && *p == ' ')
|
||||
while (*p == ' ')
|
||||
p++;
|
||||
|
||||
while (size > 1) {
|
||||
|
@ -132,7 +144,7 @@ static ssize_t emv_pk_read_string(char *buf, char *str, size_t size) {
|
|||
|
||||
*str = 0;
|
||||
|
||||
while (p != NULL && *p == ' ')
|
||||
while (*p == ' ')
|
||||
p++;
|
||||
|
||||
p--;
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#define COMPRESS_MAX_NICE_LENGTH 258
|
||||
#define COMPRESS_MAX_CHAIN 8192
|
||||
|
||||
#define HARDNESTED_TABLE_SIZE (sizeof(uint32_t) * ((1L<<19)+1))
|
||||
#define HARDNESTED_TABLE_SIZE (uint32_t)(sizeof(uint32_t) * ((1L<<19)+1))
|
||||
|
||||
static void usage(void) {
|
||||
fprintf(stdout, "Usage: fpga_compress <infile1> <infile2> ... <infile_n> <outfile>\n");
|
||||
|
@ -95,15 +95,13 @@ int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile, bool hardn
|
|||
if (i >= num_infiles * (hardnested_mode ? HARDNESTED_TABLE_SIZE : FPGA_CONFIG_SIZE)) {
|
||||
if (hardnested_mode) {
|
||||
fprintf(stderr,
|
||||
#if __WORDSIZE == 64
|
||||
"Input file too big (> %" PRIu64 " bytes). This is probably not a hardnested bitflip state table.\n"
|
||||
#else
|
||||
"Input file too big (> %li bytes). This is probably not a hardnested bitflip state table.\n"
|
||||
#endif
|
||||
"Input file too big (> %" PRIu32 " bytes). This is probably not a hardnested bitflip state table.\n"
|
||||
, HARDNESTED_TABLE_SIZE);
|
||||
|
||||
} else {
|
||||
fprintf(stderr, "Input files too big (total > %li bytes). These are probably not PM3 FPGA config files.\n", num_infiles * FPGA_CONFIG_SIZE);
|
||||
fprintf(stderr,
|
||||
"Input files too big (total > %li bytes). These are probably not PM3 FPGA config files.\n"
|
||||
, num_infiles * FPGA_CONFIG_SIZE);
|
||||
}
|
||||
for (uint16_t j = 0; j < num_infiles; j++) {
|
||||
fclose(infile[j]);
|
||||
|
|
Loading…
Reference in a new issue