[Asterisk-code-review] BuildSystem: Fix a few issues hightlighted by gcc 6.x (asterisk[certified/11.6])

George Joseph asteriskteam at digium.com
Wed Jul 20 14:45:50 CDT 2016


George Joseph has uploaded a new change for review.

  https://gerrit.asterisk.org/3260

Change subject: BuildSystem:  Fix a few issues hightlighted by gcc 6.x
......................................................................

BuildSystem:  Fix a few issues hightlighted by gcc 6.x

gcc 6.1.1 caught a few more issues.
Made sure the unit tests still pass for the func_env and stdtime
issues.

ASTERISK-26157 #close

Change-Id: I6664d8f34a45bc1481d2a854481c7878b0c1cf8e
(cherry picked from commit 95d8b057602e35f2469f7c1d568677b29178ccdf)
---
M channels/chan_agent.c
M channels/chan_motif.c
M funcs/func_env.c
M main/say.c
M main/stdtime/localtime.c
5 files changed, 17 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/60/3260/1

diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index b9047fe..a8e84e7 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -212,7 +212,6 @@
 #define AST_MAX_BUF	256
 #define AST_MAX_FILENAME_LEN	256
 
-static const char pa_family[] = "Agents";          /*!< Persistent Agents astdb family */
 #define PA_MAX_LEN 2048                             /*!< The maximum length of each persistent member agent database entry */
 
 #define DEFAULT_ACCEPTDTMF '#'
@@ -1857,11 +1856,6 @@
 	ast_cli(a->fd, "\n");
 	return CLI_SUCCESS;
 }
-
-static const char agent_logoff_usage[] =
-"Usage: agent logoff <channel> [soft]\n"
-"       Sets an agent as no longer logged in.\n"
-"       If 'soft' is specified, do not hangup existing calls.\n";
 
 static struct ast_cli_entry cli_agents[] = {
 	AST_CLI_DEFINE(agents_show, "Show status of agents"),
diff --git a/channels/chan_motif.c b/channels/chan_motif.c
index 751e33a..e51c82a 100644
--- a/channels/chan_motif.c
+++ b/channels/chan_motif.c
@@ -173,7 +173,6 @@
 	struct ast_callid *callid;            /*!< Bound session call-id */
 };
 
-static const char desc[] = "Motif Jingle Channel";
 static const char channel_type[] = "Motif";
 
 struct jingle_config {
diff --git a/funcs/func_env.c b/funcs/func_env.c
index a2f7c2b..81b81d1 100644
--- a/funcs/func_env.c
+++ b/funcs/func_env.c
@@ -624,7 +624,7 @@
 				ast_log(LOG_ERROR, "Cannot seek to offset %" PRId64 ": %s\n", i, strerror(errno));
 			}
 			end = fread(fbuf, 1, sizeof(fbuf), ff);
-			for (pos = (end < sizeof(fbuf) ? fbuf + end - 1 : fbuf + sizeof(fbuf) - 1); pos > fbuf - 1; pos--) {
+			for (pos = (end < sizeof(fbuf) ? fbuf + end - 1 : fbuf + sizeof(fbuf) - 1); pos >= fbuf; pos--) {
 				LINE_COUNTER(pos, format, count);
 
 				if (length < 0 && count * -1 == length) {
@@ -1024,7 +1024,7 @@
 						fclose(ff);
 						return -1;
 					}
-					for (pos = fbuf + sizeof(fbuf) - 1; pos > fbuf - 1; pos--) {
+					for (pos = fbuf + sizeof(fbuf) - 1; pos >= fbuf; pos--) {
 						LINE_COUNTER(pos, newline_format, count);
 
 						if (length < 0 && count * -1 == length) {
diff --git a/main/say.c b/main/say.c
index 295d411..819ad31 100644
--- a/main/say.c
+++ b/main/say.c
@@ -5159,13 +5159,14 @@
 			case 'I':
 			case 'l':
 				/* 12-Hour */
-				if (tm.tm_hour == 0)
+				if (tm.tm_hour == 0) {
 					ast_copy_string(nextmsg, "digits/12", sizeof(nextmsg));
-				else if (tm.tm_hour > 12)
+				} else if (tm.tm_hour > 12) {
 					snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour - 12);
-				else
+				} else {
 					snprintf(nextmsg, sizeof(nextmsg), "digits/%d", tm.tm_hour);
-					res = wait_file(chan, ints, nextmsg, lang);
+				}
+				res = wait_file(chan, ints, nextmsg, lang);
 				break;
 			case 'H':
 			case 'k':
@@ -5185,11 +5186,12 @@
 			case 'P':
 			case 'p':
 				/* AM/PM */
-				if (tm.tm_hour > 11)
+				if (tm.tm_hour > 11) {
 					ast_copy_string(nextmsg, "digits/p-m", sizeof(nextmsg));
-				else
+				} else {
 					ast_copy_string(nextmsg, "digits/a-m", sizeof(nextmsg));
-					res = wait_file(chan, ints, nextmsg, lang);
+				}
+				res = wait_file(chan, ints, nextmsg, lang);
 				break;
 			case 'Q':
 				/* Shorthand for "Today", "Yesterday", or ABdY */
diff --git a/main/stdtime/localtime.c b/main/stdtime/localtime.c
index f7b4bd0..66dcb60 100644
--- a/main/stdtime/localtime.c
+++ b/main/stdtime/localtime.c
@@ -1663,13 +1663,14 @@
 		*dst_enabled = 0;
 		/* Find where I can get gmtoff */
 		i = 0;
-		while (sp->ttis[i].tt_isdst)
+		while (sp->ttis[i].tt_isdst) {
 			if (++i >= sp->typecnt) {
-			i = 0;
-			break;
+				i = 0;
+				break;
 			}
-			*gmt_off = sp->ttis[i].tt_gmtoff;
-			return;
+		}
+		*gmt_off = sp->ttis[i].tt_gmtoff;
+		return;
 	}
 
 	for (i = 1; i < sp->timecnt; ++i) {

-- 
To view, visit https://gerrit.asterisk.org/3260
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6664d8f34a45bc1481d2a854481c7878b0c1cf8e
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: certified/11.6
Gerrit-Owner: George Joseph <gjoseph at digium.com>



More information about the asterisk-code-review mailing list