[asterisk-commits] mnicholson: branch 1.6.1 r238631 - in /branches/1.6.1: ./ main/file.c

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


Author: mnicholson
Date: Fri Jan  8 13:33:53 2010
New Revision: 238631

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

................
  r238630 | mnicholson | 2010-01-08 13:32:11 -0600 (Fri, 08 Jan 2010) | 12 lines
  
  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:
    branches/1.6.1/   (props changed)
    branches/1.6.1/main/file.c

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

Modified: branches/1.6.1/main/file.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.1/main/file.c?view=diff&rev=238631&r1=238630&r2=238631
==============================================================================
--- branches/1.6.1/main/file.c (original)
+++ branches/1.6.1/main/file.c Fri Jan  8 13:33:53 2010
@@ -1360,6 +1360,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");
@@ -1395,8 +1396,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;
 		}
@@ -1411,8 +1413,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