From 243100b676e73b927b33e19cc6b60252fcca5298 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Thu, 10 Feb 2011 10:38:21 +0000 Subject: [PATCH] Silent some compilation warnings (Fixes Issue 145) --- examples/nfc-emulate-tag.c | 2 +- examples/nfc-mfultralight.c | 8 ++++++-- libnfc/chips/pn53x.c | 4 ++++ libnfc/drivers/acr122.c | 4 +--- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/examples/nfc-emulate-tag.c b/examples/nfc-emulate-tag.c index 30b2304..95259b0 100644 --- a/examples/nfc-emulate-tag.c +++ b/examples/nfc-emulate-tag.c @@ -87,7 +87,7 @@ target_io( nfc_target_t * pnt, const byte_t * pbtInput, const size_t szInput, by case 0x30: // Mifare read // block address is in pbtInput[1] *pszOutput = 15; - strcpy(pbtOutput, "You read block "); + strcpy((char*)pbtOutput, "You read block "); pbtOutput[15] = pbtInput[1]; break; case 0x50: // Deselect / HALT diff --git a/examples/nfc-mfultralight.c b/examples/nfc-mfultralight.c index e1ddab2..471a3f0 100644 --- a/examples/nfc-mfultralight.c +++ b/examples/nfc-mfultralight.c @@ -113,10 +113,14 @@ write_card (void) bool write_lock; printf ("Write OTP bytes ? [yN] "); - fgets (buffer, BUFSIZ, stdin); + if (!fgets (buffer, BUFSIZ, stdin)) { + ERR ("Unable to read standard input."); + } write_otp = ((buffer[0] == 'y') || (buffer[0] == 'Y')); printf ("Write Lock bytes ? [yN] "); - fgets (buffer, BUFSIZ, stdin); + if (!fgets (buffer, BUFSIZ, stdin)) { + ERR ("Unable to read standard input."); + } write_lock = ((buffer[0] == 'y') || (buffer[0] == 'Y')); printf ("Writing %d pages |", uiBlocks + 1); diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index ee2ef8b..7b437f4 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -1287,6 +1287,8 @@ pn53x_target_init (nfc_device_t * pnd, nfc_target_t * pnt, byte_t * pbtRx, size_ nfc_dep_mode_t ndm = NDM_UNDEFINED; byte_t btActivatedMode; + nm.nbr = NBR_UNDEFINED; + if(!pn53x_TgInitAsTarget(pnd, ptm, pbtMifareParams, pbtTkt, szTkt, pbtFeliCaParams, pbtNFCID3t, pbtGBt, szGBt, pbtRx, pszRx, &btActivatedMode)) { return false; } @@ -1648,6 +1650,8 @@ pn53x_ptt_to_nm( const pn53x_target_type_t ptt ) return (const nfc_modulation_t){ .nmt = NMT_DEP, .nbr = NBR_424 }; break; } + // We should never be here, this line silent compilation warning + return (const nfc_modulation_t){ .nmt = NMT_ISO14443A, .nbr = NBR_106 }; } const pn53x_target_type_t diff --git a/libnfc/drivers/acr122.c b/libnfc/drivers/acr122.c index c39caee..82d19e8 100644 --- a/libnfc/drivers/acr122.c +++ b/libnfc/drivers/acr122.c @@ -358,11 +358,9 @@ acr122_firmware (const nfc_device_spec_t nds) uiResult = SCardTransmit (pas->hCard, &(pas->ioCard), abtGetFw, sizeof (abtGetFw), NULL, (byte_t *) abtFw, (void *) &szFwLen); } -#ifdef DEBUG if (uiResult != SCARD_S_SUCCESS) { - printf ("No ACR122 firmware received, Error: %08x\n", uiResult); + ERR ("No ACR122 firmware received, Error: %08x", uiResult); } -#endif return abtFw; }