summaryrefslogtreecommitdiff
path: root/plugins/sndfile/sndfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/sndfile/sndfile.c')
-rw-r--r--plugins/sndfile/sndfile.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/sndfile/sndfile.c b/plugins/sndfile/sndfile.c
index 99f717cc..e6dfb7ce 100644
--- a/plugins/sndfile/sndfile.c
+++ b/plugins/sndfile/sndfile.c
@@ -62,7 +62,11 @@ sf_vfs_write (const void *ptr, sf_count_t count, void *user_data) {
static sf_count_t
sf_vfs_seek (sf_count_t offset, int whence, void *user_data) {
sndfilectx_t *ctx = user_data;
- return deadbeef->fseek (ctx->file, offset, whence);
+ int ret = deadbeef->fseek (ctx->file, offset, whence);
+ if (!ret) {
+ return offset;
+ }
+ return -1;
}
static sf_count_t
@@ -174,7 +178,11 @@ sndfile_read_float32 (char *bytes, int size) {
static int
sndfile_seek_sample (int sample) {
- sfctx.currentsample = sf_seek (sfctx.ctx, sample + sfctx.startsample, SEEK_SET);
+ int ret = sf_seek (sfctx.ctx, sample + sfctx.startsample, SEEK_SET);
+ if (ret < 0) {
+ return -1;
+ }
+ sfctx.currentsample = ret;
plugin.info.readpos = (float)(sfctx.currentsample - sfctx.startsample) / plugin.info.samplerate;
return 0;
}