mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
Fix -Wcast-qual warnings with external APIs
These casts were there only drop a qualifier to satisfy some external API. Convert them to unconstify to make the purpose clear. Reviewed-by: Rui Zhao <zhaorui126@gmail.com> Discussion: https://www.postgresql.org/message-id/c76b72dd-5736-453a-b698-6968d42e4768%40eisentraut.org
This commit is contained in:
@@ -195,7 +195,7 @@ be_gssapi_write(Port *port, const void *ptr, size_t len)
|
||||
else
|
||||
input.length = bytes_to_encrypt;
|
||||
|
||||
input.value = (char *) ptr + bytes_encrypted;
|
||||
input.value = unconstify(char *, (const char *) ptr + bytes_encrypted);
|
||||
|
||||
output.value = NULL;
|
||||
output.length = 0;
|
||||
|
||||
@@ -1840,7 +1840,7 @@ alpn_cb(SSL *ssl,
|
||||
Assert(outlen != NULL);
|
||||
Assert(in != NULL);
|
||||
|
||||
retval = SSL_select_next_proto((unsigned char **) out, outlen,
|
||||
retval = SSL_select_next_proto(unconstify(unsigned char **, out), outlen,
|
||||
alpn_protos, sizeof(alpn_protos),
|
||||
in, inlen);
|
||||
if (*out == NULL || *outlen > sizeof(alpn_protos) || *outlen <= 0)
|
||||
|
||||
@@ -466,7 +466,7 @@ pgwin32_send(SOCKET s, const void *buf, int len, int flags)
|
||||
return -1;
|
||||
|
||||
wbuf.len = len;
|
||||
wbuf.buf = (char *) buf;
|
||||
wbuf.buf = unconstify(void *, buf);
|
||||
|
||||
/*
|
||||
* Readiness of socket to send data to UDP socket may be not true: socket
|
||||
|
||||
@@ -1514,7 +1514,7 @@ static char *dequote_file_name(char *fname, int quote_char);
|
||||
void
|
||||
initialize_readline(void)
|
||||
{
|
||||
rl_readline_name = (char *) pset.progname;
|
||||
rl_readline_name = unconstify(char *, pset.progname);
|
||||
rl_attempted_completion_function = psql_completion;
|
||||
|
||||
#ifdef USE_FILENAME_QUOTING_FUNCTIONS
|
||||
|
||||
@@ -185,7 +185,7 @@ pg_GSS_write(PGconn *conn, const void *ptr, size_t len)
|
||||
else
|
||||
input.length = bytes_to_encrypt;
|
||||
|
||||
input.value = (char *) ptr + bytes_encrypted;
|
||||
input.value = unconstify(char *, (const char *) ptr) + bytes_encrypted;
|
||||
|
||||
output.value = NULL;
|
||||
output.length = 0;
|
||||
|
||||
@@ -1153,7 +1153,7 @@ initialize_SSL(PGconn *conn)
|
||||
!(strspn(host, "0123456789.") == strlen(host) ||
|
||||
strchr(host, ':')))
|
||||
{
|
||||
if (SSL_set_tlsext_host_name(conn->ssl, host) != 1)
|
||||
if (SSL_set_tlsext_host_name(conn->ssl, unconstify(char *, host)) != 1)
|
||||
{
|
||||
char *errm = SSLerrmessage(ERR_get_error());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user