mirror of https://github.com/ARMmbed/mbed-os.git
Fix infinite calling loop
parent
d16ea8c958
commit
a5148ec31e
|
@ -357,7 +357,20 @@ public:
|
||||||
* Where the first element is the length of the field.
|
* Where the first element is the length of the field.
|
||||||
*/
|
*/
|
||||||
const uint8_t* findField(DataType_t type) const {
|
const uint8_t* findField(DataType_t type) const {
|
||||||
return findField(type);
|
/* Scan through advertisement data */
|
||||||
|
for (uint8_t idx = 0; idx < _payloadLen; ) {
|
||||||
|
uint8_t fieldType = _payload[idx + 1];
|
||||||
|
|
||||||
|
if (fieldType == type) {
|
||||||
|
return &_payload[idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Advance to next field */
|
||||||
|
idx += _payload[idx] + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Field not found */
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -408,20 +421,7 @@ private:
|
||||||
* otherwise. Where the first element is the length of the field.
|
* otherwise. Where the first element is the length of the field.
|
||||||
*/
|
*/
|
||||||
uint8_t* findField(DataType_t type) {
|
uint8_t* findField(DataType_t type) {
|
||||||
/* Scan through advertisement data */
|
return const_cast<uint8_t*>(static_cast<const GapAdvertisingData*>(this)->findField(type));
|
||||||
for (uint8_t idx = 0; idx < _payloadLen; ) {
|
|
||||||
uint8_t fieldType = _payload[idx + 1];
|
|
||||||
|
|
||||||
if (fieldType == type) {
|
|
||||||
return &_payload[idx];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Advance to next field */
|
|
||||||
idx += _payload[idx] + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Field not found */
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue