mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-20 11:19:56 +00:00
Fix #1285 - __builtin___snprintf_chk warning. Tighten test flags and refactor the code to squash all warnings
This commit is contained in:
1 parent
db27fae40e
commit
736b8ad7b7
30 files changed
+708
-691
No files matched your search
+4
-6
@@ -1015,19 +1015,18 @@ Subscribe to topic `topic`.
|
||||
### mg\_mqtt\_next\_sub()
|
||||
|
||||
```c
|
||||
int mg_mqtt_next_sub(struct mg_mqtt_message *msg, struct mg_str *topic,
|
||||
uint8_t *qos, int pos);
|
||||
size_t mg_mqtt_next_sub(struct mg_mqtt_message *msg, struct mg_str *topic, uint8_t *qos, size_t pos);
|
||||
```
|
||||
|
||||
Traverse list of subscribed topics.
|
||||
Used to implement MQTT server when `MQTT_CMD_SUBSCRIBE` is received.
|
||||
Return next position. Initial position `pos` should be 4. Example:
|
||||
Return next position, or 0 when done. Initial position `pos` should be 4. Example:
|
||||
|
||||
```c
|
||||
if (ev == MG_EV_MQTT_CMD) {
|
||||
struct mg_mqtt_message *mm = (struct mg_mqtt_message *) ev_data;
|
||||
if (mm->cmd == MQTT_CMD_SUBSCRIBE) {
|
||||
int pos = 4;
|
||||
size_t pos = 4;
|
||||
uint8_t qos;
|
||||
struct mg_str topic;
|
||||
while ((pos = mg_mqtt_next_sub(mm, &topic, &qos, pos)) > 0) {
|
||||
@@ -1040,8 +1039,7 @@ if (ev == MG_EV_MQTT_CMD) {
|
||||
### mg\_mqtt\_next\_unsub()
|
||||
|
||||
```c
|
||||
int mg_mqtt_next_unsub(struct mg_mqtt_message *msg, struct mg_str *topic,
|
||||
int pos);
|
||||
size_t mg_mqtt_next_unsub(struct mg_mqtt_message *msg, struct mg_str *topic, size_t pos);
|
||||
```
|
||||
|
||||
Same as `mg_mqtt_next_sub()`, but for unsubscribed topics. The difference
|
||||
|
||||
Reference in new issue
Block a user