pw_rpc: Expand server-side packet processing - Handle various error cases with incoming packets. - Dynamically assign a channel when a packet's ID doesn't exist. - Reserve space in the response buffer for packet "header" fields. Change-Id: Ibdce99c8ff1d37aa46bb4e400a4d8f8e646a8ac7
diff --git a/pw_protobuf/encoder.cc b/pw_protobuf/encoder.cc index 05ce88a..c20b093 100644 --- a/pw_protobuf/encoder.cc +++ b/pw_protobuf/encoder.cc
@@ -56,7 +56,10 @@ return encode_status_; } - memcpy(cursor_, ptr, size); + // Memmove the value into place as it's possible that it shares the encode + // buffer on a memory-constrained system. + std::memmove(cursor_, ptr, size); + cursor_ += size; return Status::OK; } @@ -167,7 +170,7 @@ to_copy = end - read_cursor; } - memmove(write_cursor, read_cursor, to_copy); + std::memmove(write_cursor, read_cursor, to_copy); write_cursor += to_copy; read_cursor += to_copy;