Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
971450f0
Commit
971450f0
authored
May 29, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/InputStream: make IsEOF() and IsAvailable() const
parent
40a48cfb
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
42 additions
and
40 deletions
+42
-40
Bzip2ArchivePlugin.cxx
src/archive/plugins/Bzip2ArchivePlugin.cxx
+2
-2
Iso9660ArchivePlugin.cxx
src/archive/plugins/Iso9660ArchivePlugin.cxx
+2
-2
ZzipArchivePlugin.cxx
src/archive/plugins/ZzipArchivePlugin.cxx
+2
-2
AsyncInputStream.cxx
src/input/AsyncInputStream.cxx
+2
-2
AsyncInputStream.hxx
src/input/AsyncInputStream.hxx
+2
-2
BufferedInputStream.cxx
src/input/BufferedInputStream.cxx
+2
-2
BufferedInputStream.hxx
src/input/BufferedInputStream.hxx
+2
-2
BufferingInputStream.cxx
src/input/BufferingInputStream.cxx
+1
-1
BufferingInputStream.hxx
src/input/BufferingInputStream.hxx
+4
-2
FailingInputStream.hxx
src/input/FailingInputStream.hxx
+1
-1
InputStream.cxx
src/input/InputStream.cxx
+2
-2
InputStream.hxx
src/input/InputStream.hxx
+3
-3
ProxyInputStream.cxx
src/input/ProxyInputStream.cxx
+2
-2
ProxyInputStream.hxx
src/input/ProxyInputStream.hxx
+2
-2
RewindInputStream.cxx
src/input/RewindInputStream.cxx
+1
-1
ThreadInputStream.cxx
src/input/ThreadInputStream.cxx
+2
-2
ThreadInputStream.hxx
src/input/ThreadInputStream.hxx
+3
-3
CdioParanoiaInputPlugin.cxx
src/input/plugins/CdioParanoiaInputPlugin.cxx
+2
-2
FfmpegInputPlugin.cxx
src/input/plugins/FfmpegInputPlugin.cxx
+2
-2
FileInputPlugin.cxx
src/input/plugins/FileInputPlugin.cxx
+1
-1
SmbclientInputPlugin.cxx
src/input/plugins/SmbclientInputPlugin.cxx
+1
-1
TestRewindInputStream.cxx
test/TestRewindInputStream.cxx
+1
-1
No files found.
src/archive/plugins/Bzip2ArchivePlugin.cxx
View file @
971450f0
...
...
@@ -71,7 +71,7 @@ public:
~
Bzip2InputStream
();
/* virtual methods from InputStream */
bool
IsEOF
()
noexcept
override
;
bool
IsEOF
()
const
noexcept
override
;
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
*
ptr
,
size_t
size
)
override
;
...
...
@@ -183,7 +183,7 @@ Bzip2InputStream::Read(std::unique_lock<Mutex> &, void *ptr, size_t length)
}
bool
Bzip2InputStream
::
IsEOF
()
noexcept
Bzip2InputStream
::
IsEOF
()
const
noexcept
{
return
eof
;
}
...
...
src/archive/plugins/Iso9660ArchivePlugin.cxx
View file @
971450f0
...
...
@@ -156,7 +156,7 @@ public:
}
/* virtual methods from InputStream */
bool
IsEOF
()
noexcept
override
;
bool
IsEOF
()
const
noexcept
override
;
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
*
ptr
,
size_t
size
)
override
;
};
...
...
@@ -210,7 +210,7 @@ Iso9660InputStream::Read(std::unique_lock<Mutex> &,
}
bool
Iso9660InputStream
::
IsEOF
()
noexcept
Iso9660InputStream
::
IsEOF
()
const
noexcept
{
return
offset
==
size
;
}
...
...
src/archive/plugins/ZzipArchivePlugin.cxx
View file @
971450f0
...
...
@@ -110,7 +110,7 @@ public:
}
/* virtual methods from InputStream */
bool
IsEOF
()
noexcept
override
;
bool
IsEOF
()
const
noexcept
override
;
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
*
ptr
,
size_t
size
)
override
;
void
Seek
(
std
::
unique_lock
<
Mutex
>
&
lock
,
offset_type
offset
)
override
;
...
...
@@ -144,7 +144,7 @@ ZzipInputStream::Read(std::unique_lock<Mutex> &, void *ptr, size_t read_size)
}
bool
ZzipInputStream
::
IsEOF
()
noexcept
ZzipInputStream
::
IsEOF
()
const
noexcept
{
return
offset_type
(
zzip_tell
(
file
))
==
size
;
}
...
...
src/input/AsyncInputStream.cxx
View file @
971450f0
...
...
@@ -88,7 +88,7 @@ AsyncInputStream::Check()
}
bool
AsyncInputStream
::
IsEOF
()
noexcept
AsyncInputStream
::
IsEOF
()
const
noexcept
{
return
(
KnownSize
()
&&
offset
>=
size
)
||
(
!
open
&&
buffer
.
empty
());
...
...
@@ -164,7 +164,7 @@ AsyncInputStream::ReadTag() noexcept
}
bool
AsyncInputStream
::
IsAvailable
()
noexcept
AsyncInputStream
::
IsAvailable
()
const
noexcept
{
return
postponed_exception
||
IsEOF
()
||
...
...
src/input/AsyncInputStream.hxx
View file @
971450f0
...
...
@@ -82,11 +82,11 @@ public:
/* virtual methods from InputStream */
void
Check
()
final
;
bool
IsEOF
()
noexcept
final
;
bool
IsEOF
()
const
noexcept
final
;
void
Seek
(
std
::
unique_lock
<
Mutex
>
&
lock
,
offset_type
new_offset
)
final
;
std
::
unique_ptr
<
Tag
>
ReadTag
()
noexcept
final
;
bool
IsAvailable
()
noexcept
final
;
bool
IsAvailable
()
const
noexcept
final
;
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
*
ptr
,
size_t
read_size
)
final
;
...
...
src/input/BufferedInputStream.cxx
View file @
971450f0
...
...
@@ -53,13 +53,13 @@ BufferedInputStream::Seek(std::unique_lock<Mutex> &,
}
bool
BufferedInputStream
::
IsEOF
()
noexcept
BufferedInputStream
::
IsEOF
()
const
noexcept
{
return
InputStream
::
offset
==
BufferingInputStream
::
size
();
}
bool
BufferedInputStream
::
IsAvailable
()
noexcept
BufferedInputStream
::
IsAvailable
()
const
noexcept
{
return
BufferingInputStream
::
IsAvailable
(
offset
);
}
...
...
src/input/BufferedInputStream.hxx
View file @
971450f0
...
...
@@ -55,10 +55,10 @@ public:
have been copied already in our constructor */
//void Update() noexcept;
void
Seek
(
std
::
unique_lock
<
Mutex
>
&
lock
,
offset_type
offset
)
override
;
bool
IsEOF
()
noexcept
override
;
bool
IsEOF
()
const
noexcept
override
;
/* we don't support tags */
// std::unique_ptr<Tag> ReadTag() override;
bool
IsAvailable
()
noexcept
override
;
bool
IsAvailable
()
const
noexcept
override
;
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
*
ptr
,
size_t
size
)
override
;
...
...
src/input/BufferingInputStream.cxx
View file @
971450f0
...
...
@@ -56,7 +56,7 @@ BufferingInputStream::Check()
}
bool
BufferingInputStream
::
IsAvailable
(
size_t
offset
)
noexcept
BufferingInputStream
::
IsAvailable
(
size_t
offset
)
const
noexcept
{
if
(
offset
>=
size
()
||
error
)
return
true
;
...
...
src/input/BufferingInputStream.hxx
View file @
971450f0
...
...
@@ -57,7 +57,9 @@ class BufferingInputStream : InputStreamHandler {
bool
stop
=
false
;
size_t
want_offset
=
INVALID_OFFSET
;
/* must be mutable because IsAvailable() acts as a hint to
modify this attribute */
mutable
size_t
want_offset
=
INVALID_OFFSET
;
std
::
exception_ptr
error
,
seek_error
;
...
...
@@ -100,7 +102,7 @@ public:
* Check whether data is available in the buffer at the given
* offset..
*/
bool
IsAvailable
(
size_t
offset
)
noexcept
;
bool
IsAvailable
(
size_t
offset
)
const
noexcept
;
/**
* Copy data from the buffer into the given pointer.
...
...
src/input/FailingInputStream.hxx
View file @
971450f0
...
...
@@ -49,7 +49,7 @@ public:
std
::
rethrow_exception
(
error
);
}
bool
IsEOF
()
noexcept
override
{
bool
IsEOF
()
const
noexcept
override
{
return
false
;
}
...
...
src/input/InputStream.cxx
View file @
971450f0
...
...
@@ -105,7 +105,7 @@ InputStream::LockReadTag() noexcept
}
bool
InputStream
::
IsAvailable
()
noexcept
InputStream
::
IsAvailable
()
const
noexcept
{
return
true
;
}
...
...
@@ -153,7 +153,7 @@ InputStream::LockReadFull(void *ptr, size_t _size)
}
bool
InputStream
::
LockIsEOF
()
noexcept
InputStream
::
LockIsEOF
()
const
noexcept
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
return
IsEOF
();
...
...
src/input/InputStream.hxx
View file @
971450f0
...
...
@@ -310,14 +310,14 @@ public:
* The caller must lock the mutex.
*/
gcc_pure
virtual
bool
IsEOF
()
noexcept
=
0
;
virtual
bool
IsEOF
()
const
noexcept
=
0
;
/**
* Wrapper for IsEOF() which locks and unlocks the mutex; the
* caller must not be holding it already.
*/
gcc_pure
bool
LockIsEOF
()
noexcept
;
bool
LockIsEOF
()
const
noexcept
;
/**
* Reads the tag from the stream.
...
...
@@ -343,7 +343,7 @@ public:
* The caller must lock the mutex.
*/
gcc_pure
virtual
bool
IsAvailable
()
noexcept
;
virtual
bool
IsAvailable
()
const
noexcept
;
/**
* Reads data from the stream into the caller-supplied buffer.
...
...
src/input/ProxyInputStream.cxx
View file @
971450f0
...
...
@@ -99,7 +99,7 @@ ProxyInputStream::Seek(std::unique_lock<Mutex> &lock,
}
bool
ProxyInputStream
::
IsEOF
()
noexcept
ProxyInputStream
::
IsEOF
()
const
noexcept
{
return
input
&&
input
->
IsEOF
();
}
...
...
@@ -114,7 +114,7 @@ ProxyInputStream::ReadTag() noexcept
}
bool
ProxyInputStream
::
IsAvailable
()
noexcept
ProxyInputStream
::
IsAvailable
()
const
noexcept
{
return
input
&&
input
->
IsAvailable
();
}
...
...
src/input/ProxyInputStream.hxx
View file @
971450f0
...
...
@@ -62,9 +62,9 @@ public:
void
Update
()
noexcept
override
;
void
Seek
(
std
::
unique_lock
<
Mutex
>
&
lock
,
offset_type
new_offset
)
override
;
bool
IsEOF
()
noexcept
override
;
bool
IsEOF
()
const
noexcept
override
;
std
::
unique_ptr
<
Tag
>
ReadTag
()
noexcept
override
;
bool
IsAvailable
()
noexcept
override
;
bool
IsAvailable
()
const
noexcept
override
;
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
*
ptr
,
size_t
read_size
)
override
;
...
...
src/input/RewindInputStream.cxx
View file @
971450f0
...
...
@@ -56,7 +56,7 @@ public:
ProxyInputStream
::
Update
();
}
bool
IsEOF
()
noexcept
override
{
bool
IsEOF
()
const
noexcept
override
{
return
!
ReadingFromBuffer
()
&&
ProxyInputStream
::
IsEOF
();
}
...
...
src/input/ThreadInputStream.cxx
View file @
971450f0
...
...
@@ -122,7 +122,7 @@ ThreadInputStream::Check()
}
bool
ThreadInputStream
::
IsAvailable
()
noexcept
ThreadInputStream
::
IsAvailable
()
const
noexcept
{
assert
(
!
thread
.
IsInside
());
...
...
@@ -160,7 +160,7 @@ ThreadInputStream::Read(std::unique_lock<Mutex> &lock,
}
bool
ThreadInputStream
::
IsEOF
()
noexcept
ThreadInputStream
::
IsEOF
()
const
noexcept
{
assert
(
!
thread
.
IsInside
());
...
...
src/input/ThreadInputStream.hxx
View file @
971450f0
...
...
@@ -91,9 +91,9 @@ public:
void
Start
();
/* virtual methods from InputStream */
void
Check
()
override
final
;
bool
IsEOF
()
noexcept
final
;
bool
IsAvailable
()
noexcept
final
;
void
Check
()
final
;
bool
IsEOF
()
const
noexcept
final
;
bool
IsAvailable
()
const
noexcept
final
;
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
*
ptr
,
size_t
size
)
override
final
;
...
...
src/input/plugins/CdioParanoiaInputPlugin.cxx
View file @
971450f0
...
...
@@ -90,7 +90,7 @@ class CdioParanoiaInputStream final : public InputStream {
}
/* virtual methods from InputStream */
bool
IsEOF
()
noexcept
override
;
bool
IsEOF
()
const
noexcept
override
;
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
*
ptr
,
size_t
size
)
override
;
void
Seek
(
std
::
unique_lock
<
Mutex
>
&
lock
,
offset_type
offset
)
override
;
...
...
@@ -344,7 +344,7 @@ CdioParanoiaInputStream::Read(std::unique_lock<Mutex> &,
}
bool
CdioParanoiaInputStream
::
IsEOF
()
noexcept
CdioParanoiaInputStream
::
IsEOF
()
const
noexcept
{
return
lsn_from
+
lsn_relofs
>
lsn_to
;
}
...
...
src/input/plugins/FfmpegInputPlugin.cxx
View file @
971450f0
...
...
@@ -48,7 +48,7 @@ public:
}
/* virtual methods from InputStream */
bool
IsEOF
()
noexcept
override
;
bool
IsEOF
()
const
noexcept
override
;
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
*
ptr
,
size_t
size
)
override
;
void
Seek
(
std
::
unique_lock
<
Mutex
>
&
lock
,
...
...
@@ -96,7 +96,7 @@ FfmpegInputStream::Read(std::unique_lock<Mutex> &,
}
bool
FfmpegInputStream
::
IsEOF
()
noexcept
FfmpegInputStream
::
IsEOF
()
const
noexcept
{
return
io
.
IsEOF
();
}
...
...
src/input/plugins/FileInputPlugin.cxx
View file @
971450f0
...
...
@@ -44,7 +44,7 @@ public:
/* virtual methods from InputStream */
bool
IsEOF
()
noexcept
override
{
bool
IsEOF
()
const
noexcept
override
{
return
GetOffset
()
>=
GetSize
();
}
...
...
src/input/plugins/SmbclientInputPlugin.cxx
View file @
971450f0
...
...
@@ -52,7 +52,7 @@ public:
/* virtual methods from InputStream */
bool
IsEOF
()
noexcept
override
{
bool
IsEOF
()
const
noexcept
override
{
return
offset
>=
size
;
}
...
...
test/TestRewindInputStream.cxx
View file @
971450f0
...
...
@@ -24,7 +24,7 @@ public:
}
/* virtual methods from InputStream */
bool
IsEOF
()
noexcept
override
{
bool
IsEOF
()
const
noexcept
override
{
return
remaining
==
0
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment