Skip to content
Bitcoin Roots

v31.1-roots.1 · Commit 9: [PATCH 09/17] fix(roots): restore audited portability and runtime behavior

src/streams.cpp

Before: src/streams.cpp · After: src/streams.cpp

File metadata
index e38b9592942e3f63772359e9e81fa7a66995485b..86b931a71e09aa933421d3a7012d45b61ef95fa6 100644

Download original patch · Release notes

Diff rows 1–7 of 7. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.

src/streams.cpp CHANGED
@@ -95,6 +95,7 @@ void AutoFile::ignore(size_t nSize)
95
  void AutoFile::write(std::span<const std::byte> src)
96
  {
97
  if (!m_file) throw std::ios_base::failure("AutoFile::write: file handle is nullptr");
 
98
  if (!m_obfuscation) {
99
  if (std::fwrite(src.data(), 1, src.size(), m_file) != src.size()) {
100
  throw std::ios_base::failure("AutoFile::write: write failed");
 
95
  void AutoFile::write(std::span<const std::byte> src)
96
  {
97
  if (!m_file) throw std::ios_base::failure("AutoFile::write: file handle is nullptr");
98
+ if (src.empty()) return;
99
  if (!m_obfuscation) {
100
  if (std::fwrite(src.data(), 1, src.size(), m_file) != src.size()) {
101
  throw std::ios_base::failure("AutoFile::write: write failed");