mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-02 07:20:16 +00:00
clarify use of maxBytes in sdp_append_attributes_in_attributeIDList
This commit is contained in:
parent
73e81a1188
commit
770b783106
@ -277,7 +277,7 @@ static int sdp_traversal_append_attributes(uint8_t * element, de_type_t type, de
|
|||||||
if (attributeIDSize == DE_SIZE_16) {
|
if (attributeIDSize == DE_SIZE_16) {
|
||||||
uint16_t attributeID = READ_NET_16(element, attributeIDPos+1);
|
uint16_t attributeID = READ_NET_16(element, attributeIDPos+1);
|
||||||
if ( sdp_attribute_list_constains_id(context->attributeIDList, attributeID)){
|
if ( sdp_attribute_list_constains_id(context->attributeIDList, attributeID)){
|
||||||
if (context->dataSize + attributeLen <= context->maxBytes) {
|
if (3 + context->dataSize + attributeLen <= context->maxBytes) {
|
||||||
// copy Attribute
|
// copy Attribute
|
||||||
memcpy( context->buffer + 3 + context->dataSize, element, attributeLen);
|
memcpy( context->buffer + 3 + context->dataSize, element, attributeLen);
|
||||||
context->dataSize += attributeLen;
|
context->dataSize += attributeLen;
|
||||||
@ -293,10 +293,11 @@ static int sdp_traversal_append_attributes(uint8_t * element, de_type_t type, de
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// returns index of the next attribute index to process, if not all could be passed on, -1 = all processed
|
// returns index of the next attribute index to process, if not all could be passed on, -1 = all processed
|
||||||
|
// maxBytes: maximal size of data element sequence
|
||||||
int sdp_append_attributes_in_attributeIDList(uint8_t *record, uint8_t *attributeIDList, uint16_t startIndex, uint16_t maxBytes, uint8_t *buffer){
|
int sdp_append_attributes_in_attributeIDList(uint8_t *record, uint8_t *attributeIDList, uint16_t startIndex, uint16_t maxBytes, uint8_t *buffer){
|
||||||
struct sdp_context_append_attributes context;
|
struct sdp_context_append_attributes context;
|
||||||
context.buffer = buffer;
|
context.buffer = buffer;
|
||||||
context.dataSize = 0;
|
context.dataSize = READ_NET_16(buffer, 1);
|
||||||
context.maxBytes = maxBytes;
|
context.maxBytes = maxBytes;
|
||||||
context.attributeIndex = 0;
|
context.attributeIndex = 0;
|
||||||
context.startIndex = startIndex;
|
context.startIndex = startIndex;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user