diff --git a/samples/dev_model/dev_model_sample.c b/samples/dev_model/dev_model_sample.c index 3985733..e164904 100644 --- a/samples/dev_model/dev_model_sample.c +++ b/samples/dev_model/dev_model_sample.c @@ -108,6 +108,7 @@ static int _setup_connect_init_params(MQTTInitParams* initParams) static void mqtt_devmodel_thread(void) { int rc; + int i = 0; MQTTInitParams init_params = DEFAULT_MQTT_INIT_PARAMS; rc = _setup_connect_init_params(&init_params); @@ -138,7 +139,7 @@ static void mqtt_devmodel_thread(void) IOT_DM_RegisterCallback(PROPERTY_SET , h_dm, property_set_cb); IOT_DM_Yield(h_dm, 200); - for (int i = 0; i < 10; i++) { + for (i = 0; i < 10; i++) { IOT_DM_Property_Report(h_dm, PROPERTY_POST, i * 2, "{\"volume\": {\"Value\":50}}"); IOT_DM_TriggerEvent(h_dm, i * 2 + 1, "low_power_alert", "{\"power\": 5}"); diff --git a/uiot/mqtt/src/mqtt_client_common.c b/uiot/mqtt/src/mqtt_client_common.c index 6992c42..18f63af 100644 --- a/uiot/mqtt/src/mqtt_client_common.c +++ b/uiot/mqtt/src/mqtt_client_common.c @@ -920,7 +920,8 @@ static int _handle_suback_packet(UIoT_Client *pClient, Timer *timer, QoS qos) int flag_dup = 0, i_free = -1; - for (int j = 0; j < count; j++) { + int j; + for (j = 0; j < count; j++) { /* In negative case, grantedQoS will be 0xFFFF FF80, which means -128 */ if ((uint8_t)grantedQoS[j] == 0x80) { sub_nack = true;