diff options
author | Xin Li <delphij@google.com> | 2023-08-14 15:38:30 -0700 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2023-08-14 15:38:30 -0700 |
commit | bddf63953e111d742b591c1c0c7c34bcda8a51c7 (patch) | |
tree | 3a93128bff4b737b24b0c9581922c0b20410f0f4 /pw_ring_buffer/docs.rst | |
parent | ee890da55c82b95deca3518d5f3777e3d8ca9f0e (diff) | |
parent | fbb9890f8922aa55fde183655a0017e69127ea4b (diff) | |
download | pigweed-bddf63953e111d742b591c1c0c7c34bcda8a51c7.tar.gz |
Merge Android U (ab/10368041)tmp_amf_298295554
Bug: 291102124
Merged-In: I10c41adb8fe3e126cfa4ff2f49b15863fff379de
Change-Id: I66f7a6cccaafc173d3924dae62a736c6c53520c7
Diffstat (limited to 'pw_ring_buffer/docs.rst')
-rw-r--r-- | pw_ring_buffer/docs.rst | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pw_ring_buffer/docs.rst b/pw_ring_buffer/docs.rst index a0efbfec4..673861042 100644 --- a/pw_ring_buffer/docs.rst +++ b/pw_ring_buffer/docs.rst @@ -27,8 +27,9 @@ entries in the provided buffer. // Setting up buffers and attaching a reader. std::byte buffer[1024]; std::byte read_buffer[256]; - PrefixedEntryRingBuffer ring_buffer(buffer); + PrefixedEntryRingBuffer ring_buffer; PrefixedEntryRingBuffer::Reader reader; + ring_buffer.SetBuffer(buffer); ring_buffer.AttachReader(reader); // Insert some entries and process some entries. @@ -43,7 +44,8 @@ entries in the provided buffer. // You can use a range-based for-loop to walk through all entries. for (auto entry : ring_buffer) { - PW_LOG_WARN("Read entry of size: %lu", entry.size()); + PW_LOG_WARN("Read entry of size: %u", + static_cast<unsigned>(entry.buffer.size())); } In cases where a crash has caused the ring buffer to have corrupted data, the @@ -60,7 +62,8 @@ indicating the reason the iterator reached it's end. // Hold the iterator outside any loops to inspect it later. iterator it = ring_buffer.begin(); for (; it != it.end(); ++it) { - PW_LOG_WARN("Read entry of size: %lu", it->size()); + PW_LOG_WARN("Read entry of size: %u", + static_cast<unsigned>(it->buffer.size())); } // Warn if there was a failure during iteration. |