Fix minor misuses of snprintf

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105841 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.1
Tilghman Lesher 17 years ago
parent cfc1df4c1a
commit 7007c565fe

@ -2735,8 +2735,8 @@ static void update_qe_rule(struct queue_ent *qe)
min_penalty = 0; min_penalty = 0;
if (min_penalty > max_penalty) if (min_penalty > max_penalty)
min_penalty = max_penalty; min_penalty = max_penalty;
snprintf(max_penalty_str, sizeof(max_penalty_str) - 1, "%d", max_penalty); snprintf(max_penalty_str, sizeof(max_penalty_str), "%d", max_penalty);
snprintf(min_penalty_str, sizeof(min_penalty_str) - 1, "%d", min_penalty); snprintf(min_penalty_str, sizeof(min_penalty_str), "%d", min_penalty);
pbx_builtin_setvar_helper(qe->chan, "QUEUE_MAX_PENALTY", max_penalty_str); pbx_builtin_setvar_helper(qe->chan, "QUEUE_MAX_PENALTY", max_penalty_str);
pbx_builtin_setvar_helper(qe->chan, "QUEUE_MIN_PENALTY", min_penalty_str); pbx_builtin_setvar_helper(qe->chan, "QUEUE_MIN_PENALTY", min_penalty_str);
qe->max_penalty = max_penalty; qe->max_penalty = max_penalty;

@ -10607,7 +10607,7 @@ static void *pri_dchannel(void *vpri)
} }
#endif #endif
snprintf(calledtonstr, sizeof(calledtonstr)-1, "%d", e->ring.calledplan); snprintf(calledtonstr, sizeof(calledtonstr), "%d", e->ring.calledplan);
pbx_builtin_setvar_helper(c, "CALLEDTON", calledtonstr); pbx_builtin_setvar_helper(c, "CALLEDTON", calledtonstr);
if (e->ring.redirectingreason >= 0) if (e->ring.redirectingreason >= 0)
pbx_builtin_setvar_helper(c, "PRIREDIRECTREASON", redirectingreason2str(e->ring.redirectingreason)); pbx_builtin_setvar_helper(c, "PRIREDIRECTREASON", redirectingreason2str(e->ring.redirectingreason));
@ -10652,7 +10652,7 @@ static void *pri_dchannel(void *vpri)
if (e->ring.redirectingreason >= 0) if (e->ring.redirectingreason >= 0)
pbx_builtin_setvar_helper(c, "PRIREDIRECTREASON", redirectingreason2str(e->ring.redirectingreason)); pbx_builtin_setvar_helper(c, "PRIREDIRECTREASON", redirectingreason2str(e->ring.redirectingreason));
snprintf(calledtonstr, sizeof(calledtonstr)-1, "%d", e->ring.calledplan); snprintf(calledtonstr, sizeof(calledtonstr), "%d", e->ring.calledplan);
pbx_builtin_setvar_helper(c, "CALLEDTON", calledtonstr); pbx_builtin_setvar_helper(c, "CALLEDTON", calledtonstr);
ast_mutex_lock(&pri->pvts[chanpos]->lock); ast_mutex_lock(&pri->pvts[chanpos]->lock);
@ -12522,7 +12522,7 @@ static int action_zapshowchannels(struct mansession *s, const struct message *m)
astman_send_ack(s, m, "Zapata channel status will follow"); astman_send_ack(s, m, "Zapata channel status will follow");
if (!ast_strlen_zero(id)) if (!ast_strlen_zero(id))
snprintf(idText, sizeof(idText) - 1, "ActionID: %s\r\n", id); snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id);
ast_mutex_lock(&iflock); ast_mutex_lock(&iflock);

@ -306,7 +306,7 @@ static void keypad_pick_up(struct video_desc *env)
char buf[160]; char buf[160];
const char *who = ast_skip_blanks(read_message(gui->bd_msg)); const char *who = ast_skip_blanks(read_message(gui->bd_msg));
buf[sizeof(buf) - 1] = '\0'; buf[sizeof(buf) - 1] = '\0';
snprintf(buf, sizeof(buf) - 1, "console dial %s", who); snprintf(buf, sizeof(buf), "console dial %s", who);
ast_log(LOG_WARNING, "doing <%s>\n", buf); ast_log(LOG_WARNING, "doing <%s>\n", buf);
print_message(gui->bd_dialed, "\n"); print_message(gui->bd_dialed, "\n");
print_message(gui->bd_dialed, who); print_message(gui->bd_dialed, who);

@ -2516,7 +2516,7 @@ static void ast_readconfig(void)
ast_copy_string(cfg_paths.config_dir, DEFAULT_CONFIG_DIR, sizeof(cfg_paths.config_dir)); ast_copy_string(cfg_paths.config_dir, DEFAULT_CONFIG_DIR, sizeof(cfg_paths.config_dir));
ast_copy_string(cfg_paths.spool_dir, DEFAULT_SPOOL_DIR, sizeof(cfg_paths.spool_dir)); ast_copy_string(cfg_paths.spool_dir, DEFAULT_SPOOL_DIR, sizeof(cfg_paths.spool_dir));
ast_copy_string(cfg_paths.module_dir, DEFAULT_MODULE_DIR, sizeof(cfg_paths.module_dir)); ast_copy_string(cfg_paths.module_dir, DEFAULT_MODULE_DIR, sizeof(cfg_paths.module_dir));
snprintf(cfg_paths.monitor_dir, sizeof(cfg_paths.monitor_dir) - 1, "%s/monitor", cfg_paths.spool_dir); snprintf(cfg_paths.monitor_dir, sizeof(cfg_paths.monitor_dir), "%s/monitor", cfg_paths.spool_dir);
ast_copy_string(cfg_paths.var_dir, DEFAULT_VAR_DIR, sizeof(cfg_paths.var_dir)); ast_copy_string(cfg_paths.var_dir, DEFAULT_VAR_DIR, sizeof(cfg_paths.var_dir));
ast_copy_string(cfg_paths.data_dir, DEFAULT_DATA_DIR, sizeof(cfg_paths.data_dir)); ast_copy_string(cfg_paths.data_dir, DEFAULT_DATA_DIR, sizeof(cfg_paths.data_dir));
ast_copy_string(cfg_paths.log_dir, DEFAULT_LOG_DIR, sizeof(cfg_paths.log_dir)); ast_copy_string(cfg_paths.log_dir, DEFAULT_LOG_DIR, sizeof(cfg_paths.log_dir));
@ -2548,7 +2548,7 @@ static void ast_readconfig(void)
ast_copy_string(cfg_paths.config_dir, v->value, sizeof(cfg_paths.config_dir)); ast_copy_string(cfg_paths.config_dir, v->value, sizeof(cfg_paths.config_dir));
} else if (!strcasecmp(v->name, "astspooldir")) { } else if (!strcasecmp(v->name, "astspooldir")) {
ast_copy_string(cfg_paths.spool_dir, v->value, sizeof(cfg_paths.spool_dir)); ast_copy_string(cfg_paths.spool_dir, v->value, sizeof(cfg_paths.spool_dir));
snprintf(cfg_paths.monitor_dir, sizeof(cfg_paths.monitor_dir) - 1, "%s/monitor", v->value); snprintf(cfg_paths.monitor_dir, sizeof(cfg_paths.monitor_dir), "%s/monitor", v->value);
} else if (!strcasecmp(v->name, "astvarlibdir")) { } else if (!strcasecmp(v->name, "astvarlibdir")) {
ast_copy_string(cfg_paths.var_dir, v->value, sizeof(cfg_paths.var_dir)); ast_copy_string(cfg_paths.var_dir, v->value, sizeof(cfg_paths.var_dir));
if (!found.dbdir) if (!found.dbdir)

Loading…
Cancel
Save