[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:
@@ -56,7 +56,7 @@ public:
|
||||
ProxyInputStream::Update();
|
||||
}
|
||||
|
||||
bool IsEOF() const noexcept override {
|
||||
[[nodiscard]] bool IsEOF() const noexcept override {
|
||||
return !ReadingFromBuffer() && ProxyInputStream::IsEOF();
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ private:
|
||||
* Are we currently reading from the buffer, and does the
|
||||
* buffer contain more data for the next read operation?
|
||||
*/
|
||||
bool ReadingFromBuffer() const noexcept {
|
||||
[[nodiscard]] bool ReadingFromBuffer() const noexcept {
|
||||
return tail > 0 && offset < input->GetOffset();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -160,22 +160,22 @@ public:
|
||||
audio_format = ParseAudioFormat(format_string, false);
|
||||
}
|
||||
}
|
||||
bool IsValidScheme() const noexcept {
|
||||
[[nodiscard]] bool IsValidScheme() const noexcept {
|
||||
return device_name != nullptr;
|
||||
}
|
||||
bool IsValid() const noexcept {
|
||||
[[nodiscard]] bool IsValid() const noexcept {
|
||||
return (device_name != nullptr) && (format_string != nullptr);
|
||||
}
|
||||
const char *GetURI() const noexcept {
|
||||
[[nodiscard]] const char *GetURI() const noexcept {
|
||||
return uri;
|
||||
}
|
||||
const char *GetDeviceName() const noexcept {
|
||||
[[nodiscard]] const char *GetDeviceName() const noexcept {
|
||||
return device_name;
|
||||
}
|
||||
const char *GetFormatString() const noexcept {
|
||||
[[nodiscard]] const char *GetFormatString() const noexcept {
|
||||
return format_string;
|
||||
}
|
||||
AudioFormat GetAudioFormat() const noexcept {
|
||||
[[nodiscard]] AudioFormat GetAudioFormat() const noexcept {
|
||||
return audio_format;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -88,7 +88,7 @@ class CdioParanoiaInputStream final : public InputStream {
|
||||
}
|
||||
|
||||
/* virtual methods from InputStream */
|
||||
bool IsEOF() const noexcept override;
|
||||
[[nodiscard]] 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;
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
}
|
||||
|
||||
/* virtual methods from InputStream */
|
||||
bool IsEOF() const noexcept override;
|
||||
[[nodiscard]] 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,
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
|
||||
/* virtual methods from InputStream */
|
||||
|
||||
bool IsEOF() const noexcept override {
|
||||
[[nodiscard]] bool IsEOF() const noexcept override {
|
||||
return GetOffset() >= GetSize();
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
|
||||
/* virtual methods from InputStream */
|
||||
|
||||
bool IsEOF() const noexcept override {
|
||||
[[nodiscard]] bool IsEOF() const noexcept override {
|
||||
return offset >= size;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user