[asterisk-commits] russell: trunk r84173 - in /trunk: apps/ channels/ main/ pbx/ res/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Oct 1 10:23:19 CDT 2007
Author: russell
Date: Mon Oct 1 10:23:19 2007
New Revision: 84173
URL: http://svn.digium.com/view/asterisk?view=rev&rev=84173
Log:
Corydon posted this janitor project to the bug tracker and mvanbaak provided
a patch for it. It replaces a bunch of simple calls to snprintf with ast_copy_string
(closes issue #10843)
Reported by: Corydon76
Patches:
2007092900_10843.diff uploaded by mvanbaak (license 7)
Modified:
trunk/apps/app_meetme.c
trunk/apps/app_minivm.c
trunk/channels/chan_iax2.c
trunk/channels/chan_mgcp.c
trunk/channels/chan_misdn.c
trunk/channels/chan_sip.c
trunk/channels/chan_skinny.c
trunk/channels/iax2-parser.c
trunk/main/asterisk.c
trunk/main/frame.c
trunk/main/rtp.c
trunk/main/say.c
trunk/pbx/dundi-parser.c
trunk/res/res_config_odbc.c
Modified: trunk/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_meetme.c?view=diff&rev=84173&r1=84172&r2=84173
==============================================================================
--- trunk/apps/app_meetme.c (original)
+++ trunk/apps/app_meetme.c Mon Oct 1 10:23:19 2007
@@ -1477,7 +1477,7 @@
}
conf->recordingformat = pbx_builtin_getvar_helper(chan, "MEETME_RECORDINGFORMAT");
if (!conf->recordingformat) {
- snprintf(recordingtmp, sizeof(recordingtmp), "wav");
+ ast_copy_string(recordingtmp, "wav", sizeof(recordingtmp));
conf->recordingformat = ast_strdupa(recordingtmp);
}
ast_verb(4, "Starting recording of MeetMe Conference %s into file %s.%s.\n",
Modified: trunk/apps/app_minivm.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_minivm.c?view=diff&rev=84173&r1=84172&r2=84173
==============================================================================
--- trunk/apps/app_minivm.c (original)
+++ trunk/apps/app_minivm.c Mon Oct 1 10:23:19 2007
@@ -934,7 +934,7 @@
char tmpcmd[PATH_MAX];
int tmpfd;
- snprintf(newtmp, sizeof(newtmp), "/tmp/XXXXXX");
+ ast_copy_string(newtmp, "/tmp/XXXXXX", sizeof(newtmp));
ast_debug(3, "newtmp: %s\n", newtmp);
tmpfd = mkstemp(newtmp);
snprintf(tmpcmd, sizeof(tmpcmd), "sox -v %.4f %s.%s %s.%s", vmu->volgain, filename, format, newtmp, format);
Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=84173&r1=84172&r2=84173
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Mon Oct 1 10:23:19 2007
@@ -5969,9 +5969,9 @@
else if (reg->messages > 1)
snprintf(msgstatus, sizeof(msgstatus), " with %d new messages waiting\n", reg->messages);
else if (reg->messages > 0)
- snprintf(msgstatus, sizeof(msgstatus), " with 1 new message waiting\n");
+ ast_copy_string(msgstatus, " with 1 new message waiting\n", sizeof(msgstatus));
else
- snprintf(msgstatus, sizeof(msgstatus), " with no messages waiting\n");
+ ast_copy_string(msgstatus, " with no messages waiting\n", sizeof(msgstatus));
snprintf(ourip, sizeof(ourip), "%s:%d", ast_inet_ntoa(reg->us.sin_addr), ntohs(reg->us.sin_port));
ast_verb(3, "Registered IAX2 to '%s', who sees us as %s%s\n", ast_inet_ntoa(sin->sin_addr), ourip, msgstatus);
manager_event(EVENT_FLAG_SYSTEM, "Registry", "ChannelType: IAX2\r\nDomain: %s\r\nStatus: Registered\r\n", ast_inet_ntoa(sin->sin_addr));
Modified: trunk/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_mgcp.c?view=diff&rev=84173&r1=84172&r2=84173
==============================================================================
--- trunk/channels/chan_mgcp.c (original)
+++ trunk/channels/chan_mgcp.c Mon Oct 1 10:23:19 2007
@@ -882,7 +882,7 @@
ast_verb(3, "MGCP distinctive callwait %s\n", tone);
}
} else {
- snprintf(tone, sizeof(tone), "L/wt");
+ ast_copy_string(tone, "L/wt", sizeof(tone));
if (mgcpdebug) {
ast_verb(3, "MGCP normal callwait %s\n", tone);
}
@@ -896,7 +896,7 @@
ast_verb(3, "MGCP distinctive ring %s\n", tone);
}
} else {
- snprintf(tone, sizeof(tone), "L/rg");
+ ast_copy_string(tone, "L/rg", sizeof(tone));
if (mgcpdebug) {
ast_verb(3, "MGCP default ring\n");
}
@@ -1932,7 +1932,7 @@
}
if (!req->lines) {
/* Add extra empty return */
- snprintf(req->data + req->len, sizeof(req->data) - req->len, "\r\n");
+ ast_copy_string(req->data + req->len, "\r\n", sizeof(req->data) - req->len);
req->len += strlen(req->data + req->len);
}
req->line[req->lines] = req->data + req->len;
@@ -2065,11 +2065,11 @@
if (mgcpdebug) {
ast_verbose("We're at %s port %d\n", ast_inet_ntoa(p->parent->ourip), ntohs(sin.sin_port));
}
- snprintf(v, sizeof(v), "v=0\r\n");
+ ast_copy_string(v, "v=0\r\n", sizeof(v));
snprintf(o, sizeof(o), "o=root %d %d IN IP4 %s\r\n", (int)getpid(), (int)getpid(), ast_inet_ntoa(dest.sin_addr));
- snprintf(s, sizeof(s), "s=session\r\n");
+ ast_copy_string(s, "s=session\r\n", sizeof(s));
snprintf(c, sizeof(c), "c=IN IP4 %s\r\n", ast_inet_ntoa(dest.sin_addr));
- snprintf(t, sizeof(t), "t=0 0\r\n");
+ ast_copy_string(t, "t=0 0\r\n", sizeof(t));
snprintf(m, sizeof(m), "m=audio %d RTP/AVP", ntohs(dest.sin_port));
for (x = 1; x <= AST_FORMAT_MAX_AUDIO; x <<= 1) {
if (p->capability & x) {
@@ -2136,7 +2136,7 @@
ast_rtp_get_peer(rtp, &sub->tmpdest);
return 0;
}
- snprintf(local, sizeof(local), "p:20");
+ ast_copy_string(local, "p:20", sizeof(local));
for (x=1;x<= AST_FORMAT_MAX_AUDIO; x <<= 1) {
if (p->capability & x) {
snprintf(tmp, sizeof(tmp), ", a:%s", ast_rtp_lookup_mime_subtype(1, x, 0));
@@ -2166,7 +2166,7 @@
int x;
struct mgcp_endpoint *p = sub->parent;
- snprintf(local, sizeof(local), "p:20");
+ ast_copy_string(local, "p:20", sizeof(local));
for (x=1;x<= AST_FORMAT_MAX_AUDIO; x <<= 1) {
if (p->capability & x) {
snprintf(tmp, sizeof(tmp), ", a:%s", ast_rtp_lookup_mime_subtype(1, x, 0));
Modified: trunk/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_misdn.c?view=diff&rev=84173&r1=84172&r2=84173
==============================================================================
--- trunk/channels/chan_misdn.c (original)
+++ trunk/channels/chan_misdn.c Mon Oct 1 10:23:19 2007
@@ -1701,7 +1701,7 @@
misdn_cfg_get(bc->port, MISDN_CFG_ECHOCANCEL, &ec, sizeof(ec));
if (ec == 1)
- snprintf(bc->pipeline, sizeof(bc->pipeline), "mg2ec");
+ ast_copy_string(bc->pipeline, "mg2ec", sizeof(bc->pipeline));
else if (ec > 1)
snprintf(bc->pipeline, sizeof(bc->pipeline), "mg2ec(deftaps=%d)", ec);
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=84173&r1=84172&r2=84173
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Mon Oct 1 10:23:19 2007
@@ -2586,7 +2586,7 @@
{
if (!req->lines) {
/* Add extra empty return. add_header() reserves 4 bytes so cannot be truncated */
- snprintf(req->data + req->len, sizeof(req->data) - req->len, "\r\n");
+ ast_copy_string(req->data + req->len, "\r\n", sizeof(req->data) - req->len);
req->len += strlen(req->data + req->len);
}
}
@@ -6175,7 +6175,7 @@
}
if (!req->lines) {
/* Add extra empty return */
- snprintf(req->data + req->len, sizeof(req->data) - req->len, "\r\n");
+ ast_copy_string(req->data + req->len, "\r\n", sizeof(req->data) - req->len);
req->len += strlen(req->data + req->len);
}
if (req->len >= sizeof(req->data) - 4) {
Modified: trunk/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_skinny.c?view=diff&rev=84173&r1=84172&r2=84173
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Mon Oct 1 10:23:19 2007
@@ -4221,8 +4221,8 @@
return -1;
req->data.speeddialreq.speedDialNumber = htolel(instance);
- snprintf(req->data.speeddial.speedDialDirNumber, sizeof(req->data.speeddial.speedDialDirNumber), sd->exten);
- snprintf(req->data.speeddial.speedDialDisplayName, sizeof(req->data.speeddial.speedDialDisplayName), sd->label);
+ ast_copy_string(req->data.speeddial.speedDialDirNumber, sd->exten, sizeof(req->data.speeddial.speedDialDirNumber));
+ ast_copy_string(req->data.speeddial.speedDialDisplayName, sd->label, sizeof(req->data.speeddial.speedDialDisplayName));
transmit_response(s, req);
return 1;
@@ -4442,7 +4442,7 @@
if (!(req = req_alloc(sizeof(struct version_res_message), VERSION_RES_MESSAGE)))
return -1;
- snprintf(req->data.version.version, sizeof(req->data.version.version), d->version_id);
+ ast_copy_string(req->data.version.version, d->version_id, sizeof(req->data.version.version));
transmit_response(s, req);
return 1;
}
Modified: trunk/channels/iax2-parser.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/iax2-parser.c?view=diff&rev=84173&r1=84172&r2=84173
==============================================================================
--- trunk/channels/iax2-parser.c (original)
+++ trunk/channels/iax2-parser.c Mon Oct 1 10:23:19 2007
@@ -82,7 +82,7 @@
memcpy(&sin, value, len);
snprintf(output, maxlen, "IPV4 %s:%d", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
} else {
- snprintf(output, maxlen, "Invalid Address");
+ ast_copy_string(output, "Invalid Address", maxlen);
}
}
Modified: trunk/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/main/asterisk.c?view=diff&rev=84173&r1=84172&r2=84173
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Mon Oct 1 10:23:19 2007
@@ -1880,7 +1880,7 @@
} else if (remotehostname)
snprintf(prompt, sizeof(prompt), ASTERISK_PROMPT2, remotehostname);
else
- snprintf(prompt, sizeof(prompt), ASTERISK_PROMPT);
+ ast_copy_string(prompt, ASTERISK_PROMPT, sizeof(prompt));
return(prompt);
}
@@ -2206,7 +2206,7 @@
snprintf(tmp, sizeof(tmp), "core set debug atleast %d", option_debug);
fdprint(ast_consock, tmp);
if (ast_opt_mute) {
- snprintf(tmp, sizeof(tmp), "log and verbose output currently muted ('logger unmute' to unmute)");
+ ast_copy_string(tmp, "log and verbose output currently muted ('logger unmute' to unmute)", sizeof(tmp));
fdprint(ast_consock, tmp);
}
ast_verbose("Connected to Asterisk %s currently running on %s (pid = %d)\n", version, hostname, pid);
Modified: trunk/main/frame.c
URL: http://svn.digium.com/view/asterisk/trunk/main/frame.c?view=diff&rev=84173&r1=84172&r2=84173
==============================================================================
--- trunk/main/frame.c (original)
+++ trunk/main/frame.c Mon Oct 1 10:23:19 2007
@@ -555,7 +555,7 @@
}
}
if (start == end)
- snprintf(start, size, "nothing)");
+ ast_copy_string(start, "nothing)", size);
else if (size > 1)
*(end -1) = ')';
return buf;
Modified: trunk/main/rtp.c
URL: http://svn.digium.com/view/asterisk/trunk/main/rtp.c?view=diff&rev=84173&r1=84172&r2=84173
==============================================================================
--- trunk/main/rtp.c (original)
+++ trunk/main/rtp.c Mon Oct 1 10:23:19 2007
@@ -2113,7 +2113,7 @@
}
if (start == end)
- snprintf(start, size, "nothing)");
+ ast_copy_string(start, "nothing)", size);
else if (size > 1)
*(end -1) = ')';
Modified: trunk/main/say.c
URL: http://svn.digium.com/view/asterisk/trunk/main/say.c?view=diff&rev=84173&r1=84172&r2=84173
==============================================================================
--- trunk/main/say.c (original)
+++ trunk/main/say.c Mon Oct 1 10:23:19 2007
@@ -486,14 +486,14 @@
while (!res && (num || playh)) {
if (num < 0) {
- snprintf(fn, sizeof(fn), "digits/minus");
+ ast_copy_string(fn, "digits/minus", sizeof(fn));
if ( num > INT_MIN ) {
num = -num;
} else {
num = 0;
}
} else if (playh) {
- snprintf(fn, sizeof(fn), "digits/hundred");
+ ast_copy_string(fn, "digits/hundred", sizeof(fn));
playh = 0;
} else if (num < 20) {
snprintf(fn, sizeof(fn), "digits/%d", num);
@@ -588,7 +588,7 @@
while (!res && (num || playh)) {
if (num < 0) {
- snprintf(fn, sizeof(fn), "digits/minus");
+ ast_copy_string(fn, "digits/minus", sizeof(fn));
if ( num > INT_MIN ) {
num = -num;
} else {
@@ -608,17 +608,17 @@
} else if (num < 1000) {
hundered = num / 100;
if ( hundered == 1 ) {
- snprintf(fn, sizeof(fn), "digits/1sto");
+ ast_copy_string(fn, "digits/1sto", sizeof(fn));
} else if ( hundered == 2 ) {
- snprintf(fn, sizeof(fn), "digits/2ste");
+ ast_copy_string(fn, "digits/2ste", sizeof(fn));
} else {
res = ast_say_number_full_cz(chan,hundered,ints,language,options,audiofd,ctrlfd);
if (res)
return res;
if (hundered == 3 || hundered == 4) {
- snprintf(fn, sizeof(fn), "digits/sta");
+ ast_copy_string(fn, "digits/sta", sizeof(fn));
} else if ( hundered > 4 ) {
- snprintf(fn, sizeof(fn), "digits/set");
+ ast_copy_string(fn, "digits/set", sizeof(fn));
}
}
num -= (hundered * 100);
@@ -691,20 +691,20 @@
* four-and thirty" and 1000012 is "one million and twelve".
*/
if (num < 0) {
- snprintf(fn, sizeof(fn), "digits/minus");
+ ast_copy_string(fn, "digits/minus", sizeof(fn));
if ( num > INT_MIN ) {
num = -num;
} else {
num = 0;
}
} else if (playh) {
- snprintf(fn, sizeof(fn), "digits/hundred");
+ ast_copy_string(fn, "digits/hundred", sizeof(fn));
playh = 0;
} else if (playa) {
- snprintf(fn, sizeof(fn), "digits/and");
+ ast_copy_string(fn, "digits/and", sizeof(fn));
playa = 0;
} else if (num == 1 && cn == -1) {
- snprintf(fn, sizeof(fn), "digits/1N");
+ ast_copy_string(fn, "digits/1N", sizeof(fn));
num = 0;
} else if (num < 20) {
snprintf(fn, sizeof(fn), "digits/%d", num);
@@ -722,7 +722,7 @@
if (num < 1000) {
int hundreds = num / 100;
if (hundreds == 1)
- snprintf(fn, sizeof(fn), "digits/1N");
+ ast_copy_string(fn, "digits/1N", sizeof(fn));
else
snprintf(fn, sizeof(fn), "digits/%d", (num / 100));
@@ -737,7 +737,7 @@
if (res)
return res;
num = num % 1000;
- snprintf(fn, sizeof(fn), "digits/thousand");
+ ast_copy_string(fn, "digits/thousand", sizeof(fn));
} else {
if (num < 1000000000) {
int millions = num / 1000000;
@@ -745,9 +745,9 @@
if (res)
return res;
if (millions == 1)
- snprintf(fn, sizeof(fn), "digits/million");
+ ast_copy_string(fn, "digits/million", sizeof(fn));
else
- snprintf(fn, sizeof(fn), "digits/millions");
+ ast_copy_string(fn, "digits/millions", sizeof(fn));
num = num % 1000000;
} else {
ast_debug(1, "Number '%d' is too big for me\n", num);
@@ -804,14 +804,14 @@
* - "million" is different in singular and plural form
*/
if (num < 0) {
- snprintf(fn, sizeof(fn), "digits/minus");
+ ast_copy_string(fn, "digits/minus", sizeof(fn));
if ( num > INT_MIN ) {
num = -num;
} else {
num = 0;
}
} else if (num < 100 && t) {
- snprintf(fn, sizeof(fn), "digits/and");
+ ast_copy_string(fn, "digits/and", sizeof(fn));
t = 0;
} else if (num == 1 && mf == -1) {
snprintf(fn, sizeof(fn), "digits/%dF", num);
@@ -829,60 +829,60 @@
num = 0;
}
} else if (num == 100 && t == 0) {
- snprintf(fn, sizeof(fn), "digits/hundred");
+ ast_copy_string(fn, "digits/hundred", sizeof(fn));
num = 0;
} else if (num < 1000) {
int hundreds = num / 100;
num = num % 100;
if (hundreds == 1) {
- snprintf(fn, sizeof(fn), "digits/1N");
+ ast_copy_string(fn, "digits/1N", sizeof(fn));
} else {
snprintf(fn, sizeof(fn), "digits/%d", hundreds);
}
- snprintf(fna, sizeof(fna), "digits/hundred");
+ ast_copy_string(fna, "digits/hundred", sizeof(fna));
t = 1;
} else if (num == 1000 && t == 0) {
- snprintf(fn, sizeof(fn), "digits/thousand");
+ ast_copy_string(fn, "digits/thousand", sizeof(fn));
num = 0;
} else if (num < 1000000) {
int thousands = num / 1000;
num = num % 1000;
t = 1;
if (thousands == 1) {
- snprintf(fn, sizeof(fn), "digits/1N");
- snprintf(fna, sizeof(fna), "digits/thousand");
+ ast_copy_string(fn, "digits/1N", sizeof(fn));
+ ast_copy_string(fna, "digits/thousand", sizeof(fna));
} else {
res = ast_say_number_full_de(chan, thousands, ints, language, options, audiofd, ctrlfd);
if (res)
return res;
- snprintf(fn, sizeof(fn), "digits/thousand");
+ ast_copy_string(fn, "digits/thousand", sizeof(fn));
}
} else if (num < 1000000000) {
int millions = num / 1000000;
num = num % 1000000;
t = 1;
if (millions == 1) {
- snprintf(fn, sizeof(fn), "digits/1F");
- snprintf(fna, sizeof(fna), "digits/million");
+ ast_copy_string(fn, "digits/1F", sizeof(fn));
+ ast_copy_string(fna, "digits/million", sizeof(fna));
} else {
res = ast_say_number_full_de(chan, millions, ints, language, options, audiofd, ctrlfd);
if (res)
return res;
- snprintf(fn, sizeof(fn), "digits/millions");
+ ast_copy_string(fn, "digits/millions", sizeof(fn));
}
} else if (num <= INT_MAX) {
int billions = num / 1000000000;
num = num % 1000000000;
t = 1;
if (billions == 1) {
- snprintf(fn, sizeof(fn), "digits/1F");
- snprintf(fna, sizeof(fna), "digits/milliard");
+ ast_copy_string(fn, "digits/1F", sizeof(fn));
+ ast_copy_string(fna, "digits/milliard", sizeof(fna));
} else {
res = ast_say_number_full_de(chan, billions, ints, language, options, audiofd, ctrlfd);
if (res) {
return res;
}
- snprintf(fn, sizeof(fn), "digits/milliards");
+ ast_copy_string(fn, "digits/milliards", sizeof(fn));
}
} else {
ast_debug(1, "Number '%d' is too big for me\n", num);
@@ -926,17 +926,17 @@
while (!res && (num || playh || playa )) {
if (num < 0) {
- snprintf(fn, sizeof(fn), "digits/minus");
+ ast_copy_string(fn, "digits/minus", sizeof(fn));
if ( num > INT_MIN ) {
num = -num;
} else {
num = 0;
}
} else if (playh) {
- snprintf(fn, sizeof(fn), "digits/hundred");
+ ast_copy_string(fn, "digits/hundred", sizeof(fn));
playh = 0;
} else if (playa) {
- snprintf(fn, sizeof(fn), "digits/and");
+ ast_copy_string(fn, "digits/and", sizeof(fn));
playa = 0;
} else if (num < 20) {
snprintf(fn, sizeof(fn), "digits/%d", num);
@@ -1158,7 +1158,7 @@
res = ast_say_number_full_fr(chan, num / 1000, ints, language, options, audiofd, ctrlfd);
if (res)
return res;
- snprintf(fn, sizeof(fn), "digits/thousand");
+ ast_copy_string(fn, "digits/thousand", sizeof(fn));
num = num % 1000;
} else if (num < 1000000000) {
res = ast_say_number_full_fr(chan, num / 1000000, ints, language, options, audiofd, ctrlfd);
@@ -1262,13 +1262,13 @@
num, state, options, mf
);
if (state==1) {
- snprintf(fn, sizeof(fn), "digits/hundred");
+ ast_copy_string(fn, "digits/hundred", sizeof(fn));
state = 0;
} else if (state==2) {
- snprintf(fn, sizeof(fn), "digits/ve");
+ ast_copy_string(fn, "digits/ve", sizeof(fn));
state = 0;
} else if (state==3) {
- snprintf(fn, sizeof(fn), "digits/thousands");
+ ast_copy_string(fn, "digits/thousands", sizeof(fn));
state=0;
} else if (num <21) {
if (mf < 0)
@@ -1281,11 +1281,11 @@
num = num % 10;
if (num>0) state=2;
} else if (num < 200) {
- snprintf(fn, sizeof(fn), "digits/1hundred");
+ ast_copy_string(fn, "digits/1hundred", sizeof(fn));
num = num - 100;
state=2;
} else if (num < 300) {
- snprintf(fn, sizeof(fn), "digits/2hundred");
+ ast_copy_string(fn, "digits/2hundred", sizeof(fn));
num = num - 200;
state=2;
} else if (num < 1000) {
@@ -1293,10 +1293,10 @@
state=1;
num = num % 100;
} else if (num < 2000) {
- snprintf(fn, sizeof(fn), "digits/thousand");
+ ast_copy_string(fn, "digits/thousand", sizeof(fn));
num = num - 1000;
} else if (num < 3000) {
- snprintf(fn, sizeof(fn), "digits/2thousand");
+ ast_copy_string(fn, "digits/2thousand", sizeof(fn));
num = num - 2000;
if (num>0) state=2;
} else if (num < 20000) {
@@ -1307,13 +1307,13 @@
res = ast_say_number_full_he(chan, num / 1000, ints, language, options, audiofd, ctrlfd);
if (res)
return res;
- snprintf(fn, sizeof(fn), "digits/thousand");
+ ast_copy_string(fn, "digits/thousand", sizeof(fn));
num = num % 1000;
} else if (num < 1000000000) {
res = ast_say_number_full_he(chan, num / 1000000, ints, language, options, audiofd, ctrlfd);
if (res)
return res;
- snprintf(fn, sizeof(fn), "digits/million");
+ ast_copy_string(fn, "digits/million", sizeof(fn));
num = num % 1000000;
} else {
ast_debug(1, "Number '%d' is too big for me\n", num);
@@ -1450,14 +1450,14 @@
while (!res && (num || playh)) {
if (num < 0) {
- snprintf(fn, sizeof(fn), "digits/minus");
+ ast_copy_string(fn, "digits/minus", sizeof(fn));
if ( num > INT_MIN ) {
num = -num;
} else {
num = 0;
}
} else if (playh) {
- snprintf(fn, sizeof(fn), "digits/hundred");
+ ast_copy_string(fn, "digits/hundred", sizeof(fn));
playh = 0;
} else if (num < 20) {
snprintf(fn, sizeof(fn), "digits/%d", num);
@@ -1519,7 +1519,7 @@
snprintf(fn, sizeof(fn), "digits/%d", (num/100));
playh++;
} else {
- snprintf(fn, sizeof(fn), "digits/hundred");
+ ast_copy_string(fn, "digits/hundred", sizeof(fn));
}
num %= 100;
} else {
@@ -1531,9 +1531,9 @@
tempnum = num;
num %= 1000;
if ((tempnum / 1000) < 2)
- snprintf(fn, sizeof(fn), "digits/thousand");
+ ast_copy_string(fn, "digits/thousand", sizeof(fn));
else /* for 1000 it says mille, for >1000 (eg 2000) says mila */
- snprintf(fn, sizeof(fn), "digits/thousands");
+ ast_copy_string(fn, "digits/thousands", sizeof(fn));
} else {
if (num < 1000000000) { /* 1,000,000,000 */
if ((num / 1000000) > 1)
@@ -1543,9 +1543,9 @@
tempnum = num;
num %= 1000000;
if ((tempnum / 1000000) < 2)
- snprintf(fn, sizeof(fn), "digits/million");
+ ast_copy_string(fn, "digits/million", sizeof(fn));
else
- snprintf(fn, sizeof(fn), "digits/millions");
+ ast_copy_string(fn, "digits/millions", sizeof(fn));
} else {
ast_debug(1, "Number '%d' is too big for me\n", num);
res = -1;
@@ -1579,14 +1579,14 @@
return ast_say_digits_full(chan, 0,ints, language, audiofd, ctrlfd);
while (!res && (num || playh )) {
if (num < 0) {
- snprintf(fn, sizeof(fn), "digits/minus");
+ ast_copy_string(fn, "digits/minus", sizeof(fn));
if ( num > INT_MIN ) {
num = -num;
} else {
num = 0;
}
} else if (playh) {
- snprintf(fn, sizeof(fn), "digits/hundred");
+ ast_copy_string(fn, "digits/hundred", sizeof(fn));
playh = 0;
} else if (num < 20) {
snprintf(fn, sizeof(fn), "digits/%d", num);
@@ -1598,7 +1598,7 @@
if (res)
return res;
num = num - units;
- snprintf(fn, sizeof(fn), "digits/nl-en");
+ ast_copy_string(fn, "digits/nl-en", sizeof(fn));
} else {
snprintf(fn, sizeof(fn), "digits/%d", num - units);
num = 0;
@@ -1682,20 +1682,20 @@
* thirty-four" and 1000012 is "one million and twelve".
*/
if (num < 0) {
- snprintf(fn, sizeof(fn), "digits/minus");
+ ast_copy_string(fn, "digits/minus", sizeof(fn));
if ( num > INT_MIN ) {
num = -num;
} else {
num = 0;
}
} else if (playh) {
- snprintf(fn, sizeof(fn), "digits/hundred");
+ ast_copy_string(fn, "digits/hundred", sizeof(fn));
playh = 0;
} else if (playa) {
- snprintf(fn, sizeof(fn), "digits/and");
+ ast_copy_string(fn, "digits/and", sizeof(fn));
playa = 0;
} else if (num == 1 && cn == -1) {
- snprintf(fn, sizeof(fn), "digits/1N");
+ ast_copy_string(fn, "digits/1N", sizeof(fn));
num = 0;
} else if (num < 20) {
snprintf(fn, sizeof(fn), "digits/%d", num);
@@ -1706,7 +1706,7 @@
} else if (num < 1000) {
int hundreds = num / 100;
if (hundreds == 1)
- snprintf(fn, sizeof(fn), "digits/1N");
+ ast_copy_string(fn, "digits/1N", sizeof(fn));
else
snprintf(fn, sizeof(fn), "digits/%d", (num / 100));
@@ -2063,7 +2063,7 @@
while (!res && num ) {
if (num < 0) {
- snprintf(fn, sizeof(fn), "digits/minus");
+ ast_copy_string(fn, "digits/minus", sizeof(fn));
if ( num > INT_MIN ) {
num = -num;
} else {
@@ -2082,9 +2082,9 @@
num = num % 10;
} else if (num < 1000) {
if (num == 100)
- snprintf(fn, sizeof(fn), "digits/100");
+ ast_copy_string(fn, "digits/100", sizeof(fn));
else if (num < 200)
- snprintf(fn, sizeof(fn), "digits/100E");
+ ast_copy_string(fn, "digits/100E", sizeof(fn));
else {
if (mf < 0 && num > 199)
snprintf(fn, sizeof(fn), "digits/%dF", (num / 100) * 100);
@@ -2100,7 +2100,7 @@
if (res)
return res;
}
- snprintf(fn, sizeof(fn), "digits/1000");
+ ast_copy_string(fn, "digits/1000", sizeof(fn));
if ((num % 1000) && ((num % 1000) < 100 || !(num % 100)))
playh = 1;
num = num % 1000;
@@ -2109,9 +2109,9 @@
if (res)
return res;
if (num < 2000000)
- snprintf(fn, sizeof(fn), "digits/1000000");
+ ast_copy_string(fn, "digits/1000000", sizeof(fn));
else
- snprintf(fn, sizeof(fn), "digits/1000000S");
+ ast_copy_string(fn, "digits/1000000S", sizeof(fn));
if ((num % 1000000) &&
/* no thousands */
@@ -2156,14 +2156,14 @@
while (!res && (num || playh)) {
if (num < 0) {
- snprintf(fn, sizeof(fn), "digits/minus");
+ ast_copy_string(fn, "digits/minus", sizeof(fn));
if ( num > INT_MIN ) {
num = -num;
} else {
num = 0;
}
} else if (playh) {
- snprintf(fn, sizeof(fn), "digits/hundred");
+ ast_copy_string(fn, "digits/hundred", sizeof(fn));
playh = 0;
} else if (num < 20) {
snprintf(fn, sizeof(fn), "digits/%d", num);
@@ -2172,7 +2172,7 @@
snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);
num %= 10;
} else if (num == 1 && cn == -1) { /* En eller ett? */
- snprintf(fn, sizeof(fn), "digits/1N");
+ ast_copy_string(fn, "digits/1N", sizeof(fn));
num = 0;
} else {
if (num < 1000){
@@ -2226,14 +2226,14 @@
while (!res && (num || playh)) {
if (num < 0) {
- snprintf(fn, sizeof(fn), "digits/minus");
+ ast_copy_string(fn, "digits/minus", sizeof(fn));
if ( num > INT_MIN ) {
num = -num;
} else {
num = 0;
}
} else if (playh) {
- snprintf(fn, sizeof(fn), "digits/hundred");
+ ast_copy_string(fn, "digits/hundred", sizeof(fn));
playh = 0;
} else if (num < 10) {
snprintf(fn, sizeof(fn), "digits/%d", num);
@@ -2318,7 +2318,7 @@
while (!res && (num)) {
if (num < 0) {
- snprintf(fn, sizeof(fn), "digits/minus");
+ ast_copy_string(fn, "digits/minus", sizeof(fn));
if ( num > INT_MIN ) {
num = -num;
} else {
@@ -2348,11 +2348,11 @@
if (res)
return res;
if (lastdigits == 1) {
- snprintf(fn, sizeof(fn), "digits/thousand");
+ ast_copy_string(fn, "digits/thousand", sizeof(fn));
} else if (lastdigits > 1 && lastdigits < 5) {
- snprintf(fn, sizeof(fn), "digits/thousands-i");
+ ast_copy_string(fn, "digits/thousands-i", sizeof(fn));
} else {
- snprintf(fn, sizeof(fn), "digits/thousands");
+ ast_copy_string(fn, "digits/thousands", sizeof(fn));
}
num %= 1000;
} else if (num < 1000000000) { /* 1,000,000,000 */
@@ -2362,11 +2362,11 @@
if (res)
return res;
if (lastdigits == 1) {
- snprintf(fn, sizeof(fn), "digits/million");
+ ast_copy_string(fn, "digits/million", sizeof(fn));
} else if (lastdigits > 1 && lastdigits < 5) {
- snprintf(fn, sizeof(fn), "digits/million-a");
+ ast_copy_string(fn, "digits/million-a", sizeof(fn));
} else {
- snprintf(fn, sizeof(fn), "digits/millions");
+ ast_copy_string(fn, "digits/millions", sizeof(fn));
}
num %= 1000000;
} else {
@@ -2396,14 +2396,14 @@
while(!res && (num || playh)) {
if (num < 0) {
- snprintf(fn, sizeof(fn), "digits/lop");
+ ast_copy_string(fn, "digits/lop", sizeof(fn));
if ( num > INT_MIN ) {
num = -num;
} else {
num = 0;
}
} else if (playh) {
- snprintf(fn, sizeof(fn), "digits/roi");
+ ast_copy_string(fn, "digits/roi", sizeof(fn));
playh = 0;
} else if (num < 100) {
if ((num <= 20) || ((num % 10) == 1)) {
@@ -2480,7 +2480,7 @@
while (!res && num) {
if (num < 0) {
- snprintf(fn, sizeof(fn), "digits/minus"); /* kind of senseless for enumerations, but our best effort for error checking */
+ ast_copy_string(fn, "digits/minus", sizeof(fn)); /* kind of senseless for enumerations, but our best effort for error checking */
if ( num > INT_MIN ) {
num = -num;
} else {
@@ -2506,9 +2506,9 @@
if (res)
return res;
if (num) {
- snprintf(fn, sizeof(fn), "digits/hundred");
+ ast_copy_string(fn, "digits/hundred", sizeof(fn));
} else {
- snprintf(fn, sizeof(fn), "digits/h-hundred");
+ ast_copy_string(fn, "digits/h-hundred", sizeof(fn));
}
} else if (num < 1000000) {
int thousands = num / 1000;
@@ -2519,9 +2519,9 @@
if (res)
return res;
if (num) {
- snprintf(fn, sizeof(fn), "digits/thousand");
+ ast_copy_string(fn, "digits/thousand", sizeof(fn));
} else {
- snprintf(fn, sizeof(fn), "digits/h-thousand");
+ ast_copy_string(fn, "digits/h-thousand", sizeof(fn));
}
t = 1;
} else if (num < 1000000000) {
@@ -2532,9 +2532,9 @@
if (res)
return res;
if (num) {
- snprintf(fn, sizeof(fn), "digits/million");
+ ast_copy_string(fn, "digits/million", sizeof(fn));
} else {
- snprintf(fn, sizeof(fn), "digits/h-million");
+ ast_copy_string(fn, "digits/h-million", sizeof(fn));
}
} else if (num < INT_MAX) {
int billions = num / 1000000000;
@@ -2544,12 +2544,12 @@
if (res)
return res;
if (num) {
- snprintf(fn, sizeof(fn), "digits/billion");
+ ast_copy_string(fn, "digits/billion", sizeof(fn));
} else {
- snprintf(fn, sizeof(fn), "digits/h-billion");
+ ast_copy_string(fn, "digits/h-billion", sizeof(fn));
}
} else if (num == INT_MAX) {
- snprintf(fn, sizeof(fn), "digits/h-last");
+ ast_copy_string(fn, "digits/h-last", sizeof(fn));
num = 0;
} else {
ast_debug(1, "Number '%d' is too big for me\n", num);
@@ -2591,14 +2591,14 @@
while (!res && num) {
if (num < 0) {
- snprintf(fn, sizeof(fn), "digits/minus"); /* kind of senseless for enumerations, but our best effort for error checking */
+ ast_copy_string(fn, "digits/minus", sizeof(fn)); /* kind of senseless for enumerations, but our best effort for error checking */
if ( num > INT_MIN ) {
num = -num;
} else {
num = 0;
}
} else if (num < 100 && t) {
- snprintf(fn, sizeof(fn), "digits/and");
+ ast_copy_string(fn, "digits/and", sizeof(fn));
t = 0;
} else if (num < 20) {
snprintf(fn, sizeof(fn), "digits/h-%d%s", num, gender);
@@ -2619,12 +2619,12 @@
int hundreds = num / 100;
num = num % 100;
if (hundreds == 1) {
- snprintf(fn, sizeof(fn), "digits/1N");
+ ast_copy_string(fn, "digits/1N", sizeof(fn));
} else {
snprintf(fn, sizeof(fn), "digits/%d", hundreds);
}
if (num) {
- snprintf(fna, sizeof(fna), "digits/hundred");
+ ast_copy_string(fna, "digits/hundred", sizeof(fna));
} else {
snprintf(fna, sizeof(fna), "digits/h-hundred%s", gender);
}
@@ -2634,11 +2634,11 @@
num = num % 1000;
if (thousands == 1) {
if (num) {
- snprintf(fn, sizeof(fn), "digits/1N");
- snprintf(fna, sizeof(fna), "digits/thousand");
+ ast_copy_string(fn, "digits/1N", sizeof(fn));
+ ast_copy_string(fna, "digits/thousand", sizeof(fna));
} else {
if (t) {
- snprintf(fn, sizeof(fn), "digits/1N");
+ ast_copy_string(fn, "digits/1N", sizeof(fn));
snprintf(fna, sizeof(fna), "digits/h-thousand%s", gender);
} else {
snprintf(fn, sizeof(fn), "digits/h-thousand%s", gender);
@@ -2650,7 +2650,7 @@
return res;
}
if (num) {
- snprintf(fn, sizeof(fn), "digits/thousand");
+ ast_copy_string(fn, "digits/thousand", sizeof(fn));
} else {
snprintf(fn, sizeof(fn), "digits/h-thousand%s", gender);
}
@@ -2661,10 +2661,10 @@
num = num % 1000000;
if (millions == 1) {
if (num) {
- snprintf(fn, sizeof(fn), "digits/1F");
- snprintf(fna, sizeof(fna), "digits/million");
+ ast_copy_string(fn, "digits/1F", sizeof(fn));
+ ast_copy_string(fna, "digits/million", sizeof(fna));
} else {
- snprintf(fn, sizeof(fn), "digits/1N");
+ ast_copy_string(fn, "digits/1N", sizeof(fn));
snprintf(fna, sizeof(fna), "digits/h-million%s", gender);
}
} else {
@@ -2673,7 +2673,7 @@
return res;
}
if (num) {
- snprintf(fn, sizeof(fn), "digits/millions");
+ ast_copy_string(fn, "digits/millions", sizeof(fn));
} else {
snprintf(fn, sizeof(fn), "digits/h-million%s", gender);
}
@@ -2684,10 +2684,10 @@
num = num % 1000000000;
if (billions == 1) {
if (num) {
- snprintf(fn, sizeof(fn), "digits/1F");
- snprintf(fna, sizeof(fna), "digits/milliard");
+ ast_copy_string(fn, "digits/1F", sizeof(fn));
+ ast_copy_string(fna, "digits/milliard", sizeof(fna));
} else {
- snprintf(fn, sizeof(fn), "digits/1N");
+ ast_copy_string(fn, "digits/1N", sizeof(fn));
snprintf(fna, sizeof(fna), "digits/h-milliard%s", gender);
}
} else {
@@ -2695,7 +2695,7 @@
if (res)
return res;
if (num) {
- snprintf(fn, sizeof(fna), "digits/milliards");
+ ast_copy_string(fn, "digits/milliards", sizeof(fna));
} else {
snprintf(fn, sizeof(fna), "digits/h-milliard%s", gender);
}
@@ -2754,14 +2754,14 @@
while (!res && num) {
if (num < 0) {
- snprintf(fn, sizeof(fn), "digits/minus"); /* kind of senseless for enumerations, but our best effort for error checking */
+ ast_copy_string(fn, "digits/minus", sizeof(fn)); /* kind of senseless for enumerations, but our best effort for error checking */
if ( num > INT_MIN ) {
num = -num;
} else {
num = 0;
}
} else if (num < 100 && t) {
- snprintf(fn, sizeof(fn), "digits/and");
+ ast_copy_string(fn, "digits/and", sizeof(fn));
t = 0;
} else if (num < 20) {
snprintf(fn, sizeof(fn), "digits/h-%d%s", num, gender);
@@ -2782,12 +2782,12 @@
int hundreds = num / 100;
num = num % 100;
if (hundreds == 1) {
- snprintf(fn, sizeof(fn), "digits/1N");
+ ast_copy_string(fn, "digits/1N", sizeof(fn));
} else {
snprintf(fn, sizeof(fn), "digits/%d", hundreds);
}
if (num) {
- snprintf(fna, sizeof(fna), "digits/hundred");
+ ast_copy_string(fna, "digits/hundred", sizeof(fna));
} else {
snprintf(fna, sizeof(fna), "digits/h-hundred%s", gender);
}
@@ -2797,11 +2797,11 @@
num = num % 1000;
if (thousands == 1) {
if (num) {
- snprintf(fn, sizeof(fn), "digits/1N");
- snprintf(fna, sizeof(fna), "digits/thousand");
+ ast_copy_string(fn, "digits/1N", sizeof(fn));
+ ast_copy_string(fna, "digits/thousand", sizeof(fna));
} else {
if (t) {
- snprintf(fn, sizeof(fn), "digits/1N");
+ ast_copy_string(fn, "digits/1N", sizeof(fn));
snprintf(fna, sizeof(fna), "digits/h-thousand%s", gender);
} else {
snprintf(fn, sizeof(fn), "digits/h-thousand%s", gender);
@@ -2813,7 +2813,7 @@
return res;
}
if (num) {
- snprintf(fn, sizeof(fn), "digits/thousand");
+ ast_copy_string(fn, "digits/thousand", sizeof(fn));
} else {
snprintf(fn, sizeof(fn), "digits/h-thousand%s", gender);
}
@@ -2824,10 +2824,10 @@
num = num % 1000000;
if (millions == 1) {
if (num) {
- snprintf(fn, sizeof(fn), "digits/1F");
- snprintf(fna, sizeof(fna), "digits/million");
+ ast_copy_string(fn, "digits/1F", sizeof(fn));
+ ast_copy_string(fna, "digits/million", sizeof(fna));
} else {
- snprintf(fn, sizeof(fn), "digits/1N");
+ ast_copy_string(fn, "digits/1N", sizeof(fn));
snprintf(fna, sizeof(fna), "digits/h-million%s", gender);
}
} else {
@@ -2836,7 +2836,7 @@
return res;
}
if (num) {
- snprintf(fn, sizeof(fn), "digits/millions");
+ ast_copy_string(fn, "digits/millions", sizeof(fn));
} else {
snprintf(fn, sizeof(fn), "digits/h-million%s", gender);
}
@@ -2847,10 +2847,10 @@
num = num % 1000000000;
if (billions == 1) {
if (num) {
- snprintf(fn, sizeof(fn), "digits/1F");
- snprintf(fna, sizeof(fna), "digits/milliard");
+ ast_copy_string(fn, "digits/1F", sizeof(fn));
+ ast_copy_string(fna, "digits/milliard", sizeof(fna));
} else {
- snprintf(fn, sizeof(fn), "digits/1N");
+ ast_copy_string(fn, "digits/1N", sizeof(fn));
snprintf(fna, sizeof(fna), "digits/h-milliard%s", gender);
}
} else {
@@ -2858,7 +2858,7 @@
if (res)
return res;
if (num) {
- snprintf(fn, sizeof(fna), "digits/milliards");
+ ast_copy_string(fn, "digits/milliards", sizeof(fna));
} else {
snprintf(fn, sizeof(fna), "digits/h-milliard%s", gender);
}
@@ -3153,7 +3153,7 @@
if (!res) {
snprintf(fn, sizeof(fn), "digits/day-%d", tm.tm_wday);
res = ast_streamfile(chan, fn, lang);
- snprintf(fn, sizeof(fn), "digits/tee");
+ ast_copy_string(fn, "digits/tee", sizeof(fn));
res = ast_streamfile(chan, fn, lang);
if (!res)
res = ast_waitstream(chan, ints);
@@ -3163,7 +3163,7 @@
if (!res)
res = ast_waitstream(chan, ints);
if (!res) {
- snprintf(fn, sizeof(fn), "digits/duan");
+ ast_copy_string(fn, "digits/duan", sizeof(fn));
res = ast_streamfile(chan, fn, lang);
snprintf(fn, sizeof(fn), "digits/mon-%d", tm.tm_mon);
res = ast_streamfile(chan, fn, lang);
@@ -3171,7 +3171,7 @@
res = ast_waitstream(chan, ints);
}
if (!res){
- snprintf(fn, sizeof(fn), "digits/posor");
+ ast_copy_string(fn, "digits/posor", sizeof(fn));
res = ast_streamfile(chan, fn, lang);
res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
}
@@ -3309,7 +3309,7 @@
case 'l':
/* 12-Hour */
if (tm.tm_hour == 0)
- snprintf(nextmsg,sizeof(nextmsg), "digits/12");
+ ast_copy_string(nextmsg, "digits/12", sizeof(nextmsg));
else if (tm.tm_hour > 12)
snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_hour - 12);
else
@@ -3367,9 +3367,9 @@
case 'p':
/* AM/PM */
if (tm.tm_hour > 11)
- snprintf(nextmsg,sizeof(nextmsg), "digits/p-m");
+ ast_copy_string(nextmsg, "digits/p-m", sizeof(nextmsg));
else
- snprintf(nextmsg,sizeof(nextmsg), "digits/a-m");
+ ast_copy_string(nextmsg, "digits/a-m", sizeof(nextmsg));
res = wait_file(chan,ints,nextmsg,lang);
break;
case 'Q':
@@ -3557,7 +3557,7 @@
/* 12-Hour */
res = wait_file(chan,ints,"digits/oclock",lang);
if (tm.tm_hour == 0)
- snprintf(nextmsg,sizeof(nextmsg), "digits/12");
+ ast_copy_string(nextmsg, "digits/12", sizeof(nextmsg));
else if (tm.tm_hour > 12)
snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_hour - 12);
else
@@ -3593,9 +3593,9 @@
case 'p':
/* AM/PM */
if (tm.tm_hour > 11)
- snprintf(nextmsg,sizeof(nextmsg), "digits/p-m");
+ ast_copy_string(nextmsg, "digits/p-m", sizeof(nextmsg));
[... 292 lines stripped ...]
More information about the asterisk-commits
mailing list