Fix TLV functions
To update the pointers as well as the data, use a call by reference
pointer to pointer.
Test: Test HCE
Change-Id: Ia91b7e494c6325f741fd373e380222a868ee190b
diff --git a/src/nfa/ee/nfa_ee_act.c b/src/nfa/ee/nfa_ee_act.c
index 670f543..3ae939d 100644
--- a/src/nfa/ee/nfa_ee_act.c
+++ b/src/nfa/ee/nfa_ee_act.c
@@ -53,27 +53,27 @@
* the command for NFCC */
#define NFA_EE_NUM_PROTO 5
-static void add_route_tech_proto_tlv(uint8_t* pp, uint8_t tlv_type,
+static void add_route_tech_proto_tlv(uint8_t** pp, uint8_t tlv_type,
uint8_t nfcee_id, uint8_t pwr_cfg,
uint8_t tech_proto) {
- *pp++ = tlv_type;
- *pp++ = 3;
- *pp++ = nfcee_id;
- *pp++ = pwr_cfg;
- *pp++ = tech_proto;
+ *(*pp)++ = tlv_type;
+ *(*pp)++ = 3;
+ *(*pp)++ = nfcee_id;
+ *(*pp)++ = pwr_cfg;
+ *(*pp)++ = tech_proto;
}
-static void add_route_aid_tlv(uint8_t* pp, uint8_t* pa, uint8_t nfcee_id,
+static void add_route_aid_tlv(uint8_t** pp, uint8_t* pa, uint8_t nfcee_id,
uint8_t pwr_cfg, uint8_t tag) {
pa++; /* EMV tag */
uint8_t len = *pa++; /* aid_len */
- *pp++ = tag;
- *pp++ = len + 2;
- *pp++ = nfcee_id;
- *pp++ = pwr_cfg;
+ *(*pp)++ = tag;
+ *(*pp)++ = len + 2;
+ *(*pp)++ = nfcee_id;
+ *(*pp)++ = pwr_cfg;
/* copy the AID */
- memcpy(pp, pa, len);
- pp += len;
+ memcpy(*pp, pa, len);
+ *pp += len;
}
const uint8_t nfa_ee_proto_mask_list[NFA_EE_NUM_PROTO] = {
@@ -241,7 +241,7 @@
if (p_cb->tech_battery_off & nfa_ee_tech_mask_list[xx])
power_cfg |= NCI_ROUTE_PWR_STATE_BATT_OFF;
if (power_cfg) {
- add_route_tech_proto_tlv(pp, NFC_ROUTE_TAG_TECH, p_cb->nfcee_id,
+ add_route_tech_proto_tlv(&pp, NFC_ROUTE_TAG_TECH, p_cb->nfcee_id,
power_cfg, nfa_ee_tech_list[xx]);
num_tlv++;
if (power_cfg != NCI_ROUTE_PWR_STATE_ON)
@@ -283,7 +283,7 @@
proto_tag = NFC_ROUTE_TAG_PROTO;
}
- add_route_tech_proto_tlv(pp, proto_tag, p_cb->nfcee_id, power_cfg,
+ add_route_tech_proto_tlv(&pp, proto_tag, p_cb->nfcee_id, power_cfg,
nfa_ee_proto_list[xx]);
num_tlv++;
if (power_cfg != NCI_ROUTE_PWR_STATE_ON)
@@ -293,7 +293,7 @@
/* add NFC-DEP routing to HOST */
if (p_cb->nfcee_id == NFC_DH_ID) {
- add_route_tech_proto_tlv(pp, NFC_ROUTE_TAG_PROTO, NFC_DH_ID,
+ add_route_tech_proto_tlv(&pp, NFC_ROUTE_TAG_PROTO, NFC_DH_ID,
NCI_ROUTE_PWR_STATE_ON, NFC_PROTOCOL_NFC_DEP);
num_tlv++;
@@ -339,7 +339,7 @@
uint8_t tag =
NFC_ROUTE_TAG_AID | nfa_ee_cb.route_block_control | route_qual;
- add_route_aid_tlv(pp, pa, p_cb->nfcee_id, p_cb->aid_pwr_cfg[xx], tag);
+ add_route_aid_tlv(&pp, pa, p_cb->nfcee_id, p_cb->aid_pwr_cfg[xx], tag);
}
start_offset += p_cb->aid_len[xx];
uint8_t new_size = (uint8_t)(pp - p_start);