mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 19:16:15 +00:00
Compiler fixes for gcc 10
This patch fixes a few compile warnings/errors that now occur when using gcc 10+. Also, the Makefile.rules check to turn off partial inlining in gcc versions greater or equal to 8.2.1 had a bug where it only it only checked against versions with at least 3 numbers (ex: 8.2.1 vs 10). This patch now ensures any version above the specified version is correctly compared. Change-Id: I54718496eb0c3ce5bd6d427cd279a29e8d2825f9
This commit is contained in:
committed by
Friendly Automation
parent
559fa0e89c
commit
3d1bf3c537
@@ -537,7 +537,7 @@ static void try_redirect(newtComponent c)
|
||||
|
||||
chan = newtListboxGetCurrent(c);
|
||||
if (chan) {
|
||||
strncpy(channame, chan->name, sizeof(channame) - 1);
|
||||
snprintf(channame, sizeof(channame), "%s", chan->name);
|
||||
snprintf(tmp, sizeof(tmp), "%s%s", tmp_prefix, channame);
|
||||
if (get_user_input(tmp, dest, sizeof(dest)))
|
||||
return;
|
||||
|
@@ -79,8 +79,7 @@ dbm_open(file, flags, mode)
|
||||
info.cachesize = 0;
|
||||
info.hash = NULL;
|
||||
info.lorder = 0;
|
||||
(void)strcpy(path, file); /* SAFE */
|
||||
(void)strncat(path, DBM_SUFFIX, len - strlen(path) - 1);
|
||||
snprintf(path, len, "%s%s", file, DBM_SUFFIX);
|
||||
db = (DBM *)__hash_open(path, flags, mode, &info, 0);
|
||||
#ifndef __GNUC__
|
||||
free(path);
|
||||
|
@@ -1057,14 +1057,16 @@ static struct ast_variable *ast_variable_new(const char *name, const char *value
|
||||
{
|
||||
struct ast_variable *variable;
|
||||
int name_len = strlen(name) + 1;
|
||||
size_t value_len = strlen(value) + 1;
|
||||
size_t filename_len = strlen(filename) + 1;
|
||||
|
||||
if ((variable = ast_calloc(1, name_len + strlen(value) + 1 + strlen(filename) + 1 + sizeof(*variable)))) {
|
||||
if ((variable = ast_calloc(1, name_len + value_len + filename_len + sizeof(*variable)))) {
|
||||
variable->name = variable->stuff;
|
||||
variable->value = variable->stuff + name_len;
|
||||
variable->file = variable->value + strlen(value) + 1;
|
||||
variable->file = variable->value + value_len;
|
||||
strcpy(variable->name,name);
|
||||
strcpy(variable->value,value);
|
||||
strcpy(variable->file,filename);
|
||||
ast_copy_string(variable->value, value, value_len);
|
||||
ast_copy_string(variable->file, filename, filename_len);
|
||||
}
|
||||
|
||||
return variable;
|
||||
|
@@ -163,12 +163,12 @@ static int load_config(void)
|
||||
fprintf(stderr, "host needs an argument (the host) at line %d\n", lineno);
|
||||
} else if (!strcasecmp(buf, "user")) {
|
||||
if (val && strlen(val))
|
||||
strncpy(user, val, sizeof(user) - 1);
|
||||
snprintf(user, sizeof(user), "%s", val);
|
||||
else
|
||||
fprintf(stderr, "user needs an argument (the user) at line %d\n", lineno);
|
||||
} else if (!strcasecmp(buf, "pass")) {
|
||||
if (val && strlen(val))
|
||||
strncpy(pass, val, sizeof(pass) - 1);
|
||||
snprintf(pass, sizeof(pass), "%s", val);
|
||||
else
|
||||
fprintf(stderr, "pass needs an argument (the password) at line %d\n", lineno);
|
||||
} else if (!strcasecmp(buf, "smoothfade")) {
|
||||
@@ -639,24 +639,29 @@ static int wait_event(void)
|
||||
return -1;
|
||||
}
|
||||
if (!strncasecmp(resp, "Event: ", strlen("Event: "))) {
|
||||
strncpy(event, resp + strlen("Event: "), sizeof(event) - 1);
|
||||
int event_len = -1;
|
||||
int channel_len = -1;
|
||||
int newname_len = -1;
|
||||
int oldname_len = -1;
|
||||
|
||||
event_len = snprintf(event, sizeof(event), "%s", resp + strlen("Event: "));
|
||||
/* Consume the rest of the non-event */
|
||||
while((resp = get_line()) && strlen(resp)) {
|
||||
if (!strncasecmp(resp, "Channel: ", strlen("Channel: ")))
|
||||
strncpy(channel, resp + strlen("Channel: "), sizeof(channel) - 1);
|
||||
channel_len = snprintf(channel, sizeof(channel), "%s", resp + strlen("Channel: "));
|
||||
if (!strncasecmp(resp, "Newname: ", strlen("Newname: ")))
|
||||
strncpy(newname, resp + strlen("Newname: "), sizeof(newname) - 1);
|
||||
newname_len = snprintf(newname, sizeof(newname), "%s", resp + strlen("Newname: "));
|
||||
if (!strncasecmp(resp, "Oldname: ", strlen("Oldname: ")))
|
||||
strncpy(oldname, resp + strlen("Oldname: "), sizeof(oldname) - 1);
|
||||
oldname_len = snprintf(oldname, sizeof(oldname), "%s", resp + strlen("Oldname: "));
|
||||
}
|
||||
if (strlen(channel)) {
|
||||
if (!strcasecmp(event, "Hangup"))
|
||||
if (channel_len == strlen(channel)) {
|
||||
if (event_len == strlen(event) && !strcasecmp(event, "Hangup"))
|
||||
hangup_chan(channel);
|
||||
else
|
||||
offhook_chan(channel);
|
||||
}
|
||||
if (strlen(newname) && strlen(oldname)) {
|
||||
if (!strcasecmp(event, "Rename")) {
|
||||
if (newname_len == strlen(newname) && oldname_len == strlen(oldname)) {
|
||||
if (event_len == strlen(event) && !strcasecmp(event, "Rename")) {
|
||||
hangup_chan(oldname);
|
||||
offhook_chan(newname);
|
||||
}
|
||||
|
Reference in New Issue
Block a user