aboutsummaryrefslogtreecommitdiffstats
path: root/formats
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-01-10 17:30:24 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-01-10 17:30:24 +0000
commitf9bd05b3e18d9af24739f07f2eafaab4e652f42b (patch)
tree2ff8e99012d849ea2488bfd858d176d23a87a8df /formats
parent27c4379db229f6c53cf1e5bf960c48a93b791650 (diff)
minor formatting changes
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@97804 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'formats')
-rw-r--r--formats/format_sln16.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/formats/format_sln16.c b/formats/format_sln16.c
index ab01d80dd..50349f2dd 100644
--- a/formats/format_sln16.c
+++ b/formats/format_sln16.c
@@ -66,32 +66,36 @@ static int slinear_write(struct ast_filestream *fs, struct ast_frame *f)
return -1;
}
if ((res = fwrite(f->data, 1, f->datalen, fs->f)) != f->datalen) {
- ast_log(LOG_WARNING, "Bad write (%d/%d): %s\n", res, f->datalen, strerror(errno));
- return -1;
+ ast_log(LOG_WARNING, "Bad write (%d/%d): %s\n", res, f->datalen, strerror(errno));
+ return -1;
}
return 0;
}
static int slinear_seek(struct ast_filestream *fs, off_t sample_offset, int whence)
{
- off_t offset=0, min, cur, max;
+ off_t offset = 0, min = 0, cur, max;
- min = 0;
sample_offset <<= 1;
+
cur = ftello(fs->f);
+
fseeko(fs->f, 0, SEEK_END);
+
max = ftello(fs->f);
+
if (whence == SEEK_SET)
offset = sample_offset;
else if (whence == SEEK_CUR || whence == SEEK_FORCECUR)
offset = sample_offset + cur;
else if (whence == SEEK_END)
offset = max - sample_offset;
- if (whence != SEEK_FORCECUR) {
- offset = (offset > max)?max:offset;
- }
+
+ if (whence != SEEK_FORCECUR)
+ offset = (offset > max) ? max : offset;
+
/* always protect against seeking past begining. */
- offset = (offset < min)?min:offset;
+ offset = (offset < min) ? min : offset;
return fseeko(fs->f, offset, SEEK_SET);
}