[Asterisk-code-review] various: Fix GCC 11 compilation issues. (asterisk[18])

Friendly Automation asteriskteam at digium.com
Thu Oct 21 13:19:09 CDT 2021


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/16607 )

Change subject: various: Fix GCC 11 compilation issues.
......................................................................

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
---
M addons/ooh323c/src/memheap.c
M addons/ooh323c/src/ooh323.c
M channels/chan_skinny.c
M menuselect/Makefile
M tests/test_linkedlists.c
M tests/test_voicemail_api.c
6 files changed, 33 insertions(+), 25 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/addons/ooh323c/src/memheap.c b/addons/ooh323c/src/memheap.c
index 4020261..33be667 100644
--- a/addons/ooh323c/src/memheap.c
+++ b/addons/ooh323c/src/memheap.c
@@ -373,7 +373,7 @@
          CHECKMEMBLOCK (pMemHeap, pMemBlk);
       }
       else  {
-	 ast_mutex_unlock(&pMemHeap->pLock);
+	      ast_mutex_unlock(&pMemHeap->pLock);
          return NULL;
       }
    }
@@ -753,9 +753,10 @@
              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 @@
          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 @@
             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;
diff --git a/addons/ooh323c/src/ooh323.c b/addons/ooh323c/src/ooh323.c
index be02f8f..ebdf75a 100644
--- a/addons/ooh323c/src/ooh323.c
+++ b/addons/ooh323c/src/ooh323.c
@@ -1062,16 +1062,17 @@
    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 @@
    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))
       {
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index c908b61..7d1d510 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -313,7 +313,7 @@
 
 #define ENBLOC_CALL_MESSAGE 0x0004
 struct enbloc_call_message {
-	char calledParty[24];
+	char calledParty[AST_MAX_EXTENSION];
 };
 
 #define STIMULUS_MESSAGE 0x0005
diff --git a/menuselect/Makefile b/menuselect/Makefile
index c310c18..ba78275 100644
--- a/menuselect/Makefile
+++ b/menuselect/Makefile
@@ -22,7 +22,9 @@
 
 # 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
diff --git a/tests/test_linkedlists.c b/tests/test_linkedlists.c
index 5c3fceb..1b3ba79 100644
--- a/tests/test_linkedlists.c
+++ b/tests/test_linkedlists.c
@@ -148,6 +148,7 @@
 	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");
diff --git a/tests/test_voicemail_api.c b/tests/test_voicemail_api.c
index e467572..2338e38 100644
--- a/tests/test_voicemail_api.c
+++ b/tests/test_voicemail_api.c
@@ -1156,7 +1156,7 @@
 {
 	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 @@
 	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 @@
 	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 @@
 	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";

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16607
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: If4fe42222c8444dc16828a42731ee53b4ce5cbbe
Gerrit-Change-Number: 16607
Gerrit-PatchSet: 2
Gerrit-Owner: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20211021/8463349d/attachment-0001.html>


More information about the asterisk-code-review mailing list