InputStream: add constant UNKNOWN_SIZE
This commit is contained in:
parent
f66a72c66b
commit
4265e71d6f
@ -76,8 +76,10 @@ protected:
|
|||||||
*/
|
*/
|
||||||
bool seekable;
|
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;
|
offset_type size;
|
||||||
|
|
||||||
@ -97,7 +99,7 @@ public:
|
|||||||
:uri(_uri),
|
:uri(_uri),
|
||||||
mutex(_mutex), cond(_cond),
|
mutex(_mutex), cond(_cond),
|
||||||
ready(false), seekable(false),
|
ready(false), seekable(false),
|
||||||
size(-1), offset(0) {
|
size(UNKNOWN_SIZE), offset(0) {
|
||||||
assert(_uri != nullptr);
|
assert(_uri != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +223,7 @@ public:
|
|||||||
bool KnownSize() const {
|
bool KnownSize() const {
|
||||||
assert(ready);
|
assert(ready);
|
||||||
|
|
||||||
return size >= 0;
|
return size != UNKNOWN_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
|
@ -42,7 +42,7 @@ ProxyInputStream::CopyAttributes()
|
|||||||
|
|
||||||
size = input.KnownSize()
|
size = input.KnownSize()
|
||||||
? input.GetSize()
|
? input.GetSize()
|
||||||
: -1;
|
: UNKNOWN_SIZE;
|
||||||
|
|
||||||
seekable = input.IsSeekable();
|
seekable = input.IsSeekable();
|
||||||
SetReady();
|
SetReady();
|
||||||
|
Loading…
Reference in New Issue
Block a user