Skip to content

Commit 0889aae

Browse files
committed
Update code to remove the incompatible-pointer-types warning for the latest ESP-IDF v5.4
1 parent d4c38d5 commit 0889aae

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

source/MQTTFileDownloader_cbor.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ bool CBOR_Decode_GetStreamResponseMessage( const uint8_t * messageBuffer,
7171
CborParser parser;
7272
CborValue value, cborMap;
7373
size_t payloadSizeReceived = 0;
74+
int variableBuffer = 0;
7475

7576
if( ( fileId == NULL ) || ( blockId == NULL ) || ( blockSize == NULL ) ||
7677
( payload == NULL ) || ( payloadSize == NULL ) ||
@@ -114,7 +115,9 @@ bool CBOR_Decode_GetStreamResponseMessage( const uint8_t * messageBuffer,
114115

115116
if( CborNoError == cborResult )
116117
{
117-
cborResult = cbor_value_get_int( &value, ( int32_t * ) fileId );
118+
variableBuffer = ( int ) *fileId;
119+
cborResult = cbor_value_get_int( &value, &variableBuffer );
120+
*fileId = ( int32_t ) variableBuffer;
118121
}
119122

120123
/* Find the block ID. */
@@ -132,7 +135,9 @@ bool CBOR_Decode_GetStreamResponseMessage( const uint8_t * messageBuffer,
132135

133136
if( CborNoError == cborResult )
134137
{
135-
cborResult = cbor_value_get_int( &value, ( int32_t * ) blockId );
138+
variableBuffer = ( int ) *blockId;
139+
cborResult = cbor_value_get_int( &value, &variableBuffer );
140+
*blockId = ( int32_t ) variableBuffer;
136141
}
137142

138143
/* Find the block size. */
@@ -150,7 +155,9 @@ bool CBOR_Decode_GetStreamResponseMessage( const uint8_t * messageBuffer,
150155

151156
if( CborNoError == cborResult )
152157
{
153-
cborResult = cbor_value_get_int( &value, ( int32_t * ) blockSize );
158+
variableBuffer = ( int ) *blockSize;
159+
cborResult = cbor_value_get_int( &value, &variableBuffer );
160+
*blockSize = ( int32_t ) variableBuffer;
154161
}
155162

156163
/* Find the payload bytes. */

0 commit comments

Comments
 (0)