Skip to content

Commit

Permalink
Regenerate generated files
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple committed Jun 25, 2021
1 parent b076ffe commit 478352e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo
{
case 0x0000: // accepts header list
{
entryOffset = GetByteSpanOffsetFromIndex(write ? dest : src, am->size, index - 1);
entryOffset = GetByteSpanOffsetFromIndex(write ? dest : src, am->size, static_cast<uint16_t>(index - 1));
if (entryOffset == 0)
{
ChipLogError(Zcl, "Index %" PRId32 " is invalid.", index);
Expand All @@ -155,7 +155,12 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo
return 0;
}

entryLength = acceptsHeaderListSpan->size();
if (!CanCastTo<uint16_t>(acceptsHeaderListSpan->size()))
{
ChipLogError(Zcl, "Span size %zu is too large", acceptsHeaderListSpan->size());
return 0;
}
entryLength = static_cast<uint16_t>(acceptsHeaderListSpan->size());
break;
}
case 0x0001: // supported streaming types
Expand Down Expand Up @@ -548,7 +553,7 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo
}
case 0x001B: // list_octet_string
{
entryOffset = GetByteSpanOffsetFromIndex(write ? dest : src, am->size, index - 1);
entryOffset = GetByteSpanOffsetFromIndex(write ? dest : src, am->size, static_cast<uint16_t>(index - 1));
if (entryOffset == 0)
{
ChipLogError(Zcl, "Index %" PRId32 " is invalid.", index);
Expand All @@ -565,7 +570,12 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo
return 0;
}

entryLength = listOctetStringSpan->size();
if (!CanCastTo<uint16_t>(listOctetStringSpan->size()))
{
ChipLogError(Zcl, "Span size %zu is too large", listOctetStringSpan->size());
return 0;
}
entryLength = static_cast<uint16_t>(listOctetStringSpan->size());
break;
}
case 0x001C: // list_struct_octet_string
Expand Down
9 changes: 7 additions & 2 deletions examples/tv-app/tv-common/gen/attribute-size.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo
{
case 0x0000: // accepts header list
{
entryOffset = GetByteSpanOffsetFromIndex(write ? dest : src, am->size, index - 1);
entryOffset = GetByteSpanOffsetFromIndex(write ? dest : src, am->size, static_cast<uint16_t>(index - 1));
if (entryOffset == 0)
{
ChipLogError(Zcl, "Index %" PRId32 " is invalid.", index);
Expand All @@ -155,7 +155,12 @@ uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, boo
return 0;
}

entryLength = acceptsHeaderListSpan->size();
if (!CanCastTo<uint16_t>(acceptsHeaderListSpan->size()))
{
ChipLogError(Zcl, "Span size %zu is too large", acceptsHeaderListSpan->size());
return 0;
}
entryLength = static_cast<uint16_t>(acceptsHeaderListSpan->size());
break;
}
case 0x0001: // supported streaming types
Expand Down
34 changes: 17 additions & 17 deletions src/controller/data_model/gen/CHIPClientCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
data[i].outputType = emberAfGetInt8u(message, 0, 1);
message += 1;
CHECK_STATUS(ReadByteSpan(message, 34, &data[i].name));
messageLen -= 34;
messageLen = static_cast<uint16_t>(messageLen - 34);
message += 34;
}

Expand All @@ -476,7 +476,7 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
{
CHECK_STATUS(ReadByteSpan(message, messageLen, &data[i]));
uint16_t entryLength = static_cast<uint16_t>(data[i].size() + kByteSpanSizeLengthInBytes);
messageLen -= entryLength;
messageLen = static_cast<uint16_t>(messageLen - entryLength);
message += entryLength;
}

Expand Down Expand Up @@ -581,10 +581,10 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
for (size_t i = 0; i < count; i++)
{
CHECK_STATUS(ReadByteSpan(message, 18, &data[i].label));
messageLen -= 18;
messageLen = static_cast<uint16_t>(messageLen - 18);
message += 18;
CHECK_STATUS(ReadByteSpan(message, 18, &data[i].value));
messageLen -= 18;
messageLen = static_cast<uint16_t>(messageLen - 18);
message += 18;
}

Expand All @@ -604,7 +604,7 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
for (size_t i = 0; i < count; i++)
{
CHECK_STATUS(ReadByteSpan(message, 34, &data[i].Name));
messageLen -= 34;
messageLen = static_cast<uint16_t>(messageLen - 34);
message += 34;
CHECK_MESSAGE_LENGTH(1);
data[i].FabricConnected = emberAfGetInt8u(message, 0, 1);
Expand Down Expand Up @@ -667,7 +667,7 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
data[i].GroupKeyIndex = emberAfGetInt16u(message, 0, 2);
message += 2;
CHECK_STATUS(ReadByteSpan(message, 18, &data[i].GroupKeyRoot));
messageLen -= 18;
messageLen = static_cast<uint16_t>(messageLen - 18);
message += 18;
CHECK_MESSAGE_LENGTH(8);
data[i].GroupKeyEpochStartTime = emberAfGetInt64u(message, 0, 8);
Expand Down Expand Up @@ -699,10 +699,10 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
data[i].inputType = emberAfGetInt8u(message, 0, 1);
message += 1;
CHECK_STATUS(ReadByteSpan(message, 34, &data[i].name));
messageLen -= 34;
messageLen = static_cast<uint16_t>(messageLen - 34);
message += 34;
CHECK_STATUS(ReadByteSpan(message, 34, &data[i].description));
messageLen -= 34;
messageLen = static_cast<uint16_t>(messageLen - 34);
message += 34;
}

Expand Down Expand Up @@ -731,7 +731,7 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
data[i].NodeId = emberAfGetInt64u(message, 0, 8);
message += 8;
CHECK_STATUS(ReadByteSpan(message, 34, &data[i].Label));
messageLen -= 34;
messageLen = static_cast<uint16_t>(messageLen - 34);
message += 34;
}

Expand All @@ -758,13 +758,13 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
data[i].minorNumber = emberAfGetInt16u(message, 0, 2);
message += 2;
CHECK_STATUS(ReadByteSpan(message, 34, &data[i].name));
messageLen -= 34;
messageLen = static_cast<uint16_t>(messageLen - 34);
message += 34;
CHECK_STATUS(ReadByteSpan(message, 34, &data[i].callSign));
messageLen -= 34;
messageLen = static_cast<uint16_t>(messageLen - 34);
message += 34;
CHECK_STATUS(ReadByteSpan(message, 34, &data[i].affiliateCallSign));
messageLen -= 34;
messageLen = static_cast<uint16_t>(messageLen - 34);
message += 34;
}

Expand All @@ -787,7 +787,7 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
data[i].identifier = emberAfGetInt8u(message, 0, 1);
message += 1;
CHECK_STATUS(ReadByteSpan(message, 34, &data[i].name));
messageLen -= 34;
messageLen = static_cast<uint16_t>(messageLen - 34);
message += 34;
}

Expand Down Expand Up @@ -824,7 +824,7 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
{
CHECK_STATUS(ReadByteSpan(message, messageLen, &data[i]));
uint16_t entryLength = static_cast<uint16_t>(data[i].size() + kByteSpanSizeLengthInBytes);
messageLen -= entryLength;
messageLen = static_cast<uint16_t>(messageLen - entryLength);
message += entryLength;
}

Expand All @@ -842,7 +842,7 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
data[i].fabricIndex = emberAfGetInt64u(message, 0, 8);
message += 8;
CHECK_STATUS(ReadByteSpan(message, 34, &data[i].operationalCert));
messageLen -= 34;
messageLen = static_cast<uint16_t>(messageLen - 34);
message += 34;
}

Expand Down Expand Up @@ -881,10 +881,10 @@ bool emberAfReadAttributesResponseCallback(ClusterId clusterId, uint8_t * messag
data[i].LQI = emberAfGetInt8u(message, 0, 1);
message += 1;
CHECK_MESSAGE_LENGTH(1);
data[i].AverageRssi = emberAfGetInt8u(message, 0, 1);
data[i].AverageRssi = emberAfGetInt8s(message, 0, 1);
message += 1;
CHECK_MESSAGE_LENGTH(1);
data[i].LastRssi = emberAfGetInt8u(message, 0, 1);
data[i].LastRssi = emberAfGetInt8s(message, 0, 1);
message += 1;
CHECK_MESSAGE_LENGTH(1);
data[i].FrameErrorRate = emberAfGetInt8u(message, 0, 1);
Expand Down

0 comments on commit 478352e

Please sign in to comment.