summaryrefslogtreecommitdiff
path: root/Utilities/cmcurl/lib/dynbuf.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-10-31 16:11:41 -0400
committerBrad King <brad.king@kitware.com>2022-10-31 16:11:41 -0400
commit9ffe6b0969fc270cc2a1aac2b2c1bf986af291d5 (patch)
tree75711965f7fd24679383853a840f42efff676e31 /Utilities/cmcurl/lib/dynbuf.c
parentfa9bbb8627e8af5153367721eb037b6e094670d1 (diff)
parentec122fff08ab9a8e56fb90126ecedb99c759011b (diff)
downloadcmake-9ffe6b0969fc270cc2a1aac2b2c1bf986af291d5.tar.gz
Merge branch 'upstream-curl' into update-curl
* upstream-curl: curl 2022-10-26 (cd95ee9f)
Diffstat (limited to 'Utilities/cmcurl/lib/dynbuf.c')
-rw-r--r--Utilities/cmcurl/lib/dynbuf.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/Utilities/cmcurl/lib/dynbuf.c b/Utilities/cmcurl/lib/dynbuf.c
index ada7e0ccf5..0b1cf9afd8 100644
--- a/Utilities/cmcurl/lib/dynbuf.c
+++ b/Utilities/cmcurl/lib/dynbuf.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2020 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -18,6 +18,8 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
+ * SPDX-License-Identifier: curl
+ *
***************************************************************************/
#include "curl_setup.h"
@@ -126,7 +128,6 @@ void Curl_dyn_reset(struct dynbuf *s)
s->leng = 0;
}
-#ifdef USE_NGTCP2
/*
* Specify the size of the tail to keep (number of bytes from the end of the
* buffer). The rest will be dropped.
@@ -151,7 +152,6 @@ CURLcode Curl_dyn_tail(struct dynbuf *s, size_t trail)
return CURLE_OK;
}
-#endif
/*
* Appends a buffer with length.
@@ -253,3 +253,18 @@ size_t Curl_dyn_len(const struct dynbuf *s)
DEBUGASSERT(!s->leng || s->bufr);
return s->leng;
}
+
+/*
+ * Set a new (smaller) length.
+ */
+CURLcode Curl_dyn_setlen(struct dynbuf *s, size_t set)
+{
+ DEBUGASSERT(s);
+ DEBUGASSERT(s->init == DYNINIT);
+ DEBUGASSERT(!s->leng || s->bufr);
+ if(set > s->leng)
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+ s->leng = set;
+ s->bufr[s->leng] = 0;
+ return CURLE_OK;
+}