diff --git a/examples/nfc-emulate-tag.c b/examples/nfc-emulate-tag.c index 91faacf..803f017 100644 --- a/examples/nfc-emulate-tag.c +++ b/examples/nfc-emulate-tag.c @@ -136,32 +136,32 @@ target_io( nfc_target *pnt, const uint8_t *pbtInput, const size_t szInput, uint8 } static bool -nfc_target_emulate_tag(nfc_device *pnd, nfc_target *pnt) +nfc_target_emulate_tag(nfc_device *dev, nfc_target *pnt) { size_t szTx; uint8_t abtTx[MAX_FRAME_LEN]; bool loop = true; - if ((szRx = nfc_target_init (pnd, pnt, abtRx, sizeof(abtRx), 0)) < 0) { - nfc_perror (pnd, "nfc_target_init"); + if ((szRx = nfc_target_init (dev, pnt, abtRx, sizeof(abtRx), 0)) < 0) { + nfc_perror (dev, "nfc_target_init"); return false; } while ( loop ) { loop = target_io( pnt, abtRx, (size_t) szRx, abtTx, &szTx ); if (szTx) { - if (nfc_target_send_bytes(pnd, abtTx, szTx, 0) < 0) { - nfc_perror (pnd, "nfc_target_send_bytes"); + if (nfc_target_send_bytes(dev, abtTx, szTx, 0) < 0) { + nfc_perror (dev, "nfc_target_send_bytes"); return false; } } if ( loop ) { if ( init_mfc_auth ) { - nfc_device_set_property_bool (pnd, NP_HANDLE_CRC, false); + nfc_device_set_property_bool (dev, NP_HANDLE_CRC, false); init_mfc_auth = false; } - if ((szRx = nfc_target_receive_bytes(pnd, abtRx, sizeof (abtRx), 0)) < 0) { - nfc_perror (pnd, "nfc_target_receive_bytes"); + if ((szRx = nfc_target_receive_bytes(dev, abtRx, sizeof (abtRx), 0)) < 0) { + nfc_perror (dev, "nfc_target_receive_bytes"); return false; } } diff --git a/utils/nfc-read-forum-tag3.c b/utils/nfc-read-forum-tag3.c index d2ed507..18d485d 100644 --- a/utils/nfc-read-forum-tag3.c +++ b/utils/nfc-read-forum-tag3.c @@ -86,7 +86,7 @@ build_felica_frame(const nfc_felica_info nfi, const uint8_t command, const uint8 #define CHECK 0x06 static int -nfc_forum_tag_type3_check (nfc_device *pnd, const nfc_target nt, const uint16_t block, const uint8_t block_count, uint8_t *data, size_t *data_len) +nfc_forum_tag_type3_check (nfc_device *dev, const nfc_target nt, const uint16_t block, const uint8_t block_count, uint8_t *data, size_t *data_len) { uint8_t payload[1024] = { 1, // Services @@ -114,7 +114,7 @@ nfc_forum_tag_type3_check (nfc_device *pnd, const nfc_target nt, const uint16_t uint8_t res[1024]; size_t res_len; - if (nfc_initiator_transceive_bytes (pnd, frame, frame_len, res, &res_len, 0) < 0) { + if (nfc_initiator_transceive_bytes (dev, frame, frame_len, res, &res_len, 0) < 0) { return -1; } const size_t res_overhead = 1 + 1 + 8 + 2; // 1+1+8+2: LEN + CMD + NFCID2 + STATUS @@ -296,13 +296,13 @@ main(int argc, char *argv[]) data_len = 0; for (uint16_t b = 0; b < (block_count_to_check/block_max_per_check); b += block_max_per_check) { - size_t len = sizeof(data) - data_len; - if(!nfc_forum_tag_type3_check (pnd, nt, 1+b, MIN(block_max_per_check, (block_count_to_check-(b*block_max_per_check))), data + data_len, &len)) { + size_t size = sizeof(data) - data_len; + if(!nfc_forum_tag_type3_check (pnd, nt, 1+b, MIN(block_max_per_check, (block_count_to_check-(b*block_max_per_check))), data + data_len, &size)) { nfc_perror (pnd, "nfc_forum_tag_type3_check"); error = EXIT_FAILURE; goto error; } - data_len += len; + data_len += size; } if (fwrite (data, 1, data_len, ndef_stream) != data_len) { fprintf (stderr, "Could not write to file.\n");