[asterisk-commits] branch 1.2 - r7805 in /branches/1.2/formats: format_pcm.c format_pcm_alaw.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jan 4 17:51:03 CST 2006


Author: kpfleming
Date: Wed Jan  4 17:51:03 2006
New Revision: 7805

URL: http://svn.digium.com/view/asterisk?rev=7805&view=rev
Log:
use proper fwrite() parameters and return value

Modified:
    branches/1.2/formats/format_pcm.c
    branches/1.2/formats/format_pcm_alaw.c

Modified: branches/1.2/formats/format_pcm.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/formats/format_pcm.c?rev=7805&r1=7804&r2=7805&view=diff
==============================================================================
--- branches/1.2/formats/format_pcm.c (original)
+++ branches/1.2/formats/format_pcm.c Wed Jan  4 17:51:03 2006
@@ -201,11 +201,11 @@
 			size_t res;
 
 			while (left) {
-				res = fwrite(ulaw_silence, (left > BUF_SIZE) ? BUF_SIZE : left,
-					     sizeof(ulaw_silence[0]), fs->f);
+				res = fwrite(ulaw_silence, sizeof(ulaw_silence[0]),
+					     (left > BUF_SIZE) ? BUF_SIZE : left, fs->f);
 				if (res == -1)
 					return res;
-				left -= res;
+				left -= res * sizeof(ulaw_silence[0]);
 			}
 			return offset;
 		}

Modified: branches/1.2/formats/format_pcm_alaw.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/formats/format_pcm_alaw.c?rev=7805&r1=7804&r2=7805&view=diff
==============================================================================
--- branches/1.2/formats/format_pcm_alaw.c (original)
+++ branches/1.2/formats/format_pcm_alaw.c Wed Jan  4 17:51:03 2006
@@ -276,11 +276,11 @@
 			size_t res;
 
 			while (left) {
-				res = fwrite(alaw_silence, (left > BUF_SIZE) ? BUF_SIZE : left,
-					     sizeof(alaw_silence[0]), fs->f);
+				res = fwrite(alaw_silence, sizeof(alaw_silence[0]),
+					     (left > BUF_SIZE) ? BUF_SIZE : left, fs->f);
 				if (res == -1)
 					return res;
-				left -= res;
+				left -= res * sizeof(alaw_silence[0]);
 			}
 			return offset;
 		}



More information about the asterisk-commits mailing list