[asterisk-commits] gtjoseph: branch 13 r434114 - in /branches/13: ./ channels/ include/asterisk/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 6 14:02:26 CDT 2015


Author: gtjoseph
Date: Mon Apr  6 14:02:23 2015
New Revision: 434114

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=434114
Log:
build: Fixes for gcc 5 compilation

These are fixes for compilation under gcc 5.0...

chan_sip.c:    In parse_request needed to make 'lim' unsigned.
inline_api.h:  Needed to add a check for '__GNUC_STDC_INLINE__' to detect C99 
               inline semantics (same as clang).
ccss.c:        In ast_cc_set_parm, needed to fix weird comparison.
dsp.c:         Needed to work around a possible compiler bug.  It was throwing 
               an array-bounds error but neither
               sgriepentrog, rmudgett nor I could figure out why.
manager.c:     In action_atxfer, needed to correct an array allocation.

This patch will go to 11, 13, trunk.

Review: https://reviewboard.asterisk.org/r/4581/
Reported-by: Jeffrey Ollie
Tested-by: George Joseph
ASTERISK-24932 #close
........

Merged revisions 434113 from http://svn.asterisk.org/svn/asterisk/branches/11

Modified:
    branches/13/   (props changed)
    branches/13/channels/chan_sip.c
    branches/13/include/asterisk/inline_api.h
    branches/13/main/ccss.c
    branches/13/main/dsp.c
    branches/13/main/manager.c

Propchange: branches/13/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Modified: branches/13/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/channels/chan_sip.c?view=diff&rev=434114&r1=434113&r2=434114
==============================================================================
--- branches/13/channels/chan_sip.c (original)
+++ branches/13/channels/chan_sip.c Mon Apr  6 14:02:23 2015
@@ -9595,7 +9595,8 @@
 {
 	char *c = ast_str_buffer(req->data);
 	ptrdiff_t *dst = req->header;
-	int i = 0, lim = SIP_MAX_HEADERS - 1;
+	int i = 0;
+	unsigned int lim = SIP_MAX_HEADERS - 1;
 	unsigned int skipping_headers = 0;
 	ptrdiff_t current_header_offset = 0;
 	char *previous_header = "";

Modified: branches/13/include/asterisk/inline_api.h
URL: http://svnview.digium.com/svn/asterisk/branches/13/include/asterisk/inline_api.h?view=diff&rev=434114&r1=434113&r2=434114
==============================================================================
--- branches/13/include/asterisk/inline_api.h (original)
+++ branches/13/include/asterisk/inline_api.h Mon Apr  6 14:02:23 2015
@@ -48,7 +48,7 @@
 #if !defined(LOW_MEMORY) && !defined(DISABLE_INLINE)
 
 #if !defined(AST_API_MODULE)
-#if defined(__clang__)
+#if defined(__clang__) || defined(__GNUC_STDC_INLINE__)
 #define AST_INLINE_API(hdr, body) static hdr; static inline hdr body
 #else /* if defined(__clang__) */
 #define AST_INLINE_API(hdr, body) hdr; extern inline hdr body

Modified: branches/13/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/main/ccss.c?view=diff&rev=434114&r1=434113&r2=434114
==============================================================================
--- branches/13/main/ccss.c (original)
+++ branches/13/main/ccss.c Mon Apr  6 14:02:23 2015
@@ -825,7 +825,7 @@
 		return 0;
 	}
 
-	if (!sscanf(value, "%30u", &value_as_uint) == 1) {
+	if (sscanf(value, "%30u", &value_as_uint) != 1) {
 		return -1;
 	}
 

Modified: branches/13/main/dsp.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/main/dsp.c?view=diff&rev=434114&r1=434113&r2=434114
==============================================================================
--- branches/13/main/dsp.c (original)
+++ branches/13/main/dsp.c Mon Apr  6 14:02:23 2015
@@ -112,9 +112,11 @@
 	{ "uk", PROG_MODE_UK },
 };
 
+#define FREQ_ARRAY_SIZE 7
+
 static struct progress {
 	enum gsamp_size size;
-	int freqs[7];
+	int freqs[FREQ_ARRAY_SIZE];
 } modes[] = {
 	{ GSAMP_SIZE_NA, { 350, 440, 480, 620, 950, 1400, 1800 } },	/*!< North America */
 	{ GSAMP_SIZE_CR, { 425 } },					/*!< Costa Rica, Brazil */
@@ -389,7 +391,7 @@
 	struct ast_dsp_busy_pattern busy_cadence;
 	int historicnoise[DSP_HISTORY];
 	int historicsilence[DSP_HISTORY];
-	goertzel_state_t freqs[7];
+	goertzel_state_t freqs[FREQ_ARRAY_SIZE];
 	int freqcount;
 	int gsamps;
 	enum gsamp_size gsamp_size;
@@ -1036,6 +1038,8 @@
 	int pass;
 	int newstate = DSP_TONE_STATE_SILENCE;
 	int res = 0;
+	int freqcount = dsp->freqcount > FREQ_ARRAY_SIZE ? FREQ_ARRAY_SIZE : dsp->freqcount;
+
 	while (len) {
 		/* Take the lesser of the number of samples we need and what we have */
 		pass = len;
@@ -1045,7 +1049,7 @@
 		for (x = 0; x < pass; x++) {
 			samp = s[x];
 			dsp->genergy += (int32_t) samp * (int32_t) samp;
-			for (y = 0; y < dsp->freqcount; y++) {
+			for (y = 0; y < freqcount; y++) {
 				goertzel_sample(&dsp->freqs[y], samp);
 			}
 		}
@@ -1053,8 +1057,8 @@
 		dsp->gsamps += pass;
 		len -= pass;
 		if (dsp->gsamps == dsp->gsamp_size) {
-			float hz[7];
-			for (y = 0; y < 7; y++) {
+			float hz[FREQ_ARRAY_SIZE];
+			for (y = 0; y < FREQ_ARRAY_SIZE; y++) {
 				hz[y] = goertzel_result(&dsp->freqs[y]);
 			}
 			switch (dsp->progmode) {
@@ -1642,7 +1646,7 @@
 
 	dsp->gsamp_size = modes[dsp->progmode].size;
 	dsp->gsamps = 0;
-	for (x = 0; x < ARRAY_LEN(modes[dsp->progmode].freqs); x++) {
+	for (x = 0; x < FREQ_ARRAY_SIZE; x++) {
 		if (modes[dsp->progmode].freqs[x]) {
 			goertzel_init(&dsp->freqs[x], (float)modes[dsp->progmode].freqs[x], dsp->sample_rate);
 			max = x + 1;
@@ -1668,6 +1672,7 @@
 		dsp->digitmode = DSP_DIGITMODE_DTMF;
 		dsp->faxmode = DSP_FAXMODE_DETECT_CNG;
 		dsp->sample_rate = sample_rate;
+		dsp->freqcount = 0;
 		/* Initialize digit detector */
 		ast_digit_detect_init(&dsp->digit_state, dsp->digitmode & DSP_DIGITMODE_MF, dsp->sample_rate);
 		dsp->display_inband_dtmf_warning = 1;

Modified: branches/13/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/main/manager.c?view=diff&rev=434114&r1=434113&r2=434114
==============================================================================
--- branches/13/main/manager.c (original)
+++ branches/13/main/manager.c Mon Apr  6 14:02:23 2015
@@ -4785,7 +4785,7 @@
 static int check_blacklist(const char *cmd)
 {
 	char *cmd_copy, *cur_cmd;
-	char *cmd_words[MAX_BLACKLIST_CMD_LEN] = { NULL, };
+	char *cmd_words[AST_MAX_CMD_LEN] = { NULL, };
 	int i;
 
 	cmd_copy = ast_strdupa(cmd);




More information about the asterisk-commits mailing list