From 4384d27f3efee7a3546de958151af5ae14e0983a Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Mon, 28 Feb 2011 09:47:31 +0000 Subject: [PATCH] examples: silent some compilation warnings. --- examples/nfc-dep-target.c | 28 +++++++++++++++++----------- examples/nfc-emulate-forum-tag4.c | 22 ++++++++++++++-------- examples/nfc-emulate-tag.c | 21 ++++++++++++++------- examples/nfc-emulate-uid.c | 20 +++++++++++++------- examples/nfc-mfultralight.c | 2 +- examples/nfc-relay-picc.c | 6 ++++-- examples/nfc-relay.c | 20 +++++++++++++------- examples/nfc-utils.c | 3 +++ examples/pn53x-diagnose.c | 6 +++--- examples/pn53x-sam.c | 22 ++++++++++++++-------- examples/pn53x-tamashell.c | 4 ++-- 11 files changed, 98 insertions(+), 56 deletions(-) diff --git a/examples/nfc-dep-target.c b/examples/nfc-dep-target.c index 7041842..9a74dfa 100644 --- a/examples/nfc-dep-target.c +++ b/examples/nfc-dep-target.c @@ -76,17 +76,23 @@ main (int argc, const char *argv[]) } nfc_target_t nt = { - .nm.nmt = NMT_DEP, - .nm.nbr = NBR_UNDEFINED, // Will be updated by nfc_target_init - .nti.ndi.abtNFCID3 = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xff, 0x00, 0x00 }, - .nti.ndi.szGB = 4, - .nti.ndi.abtGB = { 0x12, 0x34, 0x56, 0x78 }, - /* These bytes are not used by nfc_target_init: the chip will provide them automatically to the initiator */ - .nti.ndi.btDID = 0x00, - .nti.ndi.btBS = 0x00, - .nti.ndi.btBR = 0x00, - .nti.ndi.btTO = 0x00, - .nti.ndi.btPP = 0x01, + .nm = { + .nmt = NMT_DEP, + .nbr = NBR_UNDEFINED + }, + .nti = { + .ndi = { + .abtNFCID3 = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xff, 0x00, 0x00 }, + .szGB = 4, + .abtGB = { 0x12, 0x34, 0x56, 0x78 }, + /* These bytes are not used by nfc_target_init: the chip will provide them automatically to the initiator */ + .btDID = 0x00, + .btBS = 0x00, + .btBR = 0x00, + .btTO = 0x00, + .btPP = 0x01, + }, + }, }; if (!pnd) { diff --git a/examples/nfc-emulate-forum-tag4.c b/examples/nfc-emulate-forum-tag4.c index 8040a71..9b5cb39 100644 --- a/examples/nfc-emulate-forum-tag4.c +++ b/examples/nfc-emulate-forum-tag4.c @@ -108,7 +108,7 @@ bool receive_bytes (void) } int -main (int argc, char *argv[]) +main (void) { // Try to open the NFC reader pnd = nfc_connect (NULL); @@ -122,13 +122,19 @@ main (int argc, char *argv[]) printf ("Emulating NDEF tag now, please touch it with a second NFC device\n"); nfc_target_t nt = { - .nm.nmt = NMT_ISO14443A, - .nm.nbr = NBR_UNDEFINED, // Will be updated by nfc_target_init() - .nti.nai.abtAtqa = { 0x00, 0x04 }, - .nti.nai.abtUid = { 0x08, 0x00, 0xb0, 0x0b }, - .nti.nai.btSak = 0x20, - .nti.nai.szUidLen = 4, - .nti.nai.szAtsLen = 0, + .nm = { + .nmt = NMT_ISO14443A, + .nbr = NBR_UNDEFINED, // Will be updated by nfc_target_init() + }, + .nti = { + .nai = { + .abtAtqa = { 0x00, 0x04 }, + .abtUid = { 0x08, 0x00, 0xb0, 0x0b }, + .btSak = 0x20, + .szUidLen = 4, + .szAtsLen = 0, + }, + }, }; if (!nfc_target_init (pnd, &nt, abtRx, &szRx)) { diff --git a/examples/nfc-emulate-tag.c b/examples/nfc-emulate-tag.c index 95259b0..9c4935d 100644 --- a/examples/nfc-emulate-tag.c +++ b/examples/nfc-emulate-tag.c @@ -171,6 +171,7 @@ nfc_target_emulate_tag(nfc_device_t* pnd, nfc_target_t * pnt) int main (int argc, char *argv[]) { + (void) argc; const char *acLibnfcVersion; #ifdef WIN32 @@ -204,13 +205,19 @@ main (int argc, char *argv[]) // Example of a Mifare Classic Mini // Note that crypto1 is not implemented in this example nfc_target_t nt = { - .nm.nmt = NMT_ISO14443A, - .nm.nbr = NBR_UNDEFINED, - .nti.nai.abtAtqa = { 0x00, 0x04 }, - .nti.nai.abtUid = { 0x08, 0xab, 0xcd, 0xef }, - .nti.nai.btSak = 0x09, - .nti.nai.szUidLen = 4, - .nti.nai.szAtsLen = 0, + .nm = { + .nmt = NMT_ISO14443A, + .nbr = NBR_UNDEFINED, + }, + .nti = { + .nai = { + .abtAtqa = { 0x00, 0x04 }, + .abtUid = { 0x08, 0xab, 0xcd, 0xef }, + .btSak = 0x09, + .szUidLen = 4, + .szAtsLen = 0, + }, + }, }; /* // Example of a FeliCa diff --git a/examples/nfc-emulate-uid.c b/examples/nfc-emulate-uid.c index f46fa1f..faa15c4 100644 --- a/examples/nfc-emulate-uid.c +++ b/examples/nfc-emulate-uid.c @@ -143,13 +143,19 @@ main (int argc, char *argv[]) // Note: We have to build a "fake" nfc_target_t in order to do exactly the same that was done before the new nfc_target_init() was introduced. nfc_target_t nt = { - .nm.nmt = NMT_ISO14443A, - .nm.nbr = NBR_UNDEFINED, - .nti.nai.abtAtqa = { 0x04, 0x00 }, - .nti.nai.abtUid = { 0x08, 0xad, 0xbe, 0xef }, - .nti.nai.btSak = 0x20, - .nti.nai.szUidLen = 4, - .nti.nai.szAtsLen = 0, + .nm = { + .nmt = NMT_ISO14443A, + .nbr = NBR_UNDEFINED, + }, + .nti = { + .nai = { + .abtAtqa = { 0x04, 0x00 }, + .abtUid = { 0x08, 0xad, 0xbe, 0xef }, + .btSak = 0x20, + .szUidLen = 4, + .szAtsLen = 0, + }, + }, }; if (!nfc_target_init (pnd, &nt, abtRecv, &szRecvBits)) { nfc_perror (pnd, "nfc_target_init"); diff --git a/examples/nfc-mfultralight.c b/examples/nfc-mfultralight.c index 471a3f0..429cea3 100644 --- a/examples/nfc-mfultralight.c +++ b/examples/nfc-mfultralight.c @@ -29,7 +29,7 @@ */ /** - * @file nfc-mfultool.c + * @file nfc-mfultralight.c * @brief MIFARE Ultralight dump/restore tool */ diff --git a/examples/nfc-relay-picc.c b/examples/nfc-relay-picc.c index 9d32524..f5a4ee7 100644 --- a/examples/nfc-relay-picc.c +++ b/examples/nfc-relay-picc.c @@ -292,8 +292,10 @@ main (int argc, char *argv[]) } if (!initiator_only_mode) { nfc_target_t ntEmulatedTarget = { - .nm.nmt = NMT_ISO14443A, - .nm.nbr = NBR_106, + .nm = { + .nmt = NMT_ISO14443A, + .nbr = NBR_106, + }, }; if (target_only_mode) { size_t foo; diff --git a/examples/nfc-relay.c b/examples/nfc-relay.c index d65abad..4b36546 100644 --- a/examples/nfc-relay.c +++ b/examples/nfc-relay.c @@ -137,13 +137,19 @@ main (int argc, char *argv[]) printf ("[+] For example, send a RATS command or use the \"nfc-anticol\" tool\n"); nfc_target_t nt = { - .nm.nmt = NMT_ISO14443A, - .nm.nbr = NBR_UNDEFINED, - .nti.nai.abtAtqa = { 0x04, 0x00 }, - .nti.nai.abtUid = { 0xde, 0xad, 0xbe, 0xef }, - .nti.nai.btSak = 0x20, - .nti.nai.szUidLen = 4, - .nti.nai.szAtsLen = 0, + .nm = { + .nmt = NMT_ISO14443A, + .nbr = NBR_UNDEFINED, + }, + .nti = { + .nai = { + .abtAtqa = { 0x04, 0x00 }, + .abtUid = { 0xde, 0xad, 0xbe, 0xef }, + .btSak = 0x20, + .szUidLen = 4, + .szAtsLen = 0, + }, + }, }; if (!nfc_target_init (pndTag, &nt, abtReaderRx, &szReaderRxBits)) { diff --git a/examples/nfc-utils.c b/examples/nfc-utils.c index 6cd13cc..9a0f0fb 100644 --- a/examples/nfc-utils.c +++ b/examples/nfc-utils.c @@ -532,6 +532,7 @@ print_nfc_iso14443a_info (const nfc_iso14443a_info_t nai, bool verbose) void print_nfc_felica_info (const nfc_felica_info_t nfi, bool verbose) { + (void) verbose; printf (" ID (NFCID2): "); print_hex (nfi.abtId, 8); printf (" Parameter (PAD): "); @@ -541,6 +542,7 @@ print_nfc_felica_info (const nfc_felica_info_t nfi, bool verbose) void print_nfc_jewel_info (const nfc_jewel_info_t nji, bool verbose) { + (void) verbose; printf (" ATQA (SENS_RES): "); print_hex (nji.btSensRes, 2); printf (" 4-LSB JEWELID: "); @@ -608,6 +610,7 @@ print_nfc_iso14443b_info (const nfc_iso14443b_info_t nbi, bool verbose) void print_nfc_dep_info (const nfc_dep_info_t ndi, bool verbose) { + (void) verbose; printf (" NFCID3: "); print_hex (ndi.abtNFCID3, 10); printf (" BS: %02x\n", ndi.btBS); diff --git a/examples/pn53x-diagnose.c b/examples/pn53x-diagnose.c index f5995aa..5e40328 100644 --- a/examples/pn53x-diagnose.c +++ b/examples/pn53x-diagnose.c @@ -88,19 +88,19 @@ main (int argc, const char *argv[]) printf ("NFC device [%s] connected.\n", pnd->acName); - result = pn53x_transceive (pnd, pncmd_diagnose_communication_line_test, sizeof (pncmd_diagnose_communication_line_test), abtRx, &szRx); + result = pn53x_transceive (pnd, pncmd_diagnose_communication_line_test, sizeof (pncmd_diagnose_communication_line_test), abtRx, &szRx, false); if (result) { result = (memcmp (pncmd_diagnose_communication_line_test + 2, abtRx, sizeof (pncmd_diagnose_communication_line_test) - 2) == 0); } printf (" Communication line test: %s\n", result ? "OK" : "Failed"); - result = pn53x_transceive (pnd, pncmd_diagnose_rom_test, sizeof (pncmd_diagnose_rom_test), abtRx, &szRx); + result = pn53x_transceive (pnd, pncmd_diagnose_rom_test, sizeof (pncmd_diagnose_rom_test), abtRx, &szRx, false); if (result) { result = ((szRx == 1) && (abtRx[0] == 0x00)); } printf (" ROM test: %s\n", result ? "OK" : "Failed"); - result = pn53x_transceive (pnd, pncmd_diagnose_ram_test, sizeof (pncmd_diagnose_ram_test), abtRx, &szRx); + result = pn53x_transceive (pnd, pncmd_diagnose_ram_test, sizeof (pncmd_diagnose_ram_test), abtRx, &szRx, false); if (result) { result = ((szRx == 1) && (abtRx[0] == 0x00)); } diff --git a/examples/pn53x-sam.c b/examples/pn53x-sam.c index 8ab9aae..e981dd3 100644 --- a/examples/pn53x-sam.c +++ b/examples/pn53x-sam.c @@ -93,7 +93,7 @@ sam_connection (nfc_device_t * pnd, int mode) break; } - if (!pn53x_transceive (pnd, pncmd_sam_config, szCmd, abtRx, &szRx)) { + if (!pn53x_transceive (pnd, pncmd_sam_config, szCmd, abtRx, &szRx, false)) { nfc_perror(pnd, "pn53x_transceive"); ERR ("%s %d", "Unable to execute SAMConfiguration command with mode byte:", mode); return false; @@ -213,13 +213,19 @@ main (int argc, const char *argv[]) size_t szRx; nfc_target_t nt = { - .nm.nmt = NMT_ISO14443A, - .nm.nbr = NBR_UNDEFINED, - .nti.nai.abtAtqa = { 0x04, 0x00 }, - .nti.nai.abtUid = { 0x08, 0xad, 0xbe, 0xef }, - .nti.nai.btSak = 0x20, - .nti.nai.szUidLen = 4, - .nti.nai.szAtsLen = 0, + .nm = { + .nmt = NMT_ISO14443A, + .nbr = NBR_UNDEFINED, + }, + .nti = { + .nai = { + .abtAtqa = { 0x04, 0x00 }, + .abtUid = { 0x08, 0xad, 0xbe, 0xef }, + .btSak = 0x20, + .szUidLen = 4, + .szAtsLen = 0, + }, + }, }; printf ("Now both, NFC device (configured as target) and SAM are readables from an external NFC initiator.\n"); printf ("Please note that NFC device (configured as target) stay in target mode until it receive RATS, ATR_REQ or proprietary command.\n"); diff --git a/examples/pn53x-tamashell.c b/examples/pn53x-tamashell.c index ef89ee5..4a0410d 100644 --- a/examples/pn53x-tamashell.c +++ b/examples/pn53x-tamashell.c @@ -132,7 +132,7 @@ int main(int argc, const char* argv[]) while (isspace(cmd[offset])) { offset++; } - sscanf(cmd+offset, "%u", &s); + sscanf(cmd+offset, "%d", &s); printf("Pause for %i secs\n", s); if (s>0) { sleep(s); @@ -167,7 +167,7 @@ int main(int argc, const char* argv[]) printf("Tx: "); print_hex((byte_t*)abtTx+1,szTx-1); - if (!pn53x_transceive (pnd, abtTx, szTx, abtRx, &szRx)) { + if (!pn53x_transceive (pnd, abtTx, szTx, abtRx, &szRx, false)) { free(cmd); nfc_perror (pnd, "Rx"); continue;