Skip to content

Commit a38e837

Browse files
committed
chore(clang): format
1 parent 7c81ab3 commit a38e837

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

Adafruit_MQTT.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -564,21 +564,23 @@ Adafruit_MQTT_Subscribe *Adafruit_MQTT::handleSubscriptionPacket(uint16_t len) {
564564

565565
// Parse MQTT Remaining Length field (variable length encoding).
566566
// This field can be 1-4 bytes, so we must parse it byte-by-byte.
567-
// Each byte uses the lower 7 bits for data, and the MSB as a continuation flag.
568-
// This loop advances 'offset' to the first byte after the remaining length field.
567+
// Each byte uses the lower 7 bits for data, and the MSB as a continuation
568+
// flag. This loop advances 'offset' to the first byte after the remaining
569+
// length field.
569570
uint32_t multiplier = 1;
570571
uint32_t value = 0;
571572
uint8_t encodedByte;
572573
uint8_t offset = 1; // Start after the fixed header byte
573574
do {
574-
encodedByte = buffer[offset++];
575-
value += (encodedByte & 127) * multiplier;
576-
multiplier *= 128;
577-
// Infinite loop protection: MQTT spec allows max 4 bytes for this field
578-
if (offset > 5) { // 1 (header) + 4 (max length bytes)
579-
DEBUG_PRINTLN(F("Bad MQTT packet: Remaining Length field too long / malformed"));
580-
return NULL;
581-
}
575+
encodedByte = buffer[offset++];
576+
value += (encodedByte & 127) * multiplier;
577+
multiplier *= 128;
578+
// Infinite loop protection: MQTT spec allows max 4 bytes for this field
579+
if (offset > 5) { // 1 (header) + 4 (max length bytes)
580+
DEBUG_PRINTLN(
581+
F("Bad MQTT packet: Remaining Length field too long / malformed"));
582+
return NULL;
583+
}
582584
} while ((encodedByte & 128) != 0);
583585

584586
// Now 'offset' points to the first byte of the topic length field.

0 commit comments

Comments
 (0)