Fix some warnings found with clang.
Change-Id: I5195b6189b148c2ee3ed4a19d015a6d4ef3e77bd
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;
/* 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);
}
static struct ast_generator generator = {
- alloc: fax_generator_alloc,
- generate: fax_generator_generate,
+ .alloc = fax_generator_alloc,
+ .generate = fax_generator_generate,
};
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, "");
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);
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);
}
}
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 {
struct ast_callid *callid; /*!< Bound session call-id */
};
-static const char desc[] = "Motif Jingle Channel";
static const char channel_type[] = "Motif";
struct jingle_config {
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" },
static const struct {
unsigned int cid_type;
- const char const *name;
+ const char *name;
} cidtypes[] = {
{ CID_SIG_BELL, "bell" },
{ CID_SIG_V23, "v23" },
{
int res, x;
int mysig;
- enum analog_sub idx;
+ int idx;
char *c;
pthread_t threadid;
struct ast_channel *chan;
" 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),
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;
return res;
}
+#pragma GCC diagnostic warning "-Wformat-nonliteral"
void ast_pjproject_log_intercept_begin(int fd)
{