mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-26 08:19:55 +03:00
[project @ 2005-08-21 12:04:17 by bursa]
Change void * parameters to intptr_t to make them correct for storing integers or pointers. svn path=/import/netsurf/; revision=1852
This commit is contained in:
parent
4f82731104
commit
08e8ee3ed1
@ -2,7 +2,7 @@
|
||||
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
||||
* Licensed under the GNU General Public License,
|
||||
* http://www.opensource.org/licenses/gpl-license
|
||||
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
|
||||
* Copyright 2005 James Bursa <bursa@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
/** \file
|
||||
@ -13,6 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -363,9 +364,9 @@ bool content_set_type(struct content *c, content_type type,
|
||||
{
|
||||
union content_msg_data msg_data;
|
||||
struct content *clone;
|
||||
void (*callback)(content_msg msg, struct content *c, void *p1,
|
||||
void *p2, union content_msg_data data);
|
||||
void *p1, *p2;
|
||||
void (*callback)(content_msg msg, struct content *c, intptr_t p1,
|
||||
intptr_t p2, union content_msg_data data);
|
||||
intptr_t p1, p2;
|
||||
|
||||
assert(c != 0);
|
||||
assert(c->status == CONTENT_STATUS_TYPE_UNKNOWN);
|
||||
@ -772,13 +773,14 @@ bool content_redraw(struct content *c, int x, int y,
|
||||
*/
|
||||
|
||||
bool content_add_user(struct content *c,
|
||||
void (*callback)(content_msg msg, struct content *c, void *p1,
|
||||
void *p2, union content_msg_data data),
|
||||
void *p1, void *p2)
|
||||
void (*callback)(content_msg msg, struct content *c,
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data),
|
||||
intptr_t p1, intptr_t p2)
|
||||
{
|
||||
struct content_user *user;
|
||||
|
||||
LOG(("content %s, user %p %p %p", c->url, callback, p1, p2));
|
||||
LOG(("content %s, user %p 0x%" PRIxPTR " 0x%" PRIxPTR,
|
||||
c->url, callback, p1, p2));
|
||||
user = talloc(c, struct content_user);
|
||||
if (!user)
|
||||
return false;
|
||||
@ -800,9 +802,9 @@ bool content_add_user(struct content *c,
|
||||
*/
|
||||
|
||||
struct content_user * content_find_user(struct content *c,
|
||||
void (*callback)(content_msg msg, struct content *c, void *p1,
|
||||
void *p2, union content_msg_data data),
|
||||
void *p1, void *p2)
|
||||
void (*callback)(content_msg msg, struct content *c,
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data),
|
||||
intptr_t p1, intptr_t p2)
|
||||
{
|
||||
struct content_user *user;
|
||||
|
||||
@ -824,12 +826,13 @@ struct content_user * content_find_user(struct content *c,
|
||||
*/
|
||||
|
||||
void content_remove_user(struct content *c,
|
||||
void (*callback)(content_msg msg, struct content *c, void *p1,
|
||||
void *p2, union content_msg_data data),
|
||||
void *p1, void *p2)
|
||||
void (*callback)(content_msg msg, struct content *c,
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data),
|
||||
intptr_t p1, intptr_t p2)
|
||||
{
|
||||
struct content_user *user, *next;
|
||||
LOG(("content %s, user %p %p %p", c->url, callback, p1, p2));
|
||||
LOG(("content %s, user %p 0x%" PRIxPTR " 0x%" PRIxPTR,
|
||||
c->url, callback, p1, p2));
|
||||
|
||||
/* user_list starts with a sentinel */
|
||||
for (user = c->user_list; user->next != 0 &&
|
||||
@ -873,9 +876,9 @@ void content_broadcast(struct content *c, content_msg msg,
|
||||
*/
|
||||
|
||||
void content_stop(struct content *c,
|
||||
void (*callback)(content_msg msg, struct content *c, void *p1,
|
||||
void *p2, union content_msg_data data),
|
||||
void *p1, void *p2)
|
||||
void (*callback)(content_msg msg, struct content *c,
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data),
|
||||
intptr_t p1, intptr_t p2)
|
||||
{
|
||||
struct content_user *user;
|
||||
|
||||
@ -888,7 +891,8 @@ void content_stop(struct content *c,
|
||||
return;
|
||||
}
|
||||
|
||||
LOG(("%p %s: stop user %p %p %p", c, c->url, callback, p1, p2));
|
||||
LOG(("%p %s: stop user %p 0x%" PRIxPTR " 0x%" PRIxPTR,
|
||||
c, c->url, callback, p1, p2));
|
||||
user->stop = true;
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
||||
* Licensed under the GNU General Public License,
|
||||
* http://www.opensource.org/licenses/gpl-license
|
||||
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
|
||||
* Copyright 2005 James Bursa <bursa@users.sourceforge.net>
|
||||
* Copyright 2003 Philip Pemberton <philpem@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
@ -101,6 +101,7 @@
|
||||
#ifndef _NETSURF_DESKTOP_CONTENT_H_
|
||||
#define _NETSURF_DESKTOP_CONTENT_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "netsurf/utils/config.h"
|
||||
#include "netsurf/content/content_type.h"
|
||||
#include "netsurf/css/css.h"
|
||||
@ -172,10 +173,10 @@ union content_msg_data {
|
||||
/** Linked list of users of a content. */
|
||||
struct content_user
|
||||
{
|
||||
void (*callback)(content_msg msg, struct content *c, void *p1,
|
||||
void *p2, union content_msg_data data);
|
||||
void *p1;
|
||||
void *p2;
|
||||
void (*callback)(content_msg msg, struct content *c, intptr_t p1,
|
||||
intptr_t p2, union content_msg_data data);
|
||||
intptr_t p1;
|
||||
intptr_t p2;
|
||||
bool stop;
|
||||
struct content_user *next;
|
||||
};
|
||||
@ -286,23 +287,23 @@ bool content_redraw(struct content *c, int x, int y,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
float scale, unsigned long background_colour);
|
||||
bool content_add_user(struct content *c,
|
||||
void (*callback)(content_msg msg, struct content *c, void *p1,
|
||||
void *p2, union content_msg_data data),
|
||||
void *p1, void *p2);
|
||||
void (*callback)(content_msg msg, struct content *c,
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data),
|
||||
intptr_t p1, intptr_t p2);
|
||||
struct content_user * content_find_user(struct content *c,
|
||||
void (*callback)(content_msg msg, struct content *c, void *p1,
|
||||
void *p2, union content_msg_data data),
|
||||
void *p1, void *p2);
|
||||
void (*callback)(content_msg msg, struct content *c,
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data),
|
||||
intptr_t p1, intptr_t p2);
|
||||
void content_remove_user(struct content *c,
|
||||
void (*callback)(content_msg msg, struct content *c, void *p1,
|
||||
void *p2, union content_msg_data data),
|
||||
void *p1, void *p2);
|
||||
void (*callback)(content_msg msg, struct content *c,
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data),
|
||||
intptr_t p1, intptr_t p2);
|
||||
void content_broadcast(struct content *c, content_msg msg,
|
||||
union content_msg_data data);
|
||||
void content_stop(struct content *c,
|
||||
void (*callback)(content_msg msg, struct content *c, void *p1,
|
||||
void *p2, union content_msg_data data),
|
||||
void *p1, void *p2);
|
||||
void (*callback)(content_msg msg, struct content *c,
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data),
|
||||
intptr_t p1, intptr_t p2);
|
||||
void content_open(struct content *c, struct browser_window *bw,
|
||||
struct content *page, struct box *box,
|
||||
struct object_params *params);
|
||||
|
@ -2,7 +2,7 @@
|
||||
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
||||
* Licensed under the GNU General Public License,
|
||||
* http://www.opensource.org/licenses/gpl-license
|
||||
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
|
||||
* Copyright 2005 James Bursa <bursa@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
/** \file
|
||||
@ -46,8 +46,8 @@ static void fetchcache_error_page(struct content *c, const char *error);
|
||||
* \param url address to fetch
|
||||
* \param callback function to call when anything interesting happens to
|
||||
* the new content
|
||||
* \param p1 user parameter for callback
|
||||
* \param p2 user parameter for callback
|
||||
* \param p1 user parameter for callback (may be a pointer or integer)
|
||||
* \param p2 user parameter for callback (may be a pointer or integer)
|
||||
* \param width available space
|
||||
* \param height available space
|
||||
* \param no_error_pages if an error occurs, send CONTENT_MSG_ERROR instead
|
||||
@ -62,9 +62,9 @@ static void fetchcache_error_page(struct content *c, const char *error);
|
||||
*/
|
||||
|
||||
struct content * fetchcache(const char *url,
|
||||
void (*callback)(content_msg msg, struct content *c, void *p1,
|
||||
void *p2, union content_msg_data data),
|
||||
void *p1, void *p2,
|
||||
void (*callback)(content_msg msg, struct content *c,
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data),
|
||||
intptr_t p1, intptr_t p2,
|
||||
int width, int height,
|
||||
bool no_error_pages,
|
||||
char *post_urlenc,
|
||||
@ -122,8 +122,8 @@ struct content * fetchcache(const char *url,
|
||||
* \param referer referring URL, or 0
|
||||
* \param callback function to call when anything interesting happens to
|
||||
* the new content
|
||||
* \param p1 user parameter for callback
|
||||
* \param p2 user parameter for callback
|
||||
* \param p1 user parameter for callback
|
||||
* \param p2 user parameter for callback
|
||||
* \param width available space
|
||||
* \param height available space
|
||||
* \param post_urlenc url encoded post data, or 0 if none
|
||||
@ -134,9 +134,9 @@ struct content * fetchcache(const char *url,
|
||||
*/
|
||||
|
||||
void fetchcache_go(struct content *content, char *referer,
|
||||
void (*callback)(content_msg msg, struct content *c, void *p1,
|
||||
void *p2, union content_msg_data data),
|
||||
void *p1, void *p2,
|
||||
void (*callback)(content_msg msg, struct content *c,
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data),
|
||||
intptr_t p1, intptr_t p2,
|
||||
int width, int height,
|
||||
char *post_urlenc,
|
||||
struct form_successful_control *post_multipart,
|
||||
|
@ -2,7 +2,7 @@
|
||||
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
||||
* Licensed under the GNU General Public License,
|
||||
* http://www.opensource.org/licenses/gpl-license
|
||||
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
|
||||
* Copyright 2005 James Bursa <bursa@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
/** \file
|
||||
@ -16,15 +16,16 @@
|
||||
#define _NETSURF_DESKTOP_FETCHCACHE_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "netsurf/content/content.h"
|
||||
|
||||
struct form_successful_control;
|
||||
|
||||
void fetchcache_init(void);
|
||||
struct content * fetchcache(const char *url,
|
||||
void (*callback)(content_msg msg, struct content *c, void *p1,
|
||||
void *p2, union content_msg_data data),
|
||||
void *p1, void *p2,
|
||||
void (*callback)(content_msg msg, struct content *c,
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data),
|
||||
intptr_t p1, intptr_t p2,
|
||||
int width, int height,
|
||||
bool no_error_pages,
|
||||
char *post_urlenc,
|
||||
@ -32,9 +33,9 @@ struct content * fetchcache(const char *url,
|
||||
bool cookies,
|
||||
bool download);
|
||||
void fetchcache_go(struct content *content, char *referer,
|
||||
void (*callback)(content_msg msg, struct content *c, void *p1,
|
||||
void *p2, union content_msg_data data),
|
||||
void *p1, void *p2,
|
||||
void (*callback)(content_msg msg, struct content *c,
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data),
|
||||
intptr_t p1, intptr_t p2,
|
||||
int width, int height,
|
||||
char *post_urlenc,
|
||||
struct form_successful_control *post_multipart,
|
||||
|
@ -519,7 +519,9 @@ void url_store_save(const char *file) {
|
||||
const char *thumb_file = "";
|
||||
int thumb_size = 0;
|
||||
FILE *fp;
|
||||
#ifdef riscos
|
||||
struct bitmap *bitmap;
|
||||
#endif
|
||||
|
||||
fp = fopen(file, "w");
|
||||
if (!fp) {
|
||||
|
23
css/css.c
23
css/css.c
@ -74,6 +74,7 @@
|
||||
|
||||
#define _GNU_SOURCE /* for strndup */
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
@ -102,7 +103,7 @@ struct css_working_stylesheet {
|
||||
|
||||
static void css_deep_free_style(struct css_style *style);
|
||||
static void css_atimport_callback(content_msg msg, struct content *css,
|
||||
void *p1, void *p2, union content_msg_data data);
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data);
|
||||
static bool css_working_list_imports(struct content **import,
|
||||
unsigned int import_count,
|
||||
struct content ***css, unsigned int *css_count);
|
||||
@ -484,7 +485,7 @@ void css_destroy(struct content *c)
|
||||
if (c->data.css.import_content[i] != 0) {
|
||||
free(c->data.css.import_url[i]);
|
||||
content_remove_user(c->data.css.import_content[i],
|
||||
css_atimport_callback, c, (void*)i);
|
||||
css_atimport_callback, (intptr_t) c, i);
|
||||
}
|
||||
free(c->data.css.import_url);
|
||||
free(c->data.css.import_content);
|
||||
@ -869,12 +870,12 @@ void css_atimport(struct content *c, struct css_node *node)
|
||||
i = c->data.css.import_count - 1;
|
||||
c->data.css.import_url[i] = url1;
|
||||
c->data.css.import_content[i] = fetchcache(c->data.css.import_url[i],
|
||||
css_atimport_callback, c, (void *) i,
|
||||
css_atimport_callback, (intptr_t) c, i,
|
||||
c->width, c->height, true, 0, 0, false, false);
|
||||
if (c->data.css.import_content[i]) {
|
||||
c->active++;
|
||||
fetchcache_go(c->data.css.import_content[i], c->url,
|
||||
css_atimport_callback, c, (void *) i,
|
||||
css_atimport_callback, (intptr_t) c, i,
|
||||
c->width, c->height,
|
||||
0, 0, false);
|
||||
}
|
||||
@ -888,14 +889,16 @@ void css_atimport(struct content *c, struct css_node *node)
|
||||
*/
|
||||
|
||||
void css_atimport_callback(content_msg msg, struct content *css,
|
||||
void *p1, void *p2, union content_msg_data data)
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data)
|
||||
{
|
||||
struct content *c = p1;
|
||||
unsigned int i = (unsigned int) p2;
|
||||
struct content *c = (struct content *) p1;
|
||||
unsigned int i = p2;
|
||||
|
||||
switch (msg) {
|
||||
case CONTENT_MSG_LOADING:
|
||||
if (css->type != CONTENT_CSS) {
|
||||
content_remove_user(css, css_atimport_callback, c, (void*)i);
|
||||
content_remove_user(css, css_atimport_callback,
|
||||
(intptr_t) c, i);
|
||||
c->data.css.import_content[i] = 0;
|
||||
c->active--;
|
||||
content_add_error(c, "NotCSS", 0);
|
||||
@ -931,14 +934,14 @@ void css_atimport_callback(content_msg msg, struct content *css,
|
||||
}
|
||||
c->data.css.import_content[i] = fetchcache(
|
||||
c->data.css.import_url[i],
|
||||
css_atimport_callback, c, (void *) i,
|
||||
css_atimport_callback, (intptr_t) c, i,
|
||||
css->width, css->height, true, 0, 0,
|
||||
false, false);
|
||||
if (c->data.css.import_content[i]) {
|
||||
c->active++;
|
||||
fetchcache_go(c->data.css.import_content[i],
|
||||
c->url, css_atimport_callback,
|
||||
c, (void *) i,
|
||||
(intptr_t) c, i,
|
||||
css->width, css->height,
|
||||
0, 0, false);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Licensed under the GNU General Public License,
|
||||
* http://www.opensource.org/licenses/gpl-license
|
||||
* Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
|
||||
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
|
||||
* Copyright 2005 James Bursa <bursa@users.sourceforge.net>
|
||||
* Copyright 2004 Andrew Timmins <atimmins@blueyonder.co.uk>
|
||||
* Copyright 2004 John Tytgat <John.Tytgat@aaug.net>
|
||||
*/
|
||||
@ -16,6 +16,7 @@
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
@ -49,7 +50,7 @@ struct browser_window *current_redraw_browser;
|
||||
|
||||
|
||||
static void browser_window_callback(content_msg msg, struct content *c,
|
||||
void *p1, void *p2, union content_msg_data data);
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data);
|
||||
static void browser_window_convert_to_download(struct browser_window *bw);
|
||||
static void browser_window_start_throbber(struct browser_window *bw);
|
||||
static void browser_window_stop_throbber(struct browser_window *bw);
|
||||
@ -218,7 +219,7 @@ void browser_window_go_post(struct browser_window *bw, const char *url,
|
||||
browser_window_set_status(bw, messages_get("Loading"));
|
||||
bw->history_add = history_add;
|
||||
bw->time0 = clock();
|
||||
c = fetchcache(url2, browser_window_callback, bw, 0,
|
||||
c = fetchcache(url2, browser_window_callback, (intptr_t) bw, 0,
|
||||
gui_window_get_width(bw->window),
|
||||
gui_window_get_height(bw->window),
|
||||
false,
|
||||
@ -241,7 +242,7 @@ void browser_window_go_post(struct browser_window *bw, const char *url,
|
||||
bw->download = download;
|
||||
|
||||
fetchcache_go(c, option_send_referer ? referer : 0,
|
||||
browser_window_callback, bw, 0,
|
||||
browser_window_callback, (intptr_t) bw, 0,
|
||||
gui_window_get_width(bw->window),
|
||||
gui_window_get_height(bw->window),
|
||||
post_urlenc, post_multipart, true);
|
||||
@ -253,9 +254,9 @@ void browser_window_go_post(struct browser_window *bw, const char *url,
|
||||
*/
|
||||
|
||||
void browser_window_callback(content_msg msg, struct content *c,
|
||||
void *p1, void *p2, union content_msg_data data)
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data)
|
||||
{
|
||||
struct browser_window *bw = p1;
|
||||
struct browser_window *bw = (struct browser_window *) p1;
|
||||
char status[40];
|
||||
char url[256];
|
||||
|
||||
@ -270,7 +271,7 @@ void browser_window_callback(content_msg msg, struct content *c,
|
||||
theme_install_start(c);
|
||||
bw->loading_content = 0;
|
||||
content_remove_user(c, browser_window_callback,
|
||||
bw, 0);
|
||||
(intptr_t) bw, 0);
|
||||
browser_window_stop_throbber(bw);
|
||||
}
|
||||
#endif
|
||||
@ -297,7 +298,7 @@ void browser_window_callback(content_msg msg, struct content *c,
|
||||
content_close(bw->current_content);
|
||||
content_remove_user(bw->current_content,
|
||||
browser_window_callback,
|
||||
bw, 0);
|
||||
(intptr_t) bw, 0);
|
||||
}
|
||||
bw->current_content = c;
|
||||
bw->loading_content = NULL;
|
||||
@ -445,7 +446,7 @@ void browser_window_convert_to_download(struct browser_window *bw)
|
||||
|
||||
/* remove content from browser window */
|
||||
bw->loading_content = 0;
|
||||
content_remove_user(c, browser_window_callback, bw, 0);
|
||||
content_remove_user(c, browser_window_callback, (intptr_t) bw, 0);
|
||||
browser_window_stop_throbber(bw);
|
||||
}
|
||||
|
||||
@ -525,7 +526,7 @@ void browser_window_stop(struct browser_window *bw)
|
||||
{
|
||||
if (bw->loading_content) {
|
||||
content_remove_user(bw->loading_content,
|
||||
browser_window_callback, bw, 0);
|
||||
browser_window_callback, (intptr_t) bw, 0);
|
||||
bw->loading_content = 0;
|
||||
}
|
||||
|
||||
@ -533,7 +534,7 @@ void browser_window_stop(struct browser_window *bw)
|
||||
bw->current_content->status != CONTENT_STATUS_DONE) {
|
||||
assert(bw->current_content->status == CONTENT_STATUS_READY);
|
||||
content_stop(bw->current_content,
|
||||
browser_window_callback, bw, 0);
|
||||
browser_window_callback, (intptr_t) bw, 0);
|
||||
}
|
||||
|
||||
browser_window_stop_throbber(bw);
|
||||
@ -610,7 +611,7 @@ void browser_window_destroy(struct browser_window *bw)
|
||||
{
|
||||
if (bw->loading_content) {
|
||||
content_remove_user(bw->loading_content,
|
||||
browser_window_callback, bw, 0);
|
||||
browser_window_callback, (intptr_t) bw, 0);
|
||||
bw->loading_content = 0;
|
||||
}
|
||||
|
||||
@ -620,7 +621,7 @@ void browser_window_destroy(struct browser_window *bw)
|
||||
CONTENT_STATUS_DONE)
|
||||
content_close(bw->current_content);
|
||||
content_remove_user(bw->current_content,
|
||||
browser_window_callback, bw, 0);
|
||||
browser_window_callback, (intptr_t) bw, 0);
|
||||
}
|
||||
|
||||
selection_destroy(bw->sel);
|
||||
|
@ -2,7 +2,7 @@
|
||||
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
||||
* Licensed under the GNU General Public License,
|
||||
* http://www.opensource.org/licenses/gpl-license
|
||||
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
|
||||
* Copyright 2005 James Bursa <bursa@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
/** \file
|
||||
@ -11,6 +11,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <stdlib.h>
|
||||
@ -38,11 +39,11 @@
|
||||
static bool html_set_parser_encoding(struct content *c, const char *encoding);
|
||||
static const char *html_detect_encoding(const char *data, unsigned int size);
|
||||
static void html_convert_css_callback(content_msg msg, struct content *css,
|
||||
void *p1, void *p2, union content_msg_data data);
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data);
|
||||
static bool html_head(struct content *c, xmlNode *head);
|
||||
static bool html_find_stylesheets(struct content *c, xmlNode *head);
|
||||
static void html_object_callback(content_msg msg, struct content *object,
|
||||
void *p1, void *p2, union content_msg_data data);
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data);
|
||||
static void html_object_done(struct box *box, struct content *object,
|
||||
bool background);
|
||||
static void html_object_failed(struct box *box, struct content *content,
|
||||
@ -443,30 +444,30 @@ bool html_find_stylesheets(struct content *c, xmlNode *head)
|
||||
|
||||
c->data.html.stylesheet_content[STYLESHEET_BASE] = fetchcache(
|
||||
default_stylesheet_url,
|
||||
html_convert_css_callback, c,
|
||||
(void *) STYLESHEET_BASE, c->width, c->height,
|
||||
html_convert_css_callback, (intptr_t) c,
|
||||
STYLESHEET_BASE, c->width, c->height,
|
||||
true, 0, 0, false, false);
|
||||
if (!c->data.html.stylesheet_content[STYLESHEET_BASE])
|
||||
return false;
|
||||
c->active++;
|
||||
fetchcache_go(c->data.html.stylesheet_content[STYLESHEET_BASE], 0,
|
||||
html_convert_css_callback, c,
|
||||
(void *) STYLESHEET_BASE, c->width, c->height,
|
||||
html_convert_css_callback, (intptr_t) c,
|
||||
STYLESHEET_BASE, c->width, c->height,
|
||||
0, 0, false);
|
||||
|
||||
if (option_block_ads) {
|
||||
c->data.html.stylesheet_content[STYLESHEET_ADBLOCK] =
|
||||
fetchcache(adblock_stylesheet_url,
|
||||
html_convert_css_callback, c,
|
||||
(void *) STYLESHEET_ADBLOCK, c->width,
|
||||
html_convert_css_callback, (intptr_t) c,
|
||||
STYLESHEET_ADBLOCK, c->width,
|
||||
c->height, true, 0, 0, false, false);
|
||||
if (!c->data.html.stylesheet_content[STYLESHEET_ADBLOCK])
|
||||
return false;
|
||||
c->active++;
|
||||
fetchcache_go(c->data.html.
|
||||
stylesheet_content[STYLESHEET_ADBLOCK],
|
||||
0, html_convert_css_callback, c,
|
||||
(void *) STYLESHEET_ADBLOCK, c->width,
|
||||
0, html_convert_css_callback, (intptr_t) c,
|
||||
STYLESHEET_ADBLOCK, c->width,
|
||||
c->height, 0, 0, false);
|
||||
}
|
||||
|
||||
@ -526,7 +527,7 @@ bool html_find_stylesheets(struct content *c, xmlNode *head)
|
||||
c->data.html.stylesheet_content = stylesheet_content;
|
||||
c->data.html.stylesheet_content[i] = fetchcache(url,
|
||||
html_convert_css_callback,
|
||||
c, (void *) i, c->width, c->height,
|
||||
(intptr_t) c, i, c->width, c->height,
|
||||
true, 0, 0, false, false);
|
||||
if (!c->data.html.stylesheet_content[i])
|
||||
return false;
|
||||
@ -534,7 +535,7 @@ bool html_find_stylesheets(struct content *c, xmlNode *head)
|
||||
fetchcache_go(c->data.html.stylesheet_content[i],
|
||||
c->url,
|
||||
html_convert_css_callback,
|
||||
c, (void *) i, c->width, c->height,
|
||||
(intptr_t) c, i, c->width, c->height,
|
||||
0, 0, false);
|
||||
free(url);
|
||||
i++;
|
||||
@ -601,7 +602,7 @@ bool html_find_stylesheets(struct content *c, xmlNode *head)
|
||||
c->height)) {
|
||||
if (!content_add_user(c->data.html.stylesheet_content[STYLESHEET_STYLE],
|
||||
html_convert_css_callback,
|
||||
c, (void *) STYLESHEET_STYLE)) {
|
||||
(intptr_t) c, STYLESHEET_STYLE)) {
|
||||
/* no memory */
|
||||
c->data.html.stylesheet_content[STYLESHEET_STYLE] = 0;
|
||||
return false;
|
||||
@ -657,10 +658,10 @@ bool html_find_stylesheets(struct content *c, xmlNode *head)
|
||||
*/
|
||||
|
||||
void html_convert_css_callback(content_msg msg, struct content *css,
|
||||
void *p1, void *p2, union content_msg_data data)
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data)
|
||||
{
|
||||
struct content *c = p1;
|
||||
unsigned int i = (unsigned int) p2;
|
||||
struct content *c = (struct content *) p1;
|
||||
unsigned int i = p2;
|
||||
|
||||
switch (msg) {
|
||||
case CONTENT_MSG_LOADING:
|
||||
@ -671,7 +672,9 @@ void html_convert_css_callback(content_msg msg, struct content *css,
|
||||
content_add_error(c, "NotCSS", 0);
|
||||
content_set_status(c, messages_get("NotCSS"));
|
||||
content_broadcast(c, CONTENT_MSG_STATUS, data);
|
||||
content_remove_user(css, html_convert_css_callback, c, (void*)i);
|
||||
content_remove_user(css,
|
||||
html_convert_css_callback,
|
||||
(intptr_t) c, i);
|
||||
if (!css->user_list) {
|
||||
/* we were the only user and we
|
||||
* don't want this content, so
|
||||
@ -711,14 +714,14 @@ void html_convert_css_callback(content_msg msg, struct content *css,
|
||||
c->data.html.stylesheet_content[i] = fetchcache(
|
||||
data.redirect,
|
||||
html_convert_css_callback,
|
||||
c, (void *) i, css->width, css->height,
|
||||
(intptr_t) c, i, css->width, css->height,
|
||||
true, 0, 0, false, false);
|
||||
if (c->data.html.stylesheet_content[i]) {
|
||||
c->active++;
|
||||
fetchcache_go(c->data.html.stylesheet_content[i],
|
||||
c->url,
|
||||
html_convert_css_callback,
|
||||
c, (void *) i, css->width,
|
||||
(intptr_t) c, i, css->width,
|
||||
css->height, 0, 0, false);
|
||||
}
|
||||
break;
|
||||
@ -767,7 +770,7 @@ bool html_fetch_object(struct content *c, char *url, struct box *box,
|
||||
|
||||
/* initialise fetch */
|
||||
c_fetch = fetchcache(url, html_object_callback,
|
||||
c, (void *) i, available_width, available_height,
|
||||
(intptr_t) c, i, available_width, available_height,
|
||||
true, 0, 0, false, false);
|
||||
if (!c_fetch)
|
||||
return false;
|
||||
@ -776,13 +779,15 @@ bool html_fetch_object(struct content *c, char *url, struct box *box,
|
||||
object = talloc_realloc(c, c->data.html.object,
|
||||
struct content_html_object, i + 1);
|
||||
if (!object) {
|
||||
content_remove_user(c_fetch, html_object_callback, c, (void*)i);
|
||||
content_remove_user(c_fetch, html_object_callback,
|
||||
(intptr_t) c, i);
|
||||
return false;
|
||||
}
|
||||
c->data.html.object = object;
|
||||
c->data.html.object[i].url = talloc_strdup(c, url);
|
||||
if (!c->data.html.object[i].url) {
|
||||
content_remove_user(c_fetch, html_object_callback, c, (void*)i);
|
||||
content_remove_user(c_fetch, html_object_callback,
|
||||
(intptr_t) c, i);
|
||||
return false;
|
||||
}
|
||||
c->data.html.object[i].box = box;
|
||||
@ -797,7 +802,7 @@ bool html_fetch_object(struct content *c, char *url, struct box *box,
|
||||
|
||||
/* start fetch */
|
||||
fetchcache_go(c_fetch, c->url,
|
||||
html_object_callback, c, (void *) i,
|
||||
html_object_callback, (intptr_t) c, i,
|
||||
available_width, available_height,
|
||||
0, 0, false);
|
||||
|
||||
@ -810,10 +815,10 @@ bool html_fetch_object(struct content *c, char *url, struct box *box,
|
||||
*/
|
||||
|
||||
void html_object_callback(content_msg msg, struct content *object,
|
||||
void *p1, void *p2, union content_msg_data data)
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data)
|
||||
{
|
||||
struct content *c = p1;
|
||||
unsigned int i = (unsigned int) p2;
|
||||
struct content *c = (struct content *) p1;
|
||||
unsigned int i = p2;
|
||||
int x, y;
|
||||
struct box *box = c->data.html.object[i].box;
|
||||
|
||||
@ -836,8 +841,8 @@ void html_object_callback(content_msg msg, struct content *object,
|
||||
content_add_error(c, "?", 0);
|
||||
content_set_status(c, messages_get("BadObject"));
|
||||
content_broadcast(c, CONTENT_MSG_STATUS, data);
|
||||
content_remove_user(object, html_object_callback, c,
|
||||
(void *) i);
|
||||
content_remove_user(object, html_object_callback,
|
||||
(intptr_t) c, i);
|
||||
html_object_failed(box, c,
|
||||
c->data.html.object[i].background);
|
||||
break;
|
||||
@ -888,7 +893,7 @@ void html_object_callback(content_msg msg, struct content *object,
|
||||
c->data.html.object[i].content = fetchcache(
|
||||
data.redirect,
|
||||
html_object_callback,
|
||||
c, (void * ) i, 0, 0, true,
|
||||
(intptr_t) c, i, 0, 0, true,
|
||||
0, 0, false, false);
|
||||
if (!c->data.html.object[i].content) {
|
||||
/** \todo report oom */
|
||||
@ -898,7 +903,7 @@ void html_object_callback(content_msg msg, struct content *object,
|
||||
content,
|
||||
c->url,
|
||||
html_object_callback,
|
||||
c, (void * ) i,
|
||||
(intptr_t) c, i,
|
||||
0, 0,
|
||||
0, 0, false);
|
||||
}
|
||||
@ -1129,10 +1134,10 @@ void html_stop(struct content *c)
|
||||
; /* already loaded: do nothing */
|
||||
else if (object->status == CONTENT_STATUS_READY)
|
||||
content_stop(object, html_object_callback,
|
||||
c, (void *) i);
|
||||
(intptr_t) c, i);
|
||||
else {
|
||||
content_remove_user(c->data.html.object[i].content,
|
||||
html_object_callback, c, (void *) i);
|
||||
html_object_callback, (intptr_t) c, i);
|
||||
c->data.html.object[i].content = 0;
|
||||
}
|
||||
}
|
||||
@ -1178,7 +1183,7 @@ void html_destroy(struct content *c)
|
||||
content_remove_user(c->data.html.
|
||||
stylesheet_content[i],
|
||||
html_convert_css_callback,
|
||||
c, (void *) i);
|
||||
(intptr_t) c, i);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1192,7 +1197,7 @@ void html_destroy(struct content *c)
|
||||
LOG(("object %i %p", i, c->data.html.object[i].content));
|
||||
if (c->data.html.object[i].content)
|
||||
content_remove_user(c->data.html.object[i].content,
|
||||
html_object_callback, c, (void*)i);
|
||||
html_object_callback, (intptr_t) c, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user