Skip to content

Commit 8491346

Browse files
authored
fix: reduce code complexity (#130)
1 parent f28d99e commit 8491346

2 files changed

Lines changed: 1 addition & 3 deletions

File tree

src/bluetooth_data_tools/gap.pxd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,5 @@ cpdef parse_advertisement_data(object data)
4949
offset=cython.uint,
5050
start=cython.uint,
5151
end=cython.uint,
52-
tx_power_int="unsigned char"
5352
)
5453
cpdef _uncached_parse_advertisement_data(tuple data)

src/bluetooth_data_tools/gap.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,14 @@ def _uncached_parse_advertisement_data(
180180
continue
181181
start = offset + 2
182182
end = start + length - 1
183+
offset += 1 + length
183184
if end > total_length or end - start <= 0:
184185
_LOGGER.debug(
185186
"Invalid BLE GAP AD structure at offset %s: %s (%s)",
186187
offset,
187188
gap_bytes,
188189
)
189-
offset += 1 + length
190190
continue
191-
offset += 1 + length
192191
if gap_type_num == TYPE_SHORT_LOCAL_NAME and local_name is None:
193192
local_name = gap_data[start:end].decode("utf-8", "replace")
194193
elif gap_type_num == TYPE_COMPLETE_LOCAL_NAME:

0 commit comments

Comments
 (0)