Commit 05789e5a authored by Romain Tartiere's avatar Romain Tartiere

Fix a couple warnings.

parent 3eba0e9b
......@@ -288,13 +288,13 @@ select:
}
// Read time-out
if (res == 0) {
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "Timeout!");
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "%s", "Timeout!");
return NFC_ETIMEOUT;
}
if (FD_ISSET (iAbortFd, &rfds)) {
// Abort requested
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "Abort!");
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "%s", "Abort!");
close (iAbortFd);
return NFC_EOPABORTED;
}
......
......@@ -150,7 +150,7 @@ pn53x_transceive (struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szT
if (timeout > 0) {
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "Timeout values: %d", timeout);
} else if (timeout == 0) {
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "No timeout");
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "%s", "No timeout");
} else if (timeout == -1) {
timeout = CHIP_DATA (pnd)->timeout_command;
} else {
......@@ -2547,12 +2547,12 @@ pn53x_check_ack_frame (struct nfc_device *pnd, const uint8_t *pbtRxFrame, const
{
if (szRxFrameLen >= sizeof (pn53x_ack_frame)) {
if (0 == memcmp (pbtRxFrame, pn53x_ack_frame, sizeof (pn53x_ack_frame))) {
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "PN53x ACKed");
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "%s", "PN53x ACKed");
return NFC_SUCCESS;
}
}
pnd->last_error = NFC_EIO;
log_put (LOG_CATEGORY, NFC_PRIORITY_ERROR, "Unexpected PN53x reply!");
log_put (LOG_CATEGORY, NFC_PRIORITY_ERROR, "%s", "Unexpected PN53x reply!");
return pnd->last_error;
}
......@@ -2561,7 +2561,7 @@ pn53x_check_error_frame (struct nfc_device *pnd, const uint8_t *pbtRxFrame, cons
{
if (szRxFrameLen >= sizeof (pn53x_error_frame)) {
if (0 == memcmp (pbtRxFrame, pn53x_error_frame, sizeof (pn53x_error_frame))) {
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "PN53x sent an error frame");
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "%s", "PN53x sent an error frame");
pnd->last_error = NFC_EIO;
return pnd->last_error;
}
......@@ -2831,6 +2831,7 @@ pn53x_get_supported_baud_rate (nfc_device *pnd, const nfc_modulation_type nmt, n
case NMT_DEP:
*supported_br = (nfc_baud_rate*)pn53x_dep_supported_baud_rates;
break;
default:
return NFC_EINVARG;
}
return NFC_SUCCESS;
......
......@@ -476,7 +476,7 @@ acr122s_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszD
(void) connstrings;
(void) connstrings_len;
*pszDeviceFound = 0;
log_put(LOG_CATEGORY, NFC_PRIORITY_INFO, "Serial auto-probing have been disabled at compile time. Skipping autoprobe.");
log_put(LOG_CATEGORY, NFC_PRIORITY_INFO, "%s", "Serial auto-probing have been disabled at compile time. Skipping autoprobe.");
return false;
#else /* SERIAL_AUTOPROBE_ENABLED */
*pszDeviceFound = 0;
......
......@@ -101,7 +101,7 @@ arygon_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t *pszD
(void) connstrings;
(void) connstrings_len;
*pszDeviceFound = 0;
log_put (LOG_CATEGORY, NFC_PRIORITY_INFO, "Serial auto-probing have been disabled at compile time. Skipping autoprobe.");
log_put (LOG_CATEGORY, NFC_PRIORITY_INFO, "%s", "Serial auto-probing have been disabled at compile time. Skipping autoprobe.");
return false;
#else /* SERIAL_AUTOPROBE_ENABLED */
*pszDeviceFound = 0;
......@@ -113,7 +113,7 @@ arygon_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t *pszD
while ((acPort = acPorts[iDevice++])) {
sp = uart_open (acPort);
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "Trying to find ARYGON device on serial port: %s at %d bauds.", acPort, ARYGON_DEFAULT_SPEED);
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "%s", "Trying to find ARYGON device on serial port: %s at %d bauds.", acPort, ARYGON_DEFAULT_SPEED);
if ((sp != INVALID_SERIAL_PORT) && (sp != CLAIMED_SERIAL_PORT)) {
// We need to flush input to be sure first reply does not comes from older byte transceive
......@@ -344,7 +344,7 @@ arygon_tama_send (nfc_device *pnd, const uint8_t *pbtData, const size_t szData,
if (pn53x_check_ack_frame (pnd, abtRxBuf, sizeof(abtRxBuf)) == 0) {
// The PN53x is running the sent command
} else if (0 == memcmp(arygon_error_unknown_mode, abtRxBuf, sizeof(abtRxBuf))) {
log_put (LOG_CATEGORY, NFC_PRIORITY_ERROR, "Bad frame format." );
log_put (LOG_CATEGORY, NFC_PRIORITY_ERROR, "%s", "Bad frame format.");
// We have already read 6 bytes and arygon_error_unknown_mode is 10 bytes long
// so we have to read 4 remaining bytes to be synchronized at the next receiving pass.
pnd->last_error = uart_receive (DRIVER_DATA (pnd)->port, abtRxBuf, 4, 0, timeout);
......@@ -495,12 +495,12 @@ arygon_firmware (nfc_device *pnd, char *str)
int res = uart_send (DRIVER_DATA (pnd)->port, arygon_firmware_version_cmd, sizeof (arygon_firmware_version_cmd), 0);
if (res != 0) {
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "Unable to send ARYGON firmware command.");
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "%s", "Unable to send ARYGON firmware command.");
return;
}
res = uart_receive (DRIVER_DATA (pnd)->port, abtRx, szRx, 0, 0);
if (res != 0) {
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "Unable to retrieve ARYGON firmware version.");
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "%s", "Unable to retrieve ARYGON firmware version.");
return;
}
......@@ -527,7 +527,7 @@ arygon_reset_tama (nfc_device *pnd)
// or arygon_error_unknown_mode (ie. in case of the first byte was bad-transmitted)
res = uart_receive (DRIVER_DATA (pnd)->port, abtRx, szRx, 0, 1000);
if (res != 0) {
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "No reply to 'reset TAMA' command.");
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "%s", "No reply to 'reset TAMA' command.");
pnd->last_error = res;
return pnd->last_error;
}
......
......@@ -660,7 +660,7 @@ pn53x_usb_init (nfc_device *pnd)
// ...and we don't care about error
pnd->last_error = 0;
if (SONY_RCS360 == DRIVER_DATA (pnd)->model) {
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "SONY RC-S360 initialization.");
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "%s", "SONY RC-S360 initialization.");
const uint8_t abtCmd2[] = { 0x18, 0x01 };
pn53x_transceive (pnd, abtCmd2, sizeof (abtCmd2), NULL, 0, 0);
pn53x_usb_ack (pnd);
......@@ -670,7 +670,7 @@ pn53x_usb_init (nfc_device *pnd)
return res;
if (ASK_LOGO == DRIVER_DATA (pnd)->model) {
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "ASK LoGO initialization.");
log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "%s", "ASK LoGO initialization.");
/* Internal registers */
/* Disable 100mA current limit, Power on Secure IC (SVDD) */
pn53x_write_register (pnd, PN53X_REG_Control_switch_rng, 0xFF, SYMBOL_CURLIMOFF | SYMBOL_SIC_SWITCH_EN | SYMBOL_RANDOM_DATAREADY);
......
......@@ -40,8 +40,8 @@
#define NFC_PRIORITY_TRACE "trace"
#else
// No logging
#define log_init() (0)
#define log_fini() (0)
#define log_init() ((void) 0)
#define log_fini() ((void) 0)
#define log_msg(category, priority, message) do {} while (0)
#define log_set_appender(category, appender) do {} while (0)
#define log_put(category, priority, format, ...) do {} while (0)
......
......@@ -106,20 +106,22 @@ const struct nfc_driver *nfc_drivers[] = {
* This function must be called before calling any other libnfc function
* @param context Optional output location for context pointer
*/
void
void
nfc_init(nfc_context *context)
{
(void) context;
log_init ();
}
/** @ingroup lib
* @brief Deinitialize libnfc.
* Should be called after closing all open devices and before your application terminates.
*@param context The context to deinitialize
*@param context The context to deinitialize
*/
void
void
nfc_exit(nfc_context *context)
{
(void) context;
log_fini ();
}
......@@ -176,6 +178,7 @@ nfc_get_default_device (nfc_connstring *connstring)
nfc_device *
nfc_open (nfc_context *context, const nfc_connstring connstring)
{
(void) context;
nfc_device *pnd = NULL;
nfc_connstring ncs;
......@@ -251,6 +254,8 @@ nfc_list_devices (nfc_context *context, nfc_connstring connstrings[] , size_t sz
const struct nfc_driver *ndr;
const struct nfc_driver **pndr = nfc_drivers;
(void) context;
while ((ndr = *pndr)) {
szN = 0;
if (ndr->probe (connstrings + (szDeviceFound), szDevices - (szDeviceFound), &szN)) {
......@@ -1028,4 +1033,4 @@ nfc_version (void)
#else
return PACKAGE_VERSION;
#endif // SVN_REVISION
}
\ No newline at end of file
}
......@@ -101,7 +101,7 @@ main (int argc, const char *argv[])
printf ("No NFC device found.\n");
}
printf ("%d NFC device(s) found:\n", szDeviceFound);
printf ("%d NFC device(s) found:\n", (int) szDeviceFound);
for (i = 0; i < szDeviceFound; i++) {
pnd = nfc_open (NULL, connstrings[i]);
if (pnd != NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment