From 91809c6d9410a718a24d2d3ae7e84a220ebd20bd Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 28 Nov 2018 23:53:31 +0100 Subject: [PATCH] FIX: part of https://github.com/Proxmark/proxmark3/pull/723 (@Fl0-0) CHG: remove some warnings when compiling on 32/64 bit systems. Messy messy --- client/crypto/asn1dump.c | 2 ++ client/fido/cbortools.c | 9 +++++++-- client/fpga_compress.c | 9 ++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/client/crypto/asn1dump.c b/client/crypto/asn1dump.c index 60799fc8c..34f4a9fa4 100644 --- a/client/crypto/asn1dump.c +++ b/client/crypto/asn1dump.c @@ -7,12 +7,14 @@ //----------------------------------------------------------------------------- // asn.1 dumping //----------------------------------------------------------------------------- +#define _POSIX_C_SOURCE 200809L // need for strnlen() #include "asn1dump.h" #include #include #include #include +#include #include #include #include diff --git a/client/fido/cbortools.c b/client/fido/cbortools.c index 8ab104a1c..01691dad1 100644 --- a/client/fido/cbortools.c +++ b/client/fido/cbortools.c @@ -203,8 +203,13 @@ int TinyCborPrintFIDOPackage(uint8_t cmdCode, bool isResponse, uint8_t *data, si CborError err = dumprecursive(cmdCode, isResponse, &cb, false, 0); if (err) { - fprintf(stderr, "CBOR parsing failure at offset %d: %s\n", - cb.ptr - data, cbor_error_string(err)); + fprintf(stderr, +#if __WORDSIZE == 64 + "CBOR parsing failure at offset %" PRId64 " : %s\n", +#else + "CBOR parsing failure at offset %" PRId32 " : %s\n", +#endif + cb.ptr - data, cbor_error_string(err)); return 1; } diff --git a/client/fpga_compress.c b/client/fpga_compress.c index ce0f41982..ceba6ac64 100644 --- a/client/fpga_compress.c +++ b/client/fpga_compress.c @@ -99,7 +99,14 @@ 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, "Input file too big (> %llu bytes). This is probably not a hardnested bitflip state table.\n", HARDNESTED_TABLE_SIZE); + 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 (> %lu bytes). This is probably not a hardnested bitflip state table.\n" +#endif + , HARDNESTED_TABLE_SIZE); + } else { fprintf(stderr, "Input files too big (total > %lu bytes). These are probably not PM3 FPGA config files.\n", num_infiles * FPGA_CONFIG_SIZE); }