[asterisk-commits] build system: Fix some warnings highlighted by clang (asterisk[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Feb 2 06:01:32 CST 2016
Joshua Colp has submitted this change and it was merged.
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 main/manager.c
M res/res_pjproject.c
9 files changed, 20 insertions(+), 19 deletions(-)
Approvals:
Richard Mudgett: Looks good to me, but someone else must approve
Anonymous Coward #1000019: Verified
Joshua Colp: Looks good to me, approved
diff --git a/addons/res_config_mysql.c b/addons/res_config_mysql.c
index a805cb4..c9fa7c7 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(!ast_strlen_zero(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) || !ast_strlen_zero(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 d6e9b4d..bf57d82 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 ab6b94f..791f75e 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 4b1c4b5..e97150b 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 : "-",
+ S_OR(this->charset, "-"),
+ S_OR(this->locale, "-"),
this->attachment ? "Yes" : "No",
- this->subject ? this->subject : "-");
+ S_OR(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, S_OR(vmu->etemplate, "-"),
+ S_OR(vmu->ptemplate, "-"),
+ S_OR(vmu->zonetag, "-"),
+ S_OR(vmu->attachfmt, "-"),
vmu->fullname);
}
}
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 697c720..2d92343 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -4704,7 +4704,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 15a7b4d..118d1d9 100644
--- a/channels/chan_motif.c
+++ b/channels/chan_motif.c
@@ -320,7 +320,6 @@
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 0608c34..110942c 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" },
@@ -2670,7 +2670,7 @@
{
int res, x;
int mysig;
- enum analog_sub idx;
+ int idx;
char *c;
pthread_t threadid;
struct ast_channel *chan;
diff --git a/main/manager.c b/main/manager.c
index 6c692d5..2adcb3e 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -2342,7 +2342,7 @@
" write perm: %s\n"
" displayconnects: %s\n"
"allowmultiplelogin: %s\n",
- (user->username ? user->username : "(N/A)"),
+ S_OR(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 e9f0d15..9e08bf3 100644
--- a/res/res_pjproject.c
+++ b/res/res_pjproject.c
@@ -125,6 +125,7 @@
AST_VECTOR_ADD_SORTED(&buildopts, ast_strdup(ast_skip_blanks(data)), strcmp);
}
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
int ast_pjproject_get_buildopt(char *option, char *format_string, ...)
{
int res = 0;
@@ -146,6 +147,7 @@
return res;
}
+#pragma GCC diagnostic warning "-Wformat-nonliteral"
void ast_pjproject_log_intercept_begin(int fd)
{
--
To view, visit https://gerrit.asterisk.org/2139
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5195b6189b148c2ee3ed4a19d015a6d4ef3e77bd
Gerrit-PatchSet: 5
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
More information about the asterisk-commits
mailing list