[asterisk-commits] tilghman: branch 1.6.2 r197247 - in /branches/1.6.2: ./ funcs/func_cut.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 27 14:30:11 CDT 2009


Author: tilghman
Date: Wed May 27 14:30:06 2009
New Revision: 197247

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=197247
Log:
Recorded merge of revisions 197209 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r197209 | tilghman | 2009-05-27 14:20:56 -0500 (Wed, 27 May 2009) | 12 lines
  
  Recorded merge of revisions 197194 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r197194 | tilghman | 2009-05-27 14:09:42 -0500 (Wed, 27 May 2009) | 5 lines
    
    Use a different determinator on whether to print the delimiter, since leading fields may be blank.
    (closes issue #15208)
     Reported by: ramonpeek
     Patch by me, though inspired in part by a patch from ramonpeek
  ........
................

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/funcs/func_cut.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.2/funcs/func_cut.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.2/funcs/func_cut.c?view=diff&rev=197247&r1=197246&r2=197247
==============================================================================
--- branches/1.6.2/funcs/func_cut.c (original)
+++ branches/1.6.2/funcs/func_cut.c Wed May 27 14:30:06 2009
@@ -190,7 +190,7 @@
 		pbx_substitute_variables_helper(chan, tmp, tmp2, MAXRESULT - 1);
 
 		if (tmp2) {
-			int curfieldnum = 1;
+			int curfieldnum = 1, firstfield = 1;
 			while (tmp2 != NULL && args.field != NULL) {
 				char *nextgroup = strsep(&(args.field), "&");
 				int num1 = 0, num2 = MAXRESULT;
@@ -232,10 +232,12 @@
 					char *tmp3 = strsep(&tmp2, ds);
 					int curlen = strlen(buffer);
 
-					if (curlen)
+					if (firstfield) {
+						snprintf(buffer, buflen, "%s", tmp3);
+						firstfield = 0;
+					} else {
 						snprintf(buffer + curlen, buflen - curlen, "%c%s", d, tmp3);
-					else
-						snprintf(buffer, buflen, "%s", tmp3);
+					}
 
 					curfieldnum++;
 				}




More information about the asterisk-commits mailing list