[Asterisk-cvs] asterisk say.c,1.36,1.37

markster at lists.digium.com markster at lists.digium.com
Mon Sep 6 21:26:09 CDT 2004


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv21352

Modified Files:
	say.c 
Log Message:
Compute power of 10 using ints instead of silly floats (bug #2390)


Index: say.c
===================================================================
RCS file: /usr/cvsroot/asterisk/say.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- say.c	6 Sep 2004 15:43:43 -0000	1.36
+++ say.c	7 Sep 2004 01:28:52 -0000	1.37
@@ -1194,6 +1194,14 @@
 	return res;
 }
 
+static int exp10_int(int power)
+{
+	int x, res= 1;
+	for (x=0;x<power;x++)
+		res *= 10;
+	return res;
+}
+
 typedef struct {  
 	char *separator_dziesiatek;
 	char *cyfry[10];
@@ -1776,7 +1784,7 @@
 			while ( (length % 3 ) != 1 ) {
 				length--;		
 			}
-			left = num / (exp10(length-1));
+			left = num / (exp10_int(length-1));
 			if ( left == 2 ) {  
 				switch (length-1) {
 					case 9: options = "w";  /* 1,000,000,000 gender female */
@@ -1796,7 +1804,7 @@
 			} else { /* left == 1 */
 				snprintf(fn, sizeof(fn), "digits/1_E%d",length-1);
 			}
-			num -= left * (exp10(length-1));
+			num -= left * (exp10_int(length-1));
 		}
 		if (!res) {
 			if(!ast_streamfile(chan, fn, language)) {




More information about the svn-commits mailing list