[svn-commits] murf: branch murf/bug_7635 r38651 - in /team/murf/bug_7635/pbx: ./ ael/ael-te...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Aug 1 11:44:30 MST 2006


Author: murf
Date: Tue Aug  1 13:44:29 2006
New Revision: 38651

URL: http://svn.digium.com/view/asterisk?rev=38651&view=rev
Log:
This small mod, which cleans the spaces from the appargs string,
before the '=', will prevent the problems reported by this bug.
A regression test has been included also.


Added:
    team/murf/bug_7635/pbx/ael/ael-test/ael-ntest12/
    team/murf/bug_7635/pbx/ael/ael-test/ael-ntest12/extensions.ael   (with props)
Modified:
    team/murf/bug_7635/pbx/pbx_ael.c

Added: team/murf/bug_7635/pbx/ael/ael-test/ael-ntest12/extensions.ael
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7635/pbx/ael/ael-test/ael-ntest12/extensions.ael?rev=38651&view=auto
==============================================================================
--- team/murf/bug_7635/pbx/ael/ael-test/ael-ntest12/extensions.ael (added)
+++ team/murf/bug_7635/pbx/ael/ael-test/ael-ntest12/extensions.ael Tue Aug  1 13:44:29 2006
@@ -1,0 +1,13 @@
+context test1
+{
+        771 => {
+                for(	i=0; 
+			${i} <= 3; 
+			i = ${i} + 1 )
+                        NoOp(i is '${i}');
+        }
+        772 => {
+                for(i=0; ${i} <= 3;i= ${i} + 1 )
+                        NoOp(i is '${i}');
+        }
+}

Propchange: team/murf/bug_7635/pbx/ael/ael-test/ael-ntest12/extensions.ael
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/murf/bug_7635/pbx/ael/ael-test/ael-ntest12/extensions.ael
------------------------------------------------------------------------------
    svn:keywords = Author Id Date Revision

Propchange: team/murf/bug_7635/pbx/ael/ael-test/ael-ntest12/extensions.ael
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/murf/bug_7635/pbx/pbx_ael.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7635/pbx/pbx_ael.c?rev=38651&r1=38650&r2=38651&view=diff
==============================================================================
--- team/murf/bug_7635/pbx/pbx_ael.c (original)
+++ team/murf/bug_7635/pbx/pbx_ael.c Tue Aug  1 13:44:29 2006
@@ -149,6 +149,8 @@
 
 static struct pval *find_label_in_current_extension(const char *label);
 static struct pval *find_label_in_current_db(const char *context, const char *exten, const char *label);
+static void remove_spaces_before_equals(char *str);
+
 
 /* PRETTY PRINTER FOR AEL:  ============================================================================= */
 
@@ -2526,6 +2528,25 @@
 	exten->next_exten = add;
 }
 
+static void remove_spaces_before_equals(char *str)
+{
+	char *p;
+	while( str && *str && *str != '=' )
+	{
+		if( *str == ' ' || *str == '\n' || *str == '\r' || *str == '\t' )
+		{
+			p = str;
+			while( *p )
+			{
+				*p = *(p+1);
+				p++;
+			}
+		}
+		else
+			str++;
+	}
+}
+
 void gen_prios(struct ael_extension *exten, char *label, pval *statement, struct ael_extension *mother_exten )
 {
 	pval *p,*p2,*p3;
@@ -2554,6 +2575,7 @@
 			pr->type = AEL_APPCALL;
 			snprintf(buf1,sizeof(buf1),"%s=$[%s]", p->u1.str, p->u2.val);
 			pr->app = strdup("Set");
+			remove_spaces_before_equals(buf1);
 			pr->appargs = strdup(buf1);
 			pr->origin = p;
 			linkprio(exten, pr);
@@ -2612,6 +2634,7 @@
 			for_init->app = strdup("Set");
 			
 			strcpy(buf2,p->u1.for_init);
+			remove_spaces_before_equals(buf2);
 			strp = strchr(buf2, '=');
 			strp2 = strchr(p->u1.for_init, '=');
 			if (strp) {
@@ -2626,6 +2649,7 @@
 			for_inc->app = strdup("Set");
 
 			strcpy(buf2,p->u3.for_inc);
+			remove_spaces_before_equals(buf2);
 			strp = strchr(buf2, '=');
 			strp2 = strchr(p->u3.for_inc, '=');
 			if (strp) {
@@ -3308,6 +3332,7 @@
 				np2->type = AEL_APPCALL;
 				np2->app = strdup("Set");
 				snprintf(buf,sizeof(buf),"%s=${ARG%d}", lp->u1.str, argc++);
+				remove_spaces_before_equals(buf);
 				np2->appargs = strdup(buf);
 				linkprio(exten, np2);
 			}



More information about the svn-commits mailing list