various: Fix GCC 11 compilation issues.

test_voicemail_api: Use empty char* for empty_msg_ids.
chan_skinny: Fix size of calledParty to be maximum extension.
menuselect: Change Makefile to stop deprecated warnings. Added comments
test_linkedlist: 'bogus' variable was manually allocated from a macro
and the test fails if this happens but the compiler couldn't 'see' this
and returns a warning. memset to all 0's after allocation.
chan_ooh323: Fixed various indentation issues that triggered misleading
 indentation warnings.

ASTERISK-29682
Reported by: George Joseph

Change-Id: If4fe42222c8444dc16828a42731ee53b4ce5cbbe
This commit is contained in:
Mike Bradeen 2021-10-07 12:07:24 -06:00 committed by Friendly Automation
parent cfae5224e3
commit 99a1a427a9
6 changed files with 33 additions and 25 deletions

View File

@ -373,7 +373,7 @@ void* memHeapAlloc (void** ppvMemHeap, int nbytes)
CHECKMEMBLOCK (pMemHeap, pMemBlk);
}
else {
ast_mutex_unlock(&pMemHeap->pLock);
ast_mutex_unlock(&pMemHeap->pLock);
return NULL;
}
}
@ -753,9 +753,10 @@ void* memHeapRealloc (void** ppvMemHeap, void* mem_p, int nbytes_)
if (newMemBlk == 0)
return 0;
pMemLink->pMemBlk = newMemBlk;
}
else
}
else {
return 0;
}
*(int*)(((char*)pMemLink) + sizeof (OSMemLink)) = nbytes_;
return pMemLink->pMemBlk;
}
@ -1132,7 +1133,7 @@ void* memHeapMarkSaved (void** ppvMemHeap, const void* mem_p,
RTMEMDIAG2 ("memHeapMarkSaved: the element 0x%x is "
"already free!\n", pElem);
ast_mutex_unlock(&pMemHeap->pLock);
ast_mutex_unlock(&pMemHeap->pLock);
return 0;
}
@ -1151,9 +1152,10 @@ void* memHeapMarkSaved (void** ppvMemHeap, const void* mem_p,
CLEAR_SAVED (pMemBlk, pElem);
nsaved = pMemBlk->nsaved;
}
else
ast_mutex_unlock(&pMemHeap->pLock);
return 0;
else {
ast_mutex_unlock(&pMemHeap->pLock);
}
return 0;
}
if (saved && nsaved > 0)
pMemLink->blockType |= RTMEMSAVED;

View File

@ -1062,16 +1062,17 @@ int ooOnReceivedAlerting(OOH323CallData *call, Q931Message *q931Msg)
if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent &&
q931Msg->userInfo->h323_uu_pdu.h245Tunneling &&
OO_TESTFLAG (call->flags, OO_M_TUNNELING)) {
if (alerting->m.h245AddressPresent)
if (alerting->m.h245AddressPresent) {
OOTRACEINFO3("Tunneling and h245address provided."
"Giving preference to Tunneling (%s, %s)\n",
call->callType, call->callToken);
if (call->h225version >= 4) {
ret =ooSendTCSandMSD(call);
}
if (ret != OO_OK)
return ret;
}
if (call->h225version >= 4) {
ret =ooSendTCSandMSD(call);
}
if (ret != OO_OK) {
return ret;
}
} else if(alerting->m.h245AddressPresent) {
if (OO_TESTFLAG (call->flags, OO_M_TUNNELING))
{
@ -1314,15 +1315,17 @@ int ooOnReceivedProgress(OOH323CallData *call, Q931Message *q931Msg)
if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent &&
q931Msg->userInfo->h323_uu_pdu.h245Tunneling &&
OO_TESTFLAG (call->flags, OO_M_TUNNELING)) {
if (progress->m.h245AddressPresent)
if (progress->m.h245AddressPresent) {
OOTRACEINFO3("Tunneling and h245address provided."
"Giving preference to Tunneling (%s, %s)\n",
call->callType, call->callToken);
if (call->h225version >= 4) {
ret =ooSendTCSandMSD(call);
}
if (ret != OO_OK)
}
if (call->h225version >= 4) {
ret =ooSendTCSandMSD(call);
}
if (ret != OO_OK) {
return ret;
}
} else if(progress->m.h245AddressPresent) {
if (OO_TESTFLAG (call->flags, OO_M_TUNNELING))
{

View File

@ -314,7 +314,7 @@ struct keypad_button_message {
#define ENBLOC_CALL_MESSAGE 0x0004
struct enbloc_call_message {
char calledParty[24];
char calledParty[AST_MAX_EXTENSION];
};
#define STIMULUS_MESSAGE 0x0005

View File

@ -22,7 +22,9 @@ endif
# Basic set of sources and flags/libraries/includes
OBJS:=menuselect.o strcompat.o
CFLAGS+=-g -D_GNU_SOURCE -Wall
# Adding -Wdeprecated-declarations to deal with internal deprecation warnings
# from gtk+ for GTypeDebugFlags and GTimeVal deprecated in later glib versions
CFLAGS+=-g -D_GNU_SOURCE -Wall -Wno-deprecated-declarations
ifneq ($(findstring dragonfly,$(OSARCH)),)
CFLAGS += -isystem /usr/local/include

View File

@ -148,6 +148,7 @@ AST_TEST_DEFINE(single_ll_tests)
if (!(bogus = ast_alloca(sizeof(*bogus)))) {
return AST_TEST_FAIL;
}
memset(bogus, 0, sizeof(*bogus));
if (AST_LIST_REMOVE(&test_list, bogus, list)) {
ast_test_status_update(test, "AST_LIST_REMOVE should safely return NULL for missing element from empty list\n");

View File

@ -1156,7 +1156,7 @@ AST_TEST_DEFINE(voicemail_api_off_nominal_remove)
{
const char *inbox_msg_id;
const char *multi_msg_ids[2];
const char *empty_msg_ids[] = { };
const char *empty_msg_ids = "";
switch (cmd) {
case TEST_INIT:
@ -1207,7 +1207,7 @@ AST_TEST_DEFINE(voicemail_api_off_nominal_remove)
VM_API_REMOVE_MESSAGE_OFF_NOMINAL("test_vm_api_2345", "default", 2, "INBOX", multi_msg_ids);
ast_test_status_update(test, "Test removing no messages with no message numbers\n");
VM_API_REMOVE_MESSAGE_OFF_NOMINAL("test_vm_api_1234", "default", 0, "INBOX", empty_msg_ids);
VM_API_REMOVE_MESSAGE_OFF_NOMINAL("test_vm_api_1234", "default", 0, "INBOX", &empty_msg_ids);
ast_test_status_update(test, "Test removing multiple messages with an invalid size specifier\n");
VM_API_REMOVE_MESSAGE_OFF_NOMINAL("test_vm_api_2345", "default", -30, "INBOX", multi_msg_ids);
@ -1330,7 +1330,7 @@ AST_TEST_DEFINE(voicemail_api_off_nominal_forward)
const char *inbox_msg_id;
const char *multi_msg_ids[4];
const char *empty_msg_ids[] = { };
const char *empty_msg_ids = "";
switch (cmd) {
case TEST_INIT:
@ -1393,7 +1393,7 @@ AST_TEST_DEFINE(voicemail_api_off_nominal_forward)
VM_API_FORWARD_MESSAGE_OFF_NOMINAL("test_vm_api_1234", "default", "INBOX", "test_vm_api_2345", "default", NULL, 1, &inbox_msg_id, 0);
ast_test_status_update(test, "Test forwarding when no messages are select\n");
VM_API_FORWARD_MESSAGE_OFF_NOMINAL("test_vm_api_1234", "default", "INBOX", "test_vm_api_2345", "default", "INBOX", 0, empty_msg_ids, 0);
VM_API_FORWARD_MESSAGE_OFF_NOMINAL("test_vm_api_1234", "default", "INBOX", "test_vm_api_2345", "default", "INBOX", 0, &empty_msg_ids, 0);
ast_test_status_update(test, "Test forwarding a message that doesn't exist\n");
inbox_msg_id = "POOPOO";