build_system: Fix some warnings highlighted by clang

Fix some warnings found with clang.

Change-Id: I5195b6189b148c2ee3ed4a19d015a6d4ef3e77bd
changes/38/2138/5
George Joseph 9 years ago
parent 109b0aff6b
commit 8804d0973c

@ -1518,7 +1518,7 @@ static int load_mysql_config(struct ast_config *config, const char *category, st
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 @@ static int mysql_reconnect(struct mysql_conn *conn)
/* 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);

@ -356,8 +356,8 @@ static int fax_generator_generate(struct ast_channel *chan, void *data, int len,
}
static struct ast_generator generator = {
alloc: fax_generator_alloc,
generate: fax_generator_generate,
.alloc = fax_generator_alloc,
.generate = fax_generator_generate,
};

@ -2936,7 +2936,7 @@ static void meetme_menu_admin(enum menu_modes *menu_mode, int *dtmf, struct ast_
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, "");

@ -2998,10 +2998,10 @@ static char *handle_minivm_list_templates(struct ast_cli_entry *e, int cmd, stru
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 @@ static char *handle_minivm_show_users(struct ast_cli_entry *e, int cmd, struct a
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);
}
}

@ -4705,7 +4705,7 @@ static int drc_sample(int sample, float drc)
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 {

@ -320,7 +320,6 @@ struct jingle_session {
struct ast_callid *callid; /*!< Bound session call-id */
};
static const char desc[] = "Motif Jingle Channel";
static const char channel_type[] = "Motif";
struct jingle_config {

@ -70,7 +70,7 @@ static char analog_defaultozz[64] = "";
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 {
static const struct {
unsigned int cid_type;
const char const *name;
const char *name;
} cidtypes[] = {
{ CID_SIG_BELL, "bell" },
{ CID_SIG_V23, "v23" },
@ -2671,7 +2671,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
{
int res, x;
int mysig;
enum analog_sub idx;
int idx;
char *c;
pthread_t threadid;
struct ast_channel *chan;

@ -2334,7 +2334,7 @@ static char *handle_showmanager(struct ast_cli_entry *e, int cmd, struct ast_cli
" 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),

@ -125,6 +125,7 @@ static void capture_buildopts_cb(int level, const char *data, int len)
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 @@ int ast_pjproject_get_buildopt(char *option, char *format_string, ...)
return res;
}
#pragma GCC diagnostic warning "-Wformat-nonliteral"
void ast_pjproject_log_intercept_begin(int fd)
{

Loading…
Cancel
Save