[asterisk-commits] tilghman: trunk r81431 - in /trunk: ./ funcs/func_logic.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Sep 2 22:01:32 CDT 2007


Author: tilghman
Date: Sun Sep  2 22:01:31 2007
New Revision: 81431

URL: http://svn.digium.com/view/asterisk?view=rev&rev=81431
Log:
Merged revisions 81415 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r81415 | tilghman | 2007-08-31 14:16:52 -0500 (Fri, 31 Aug 2007) | 2 lines

The IF() function was not allowing true values that had embedded colons (closes issue #10613)

........

Modified:
    trunk/   (props changed)
    trunk/funcs/func_logic.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/funcs/func_logic.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_logic.c?view=diff&rev=81431&r1=81430&r2=81431
==============================================================================
--- trunk/funcs/func_logic.c (original)
+++ trunk/funcs/func_logic.c Sun Sep  2 22:01:31 2007
@@ -93,27 +93,30 @@
 static int acf_if(struct ast_channel *chan, const char *cmd, char *data, char *buf,
 		  size_t len)
 {
-	char *expr;
-	char *iftrue;
-	char *iffalse;
-
-	data = ast_strip_quoted(data, "\"", "\"");
-	expr = strsep(&data, "?");
-	iftrue = strsep(&data, ":");
-	iffalse = data;
-
-	if (ast_strlen_zero(expr) || !(iftrue || iffalse)) {
+	AST_DECLARE_APP_ARGS(args1,
+		AST_APP_ARG(expr);
+		AST_APP_ARG(remainder);
+	);
+	AST_DECLARE_APP_ARGS(args2,
+		AST_APP_ARG(iftrue);
+		AST_APP_ARG(iffalse);
+	);
+
+	AST_NONSTANDARD_APP_ARGS(args1, data, '?');
+	AST_NONSTANDARD_APP_ARGS(args2, args1.remainder, ':');
+
+	if (ast_strlen_zero(args1.expr) || !(args2.iftrue || args2.iffalse)) {
 		ast_log(LOG_WARNING, "Syntax IF(<expr>?[<true>][:<false>])\n");
 		return -1;
 	}
 
-	expr = ast_strip(expr);
-	if (iftrue)
-		iftrue = ast_strip_quoted(iftrue, "\"", "\"");
-	if (iffalse)
-		iffalse = ast_strip_quoted(iffalse, "\"", "\"");
-
-	ast_copy_string(buf, pbx_checkcondition(expr) ? (S_OR(iftrue, "")) : (S_OR(iffalse, "")), len);
+	args1.expr = ast_strip(args1.expr);
+	if (args2.iftrue)
+		args2.iftrue = ast_strip(args2.iftrue);
+	if (args2.iffalse)
+		args2.iffalse = ast_strip(args2.iffalse);
+
+	ast_copy_string(buf, pbx_checkcondition(args1.expr) ? (S_OR(args2.iftrue, "")) : (S_OR(args2.iffalse, "")), len);
 
 	return 0;
 }




More information about the asterisk-commits mailing list