Merged revisions 7805 via svnmerge from
authorKevin P. Fleming <kpfleming@digium.com>
Wed, 4 Jan 2006 23:51:23 +0000 (23:51 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Wed, 4 Jan 2006 23:51:23 +0000 (23:51 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r7805 | kpfleming | 2006-01-04 17:51:03 -0600 (Wed, 04 Jan 2006) | 2 lines

use proper fwrite() parameters and return value

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7806 65c4cc65-6c06-0410-ace0-fbb531ad65f3

formats/format_pcm.c
formats/format_pcm_alaw.c

index 7a1e98b..8736323 100644 (file)
@@ -201,11 +201,11 @@ static int pcm_seek(struct ast_filestream *fs, long sample_offset, int whence)
                        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;
                }
index 811a6ef..b26796b 100644 (file)
@@ -276,11 +276,11 @@ static int pcm_seek(struct ast_filestream *fs, long sample_offset, int whence)
                        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;
                }