fix bad cast done in last revision.

This commit is contained in:
Audrey Diacre 2012-01-05 17:03:38 +00:00
parent 642f9a38f7
commit 601105ef79
6 changed files with 26 additions and 16 deletions

View file

@ -62,6 +62,7 @@ int
main (int argc, const char *argv[])
{
uint8_t abtRx[MAX_FRAME_LEN];
int res = 0;
size_t szRx = sizeof(abtRx);
size_t szDeviceFound;
uint8_t abtTx[] = "Hello Mars!";
@ -125,10 +126,11 @@ main (int argc, const char *argv[])
}
printf("Initiator request received. Waiting for data...\n");
if (((int) (szRx = (size_t) nfc_target_receive_bytes (pnd, abtRx, 0))) < 0) {
if ((res = nfc_target_receive_bytes (pnd, abtRx, 0)) < 0) {
nfc_perror(pnd, "nfc_target_receive_bytes");
goto error;
}
szRx = (size_t) res;
abtRx[szRx] = '\0';
printf ("Received: %s\n", abtRx);

View file

@ -137,6 +137,7 @@ bool
nfc_target_emulate_tag(nfc_device *pnd, nfc_target *pnt)
{
size_t szTx;
int res = 0;
uint8_t abtTx[MAX_FRAME_LEN];
bool loop = true;
@ -158,10 +159,11 @@ nfc_target_emulate_tag(nfc_device *pnd, nfc_target *pnt)
nfc_device_set_property_bool (pnd, NP_HANDLE_CRC, false);
init_mfc_auth = false;
}
if ((int) ((szRx = (size_t) nfc_target_receive_bytes(pnd, abtRx, 0))) < 0) {
if ((res = nfc_target_receive_bytes(pnd, abtRx, 0)) < 0) {
nfc_perror (pnd, "nfc_target_receive_bytes");
return false;
}
szRx = (size_t) res;
}
}
return true;