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

[session] cast

This commit is contained in:
Witold Filipczyk 2022-01-26 17:51:52 +01:00
parent b0565cce64
commit 20aea2ceaf
5 changed files with 33 additions and 33 deletions

View File

@ -151,7 +151,7 @@ check_whether_file_exists(char *name)
return namelen;
for (i = 0; i < sizeof(chars) - 1; i++) {
char *pos = memchr(name, chars[i], namelen);
char *pos = (char *)memchr(name, chars[i], namelen);
int exists;
if (!pos) continue;
@ -631,7 +631,7 @@ add_uri_to_string(struct string *string, const struct uri *uri,
}
if (wants(URI_QUERY) && uri->datalen) {
const char *query = memchr(uri->data, '?', uri->datalen);
const char *query = (const char *)memchr(uri->data, '?', uri->datalen);
assertm(URI_QUERY == components,
"URI_QUERY should be used alone %d", components);
@ -906,7 +906,7 @@ join_urls(struct uri *base, char *rel)
length = base->fragment ? base->fragment - struri(base) - 1
: get_real_uri_length(base);
uristring = memchr(base->data, '?', base->datalen);
uristring = (char *)memchr(base->data, '?', base->datalen);
if (uristring) length = uristring - struri(base);
} else if (rel[0] == '/' && rel[1] == '/') {
@ -1574,7 +1574,7 @@ get_uri_cache_entry(char *string, int length)
if_assert_failed return NULL;
item = get_hash_item(uri_cache.map, string, length);
if (item) return item->value;
if (item) return (struct uri_cache_entry *)item->value;
/* Setup a new entry */
@ -1646,7 +1646,7 @@ done_uri(struct uri *uri)
if (is_object_used(uri)) return;
item = get_hash_item(uri_cache.map, string, length);
entry = item ? item->value : NULL;
entry = (struct uri_cache_entry *)(item ? item->value : NULL);
assertm(entry != NULL, "Releasing unknown URI [%s]", string);
del_hash_item(uri_cache.map, item);

View File

@ -180,7 +180,7 @@ void
abort_all_downloads(void)
{
while (!list_empty(downloads))
abort_download(downloads.next);
abort_download((struct file_download *)downloads.next);
}
@ -359,7 +359,7 @@ do_follow_url_mailcap(struct session *ses, struct uri *uri)
static void
exec_mailcap_command(void *data)
{
struct exec_mailcap *exec_mailcap = data;
struct exec_mailcap *exec_mailcap = (struct exec_mailcap *)data;
if (exec_mailcap) {
if (exec_mailcap->command) {
@ -667,7 +667,7 @@ struct cdf_hop {
static void
lun_alternate(void *lun_hop_)
{
struct lun_hop *lun_hop = lun_hop_;
struct lun_hop *lun_hop = (struct lun_hop *)lun_hop_;
lun_hop->callback(lun_hop->term, lun_hop->file, lun_hop->data,
lun_hop->flags);
@ -684,7 +684,7 @@ lun_alternate(void *lun_hop_)
static void
lun_cancel(void *lun_hop_)
{
struct lun_hop *lun_hop = lun_hop_;
struct lun_hop *lun_hop = (struct lun_hop *)lun_hop_;
lun_hop->callback(lun_hop->term, NULL, lun_hop->data,
lun_hop->flags);
@ -703,7 +703,7 @@ lun_cancel(void *lun_hop_)
static void
lun_overwrite(void *lun_hop_)
{
struct lun_hop *lun_hop = lun_hop_;
struct lun_hop *lun_hop = (struct lun_hop *)lun_hop_;
lun_hop->callback(lun_hop->term, lun_hop->ofile, lun_hop->data,
lun_hop->flags);
@ -721,7 +721,7 @@ lun_overwrite(void *lun_hop_)
static void
lun_resume(void *lun_hop_)
{
struct lun_hop *lun_hop = lun_hop_;
struct lun_hop *lun_hop = (struct lun_hop *)lun_hop_;
lun_hop->callback(lun_hop->term, lun_hop->ofile, lun_hop->data,
lun_hop->flags | DOWNLOAD_RESUME_SELECTED);
@ -863,7 +863,7 @@ static void
create_download_file_do(struct terminal *term, char *file,
void *data, enum download_flags flags)
{
struct cdf_hop *cdf_hop = data;
struct cdf_hop *cdf_hop = (struct cdf_hop *)data;
char *wd;
int h = -1;
int saved_errno;
@ -1108,7 +1108,7 @@ common_download_do(struct terminal *term, int fd, void *data,
enum download_flags flags)
{
struct file_download *file_download;
struct cmdw_hop *cmdw_hop = data;
struct cmdw_hop *cmdw_hop = (struct cmdw_hop *)data;
struct uri *download_uri = cmdw_hop->download_uri;
char *file = cmdw_hop->real_file;
struct session *ses = cmdw_hop->ses;
@ -1177,7 +1177,7 @@ common_download(struct session *ses, char *file,
void
start_download(void *ses, char *file)
{
common_download(ses, file,
common_download((struct session *)ses, file,
DOWNLOAD_RESUME_ALLOWED);
}
@ -1192,7 +1192,7 @@ start_download(void *ses, char *file)
void
resume_download(void *ses, char *file)
{
common_download(ses, file,
common_download((struct session *)ses, file,
DOWNLOAD_RESUME_ALLOWED | DOWNLOAD_RESUME_SELECTED);
}
@ -1233,7 +1233,7 @@ static void
continue_download_do(struct terminal *term, int fd, void *data,
enum download_flags flags)
{
struct codw_hop *codw_hop = data;
struct codw_hop *codw_hop = (struct codw_hop *)data;
struct file_download *file_download = NULL;
struct type_query *type_query;
@ -1301,7 +1301,7 @@ cancel:
static void
continue_download(void *data, char *file)
{
struct type_query *type_query = data;
struct type_query *type_query = (struct type_query *)data;
struct codw_hop *codw_hop = (struct codw_hop *)mem_calloc(1, sizeof(*codw_hop));
if (!codw_hop) {
@ -1407,7 +1407,7 @@ done_type_query(struct type_query *type_query)
void
tp_cancel(void *data)
{
struct type_query *type_query = data;
struct type_query *type_query = (struct type_query *)data;
/* XXX: Should we really abort? (1 vs 0 as the last param) --pasky */
cancel_download(&type_query->download, 1);
@ -1440,7 +1440,7 @@ tp_save(struct type_query *type_query)
static widget_handler_status_T
tp_show_header(struct dialog_data *dlg_data, struct widget_data *widget_data)
{
struct type_query *type_query = widget_data->widget->data;
struct type_query *type_query = (struct type_query *)widget_data->widget->data;
cached_header_dialog(type_query->ses, type_query->cached);

View File

@ -28,7 +28,7 @@ static inline void
free_history(LIST_OF(struct location) *history)
{
while (!list_empty(*history)) {
struct location *loc = history->next;
struct location *loc = (struct location *)history->next;
del_from_list(loc);
destroy_location(loc);

View File

@ -143,7 +143,7 @@ void
done_saved_session_info(void)
{
while (!list_empty(session_info))
done_session_info(session_info.next);
done_session_info((struct session_info *)session_info.next);
}
/** Timer callback for session_info.timer. As explained in install_timer(),
@ -228,7 +228,7 @@ get_master_session(void)
if (ses->tab->term->master) {
struct window *current_tab = get_current_tab(ses->tab->term);
return current_tab ? current_tab->data : NULL;
return (struct session *)(current_tab ? current_tab->data : NULL);
}
return NULL;
@ -598,7 +598,7 @@ void
check_questions_queue(struct session *ses)
{
while (!list_empty(questions_queue)) {
struct questions_entry *q = questions_queue.next;
struct questions_entry *q = (struct questions_entry *)questions_queue.next;
q->callback(ses, q->data);
del_from_list(q);
@ -970,7 +970,7 @@ setup_first_session(struct session *ses, struct uri *uri)
"Press ESC for menu. Documentation is available in "
"Help menu."),
ses, 1,
MSG_BOX_BUTTON(N_("~OK"), handler, B_ENTER | B_ESC));
MSG_BOX_BUTTON(N_("~OK"), (void (*)(void *))handler, B_ENTER | B_ESC));
/* If there is no URI the goto dialog will pop up so there is
* no need to call setup_session(). */
@ -1251,7 +1251,7 @@ decode_session_info(struct terminal *term, struct terminal_info *info)
/* If processing session info from a -remote instance we want
* to hook up with the master so we can handle request for
* stuff in current tab. */
base_session = get_master_session() ?: sessions.next;
base_session = (struct session *)(get_master_session() ?: sessions.next);
if (!base_session) {
return 0;
@ -1286,7 +1286,7 @@ decode_session_info(struct terminal *term, struct terminal_info *info)
/* Extract multiple (possible) NUL terminated URIs */
while (len > 0) {
char *end = memchr(str, 0, len);
char *end = (char *)memchr(str, 0, len);
int urilength = end ? end - str : len;
struct uri *uri = NULL;
char *uristring = memacpy(str, urilength);
@ -1382,7 +1382,7 @@ destroy_session(struct session *ses)
kill_timer(&ses->display_timer);
while (!list_empty(ses->type_queries))
done_type_query(ses->type_queries.next);
done_type_query((struct type_query *)ses->type_queries.next);
if (ses->download_uri) done_uri(ses->download_uri);
mem_free_if(ses->search_word);
@ -1493,7 +1493,7 @@ set_session_referrer(struct session *ses, struct uri *referrer)
static void
tabwin_func(struct window *tab, struct term_event *ev)
{
struct session *ses = tab->data;
struct session *ses = (struct session *)tab->data;
switch (ev->ev) {
case EVENT_ABORT:

View File

@ -101,7 +101,7 @@ ses_load(struct session *ses, struct uri *uri, char *target_frame,
static void
post_yes(void *task_)
{
struct task *task = task_;
struct task *task = (struct task *)task_;
abort_preloading(task->ses, 0);
@ -114,7 +114,7 @@ post_yes(void *task_)
static void
post_no(void *task_)
{
struct task *task = task_;
struct task *task = (struct task *)task_;
reload(task->ses, CACHE_MODE_NORMAL);
done_uri(task->uri);
@ -704,7 +704,7 @@ goto_uri_frame(struct session *ses, struct uri *uri,
void
delayed_goto_uri_frame(void *data)
{
struct delayed_open *deo = data;
struct delayed_open *deo = (struct delayed_open *)data;
struct frame *frame;
assert(deo);
@ -723,8 +723,8 @@ delayed_goto_uri_frame(void *data)
void
map_selected(struct terminal *term, void *ld_, void *ses_)
{
struct link_def *ld = ld_;
struct session *ses = ses_;
struct link_def *ld = (struct link_def *)ld_;
struct session *ses = (struct session *)ses_;
struct uri *uri = get_uri(ld->link, URI_NONE);
goto_uri_frame(ses, uri, ld->target, CACHE_MODE_NORMAL);