all warnings as errors

This commit is contained in:
2020-11-20 11:23:44 +01:00
parent ada748edbb
commit 5ba461adf6
11 changed files with 52 additions and 47 deletions

View File

@ -53,9 +53,9 @@ static void mqttStatusPublisher(void *handle) {
coloredMsg(LOG_GREEN, false, "mqsp: publishing status");
t_mbusCommStats *mbusCommStats = mbusCommGetStats();
char buf[64];
snprintf(buf, 128, "{\"uptime\":\"%ld\", \"tasks\":\"%d\", \"requests\":\"%d\", \"errors\":\"%d\"}",
snprintf(buf, 128, "{\"uptime\":\"%ld\", \"tasks\":\"%d\", \"requests\":\"%ld\", \"errors\":\"%ld\"}",
HAL_GetTick()/1000, schTaskCnt(), mbusCommStats->requestCnt, mbusCommStats->errorCnt);
bool res = publish(&mqttClient, StatusTopic, (const char*)buf, strlen(buf), false);
bool res = publish(&mqttClient, StatusTopic, (const uint8_t*)buf, strlen(buf), false);
coloredMsg(LOG_GREEN, false, "mqch, publish returned %d", res);
}
@ -90,7 +90,7 @@ void mqttCommHandler(void *handle) {
case 2:
coloredMsg(LOG_GREEN, false, "mqch, publish start-up");
res = publish(&mqttClient, StartupTopic, (const char*)message, strlen(message), false);
res = publish(&mqttClient, StartupTopic, (const uint8_t*)message, strlen((char*)message), false);
coloredMsg(LOG_GREEN, false, "mqch, publish returned %d", res);
schAdd(mqttStatusPublisher, NULL, 0, 60000);
coloredMsg(LOG_GREEN, false, "mqch, status publisher scheduled");
@ -132,10 +132,10 @@ void mqttCommInit() {
schAdd(mqttCommHandler, NULL, 0, 100);
}
void mqttPublish(char *topic, char *message) {
void mqttPublish(const char *topic, char *message) {
bool res = false;
if (isNetworkAvailable()) {
res = publish(&mqttClient, topic, message, strlen(message), false);
res = publish(&mqttClient, topic, (const uint8_t*)message, strlen(message), false);
}
if (res) {
coloredMsg(LOG_GREEN, false, "mqp: %s -> %s successfully published", message, topic);
@ -144,7 +144,7 @@ void mqttPublish(char *topic, char *message) {
}
}
void mqttPublishf(char *topic, char *messageFormat, ...) {
void mqttPublishf(const char *topic, char *messageFormat, ...) {
va_list vl;
va_start(vl, messageFormat);
char buf[2048];
@ -156,3 +156,5 @@ void mqttPublishf(char *topic, char *messageFormat, ...) {
coloredMsg(LOG_RED, true, "mqc mpf buffer overflow, truncated message not published");
}
}