pw_transfer: Account for remaining_bytes in payload buffer

This updates the transfer buffer size reservation to include space for
the `remaining_bytes` field if a transfer size is set.

Tested: The added unit test fails to encode without the fix, but
        succeeds with it.
Change-Id: I8aae3547117e1ed1e4f6ab6adf3839a807668e53
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/190572
Pigweed-Auto-Submit: Alexei Frolov <frolv@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
2 files changed
tree: f16efff6a39f2abbb74736fa9438605096efa45e
  1. .allstar/
  2. .vscode/
  3. build_overrides/
  4. docker/
  5. docs/
  6. kudzu/
  7. pw_alignment/
  8. pw_allocator/
  9. pw_analog/
  10. pw_android_toolchain/
  11. pw_arduino_build/
  12. pw_assert/
  13. pw_assert_basic/
  14. pw_assert_log/
  15. pw_assert_tokenized/
  16. pw_assert_zephyr/
  17. pw_async/
  18. pw_async2/
  19. pw_async2_basic/
  20. pw_async_basic/
  21. pw_base64/
  22. pw_bloat/
  23. pw_blob_store/
  24. pw_bluetooth/
  25. pw_bluetooth_hci/
  26. pw_bluetooth_profiles/
  27. pw_bluetooth_sapphire/
  28. pw_boot/
  29. pw_boot_cortex_m/
  30. pw_build/
  31. pw_build_info/
  32. pw_build_mcuxpresso/
  33. pw_bytes/
  34. pw_channel/
  35. pw_checksum/
  36. pw_chre/
  37. pw_chrono/
  38. pw_chrono_embos/
  39. pw_chrono_freertos/
  40. pw_chrono_rp2040/
  41. pw_chrono_stl/
  42. pw_chrono_threadx/
  43. pw_chrono_zephyr/
  44. pw_cli/
  45. pw_compilation_testing/
  46. pw_console/
  47. pw_containers/
  48. pw_cpu_exception/
  49. pw_cpu_exception_cortex_m/
  50. pw_crypto/
  51. pw_digital_io/
  52. pw_digital_io_mcuxpresso/
  53. pw_digital_io_rp2040/
  54. pw_docgen/
  55. pw_doctor/
  56. pw_emu/
  57. pw_env_setup/
  58. pw_file/
  59. pw_format/
  60. pw_function/
  61. pw_fuzzer/
  62. pw_grpc/
  63. pw_hdlc/
  64. pw_hex_dump/
  65. pw_i2c/
  66. pw_i2c_linux/
  67. pw_i2c_mcuxpresso/
  68. pw_ide/
  69. pw_interrupt/
  70. pw_interrupt_cortex_m/
  71. pw_interrupt_xtensa/
  72. pw_interrupt_zephyr/
  73. pw_intrusive_ptr/
  74. pw_kvs/
  75. pw_libc/
  76. pw_libcxx/
  77. pw_log/
  78. pw_log_android/
  79. pw_log_basic/
  80. pw_log_null/
  81. pw_log_rpc/
  82. pw_log_string/
  83. pw_log_tokenized/
  84. pw_log_zephyr/
  85. pw_malloc/
  86. pw_malloc_freelist/
  87. pw_malloc_freertos/
  88. pw_metric/
  89. pw_minimal_cpp_stdlib/
  90. pw_module/
  91. pw_multibuf/
  92. pw_multisink/
  93. pw_package/
  94. pw_perf_test/
  95. pw_persistent_ram/
  96. pw_polyfill/
  97. pw_preprocessor/
  98. pw_presubmit/
  99. pw_protobuf/
  100. pw_protobuf_compiler/
  101. pw_random/
  102. pw_result/
  103. pw_ring_buffer/
  104. pw_router/
  105. pw_rpc/
  106. pw_rpc_transport/
  107. pw_rust/
  108. pw_snapshot/
  109. pw_software_update/
  110. pw_span/
  111. pw_spi/
  112. pw_spi_mcuxpresso/
  113. pw_status/
  114. pw_stm32cube_build/
  115. pw_stream/
  116. pw_stream_shmem_mcuxpresso/
  117. pw_stream_uart_linux/
  118. pw_stream_uart_mcuxpresso/
  119. pw_string/
  120. pw_symbolizer/
  121. pw_sync/
  122. pw_sync_baremetal/
  123. pw_sync_embos/
  124. pw_sync_freertos/
  125. pw_sync_stl/
  126. pw_sync_threadx/
  127. pw_sync_zephyr/
  128. pw_sys_io/
  129. pw_sys_io_ambiq_sdk/
  130. pw_sys_io_arduino/
  131. pw_sys_io_baremetal_lm3s6965evb/
  132. pw_sys_io_baremetal_stm32f429/
  133. pw_sys_io_emcraft_sf2/
  134. pw_sys_io_mcuxpresso/
  135. pw_sys_io_rp2040/
  136. pw_sys_io_stdio/
  137. pw_sys_io_stm32cube/
  138. pw_sys_io_zephyr/
  139. pw_system/
  140. pw_target_runner/
  141. pw_thread/
  142. pw_thread_embos/
  143. pw_thread_freertos/
  144. pw_thread_stl/
  145. pw_thread_threadx/
  146. pw_thread_zephyr/
  147. pw_tls_client/
  148. pw_tls_client_boringssl/
  149. pw_tls_client_mbedtls/
  150. pw_tokenizer/
  151. pw_toolchain/
  152. pw_toolchain_bazel/
  153. pw_trace/
  154. pw_trace_tokenized/
  155. pw_transfer/
  156. pw_unit_test/
  157. pw_unit_test_zephyr/
  158. pw_varint/
  159. pw_watch/
  160. pw_web/
  161. pw_work_queue/
  162. seed/
  163. targets/
  164. third_party/
  165. ts/
  166. zephyr/
  167. .bazelignore
  168. .bazelrc
  169. .black.toml
  170. .clang-format
  171. .clang-tidy
  172. .eslintrc.cjs
  173. .git-blame-ignore-revs
  174. .gitattributes
  175. .gitignore
  176. .gn
  177. .mypy.ini
  178. .prettierignore
  179. .prettierrc.cjs
  180. .pw_ide.yaml
  181. .pylintrc
  182. activate.bat
  183. Android.bp
  184. AUTHORS
  185. bootstrap.bat
  186. bootstrap.sh
  187. BUILD.bazel
  188. BUILD.gn
  189. BUILDCONFIG.gn
  190. CMakeLists.txt
  191. jest.config.ts
  192. Kconfig.zephyr
  193. LICENSE
  194. modules.gni
  195. OWNERS
  196. package-lock.json
  197. package.json
  198. pigweed.json
  199. PIGWEED_MODULES
  200. README.md
  201. rollup.config.js
  202. tsconfig.json
  203. WORKSPACE
README.md

Pigweed

Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.

For more information please see our website: https://pigweed.dev/.

Links