pw_file: Remove use of pw_rpc channel payload buffer
Provide a buffer for encoding rather than using the deprecated
pw_rpc PayloadBuffer() API.
Bug: 605
Change-Id: I2961f1e1e5f3b894713296ee9f23a849d8fd3015
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/81840
Reviewed-by: Armando Montanez <amontanez@google.com>
diff --git a/pw_file/flat_file_system.cc b/pw_file/flat_file_system.cc
index fc15b4e..ea24478 100644
--- a/pw_file/flat_file_system.cc
+++ b/pw_file/flat_file_system.cc
@@ -36,12 +36,6 @@
using Entry = FlatFileSystemService::Entry;
-// TODO(pwbug/605): Remove this hack for accessing the PayloadBuffer() API.
-class AccessHiddenFunctions : public rpc::RawServerWriter {
- public:
- using RawServerWriter::PayloadBuffer;
-};
-
Status FlatFileSystemService::EnumerateFile(
Entry& entry, pw::file::ListResponse::StreamEncoder& output_encoder) {
StatusWithSize sws = entry.Name(file_name_buffer_);
@@ -64,8 +58,7 @@
for (Entry* entry : entries_) {
PW_DCHECK_NOTNULL(entry);
// For now, don't try to pack entries.
- pw::file::ListResponse::MemoryEncoder encoder(
- static_cast<AccessHiddenFunctions&>(writer).PayloadBuffer());
+ pw::file::ListResponse::MemoryEncoder encoder(encoding_buffer_);
if (Status status = EnumerateFile(*entry, encoder); !status.ok()) {
if (status != Status::NotFound()) {
PW_LOG_ERROR("Failed to enumerate file (id: %u) with status %d",
@@ -108,8 +101,7 @@
return;
}
- pw::file::ListResponse::MemoryEncoder encoder(
- static_cast<AccessHiddenFunctions&>(writer).PayloadBuffer());
+ pw::file::ListResponse::MemoryEncoder encoder(encoding_buffer_);
Status proto_encode_status = EnumerateFile(*result.value(), encoder);
if (!proto_encode_status.ok()) {
writer.Finish(proto_encode_status);