Fix more warnings while using -Wswitch-enum and -Wshadow on internal libnfc files

This commit is contained in:
Romuald Conty 2012-05-16 18:08:42 +00:00
parent d6a1249469
commit bfcdb1bd4c
5 changed files with 26 additions and 11 deletions

View file

@ -408,7 +408,7 @@ acr122_usb_open (const nfc_connstring connstring)
case TOUCHATAG:
CHIP_DATA (pnd)->timer_correction = 50;
break;
default:
case UNKNOWN:
break;
}
pnd->driver = &acr122_usb_driver;

View file

@ -224,7 +224,7 @@ pn53x_usb_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t *p
usb_dev_handle *udev = usb_open (dev);
// Set configuration
int res = usb_set_configuration (udev, 1);
res = usb_set_configuration (udev, 1);
if (res < 0) {
log_put (LOG_CATEGORY, NFC_PRIORITY_ERROR, "Unable to set USB configuration (%s)", _usb_strerror (res));
usb_close (udev);
@ -362,7 +362,7 @@ pn53x_usb_open (const nfc_connstring connstring)
// Retrieve end points
pn53x_usb_get_end_points (dev, &data);
// Set configuration
int res = usb_set_configuration (data.pudh, 1);
res = usb_set_configuration (data.pudh, 1);
if (res < 0) {
log_put (LOG_CATEGORY, NFC_PRIORITY_ERROR, "Unable to set USB configuration (%s)", _usb_strerror (res));
if (EPERM == -res) {
@ -406,7 +406,9 @@ pn53x_usb_open (const nfc_connstring connstring)
case SONY_PN531:
CHIP_DATA (pnd)->timer_correction = 54;
break;
default:
case SONY_RCS360:
case UNKNOWN:
CHIP_DATA (pnd)->timer_correction = 0; // TODO: allow user to know if timed functions are available
break;
}
pnd->driver = &pn53x_usb_driver;
@ -731,7 +733,12 @@ pn53x_usb_set_property_bool (nfc_device *pnd, const nfc_property property, const
return res;
}
break;
default:
case NXP_PN531:
case NXP_PN533:
case SONY_PN531:
case SONY_RCS360:
case UNKNOWN:
// Nothing to do.
break;
}
return NFC_SUCCESS;

View file

@ -59,10 +59,10 @@ nfc_device_new (const nfc_connstring connstring)
}
void
nfc_device_free (nfc_device *nfc_device)
nfc_device_free (nfc_device *dev)
{
if (nfc_device) {
free (nfc_device->driver_data);
free (nfc_device);
if (dev) {
free (dev->driver_data);
free (dev);
}
}

View file

@ -59,7 +59,9 @@ prepare_initiator_data (const nfc_modulation nm, uint8_t **ppbtInitiatorData, si
*pszInitiatorData = 5;
}
break;
default:
case NMT_ISO14443A:
case NMT_JEWEL:
case NMT_DEP:
*ppbtInitiatorData = NULL;
*pszInitiatorData = 0;
break;

View file

@ -404,7 +404,13 @@ nfc_initiator_select_passive_target (nfc_device *pnd,
iso14443_cascade_uid (pbtInitData, szInitData, abtInit, &szInit);
break;
default:
case NMT_JEWEL:
case NMT_ISO14443B:
case NMT_ISO14443BI:
case NMT_ISO14443B2SR:
case NMT_ISO14443B2CT:
case NMT_FELICA:
case NMT_DEP:
memcpy (abtInit, pbtInitData, szInitData);
szInit = szInitData;
break;