mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-02 11:58:40 +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
@@ -1115,10 +1115,12 @@ static int inprocess_cmp_fn(void *obj, void *arg, int flags)
|
||||
|
||||
static int inprocess_count(const char *context, const char *mailbox, int delta)
|
||||
{
|
||||
struct inprocess *i, *arg = ast_alloca(sizeof(*arg) + strlen(context) + strlen(mailbox) + 2);
|
||||
arg->context = arg->mailbox + strlen(mailbox) + 1;
|
||||
strcpy(arg->mailbox, mailbox); /* SAFE */
|
||||
strcpy(arg->context, context); /* SAFE */
|
||||
int context_len = strlen(context) + 1;
|
||||
int mailbox_len = strlen(mailbox) + 1;
|
||||
struct inprocess *i, *arg = ast_alloca(sizeof(*arg) + context_len + mailbox_len);
|
||||
arg->context = arg->mailbox + mailbox_len;
|
||||
ast_copy_string(arg->mailbox, mailbox, mailbox_len); /* SAFE */
|
||||
ast_copy_string(arg->context, context, context_len); /* SAFE */
|
||||
ao2_lock(inprocess_container);
|
||||
if ((i = ao2_find(inprocess_container, arg, 0))) {
|
||||
int ret = ast_atomic_fetchadd_int(&i->count, delta);
|
||||
@@ -1129,13 +1131,13 @@ static int inprocess_count(const char *context, const char *mailbox, int delta)
|
||||
if (delta < 0) {
|
||||
ast_log(LOG_WARNING, "BUG: ref count decrement on non-existing object???\n");
|
||||
}
|
||||
if (!(i = ao2_alloc(sizeof(*i) + strlen(context) + strlen(mailbox) + 2, NULL))) {
|
||||
if (!(i = ao2_alloc(sizeof(*i) + context_len + mailbox_len, NULL))) {
|
||||
ao2_unlock(inprocess_container);
|
||||
return 0;
|
||||
}
|
||||
i->context = i->mailbox + strlen(mailbox) + 1;
|
||||
strcpy(i->mailbox, mailbox); /* SAFE */
|
||||
strcpy(i->context, context); /* SAFE */
|
||||
i->context = i->mailbox + mailbox_len;
|
||||
ast_copy_string(i->mailbox, mailbox, mailbox_len); /* SAFE */
|
||||
ast_copy_string(i->context, context, context_len); /* SAFE */
|
||||
i->count = delta;
|
||||
ao2_link(inprocess_container, i);
|
||||
ao2_unlock(inprocess_container);
|
||||
@@ -13564,8 +13566,8 @@ static struct alias_mailbox_mapping *alias_mailbox_mapping_create(const char *al
|
||||
}
|
||||
mapping->alias = mapping->buf;
|
||||
mapping->mailbox = mapping->buf + from_len;
|
||||
strcpy(mapping->alias, alias); /* Safe */
|
||||
strcpy(mapping->mailbox, mailbox); /* Safe */
|
||||
ast_copy_string(mapping->alias, alias, from_len); /* Safe */
|
||||
ast_copy_string(mapping->mailbox, mailbox, to_len); /* Safe */
|
||||
|
||||
return mapping;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user