From 3e4ab945f5889688e1d0828bdf5b6330c159c26a Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sun, 10 Nov 2024 15:08:45 +0100 Subject: [PATCH] fix parameter name and style --- client/src/mifare/mifarehost.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/client/src/mifare/mifarehost.c b/client/src/mifare/mifarehost.c index 19d6f609d..00570c7c2 100644 --- a/client/src/mifare/mifarehost.c +++ b/client/src/mifare/mifarehost.c @@ -1001,22 +1001,25 @@ int mfWriteBlock(uint8_t blockno, uint8_t keyType, const uint8_t *key, uint8_t * memcpy(data + 10, block, MFBLOCK_SIZE); clearCommandBuffer(); - SendCommandMIX(CMD_HF_MIFARE_WRITEBL, blockno, keytype, 0, data, sizeof(data)); + SendCommandMIX(CMD_HF_MIFARE_WRITEBL, blockno, keyType, 0, data, sizeof(data)); PacketResponseNG resp; if (WaitForResponseTimeout(CMD_ACK, &resp, 1500) == false) { PrintAndLogEx(FAILED, "mfWriteBlock execution time out"); return PM3_ETIMEOUT; } - - return ((resp.oldarg[0] & 0xff) == 1)?PM3_SUCCESS:PM3_EFAILED; + int res = PM3_SUCCESS; + if ((resp.oldarg[0] & 0xff) != 1) { + res = PM3_EFAILED; + } + return res; } int mfWriteSector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t *sector){ - int res; - for (int i=0;i<4; i++){ - res = mfWriteBlock((sectorNo*4)+i, keyType, key, sector+(i*MFBLOCK_SIZE)); - if (res != PM3_SUCCESS){ - return (i==0)?PM3_EFAILED:PM3_EPARTIAL; + + for (int i = 0; i < 4; i++) { + int res = mfWriteBlock((sectorNo*4)+i, keyType, key, sector + ( i * MFBLOCK_SIZE )); + if (res != PM3_SUCCESS) { + return (i == 0) ? PM3_EFAILED : PM3_EPARTIAL; } } return PM3_SUCCESS;