aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/plugins/AudiofileDecoderPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-05-22 10:10:16 +0200
committerMax Kellermann <max@duempel.org>2014-05-22 13:52:00 +0200
commit07b93dcf8084bcae92fa1f33652723ca9c990db2 (patch)
tree5cfa3d13c14d68b70d54ade24169b84a7f614b8e /src/decoder/plugins/AudiofileDecoderPlugin.cxx
parent374c6a27db790eb637feaeb9bd27ed82897d7953 (diff)
downloadmpd-07b93dcf8084bcae92fa1f33652723ca9c990db2.tar.gz
mpd-07b93dcf8084bcae92fa1f33652723ca9c990db2.tar.xz
mpd-07b93dcf8084bcae92fa1f33652723ca9c990db2.zip
InputStream: make Seek() always absolute
Remove the "whence" parameter that is not actually necessary, and only complicates the InputStream implementations.
Diffstat (limited to 'src/decoder/plugins/AudiofileDecoderPlugin.cxx')
-rw-r--r--src/decoder/plugins/AudiofileDecoderPlugin.cxx10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/decoder/plugins/AudiofileDecoderPlugin.cxx b/src/decoder/plugins/AudiofileDecoderPlugin.cxx
index 262c4a5bf..a3f0ee380 100644
--- a/src/decoder/plugins/AudiofileDecoderPlugin.cxx
+++ b/src/decoder/plugins/AudiofileDecoderPlugin.cxx
@@ -92,13 +92,17 @@ audiofile_file_destroy(AFvirtualfile *vfile)
}
static AFfileoffset
-audiofile_file_seek(AFvirtualfile *vfile, AFfileoffset offset, int is_relative)
+audiofile_file_seek(AFvirtualfile *vfile, AFfileoffset _offset,
+ int is_relative)
{
InputStream &is = *(InputStream *)vfile->closure;
- int whence = (is_relative ? SEEK_CUR : SEEK_SET);
+
+ InputStream::offset_type offset = _offset;
+ if (is_relative)
+ offset += is.GetOffset();
Error error;
- if (is.LockSeek(offset, whence, error)) {
+ if (is.LockSeek(offset, IgnoreError())) {
return is.GetOffset();
} else {
return -1;