From 4265e71d6f8334c77bef8ccb26d6f0db8b25a53e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 19 Aug 2014 11:56:12 +0200 Subject: InputStream: add constant UNKNOWN_SIZE --- src/input/InputStream.hxx | 8 +++++--- src/input/ProxyInputStream.cxx | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') 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(); -- cgit v1.2.3