Skip to content

Commit

Permalink
GH-303 Ensure implementations of packet::IReader use ROC_ATTR_NODISCARD
Browse files Browse the repository at this point in the history
See also: #591 (comment)
  • Loading branch information
dshil authored and gavv committed Nov 1, 2023
1 parent 718edf4 commit 2a805e7
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/internal_modules/roc_fec/reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Reader : public packet::IReader, public core::NonCopyable<> {
//! Read packet.
//! @remarks
//! When a packet loss is detected, try to restore it from repair packets.
virtual status::StatusCode read(packet::PacketPtr&);
virtual ROC_ATTR_NODISCARD status::StatusCode read(packet::PacketPtr&);

private:
status::StatusCode read_(packet::PacketPtr&);
Expand Down
2 changes: 1 addition & 1 deletion src/internal_modules/roc_packet/concurrent_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ConcurrentQueue : public IReader, public IWriter, public core::NonCopyable
//! If reads are not concurrent, and queue is non-blocking, then
//! reads are wait-free. Otherwise they may block.
//! @see Mode.
virtual status::StatusCode read(PacketPtr&);
virtual ROC_ATTR_NODISCARD status::StatusCode read(PacketPtr&);

//! Add packet to the queue.
//! Wait-free operation.
Expand Down
2 changes: 1 addition & 1 deletion src/internal_modules/roc_packet/delayed_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class DelayedReader : public IReader, public core::NonCopyable<> {
const audio::SampleSpec& sample_spec);

//! Read packet.
virtual status::StatusCode read(PacketPtr&);
virtual ROC_ATTR_NODISCARD status::StatusCode read(PacketPtr&);

private:
status::StatusCode fetch_packets_();
Expand Down
2 changes: 1 addition & 1 deletion src/internal_modules/roc_packet/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace packet {
class Queue : public IReader, public IWriter, public core::NonCopyable<> {
public:
//! Read next packet.
virtual status::StatusCode read(PacketPtr& packet);
virtual ROC_ATTR_NODISCARD status::StatusCode read(PacketPtr& packet);

//! Add packet to the queue.
//! @remarks
Expand Down
2 changes: 1 addition & 1 deletion src/internal_modules/roc_packet/sorted_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class SortedQueue : public IWriter, public IReader, public core::NonCopyable<> {
//!
//! @remarks
//! Removes returned packet from the queue.
virtual status::StatusCode read(PacketPtr& packet);
virtual ROC_ATTR_NODISCARD status::StatusCode read(PacketPtr& packet);

//! Get number of packets in queue.
size_t size() const;
Expand Down
2 changes: 1 addition & 1 deletion src/internal_modules/roc_rtp/populator.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Populator : public packet::IReader, public core::NonCopyable<> {
const audio::SampleSpec& sample_spec);

//! Read next packet.
virtual status::StatusCode read(packet::PacketPtr&);
virtual ROC_ATTR_NODISCARD status::StatusCode read(packet::PacketPtr&);

private:
packet::IReader& reader_;
Expand Down
2 changes: 1 addition & 1 deletion src/internal_modules/roc_rtp/timestamp_injector.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class TimestampInjector : public packet::IReader, public core::NonCopyable<> {
//! Get packet with filled capture ts field.
//! @remarks
//! If update_mapping has not been called yet, capture timestamp will be 0.
virtual status::StatusCode read(packet::PacketPtr&);
virtual ROC_ATTR_NODISCARD status::StatusCode read(packet::PacketPtr&);

//! Get a pair of a reference timestamps.
void update_mapping(core::nanoseconds_t capture_ts,
Expand Down
2 changes: 1 addition & 1 deletion src/internal_modules/roc_rtp/validator.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Validator : public packet::IReader, public core::NonCopyable<> {
//!
//! @remarks
//! Reads packet from the underlying reader and validates it.
virtual status::StatusCode read(packet::PacketPtr& pp);
virtual ROC_ATTR_NODISCARD status::StatusCode read(packet::PacketPtr& pp);

private:
bool validate_(const packet::RTP& prev, const packet::RTP& next) const;
Expand Down
2 changes: 1 addition & 1 deletion src/tests/roc_audio/test_depacketizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class TestReader : public packet::IReader {
, code_(default_code_) {
}

virtual status::StatusCode read(packet::PacketPtr& pp) {
virtual ROC_ATTR_NODISCARD status::StatusCode read(packet::PacketPtr& pp) {
++call_count_;

if (code_enabled_) {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/roc_fec/test_writer_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class StatusReader : public packet::IReader {
: code_(code) {
}

virtual status::StatusCode read(packet::PacketPtr&) {
virtual ROC_ATTR_NODISCARD status::StatusCode read(packet::PacketPtr&) {
return code_;
}

Expand Down
2 changes: 1 addition & 1 deletion src/tests/roc_packet/test_delayed_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class StatusReader : public IReader {
: code_(code) {
}

virtual status::StatusCode read(PacketPtr&) {
virtual ROC_ATTR_NODISCARD status::StatusCode read(PacketPtr&) {
return code_;
}

Expand Down
2 changes: 1 addition & 1 deletion src/tests/roc_rtp/test_helpers/status_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class StatusReader : public packet::IReader {
: code_(code) {
}

virtual status::StatusCode read(packet::PacketPtr&) {
virtual ROC_ATTR_NODISCARD status::StatusCode read(packet::PacketPtr&) {
return code_;
}

Expand Down

0 comments on commit 2a805e7

Please sign in to comment.