Boost library min/max guidance:

fix #170
This commit is contained in:
Vinnie Falco
2016-11-12 11:27:56 -05:00
parent 02feea5128
commit 84a6775dc1
13 changed files with 21 additions and 19 deletions
+4 -4
View File
@@ -657,7 +657,7 @@ basic_streambuf<Allocator>::commit(size_type n)
debug_check();
}
n = std::min(n, out_end_ - out_pos_);
n = (std::min)(n, out_end_ - out_pos_);
out_pos_ += n;
in_size_ += n;
if(out_pos_ == out_->size())
@@ -862,13 +862,13 @@ read_size_helper(basic_streambuf<
// buffer, try to fill that up first
auto const avail = streambuf.capacity() - streambuf.size();
if (avail > 0)
return std::min(avail, max_size);
return (std::min)(avail, max_size);
// Try to have just one new block allocated
constexpr std::size_t low = 512;
if (streambuf.alloc_size_ > low)
return std::min(max_size, streambuf.alloc_size_);
return (std::min)(max_size, streambuf.alloc_size_);
// ...but enforce a 512 byte minimum.
return std::min(max_size, low);
return (std::min)(max_size, low);
}
template<class Alloc, class T>
+1 -1
View File
@@ -444,7 +444,7 @@ buffers_adapter<MutableBufferSequence>::commit(std::size_t n)
max_size_ -= avail;
}
n = std::min(n, out_end_ - out_pos_);
n = (std::min)(n, out_end_ - out_pos_);
out_pos_ += n;
in_size_ += n;
max_size_ -= n;