Skip to content

Commit be5ba4e

Browse files
committed
Update mqttclient.c
1 parent 43ff841 commit be5ba4e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

mqttclient/mqttclient.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,6 +1302,7 @@ int mqtt_subscribe(mqtt_client_t* c, const char* topic_filter, mqtt_qos_t qos, m
13021302
{
13031303
int rc = MQTT_SUBSCRIBE_ERROR;
13041304
int len = 0;
1305+
int qos_level = qos; /* This can avoid alignment bugs, because enum is not int on some compilers */
13051306
uint16_t packet_id;
13061307
platform_timer_t timer;
13071308
MQTTString topic = MQTTString_initializer;
@@ -1315,8 +1316,6 @@ int mqtt_subscribe(mqtt_client_t* c, const char* topic_filter, mqtt_qos_t qos, m
13151316

13161317
packet_id = mqtt_get_next_packet_id(c);
13171318

1318-
int qos_level = qos; /* This can avoid alignment bugs, because enum is not int on some compilers */
1319-
13201319
/* serialize subscribe packet and send it */
13211320
len = MQTTSerialize_subscribe(c->mqtt_write_buf, c->mqtt_write_buf_size, 0, packet_id, 1, &topic, (int *)&qos_level);
13221321
if (len <= 0)

0 commit comments

Comments
 (0)