[asterisk-commits] mnicholson: trunk r238630 - in /trunk: ./ main/file.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 8 13:32:15 CST 2010


Author: mnicholson
Date: Fri Jan  8 13:32:11 2010
New Revision: 238630

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

........
  r238629 | mnicholson | 2010-01-08 13:20:44 -0600 (Fri, 08 Jan 2010) | 5 lines
  
  Properly calculate the remaining space in the output string when reducing format strings.
  
  (closes issue #16560)
  Reported by: goldwein
........

Modified:
    trunk/   (props changed)
    trunk/main/file.c

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

Modified: trunk/main/file.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/file.c?view=diff&rev=238630&r1=238629&r2=238630
==============================================================================
--- trunk/main/file.c (original)
+++ trunk/main/file.c Fri Jan  8 13:32:11 2010
@@ -1356,6 +1356,7 @@
 	char *orig = fmts;
 	int i, j, x, first, found = 0;
 	int len = strlen(fmts) + 1;
+	int res;
 
 	if (AST_RWLIST_RDLOCK(&formats)) {
 		ast_log(LOG_WARNING, "Unable to lock format list\n");
@@ -1391,8 +1392,9 @@
 
 		/* special handling for the first entry */
 		if (first) {
-			fmts += snprintf(fmts, len, "%s", fmts_str[i]);
-			len -= (fmts - orig);
+			res = snprintf(fmts, len, "%s", fmts_str[i]);
+			fmts += res;
+			len -= res;
 			first = 0;
 			continue;
 		}
@@ -1407,8 +1409,9 @@
 		}
 
 		if (!found) {
-			fmts += snprintf(fmts, len, "|%s", fmts_str[i]);
-			len -= (fmts - orig);
+			res = snprintf(fmts, len, "|%s", fmts_str[i]);
+			fmts += res;
+			len -= res;
 		}
 	}
 




More information about the asterisk-commits mailing list