[api] Add explicit static_cast<uint32_t> in decode_zigzag32 calls

On BLE builds where proto_varint_value_t is uint64_t, decode_zigzag32()
takes uint32_t — make the narrowing explicit to match the static_cast
pattern used for other type conversions in generated code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
J. Nick Koston
2026-03-08 21:05:07 -10:00
co-authored by Claude Opus 4.6
parent 5dbf35051a
commit e7ce2703e8
2 changed files with 6 additions and 6 deletions
+5 -5
View File
@@ -1039,7 +1039,7 @@ bool HomeAssistantStateResponse::decode_length(uint32_t field_id, ProtoLengthDel
bool DSTRule::decode_varint(uint32_t field_id, proto_varint_value_t value) {
switch (field_id) {
case 1:
this->time_seconds = decode_zigzag32(value);
this->time_seconds = decode_zigzag32(static_cast<uint32_t>(value));
break;
case 2:
this->day = value;
@@ -1064,10 +1064,10 @@ bool DSTRule::decode_varint(uint32_t field_id, proto_varint_value_t value) {
bool ParsedTimezone::decode_varint(uint32_t field_id, proto_varint_value_t value) {
switch (field_id) {
case 1:
this->std_offset_seconds = decode_zigzag32(value);
this->std_offset_seconds = decode_zigzag32(static_cast<uint32_t>(value));
break;
case 2:
this->dst_offset_seconds = decode_zigzag32(value);
this->dst_offset_seconds = decode_zigzag32(static_cast<uint32_t>(value));
break;
default:
return false;
@@ -1151,13 +1151,13 @@ bool ExecuteServiceArgument::decode_varint(uint32_t field_id, proto_varint_value
this->legacy_int = static_cast<int32_t>(value);
break;
case 5:
this->int_ = decode_zigzag32(value);
this->int_ = decode_zigzag32(static_cast<uint32_t>(value));
break;
case 6:
this->bool_array.push_back(value != 0);
break;
case 7:
this->int_array.push_back(decode_zigzag32(value));
this->int_array.push_back(decode_zigzag32(static_cast<uint32_t>(value)));
break;
default:
return false;
+1 -1
View File
@@ -1262,7 +1262,7 @@ class SFixed64Type(TypeInfo):
class SInt32Type(TypeInfo):
cpp_type = "int32_t"
default_value = "0"
decode_varint = "decode_zigzag32(value)"
decode_varint = "decode_zigzag32(static_cast<uint32_t>(value))"
encode_func = "encode_sint32"
wire_type = WireType.VARINT # Uses wire type 0