tidy-up: use more static, sizeof(), char[], double-const

- make `const` data `static`, where missing and possible.
- replace `strlen()` on literal or const strings with `sizeof()`.
  While the latter is optimized by popular C compiler, e.g. MSVC only
  does it with `/O2`.
- replace magic numbers with `sizeof()`, where missing.
- introduce `CURL_CSTRLEN()` macro for `sizeof(char[]) - 1`.
- use `CURL_CSTRLEN()` macro.
- move `const` before integer types, where missing.
- replace `char *var` with `var[]`, where missing and possible.
- use double const, where missing.
  `static const char *` -> `static const char * const`.
- lib1514: constify pointers.
- unit3205: drop redundant cast, avoid another one.
- unit1666: map `OID()` macro to identical `STRCONST()`.

Closes #22406
This commit is contained in:
Viktor Szakats 2026-07-23 01:50:06 +02:00
parent 573a6ec16b
commit e1450d8fda
No known key found for this signature in database
117 changed files with 311 additions and 287 deletions

View file

@ -949,7 +949,7 @@ static int curltest_post_config(apr_pool_t *p, apr_pool_t *plog,
apr_pool_t *ptemp, server_rec *s)
{
void *data = NULL;
const char *key = "mod_curltest_init_counter";
static const char *key = "mod_curltest_init_counter";
(void)p;
(void)plog;

View file

@ -29,7 +29,7 @@
#include "first.h"
struct t1514_WriteThis {
char *readptr;
const char *readptr;
size_t sizeleft;
};
@ -55,9 +55,9 @@ static CURLcode test_lib1514(const char *URL)
CURL *curl;
CURLcode result = CURLE_OK;
static char testdata[] = "dummy";
static const char testdata[] = "dummy";
struct t1514_WriteThis pooh = { testdata, sizeof(testdata) - 1 };
struct t1514_WriteThis pooh = { testdata, CURL_CSTRLEN(testdata) };
global_init(CURL_GLOBAL_ALL);

View file

@ -60,7 +60,7 @@ static CURLcode test_lib1517(const char *URL)
struct t1517_WriteThis pooh;
pooh.readptr = testdata;
pooh.sizeleft = sizeof(testdata) - 1;
pooh.sizeleft = CURL_CSTRLEN(testdata);
if(curl_global_init(CURL_GLOBAL_ALL)) {
curl_mfprintf(stderr, "curl_global_init() failed\n");

View file

@ -29,7 +29,7 @@ struct upload_status {
static size_t t1520_read_cb(char *ptr, size_t size, size_t nmemb, void *userp)
{
static const char *payload_text[] = {
static const char * const payload_text[] = {
"From: different\r\n",
"To: another\r\n",
"\r\n",

View file

@ -31,7 +31,7 @@
#include "first.h"
static const char t1525_data[] = "Hello Cloud!\n";
static size_t const t1525_datalen = sizeof(t1525_data) - 1;
static const size_t t1525_datalen = CURL_CSTRLEN(t1525_data);
static size_t t1525_read_cb(char *ptr, size_t size, size_t nmemb, void *stream)
{

View file

@ -30,7 +30,7 @@
#include "first.h"
static const char t1526_data[] = "Hello Cloud!\n";
static size_t const t1526_datalen = sizeof(t1526_data) - 1;
static const size_t t1526_datalen = CURL_CSTRLEN(t1526_data);
static size_t t1526_read_cb(char *ptr, size_t size, size_t nmemb, void *stream)
{

View file

@ -30,7 +30,7 @@
#include "first.h"
static const char t1527_data[] = "Hello Cloud!\n";
static size_t const t1527_datalen = sizeof(t1527_data) - 1;
static const size_t t1527_datalen = CURL_CSTRLEN(t1527_data);
static size_t t1527_read_cb(char *ptr, size_t size, size_t nmemb, void *stream)
{

View file

@ -25,8 +25,8 @@
static CURLcode test_lib1531(const char *URL)
{
static char const testdata[] = ".abc\0xyz";
static curl_off_t const testdatalen = sizeof(testdata) - 1;
static const char testdata[] = ".abc\0xyz";
static const curl_off_t testdatalen = CURL_CSTRLEN(testdata);
CURL *curl;
CURLM *multi;

View file

@ -25,8 +25,10 @@
static CURLcode test_lib1537(const char *URL)
{
const unsigned char a[] = { 0x2f, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe6, 0xf7 };
static const unsigned char a[] = {
0x2f, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe6, 0xf7
};
CURLcode result = CURLE_OK;
char *ptr = NULL;
int asize;

View file

@ -23,7 +23,7 @@
***************************************************************************/
#include "first.h"
static const char *ldata_names[] = {
static const char * const ldata_names[] = {
"NONE",
"SHARE",
"COOKIE",

View file

@ -2269,7 +2269,7 @@ static char bigpart[120000];
*/
static int huge(void)
{
static const char *smallpart = "c";
static const char smallpart[] = "c";
int i;
CURLU *urlp = curl_url();
CURLUcode rc;
@ -2323,7 +2323,7 @@ static int huge(void)
static int urldup(void)
{
static const char *url[] = {
static const char * const url[] = {
"http://"
"user:pwd@"
"[2a04:4e42:e00::347%25eth0]"

View file

@ -23,8 +23,9 @@
***************************************************************************/
#include "first.h"
static char t1576_data[] = "request indicates that the client, which made";
static size_t const t1576_datalen = sizeof(t1576_data) - 1;
static const char t1576_data[] = "request indicates that the client, "
"which made";
static const size_t t1576_datalen = CURL_CSTRLEN(t1576_data);
static size_t t1576_read_cb(char *ptr, size_t size, size_t nmemb, void *stream)
{

View file

@ -34,7 +34,7 @@ static size_t consumed = 0;
static size_t t1591_read_cb(char *ptr, size_t size, size_t nmemb, void *stream)
{
static const char testdata[] = "Hello Cloud!\r\n";
static size_t const datalen = sizeof(testdata) - 1;
static const size_t datalen = CURL_CSTRLEN(testdata);
size_t amount = nmemb * size; /* Total bytes curl wants */

View file

@ -52,7 +52,7 @@ static int t1598_trailers_callback(struct curl_slist **list, void *userdata)
static CURLcode test_lib1598(const char *URL)
{
static const char *post_data = "xxx=yyy&aaa=bbbbb";
static const char post_data[] = "xxx=yyy&aaa=bbbbb";
CURL *curl = NULL;
CURLcode result = CURLE_FAILED_INIT;
@ -84,7 +84,7 @@ static CURLcode test_lib1598(const char *URL)
easy_setopt(curl, CURLOPT_URL, URL);
easy_setopt(curl, CURLOPT_HTTPHEADER, hhl);
easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(post_data));
easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)CURL_CSTRLEN(post_data));
easy_setopt(curl, CURLOPT_POSTFIELDS, post_data);
easy_setopt(curl, CURLOPT_TRAILERFUNCTION, t1598_trailers_callback);
easy_setopt(curl, CURLOPT_TRAILERDATA, NULL);

View file

@ -30,7 +30,7 @@ struct t1662_WriteThis {
static size_t t1662_read_cb(char *ptr, size_t size, size_t nmemb, void *userp)
{
static const char testdata[] = "mooaaa";
static size_t const testdatalen = sizeof(testdata) - 1;
static const size_t testdatalen = CURL_CSTRLEN(testdata);
struct t1662_WriteThis *pooh = (struct t1662_WriteThis *)userp;

View file

@ -25,7 +25,7 @@
static size_t t1901_read_cb(char *ptr, size_t size, size_t nmemb, void *stream)
{
static const char *chunks[] = { "one", "two", "three", "four", NULL };
static const char * const chunks[] = { "one", "two", "three", "four", NULL };
static int ix = 0;
(void)stream;
if(chunks[ix]) {

View file

@ -25,7 +25,7 @@
static void t1940_showem(CURL *curl, int header_request, unsigned int type)
{
static const char *testdata[] = {
static const char * const testdata[] = {
"daTE",
"Server",
"content-type",

View file

@ -55,9 +55,9 @@ static CURLcode test_lib1948(const char *URL)
easy_setopt(curl, CURLOPT_HEADER, 1L);
easy_setopt(curl, CURLOPT_READFUNCTION, put_callback);
pbuf.buf = testput;
pbuf.len = sizeof(testput) - 1;
pbuf.len = CURL_CSTRLEN(testput);
easy_setopt(curl, CURLOPT_READDATA, &pbuf);
easy_setopt(curl, CURLOPT_INFILESIZE, (long)(sizeof(testput) - 1));
easy_setopt(curl, CURLOPT_INFILESIZE, (long)CURL_CSTRLEN(testput));
easy_setopt(curl, CURLOPT_URL, URL);
result = curl_easy_perform(curl);
if(result)
@ -66,7 +66,7 @@ static CURLcode test_lib1948(const char *URL)
/* POST */
easy_setopt(curl, CURLOPT_POST, 1L);
easy_setopt(curl, CURLOPT_POSTFIELDS, testput);
easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)(sizeof(testput) - 1));
easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)CURL_CSTRLEN(testput));
result = curl_easy_perform(curl);
test_cleanup:

View file

@ -27,7 +27,7 @@ static CURLcode test_lib1965(const char *URL)
{
CURLcode result = CURLE_OK;
CURLUcode rc;
static const char *schemes[] = {
static const char * const schemes[] = {
"bad!", "bad{", "bad/", "bad\\", "a!",
"a+123", "http-2", "http.1",
"a+-.123", "http-+++2", "http.1--",

View file

@ -47,11 +47,11 @@ static bool is_chain_in_order(struct curl_certinfo *cert_info)
static const char issuer_prefix[] = "Issuer:";
static const char subject_prefix[] = "Subject:";
if(!strncmp(slist->data, issuer_prefix, sizeof(issuer_prefix) - 1)) {
issuer = slist->data + sizeof(issuer_prefix) - 1;
if(!strncmp(slist->data, issuer_prefix, CURL_CSTRLEN(issuer_prefix))) {
issuer = slist->data + CURL_CSTRLEN(issuer_prefix);
}
if(!strncmp(slist->data, subject_prefix, sizeof(subject_prefix) - 1)) {
subject = slist->data + sizeof(subject_prefix) - 1;
if(!strncmp(slist->data, subject_prefix, CURL_CSTRLEN(subject_prefix))) {
subject = slist->data + CURL_CSTRLEN(subject_prefix);
}
}

View file

@ -41,8 +41,8 @@ static CURLcode test_lib505(const char *URL)
struct curl_slist *headerlist;
struct curl_slist *temp;
static const char *buf_1 = "RNFR 505";
static const char *buf_2 = "RNTO 505-forreal";
static const char buf_1[] = "RNFR 505";
static const char buf_2[] = "RNTO 505-forreal";
if(!libtest_arg2) {
curl_mfprintf(stderr, "Usage: <url> <file-to-upload>\n");

View file

@ -56,7 +56,7 @@ static CURLcode test_lib508(const char *URL)
struct t508_WriteThis pooh;
pooh.readptr = testdata;
pooh.sizeleft = sizeof(testdata) - 1;
pooh.sizeleft = CURL_CSTRLEN(testdata);
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
curl_mfprintf(stderr, "curl_global_init() failed\n");

View file

@ -37,7 +37,7 @@ static CURLcode test_lib536(const char *URL)
CURL *curl;
struct curl_slist *host = NULL;
static const char *url_with_proxy = "http://usingproxy.test/";
static const char url_with_proxy[] = "http://usingproxy.test/";
const char *url_without_proxy = libtest_arg2;
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {

View file

@ -63,7 +63,7 @@ static CURLcode test_lib544(const char *URL)
easy_setopt(curl, CURLOPT_HEADER, 1L); /* include header */
/* Update the original data to detect non-copy. */
curlx_strcopy(teststring, sizeof(teststring), "FAIL", strlen("FAIL"));
curlx_strcopy(teststring, sizeof(teststring), "FAIL", CURL_CSTRLEN("FAIL"));
{
CURL *curl2;

View file

@ -29,7 +29,7 @@
#include "first.h"
static const char t547_uploadthis[] = "this is the blurb we want to upload\n";
static size_t const t547_datalen = sizeof(t547_uploadthis) - 1;
static const size_t t547_datalen = CURL_CSTRLEN(t547_uploadthis);
static size_t t547_read_cb(char *ptr, size_t size, size_t nmemb, void *clientp)
{

View file

@ -69,7 +69,7 @@ static CURLcode t554_test_once(const char *URL, bool oldstyle)
struct t554_WriteThis pooh2;
pooh.readptr = testdata;
pooh.sizeleft = sizeof(testdata) - 1;
pooh.sizeleft = CURL_CSTRLEN(testdata);
/* Fill in the file upload field */
if(oldstyle) {
@ -99,7 +99,7 @@ static CURLcode t554_test_once(const char *URL, bool oldstyle)
a file upload but still using the callback */
pooh2.readptr = testdata;
pooh2.sizeleft = sizeof(testdata) - 1;
pooh2.sizeleft = CURL_CSTRLEN(testdata);
/* Fill in the file upload field */
formrc = curl_formadd(&formpost,

View file

@ -33,7 +33,7 @@
#include "first.h"
static const char t555_uploadthis[] = "this is the blurb we want to upload\n";
static size_t const t555_datalen = sizeof(t555_uploadthis) - 1;
static const size_t t555_datalen = CURL_CSTRLEN(t555_uploadthis);
static size_t t555_read_cb(char *ptr, size_t size, size_t nmemb, void *clientp)
{

View file

@ -44,7 +44,7 @@ static int rtp_packet_count = 0;
static size_t rtp_write(char *data, size_t size, size_t nmemb, void *stream)
{
static const char *RTP_DATA = "$_1234\n\0Rsdf";
static const char RTP_DATA[] = "$_1234\n\0Rsdf";
int channel = RTP_PKT_CHANNEL(data);
int message_size;

View file

@ -69,7 +69,7 @@ static CURLcode t643_test_once(const char *URL, bool oldstyle)
pooh.readptr = testdata;
if(testnum == 643)
datasize = (curl_off_t)(sizeof(testdata) - 1);
datasize = (curl_off_t)CURL_CSTRLEN(testdata);
pooh.sizeleft = datasize;
curl = curl_easy_init();
@ -123,7 +123,7 @@ static CURLcode t643_test_once(const char *URL, bool oldstyle)
pooh2.readptr = testdata;
if(testnum == 643)
datasize = (curl_off_t)(sizeof(testdata) - 1);
datasize = (curl_off_t)CURL_CSTRLEN(testdata);
pooh2.sizeleft = datasize;
part = curl_mime_addpart(mime);

View file

@ -92,7 +92,7 @@ static CURLcode test_lib654(const char *URL)
/* Prepare the callback structure. */
pooh.readptr = testdata;
pooh.sizeleft = (curl_off_t)(sizeof(testdata) - 1);
pooh.sizeleft = (curl_off_t)CURL_CSTRLEN(testdata);
pooh.freecount = 0;
/* Build the mime tree. */

View file

@ -25,7 +25,7 @@
#include "testtrace.h"
static const char *TEST_DATA_STRING = "Test data";
static const char TEST_DATA_STRING[] = "Test data";
static int cb_count = 0;
static int resolver_alloc_cb_fail(void *resolver_state, void *reserved,

View file

@ -82,7 +82,7 @@ static CURLcode test_lib667(const char *URL)
/* Prepare the callback structure. */
pooh.readptr = testdata;
pooh.sizeleft = (curl_off_t)(sizeof(testdata) - 1);
pooh.sizeleft = (curl_off_t)CURL_CSTRLEN(testdata);
/* Build the mime tree. */
mime = curl_mime_init(curl);

View file

@ -77,7 +77,7 @@ static CURLcode test_lib668(const char *URL)
/* Prepare the callback structures. */
pooh1.readptr = testdata;
pooh1.sizeleft = sizeof(testdata) - 1;
pooh1.sizeleft = CURL_CSTRLEN(testdata);
pooh2 = pooh1;
/* Build the mime tree. */

View file

@ -77,8 +77,8 @@ static CURLcode test_lib677(const char *URL)
if(!state) {
CURLcode ec;
ec = curl_easy_send(curl, testcmd + pos,
sizeof(testcmd) - 1 - pos, &len);
ec = curl_easy_send(curl, testcmd + pos, CURL_CSTRLEN(testcmd) - pos,
&len);
if(ec == CURLE_AGAIN) {
continue;
}
@ -92,7 +92,7 @@ static CURLcode test_lib677(const char *URL)
pos += len;
else
pos = 0;
if(pos == sizeof(testcmd) - 1) {
if(pos == CURL_CSTRLEN(testcmd)) {
state++;
pos = 0;
}

View file

@ -24,7 +24,7 @@
#include "first.h"
static const char t757_data[] = "<title>fun-times</title>";
static size_t const t757_datalen = sizeof(t757_data) - 1;
static const size_t t757_datalen = CURL_CSTRLEN(t757_data);
static size_t read_757(char *buffer, size_t size, size_t nitems, void *arg)
{

View file

@ -178,8 +178,8 @@ static int connack(FILE *dump, curl_socket_t fd)
MQTT_MSG_CONNACK, 0x02,
0x00, 0x00
};
ssize_t rc;
const char *label = "CONNACK";
ssize_t rc;
if(m_config.pingresp_as_connack) {
/* Send a PINGRESP (0xD0) with remaining_length=2 and payload
@ -260,8 +260,8 @@ static int disconnect(FILE *dump, curl_socket_t fd)
MQTT_MSG_DISCONNECT, 0x00,
0x00, 0x00 /* extra bytes for malformed variant */
};
size_t pktlen = 2;
const char *label = "DISCONNECT";
size_t pktlen = 2;
ssize_t rc;
if(m_config.disconnect_malformed) {
@ -638,8 +638,8 @@ static curl_socket_t mqttit(curl_socket_t fd)
}
}
else {
const char *def = "this is random payload yes yes it is";
publish(dump, fd, packet_id, topic, def, strlen(def));
static const char def[] = "this is random payload yes yes it is";
publish(dump, fd, packet_id, topic, def, CURL_CSTRLEN(def));
}
disconnect(dump, fd);
}

View file

@ -106,18 +106,18 @@ struct rtspd_httprequest {
#define END_OF_HEADERS "\r\n\r\n"
/* sent as reply to a QUIT */
static const char *docquit_rtsp = "HTTP/1.1 200 Goodbye" END_OF_HEADERS;
static const char docquit_rtsp[] = "HTTP/1.1 200 Goodbye" END_OF_HEADERS;
/* sent as reply to a CONNECT */
static const char *docconnect =
static const char docconnect[] =
"HTTP/1.1 200 Mighty fine indeed" END_OF_HEADERS;
/* sent as reply to a "bad" CONNECT */
static const char *docbadconnect =
static const char docbadconnect[] =
"HTTP/1.1 501 Forbidden you fool" END_OF_HEADERS;
/* send back this on HTTP 404 file not found */
static const char *doc404_HTTP =
static const char doc404_HTTP[] =
"HTTP/1.1 404 Not Found\r\n"
"Server: " RTSPDVERSION "\r\n"
"Connection: close\r\n"
@ -133,13 +133,13 @@ static const char *doc404_HTTP =
"</BODY></HTML>\n";
/* send back this on RTSP 404 file not found */
static const char *doc404_RTSP = "RTSP/1.0 404 Not Found\r\n"
static const char doc404_RTSP[] = "RTSP/1.0 404 Not Found\r\n"
"Server: " RTSPDVERSION
END_OF_HEADERS;
/* Default size to send away fake RTP data */
#define RTP_DATA_SIZE 12
static const char *RTP_DATA = "$_1234\n\0Rsdf";
static const char RTP_DATA[] = "$_1234\n\0Rsdf";
static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
{
@ -267,16 +267,17 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
logmsg("Found a reply-servercmd section!");
do {
rtp_size_err = 0;
if(!strncmp(CMD_AUTH_REQUIRED, ptr, strlen(CMD_AUTH_REQUIRED))) {
if(!strncmp(CMD_AUTH_REQUIRED, ptr,
CURL_CSTRLEN(CMD_AUTH_REQUIRED))) {
logmsg("instructed to require authorization header");
req->auth_req = TRUE;
}
else if(!strncmp(CMD_IDLE, ptr, strlen(CMD_IDLE))) {
else if(!strncmp(CMD_IDLE, ptr, CURL_CSTRLEN(CMD_IDLE))) {
logmsg("instructed to idle");
req->rcmd = RCMD_IDLE;
req->open = TRUE;
}
else if(!strncmp(CMD_STREAM, ptr, strlen(CMD_STREAM))) {
else if(!strncmp(CMD_STREAM, ptr, CURL_CSTRLEN(CMD_STREAM))) {
logmsg("instructed to stream");
req->rcmd = RCMD_STREAM;
}
@ -404,7 +405,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
if(req->pipe)
/* we do have a full set, advance the checkindex to after the end of the
headers, for the pipelining case mostly */
req->checkindex += (end - line) + strlen(END_OF_HEADERS);
req->checkindex += (end - line) + CURL_CSTRLEN(END_OF_HEADERS);
/* **** Persistence ****
*
@ -427,7 +428,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
ignore the content-length, we return as soon as all headers
have been received */
curl_off_t clen;
const char *p = line + strlen("Content-Length:");
const char *p = line + CURL_CSTRLEN("Content-Length:");
if(curlx_str_numblanks(&p, &clen)) {
/* this assumes that a zero Content-Length is valid */
logmsg("Found invalid '%s' in the request", line);
@ -442,7 +443,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
break;
}
else if(!CURL_STRNICMP("Transfer-Encoding: chunked", line,
strlen("Transfer-Encoding: chunked"))) {
CURL_CSTRLEN("Transfer-Encoding: chunked"))) {
/* chunked data coming in */
chunked = TRUE;
}
@ -506,12 +507,12 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
if(!req->pipe &&
req->open &&
req->prot_version >= 11 &&
req->reqbuf + req->offset > end + strlen(END_OF_HEADERS) &&
(!strncmp(req->reqbuf, "GET", strlen("GET")) ||
!strncmp(req->reqbuf, "HEAD", strlen("HEAD")))) {
req->reqbuf + req->offset > end + CURL_CSTRLEN(END_OF_HEADERS) &&
(!strncmp(req->reqbuf, "GET", CURL_CSTRLEN("GET")) ||
!strncmp(req->reqbuf, "HEAD", CURL_CSTRLEN("HEAD")))) {
/* If we have a persistent connection, HTTP version >= 1.1
and GET/HEAD request, enable pipelining. */
req->checkindex = (end - req->reqbuf) + strlen(END_OF_HEADERS);
req->checkindex = (end - req->reqbuf) + CURL_CSTRLEN(END_OF_HEADERS);
req->pipelining = TRUE;
}
@ -523,7 +524,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
end = strstr(line, END_OF_HEADERS);
if(!end)
break;
req->checkindex += (end - line) + strlen(END_OF_HEADERS);
req->checkindex += (end - line) + CURL_CSTRLEN(END_OF_HEADERS);
req->pipe--;
}
@ -535,7 +536,8 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
return 1; /* done */
if(req->cl > 0) {
if(req->cl <= req->offset - (end - req->reqbuf) - strlen(END_OF_HEADERS))
if(req->cl <= req->offset - (end - req->reqbuf) -
CURL_CSTRLEN(END_OF_HEADERS))
return 1; /* done */
else
return 0; /* not complete yet */

View file

@ -102,9 +102,9 @@ static void socksd_resetdefaults(void)
curlx_strcopy(s_config.addr, sizeof(s_config.addr),
CONFIG_ADDR, strlen(CONFIG_ADDR));
curlx_strcopy(s_config.user, sizeof(s_config.user),
"user", strlen("user"));
"user", CURL_CSTRLEN("user"));
curlx_strcopy(s_config.password, sizeof(s_config.password),
"password", strlen("password"));
"password", CURL_CSTRLEN("password"));
}
static void socksd_getconfig(void)

View file

@ -141,10 +141,10 @@ static const char *cmdfile = "log/server.cmd";
static const char *end_of_headers = END_OF_HEADERS;
/* sent as reply to a QUIT */
static const char *docquit_sws = "HTTP/1.1 200 Goodbye" END_OF_HEADERS;
static const char docquit_sws[] = "HTTP/1.1 200 Goodbye" END_OF_HEADERS;
/* send back this on 404 file not found */
static const char *doc404 =
static const char doc404[] =
"HTTP/1.1 404 Not Found\r\n"
"Server: " SWSVERSION "\r\n"
"Connection: close\r\n"
@ -262,29 +262,29 @@ static int sws_parse_servercmd(struct sws_httprequest *req)
while(cmd && cmdsize) {
const char *check;
if(!strncmp(CMD_AUTH_REQUIRED, cmd, strlen(CMD_AUTH_REQUIRED))) {
if(!strncmp(CMD_AUTH_REQUIRED, cmd, CURL_CSTRLEN(CMD_AUTH_REQUIRED))) {
logmsg("instructed to require authorization header");
req->auth_req = TRUE;
}
else if(!strncmp(CMD_IDLE, cmd, strlen(CMD_IDLE))) {
else if(!strncmp(CMD_IDLE, cmd, CURL_CSTRLEN(CMD_IDLE))) {
logmsg("instructed to idle");
req->rcmd = RCMD_IDLE;
req->open = TRUE;
}
else if(!strncmp(CMD_STREAM, cmd, strlen(CMD_STREAM))) {
else if(!strncmp(CMD_STREAM, cmd, CURL_CSTRLEN(CMD_STREAM))) {
logmsg("instructed to stream");
req->rcmd = RCMD_STREAM;
}
else if(!strncmp(CMD_CONNECTIONMONITOR, cmd,
strlen(CMD_CONNECTIONMONITOR))) {
CURL_CSTRLEN(CMD_CONNECTIONMONITOR))) {
logmsg("enabled connection monitoring");
req->connmon = TRUE;
}
else if(!strncmp(CMD_UPGRADE, cmd, strlen(CMD_UPGRADE))) {
else if(!strncmp(CMD_UPGRADE, cmd, CURL_CSTRLEN(CMD_UPGRADE))) {
logmsg("enabled upgrade");
req->upgrade = TRUE;
}
else if(!strncmp(CMD_SWSCLOSE, cmd, strlen(CMD_SWSCLOSE))) {
else if(!strncmp(CMD_SWSCLOSE, cmd, CURL_CSTRLEN(CMD_SWSCLOSE))) {
logmsg("swsclose: close this connection after response");
req->close = TRUE;
}
@ -292,7 +292,7 @@ static int sws_parse_servercmd(struct sws_httprequest *req)
logmsg("instructed to skip this number of bytes %d", num);
req->skip = num;
}
else if(!strncmp(CMD_NOEXPECT, cmd, strlen(CMD_NOEXPECT))) {
else if(!strncmp(CMD_NOEXPECT, cmd, CURL_CSTRLEN(CMD_NOEXPECT))) {
logmsg("instructed to reject Expect: 100-continue");
req->noexpect = TRUE;
}
@ -591,7 +591,7 @@ static int sws_ProcessRequest(struct sws_httprequest *req)
ignore the content-length, we return as soon as all headers
have been received */
curl_off_t clen;
const char *p = line + strlen("Content-Length:");
const char *p = line + CURL_CSTRLEN("Content-Length:");
if(curlx_str_numblanks(&p, &clen)) {
/* this assumes that a zero Content-Length is valid */
logmsg("Found invalid '%s' in the request", line);
@ -608,12 +608,13 @@ static int sws_ProcessRequest(struct sws_httprequest *req)
logmsg("... but going to abort after %zu bytes", req->cl);
}
else if(!CURL_STRNICMP("Transfer-Encoding: chunked", line,
strlen("Transfer-Encoding: chunked"))) {
CURL_CSTRLEN("Transfer-Encoding: chunked"))) {
/* chunked data coming in */
chunked = TRUE;
}
else if(req->noexpect && !CURL_STRNICMP("Expect: 100-continue", line,
strlen("Expect: 100-continue"))) {
else if(req->noexpect &&
!CURL_STRNICMP("Expect: 100-continue", line,
CURL_CSTRLEN("Expect: 100-continue"))) {
if(req->cl)
req->cl = 0;
req->skipall = TRUE;
@ -709,8 +710,8 @@ static int sws_ProcessRequest(struct sws_httprequest *req)
req->prot_version >= 11 &&
req->reqbuf + req->offset > end + strlen(end_of_headers) &&
!req->cl &&
(!strncmp(req->reqbuf, "GET", strlen("GET")) ||
!strncmp(req->reqbuf, "HEAD", strlen("HEAD")))) {
(!strncmp(req->reqbuf, "GET", CURL_CSTRLEN("GET")) ||
!strncmp(req->reqbuf, "HEAD", CURL_CSTRLEN("HEAD")))) {
/* If we have a persistent connection, HTTP version >= 1.1
and GET/HEAD request, enable pipelining. */
req->checkindex = (end - req->reqbuf) + strlen(end_of_headers);
@ -771,10 +772,10 @@ static int sws_send_doc(curl_socket_t sock, struct sws_httprequest *req)
case RCMD_STREAM: {
static const char streamthis[] = "a string to stream 01234567890\n";
for(;;) {
written = swrite(sock, streamthis, sizeof(streamthis) - 1);
written = swrite(sock, streamthis, CURL_CSTRLEN(streamthis));
if(got_exit_signal)
return -1;
if(written != (ssize_t)(sizeof(streamthis) - 1)) {
if(written != (ssize_t)CURL_CSTRLEN(streamthis)) {
logmsg("Stopped streaming");
break;
}
@ -2325,8 +2326,9 @@ static int test_sws(int argc, const char *argv[])
logmsg("====> Client disconnect %d", req->connmon);
if(req->connmon) {
const char *keepopen = "[DISCONNECT]\n";
storerequest(keepopen, strlen(keepopen), REQUEST_DUMP_FILENAME);
static const char keepopen[] = "[DISCONNECT]\n";
storerequest(keepopen, CURL_CSTRLEN(keepopen),
REQUEST_DUMP_FILENAME);
}
if(!req->open)

View file

@ -28,7 +28,7 @@ static CURLcode test_tool1720(const char *arg)
{
UNITTEST_BEGIN_SIMPLE
static const char *check[] = {
static const char * const check[] = {
"",
"(null)",
"filename",

View file

@ -85,7 +85,7 @@ static CURLcode test_unit1303(const char *arg)
const char *comment;
};
const struct timetest run[] = {
static const struct timetest run[] = {
/* both timeouts set, not connecting */
{BASE + 4, 0, 10000, 8000, FALSE, 6000, "6 seconds should be left"},
{BASE + 4, 990000, 10000, 8000, FALSE, 5010, "5010 ms should be left"},

View file

@ -35,7 +35,7 @@ static CURLcode test_unit1395(const char *arg)
const char *output;
};
const struct dotdot pairs[] = {
static const struct dotdot pairs[] = {
{ "/%2f%2e%2e%2f/../a", "/a" },
{ "/%2f%2e%2e%2f/../", "/" },
{ "/%2f%2e%2e%2f/.", "/%2f%2e%2e%2f/" },

View file

@ -51,7 +51,7 @@ static CURLcode test_unit1396(const char *arg)
};
/* unescape, this => that */
const struct test list1[] = {
static const struct test list1[] = {
{ "%61", 3, "a", 1 },
{ "%61a", 4, "aa", 2 },
{ "%61b", 4, "ab", 2 },
@ -67,7 +67,7 @@ static CURLcode test_unit1396(const char *arg)
{ NULL, 0, NULL, 0 } /* end of list marker */
};
/* escape, this => that */
const struct test list2[] = {
static const struct test list2[] = {
{ "a", 1, "a", 1 },
{ "/", 1, "%2F", 3 },
{ "a=b", 3, "a%3Db", 5 },

View file

@ -34,7 +34,7 @@ static CURLcode test_unit1398(const char *arg)
int rc;
char buf[3] = { 'b', 'u', 'g' };
static const char *str = "bug";
static const char str[] = "bug";
int width = 3;
char output[130];

View file

@ -41,8 +41,8 @@ static CURLcode test_unit1625(const char *arg)
char *large;
size_t i;
const size_t large_value_len = MAX_HTTP_RESP_HEADER_SIZE;
const size_t large_prefix_len = strlen("Encoding: ");
const size_t large_suffix_len = strlen(", chunked");
const size_t large_prefix_len = CURL_CSTRLEN("Encoding: ");
const size_t large_suffix_len = CURL_CSTRLEN(", chunked");
static const struct check1625 list[] = {
/* basic case */
{ "Encoding: gzip, chunked", "Encoding:", "chunked", TRUE },

View file

@ -32,7 +32,7 @@ static CURLcode test_unit1627(const char *arg)
size_t i, j;
/* existing schemes in different cases */
static const char *okay[] = {
static const char * const okay[] = {
/* all upper */
"DICT", "FILE", "FTP", "FTPS", "GOPHER", "GOPHERS", "HTTP", "HTTPS",
"IMAP", "IMAPS", "LDAP", "LDAPS", "MQTT", "MQTTS", "POP3", "POP3S",
@ -50,7 +50,7 @@ static CURLcode test_unit1627(const char *arg)
"TELNEt", "tFTP", "Ws", "wSS",
};
/* non-existing schemes */
static const char *notokay[] = {
static const char * const notokay[] = {
"a", "A", "htt", "ttp", "httt", "http+", "HTTPP", "HTTPPS", "HTTSP",
"GROPHER", "D1CT", "AbG", "zLQp", "mNrtW", "PkY", "bVcxZq", "LmO",
"iUhyT", "rEwQA", "xSdfG", "nBvC", "pOiuY", "tRewQ", "aSdfG", "hJkl",

View file

@ -54,8 +54,10 @@ static CURLcode test_unit1650(const char *arg)
};
static const struct dohrequest req[] = {
{"test.host.name", CURL_DNS_TYPE_A, DNS_Q1, sizeof(DNS_Q1)-1, DOH_OK },
{"test.host.name", CURL_DNS_TYPE_AAAA, DNS_Q2, sizeof(DNS_Q2)-1, DOH_OK },
{"test.host.name",
CURL_DNS_TYPE_A, DNS_Q1, CURL_CSTRLEN(DNS_Q1), DOH_OK },
{"test.host.name",
CURL_DNS_TYPE_AAAA, DNS_Q2, CURL_CSTRLEN(DNS_Q2), DOH_OK },
{"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
".host.name",
CURL_DNS_TYPE_AAAA, NULL, 0, DOH_DNS_BAD_LABEL }
@ -235,7 +237,7 @@ static CURLcode test_unit1650(const char *arg)
}
/* pass all sizes into the decoder until full */
for(i = 0; i < sizeof(full49) - 1; i++) {
for(i = 0; i < CURL_CSTRLEN(full49); i++) {
struct dohentry d;
DOHcode rc;
memset(&d, 0, sizeof(d));
@ -267,8 +269,8 @@ static CURLcode test_unit1650(const char *arg)
struct dohentry d;
struct dohaddr *a;
memset(&d, 0, sizeof(d));
rc = doh_resp_decode((const unsigned char *)full49,
sizeof(full49) - 1, CURL_DNS_TYPE_A, &d);
rc = doh_resp_decode((const unsigned char *)full49, CURL_CSTRLEN(full49),
CURL_DNS_TYPE_A, &d);
fail_if(d.numaddr != 1, "missing address");
a = &d.addr[0];
p = &a->ip.v4[0];

View file

@ -132,9 +132,9 @@ static CURLcode test_unit1655(const char *arg)
const size_t buflen = sizeof(buffer);
const size_t magic1 = 9765;
size_t olen1 = magic1;
static const char *sunshine1 = "a.com";
static const char *dotshine1 = "a.com.";
static const char *sunshine2 = "aa.com";
static const char sunshine1[] = "a.com";
static const char dotshine1[] = "a.com.";
static const char sunshine2[] = "aa.com";
size_t olen2;
DOHcode ret2;
size_t olen;

View file

@ -41,7 +41,7 @@ static CURLcode test_unit1664(const char *arg)
{
UNITTEST_BEGIN(t1664_setup())
static const char *wordparse[] = {
static const char * const wordparse[] = {
"word",
"word ",
" word ",
@ -78,7 +78,7 @@ static CURLcode test_unit1664(const char *arg)
}
{
static const char *qwords[] = {
static const char * const qwords[] = {
"\"word\"",
"\"word",
"word\"",
@ -112,7 +112,7 @@ static CURLcode test_unit1664(const char *arg)
}
{
static const char *single[] = {
static const char * const single[] = {
"a",
"aa",
"A",
@ -133,7 +133,7 @@ static CURLcode test_unit1664(const char *arg)
}
{
static const char *single[] = {
static const char * const single[] = {
"a",
"aa",
"A",
@ -156,7 +156,7 @@ static CURLcode test_unit1664(const char *arg)
}
{
static const char *single[] = {
static const char * const single[] = {
"a",
"aa",
"A",
@ -177,7 +177,7 @@ static CURLcode test_unit1664(const char *arg)
}
{
static const char *nums[] = {
static const char * const nums[] = {
"1",
"10000",
"1234",
@ -313,7 +313,7 @@ static CURLcode test_unit1664(const char *arg)
{
/* CURL_OFF_T is typically 9223372036854775807 */
static const char *nums[] = {
static const char * const nums[] = {
"9223372036854775807", /* 2^63 -1 */
"9223372036854775808", /* 2^63 */
"18446744073709551615", /* 2^64 - 1 */
@ -347,7 +347,7 @@ static CURLcode test_unit1664(const char *arg)
}
{
static const char *newl[] = {
static const char * const newl[] = {
"a",
"aa",
"A",
@ -372,7 +372,7 @@ static CURLcode test_unit1664(const char *arg)
}
{
static const char *nums[] = {
static const char * const nums[] = {
"1",
"1000",
"1234",
@ -399,7 +399,7 @@ static CURLcode test_unit1664(const char *arg)
}
{
static const char *nums[] = {
static const char * const nums[] = {
"1",
"1000",
"1234",
@ -427,7 +427,7 @@ static CURLcode test_unit1664(const char *arg)
{
/* CURL_OFF_T is typically 2^63-1 */
static const char *nums[] = {
static const char * const nums[] = {
"777777777777777777777", /* 2^63 -1 */
"1000000000000000000000", /* 2^63 */
"111111111111111111111",
@ -451,7 +451,7 @@ static CURLcode test_unit1664(const char *arg)
{
/* CURL_OFF_T is typically 2^63-1 */
static const char *nums[] = {
static const char * const nums[] = {
"7FFFFFFFFFFFFFFF", /* 2^63 -1 */
"8000000000000000", /* 2^63 */
"1111111111111111",

View file

@ -36,7 +36,7 @@ struct test_1666 {
};
/* the size of the object needs to deduct the null-terminator */
#define OID(x) x, sizeof(x) - 1
#define OID(x) STRCONST(x)
static bool test1666(const struct test_1666 *spec, size_t i,
struct dynbuf *dbuf)

View file

@ -38,7 +38,7 @@ static CURLcode test_unit1675(const char *arg)
const char *in;
const char *out;
};
const struct ipv4_test tests[] = {
static const struct ipv4_test tests[] = {
{ "0x.0x.0x.0x", NULL }, /* invalid hex */
{ "0x.0x.0x", NULL }, /* invalid hex */
{ "0x.0x", NULL }, /* invalid hex */
@ -146,7 +146,7 @@ static CURLcode test_unit1675(const char *arg)
unsigned int query;
const char *out;
};
const struct urlencode_test tests[] = {
static const struct urlencode_test tests[] = {
{ "http://leave\x01/hello\x01world", FALSE, QUERY_NO,
"http://leave\x01/hello%01world" },
{ "http://leave/hello\x01world", FALSE, QUERY_NO,
@ -204,7 +204,7 @@ static CURLcode test_unit1675(const char *arg)
const char *out_host;
const char *out_zone;
};
const struct ipv6_test tests[] = {
static const struct ipv6_test tests[] = {
{ "[::1]", "[::1]", NULL },
{ "[fe80::1%eth0]", "[fe80::1]", "eth0" },
{ "[fe80::1%25eth0]", "[fe80::1]", "eth0" },
@ -260,7 +260,7 @@ static CURLcode test_unit1675(const char *arg)
const char *out_path;
bool fine;
};
const struct file_test tests[] = {
static const struct file_test tests[] = {
{ "file:///etc/hosts", "/etc/hosts", TRUE },
{ "file://localhost/etc/hosts", "/etc/hosts", TRUE },
{ "file://apple/etc/hosts", "/etc/hosts", FALSE },
@ -317,7 +317,7 @@ static CURLcode test_unit1675(const char *arg)
const char *path;
bool expect_match;
};
const struct origin_test tests[] = {
static const struct origin_test tests[] = {
{ "http://host:123/x", "http", "host", "123", "/y", TRUE },
{ "http://host:123/x", NULL, "host", "123", "/y", TRUE },
{ "http://host:123/x", NULL, NULL, NULL, "/y", TRUE },
@ -395,7 +395,7 @@ loop_end:
const char *options;
size_t offset;
};
const struct test tests[] = {
static const struct test tests[] = {
{ CURLUE_OK, "foo:bar@host", NULL, 0, "foo", "bar", "o", 8 },
{ CURLUE_OK, "foo:bar;abc@host", "imap", 0, "foo", "bar", "abc", 12 },
{ CURLUE_OK, "foo:bar;abc@host", NULL, 0, "foo", "bar;abc", "o", 12 },

View file

@ -48,7 +48,7 @@ static void check_eq(const char *s, const char *exp_s, const char *name)
}
struct tcase {
const char **input;
const char * const *input;
const char *default_scheme;
const char *custom_method;
const char *method;
@ -117,7 +117,7 @@ static CURLcode test_unit2603(const char *arg)
UNITTEST_BEGIN_SIMPLE
#ifndef CURL_DISABLE_HTTP
static const char *T1_INPUT[] = {
static const char * const T1_INPUT[] = {
"GET /path HTTP/1.1\r\nHost: test.curl.se\r\n\r\n",
NULL,
};
@ -128,7 +128,7 @@ static CURLcode test_unit2603(const char *arg)
T1_INPUT, "https", NULL, "GET", "https", NULL, "/path", 1, 0
};
static const char *T2_INPUT[] = {
static const char * const T2_INPUT[] = {
"GET /path HTT",
"P/1.1\r\nHost: te",
"st.curl.se\r\n\r",
@ -139,7 +139,7 @@ static CURLcode test_unit2603(const char *arg)
T2_INPUT, NULL, NULL, "GET", NULL, NULL, "/path", 1, 8
};
static const char *T3_INPUT[] = {
static const char * const T3_INPUT[] = {
"GET ftp://ftp.curl.se/xxx?a=2 HTTP/1.1\r\nContent-Length: 0\r",
"\nUser-Agent: xxx\r\n\r\n",
NULL,
@ -148,7 +148,7 @@ static CURLcode test_unit2603(const char *arg)
T3_INPUT, NULL, NULL, "GET", "ftp", "ftp.curl.se", "/xxx?a=2", 2, 0
};
static const char *T4_INPUT[] = {
static const char * const T4_INPUT[] = {
"CONNECT ftp.curl.se:123 HTTP/1.1\r\nContent-Length: 0\r\n",
"User-Agent: xxx\r\n",
"nothing: \r\n\r\n\n\n",
@ -158,7 +158,7 @@ static CURLcode test_unit2603(const char *arg)
T4_INPUT, NULL, NULL, "CONNECT", NULL, "ftp.curl.se:123", NULL, 3, 2
};
static const char *T6_INPUT[] = {
static const char * const T6_INPUT[] = {
"PUT /path HTTP/1.1\nHost: test.curl.se\n\n123",
NULL,
};
@ -167,7 +167,7 @@ static CURLcode test_unit2603(const char *arg)
};
/* test a custom method with space, #19543 */
static const char *T7_INPUT[] = {
static const char * const T7_INPUT[] = {
"IN SANE /path HTTP/1.1\r\nContent-Length: 0\r\n\r\n",
NULL,
};

View file

@ -45,7 +45,7 @@ static CURLcode test_unit3200(const char *arg)
#define C1024 C256 C256 C256 C256
#define C4096 C1024 C1024 C1024 C1024
static const char *filecontents[] = {
static const char * const filecontents[] = {
/* Both should be read */
"LINE1\n"
"LINE2 NEWLINE\n",

View file

@ -420,7 +420,7 @@ static CURLcode test_unit3205(const char *arg)
#endif
};
static const char *cs_test_string =
static const char cs_test_string[] =
"TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:"
"TLS_CHACHA20_POLY1305_SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:"
"ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:"
@ -561,11 +561,12 @@ static CURLcode test_unit3205(const char *arg)
if(test->id >= 0x0011 && test->id < 0x0017) {
if(expect && !memcmp(expect, "EDH-", 4)) {
curlx_strcopy(alt, sizeof(alt), expect, strlen(expect));
expect = (const char *)memcpy(alt, "DHE-", sizeof("DHE-") - 1);
expect = memcpy(alt, "DHE-", CURL_CSTRLEN("DHE-"));
}
if(expect && !memcmp(expect + 4, "EDH-", 4)) {
curlx_strcopy(alt, sizeof(alt), expect, strlen(expect));
expect = (const char *)memcpy(alt + 4, "DHE-", sizeof("DHE-") - 1) - 4;
expect = memcpy(alt + 4, "DHE-", CURL_CSTRLEN("DHE-"));
expect -= 4;
}
}

View file

@ -56,13 +56,13 @@ static void check_capsule_hdr(size_t payload_len,
static void test_capsule_encap_udp_hdr_boundaries(void)
{
const unsigned char p0[] = { 0x00, 0x01, 0x00 };
const unsigned char p62[] = { 0x00, 0x3F, 0x00 };
const unsigned char p63[] = { 0x00, 0x40, 0x40, 0x00 };
const unsigned char p64[] = { 0x00, 0x40, 0x41, 0x00 };
const unsigned char p16382[] = { 0x00, 0x7F, 0xFF, 0x00 };
const unsigned char p16383[] = { 0x00, 0x80, 0x00, 0x40, 0x00, 0x00 };
const unsigned char p16384[] = { 0x00, 0x80, 0x00, 0x40, 0x01, 0x00 };
static const unsigned char p0[] = { 0x00, 0x01, 0x00 };
static const unsigned char p62[] = { 0x00, 0x3F, 0x00 };
static const unsigned char p63[] = { 0x00, 0x40, 0x40, 0x00 };
static const unsigned char p64[] = { 0x00, 0x40, 0x41, 0x00 };
static const unsigned char p16382[] = { 0x00, 0x7F, 0xFF, 0x00 };
static const unsigned char p16383[] = { 0x00, 0x80, 0x00, 0x40, 0x00, 0x00 };
static const unsigned char p16384[] = { 0x00, 0x80, 0x00, 0x40, 0x01, 0x00 };
check_capsule_hdr(0, p0, sizeof(p0));
check_capsule_hdr(62, p62, sizeof(p62));
@ -139,7 +139,7 @@ static void test_capsule_sequential_decode(void)
CURLcode err;
size_t nread;
/* Two back-to-back 3-byte UDP capsules */
const unsigned char two_caps[] = {
static const unsigned char two_caps[] = {
0x00, 0x04, 0x00, 0x11, 0x22, 0x33, /* capsule 1: [0x11,0x22,0x33] */
0x00, 0x04, 0x00, 0xAA, 0xBB, 0xCC /* capsule 2: [0xAA,0xBB,0xCC] */
};
@ -186,13 +186,15 @@ static void test_capsule_decode_paths(void)
unsigned char out[8];
CURLcode err = CURLE_OK;
size_t nread;
const unsigned char invalid_type[] = { 0x01 };
const unsigned char partial_len[] = { 0x00, 0x40 };
const unsigned char invalid_context[] = { 0x00, 0x01, 0x01 };
const unsigned char invalid_caps_len[] = { 0x00, 0x00, 0x00 };
const unsigned char partial_payload[] = { 0x00, 0x04, 0x00, 0x11, 0x22 };
const unsigned char payload_3b[] = { 0x00, 0x04, 0x00, 0x11, 0x22, 0x33 };
const unsigned char payload_empty[] = { 0x00, 0x01, 0x00 };
static const unsigned char invalid_type[] = { 0x01 };
static const unsigned char partial_len[] = { 0x00, 0x40 };
static const unsigned char invalid_context[] = { 0x00, 0x01, 0x01 };
static const unsigned char invalid_caps_len[] = { 0x00, 0x00, 0x00 };
static const unsigned char partial_payload[] = { 0x00, 0x04, 0x00, 0x11,
0x22 };
static const unsigned char payload_3b[] = { 0x00, 0x04, 0x00,
0x11, 0x22, 0x33 };
static const unsigned char payload_empty[] = { 0x00, 0x01, 0x00 };
Curl_bufq_init2(&q, 32, 4, BUFQ_OPT_NONE);