Silent down gcc44 -Wextra warnings.
This commit is contained in:
parent
a9c026e8f2
commit
5027d69b7e
5 changed files with 12 additions and 10 deletions
|
@ -90,7 +90,7 @@ int
|
||||||
try_format_sector (MifareTag tag, MifareClassicBlockNumber block)
|
try_format_sector (MifareTag tag, MifareClassicBlockNumber block)
|
||||||
{
|
{
|
||||||
display_progress ();
|
display_progress ();
|
||||||
for (int i = 0; i < (sizeof (default_keys) / sizeof (MifareClassicKey)); i++) {
|
for (size_t i = 0; i < (sizeof (default_keys) / sizeof (MifareClassicKey)); i++) {
|
||||||
if ((0 == mifare_classic_connect (tag)) && (0 == mifare_classic_authenticate (tag, block, default_keys[i], MFC_KEY_A))) {
|
if ((0 == mifare_classic_connect (tag)) && (0 == mifare_classic_authenticate (tag, block, default_keys[i], MFC_KEY_A))) {
|
||||||
if (0 == mifare_classic_format_sector (tag, block)) {
|
if (0 == mifare_classic_format_sector (tag, block)) {
|
||||||
mifare_classic_disconnect (tag);
|
mifare_classic_disconnect (tag);
|
||||||
|
@ -123,6 +123,8 @@ main(int argc, char *argv[])
|
||||||
nfc_device_t *device = NULL;
|
nfc_device_t *device = NULL;
|
||||||
MifareTag *tags = NULL;
|
MifareTag *tags = NULL;
|
||||||
|
|
||||||
|
(void)argc, (void)argv;
|
||||||
|
|
||||||
device = nfc_connect (NULL);
|
device = nfc_connect (NULL);
|
||||||
if (!device)
|
if (!device)
|
||||||
errx (EXIT_FAILURE, "No NFC device found.");
|
errx (EXIT_FAILURE, "No NFC device found.");
|
||||||
|
|
|
@ -58,7 +58,7 @@ int
|
||||||
search_sector_key (MifareTag tag, MifareClassicBlockNumber block, MifareClassicKey *key, MifareClassicKeyType *key_type)
|
search_sector_key (MifareTag tag, MifareClassicBlockNumber block, MifareClassicKey *key, MifareClassicKeyType *key_type)
|
||||||
{
|
{
|
||||||
mifare_classic_disconnect (tag);
|
mifare_classic_disconnect (tag);
|
||||||
for (int i = 0; i < (sizeof (default_keys) / sizeof (MifareClassicKey)); i++) {
|
for (size_t i = 0; i < (sizeof (default_keys) / sizeof (MifareClassicKey)); i++) {
|
||||||
if ((0 == mifare_classic_connect (tag)) && (0 == mifare_classic_authenticate (tag, block, default_keys[i], MFC_KEY_A))) {
|
if ((0 == mifare_classic_connect (tag)) && (0 == mifare_classic_authenticate (tag, block, default_keys[i], MFC_KEY_A))) {
|
||||||
if ((1 == mifare_classic_get_trailer_block_permission (tag, block + 3, MCAB_WRITE_KEYA, MFC_KEY_A)) &&
|
if ((1 == mifare_classic_get_trailer_block_permission (tag, block + 3, MCAB_WRITE_KEYA, MFC_KEY_A)) &&
|
||||||
(1 == mifare_classic_get_trailer_block_permission (tag, block + 3, MCAB_WRITE_ACCESS_BITS, MFC_KEY_A)) &&
|
(1 == mifare_classic_get_trailer_block_permission (tag, block + 3, MCAB_WRITE_ACCESS_BITS, MFC_KEY_A)) &&
|
||||||
|
@ -215,7 +215,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
|
|
||||||
size_t encoded_size;
|
size_t encoded_size;
|
||||||
off_t pos = 0;
|
size_t pos = 0;
|
||||||
uint8_t *tlv_data = tlv_encode (3, ndef_msg, sizeof (ndef_msg), &encoded_size);
|
uint8_t *tlv_data = tlv_encode (3, ndef_msg, sizeof (ndef_msg), &encoded_size);
|
||||||
|
|
||||||
MifareClassicBlockNumber bn = 0x04;
|
MifareClassicBlockNumber bn = 0x04;
|
||||||
|
|
|
@ -77,7 +77,7 @@ freefare_get_tags (nfc_device_t *device)
|
||||||
bool found = false;
|
bool found = false;
|
||||||
struct supported_tag *tag_info;
|
struct supported_tag *tag_info;
|
||||||
|
|
||||||
for (int i = 0; i < sizeof (supported_tags) / sizeof (struct supported_tag); i++) {
|
for (size_t i = 0; i < sizeof (supported_tags) / sizeof (struct supported_tag); i++) {
|
||||||
if ((target_info.nai.abtAtqa[0] == supported_tags[i].ATQA[0]) &&
|
if ((target_info.nai.abtAtqa[0] == supported_tags[i].ATQA[0]) &&
|
||||||
(target_info.nai.abtAtqa[1] == supported_tags[i].ATQA[1]) &&
|
(target_info.nai.abtAtqa[1] == supported_tags[i].ATQA[1]) &&
|
||||||
(target_info.nai.btSak == supported_tags[i].SAK)) {
|
(target_info.nai.btSak == supported_tags[i].SAK)) {
|
||||||
|
@ -155,7 +155,7 @@ char *
|
||||||
freefare_get_tag_uid (MifareTag tag)
|
freefare_get_tag_uid (MifareTag tag)
|
||||||
{
|
{
|
||||||
char *res = malloc (2 * tag->info.szUidLen + 1);
|
char *res = malloc (2 * tag->info.szUidLen + 1);
|
||||||
for (int i =0; i < tag->info.szUidLen; i++)
|
for (size_t i =0; i < tag->info.szUidLen; i++)
|
||||||
snprintf (res + 2*i, 3, "%02x", tag->info.abtUid[i]);
|
snprintf (res + 2*i, 3, "%02x", tag->info.abtUid[i]);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ mifare_application_alloc (Mad mad, MadAid aid, size_t size)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
for (int c = 0; c < size; c++) {
|
for (size_t c = 0; c < size; c++) {
|
||||||
if (free_aids[c]) {
|
if (free_aids[c]) {
|
||||||
res[c] = free_aids[c];
|
res[c] = free_aids[c];
|
||||||
} else {
|
} else {
|
||||||
|
@ -111,7 +111,7 @@ mifare_application_alloc (Mad mad, MadAid aid, size_t size)
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
/* Update the MAD */
|
/* Update the MAD */
|
||||||
for (int c = 0; c < size; c++)
|
for (size_t c = 0; c < size; c++)
|
||||||
mad_set_aid (mad, res[c], aid);
|
mad_set_aid (mad, res[c], aid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -306,12 +306,12 @@ mifare_classic_read_value (MifareTag tag, const MifareClassicBlockNumber block,
|
||||||
union mifare_classic_block b = *((union mifare_classic_block *)(&data));
|
union mifare_classic_block b = *((union mifare_classic_block *)(&data));
|
||||||
|
|
||||||
|
|
||||||
if ((b.value.value != (~b.value.value_)) || (b.value.value != b.value.value__)) {
|
if ((b.value.value ^ (uint32_t)~b.value.value_) || (b.value.value != b.value.value__)) {
|
||||||
errno = EIO;
|
errno = EIO;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((b.value.address != (unsigned char)(~b.value.address_)) || (b.value.address != b.value.address__) || (b.value.address_ != b.value.address___)) {
|
if ((b.value.address ^ (uint8_t)~b.value.address_) || (b.value.address != b.value.address__) || (b.value.address_ != b.value.address___)) {
|
||||||
errno = EIO;
|
errno = EIO;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -540,7 +540,7 @@ get_block_access_bits (MifareTag tag, const MifareClassicBlockNumber block, Mifa
|
||||||
sector_access_bits_ = trailer_data[6] | ((trailer_data[7] & 0x0f) << 8) | 0xf000;
|
sector_access_bits_ = trailer_data[6] | ((trailer_data[7] & 0x0f) << 8) | 0xf000;
|
||||||
sector_access_bits = ((trailer_data[7] & 0xf0) >> 4) | (trailer_data[8] << 4);
|
sector_access_bits = ((trailer_data[7] & 0xf0) >> 4) | (trailer_data[8] << 4);
|
||||||
|
|
||||||
if (sector_access_bits != (uint16_t) ~sector_access_bits_) {
|
if (sector_access_bits ^ (uint16_t)~sector_access_bits_) {
|
||||||
/* Sector locked */
|
/* Sector locked */
|
||||||
errno = EIO;
|
errno = EIO;
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue