Convert by value passing of nfc_target to pointer for str_nfc_target and nfc_initiator_target_is_present

This becomes more consistent with all other pass by pointer of most structures.
Additionally, this should lessen stack memory usage, as building strings with str_nfc_target would push the target (283 bytes) plus then a copy of the info objects (up to 275) onto the stack as it dives into the sprintf functions.

Lastly, this makes my attempt at a .NET wrapper easier, as I can make passing by pointer work, but passing by value seems to bomb on the interop right now.
This commit is contained in:
Alex Lian 2013-03-03 23:40:07 -05:00 committed by Philippe Teuwen
parent a262be5633
commit c72846e3c6
16 changed files with 156 additions and 154 deletions

View file

@ -103,7 +103,7 @@ main(int argc, const char *argv[])
nfc_exit(context);
exit(EXIT_FAILURE);
}
print_nfc_target(nt, false);
print_nfc_target(&nt, false);
printf("Sending: %s\n", abtTx);
int res;

View file

@ -126,7 +126,7 @@ main(int argc, const char *argv[])
signal(SIGINT, stop_dep_communication);
printf("NFC device will now act as: ");
print_nfc_target(nt, false);
print_nfc_target(&nt, false);
printf("Waiting for initiator request...\n");
if ((szRx = nfc_target_init(pnd, &nt, abtRx, sizeof(abtRx), 0)) < 0) {

View file

@ -266,7 +266,7 @@ main(int argc, char *argv[])
*/
printf("%s will emulate this ISO14443-A tag:\n", argv[0]);
print_nfc_target(nt, true);
print_nfc_target(&nt, true);
// Switch off NP_EASY_FRAMING if target is not ISO14443-4
nfc_device_set_property_bool(pnd, NP_EASY_FRAMING, (nt.nti.nai.btSak & SAK_ISO14443_4_COMPLIANT));

View file

@ -137,7 +137,7 @@ main(int argc, const char *argv[])
}
if (res > 0) {
print_nfc_target(nt, verbose);
print_nfc_target(&nt, verbose);
} else {
printf("No target found.\n");
}