Created a CURLMIN macro to match CURLMAX
This commit is contained in:
10
lib/sendf.c
10
lib/sendf.c
@@ -559,10 +559,6 @@ int Curl_read_plain(curl_socket_t sockfd,
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Internal read-from-socket function. This is meant to deal with plain
|
||||
* sockets, SSL sockets and kerberos sockets.
|
||||
@@ -591,7 +587,7 @@ int Curl_read(struct connectdata *conn, /* connection data */
|
||||
|
||||
/* If session can pipeline, check connection buffer */
|
||||
if(pipelining) {
|
||||
size_t bytestocopy = MIN(conn->buf_len - conn->read_pos, sizerequested);
|
||||
size_t bytestocopy = CURLMIN(conn->buf_len - conn->read_pos, sizerequested);
|
||||
|
||||
/* Copy from our master buffer first if we have some unread data there*/
|
||||
if(bytestocopy > 0) {
|
||||
@@ -604,11 +600,11 @@ int Curl_read(struct connectdata *conn, /* connection data */
|
||||
}
|
||||
/* If we come here, it means that there is no data to read from the buffer,
|
||||
* so we read from the socket */
|
||||
bytesfromsocket = MIN(sizerequested, BUFSIZE * sizeof (char));
|
||||
bytesfromsocket = CURLMIN(sizerequested, BUFSIZE * sizeof (char));
|
||||
buffertofill = conn->master_buffer;
|
||||
}
|
||||
else {
|
||||
bytesfromsocket = MIN((long)sizerequested, conn->data->set.buffer_size ?
|
||||
bytesfromsocket = CURLMIN((long)sizerequested, conn->data->set.buffer_size ?
|
||||
conn->data->set.buffer_size : BUFSIZE);
|
||||
buffertofill = buf;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user