Fix code warning.
Change-Id: Ib11fb49f528d3688351ae349d5b4e307c28b3967
diff --git a/mbtk/libmbtk_lib/mqtt/MQTTPacket/MQTTFormat.c b/mbtk/libmbtk_lib/mqtt/MQTTPacket/MQTTFormat.c
index 3015a0e..9878492 100755
--- a/mbtk/libmbtk_lib/mqtt/MQTTPacket/MQTTFormat.c
+++ b/mbtk/libmbtk_lib/mqtt/MQTTPacket/MQTTFormat.c
@@ -119,7 +119,7 @@
int index = 0;
int rem_length = 0;
MQTTHeader header = {0};
- int strindex = 0;
+// int strindex = 0;
header.byte = buf[index++];
index += MQTTPacket_decodeBuf(&buf[index], &rem_length);
@@ -130,7 +130,7 @@
{
unsigned char sessionPresent, connack_rc;
if (MQTTDeserialize_connack(&sessionPresent, &connack_rc, buf, buflen) == 1)
- strindex = MQTTStringFormat_connack(strbuf, strbuflen, connack_rc, sessionPresent);
+ MQTTStringFormat_connack(strbuf, strbuflen, connack_rc, sessionPresent);
}
break;
case PUBLISH:
@@ -141,7 +141,7 @@
MQTTString topicName = MQTTString_initializer;
if (MQTTDeserialize_publish(&dup, &qos, &retained, &packetid, &topicName,
&payload, &payloadlen, buf, buflen) == 1)
- strindex = MQTTStringFormat_publish(strbuf, strbuflen, dup, qos, retained, packetid,
+ MQTTStringFormat_publish(strbuf, strbuflen, dup, qos, retained, packetid,
topicName, payload, payloadlen);
}
break;
@@ -153,7 +153,7 @@
unsigned char packettype, dup;
unsigned short packetid;
if (MQTTDeserialize_ack(&packettype, &dup, &packetid, buf, buflen) == 1)
- strindex = MQTTStringFormat_ack(strbuf, strbuflen, packettype, dup, packetid);
+ MQTTStringFormat_ack(strbuf, strbuflen, packettype, dup, packetid);
}
break;
case SUBACK:
@@ -162,20 +162,20 @@
int maxcount = 1, count = 0;
int grantedQoSs[1];
if (MQTTDeserialize_suback(&packetid, maxcount, &count, grantedQoSs, buf, buflen) == 1)
- strindex = MQTTStringFormat_suback(strbuf, strbuflen, packetid, count, grantedQoSs);
+ MQTTStringFormat_suback(strbuf, strbuflen, packetid, count, grantedQoSs);
}
break;
case UNSUBACK:
{
unsigned short packetid;
if (MQTTDeserialize_unsuback(&packetid, buf, buflen) == 1)
- strindex = MQTTStringFormat_ack(strbuf, strbuflen, UNSUBACK, 0, packetid);
+ MQTTStringFormat_ack(strbuf, strbuflen, UNSUBACK, 0, packetid);
}
break;
case PINGREQ:
case PINGRESP:
case DISCONNECT:
- strindex = snprintf(strbuf, strbuflen, "%s", MQTTPacket_names[header.bits.type]);
+ snprintf(strbuf, strbuflen, "%s", MQTTPacket_names[header.bits.type]);
break;
}
return strbuf;
@@ -187,7 +187,7 @@
int index = 0;
int rem_length = 0;
MQTTHeader header = {0};
- int strindex = 0;
+// int strindex = 0;
header.byte = buf[index++];
index += MQTTPacket_decodeBuf(&buf[index], &rem_length);
@@ -199,7 +199,7 @@
MQTTPacket_connectData data;
int rc;
if ((rc = MQTTDeserialize_connect(&data, buf, buflen)) == 1)
- strindex = MQTTStringFormat_connect(strbuf, strbuflen, &data);
+ MQTTStringFormat_connect(strbuf, strbuflen, &data);
}
break;
case PUBLISH:
@@ -210,7 +210,7 @@
MQTTString topicName = MQTTString_initializer;
if (MQTTDeserialize_publish(&dup, &qos, &retained, &packetid, &topicName,
&payload, &payloadlen, buf, buflen) == 1)
- strindex = MQTTStringFormat_publish(strbuf, strbuflen, dup, qos, retained, packetid,
+ MQTTStringFormat_publish(strbuf, strbuflen, dup, qos, retained, packetid,
topicName, payload, payloadlen);
}
break;
@@ -222,7 +222,7 @@
unsigned char packettype, dup;
unsigned short packetid;
if (MQTTDeserialize_ack(&packettype, &dup, &packetid, buf, buflen) == 1)
- strindex = MQTTStringFormat_ack(strbuf, strbuflen, packettype, dup, packetid);
+ MQTTStringFormat_ack(strbuf, strbuflen, packettype, dup, packetid);
}
break;
case SUBSCRIBE:
@@ -234,7 +234,7 @@
int requestedQoSs[1];
if (MQTTDeserialize_subscribe(&dup, &packetid, maxcount, &count,
topicFilters, requestedQoSs, buf, buflen) == 1)
- strindex = MQTTStringFormat_subscribe(strbuf, strbuflen, dup, packetid, count, topicFilters, requestedQoSs);;
+ MQTTStringFormat_subscribe(strbuf, strbuflen, dup, packetid, count, topicFilters, requestedQoSs);;
}
break;
case UNSUBSCRIBE:
@@ -244,13 +244,13 @@
int maxcount = 1, count = 0;
MQTTString topicFilters[1];
if (MQTTDeserialize_unsubscribe(&dup, &packetid, maxcount, &count, topicFilters, buf, buflen) == 1)
- strindex = MQTTStringFormat_unsubscribe(strbuf, strbuflen, dup, packetid, count, topicFilters);
+ MQTTStringFormat_unsubscribe(strbuf, strbuflen, dup, packetid, count, topicFilters);
}
break;
case PINGREQ:
case PINGRESP:
case DISCONNECT:
- strindex = snprintf(strbuf, strbuflen, "%s", MQTTPacket_names[header.bits.type]);
+ snprintf(strbuf, strbuflen, "%s", MQTTPacket_names[header.bits.type]);
break;
}
strbuf[strbuflen] = '\0';