[asterisk-commits] russell: branch 1.6.0 r106307 - in /branches/1.6.0: ./ apps/ channels/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 5 18:15:03 CST 2008


Author: russell
Date: Wed Mar  5 18:15:02 2008
New Revision: 106307

URL: http://svn.digium.com/view/asterisk?view=rev&rev=106307
Log:
Merged revisions 105841 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r105841 | tilghman | 2008-03-04 17:10:45 -0600 (Tue, 04 Mar 2008) | 2 lines

Fix minor misuses of snprintf

........

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/apps/app_queue.c
    branches/1.6.0/channels/chan_zap.c
    branches/1.6.0/channels/console_gui.c
    branches/1.6.0/main/asterisk.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
--- trunk-merged (original)
+++ trunk-merged Wed Mar  5 18:15:02 2008
@@ -1,1 +1,1 @@
-/trunk:1-105595,105675,105677,105733-105734,105773,105785,105804,105840,106036,106040,106139
+/trunk:1-105595,105675,105677,105733-105734,105773,105785,105804,105840-105841,106036,106040,106139

Modified: branches/1.6.0/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_queue.c?view=diff&rev=106307&r1=106306&r2=106307
==============================================================================
--- branches/1.6.0/apps/app_queue.c (original)
+++ branches/1.6.0/apps/app_queue.c Wed Mar  5 18:15:02 2008
@@ -583,7 +583,7 @@
 		if (qe->parent->callscompleted > 0) 
 			sl = 100 * ((float) qe->parent->callscompletedinsl / (float) qe->parent->callscompleted);
 
-		snprintf(interfacevar,sizeof(interfacevar),
+		snprintf(interfacevar, sizeof(interfacevar),
 			"QUEUENAME=%s|QUEUEMAX=%d|QUEUESTRATEGY=%s|QUEUECALLS=%d|QUEUEHOLDTIME=%d|QUEUECOMPLETED=%d|QUEUEABANDONED=%d|QUEUESRVLEVEL=%d|QUEUESRVLEVELPERF=%2.1f",
 			qe->parent->name, qe->parent->maxlen, int2strat(qe->parent->strategy), qe->parent->count, qe->parent->holdtime, qe->parent->callscompleted,
 			qe->parent->callsabandoned,  qe->parent->servicelevel, sl);
@@ -2735,8 +2735,8 @@
 		min_penalty = 0;
 	if (min_penalty > max_penalty)
 		min_penalty = max_penalty;
-	snprintf(max_penalty_str, sizeof(max_penalty_str) - 1, "%d", max_penalty);
-	snprintf(min_penalty_str, sizeof(min_penalty_str) - 1, "%d", min_penalty);
+	snprintf(max_penalty_str, sizeof(max_penalty_str), "%d", max_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_MIN_PENALTY", min_penalty_str);
 	qe->max_penalty = max_penalty;
@@ -3340,7 +3340,7 @@
 		/* if setinterfacevar is defined, make member variables available to the channel */
 		/* use  pbx_builtin_setvar to set a load of variables with one call */
 		if (qe->parent->setinterfacevar) {
-			snprintf(interfacevar,sizeof(interfacevar), "MEMBERINTERFACE=%s|MEMBERNAME=%s|MEMBERCALLS=%d|MEMBERLASTCALL=%ld|MEMBERPENALTY=%d|MEMBERDYNAMIC=%d|MEMBERREALTIME=%d",
+			snprintf(interfacevar, sizeof(interfacevar), "MEMBERINTERFACE=%s|MEMBERNAME=%s|MEMBERCALLS=%d|MEMBERLASTCALL=%ld|MEMBERPENALTY=%d|MEMBERDYNAMIC=%d|MEMBERREALTIME=%d",
 				member->interface, member->membername, member->calls, (long)member->lastcall, member->penalty, member->dynamic, member->realtime);
 		 	pbx_builtin_setvar(qe->chan, interfacevar);
 		}
@@ -3348,7 +3348,7 @@
 		/* if setqueueentryvar is defined, make queue entry (i.e. the caller) variables available to the channel */
 		/* use  pbx_builtin_setvar to set a load of variables with one call */
 		if (qe->parent->setqueueentryvar) {
-			snprintf(interfacevar,sizeof(interfacevar), "QEHOLDTIME=%ld|QEORIGINALPOS=%d",
+			snprintf(interfacevar, sizeof(interfacevar), "QEHOLDTIME=%ld|QEORIGINALPOS=%d",
 				(long) time(NULL) - qe->start, qe->opos);
 			pbx_builtin_setvar(qe->chan, interfacevar);
 		}
@@ -4581,7 +4581,7 @@
 		        if (q->callscompleted > 0)
 		                sl = 100 * ((float) q->callscompletedinsl / (float) q->callscompleted);
 
-		        snprintf(interfacevar,sizeof(interfacevar),
+		        snprintf(interfacevar, sizeof(interfacevar),
                 		"QUEUEMAX=%d|QUEUESTRATEGY=%s|QUEUECALLS=%d|QUEUEHOLDTIME=%d|QUEUECOMPLETED=%d|QUEUEABANDONED=%d|QUEUESRVLEVEL=%d|QUEUESRVLEVELPERF=%2.1f",
 		                q->maxlen, int2strat(q->strategy), q->count, q->holdtime, q->callscompleted, q->callsabandoned,  q->servicelevel, sl);
 

Modified: branches/1.6.0/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_zap.c?view=diff&rev=106307&r1=106306&r2=106307
==============================================================================
--- branches/1.6.0/channels/chan_zap.c (original)
+++ branches/1.6.0/channels/chan_zap.c Wed Mar  5 18:15:02 2008
@@ -10614,7 +10614,7 @@
 							}
 #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);
 							if (e->ring.redirectingreason >= 0)
 								pbx_builtin_setvar_helper(c, "PRIREDIRECTREASON", redirectingreason2str(e->ring.redirectingreason));
@@ -10659,7 +10659,7 @@
 								if (e->ring.redirectingreason >= 0)
 									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);
 
 								ast_mutex_lock(&pri->pvts[chanpos]->lock);
@@ -12529,7 +12529,7 @@
 
 	astman_send_ack(s, m, "Zapata channel status will follow");
 	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);
 	

Modified: branches/1.6.0/channels/console_gui.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/console_gui.c?view=diff&rev=106307&r1=106306&r2=106307
==============================================================================
--- branches/1.6.0/channels/console_gui.c (original)
+++ branches/1.6.0/channels/console_gui.c Wed Mar  5 18:15:02 2008
@@ -306,7 +306,7 @@
 		char buf[160];
 		const char *who = ast_skip_blanks(read_message(gui->bd_msg));
 		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);
 		print_message(gui->bd_dialed, "\n");
 		print_message(gui->bd_dialed, who);

Modified: branches/1.6.0/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/asterisk.c?view=diff&rev=106307&r1=106306&r2=106307
==============================================================================
--- branches/1.6.0/main/asterisk.c (original)
+++ branches/1.6.0/main/asterisk.c Wed Mar  5 18:15:02 2008
@@ -2201,7 +2201,7 @@
 	len = lf->cursor - ptr;
 
 	if (ast_opt_remote) {
-		snprintf(buf, sizeof(buf),"_COMMAND NUMMATCHES \"%s\" \"%s\"", lf->buffer, ptr); 
+		snprintf(buf, sizeof(buf), "_COMMAND NUMMATCHES \"%s\" \"%s\"", lf->buffer, ptr); 
 		fdprint(ast_consock, buf);
 		res = read(ast_consock, buf, sizeof(buf));
 		buf[res] = '\0';
@@ -2213,7 +2213,7 @@
 			/* Start with a 2048 byte buffer */			
 			if (!(mbuf = ast_malloc(maxmbuf)))
 				return (char *)(CC_ERROR);
-			snprintf(buf, sizeof(buf),"_COMMAND MATCHESARRAY \"%s\" \"%s\"", lf->buffer, ptr); 
+			snprintf(buf, sizeof(buf), "_COMMAND MATCHESARRAY \"%s\" \"%s\"", lf->buffer, ptr); 
 			fdprint(ast_consock, buf);
 			res = 0;
 			mbuf[0] = '\0';
@@ -2516,7 +2516,7 @@
 	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.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.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));
@@ -2548,7 +2548,7 @@
 			ast_copy_string(cfg_paths.config_dir, v->value, sizeof(cfg_paths.config_dir));
 		} else if (!strcasecmp(v->name, "astspooldir")) {
 			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")) {
 			ast_copy_string(cfg_paths.var_dir, v->value, sizeof(cfg_paths.var_dir));
 			if (!found.dbdir)




More information about the asterisk-commits mailing list