Skip to content

Commit 2a805e7

Browse files
dshilgavv
authored andcommitted
GH-303 Ensure implementations of packet::IReader use ROC_ATTR_NODISCARD
See also: #591 (comment)
1 parent 718edf4 commit 2a805e7

File tree

12 files changed

+12
-12
lines changed

12 files changed

+12
-12
lines changed

src/internal_modules/roc_fec/reader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class Reader : public packet::IReader, public core::NonCopyable<> {
6969
//! Read packet.
7070
//! @remarks
7171
//! When a packet loss is detected, try to restore it from repair packets.
72-
virtual status::StatusCode read(packet::PacketPtr&);
72+
virtual ROC_ATTR_NODISCARD status::StatusCode read(packet::PacketPtr&);
7373

7474
private:
7575
status::StatusCode read_(packet::PacketPtr&);

src/internal_modules/roc_packet/concurrent_queue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ConcurrentQueue : public IReader, public IWriter, public core::NonCopyable
4141
//! If reads are not concurrent, and queue is non-blocking, then
4242
//! reads are wait-free. Otherwise they may block.
4343
//! @see Mode.
44-
virtual status::StatusCode read(PacketPtr&);
44+
virtual ROC_ATTR_NODISCARD status::StatusCode read(PacketPtr&);
4545

4646
//! Add packet to the queue.
4747
//! Wait-free operation.

src/internal_modules/roc_packet/delayed_reader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class DelayedReader : public IReader, public core::NonCopyable<> {
3838
const audio::SampleSpec& sample_spec);
3939

4040
//! Read packet.
41-
virtual status::StatusCode read(PacketPtr&);
41+
virtual ROC_ATTR_NODISCARD status::StatusCode read(PacketPtr&);
4242

4343
private:
4444
status::StatusCode fetch_packets_();

src/internal_modules/roc_packet/queue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace packet {
2525
class Queue : public IReader, public IWriter, public core::NonCopyable<> {
2626
public:
2727
//! Read next packet.
28-
virtual status::StatusCode read(PacketPtr& packet);
28+
virtual ROC_ATTR_NODISCARD status::StatusCode read(PacketPtr& packet);
2929

3030
//! Add packet to the queue.
3131
//! @remarks

src/internal_modules/roc_packet/sorted_queue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class SortedQueue : public IWriter, public IReader, public core::NonCopyable<> {
4242
//!
4343
//! @remarks
4444
//! Removes returned packet from the queue.
45-
virtual status::StatusCode read(PacketPtr& packet);
45+
virtual ROC_ATTR_NODISCARD status::StatusCode read(PacketPtr& packet);
4646

4747
//! Get number of packets in queue.
4848
size_t size() const;

src/internal_modules/roc_rtp/populator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Populator : public packet::IReader, public core::NonCopyable<> {
2929
const audio::SampleSpec& sample_spec);
3030

3131
//! Read next packet.
32-
virtual status::StatusCode read(packet::PacketPtr&);
32+
virtual ROC_ATTR_NODISCARD status::StatusCode read(packet::PacketPtr&);
3333

3434
private:
3535
packet::IReader& reader_;

src/internal_modules/roc_rtp/timestamp_injector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class TimestampInjector : public packet::IReader, public core::NonCopyable<> {
3636
//! Get packet with filled capture ts field.
3737
//! @remarks
3838
//! If update_mapping has not been called yet, capture timestamp will be 0.
39-
virtual status::StatusCode read(packet::PacketPtr&);
39+
virtual ROC_ATTR_NODISCARD status::StatusCode read(packet::PacketPtr&);
4040

4141
//! Get a pair of a reference timestamps.
4242
void update_mapping(core::nanoseconds_t capture_ts,

src/internal_modules/roc_rtp/validator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Validator : public packet::IReader, public core::NonCopyable<> {
5151
//!
5252
//! @remarks
5353
//! Reads packet from the underlying reader and validates it.
54-
virtual status::StatusCode read(packet::PacketPtr& pp);
54+
virtual ROC_ATTR_NODISCARD status::StatusCode read(packet::PacketPtr& pp);
5555

5656
private:
5757
bool validate_(const packet::RTP& prev, const packet::RTP& next) const;

src/tests/roc_audio/test_depacketizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class TestReader : public packet::IReader {
133133
, code_(default_code_) {
134134
}
135135

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

139139
if (code_enabled_) {

src/tests/roc_fec/test_writer_reader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class StatusReader : public packet::IReader {
6969
: code_(code) {
7070
}
7171

72-
virtual status::StatusCode read(packet::PacketPtr&) {
72+
virtual ROC_ATTR_NODISCARD status::StatusCode read(packet::PacketPtr&) {
7373
return code_;
7474
}
7575

0 commit comments

Comments
 (0)