Skip to content

Commit

Permalink
#58: compiler warnings seen after bullseye update
Browse files Browse the repository at this point in the history
  • Loading branch information
ballle98 committed Mar 8, 2022
1 parent baf1ae5 commit 12e537e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
8 changes: 6 additions & 2 deletions mongoose.c
Original file line number Diff line number Diff line change
Expand Up @@ -9026,7 +9026,10 @@ static void mg_do_ssi_include(struct mg_connection *nc, struct http_message *hm,
*/
if (sscanf(tag, " virtual=\"%[^\"]\"", file_name) == 1) {
/* File name is relative to the webserver root */
snprintf(path, sizeof(path), "%s/%s", opts->document_root, file_name);
int n = snprintf(path, sizeof(path), "%s/%s", opts->document_root, file_name);
if ((n <0) || ((size_t)n > sizeof (path))) {
mg_printf(nc, "Bad SSI #include path too long: [%s]", tag);
}
} else if (sscanf(tag, " abspath=\"%[^\"]\"", file_name) == 1) {
/*
* File name is relative to the webserver working directory
Expand Down Expand Up @@ -11590,7 +11593,8 @@ int mg_resolve_async_opt(struct mg_mgr *mgr, const char *name, int query,
return -1;
}

strncpy(req->name, name, sizeof(req->name));
strncpy(req->name, name, sizeof(req->name)-1);
req->name[sizeof(req->name)-1] = '\0';
req->query = query;
req->callback = cb;
req->data = data;
Expand Down
8 changes: 4 additions & 4 deletions net_services.c
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ uriAtype action_URI(netRequest from, const char *URI, int uri_length, float valu
// Action Light program.
} else if ((ri3 != NULL && ((strncasecmp(ri2, "color", 5) == 0) || (strncasecmp(ri2, "program", 7) == 0)) && (strncasecmp(ri3, "set", 3) == 0))) {
found = false;
snprintf(labelBuff, sizeof(labelBuff), "%.*s", ri2-ri1-1, ri1);
snprintf(labelBuff, sizeof(labelBuff), "%.*s", (int)(ri2-ri1-1), ri1);
for (i=0; i < _aqualink_data->total_buttons; i++) {
if (strcmp(labelBuff, _aqualink_data->aqbuttons[i].name) == 0 ||
strcmp(labelBuff, _aqualink_data->aqbuttons[i].label) == 0)
Expand Down Expand Up @@ -871,7 +871,7 @@ uriAtype action_URI(netRequest from, const char *URI, int uri_length, float valu
}
}
} else { // Pump by button name
snprintf(labelBuff, sizeof(labelBuff), "%.*s", ri2-ri1-1, ri1);
snprintf(labelBuff, sizeof(labelBuff), "%.*s", (int)(ri2-ri1-1), ri1);

for (i=0; i < _aqualink_data->total_buttons ; i++) {
if (strcmp(labelBuff, _aqualink_data->aqbuttons[i].name) == 0 ){
Expand Down Expand Up @@ -916,7 +916,7 @@ uriAtype action_URI(netRequest from, const char *URI, int uri_length, float valu
// Must be a switch on / off
rtn = uActioned;
found = false;
snprintf(labelBuff, sizeof(labelBuff), "%.*s", ri2-ri1-1, ri1);
snprintf(labelBuff, sizeof(labelBuff), "%.*s", (int)(ri2-ri1-1), ri1);
for (i=0; i < _aqualink_data->total_buttons; i++) {
if (strcmp(labelBuff, _aqualink_data->aqbuttons[i].name) == 0 ||
strcmp(labelBuff, _aqualink_data->aqbuttons[i].label) == 0)
Expand Down Expand Up @@ -1166,7 +1166,7 @@ void action_web_request(struct mg_connection *nc, struct http_message *http_msg)
mg_send(nc, GET_RTN_UNKNOWN, strlen(GET_RTN_UNKNOWN));
}
snprintf(buf, sizeof(buf), "action_web_request() request '%.*s' took",
http_msg->uri.len, http_msg->uri.p);
(int)(http_msg->uri.len), http_msg->uri.p);

DEBUG_TIMER_STOP(tid, NET_LOG, buf);
}
Expand Down
3 changes: 3 additions & 0 deletions onetouch.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,14 +560,17 @@ void set_macro_status()
// OneTouch Menu Line 8 = ONETOUCH 3 OFF
if (get_onetouch_menu_type() == OTM_ONETOUCH) {
strncpy(_macros[0].name, _menu[2], 13);
_macros[0].name[13] = '\0';
chopwhitespace(_macros[0].name);
_macros[0].ison = (_menu[2][15] == 'N'?true:false);

strncpy(_macros[1].name, _menu[5], 13);
_macros[1].name[13] = '\0';
chopwhitespace(_macros[1].name);
_macros[1].ison = (_menu[5][15] == 'N'?true:false);

strncpy(_macros[2].name, _menu[8], 13);
_macros[2].name[13] = '\0';
chopwhitespace(_macros[2].name);
_macros[2].ison = (_menu[8][15] == 'N'?true:false);

Expand Down
2 changes: 1 addition & 1 deletion utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ void _LOG(int16_t from, int msg_level, char *message)
//int len;
message[8] = ' ';
char *strLevel = elevel2text(msg_level);
strncpy(message, strLevel, strlen(strLevel));
memcpy(message, strLevel, strlen(strLevel));
//len = strlen(message);
/*
if ( message[len-1] != '\n') {
Expand Down

0 comments on commit 12e537e

Please sign in to comment.