fixed stupid 64-bit formatting for x86/amd64 and unix/windows - part2

This commit is contained in:
roel@libnfc.org 2013-02-28 22:33:31 +00:00
parent 125a98a110
commit 1a07fd510d
4 changed files with 7 additions and 5 deletions

View file

@ -31,13 +31,13 @@ int CmdHFEPACollectPACENonces(const char *Cmd)
// delay between requests
unsigned int d = 0;
sscanf(Cmd, "%hhu %u %u", &m, &n, &d);
sscanf(Cmd, "%"hhu" %u %u", &m, &n, &d);
// values are expected to be > 0
m = m > 0 ? m : 1;
n = n > 0 ? n : 1;
PrintAndLog("Collecting %u %hhu-byte nonces", n, m);
PrintAndLog("Collecting %u %"hhu"-byte nonces", n, m);
PrintAndLog("Start: %u", time(NULL));
// repeat n times
for (unsigned int i = 0; i < n; i++) {

View file

@ -324,7 +324,7 @@ int CmdLegicRfSim(const char *Cmd)
c.arg[0] = 6;
c.arg[1] = 3;
c.arg[2] = 0;
sscanf(Cmd, " %lli %lli %lli", &c.arg[0], &c.arg[1], &c.arg[2]);
sscanf(Cmd, " %"lli" %"lli" %"lli, &c.arg[0], &c.arg[1], &c.arg[2]);
SendCommand(&c);
return 0;
}
@ -344,7 +344,7 @@ int CmdLegicRfWrite(const char *Cmd)
int CmdLegicRfFill(const char *Cmd)
{
UsbCommand cmd ={CMD_WRITER_LEGIC_RF};
int res = sscanf(Cmd, " 0x%llx 0x%llx 0x%llx", &cmd.arg[0], &cmd.arg[1], &cmd.arg[2]);
int res = sscanf(Cmd, " 0x%"llx" 0x%"llx" 0x%"llx, &cmd.arg[0], &cmd.arg[1], &cmd.arg[2]);
if(res != 3) {
PrintAndLog("Please specify the offset, length and value as two hex strings");
return -1;

View file

@ -38,7 +38,7 @@ int CmdLFCommandRead(const char *Cmd)
dummy[0]= ' ';
UsbCommand c = {CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K};
sscanf(Cmd, "%lli %lli %lli %s %s", &c.arg[0], &c.arg[1], &c.arg[2], (char *) &c.d.asBytes,(char *) &dummy+1);
sscanf(Cmd, "%"lli" %"lli" %"lli" %s %s", &c.arg[0], &c.arg[1], &c.arg[2],(char*)(&c.d.asBytes),(char*)(&dummy+1));
// in case they specified 'h'
strcpy((char *)&c.d.asBytes + strlen((char *)c.d.asBytes), dummy);
SendCommand(&c);

View file

@ -15,6 +15,8 @@
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#define llx PRIx64
#define lli PRIi64
#define hhu PRIu8
#include <usb.h>
#include "usb_cmd.h"