Reduce conflict between std::min and macros

Adjust usage of std::min to be more compatible with systems that define
a min(...) macro
This commit is contained in:
Peter Thorson
2014-08-09 15:36:10 -05:00
parent e203dbed45
commit 122d4e2128
5 changed files with 7 additions and 5 deletions

View File

@@ -1,4 +1,6 @@
HEAD
- Compatibility: Adjust usage of std::min to be more compatible with systems
that define a min(...) macro.
0.3.0 - 2014-08-10
- Feature: Adds `start_perpetual` and `stop_perpetual` methods to asio transport

View File

@@ -643,7 +643,7 @@ private:
m_s2c_max_window_bits = bits;
break;
case mode::largest:
m_s2c_max_window_bits = std::min(bits,m_s2c_max_window_bits);
m_s2c_max_window_bits = (std::min)(bits,m_s2c_max_window_bits);
break;
case mode::smallest:
m_s2c_max_window_bits = min_s2c_max_window_bits;

View File

@@ -110,7 +110,7 @@ public:
// of warning or exception.
const std::string& key3 = req.get_header("Sec-WebSocket-Key3");
std::copy(key3.c_str(),
key3.c_str()+std::min(static_cast<size_t>(8), key3.size()),
key3.c_str()+(std::min)(static_cast<size_t>(8), key3.size()),
&key_final[8]);
res.append_header(

View File

@@ -404,7 +404,7 @@ public:
} else if (m_state == EXTENSION) {
m_state = APPLICATION;
} else if (m_state == APPLICATION) {
size_t bytes_to_process = std::min(m_bytes_needed,len-p);
size_t bytes_to_process = (std::min)(m_bytes_needed,len-p);
if (bytes_to_process > 0) {
p += this->process_payload_bytes(buf+p,bytes_to_process,ec);
@@ -670,7 +670,7 @@ protected:
/// Reads bytes from buf into m_extended_header
size_t copy_extended_header_bytes(uint8_t const * buf, size_t len) {
size_t bytes_to_read = std::min(m_bytes_needed,len);
size_t bytes_to_read = (std::min)(m_bytes_needed,len);
std::copy(buf,buf+bytes_to_read,m_extended_header.bytes+m_cursor);
m_cursor += bytes_to_read;

View File

@@ -510,7 +510,7 @@ private:
return 0;
}
size_t bytes_to_copy = std::min(len,m_len-m_cursor);
size_t bytes_to_copy = (std::min)(len,m_len-m_cursor);
std::copy(buf,buf+bytes_to_copy,m_buf+m_cursor);