Skip to content

Commit

Permalink
change(bt/bluedroid): Remove a duplicate macro in OBEX
Browse files Browse the repository at this point in the history
  • Loading branch information
esp-lrh committed Dec 3, 2024
1 parent c28703c commit 88913c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
4 changes: 0 additions & 4 deletions components/bt/host/bluedroid/stack/obex/include/obex_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,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 */
Expand Down
16 changes: 8 additions & 8 deletions components/bt/host/bluedroid/stack/obex/obex_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,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);
}

/*******************************************************************************
Expand Down Expand Up @@ -349,7 +349,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:
Expand All @@ -363,7 +363,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;
Expand Down Expand Up @@ -411,14 +411,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;
Expand Down Expand Up @@ -471,7 +471,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;
}

Expand Down Expand Up @@ -530,15 +530,15 @@ 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 */
memcpy(p_start, data, data_len);
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;
}

Expand Down

0 comments on commit 88913c8

Please sign in to comment.