[svn-commits] tilghman: branch 1.2 r66537 - /branches/1.2/funcs/func_strings.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue May 29 14:49:35 MST 2007


Author: tilghman
Date: Tue May 29 16:49:35 2007
New Revision: 66537

URL: http://svn.digium.com/view/asterisk?view=rev&rev=66537
Log:
If the value of a variable passed to FIELDQTY is blank, then FIELDQTY should return 0, not 1.

Modified:
    branches/1.2/funcs/func_strings.c

Modified: branches/1.2/funcs/func_strings.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/funcs/func_strings.c?view=diff&rev=66537&r1=66536&r2=66537
==============================================================================
--- branches/1.2/funcs/func_strings.c (original)
+++ branches/1.2/funcs/func_strings.c Tue May 29 16:49:35 2007
@@ -51,7 +51,9 @@
 
 		sprintf(varsubst, "${%s}", varname);
 		pbx_substitute_variables_helper(chan, varsubst, varval, sizeof(varval) - 1);
-		if (delim) {
+		if (ast_strlen_zero(varval))
+			fieldcount = 0;
+		else if (delim) {
 			while (strsep(&varval2, delim))
 				fieldcount++;
 		} else if (!ast_strlen_zero(varval)) {
@@ -60,7 +62,7 @@
 		snprintf(buf, len, "%d", fieldcount);
 	} else {
 		ast_log(LOG_ERROR, "Out of memory\n");
-		strncpy(buf, "1", len);
+		ast_copy_string(buf, "1", len);
 	}
 	return buf;
 }



More information about the svn-commits mailing list