mirror of
https://github.com/curl/curl.git
synced 2026-04-26 18:02:12 +03:00
The issues found fell into these categories, with the applied fixes:
- const was accidentally stripped.
Adjust code to not cast or cast with const.
- const/volatile missing from arguments, local variables.
Constify arguments or variables, adjust/delete casts. Small code
changes in a few places.
- const must be stripped because an API dependency requires it.
Strip `const` with `CURL_UNCONST()` macro to silence the warning out
of our control. These happen at API boundaries. Sometimes they depend
on dependency version, which this patch handles as necessary. Also
enable const support for the zlib API, using `ZLIB_CONST`. Supported
by zlib 1.2.5.2 and newer.
- const must be stripped because a curl API requires it.
Strip `const` with `CURL_UNCONST()` macro to silence the warning out
of our immediate control. For example we promise to send a non-const
argument to a callback, though the data is const internally.
- other cases where we may avoid const stripping by code changes.
Also silenced with `CURL_UNCONST()`.
- there are 3 places where `CURL_UNCONST()` is cast again to const.
To silence this type of warning:
```
lib/vquic/curl_osslq.c:1015:29: error: to be safe all intermediate
pointers in cast from 'unsigned char **' to 'const unsigned char **'
must be 'const' qualified [-Werror=cast-qual]
lib/cf-socket.c:734:32: error: to be safe all intermediate pointers in
cast from 'char **' to 'const char **' must be 'const' qualified
[-Werror=cast-qual]
```
There may be a better solution, but I couldn't find it.
These cases are handled in separate subcommits, but without further
markup.
If you see a `-Wcast-qual` warning in curl, we appreciate your report
about it.
Closes #16142
93 lines
3.1 KiB
C
93 lines
3.1 KiB
C
#ifndef HEADER_CURL_TOOL_HELP_H
|
|
#define HEADER_CURL_TOOL_HELP_H
|
|
/***************************************************************************
|
|
* _ _ ____ _
|
|
* Project ___| | | | _ \| |
|
|
* / __| | | | |_) | |
|
|
* | (__| |_| | _ <| |___
|
|
* \___|\___/|_| \_\_____|
|
|
*
|
|
* Copyright (C) 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
|
|
* are also available at https://curl.se/docs/copyright.html.
|
|
*
|
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
* copies of the Software, and permit persons to whom the Software is
|
|
* furnished to do so, under the terms of the COPYING file.
|
|
*
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
* KIND, either express or implied.
|
|
*
|
|
* SPDX-License-Identifier: curl
|
|
*
|
|
***************************************************************************/
|
|
#include "tool_setup.h"
|
|
|
|
void tool_help(char *category);
|
|
void tool_list_engines(void);
|
|
void tool_version_info(void);
|
|
struct scan_ctx {
|
|
const char *trigger;
|
|
size_t tlen;
|
|
const char *arg;
|
|
size_t flen;
|
|
const char *endarg;
|
|
size_t elen;
|
|
size_t olen;
|
|
char rbuf[40];
|
|
char obuf[160];
|
|
unsigned char show; /* start as at 0.
|
|
trigger match moves it to 1
|
|
arg match moves it to 2
|
|
endarg stops the search */
|
|
};
|
|
void inithelpscan(struct scan_ctx *ctx, const char *trigger,
|
|
const char *arg, const char *endarg);
|
|
bool helpscan(const unsigned char *buf, size_t len, struct scan_ctx *ctx);
|
|
|
|
struct helptxt {
|
|
const char *opt;
|
|
const char *desc;
|
|
unsigned int categories;
|
|
};
|
|
|
|
/*
|
|
* The bitmask output is generated with the following command
|
|
------------------------------------------------------------
|
|
make -C docs/cmdline-opts listcats
|
|
*/
|
|
|
|
#define CURLHELP_AUTH (1u << 0u)
|
|
#define CURLHELP_CONNECTION (1u << 1u)
|
|
#define CURLHELP_CURL (1u << 2u)
|
|
#define CURLHELP_DEPRECATED (1u << 3u)
|
|
#define CURLHELP_DNS (1u << 4u)
|
|
#define CURLHELP_FILE (1u << 5u)
|
|
#define CURLHELP_FTP (1u << 6u)
|
|
#define CURLHELP_GLOBAL (1u << 7u)
|
|
#define CURLHELP_HTTP (1u << 8u)
|
|
#define CURLHELP_IMAP (1u << 9u)
|
|
#define CURLHELP_IMPORTANT (1u << 10u)
|
|
#define CURLHELP_LDAP (1u << 11u)
|
|
#define CURLHELP_OUTPUT (1u << 12u)
|
|
#define CURLHELP_POP3 (1u << 13u)
|
|
#define CURLHELP_POST (1u << 14u)
|
|
#define CURLHELP_PROXY (1u << 15u)
|
|
#define CURLHELP_SCP (1u << 16u)
|
|
#define CURLHELP_SFTP (1u << 17u)
|
|
#define CURLHELP_SMTP (1u << 18u)
|
|
#define CURLHELP_SSH (1u << 19u)
|
|
#define CURLHELP_TELNET (1u << 20u)
|
|
#define CURLHELP_TFTP (1u << 21u)
|
|
#define CURLHELP_TIMEOUT (1u << 22u)
|
|
#define CURLHELP_TLS (1u << 23u)
|
|
#define CURLHELP_UPLOAD (1u << 24u)
|
|
#define CURLHELP_VERBOSE (1u << 25u)
|
|
|
|
#define CURLHELP_ALL (0xfffffffu)
|
|
|
|
extern const struct helptxt helptext[];
|
|
|
|
#endif /* HEADER_CURL_TOOL_HELP_H */
|