Codechange: Remove min/max functions in favour of STL variants (#8502)

This commit is contained in:
Charles Pigott
2021-01-08 10:16:18 +00:00
committed by GitHub
parent c1fddb9a6a
commit 9b800a96ed
181 changed files with 900 additions and 954 deletions

View File

@@ -250,8 +250,8 @@ int NetworkHTTPSocketHandler::Receive()
/* Wait till we read the end-of-header identifier */
if (this->recv_length == 0) {
int read = this->recv_pos + res;
int end = min(read, lengthof(this->recv_buffer) - 1);
ssize_t read = this->recv_pos + res;
ssize_t end = std::min<ssize_t>(read, lengthof(this->recv_buffer) - 1);
/* Do a 'safe' search for the end of the header. */
char prev = this->recv_buffer[end];
@@ -272,7 +272,7 @@ int NetworkHTTPSocketHandler::Receive()
this->recv_length = ret;
end_of_header += strlen(END_OF_HEADER);
int len = min(read - (end_of_header - this->recv_buffer), res);
int len = std::min(read - (end_of_header - this->recv_buffer), res);
if (len != 0) {
this->callback->OnReceiveData(end_of_header, len);
this->recv_length -= len;
@@ -281,7 +281,7 @@ int NetworkHTTPSocketHandler::Receive()
this->recv_pos = 0;
}
} else {
res = min(this->recv_length, res);
res = std::min<ssize_t>(this->recv_length, res);
/* Receive whatever we're expecting. */
this->callback->OnReceiveData(this->recv_buffer, res);
this->recv_length -= res;