Skip to content

Commit 31cd667

Browse files
committed
Use bool variables to make if condition more readable
1 parent 0fb709a commit 31cd667

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/cbor/CBOREncoder.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ CborError CBOREncoder::encode(PropertyContainer & property_container, uint8_t *
5959
property_container.end(),
6060
[lightPayload, &arrayEncoder, &error, &num_encoded_properties, &num_checked_properties](Property * p)
6161
{
62-
if((error == CborNoError) && ((num_encoded_properties < encoded_properties_message_limit) || (encoded_properties_message_limit == CBOR_ENCODER_NO_PROPERTIES_LIMIT)))
62+
bool maximum_number_of_properties_reached = (num_encoded_properties >= encoded_properties_message_limit) && (encoded_properties_message_limit != CBOR_ENCODER_NO_PROPERTIES_LIMIT);
63+
bool cbor_encoder_error = (error != CborNoError);
64+
if((!cbor_encoder_error) && (!maximum_number_of_properties_reached))
6365
{
6466
if (p->shouldBeUpdated() && p->isReadableByCloud())
6567
{

0 commit comments

Comments
 (0)