Fix shadowed declaration warnings
This commit is contained in:
parent
e4802de965
commit
cfd95bae2c
2 changed files with 13 additions and 13 deletions
|
@ -136,32 +136,32 @@ target_io( nfc_target *pnt, const uint8_t *pbtInput, const size_t szInput, uint8
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
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;
|
size_t szTx;
|
||||||
uint8_t abtTx[MAX_FRAME_LEN];
|
uint8_t abtTx[MAX_FRAME_LEN];
|
||||||
bool loop = true;
|
bool loop = true;
|
||||||
|
|
||||||
if ((szRx = nfc_target_init (pnd, pnt, abtRx, sizeof(abtRx), 0)) < 0) {
|
if ((szRx = nfc_target_init (dev, pnt, abtRx, sizeof(abtRx), 0)) < 0) {
|
||||||
nfc_perror (pnd, "nfc_target_init");
|
nfc_perror (dev, "nfc_target_init");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( loop ) {
|
while ( loop ) {
|
||||||
loop = target_io( pnt, abtRx, (size_t) szRx, abtTx, &szTx );
|
loop = target_io( pnt, abtRx, (size_t) szRx, abtTx, &szTx );
|
||||||
if (szTx) {
|
if (szTx) {
|
||||||
if (nfc_target_send_bytes(pnd, abtTx, szTx, 0) < 0) {
|
if (nfc_target_send_bytes(dev, abtTx, szTx, 0) < 0) {
|
||||||
nfc_perror (pnd, "nfc_target_send_bytes");
|
nfc_perror (dev, "nfc_target_send_bytes");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( loop ) {
|
if ( loop ) {
|
||||||
if ( init_mfc_auth ) {
|
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;
|
init_mfc_auth = false;
|
||||||
}
|
}
|
||||||
if ((szRx = nfc_target_receive_bytes(pnd, abtRx, sizeof (abtRx), 0)) < 0) {
|
if ((szRx = nfc_target_receive_bytes(dev, abtRx, sizeof (abtRx), 0)) < 0) {
|
||||||
nfc_perror (pnd, "nfc_target_receive_bytes");
|
nfc_perror (dev, "nfc_target_receive_bytes");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ build_felica_frame(const nfc_felica_info nfi, const uint8_t command, const uint8
|
||||||
|
|
||||||
#define CHECK 0x06
|
#define CHECK 0x06
|
||||||
static int
|
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] = {
|
uint8_t payload[1024] = {
|
||||||
1, // Services
|
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];
|
uint8_t res[1024];
|
||||||
|
|
||||||
size_t res_len;
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
const size_t res_overhead = 1 + 1 + 8 + 2; // 1+1+8+2: LEN + CMD + NFCID2 + STATUS
|
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;
|
data_len = 0;
|
||||||
for (uint16_t b = 0; b < (block_count_to_check/block_max_per_check); b += block_max_per_check) {
|
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;
|
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, &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");
|
nfc_perror (pnd, "nfc_forum_tag_type3_check");
|
||||||
error = EXIT_FAILURE;
|
error = EXIT_FAILURE;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
data_len += len;
|
data_len += size;
|
||||||
}
|
}
|
||||||
if (fwrite (data, 1, data_len, ndef_stream) != data_len) {
|
if (fwrite (data, 1, data_len, ndef_stream) != data_len) {
|
||||||
fprintf (stderr, "Could not write to file.\n");
|
fprintf (stderr, "Could not write to file.\n");
|
||||||
|
|
Loading…
Add table
Reference in a new issue