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:
...
@@ -71,7 +71,7 @@ public:
~
Bzip2InputStream
();
~
Bzip2InputStream
();
/* virtual methods from InputStream */
/* virtual methods from InputStream */
bool
IsEOF
()
noexcept
override
;
bool
IsEOF
()
const
noexcept
override
;
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
*
ptr
,
size_t
size
)
override
;
void
*
ptr
,
size_t
size
)
override
;
...
@@ -183,7 +183,7 @@ Bzip2InputStream::Read(std::unique_lock<Mutex> &, void *ptr, size_t length)
...
@@ -183,7 +183,7 @@ Bzip2InputStream::Read(std::unique_lock<Mutex> &, void *ptr, size_t length)
}
}
bool
bool
Bzip2InputStream
::
IsEOF
()
noexcept
Bzip2InputStream
::
IsEOF
()
const
noexcept
{
{
return
eof
;
return
eof
;
}
}
...
...
src/archive/plugins/Iso9660ArchivePlugin.cxx
View file @
971450f0
...
@@ -156,7 +156,7 @@ public:
...
@@ -156,7 +156,7 @@ public:
}
}
/* virtual methods from InputStream */
/* virtual methods from InputStream */
bool
IsEOF
()
noexcept
override
;
bool
IsEOF
()
const
noexcept
override
;
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
*
ptr
,
size_t
size
)
override
;
void
*
ptr
,
size_t
size
)
override
;
};
};
...
@@ -210,7 +210,7 @@ Iso9660InputStream::Read(std::unique_lock<Mutex> &,
...
@@ -210,7 +210,7 @@ Iso9660InputStream::Read(std::unique_lock<Mutex> &,
}
}
bool
bool
Iso9660InputStream
::
IsEOF
()
noexcept
Iso9660InputStream
::
IsEOF
()
const
noexcept
{
{
return
offset
==
size
;
return
offset
==
size
;
}
}
...
...
src/archive/plugins/ZzipArchivePlugin.cxx
View file @
971450f0
...
@@ -110,7 +110,7 @@ public:
...
@@ -110,7 +110,7 @@ public:
}
}
/* virtual methods from InputStream */
/* virtual methods from InputStream */
bool
IsEOF
()
noexcept
override
;
bool
IsEOF
()
const
noexcept
override
;
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
*
ptr
,
size_t
size
)
override
;
void
*
ptr
,
size_t
size
)
override
;
void
Seek
(
std
::
unique_lock
<
Mutex
>
&
lock
,
offset_type
offset
)
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)
...
@@ -144,7 +144,7 @@ ZzipInputStream::Read(std::unique_lock<Mutex> &, void *ptr, size_t read_size)
}
}
bool
bool
ZzipInputStream
::
IsEOF
()
noexcept
ZzipInputStream
::
IsEOF
()
const
noexcept
{
{
return
offset_type
(
zzip_tell
(
file
))
==
size
;
return
offset_type
(
zzip_tell
(
file
))
==
size
;
}
}
...
...
src/input/AsyncInputStream.cxx
View file @
971450f0
...
@@ -88,7 +88,7 @@ AsyncInputStream::Check()
...
@@ -88,7 +88,7 @@ AsyncInputStream::Check()
}
}
bool
bool
AsyncInputStream
::
IsEOF
()
noexcept
AsyncInputStream
::
IsEOF
()
const
noexcept
{
{
return
(
KnownSize
()
&&
offset
>=
size
)
||
return
(
KnownSize
()
&&
offset
>=
size
)
||
(
!
open
&&
buffer
.
empty
());
(
!
open
&&
buffer
.
empty
());
...
@@ -164,7 +164,7 @@ AsyncInputStream::ReadTag() noexcept
...
@@ -164,7 +164,7 @@ AsyncInputStream::ReadTag() noexcept
}
}
bool
bool
AsyncInputStream
::
IsAvailable
()
noexcept
AsyncInputStream
::
IsAvailable
()
const
noexcept
{
{
return
postponed_exception
||
return
postponed_exception
||
IsEOF
()
||
IsEOF
()
||
...
...
src/input/AsyncInputStream.hxx
View file @
971450f0
...
@@ -82,11 +82,11 @@ public:
...
@@ -82,11 +82,11 @@ public:
/* virtual methods from InputStream */
/* virtual methods from InputStream */
void
Check
()
final
;
void
Check
()
final
;
bool
IsEOF
()
noexcept
final
;
bool
IsEOF
()
const
noexcept
final
;
void
Seek
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
Seek
(
std
::
unique_lock
<
Mutex
>
&
lock
,
offset_type
new_offset
)
final
;
offset_type
new_offset
)
final
;
std
::
unique_ptr
<
Tag
>
ReadTag
()
noexcept
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
,
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
*
ptr
,
size_t
read_size
)
final
;
void
*
ptr
,
size_t
read_size
)
final
;
...
...
src/input/BufferedInputStream.cxx
View file @
971450f0
...
@@ -53,13 +53,13 @@ BufferedInputStream::Seek(std::unique_lock<Mutex> &,
...
@@ -53,13 +53,13 @@ BufferedInputStream::Seek(std::unique_lock<Mutex> &,
}
}
bool
bool
BufferedInputStream
::
IsEOF
()
noexcept
BufferedInputStream
::
IsEOF
()
const
noexcept
{
{
return
InputStream
::
offset
==
BufferingInputStream
::
size
();
return
InputStream
::
offset
==
BufferingInputStream
::
size
();
}
}
bool
bool
BufferedInputStream
::
IsAvailable
()
noexcept
BufferedInputStream
::
IsAvailable
()
const
noexcept
{
{
return
BufferingInputStream
::
IsAvailable
(
offset
);
return
BufferingInputStream
::
IsAvailable
(
offset
);
}
}
...
...
src/input/BufferedInputStream.hxx
View file @
971450f0
...
@@ -55,10 +55,10 @@ public:
...
@@ -55,10 +55,10 @@ public:
have been copied already in our constructor */
have been copied already in our constructor */
//void Update() noexcept;
//void Update() noexcept;
void
Seek
(
std
::
unique_lock
<
Mutex
>
&
lock
,
offset_type
offset
)
override
;
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 */
/* we don't support tags */
// std::unique_ptr<Tag> ReadTag() override;
// std::unique_ptr<Tag> ReadTag() override;
bool
IsAvailable
()
noexcept
override
;
bool
IsAvailable
()
const
noexcept
override
;
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
*
ptr
,
size_t
size
)
override
;
void
*
ptr
,
size_t
size
)
override
;
...
...
src/input/BufferingInputStream.cxx
View file @
971450f0
...
@@ -56,7 +56,7 @@ BufferingInputStream::Check()
...
@@ -56,7 +56,7 @@ BufferingInputStream::Check()
}
}
bool
bool
BufferingInputStream
::
IsAvailable
(
size_t
offset
)
noexcept
BufferingInputStream
::
IsAvailable
(
size_t
offset
)
const
noexcept
{
{
if
(
offset
>=
size
()
||
error
)
if
(
offset
>=
size
()
||
error
)
return
true
;
return
true
;
...
...
src/input/BufferingInputStream.hxx
View file @
971450f0
...
@@ -57,7 +57,9 @@ class BufferingInputStream : InputStreamHandler {
...
@@ -57,7 +57,9 @@ class BufferingInputStream : InputStreamHandler {
bool
stop
=
false
;
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
;
std
::
exception_ptr
error
,
seek_error
;
...
@@ -100,7 +102,7 @@ public:
...
@@ -100,7 +102,7 @@ public:
* Check whether data is available in the buffer at the given
* Check whether data is available in the buffer at the given
* offset..
* offset..
*/
*/
bool
IsAvailable
(
size_t
offset
)
noexcept
;
bool
IsAvailable
(
size_t
offset
)
const
noexcept
;
/**
/**
* Copy data from the buffer into the given pointer.
* Copy data from the buffer into the given pointer.
...
...
src/input/FailingInputStream.hxx
View file @
971450f0
...
@@ -49,7 +49,7 @@ public:
...
@@ -49,7 +49,7 @@ public:
std
::
rethrow_exception
(
error
);
std
::
rethrow_exception
(
error
);
}
}
bool
IsEOF
()
noexcept
override
{
bool
IsEOF
()
const
noexcept
override
{
return
false
;
return
false
;
}
}
...
...
src/input/InputStream.cxx
View file @
971450f0
...
@@ -105,7 +105,7 @@ InputStream::LockReadTag() noexcept
...
@@ -105,7 +105,7 @@ InputStream::LockReadTag() noexcept
}
}
bool
bool
InputStream
::
IsAvailable
()
noexcept
InputStream
::
IsAvailable
()
const
noexcept
{
{
return
true
;
return
true
;
}
}
...
@@ -153,7 +153,7 @@ InputStream::LockReadFull(void *ptr, size_t _size)
...
@@ -153,7 +153,7 @@ InputStream::LockReadFull(void *ptr, size_t _size)
}
}
bool
bool
InputStream
::
LockIsEOF
()
noexcept
InputStream
::
LockIsEOF
()
const
noexcept
{
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
return
IsEOF
();
return
IsEOF
();
...
...
src/input/InputStream.hxx
View file @
971450f0
...
@@ -310,14 +310,14 @@ public:
...
@@ -310,14 +310,14 @@ public:
* The caller must lock the mutex.
* The caller must lock the mutex.
*/
*/
gcc_pure
gcc_pure
virtual
bool
IsEOF
()
noexcept
=
0
;
virtual
bool
IsEOF
()
const
noexcept
=
0
;
/**
/**
* Wrapper for IsEOF() which locks and unlocks the mutex; the
* Wrapper for IsEOF() which locks and unlocks the mutex; the
* caller must not be holding it already.
* caller must not be holding it already.
*/
*/
gcc_pure
gcc_pure
bool
LockIsEOF
()
noexcept
;
bool
LockIsEOF
()
const
noexcept
;
/**
/**
* Reads the tag from the stream.
* Reads the tag from the stream.
...
@@ -343,7 +343,7 @@ public:
...
@@ -343,7 +343,7 @@ public:
* The caller must lock the mutex.
* The caller must lock the mutex.
*/
*/
gcc_pure
gcc_pure
virtual
bool
IsAvailable
()
noexcept
;
virtual
bool
IsAvailable
()
const
noexcept
;
/**
/**
* Reads data from the stream into the caller-supplied buffer.
* 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,
...
@@ -99,7 +99,7 @@ ProxyInputStream::Seek(std::unique_lock<Mutex> &lock,
}
}
bool
bool
ProxyInputStream
::
IsEOF
()
noexcept
ProxyInputStream
::
IsEOF
()
const
noexcept
{
{
return
input
&&
input
->
IsEOF
();
return
input
&&
input
->
IsEOF
();
}
}
...
@@ -114,7 +114,7 @@ ProxyInputStream::ReadTag() noexcept
...
@@ -114,7 +114,7 @@ ProxyInputStream::ReadTag() noexcept
}
}
bool
bool
ProxyInputStream
::
IsAvailable
()
noexcept
ProxyInputStream
::
IsAvailable
()
const
noexcept
{
{
return
input
&&
input
->
IsAvailable
();
return
input
&&
input
->
IsAvailable
();
}
}
...
...
src/input/ProxyInputStream.hxx
View file @
971450f0
...
@@ -62,9 +62,9 @@ public:
...
@@ -62,9 +62,9 @@ public:
void
Update
()
noexcept
override
;
void
Update
()
noexcept
override
;
void
Seek
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
Seek
(
std
::
unique_lock
<
Mutex
>
&
lock
,
offset_type
new_offset
)
override
;
offset_type
new_offset
)
override
;
bool
IsEOF
()
noexcept
override
;
bool
IsEOF
()
const
noexcept
override
;
std
::
unique_ptr
<
Tag
>
ReadTag
()
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
,
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
*
ptr
,
size_t
read_size
)
override
;
void
*
ptr
,
size_t
read_size
)
override
;
...
...
src/input/RewindInputStream.cxx
View file @
971450f0
...
@@ -56,7 +56,7 @@ public:
...
@@ -56,7 +56,7 @@ public:
ProxyInputStream
::
Update
();
ProxyInputStream
::
Update
();
}
}
bool
IsEOF
()
noexcept
override
{
bool
IsEOF
()
const
noexcept
override
{
return
!
ReadingFromBuffer
()
&&
ProxyInputStream
::
IsEOF
();
return
!
ReadingFromBuffer
()
&&
ProxyInputStream
::
IsEOF
();
}
}
...
...
src/input/ThreadInputStream.cxx
View file @
971450f0
...
@@ -122,7 +122,7 @@ ThreadInputStream::Check()
...
@@ -122,7 +122,7 @@ ThreadInputStream::Check()
}
}
bool
bool
ThreadInputStream
::
IsAvailable
()
noexcept
ThreadInputStream
::
IsAvailable
()
const
noexcept
{
{
assert
(
!
thread
.
IsInside
());
assert
(
!
thread
.
IsInside
());
...
@@ -160,7 +160,7 @@ ThreadInputStream::Read(std::unique_lock<Mutex> &lock,
...
@@ -160,7 +160,7 @@ ThreadInputStream::Read(std::unique_lock<Mutex> &lock,
}
}
bool
bool
ThreadInputStream
::
IsEOF
()
noexcept
ThreadInputStream
::
IsEOF
()
const
noexcept
{
{
assert
(
!
thread
.
IsInside
());
assert
(
!
thread
.
IsInside
());
...
...
src/input/ThreadInputStream.hxx
View file @
971450f0
...
@@ -91,9 +91,9 @@ public:
...
@@ -91,9 +91,9 @@ public:
void
Start
();
void
Start
();
/* virtual methods from InputStream */
/* virtual methods from InputStream */
void
Check
()
override
final
;
void
Check
()
final
;
bool
IsEOF
()
noexcept
final
;
bool
IsEOF
()
const
noexcept
final
;
bool
IsAvailable
()
noexcept
final
;
bool
IsAvailable
()
const
noexcept
final
;
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
*
ptr
,
size_t
size
)
override
final
;
void
*
ptr
,
size_t
size
)
override
final
;
...
...
src/input/plugins/CdioParanoiaInputPlugin.cxx
View file @
971450f0
...
@@ -90,7 +90,7 @@ class CdioParanoiaInputStream final : public InputStream {
...
@@ -90,7 +90,7 @@ class CdioParanoiaInputStream final : public InputStream {
}
}
/* virtual methods from InputStream */
/* virtual methods from InputStream */
bool
IsEOF
()
noexcept
override
;
bool
IsEOF
()
const
noexcept
override
;
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
*
ptr
,
size_t
size
)
override
;
void
*
ptr
,
size_t
size
)
override
;
void
Seek
(
std
::
unique_lock
<
Mutex
>
&
lock
,
offset_type
offset
)
override
;
void
Seek
(
std
::
unique_lock
<
Mutex
>
&
lock
,
offset_type
offset
)
override
;
...
@@ -344,7 +344,7 @@ CdioParanoiaInputStream::Read(std::unique_lock<Mutex> &,
...
@@ -344,7 +344,7 @@ CdioParanoiaInputStream::Read(std::unique_lock<Mutex> &,
}
}
bool
bool
CdioParanoiaInputStream
::
IsEOF
()
noexcept
CdioParanoiaInputStream
::
IsEOF
()
const
noexcept
{
{
return
lsn_from
+
lsn_relofs
>
lsn_to
;
return
lsn_from
+
lsn_relofs
>
lsn_to
;
}
}
...
...
src/input/plugins/FfmpegInputPlugin.cxx
View file @
971450f0
...
@@ -48,7 +48,7 @@ public:
...
@@ -48,7 +48,7 @@ public:
}
}
/* virtual methods from InputStream */
/* virtual methods from InputStream */
bool
IsEOF
()
noexcept
override
;
bool
IsEOF
()
const
noexcept
override
;
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
size_t
Read
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
*
ptr
,
size_t
size
)
override
;
void
*
ptr
,
size_t
size
)
override
;
void
Seek
(
std
::
unique_lock
<
Mutex
>
&
lock
,
void
Seek
(
std
::
unique_lock
<
Mutex
>
&
lock
,
...
@@ -96,7 +96,7 @@ FfmpegInputStream::Read(std::unique_lock<Mutex> &,
...
@@ -96,7 +96,7 @@ FfmpegInputStream::Read(std::unique_lock<Mutex> &,
}
}
bool
bool
FfmpegInputStream
::
IsEOF
()
noexcept
FfmpegInputStream
::
IsEOF
()
const
noexcept
{
{
return
io
.
IsEOF
();
return
io
.
IsEOF
();
}
}
...
...
src/input/plugins/FileInputPlugin.cxx
View file @
971450f0
...
@@ -44,7 +44,7 @@ public:
...
@@ -44,7 +44,7 @@ public:
/* virtual methods from InputStream */
/* virtual methods from InputStream */
bool
IsEOF
()
noexcept
override
{
bool
IsEOF
()
const
noexcept
override
{
return
GetOffset
()
>=
GetSize
();
return
GetOffset
()
>=
GetSize
();
}
}
...
...
src/input/plugins/SmbclientInputPlugin.cxx
View file @
971450f0
...
@@ -52,7 +52,7 @@ public:
...
@@ -52,7 +52,7 @@ public:
/* virtual methods from InputStream */
/* virtual methods from InputStream */
bool
IsEOF
()
noexcept
override
{
bool
IsEOF
()
const
noexcept
override
{
return
offset
>=
size
;
return
offset
>=
size
;
}
}
...
...
test/TestRewindInputStream.cxx
View file @
971450f0
...
@@ -24,7 +24,7 @@ public:
...
@@ -24,7 +24,7 @@ public:
}
}
/* virtual methods from InputStream */
/* virtual methods from InputStream */
bool
IsEOF
()
noexcept
override
{
bool
IsEOF
()
const
noexcept
override
{
return
remaining
==
0
;
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