rx buffer size parameter of pn53x_TgInitAsTarget() function is now a const size_t.
This commit is contained in:
parent
c10b473361
commit
5e796e0a26
2 changed files with 10 additions and 7 deletions
|
@ -1745,10 +1745,10 @@ pn53x_target_init (struct nfc_device *pnd, nfc_target *pnt, uint8_t *pbtRx, size
|
||||||
while (!targetActivated) {
|
while (!targetActivated) {
|
||||||
uint8_t btActivatedMode;
|
uint8_t btActivatedMode;
|
||||||
|
|
||||||
if((res = pn53x_TgInitAsTarget(pnd, ptm, pbtMifareParams, pbtTkt, szTkt, pbtFeliCaParams, pbtNFCID3t, pbtGBt, szGBt, pbtRx, pszRx, &btActivatedMode, timeout)) < 0) {
|
if((res = pn53x_TgInitAsTarget(pnd, ptm, pbtMifareParams, pbtTkt, szTkt, pbtFeliCaParams, pbtNFCID3t, pbtGBt, szGBt, pbtRx, *pszRx, &btActivatedMode, timeout)) < 0) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
*pszRx = (size_t) res;
|
||||||
nfc_modulation nm = {
|
nfc_modulation nm = {
|
||||||
.nmt = NMT_DEP, // Silent compilation warnings
|
.nmt = NMT_DEP, // Silent compilation warnings
|
||||||
.nbr = NBR_UNDEFINED
|
.nbr = NBR_UNDEFINED
|
||||||
|
@ -2434,7 +2434,7 @@ pn53x_TgInitAsTarget (struct nfc_device *pnd, pn53x_target_mode ptm,
|
||||||
const uint8_t *pbtTkt, size_t szTkt,
|
const uint8_t *pbtTkt, size_t szTkt,
|
||||||
const uint8_t *pbtFeliCaParams,
|
const uint8_t *pbtFeliCaParams,
|
||||||
const uint8_t *pbtNFCID3t, const uint8_t *pbtGBt, const size_t szGBt,
|
const uint8_t *pbtNFCID3t, const uint8_t *pbtGBt, const size_t szGBt,
|
||||||
uint8_t *pbtRx, size_t *pszRx, uint8_t *pbtModeByte, int timeout)
|
uint8_t *pbtRx, const size_t szRxLen, uint8_t *pbtModeByte, int timeout)
|
||||||
{
|
{
|
||||||
uint8_t abtCmd[39 + 47 + 48] = { TgInitAsTarget }; // Worst case: 39-byte base, 47 bytes max. for General Bytes, 48 bytes max. for Historical Bytes
|
uint8_t abtCmd[39 + 47 + 48] = { TgInitAsTarget }; // Worst case: 39-byte base, 47 bytes max. for General Bytes, 48 bytes max. for Historical Bytes
|
||||||
size_t szOptionalBytes = 0;
|
size_t szOptionalBytes = 0;
|
||||||
|
@ -2494,11 +2494,14 @@ pn53x_TgInitAsTarget (struct nfc_device *pnd, pn53x_target_mode ptm,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the received byte count
|
// Save the received byte count
|
||||||
*pszRx = szRx - 1;
|
szRx -= 1;
|
||||||
// Copy the received bytes
|
|
||||||
memcpy (pbtRx, abtRx + 1, *pszRx);
|
|
||||||
|
|
||||||
return NFC_SUCCESS;
|
if ((szRx - 1) > szRxLen)
|
||||||
|
return NFC_EOVFLOW;
|
||||||
|
// Copy the received bytes
|
||||||
|
memcpy (pbtRx, abtRx + 1, szRx);
|
||||||
|
|
||||||
|
return szRx;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -342,7 +342,7 @@ int pn53x_TgInitAsTarget (struct nfc_device *pnd, pn53x_target_mode ptm,
|
||||||
const uint8_t *pbtTkt, size_t szTkt,
|
const uint8_t *pbtTkt, size_t szTkt,
|
||||||
const uint8_t *pbtFeliCaParams,
|
const uint8_t *pbtFeliCaParams,
|
||||||
const uint8_t *pbtNFCID3t, const uint8_t *pbtGB, const size_t szGB,
|
const uint8_t *pbtNFCID3t, const uint8_t *pbtGB, const size_t szGB,
|
||||||
uint8_t *pbtRx, size_t *pszRx, uint8_t *pbtModeByte, int timeout);
|
uint8_t *pbtRx, const size_t szRxLen, uint8_t *pbtModeByte, int timeout);
|
||||||
|
|
||||||
// RFConfiguration
|
// RFConfiguration
|
||||||
int pn53x_RFConfiguration__RF_field (struct nfc_device *pnd, bool bEnable);
|
int pn53x_RFConfiguration__RF_field (struct nfc_device *pnd, bool bEnable);
|
||||||
|
|
Loading…
Add table
Reference in a new issue