1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[network] cast

This commit is contained in:
Witold Filipczyk 2022-01-25 18:37:40 +01:00
parent 3ca726ac98
commit 7d3cff0655
8 changed files with 35 additions and 35 deletions

View File

@ -242,28 +242,28 @@ static void
set_connection_socket_state(struct socket *socket, struct connection_state state) set_connection_socket_state(struct socket *socket, struct connection_state state)
{ {
assert(socket); assert(socket);
set_connection_state(socket->conn, state); set_connection_state((struct connection *)socket->conn, state);
} }
static void static void
set_connection_socket_timeout(struct socket *socket, struct connection_state state) set_connection_socket_timeout(struct socket *socket, struct connection_state state)
{ {
assert(socket); assert(socket);
set_connection_timeout(socket->conn); set_connection_timeout((struct connection *)socket->conn);
} }
static void static void
retry_connection_socket(struct socket *socket, struct connection_state state) retry_connection_socket(struct socket *socket, struct connection_state state)
{ {
assert(socket); assert(socket);
retry_connection(socket->conn, state); retry_connection((struct connection *)socket->conn, state);
} }
static void static void
done_connection_socket(struct socket *socket, struct connection_state state) done_connection_socket(struct socket *socket, struct connection_state state)
{ {
assert(socket); assert(socket);
abort_connection(socket->conn, state); abort_connection((struct connection *)socket->conn, state);
} }
static struct connection * static struct connection *
@ -348,7 +348,7 @@ stat_timer(struct connection *conn)
static void static void
upload_stat_timer(struct connection *conn) upload_stat_timer(struct connection *conn)
{ {
struct http_connection_info *http = conn->info; struct http_connection_info *http = (struct http_connection_info *)conn->info;
assert(conn->http_upload_progress); assert(conn->http_upload_progress);
assert(http); assert(http);
@ -684,7 +684,7 @@ check_keepalive_connections(void)
for (; p > MAX_KEEPALIVE_CONNECTIONS; p--) { for (; p > MAX_KEEPALIVE_CONNECTIONS; p--) {
assertm(!list_empty(keepalive_connections), "keepalive list empty"); assertm(!list_empty(keepalive_connections), "keepalive list empty");
if_assert_failed return; if_assert_failed return;
done_keepalive_connection(keepalive_connections.prev); done_keepalive_connection((struct keepalive_connection *)keepalive_connections.prev);
} }
if (!list_empty(keepalive_connections)) if (!list_empty(keepalive_connections))
@ -696,7 +696,7 @@ static inline void
abort_all_keepalive_connections(void) abort_all_keepalive_connections(void)
{ {
while (!list_empty(keepalive_connections)) while (!list_empty(keepalive_connections))
done_keepalive_connection(keepalive_connections.next); done_keepalive_connection((struct keepalive_connection *)keepalive_connections.next);
check_keepalive_connections(); check_keepalive_connections();
} }
@ -839,7 +839,7 @@ check_queue(void)
int max_conns = get_opt_int("connection.max_connections", NULL); int max_conns = get_opt_int("connection.max_connections", NULL);
again: again:
conn = connection_queue.next; conn = (struct connection *)connection_queue.next;
check_queue_bugs(); check_queue_bugs();
check_keepalive_connections(); check_keepalive_connections();
@ -1219,7 +1219,7 @@ void
abort_all_connections(void) abort_all_connections(void)
{ {
while (!list_empty(connection_queue)) { while (!list_empty(connection_queue)) {
abort_connection(connection_queue.next, abort_connection((struct connection *)connection_queue.next,
connection_state(S_INTERRUPTED)); connection_state(S_INTERRUPTED));
} }

View File

@ -529,7 +529,7 @@ find_host(char *name, void **queryref,
void void
kill_dns_request(void **queryref) kill_dns_request(void **queryref)
{ {
struct dnsquery *query = *queryref; struct dnsquery *query = (struct dnsquery *)*queryref;
assert(query); assert(query);

View File

@ -50,7 +50,7 @@ done_progress(struct progress *progress)
static void static void
progress_timeout(void *progress_voidptr) progress_timeout(void *progress_voidptr)
{ {
struct progress *const progress = progress_voidptr; struct progress *const progress = (struct progress *const)progress_voidptr;
progress->timer = TIMER_ID_UNDEF; progress->timer = TIMER_ID_UNDEF;
/* The expired timer ID has now been erased. */ /* The expired timer ID has now been erased. */

View File

@ -804,7 +804,7 @@ generic_write(struct socket *socket, char *data, int len)
static void static void
write_select(struct socket *socket) write_select(struct socket *socket)
{ {
struct write_buffer *wb = socket->write_buffer; struct write_buffer *wb = (struct write_buffer *)socket->write_buffer;
int wr; int wr;
assertm(wb != NULL, "write socket has no buffer"); assertm(wb != NULL, "write socket has no buffer");

View File

@ -57,7 +57,7 @@ match_hostname_pattern(const char *hostname,
size_t literal_length; size_t literal_length;
++pattern; ++pattern;
next_wildcard = memchr(pattern, '*', next_wildcard = (const char *)memchr(pattern, '*',
pattern_end - pattern); pattern_end - pattern);
if (next_wildcard == NULL) if (next_wildcard == NULL)
literal_length = pattern_end - pattern; literal_length = pattern_end - pattern;

View File

@ -56,9 +56,9 @@
#ifdef USE_OPENSSL #ifdef USE_OPENSSL
#define ssl_do_connect(socket) SSL_get_error(socket->ssl, SSL_connect(socket->ssl)) #define ssl_do_connect(socket) SSL_get_error((SSL *)socket->ssl, SSL_connect((SSL *)socket->ssl))
#define ssl_do_write(socket, data, len) SSL_write(socket->ssl, data, len) #define ssl_do_write(socket, data, len) SSL_write((SSL *)socket->ssl, data, len)
#define ssl_do_read(socket, data, len) SSL_read(socket->ssl, data, len) #define ssl_do_read(socket, data, len) SSL_read((SSL *)socket->ssl, data, len)
#define ssl_do_close(socket) /* Hmh? No idea.. */ #define ssl_do_close(socket) /* Hmh? No idea.. */
#elif defined(CONFIG_GNUTLS) #elif defined(CONFIG_GNUTLS)
@ -316,9 +316,9 @@ verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
return preverify_ok; return preverify_ok;
cert = X509_STORE_CTX_get_current_cert(ctx); cert = X509_STORE_CTX_get_current_cert(ctx);
ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx()); ssl = (SSL *)X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx());
socket = SSL_get_ex_data(ssl, socket_SSL_ex_data_idx); socket = (struct socket *)SSL_get_ex_data(ssl, socket_SSL_ex_data_idx);
conn = socket->conn; conn = (struct connection *)socket->conn;
host_in_uri = get_uri_string(conn->proxied_uri, URI_DNS_HOST); host_in_uri = get_uri_string(conn->proxied_uri, URI_DNS_HOST);
if (!host_in_uri) if (!host_in_uri)
return 0; return 0;
@ -326,7 +326,7 @@ verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
/* RFC 5280 section 4.2.1.6 describes the subjectAltName extension. /* RFC 5280 section 4.2.1.6 describes the subjectAltName extension.
* RFC 2818 section 3.1 says Common Name must not be used * RFC 2818 section 3.1 says Common Name must not be used
* if dNSName is present. */ * if dNSName is present. */
alts = X509_get_ext_d2i(cert, NID_subject_alt_name, NULL, NULL); alts = (GENERAL_NAMES *)X509_get_ext_d2i(cert, NID_subject_alt_name, NULL, NULL);
if (alts != NULL) { if (alts != NULL) {
int alt_count; int alt_count;
int alt_pos; int alt_pos;
@ -421,7 +421,7 @@ ssl_connect(struct socket *socket)
{ {
int ret; int ret;
char *server_name; char *server_name;
struct connection *conn = socket->conn; struct connection *conn = (struct connection *)socket->conn;
/* TODO: Recode server_name to UTF-8. */ /* TODO: Recode server_name to UTF-8. */
server_name = get_uri_string(conn->proxied_uri, URI_HOST); server_name = get_uri_string(conn->proxied_uri, URI_HOST);
@ -447,10 +447,10 @@ ssl_connect(struct socket *socket)
ssl_set_no_tls(socket); ssl_set_no_tls(socket);
#ifdef USE_OPENSSL #ifdef USE_OPENSSL
SSL_set_fd(socket->ssl, socket->fd); SSL_set_fd((SSL *)socket->ssl, socket->fd);
if (socket->verify && get_opt_bool("connection.ssl.cert_verify", NULL)) if (socket->verify && get_opt_bool("connection.ssl.cert_verify", NULL))
SSL_set_verify(socket->ssl, SSL_VERIFY_PEER SSL_set_verify((SSL *)socket->ssl, SSL_VERIFY_PEER
| SSL_VERIFY_FAIL_IF_NO_PEER_CERT, | SSL_VERIFY_FAIL_IF_NO_PEER_CERT,
verify_callback); verify_callback);
@ -538,7 +538,7 @@ ssl_write(struct socket *socket, char *data, int len)
if (wr <= 0) { if (wr <= 0) {
#ifdef USE_OPENSSL #ifdef USE_OPENSSL
int err = SSL_get_error(socket->ssl, wr); int err = SSL_get_error((SSL *)socket->ssl, wr);
#elif defined(CONFIG_GNUTLS) #elif defined(CONFIG_GNUTLS)
int err = wr; int err = wr;
#endif #endif
@ -567,7 +567,7 @@ ssl_read(struct socket *socket, char *data, int len)
if (rd <= 0) { if (rd <= 0) {
#ifdef USE_OPENSSL #ifdef USE_OPENSSL
int err = SSL_get_error(socket->ssl, rd); int err = SSL_get_error((SSL *)socket->ssl, rd);
#elif defined(CONFIG_GNUTLS) #elif defined(CONFIG_GNUTLS)
int err = rd; int err = rd;
#endif #endif

View File

@ -72,7 +72,7 @@ socket_SSL_ex_data_dup(CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from,
* *
* i.e., from_d always points to a pointer, even though * i.e., from_d always points to a pointer, even though
* it is just a void * in the prototype. */ * it is just a void * in the prototype. */
struct socket *socket = *(void **) from_d; struct socket *socket = (struct socket *)*(void **)from_d;
assert(idx == socket_SSL_ex_data_idx); assert(idx == socket_SSL_ex_data_idx);
if_assert_failed return 0; if_assert_failed return 0;
@ -358,8 +358,8 @@ init_ssl_connection(struct socket *socket,
socket->ssl = SSL_new(context); socket->ssl = SSL_new(context);
if (!socket->ssl) return S_SSL_ERROR; if (!socket->ssl) return S_SSL_ERROR;
if (!SSL_set_ex_data(socket->ssl, socket_SSL_ex_data_idx, socket)) { if (!SSL_set_ex_data((SSL *)socket->ssl, socket_SSL_ex_data_idx, socket)) {
SSL_free(socket->ssl); SSL_free((SSL *)socket->ssl);
socket->ssl = NULL; socket->ssl = NULL;
return S_SSL_ERROR; return S_SSL_ERROR;
} }
@ -370,8 +370,8 @@ init_ssl_connection(struct socket *socket,
* documented. The source shows that it returns 1 if * documented. The source shows that it returns 1 if
* successful; on error, it calls SSLerr and returns 0. */ * successful; on error, it calls SSLerr and returns 0. */
if (server_name if (server_name
&& !SSL_set_tlsext_host_name(socket->ssl, server_name)) { && !SSL_set_tlsext_host_name((SSL *)socket->ssl, server_name)) {
SSL_free(socket->ssl); SSL_free((SSL *)socket->ssl);
socket->ssl = NULL; socket->ssl = NULL;
return S_SSL_ERROR; return S_SSL_ERROR;
} }
@ -451,7 +451,7 @@ init_ssl_connection(struct socket *socket,
void void
done_ssl_connection(struct socket *socket) done_ssl_connection(struct socket *socket)
{ {
ssl_t *ssl = socket->ssl; ssl_t *ssl = (SSL *)socket->ssl;
if (!ssl) return; if (!ssl) return;
#ifdef USE_OPENSSL #ifdef USE_OPENSSL
@ -466,7 +466,7 @@ done_ssl_connection(struct socket *socket)
char * char *
get_ssl_connection_cipher(struct socket *socket) get_ssl_connection_cipher(struct socket *socket)
{ {
ssl_t *ssl = socket->ssl; ssl_t *ssl = (SSL *)socket->ssl;
struct string str; struct string str;
if (!init_string(&str)) return NULL; if (!init_string(&str)) return NULL;

View File

@ -121,7 +121,7 @@ handle_mouse(int cons, void (*fn)(void *, char *, int),
void void
unhandle_mouse(void *h) unhandle_mouse(void *h)
{ {
struct gpm_mouse_spec *gms = h; struct gpm_mouse_spec *gms = (struct gpm_mouse_spec *)h;
if (!gms) return; if (!gms) return;
@ -133,7 +133,7 @@ unhandle_mouse(void *h)
void void
suspend_mouse(void *h) suspend_mouse(void *h)
{ {
struct gpm_mouse_spec *gms = h; struct gpm_mouse_spec *gms = (struct gpm_mouse_spec *)h;
if (!gms) return; if (!gms) return;
@ -146,7 +146,7 @@ suspend_mouse(void *h)
void void
resume_mouse(void *h) resume_mouse(void *h)
{ {
struct gpm_mouse_spec *gms = h; struct gpm_mouse_spec *gms = (struct gpm_mouse_spec *)h;
if (!gms) return; if (!gms) return;