[asterisk-commits] mmichelson: branch 1.4 r94420 - in /branches/1.4: apps/app_queue.c main/say.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Dec 21 09:45:14 CST 2007


Author: mmichelson
Date: Fri Dec 21 09:45:14 2007
New Revision: 94420

URL: http://svn.digium.com/view/asterisk?view=rev&rev=94420
Log:
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)


Modified:
    branches/1.4/apps/app_queue.c
    branches/1.4/main/say.c

Modified: branches/1.4/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_queue.c?view=diff&rev=94420&r1=94419&r2=94420
==============================================================================
--- branches/1.4/apps/app_queue.c (original)
+++ branches/1.4/apps/app_queue.c Fri Dec 21 09:45:14 2007
@@ -2079,6 +2079,7 @@
 				break;
 			/* On "ringall" strategy we only move to the next penalty level
 			   when *all* ringing phones are done in the current penalty level */
+			ast_log(LOG_DEBUG, "I actually hit this...\n");
 			ring_one(qe, outgoing, &numbusies);
 			/* and retry... */
 		}

Modified: branches/1.4/main/say.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/say.c?view=diff&rev=94420&r1=94419&r2=94420
==============================================================================
--- branches/1.4/main/say.c (original)
+++ branches/1.4/main/say.c Fri Dec 21 09:45:14 2007
@@ -468,7 +468,7 @@
 	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 @@
 			}
 		}
 		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 @@
 	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 @@
 			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 @@
 
 	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 @@
 			}
 		}
 		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 @@
 	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 @@
 			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 @@
 	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 @@
 		}
 		
 		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 @@
 		}
 
 		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 @@
 	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 @@
 			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 @@
 		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 @@
 			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 @@
 		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 @@
 				}
 			}
 			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 @@
 		}
 
 		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 @@
 	
 	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 @@
 		}
 		
 		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 @@
 	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 @@
 		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 @@
 			}
 		}
 		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 @@
 	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 @@
 				}
 			}
 			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 @@
 	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 @@
 				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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 						}
 						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 @@
 						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 @@
 				} 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 @@
 			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 @@
 			/* 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 @@
 			}
 		} 
 		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 @@
 		free(new_string);
 
 		remainder = s + 1;  /* position just after the found space char. */
-		while(*remainder == ' ')  /* skip multiple spaces */
+		while (*remainder == ' ')  /* skip multiple spaces */
 			remainder++;
 	}
 




More information about the asterisk-commits mailing list