fix compiler warning in cmdhflegic.c (and whitespace fixes) (#826)

This commit is contained in:
pwpiwi 2019-05-27 07:57:40 +02:00 committed by GitHub
parent a39af1cb9c
commit 2378bb24c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -218,8 +218,10 @@ int CmdLegicRFRead(const char *Cmd)
UsbCommand resp;
WaitForResponse(CMD_ACK,&resp);
switch (resp.arg[0]) {
legic_card_select_t card;
case 0:
PrintAndLog("Card (MIM %i) read, use 'hf legic decode' or", ((legic_card_select_t*)resp.d.asBytes)->cardsize);
memcpy(&card, resp.d.asBytes, sizeof(card));
PrintAndLog("Card (MIM %i) read, use 'hf legic decode' or", card.cardsize);
PrintAndLog("'data hexsamples %d' to view results", (resp.arg[1] + 7) & ~7);
break;
case 1:
@ -252,16 +254,16 @@ int CmdLegicLoad(const char *Cmd)
memcpy(filename, Cmd, len);
FILE *f = fopen(filename, "r");
if(!f) {
if (!f) {
PrintAndLog("couldn't open '%s'", Cmd);
return -1;
}
char line[80]; int offset = 0; unsigned int data[8];
while(fgets(line, sizeof(line), f)) {
while (fgets(line, sizeof(line), f)) {
int res = sscanf(line, "%x %x %x %x %x %x %x %x",
&data[0], &data[1], &data[2], &data[3],
&data[4], &data[5], &data[6], &data[7]);
if(res != 8) {
if (res != 8) {
PrintAndLog("Error: could not read samples");
fclose(f);
return -1;
@ -304,7 +306,7 @@ int CmdLegicSave(const char *Cmd)
}
FILE *f = fopen(filename, "w");
if(!f) {
if (!f) {
PrintAndLog("couldn't open '%s'", Cmd+1);
return -1;
}
@ -345,7 +347,7 @@ int CmdLegicRfWrite(const char *Cmd)
{
UsbCommand c={CMD_WRITER_LEGIC_RF};
int res = sscanf(Cmd, " 0x%" SCNx64 " 0x%" SCNx64, &c.arg[0], &c.arg[1]);
if(res != 2) {
if (res != 2) {
PrintAndLog("Please specify the offset and length as two hex strings");
return -1;
}
@ -357,17 +359,17 @@ int CmdLegicRfFill(const char *Cmd)
{
UsbCommand cmd ={CMD_WRITER_LEGIC_RF};
int res = sscanf(Cmd, " 0x%" SCNx64 " 0x%" SCNx64 " 0x%" SCNx64, &cmd.arg[0], &cmd.arg[1], &cmd.arg[2]);
if(res != 3) {
if (res != 3) {
PrintAndLog("Please specify the offset, length and value as two hex strings");
return -1;
}
int i;
UsbCommand c={CMD_DOWNLOADED_SIM_SAMPLES_125K, {0, 1, 0}};
for(i = 0; i < 48; i++) {
for (i = 0; i < 48; i++) {
c.d.asBytes[i] = cmd.arg[2];
}
for(i = 0; i < 22; i++) {
for (i = 0; i < 22; i++) {
c.arg[0] = i*48;
SendCommand(&c);
WaitForResponse(CMD_ACK,NULL);