aboutsummaryrefslogtreecommitdiffstats
path: root/src/input/plugins
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-18 09:47:23 +0200
committerMax Kellermann <max@duempel.org>2014-08-19 21:23:03 +0200
commit181edf4b5397ded0bb49b13a9df0a21b1806a695 (patch)
treeb12c1d5fe4d6616e23208ee22f46bbf3a4111e9c /src/input/plugins
parentdfa53cb88e0e4a102eafb73d147c03f7a73c51c9 (diff)
downloadmpd-181edf4b5397ded0bb49b13a9df0a21b1806a695.tar.gz
mpd-181edf4b5397ded0bb49b13a9df0a21b1806a695.tar.xz
mpd-181edf4b5397ded0bb49b13a9df0a21b1806a695.zip
InputStream: make offset_type unsigned
Diffstat (limited to '')
-rw-r--r--src/input/plugins/CdioParanoiaInputPlugin.cxx2
-rw-r--r--src/input/plugins/FileInputPlugin.cxx6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/input/plugins/CdioParanoiaInputPlugin.cxx b/src/input/plugins/CdioParanoiaInputPlugin.cxx
index 6f1ea976a..f847b35c1 100644
--- a/src/input/plugins/CdioParanoiaInputPlugin.cxx
+++ b/src/input/plugins/CdioParanoiaInputPlugin.cxx
@@ -274,7 +274,7 @@ input_cdio_open(const char *uri,
bool
CdioParanoiaInputStream::Seek(offset_type new_offset, Error &error)
{
- if (new_offset < 0 || new_offset > size) {
+ if (new_offset > size) {
error.Format(cdio_domain, "Invalid offset to seek %ld (%ld)",
(long int)new_offset, (long int)size);
return false;
diff --git a/src/input/plugins/FileInputPlugin.cxx b/src/input/plugins/FileInputPlugin.cxx
index 60c316567..922c54b79 100644
--- a/src/input/plugins/FileInputPlugin.cxx
+++ b/src/input/plugins/FileInputPlugin.cxx
@@ -101,13 +101,13 @@ input_file_open(const char *filename,
bool
FileInputStream::Seek(offset_type new_offset, Error &error)
{
- new_offset = (offset_type)lseek(fd, (off_t)new_offset, SEEK_SET);
- if (new_offset < 0) {
+ auto result = lseek(fd, (off_t)new_offset, SEEK_SET);
+ if (result < 0) {
error.SetErrno("Failed to seek");
return false;
}
- offset = new_offset;
+ offset = (offset_type)result;
return true;
}