Skip to content

Commit 0fb709a

Browse files
committed
Use a constant value for CBOR_ENCODER_NO_PROPERTIES_LIMIT
1 parent a27b315 commit 0fb709a

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/cbor/CBOREncoder.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ CborError CBOREncoder::encode(PropertyContainer & property_container, uint8_t *
4747
CborError error = CborNoError;
4848
int num_encoded_properties = 0;
4949
int num_checked_properties = 0;
50-
static int encoded_properties_message_limit = -1;
50+
static int encoded_properties_message_limit = CBOR_ENCODER_NO_PROPERTIES_LIMIT;
5151

5252
if(current_property_index >= property_container.size())
5353
current_property_index = 0;
@@ -59,7 +59,7 @@ 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 == -1)))
62+
if((error == CborNoError) && ((num_encoded_properties < encoded_properties_message_limit) || (encoded_properties_message_limit == CBOR_ENCODER_NO_PROPERTIES_LIMIT)))
6363
{
6464
if (p->shouldBeUpdated() && p->isReadableByCloud())
6565
{
@@ -88,8 +88,8 @@ CborError CBOREncoder::encode(PropertyContainer & property_container, uint8_t *
8888
return error;
8989
}
9090

91-
/* Restore property message limit to NO_LIMIT */
92-
encoded_properties_message_limit = -1;
91+
/* Restore property message limit to CBOR_ENCODER_NO_PROPERTIES_LIMIT */
92+
encoded_properties_message_limit = CBOR_ENCODER_NO_PROPERTIES_LIMIT;
9393

9494
/* The append process has been successful, so we don't need to terty to send this properties set. Cleanup _has_been_appended_but_not_sended flag */
9595
iter = property_container.begin();

src/cbor/CBOREncoder.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434

3535
#include "../property/PropertyContainer.h"
3636

37+
/******************************************************************************
38+
* CONSTANTS
39+
******************************************************************************/
40+
41+
static int const CBOR_ENCODER_NO_PROPERTIES_LIMIT = -1;
42+
3743
/******************************************************************************
3844
* CLASS DECLARATION
3945
******************************************************************************/

0 commit comments

Comments
 (0)