aboutsummaryrefslogtreecommitdiffstats
path: root/main/say.c
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-12-21 15:45:14 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-12-21 15:45:14 +0000
commitcb6219ef7ac53fffb1f83533aa0ebb12f00f5b61 (patch)
treedd5ea57f5e8cf78afb68d5b333a48faf03783262 /main/say.c
parent51e709b541f52ff71840cad3abf9c1a81ace641e (diff)
Fixing Portuguese syntax for saying dates and times. Also some coding guidelines cleanup.
(closes issue #11599, reported and patched by caio1982, coding guidelines cleanup by me) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@94420 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/say.c')
-rw-r--r--main/say.c88
1 files changed, 42 insertions, 46 deletions
diff --git a/main/say.c b/main/say.c
index 336b7f5f5..ede9e98da 100644
--- a/main/say.c
+++ b/main/say.c
@@ -468,7 +468,7 @@ static int ast_say_number_full_en(struct ast_channel *chan, int num, const char
if (!num)
return ast_say_digits_full(chan, 0,ints, language, audiofd, ctrlfd);
- while(!res && (num || playh)) {
+ while (!res && (num || playh)) {
if (num < 0) {
snprintf(fn, sizeof(fn), "digits/minus");
if ( num > INT_MIN ) {
@@ -512,7 +512,7 @@ static int ast_say_number_full_en(struct ast_channel *chan, int num, const char
}
}
if (!res) {
- if(!ast_streamfile(chan, fn, language)) {
+ if (!ast_streamfile(chan, fn, language)) {
if ((audiofd > -1) && (ctrlfd > -1))
res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
else
@@ -570,7 +570,7 @@ static int ast_say_number_full_cz(struct ast_channel *chan, int num, const char
if (!num)
return ast_say_digits_full(chan, 0,ints, language, audiofd, ctrlfd);
- while(!res && (num || playh)) {
+ while (!res && (num || playh)) {
if (num < 0) {
snprintf(fn, sizeof(fn), "digits/minus");
if ( num > INT_MIN ) {
@@ -634,7 +634,7 @@ static int ast_say_number_full_cz(struct ast_channel *chan, int num, const char
num -= left * (exp10_int(length-1));
}
if (!res) {
- if(!ast_streamfile(chan, fn, language)) {
+ if (!ast_streamfile(chan, fn, language)) {
if ((audiofd > -1) && (ctrlfd > -1)) {
res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
} else {
@@ -663,7 +663,7 @@ static int ast_say_number_full_da(struct ast_channel *chan, int num, const char
if (options && !strncasecmp(options, "n",1)) cn = -1;
- while(!res && (num || playh || playa )) {
+ while (!res && (num || playh || playa )) {
/* The grammar for Danish numbers is the same as for English except
* for the following:
* - 1 exists in both commune ("en", file "1N") and neuter ("et", file "1")
@@ -743,7 +743,7 @@ static int ast_say_number_full_da(struct ast_channel *chan, int num, const char
}
}
if (!res) {
- if(!ast_streamfile(chan, fn, language)) {
+ if (!ast_streamfile(chan, fn, language)) {
if ((audiofd > -1) && (ctrlfd > -1))
res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
else
@@ -776,7 +776,7 @@ static int ast_say_number_full_de(struct ast_channel *chan, int num, const char
if (options && (!strncasecmp(options, "f",1)))
mf = -1;
- while(!res && num) {
+ while (!res && num) {
/* The grammar for German numbers is the same as for English except
* for the following:
* - numbers 20 through 99 are said in reverse order, i.e. 21 is
@@ -873,7 +873,7 @@ static int ast_say_number_full_de(struct ast_channel *chan, int num, const char
res = -1;
}
if (!res) {
- if(!ast_streamfile(chan, fn, language)) {
+ if (!ast_streamfile(chan, fn, language)) {
if ((audiofd > -1) && (ctrlfd > -1))
res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
else
@@ -908,7 +908,7 @@ static int ast_say_number_full_en_GB(struct ast_channel *chan, int num, const ch
if (!num)
return ast_say_digits_full(chan, 0,ints, language, audiofd, ctrlfd);
- while(!res && (num || playh || playa )) {
+ while (!res && (num || playh || playa )) {
if (num < 0) {
snprintf(fn, sizeof(fn), "digits/minus");
if ( num > INT_MIN ) {
@@ -959,7 +959,7 @@ static int ast_say_number_full_en_GB(struct ast_channel *chan, int num, const ch
}
if (!res) {
- if(!ast_streamfile(chan, fn, language)) {
+ if (!ast_streamfile(chan, fn, language)) {
if ((audiofd > -1) && (ctrlfd > -1))
res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
else
@@ -1063,7 +1063,7 @@ static int ast_say_number_full_es(struct ast_channel *chan, int num, const char
}
if (!res) {
- if(!ast_streamfile(chan, fn, language)) {
+ if (!ast_streamfile(chan, fn, language)) {
if ((audiofd > -1) && (ctrlfd > -1))
res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
else
@@ -1094,7 +1094,7 @@ static int ast_say_number_full_fr(struct ast_channel *chan, int num, const char
if (options && !strncasecmp(options, "f",1))
mf = -1;
- while(!res && (num || playh || playa)) {
+ while (!res && (num || playh || playa)) {
if (num < 0) {
snprintf(fn, sizeof(fn), "digits/minus");
if ( num > INT_MIN ) {
@@ -1155,7 +1155,7 @@ static int ast_say_number_full_fr(struct ast_channel *chan, int num, const char
res = -1;
}
if (!res) {
- if(!ast_streamfile(chan, fn, language)) {
+ if (!ast_streamfile(chan, fn, language)) {
if ((audiofd > -1) && (ctrlfd > -1))
res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
else
@@ -1233,7 +1233,7 @@ static int ast_say_number_full_he(struct ast_channel *chan, int num,
mf = -1;
/* Do we have work to do? */
- while(!res && (num || (state>0) )) {
+ while (!res && (num || (state>0) )) {
/* first type of work: play a second sound. In this loop
* we can only play one sound file at a time. Thus playing
* a second one requires repeating the loop just for the
@@ -1304,7 +1304,7 @@ static int ast_say_number_full_he(struct ast_channel *chan, int num,
res = -1;
}
if (!res) {
- if(!ast_streamfile(chan, fn, language)) {
+ if (!ast_streamfile(chan, fn, language)) {
if ((audiofd > -1) && (ctrlfd > -1))
res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
else
@@ -1351,7 +1351,7 @@ static int ast_say_number_full_it(struct ast_channel *chan, int num, const char
So the right file is provided.
*/
- while(!res && (num || playh)) {
+ while (!res && (num || playh)) {
if (num < 0) {
snprintf(fn, sizeof(fn), "digits/minus");
if ( num > INT_MIN ) {
@@ -1457,7 +1457,7 @@ static int ast_say_number_full_it(struct ast_channel *chan, int num, const char
}
}
if (!res) {
- if(!ast_streamfile(chan, fn, language)) {
+ if (!ast_streamfile(chan, fn, language)) {
if ((audiofd > -1) && (ctrlfd > -1))
res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
else
@@ -1548,7 +1548,7 @@ static int ast_say_number_full_nl(struct ast_channel *chan, int num, const char
}
if (!res) {
- if(!ast_streamfile(chan, fn, language)) {
+ if (!ast_streamfile(chan, fn, language)) {
if ((audiofd > -1) && (ctrlfd > -1))
res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
else
@@ -1577,7 +1577,7 @@ static int ast_say_number_full_no(struct ast_channel *chan, int num, const char
if (options && !strncasecmp(options, "n",1)) cn = -1;
- while(!res && (num || playh || playa )) {
+ while (!res && (num || playh || playa )) {
/* The grammar for Norwegian numbers is the same as for English except
* for the following:
* - 1 exists in both commune ("en", file "1") and neuter ("ett", file "1N")
@@ -1640,7 +1640,7 @@ static int ast_say_number_full_no(struct ast_channel *chan, int num, const char
}
if (!res) {
- if(!ast_streamfile(chan, fn, language)) {
+ if (!ast_streamfile(chan, fn, language)) {
if ((audiofd > -1) && (ctrlfd > -1))
res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
else
@@ -1964,7 +1964,7 @@ static int ast_say_number_full_pt(struct ast_channel *chan, int num, const char
if (options && !strncasecmp(options, "f",1))
mf = -1;
- while(!res && num ) {
+ while (!res && num ) {
if (num < 0) {
snprintf(fn, sizeof(fn), "digits/minus");
if ( num > INT_MIN ) {
@@ -2057,7 +2057,7 @@ static int ast_say_number_full_se(struct ast_channel *chan, int num, const char
return ast_say_digits_full(chan, 0,ints, language, audiofd, ctrlfd);
if (options && !strncasecmp(options, "n",1)) cn = -1;
- while(!res && (num || playh)) {
+ while (!res && (num || playh)) {
if (num < 0) {
snprintf(fn, sizeof(fn), "digits/minus");
if ( num > INT_MIN ) {
@@ -2106,7 +2106,7 @@ static int ast_say_number_full_se(struct ast_channel *chan, int num, const char
}
}
if (!res) {
- if(!ast_streamfile(chan, fn, language)) {
+ if (!ast_streamfile(chan, fn, language)) {
if ((audiofd > -1) && (ctrlfd > -1))
res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
else
@@ -2127,7 +2127,7 @@ static int ast_say_number_full_tw(struct ast_channel *chan, int num, const char
if (!num)
return ast_say_digits_full(chan, 0,ints, language, audiofd, ctrlfd);
- while(!res && (num || playh)) {
+ while (!res && (num || playh)) {
if (num < 0) {
snprintf(fn, sizeof(fn), "digits/minus");
if ( num > INT_MIN ) {
@@ -2171,7 +2171,7 @@ static int ast_say_number_full_tw(struct ast_channel *chan, int num, const char
}
}
if (!res) {
- if(!ast_streamfile(chan, fn, language)) {
+ if (!ast_streamfile(chan, fn, language)) {
if ((audiofd > -1) && (ctrlfd > -1))
res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
else
@@ -2219,7 +2219,7 @@ static int ast_say_number_full_ru(struct ast_channel *chan, int num, const char
if (!num)
return ast_say_digits_full(chan, 0,ints, language, audiofd, ctrlfd);
- while(!res && (num)) {
+ while (!res && (num)) {
if (num < 0) {
snprintf(fn, sizeof(fn), "digits/minus");
if ( num > INT_MIN ) {
@@ -2228,7 +2228,7 @@ static int ast_say_number_full_ru(struct ast_channel *chan, int num, const char
num = 0;
}
} else if (num < 20) {
- if(options && strlen(options) == 1 && num < 3) {
+ if (options && strlen(options) == 1 && num < 3) {
snprintf(fn, sizeof(fn), "digits/%d%s", num, options);
} else {
snprintf(fn, sizeof(fn), "digits/%d", num);
@@ -2313,7 +2313,7 @@ static int ast_say_enumeration_full_en(struct ast_channel *chan, int num, const
int res = 0, t = 0;
char fn[256] = "";
- while(!res && num) {
+ while (!res && num) {
if (num < 0) {
snprintf(fn, sizeof(fn), "digits/minus"); /* kind of senseless for enumerations, but our best effort for error checking */
if ( num > INT_MIN ) {
@@ -2424,7 +2424,7 @@ static int ast_say_enumeration_full_da(struct ast_channel *chan, int num, const
if (!num)
return ast_say_digits_full(chan, 0,ints, language, audiofd, ctrlfd);
- while(!res && num) {
+ while (!res && num) {
if (num < 0) {
snprintf(fn, sizeof(fn), "digits/minus"); /* kind of senseless for enumerations, but our best effort for error checking */
if ( num > INT_MIN ) {
@@ -2587,7 +2587,7 @@ static int ast_say_enumeration_full_de(struct ast_channel *chan, int num, const
if (!num)
return ast_say_digits_full(chan, 0,ints, language, audiofd, ctrlfd);
- while(!res && num) {
+ while (!res && num) {
if (num < 0) {
snprintf(fn, sizeof(fn), "digits/minus"); /* kind of senseless for enumerations, but our best effort for error checking */
if ( num > INT_MIN ) {
@@ -4908,7 +4908,7 @@ int ast_say_date_with_format_pt(struct ast_channel *chan, time_t time, const cha
char sndfile[256], nextmsg[256];
if (format == NULL)
- format = "Ad 'digits/pt-de' B 'digits/pt-de' Y 'digits/at' IMp";
+ format = "Ad 'digits/pt-de' B 'digits/pt-de' Y I 'digits/pt-e' Mp";
ast_localtime(&time,&tm,timezone);
@@ -4979,8 +4979,6 @@ int ast_say_date_with_format_pt(struct ast_channel *chan, time_t time, const cha
}
if (!res)
res = ast_say_number(chan, (tm.tm_hour % 12), ints, lang, "f");
- if ((!res) && (format[offset] == 'I'))
- res = ast_say_date_with_format(chan, time, ints, lang, "P", timezone);
}
} else {
if (tm.tm_hour == 0) {
@@ -5052,10 +5050,9 @@ int ast_say_date_with_format_pt(struct ast_channel *chan, time_t time, const cha
res = wait_file(chan, ints, "digits/pt-hora", lang);
if (tm.tm_hour != 1)
if (!res)
- res = wait_file(chan, ints, "digits/pt-sss", lang); } else {
- res = wait_file(chan,ints,"digits/pt-e",lang);
- if (!res)
- res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
+ res = wait_file(chan, ints, "digits/pt-sss", lang);
+ } else {
+ res = ast_say_number(chan, tm.tm_min, ints, lang, (char *) NULL);
}
}
break;
@@ -5240,12 +5237,12 @@ int ast_say_date_with_format_tw(struct ast_channel *chan, time_t time, const cha
} else {
snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_mday - (tm.tm_mday % 10));
res = wait_file(chan,ints,nextmsg,lang);
- if(!res) {
+ if (!res) {
snprintf(nextmsg,sizeof(nextmsg), "digits/%d", tm.tm_mday % 10);
res = wait_file(chan,ints,nextmsg,lang);
}
}
- if(!res) res = wait_file(chan,ints,"digits/day",lang);
+ if (!res) res = wait_file(chan,ints,"digits/day",lang);
break;
case 'Y':
/* Year */
@@ -6207,7 +6204,7 @@ static int ast_say_number_full_gr(struct ast_channel *chan, int num, const char
return ast_waitstream(chan, ints);
}
- while(!res && num ) {
+ while (!res && num ) {
i++;
if (num < 13) {
snprintf(fn, sizeof(fn), "digits/%d", num);
@@ -6220,15 +6217,14 @@ static int ast_say_number_full_gr(struct ast_channel *chan, int num, const char
/* 100 < num < 200 */
snprintf(fn, sizeof(fn), "digits/hundred-100");
num -= ((num / 100) * 100);
- }else if (num < 1000) {
+ } else if (num < 1000) {
/* 200 < num < 1000 */
snprintf(fn, sizeof(fn), "digits/hundred-%d", (num/100)*100);
num -= ((num / 100) * 100);
- }else if (num < 2000){
+ } else if (num < 2000){
snprintf(fn, sizeof(fn), "digits/xilia");
num -= ((num / 1000) * 1000);
- }
- else {
+ } else {
/* num > 1000 */
if (num < 1000000) {
res = ast_say_number_full_gr(chan, (num / 1000), ints, chan->language, audiofd, ctrlfd);
@@ -6250,7 +6246,7 @@ static int ast_say_number_full_gr(struct ast_channel *chan, int num, const char
}
}
if (!res) {
- if(!ast_streamfile(chan, fn, language)) {
+ if (!ast_streamfile(chan, fn, language)) {
if ((audiofd > -1) && (ctrlfd > -1))
res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
else
@@ -6773,7 +6769,7 @@ static int ast_say_number_full_ge(struct ast_channel *chan, int num, const char
free(new_string);
remainder = s + 1; /* position just after the found space char. */
- while(*remainder == ' ') /* skip multiple spaces */
+ while (*remainder == ' ') /* skip multiple spaces */
remainder++;
}