[clang-tidy] use nodiscard
Introduced in C++17. It replaces gcc's warn_unused_result. Found with modernize-use-nodiscard. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
@@ -51,7 +51,7 @@ struct DsdiffChunkHeader {
|
||||
* Read the "size" attribute from the specified header, converting it
|
||||
* to the host byte order if needed.
|
||||
*/
|
||||
constexpr
|
||||
[[nodiscard]] constexpr
|
||||
uint64_t GetSize() const {
|
||||
return size.Read();
|
||||
}
|
||||
|
@@ -146,10 +146,10 @@ private:
|
||||
void ParseId3(size_t tagsize, Tag *tag) noexcept;
|
||||
MadDecoderAction DecodeNextFrame(bool skip, Tag *tag) noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[nodiscard]] gcc_pure
|
||||
offset_type ThisFrameOffset() const noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[nodiscard]] gcc_pure
|
||||
offset_type RestIncludingThisFrame() const noexcept;
|
||||
|
||||
/**
|
||||
@@ -168,7 +168,7 @@ private:
|
||||
times = new mad_timer_t[max_frames];
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[nodiscard]] gcc_pure
|
||||
size_t TimeToFrame(SongTime t) const noexcept;
|
||||
|
||||
/**
|
||||
|
@@ -94,7 +94,7 @@ public:
|
||||
/**
|
||||
* Has DecoderClient::Ready() been called yet?
|
||||
*/
|
||||
bool IsInitialized() const {
|
||||
[[nodiscard]] bool IsInitialized() const {
|
||||
return previous_channels != 0;
|
||||
}
|
||||
|
||||
|
@@ -86,7 +86,7 @@ public:
|
||||
return ::CheckAudioFormat(vi.rate, sample_format, vi.channels);
|
||||
}
|
||||
|
||||
AudioFormat CheckAudioFormat() const {
|
||||
[[nodiscard]] AudioFormat CheckAudioFormat() const {
|
||||
return CheckAudioFormat(vi);
|
||||
}
|
||||
|
||||
|
@@ -291,7 +291,7 @@ struct WavpackInput {
|
||||
|
||||
int32_t ReadBytes(void *data, size_t bcount);
|
||||
|
||||
InputStream::offset_type GetPos() const {
|
||||
[[nodiscard]] InputStream::offset_type GetPos() const {
|
||||
return is.GetOffset();
|
||||
}
|
||||
|
||||
@@ -337,14 +337,14 @@ struct WavpackInput {
|
||||
}
|
||||
}
|
||||
|
||||
InputStream::offset_type GetLength() const {
|
||||
[[nodiscard]] InputStream::offset_type GetLength() const {
|
||||
if (!is.KnownSize())
|
||||
return 0;
|
||||
|
||||
return is.GetSize();
|
||||
}
|
||||
|
||||
bool CanSeek() const {
|
||||
[[nodiscard]] bool CanSeek() const {
|
||||
return is.IsSeekable();
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user