tidy-up: miscellaneous

- asyn-thrdd.c: scope an include.
- apply more clang-format suggestions.
- tidy-up PP guard comments.
- delete empty line from the top of headers.
- add empty line after `curl_setup.h` include where missing.
- fix indent.
- CODE_STYLE.md: add `strcpy`.
  Follow-up to 8636ad55df #20088
- lib1901.c: drop unnecessary line.
  Follow-up to 436e67f65b #20076

Closes #20070
This commit is contained in:
Viktor Szakats 2025-12-20 14:32:49 +01:00
parent abcb10f3ac
commit 7032982896
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
314 changed files with 486 additions and 730 deletions

View file

@ -36,13 +36,13 @@ CURLcode Curl_client_write(struct Curl_easy *data, int type, const char *buf, si
The `type` argument specifies what the bytes in `buf` actually are.
The following bits are defined:
```
#define CLIENTWRITE_BODY (1<<0) /* non-meta information, BODY */
#define CLIENTWRITE_INFO (1<<1) /* meta information, not a HEADER */
#define CLIENTWRITE_HEADER (1<<2) /* meta information, HEADER */
#define CLIENTWRITE_STATUS (1<<3) /* a special status HEADER */
#define CLIENTWRITE_CONNECT (1<<4) /* a CONNECT related HEADER */
#define CLIENTWRITE_1XX (1<<5) /* a 1xx response related HEADER */
#define CLIENTWRITE_TRAILER (1<<6) /* a trailer HEADER */
#define CLIENTWRITE_BODY (1 << 0) /* non-meta information, BODY */
#define CLIENTWRITE_INFO (1 << 1) /* meta information, not a HEADER */
#define CLIENTWRITE_HEADER (1 << 2) /* meta information, HEADER */
#define CLIENTWRITE_STATUS (1 << 3) /* a special status HEADER */
#define CLIENTWRITE_CONNECT (1 << 4) /* a CONNECT related HEADER */
#define CLIENTWRITE_1XX (1 << 5) /* a 1xx response related HEADER */
#define CLIENTWRITE_TRAILER (1 << 6) /* a trailer HEADER */
```
The main types here are `CLIENTWRITE_BODY` and `CLIENTWRITE_HEADER`. They are

View file

@ -393,6 +393,7 @@ This is the full list of functions generally banned.
sscanf
stat
strcat
strcpy
strdup
strerror
strncat

View file

@ -54,7 +54,7 @@ This, because first then does libcurl known which actual read callback to use.
size_t print_httppost_callback(void *arg, const char *buf, size_t len)
{
fwrite(buf, len, 1, stdout);
(*(size_t *)arg) += len;
*((size_t *)arg) += len;
return len;
}

View file

@ -22,10 +22,10 @@ CURLOPT_ALTSVC_CTRL - control alt-svc behavior
~~~c
#include <curl/curl.h>
#define CURLALTSVC_READONLYFILE (1L<<2)
#define CURLALTSVC_H1 (1L<<3)
#define CURLALTSVC_H2 (1L<<4)
#define CURLALTSVC_H3 (1L<<5)
#define CURLALTSVC_READONLYFILE (1L << 2)
#define CURLALTSVC_H1 (1L << 3)
#define CURLALTSVC_H2 (1L << 4)
#define CURLALTSVC_H3 (1L << 5)
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ALTSVC_CTRL, long bitmask);
~~~

View file

@ -23,8 +23,8 @@ CURLOPT_HSTS_CTRL - control HSTS behavior
~~~c
#include <curl/curl.h>
#define CURLHSTS_ENABLE (1L<<0)
#define CURLHSTS_READONLYFILE (1L<<1)
#define CURLHSTS_ENABLE (1L << 0)
#define CURLHSTS_READONLYFILE (1L << 1)
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTS_CTRL, long bitmask);
~~~

View file

@ -52,7 +52,7 @@ open F, "<symbols-in-versions";
sub str2num {
my ($str)=@_;
if($str && $str =~ /([0-9]*)\.([0-9]*)\.*([0-9]*)/) {
return sprintf("0x%06x", $1 <<16 | $2 << 8 | ($3 || '0'));
return sprintf("0x%06x", $1 << 16 | $2 << 8 | ($3 || '0'));
}
}