[Asterisk-code-review] build system: Fix some warnings highlighted by clang (asterisk[13])

George Joseph asteriskteam at digium.com
Mon Feb 1 15:56:52 CST 2016


George Joseph has uploaded a new change for review.

  https://gerrit.asterisk.org/2138

Change subject: build_system:  Fix some warnings highlighted by clang
......................................................................

build_system:  Fix some warnings highlighted by clang

Fix some warnings found with clang.

Change-Id: I5195b6189b148c2ee3ed4a19d015a6d4ef3e77bd
---
M addons/res_config_mysql.c
M apps/app_fax.c
M apps/app_meetme.c
M apps/app_minivm.c
M channels/chan_dahdi.c
M channels/chan_motif.c
M channels/sig_analog.c
M channels/sig_analog.h
M main/manager.c
M res/res_pjproject.c
10 files changed, 20 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/38/2138/1

diff --git a/addons/res_config_mysql.c b/addons/res_config_mysql.c
index 6e6224b..a417a26 100644
--- a/addons/res_config_mysql.c
+++ b/addons/res_config_mysql.c
@@ -1518,7 +1518,7 @@
 	ast_debug(1, "MySQL RealTime database name: %s\n", conn->name);
 	ast_debug(1, "MySQL RealTime user: %s\n", conn->user);
 	ast_debug(1, "MySQL RealTime password: %s\n", conn->pass);
-	if(conn->charset)
+	if(*conn->charset)
 		ast_debug(1, "MySQL RealTime charset: %s\n", conn->charset);
 
 	return 1;
@@ -1533,13 +1533,13 @@
 	/* mutex lock should have been locked before calling this function. */
 
 reconnect_tryagain:
-	if ((!conn->connected) && (!ast_strlen_zero(conn->host) || conn->sock) && !ast_strlen_zero(conn->user) && !ast_strlen_zero(conn->name)) {
+	if ((!conn->connected) && (!ast_strlen_zero(conn->host) || *conn->sock) && !ast_strlen_zero(conn->user) && !ast_strlen_zero(conn->name)) {
 		if (!mysql_init(&conn->handle)) {
 			ast_log(LOG_WARNING, "MySQL RealTime: Insufficient memory to allocate MySQL resource.\n");
 			conn->connected = 0;
 			return 0;
 		}
-		if(conn->charset && strlen(conn->charset) > 2){
+		if(strlen(conn->charset) > 2){
 			char set_names[255];
 			char statement[512];
 			snprintf(set_names, sizeof(set_names), "SET NAMES %s", conn->charset);
diff --git a/apps/app_fax.c b/apps/app_fax.c
index 7822a34..88aa6ad 100644
--- a/apps/app_fax.c
+++ b/apps/app_fax.c
@@ -356,8 +356,8 @@
 }
 
 static struct ast_generator generator = {
-	alloc:		fax_generator_alloc,
-	generate: 	fax_generator_generate,
+	.alloc = fax_generator_alloc,
+	.generate = fax_generator_generate,
 };
 
 
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index b2131ff..7903b1d 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -2936,7 +2936,7 @@
 		tweak_talk_volume(user, VOL_UP);
 		break;
 	default:
-		menu_mode = MENU_DISABLED;
+		*menu_mode = MENU_DISABLED;
 		/* Play an error message! */
 		if (!ast_streamfile(chan, "conf-errormenu", ast_channel_language(chan))) {
 			ast_waitstream(chan, "");
diff --git a/apps/app_minivm.c b/apps/app_minivm.c
index 45d04d8..5078159 100644
--- a/apps/app_minivm.c
+++ b/apps/app_minivm.c
@@ -2998,10 +2998,10 @@
 	ast_cli(a->fd, HVLT_OUTPUT_FORMAT, "-------------", "-------", "------", "------------", "-------");
 	AST_LIST_TRAVERSE(&message_templates, this, list) {
 		ast_cli(a->fd, HVLT_OUTPUT_FORMAT, this->name, 
-			this->charset ? this->charset : "-", 
-			this->locale ? this->locale : "-",
+			*this->charset ? this->charset : "-",
+			*this->locale ? this->locale : "-",
 			this->attachment ? "Yes" : "No",
-			this->subject ? this->subject : "-");
+			*this->subject ? this->subject : "-");
 		count++;
 	}
 	AST_LIST_UNLOCK(&message_templates);
@@ -3069,10 +3069,10 @@
 		if ((a->argc == 3) || ((a->argc == 5) && !strcmp(a->argv[4], vmu->domain))) {
 			count++;
 			snprintf(tmp, sizeof(tmp), "%s@%s", vmu->username, vmu->domain);
-			ast_cli(a->fd, HMSU_OUTPUT_FORMAT, tmp, vmu->etemplate ? vmu->etemplate : "-", 
-				vmu->ptemplate ? vmu->ptemplate : "-",
-				vmu->zonetag ? vmu->zonetag : "-", 
-				vmu->attachfmt ? vmu->attachfmt : "-",
+			ast_cli(a->fd, HMSU_OUTPUT_FORMAT, tmp, *vmu->etemplate ? vmu->etemplate : "-",
+				*vmu->ptemplate ? vmu->ptemplate : "-",
+				*vmu->zonetag ? vmu->zonetag : "-",
+				*vmu->attachfmt ? vmu->attachfmt : "-",
 				vmu->fullname);
 		}
 	}
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index ef0ad65..e9d0b5b 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -4705,7 +4705,7 @@
 	neg = (sample < 0 ? -1 : 1);
 	steep = drc*sample;
 	shallow = neg*(max-max/drc)+(float)sample/drc;
-	if (abs(steep) < abs(shallow)) {
+	if (fabsf(steep) < fabsf(shallow)) {
 		sample = steep;
 	}
 	else {
diff --git a/channels/chan_motif.c b/channels/chan_motif.c
index 24575fa..640976f 100644
--- a/channels/chan_motif.c
+++ b/channels/chan_motif.c
@@ -320,7 +320,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/channels/sig_analog.c b/channels/sig_analog.c
index 1d44a29..8b04b4e 100644
--- a/channels/sig_analog.c
+++ b/channels/sig_analog.c
@@ -70,7 +70,7 @@
 
 static const struct {
 	enum analog_sigtype sigtype;
-	const char const *name;
+	const char *name;
 } sigtypes[] = {
 	{ ANALOG_SIG_FXOLS, "fxo_ls" },
 	{ ANALOG_SIG_FXOKS, "fxo_ks" },
@@ -97,7 +97,7 @@
 
 static const struct {
 	unsigned int cid_type;
-	const char const *name;
+	const char *name;
 } cidtypes[] = {
 	{ CID_SIG_BELL,   "bell" },
 	{ CID_SIG_V23,    "v23" },
diff --git a/channels/sig_analog.h b/channels/sig_analog.h
index 6415b6e..d1e919b 100644
--- a/channels/sig_analog.h
+++ b/channels/sig_analog.h
@@ -99,6 +99,7 @@
 };
 
 enum analog_sub {
+	ANALOG_SUB_ERROR = -1,
 	ANALOG_SUB_REAL = 0,			/*!< Active call */
 	ANALOG_SUB_CALLWAIT,			/*!< Call-Waiting call on hold */
 	ANALOG_SUB_THREEWAY,			/*!< Three-way call */
diff --git a/main/manager.c b/main/manager.c
index 8478730..6ed6e11 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -2334,7 +2334,7 @@
 		"        write perm: %s\n"
 		"   displayconnects: %s\n"
 		"allowmultiplelogin: %s\n",
-		(user->username ? user->username : "(N/A)"),
+		(*user->username ? user->username : "(N/A)"),
 		(user->secret ? "<Set>" : "(N/A)"),
 		((user->acl && !ast_acl_list_is_empty(user->acl)) ? "yes" : "no"),
 		user_authority_to_str(user->readperm, &rauthority),
diff --git a/res/res_pjproject.c b/res/res_pjproject.c
index 2e092d7..cfad172 100644
--- a/res/res_pjproject.c
+++ b/res/res_pjproject.c
@@ -137,7 +137,9 @@
 	for (i = 0; i < AST_VECTOR_SIZE(&buildopts); i++) {
 		va_list arg_ptr;
 		va_start(arg_ptr, format_string);
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
 		res = vsscanf(AST_VECTOR_GET(&buildopts, i), format_temp, arg_ptr);
+#pragma GCC diagnostic warning "-Wformat-nonliteral"
 		va_end(arg_ptr);
 		if (res) {
 			break;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5195b6189b148c2ee3ed4a19d015a6d4ef3e77bd
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>



More information about the asterisk-code-review mailing list