aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-19 11:56:12 +0200
committerMax Kellermann <max@duempel.org>2014-08-19 21:00:50 +0200
commit4265e71d6f8334c77bef8ccb26d6f0db8b25a53e (patch)
tree6b3c4621dd96ce8c9d880db12cbaa11f43d59cd3 /src
parentf66a72c66bfe001c7bb6952dfceedc740d2b7154 (diff)
downloadmpd-4265e71d6f8334c77bef8ccb26d6f0db8b25a53e.tar.gz
mpd-4265e71d6f8334c77bef8ccb26d6f0db8b25a53e.tar.xz
mpd-4265e71d6f8334c77bef8ccb26d6f0db8b25a53e.zip
InputStream: add constant UNKNOWN_SIZE
Diffstat (limited to 'src')
-rw-r--r--src/input/InputStream.hxx8
-rw-r--r--src/input/ProxyInputStream.cxx2
2 files changed, 6 insertions, 4 deletions
diff --git a/src/input/InputStream.hxx b/src/input/InputStream.hxx
index c62f71e45..a84405df0 100644
--- a/src/input/InputStream.hxx
+++ b/src/input/InputStream.hxx
@@ -76,8 +76,10 @@ protected:
*/
bool seekable;
+ static constexpr offset_type UNKNOWN_SIZE = -1;
+
/**
- * the size of the resource, or -1 if unknown
+ * the size of the resource, or #UNKNOWN_SIZE if unknown
*/
offset_type size;
@@ -97,7 +99,7 @@ public:
:uri(_uri),
mutex(_mutex), cond(_cond),
ready(false), seekable(false),
- size(-1), offset(0) {
+ size(UNKNOWN_SIZE), offset(0) {
assert(_uri != nullptr);
}
@@ -221,7 +223,7 @@ public:
bool KnownSize() const {
assert(ready);
- return size >= 0;
+ return size != UNKNOWN_SIZE;
}
gcc_pure
diff --git a/src/input/ProxyInputStream.cxx b/src/input/ProxyInputStream.cxx
index 67b2c3338..74a272f6a 100644
--- a/src/input/ProxyInputStream.cxx
+++ b/src/input/ProxyInputStream.cxx
@@ -42,7 +42,7 @@ ProxyInputStream::CopyAttributes()
size = input.KnownSize()
? input.GetSize()
- : -1;
+ : UNKNOWN_SIZE;
seekable = input.IsSeekable();
SetReady();