tidy-up: one more round of formatting nits

Closes #19835
This commit is contained in:
Viktor Szakats 2025-11-29 23:11:52 +01:00
parent 7a1e99eefa
commit 0476e4fc65
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
149 changed files with 1381 additions and 1376 deletions

View file

@ -59,8 +59,8 @@ static int qname(const unsigned char **pkt, size_t *size)
return 0;
}
#define QTYPE_A 1
#define QTYPE_AAAA 28
#define QTYPE_A 1
#define QTYPE_AAAA 28
#define QTYPE_HTTPS 0x41
static const char *type2string(unsigned short qtype)
@ -497,8 +497,7 @@ static int test_dnsd(int argc, char **argv)
}
flag = 1;
if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
(void *)&flag, sizeof(flag))) {
if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&flag, sizeof(flag))) {
error = SOCKERRNO;
logmsg("setsockopt(SO_REUSEADDR) failed with error (%d) %s",
error, curlx_strerror(error, errbuf, sizeof(errbuf)));

View file

@ -243,7 +243,7 @@ static int decodedata(char **buf, /* dest buffer */
int getpart(char **outbuf, size_t *outlen,
const char *main, const char *sub, FILE *stream)
{
# define MAX_TAG_LEN 200
#define MAX_TAG_LEN 200
char curouter[MAX_TAG_LEN + 1]; /* current outermost section */
char curmain[MAX_TAG_LEN + 1]; /* current main section */
char cursub[MAX_TAG_LEN + 1]; /* current sub section */

View file

@ -55,7 +55,7 @@ struct mqttd_configurable {
int testnum;
};
#define REQUEST_DUMP "server.input"
#define REQUEST_DUMP "server.input"
#define CONFIG_VERSION 5
static struct mqttd_configurable m_config;
@ -152,7 +152,6 @@ static void logprotocol(mqttdir dir,
prefix, (int)remlen, data);
}
/* return 0 on success */
static int connack(FILE *dump, curl_socket_t fd)
{
@ -179,7 +178,7 @@ static int connack(FILE *dump, curl_socket_t fd)
/* return 0 on success */
static int suback(FILE *dump, curl_socket_t fd, unsigned short packetid)
{
unsigned char packet[]={
unsigned char packet[] = {
MQTT_MSG_SUBACK, 0x03,
0, 0, /* filled in below */
0x00
@ -202,7 +201,7 @@ static int suback(FILE *dump, curl_socket_t fd, unsigned short packetid)
/* return 0 on success */
static int puback(FILE *dump, curl_socket_t fd, unsigned short packetid)
{
unsigned char packet[]={
unsigned char packet[] = {
MQTT_MSG_PUBACK, 0x00,
0, 0 /* filled in below */
};
@ -225,7 +224,7 @@ static int puback(FILE *dump, curl_socket_t fd, unsigned short packetid)
/* return 0 on success */
static int disconnect(FILE *dump, curl_socket_t fd)
{
unsigned char packet[]={
unsigned char packet[] = {
MQTT_MSG_DISCONNECT, 0x00,
};
ssize_t rc = swrite(fd, (char *)packet, sizeof(packet));
@ -364,7 +363,7 @@ static int publish(FILE *dump,
return 1;
}
#define MAX_TOPIC_LENGTH 65535
#define MAX_TOPIC_LENGTH 65535
#define MAX_CLIENT_ID_LENGTH 32
static char topic[MAX_TOPIC_LENGTH + 1];

View file

@ -88,10 +88,10 @@ struct rtspd_httprequest {
#define RESPONSE_DUMP "server.response"
/* very-big-path support */
#define MAXDOCNAMELEN 140000
#define MAXDOCNAMELEN 140000
#define MAXDOCNAMELEN_TXT "139999"
#define REQUEST_KEYWORD_SIZE 256
#define REQUEST_KEYWORD_SIZE 256
#define REQUEST_KEYWORD_SIZE_TXT "255"
#define CMD_AUTH_REQUIRED "auth_required"
@ -110,14 +110,15 @@ static const char *docquit_rtsp = "HTTP/1.1 200 Goodbye" END_OF_HEADERS;
/* sent as reply to a CONNECT */
static const char *docconnect =
"HTTP/1.1 200 Mighty fine indeed" END_OF_HEADERS;
"HTTP/1.1 200 Mighty fine indeed" END_OF_HEADERS;
/* sent as reply to a "bad" CONNECT */
static const char *docbadconnect =
"HTTP/1.1 501 Forbidden you fool" END_OF_HEADERS;
"HTTP/1.1 501 Forbidden you fool" END_OF_HEADERS;
/* send back this on HTTP 404 file not found */
static const char *doc404_HTTP = "HTTP/1.1 404 Not Found\r\n"
static const char *doc404_HTTP =
"HTTP/1.1 404 Not Found\r\n"
"Server: " RTSPDVERSION "\r\n"
"Connection: close\r\n"
"Content-Type: text/html"
@ -128,7 +129,8 @@ static const char *doc404_HTTP = "HTTP/1.1 404 Not Found\r\n"
"</HEAD><BODY>\n"
"<H1>Not Found</H1>\n"
"The requested URL was not found on this server.\n"
"<P><HR><ADDRESS>" RTSPDVERSION "</ADDRESS>\n" "</BODY></HTML>\n";
"<P><HR><ADDRESS>" RTSPDVERSION "</ADDRESS>\n"
"</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"
@ -1021,8 +1023,7 @@ static int test_rtspd(int argc, char *argv[])
curl_off_t num;
if(!strcmp("--version", argv[arg])) {
printf("rtspd IPv4%s"
"\n"
,
"\n",
#ifdef USE_IPV6
"/IPv6"
#else

View file

@ -173,7 +173,7 @@ static ssize_t write_wincon(int fd, const void *buf, size_t count)
/* On Windows, we sometimes get this for a broken pipe, seemingly
* when the client just closed stdin? */
#define CURL_WIN32_EPIPE 109
#define CURL_WIN32_EPIPE 109
/*
* fullread is a wrapper around the read() function. This will repeat the call
@ -888,7 +888,6 @@ static bool disc_handshake(void)
logmsg("Throwing away data bytes");
if(!read_data_block(buffer, sizeof(buffer), &buffer_len))
return FALSE;
}
else if(!memcmp("QUIT", buffer, 4)) {
/* just die */
@ -1339,31 +1338,31 @@ static int test_sockfilt(int argc, char *argv[])
/* Active mode, we should connect to the given port number */
mode = ACTIVE;
switch(socket_domain) {
case AF_INET:
memset(&me.sa4, 0, sizeof(me.sa4));
me.sa4.sin_family = AF_INET;
me.sa4.sin_port = htons(server_connectport);
me.sa4.sin_addr.s_addr = INADDR_ANY;
if(!addr)
addr = "127.0.0.1";
curlx_inet_pton(AF_INET, addr, &me.sa4.sin_addr);
case AF_INET:
memset(&me.sa4, 0, sizeof(me.sa4));
me.sa4.sin_family = AF_INET;
me.sa4.sin_port = htons(server_connectport);
me.sa4.sin_addr.s_addr = INADDR_ANY;
if(!addr)
addr = "127.0.0.1";
curlx_inet_pton(AF_INET, addr, &me.sa4.sin_addr);
rc = connect(sock, &me.sa, sizeof(me.sa4));
break;
rc = connect(sock, &me.sa, sizeof(me.sa4));
break;
#ifdef USE_IPV6
case AF_INET6:
memset(&me.sa6, 0, sizeof(me.sa6));
me.sa6.sin6_family = AF_INET6;
me.sa6.sin6_port = htons(server_connectport);
if(!addr)
addr = "::1";
curlx_inet_pton(AF_INET6, addr, &me.sa6.sin6_addr);
case AF_INET6:
memset(&me.sa6, 0, sizeof(me.sa6));
me.sa6.sin6_family = AF_INET6;
me.sa6.sin6_port = htons(server_connectport);
if(!addr)
addr = "::1";
curlx_inet_pton(AF_INET6, addr, &me.sa6.sin6_addr);
rc = connect(sock, &me.sa, sizeof(me.sa6));
break;
rc = connect(sock, &me.sa, sizeof(me.sa6));
break;
#endif /* USE_IPV6 */
default:
rc = 1;
default:
rc = 1;
}
if(rc) {
error = SOCKERRNO;

View file

@ -76,15 +76,15 @@ struct socksd_configurable {
char password[256];
};
#define CONFIG_VERSION 5
#define CONFIG_NMETHODS_MIN 1 /* unauth, gssapi, auth */
#define CONFIG_NMETHODS_MAX 3
#define CONFIG_VERSION 5
#define CONFIG_NMETHODS_MIN 1 /* unauth, gssapi, auth */
#define CONFIG_NMETHODS_MAX 3
#define CONFIG_RESPONSEVERSION CONFIG_VERSION
#define CONFIG_RESPONSEMETHOD 0 /* no auth */
#define CONFIG_REQCMD 1 /* CONNECT */
#define CONFIG_PORT backendport
#define CONFIG_ADDR backendaddr
#define CONFIG_CONNECTREP 0
#define CONFIG_RESPONSEMETHOD 0 /* no auth */
#define CONFIG_REQCMD 1 /* CONNECT */
#define CONFIG_PORT backendport
#define CONFIG_ADDR backendaddr
#define CONFIG_CONNECTREP 0
static struct socksd_configurable s_config;
@ -185,24 +185,24 @@ static void socksd_getconfig(void)
}
/* RFC 1928, SOCKS5 byte index */
#define SOCKS5_VERSION 0
#define SOCKS5_VERSION 0
#define SOCKS5_NMETHODS 1 /* number of methods that is listed */
/* in the request: */
#define SOCKS5_REQCMD 1
#define SOCKS5_REQCMD 1
#define SOCKS5_RESERVED 2
#define SOCKS5_ATYP 3
#define SOCKS5_DSTADDR 4
#define SOCKS5_ATYP 3
#define SOCKS5_DSTADDR 4
/* connect response */
#define SOCKS5_REP 1
#define SOCKS5_REP 1
#define SOCKS5_BNDADDR 4
/* auth request */
#define SOCKS5_ULEN 1
#define SOCKS5_ULEN 1
#define SOCKS5_UNAME 2
#define SOCKS4_CD 1
#define SOCKS4_CD 1
#define SOCKS4_DSTPORT 2
/* connect to a given IPv4 address, not the one asked for */

View file

@ -104,10 +104,10 @@ static size_t num_sockets = 0;
static const char *cmdfile = "log/server.cmd";
/* very-big-path support */
#define MAXDOCNAMELEN 140000
#define MAXDOCNAMELEN 140000
#define MAXDOCNAMELEN_TXT "139999"
#define REQUEST_KEYWORD_SIZE 256
#define REQUEST_KEYWORD_SIZE 256
#define REQUEST_KEYWORD_SIZE_TXT "255"
#define CMD_AUTH_REQUIRED "auth_required"
@ -141,7 +141,8 @@ static const char *end_of_headers = 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 = "HTTP/1.1 404 Not Found\r\n"
static const char *doc404 =
"HTTP/1.1 404 Not Found\r\n"
"Server: " SWSVERSION "\r\n"
"Connection: close\r\n"
"Content-Type: text/html"
@ -152,7 +153,8 @@ static const char *doc404 = "HTTP/1.1 404 Not Found\r\n"
"</HEAD><BODY>\n"
"<H1>Not Found</H1>\n"
"The requested URL was not found on this server.\n"
"<P><HR><ADDRESS>" SWSVERSION "</ADDRESS>\n" "</BODY></HTML>\n";
"<P><HR><ADDRESS>" SWSVERSION "</ADDRESS>\n"
"</BODY></HTML>\n";
/* work around for handling trailing headers */
static int already_recv_zeroed_chunk = FALSE;
@ -332,8 +334,7 @@ static int sws_ProcessRequest(struct sws_httprequest *req)
char *httppath = NULL;
size_t npath = 0; /* httppath length */
if(sscanf(line,
"%" REQUEST_KEYWORD_SIZE_TXT "s ", request) == 1) {
if(sscanf(line, "%" REQUEST_KEYWORD_SIZE_TXT "s ", request) == 1) {
http = strstr(line + strlen(request), "HTTP/");
if(http && sscanf(http, "HTTP/%d.%d", &prot_major, &prot_minor) == 2) {
@ -833,7 +834,7 @@ static int sws_get_request(curl_socket_t sock, struct sws_httprequest *req)
int rc;
fd_set input;
fd_set output;
struct timeval timeout = {0};
struct timeval timeout = { 0 };
timeout.tv_sec = 1; /* 1000 ms */
logmsg("Got EAGAIN from sread");
@ -1318,7 +1319,7 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port)
error = SOCKERRNO;
if((error == SOCKEINPROGRESS) || (error == SOCKEWOULDBLOCK)) {
fd_set output;
struct timeval timeout = {0};
struct timeval timeout = { 0 };
timeout.tv_sec = 1; /* 1000 ms */
FD_ZERO(&output);
@ -1386,8 +1387,8 @@ success:
#define data_or_ctrl(x) ((x) ? "DATA" : "CTRL")
#define SWS_CTRL 0
#define SWS_DATA 1
#define SWS_CTRL 0
#define SWS_DATA 1
static void http_connect(curl_socket_t *infdp,
curl_socket_t rootfd,
@ -1395,10 +1396,10 @@ static void http_connect(curl_socket_t *infdp,
unsigned short ipport,
int keepalive_secs)
{
curl_socket_t serverfd[2] = {CURL_SOCKET_BAD, CURL_SOCKET_BAD};
curl_socket_t clientfd[2] = {CURL_SOCKET_BAD, CURL_SOCKET_BAD};
ssize_t toc[2] = {0, 0}; /* number of bytes to client */
ssize_t tos[2] = {0, 0}; /* number of bytes to server */
curl_socket_t serverfd[2] = { CURL_SOCKET_BAD, CURL_SOCKET_BAD };
curl_socket_t clientfd[2] = { CURL_SOCKET_BAD, CURL_SOCKET_BAD };
ssize_t toc[2] = { 0, 0 }; /* number of bytes to client */
ssize_t tos[2] = { 0, 0 }; /* number of bytes to server */
char readclient[2][256];
char readserver[2][256];
bool poll_client_rd[2] = { TRUE, TRUE };
@ -1441,7 +1442,7 @@ static void http_connect(curl_socket_t *infdp,
fd_set output;
ssize_t rc;
curl_socket_t maxfd = (curl_socket_t)-1;
struct timeval timeout = {0};
struct timeval timeout = { 0 };
timeout.tv_sec = 1; /* 1000 ms */
FD_ZERO(&input);
@ -2176,8 +2177,7 @@ static int test_sws(int argc, char *argv[])
}
flag = 1;
if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
(void *)&flag, sizeof(flag))) {
if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&flag, sizeof(flag))) {
error = SOCKERRNO;
logmsg("setsockopt(SO_REUSEADDR) failed with error (%d) %s",
error, curlx_strerror(error, errbuf, sizeof(errbuf)));
@ -2314,7 +2314,7 @@ static int test_sws(int argc, char *argv[])
fd_set output;
curl_socket_t maxfd = (curl_socket_t)-1;
int active;
struct timeval timeout = {0};
struct timeval timeout = { 0 };
timeout.tv_usec = 250000L; /* 250 ms */
/* Clear out closed sockets */
@ -2458,7 +2458,7 @@ sws_cleanup:
for(socket_idx = 1; socket_idx < num_sockets; ++socket_idx)
if((all_sockets[socket_idx] != sock) &&
(all_sockets[socket_idx] != CURL_SOCKET_BAD))
(all_sockets[socket_idx] != CURL_SOCKET_BAD))
sclose(all_sockets[socket_idx]);
if(sock != CURL_SOCKET_BAD)

View file

@ -70,8 +70,8 @@
#include <ctype.h>
/*****************************************************************************
* This is a rewrite/clone of the arpa/tftp.h file for systems without it. *
*****************************************************************************/
* This is a rewrite/clone of the arpa/tftp.h file for systems without it. *
*****************************************************************************/
#define SEGSIZE 512 /* data segment size */
#if defined(__GNUC__) && ((__GNUC__ >= 3) || \
@ -105,8 +105,8 @@ struct tftphdr {
#define TFTP_ENOUSER 7
/*****************************************************************************
* STRUCT DECLARATIONS AND DEFINES *
*****************************************************************************/
* STRUCT DECLARATIONS AND DEFINES *
*****************************************************************************/
#ifndef PKTSIZE
#define PKTSIZE (SEGSIZE + 4) /* SEGSIZE defined in arpa/tftp.h */
@ -157,13 +157,13 @@ struct bf {
#define opcode_ACK 4
#define opcode_ERROR 5
#define TIMEOUT 5
#define TIMEOUT 5
#define REQUEST_DUMP "server.input"
#define REQUEST_DUMP "server.input"
/*****************************************************************************
* GLOBAL VARIABLES *
*****************************************************************************/
* GLOBAL VARIABLES *
*****************************************************************************/
static struct errmsg errmsgs[] = {
{ TFTP_EUNDEF, "Undefined error code" },
@ -212,8 +212,8 @@ static const unsigned int rexmtval = TIMEOUT;
#endif
/*****************************************************************************
* FUNCTION PROTOTYPES *
*****************************************************************************/
* FUNCTION PROTOTYPES *
*****************************************************************************/
static struct tftphdr *rw_init(int);
@ -249,8 +249,8 @@ static void justtimeout(int signum);
#endif /* HAVE_ALARM && SIGALRM */
/*****************************************************************************
* FUNCTION IMPLEMENTATIONS *
*****************************************************************************/
* FUNCTION IMPLEMENTATIONS *
*****************************************************************************/
#if defined(HAVE_ALARM) && defined(SIGALRM)
@ -482,9 +482,8 @@ static ssize_t write_behind(struct testcase *test, int convert)
if(prevchar == '\r') { /* if prev char was cr */
if(c == '\n') /* if have cr,lf then just */
lseek(test->ofile, -1, SEEK_CUR); /* smash lf on top of the cr */
else
if(c == '\0') /* if have cr,nul then */
goto skipit; /* just skip over the putc */
else if(c == '\0') /* if have cr,nul then */
goto skipit; /* just skip over the putc */
/* else just fall through and allow it */
}
/* formerly
@ -1204,8 +1203,7 @@ static void sendtftp(struct testcase *test, const struct formats *pf)
(void)sigsetjmp(timeoutbuf, 1);
#endif
if(test->writedelay) {
logmsg("Pausing %d seconds before %d bytes", test->writedelay,
size);
logmsg("Pausing %d seconds before %d bytes", test->writedelay, size);
curlx_wait_ms(1000 * test->writedelay);
}
@ -1299,7 +1297,7 @@ send_ack:
#endif
if(got_exit_signal)
goto abort;
if(n < 0) { /* really? */
if(n < 0) { /* really? */
logmsg("read: fail");
goto abort;
}
@ -1313,13 +1311,13 @@ send_ack:
}
/* Re-synchronize with the other side */
(void)synchnet(peer);
if(rdp->th_block == (recvblock-1))
if(rdp->th_block == (recvblock - 1))
goto send_ack; /* rexmit */
}
}
size = writeit(test, &rdp, (int)(n - 4), pf->f_convert);
if(size != (n-4)) { /* ahem */
if(size != (n - 4)) { /* ahem */
if(size < 0)
nak(errno + 100);
else