summaryrefslogtreecommitdiff
path: root/libs/libcurl/src/bufq.c
diff options
context:
space:
mode:
authordartraiden <wowemuh@gmail.com>2024-03-27 16:04:05 +0300
committerdartraiden <wowemuh@gmail.com>2024-03-27 16:04:05 +0300
commit26b7f4e979561aa1f17d6719fc1dad91e1a5d1b4 (patch)
tree98aafdc421d93e855ddc886fe56e9e084f992ac8 /libs/libcurl/src/bufq.c
parent9be45ab3f9c03107dfb717798e41dda72576122d (diff)
libcurl: update to 8.7.1
Diffstat (limited to 'libs/libcurl/src/bufq.c')
-rw-r--r--libs/libcurl/src/bufq.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/libs/libcurl/src/bufq.c b/libs/libcurl/src/bufq.c
index a8c6b73c75..2bcad8a57f 100644
--- a/libs/libcurl/src/bufq.c
+++ b/libs/libcurl/src/bufq.c
@@ -396,7 +396,7 @@ ssize_t Curl_bufq_write(struct bufq *q,
while(len) {
tail = get_non_full_tail(q);
if(!tail) {
- if(q->chunk_count < q->max_chunks) {
+ if((q->chunk_count < q->max_chunks) || (q->opts & BUFQ_OPT_SOFT_LIMIT)) {
*err = CURLE_OUT_OF_MEMORY;
return -1;
}
@@ -417,6 +417,17 @@ ssize_t Curl_bufq_write(struct bufq *q,
return nwritten;
}
+CURLcode Curl_bufq_cwrite(struct bufq *q,
+ const char *buf, size_t len,
+ size_t *pnwritten)
+{
+ ssize_t n;
+ CURLcode result;
+ n = Curl_bufq_write(q, (const unsigned char *)buf, len, &result);
+ *pnwritten = (n < 0)? 0 : (size_t)n;
+ return result;
+}
+
ssize_t Curl_bufq_read(struct bufq *q, unsigned char *buf, size_t len,
CURLcode *err)
{
@@ -440,6 +451,16 @@ ssize_t Curl_bufq_read(struct bufq *q, unsigned char *buf, size_t len,
return nread;
}
+CURLcode Curl_bufq_cread(struct bufq *q, char *buf, size_t len,
+ size_t *pnread)
+{
+ ssize_t n;
+ CURLcode result;
+ n = Curl_bufq_read(q, (unsigned char *)buf, len, &result);
+ *pnread = (n < 0)? 0 : (size_t)n;
+ return result;
+}
+
bool Curl_bufq_peek(struct bufq *q,
const unsigned char **pbuf, size_t *plen)
{