mirror of
https://github.com/espressif/esp-mqtt.git
synced 2026-10-24 16:23:50 +00:00
mqtt_msg: avoid uncasting const to mqtt topic and data pointers
This commit is contained in:
@@ -113,8 +113,8 @@ static inline int mqtt_get_retain(uint8_t* buffer) { return (buffer[0] & 0x01);
|
||||
void mqtt_msg_init(mqtt_connection_t* connection, uint8_t* buffer, uint16_t buffer_length);
|
||||
bool mqtt_header_complete(uint8_t* buffer, uint16_t buffer_length);
|
||||
uint32_t mqtt_get_total_length(uint8_t* buffer, uint16_t length, int* fixed_size_len);
|
||||
const char* mqtt_get_publish_topic(uint8_t* buffer, uint32_t* length);
|
||||
const char* mqtt_get_publish_data(uint8_t* buffer, uint32_t* length);
|
||||
char* mqtt_get_publish_topic(uint8_t* buffer, uint32_t* length);
|
||||
char* mqtt_get_publish_data(uint8_t* buffer, uint32_t* length);
|
||||
uint16_t mqtt_get_id(uint8_t* buffer, uint16_t length);
|
||||
int mqtt_has_valid_msg_hdr(uint8_t* buffer, uint16_t length);
|
||||
|
||||
|
||||
+4
-4
@@ -206,7 +206,7 @@ bool mqtt_header_complete(uint8_t* buffer, uint16_t buffer_length)
|
||||
return buffer_length >= i;
|
||||
}
|
||||
|
||||
const char* mqtt_get_publish_topic(uint8_t* buffer, uint32_t* length)
|
||||
char* mqtt_get_publish_topic(uint8_t* buffer, uint32_t* length)
|
||||
{
|
||||
int i;
|
||||
int totlen = 0;
|
||||
@@ -232,10 +232,10 @@ const char* mqtt_get_publish_topic(uint8_t* buffer, uint32_t* length)
|
||||
return NULL;
|
||||
|
||||
*length = topiclen;
|
||||
return (const char*)(buffer + i);
|
||||
return (char*)(buffer + i);
|
||||
}
|
||||
|
||||
const char* mqtt_get_publish_data(uint8_t* buffer, uint32_t* length)
|
||||
char* mqtt_get_publish_data(uint8_t* buffer, uint32_t* length)
|
||||
{
|
||||
int i;
|
||||
int totlen = 0;
|
||||
@@ -278,7 +278,7 @@ const char* mqtt_get_publish_data(uint8_t* buffer, uint32_t* length)
|
||||
*length = totlen - i;
|
||||
else
|
||||
*length = blength - i;
|
||||
return (const char*)(buffer + i);
|
||||
return (char*)(buffer + i);
|
||||
}
|
||||
|
||||
uint16_t mqtt_get_id(uint8_t* buffer, uint16_t length)
|
||||
|
||||
Reference in New Issue
Block a user