diff --git a/components/bt/host/bluedroid/stack/obex/include/obex_int.h b/components/bt/host/bluedroid/stack/obex/include/obex_int.h index 4512e89c2a..baab7a986d 100644 --- a/components/bt/host/bluedroid/stack/obex/include/obex_int.h +++ b/components/bt/host/bluedroid/stack/obex/include/obex_int.h @@ -24,10 +24,6 @@ #define OBEX_STATE_OPENING 1 /* Starting to open a connection */ #define OBEX_STATE_OPENED 2 /* Connection opened */ -/* Store 16 bits data in big endian format, not modify the p_buf */ -#define STORE16BE(p_buf, data) do { *p_buf = ((data)>>8)&0xff; \ - *(p_buf+1) = (data)&0xff;} while(0) - /* OBEX Connection Control block */ typedef struct { tOBEX_MSG_CBACK *callback; /* Connection msg callback function */ diff --git a/components/bt/host/bluedroid/stack/obex/obex_api.c b/components/bt/host/bluedroid/stack/obex/obex_api.c index befabb0e92..ab224ce78c 100644 --- a/components/bt/host/bluedroid/stack/obex/obex_api.c +++ b/components/bt/host/bluedroid/stack/obex/obex_api.c @@ -34,7 +34,7 @@ static inline void obex_server_to_tl_server(tOBEX_SVR_INFO *server, tOBEX_TL_SVR static inline void obex_updata_packet_length(BT_HDR *p_buf, UINT16 len) { UINT8 *p_pkt_len = (UINT8 *)(p_buf + 1) + p_buf->offset + 1; - STORE16BE(p_pkt_len, len); + UINT16_TO_BE_FIELD(p_pkt_len, len); } /******************************************************************************* @@ -343,7 +343,7 @@ UINT16 OBEX_BuildRequest(tOBEX_PARSE_INFO *info, UINT16 buff_size, BT_HDR **out_ /* byte 4: flags */ *p_data++ = info->flags; /* byte 5, 6: maximum OBEX packet length, recommend to set as our mtu*/ - STORE16BE(p_data, info->max_packet_length); + UINT16_TO_BE_FIELD(p_data, info->max_packet_length); pkt_len += 4; break; case OBEX_OPCODE_SETPATH: @@ -357,7 +357,7 @@ UINT16 OBEX_BuildRequest(tOBEX_PARSE_INFO *info, UINT16 buff_size, BT_HDR **out_ break; } - STORE16BE(p_pkt_len, pkt_len); + UINT16_TO_BE_FIELD(p_pkt_len, pkt_len); p_buf->len = pkt_len; *out_pkt = p_buf; return OBEX_SUCCESS; @@ -405,14 +405,14 @@ UINT16 OBEX_BuildResponse(tOBEX_PARSE_INFO *info, UINT16 buff_size, BT_HDR **out /* byte 4: flags */ *p_data++ = info->flags; /* byte 5, 6: maximum OBEX packet length, recommend to set as our mtu */ - STORE16BE(p_data, info->max_packet_length); + UINT16_TO_BE_FIELD(p_data, info->max_packet_length); pkt_len += 4; break; default: break; } - STORE16BE(p_pkt_len, pkt_len); + UINT16_TO_BE_FIELD(p_pkt_len, pkt_len); p_buf->len = pkt_len; *out_pkt = p_buf; return OBEX_SUCCESS; @@ -465,7 +465,7 @@ UINT16 OBEX_AppendHeader(BT_HDR *pkt, const UINT8 *header) pkt->len += header_len; /* point to packet len */ p_data++; - STORE16BE(p_data, pkt->len); + UINT16_TO_BE_FIELD(p_data, pkt->len); return OBEX_SUCCESS; } @@ -524,7 +524,7 @@ UINT16 OBEX_AppendHeaderRaw(BT_HDR *pkt, UINT8 header_id, const UINT8 *data, UIN *p_start++ = header_id; if (store_header_len) { /* store header length */ - STORE16BE(p_start, header_len); + UINT16_TO_BE_FIELD(p_start, header_len); p_start+= 2; } /* store data */ @@ -532,7 +532,7 @@ UINT16 OBEX_AppendHeaderRaw(BT_HDR *pkt, UINT8 header_id, const UINT8 *data, UIN pkt->len += header_len; /* point to packet len */ p_data++; - STORE16BE(p_data, pkt->len); + UINT16_TO_BE_FIELD(p_data, pkt->len); return OBEX_SUCCESS; }