summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/content.c29
-rw-r--r--content/fetch.c15
-rw-r--r--content/fetchers/curl.c80
-rw-r--r--content/fetchers/data.c17
-rw-r--r--content/fetchers/resource.c6
-rw-r--r--content/fs_backing_store.c225
-rw-r--r--content/handlers/css/css.c15
-rw-r--r--content/handlers/css/hints.c2
-rw-r--r--content/handlers/css/select.c17
-rw-r--r--content/handlers/image/ico.c8
-rw-r--r--content/handlers/image/image_cache.c110
-rw-r--r--content/handlers/image/jpeg.c4
-rw-r--r--content/handlers/image/nssprite.c4
-rw-r--r--content/handlers/image/png.c15
-rw-r--r--content/handlers/image/rsvg.c17
-rw-r--r--content/handlers/javascript/duktape/dukky.c131
-rw-r--r--content/hlcache.c19
-rw-r--r--content/llcache.c45
-rw-r--r--content/urldb.c60
19 files changed, 483 insertions, 336 deletions
diff --git a/content/content.c b/content/content.c
index 45a4016f0..8ed5c1ba8 100644
--- a/content/content.c
+++ b/content/content.c
@@ -73,7 +73,8 @@ nserror content__init(struct content *c, const content_handler *handler,
struct content_user *user_sentinel;
nserror error;
- LOG("url "URL_FMT_SPC" -> %p", nsurl_access(llcache_handle_get_url(llcache)), c);
+ NSLOG(netsurf, INFO, "url "URL_FMT_SPC" -> %p",
+ nsurl_access(llcache_handle_get_url(llcache)), c);
user_sentinel = calloc(1, sizeof(struct content_user));
if (user_sentinel == NULL) {
@@ -272,7 +273,8 @@ void content_convert(struct content *c)
if (c->locked == true)
return;
- LOG("content "URL_FMT_SPC" (%p)", nsurl_access(llcache_handle_get_url(c->llcache)), c);
+ NSLOG(netsurf, INFO, "content "URL_FMT_SPC" (%p)",
+ nsurl_access(llcache_handle_get_url(c->llcache)), c);
if (c->handler->data_complete != NULL) {
c->locked = true;
@@ -376,7 +378,8 @@ void content_destroy(struct content *c)
struct content_rfc5988_link *link;
assert(c);
- LOG("content %p %s", c, nsurl_access(llcache_handle_get_url(c->llcache)));
+ NSLOG(netsurf, INFO, "content %p %s", c,
+ nsurl_access(llcache_handle_get_url(c->llcache)));
assert(c->locked == false);
if (c->handler->destroy != NULL)
@@ -585,7 +588,7 @@ bool content_scaled_redraw(struct hlcache_handle *h,
return true;
}
- LOG("Content %p %dx%d ctx:%p", c, width, height, ctx);
+ NSLOG(netsurf, INFO, "Content %p %dx%d ctx:%p", c, width, height, ctx);
if (ctx->plot->option_knockout) {
knockout_plot_start(ctx, &new_ctx);
@@ -654,7 +657,9 @@ bool content_add_user(
{
struct content_user *user;
- LOG("content "URL_FMT_SPC" (%p), user %p %p", nsurl_access(llcache_handle_get_url(c->llcache)), c, callback, pw);
+ NSLOG(netsurf, INFO, "content "URL_FMT_SPC" (%p), user %p %p",
+ nsurl_access(llcache_handle_get_url(c->llcache)), c, callback,
+ pw);
user = malloc(sizeof(struct content_user));
if (!user)
return false;
@@ -687,7 +692,9 @@ void content_remove_user(
void *pw)
{
struct content_user *user, *next;
- LOG("content "URL_FMT_SPC" (%p), user %p %p", nsurl_access(llcache_handle_get_url(c->llcache)), c, callback, pw);
+ NSLOG(netsurf, INFO, "content "URL_FMT_SPC" (%p), user %p %p",
+ nsurl_access(llcache_handle_get_url(c->llcache)), c, callback,
+ pw);
/* user_list starts with a sentinel */
for (user = c->user_list; user->next != 0 &&
@@ -695,7 +702,7 @@ void content_remove_user(
user->next->pw == pw); user = user->next)
;
if (user->next == 0) {
- LOG("user not found in list");
+ NSLOG(netsurf, INFO, "user not found in list");
assert(0);
return;
}
@@ -808,7 +815,8 @@ void content_open(hlcache_handle *h, struct browser_window *bw,
{
struct content *c = hlcache_handle_get_content(h);
assert(c != 0);
- LOG("content %p %s", c, nsurl_access(llcache_handle_get_url(c->llcache)));
+ NSLOG(netsurf, INFO, "content %p %s", c,
+ nsurl_access(llcache_handle_get_url(c->llcache)));
if (c->handler->open != NULL)
c->handler->open(c, bw, page, params);
}
@@ -824,7 +832,8 @@ void content_close(hlcache_handle *h)
{
struct content *c = hlcache_handle_get_content(h);
assert(c != 0);
- LOG("content %p %s", c, nsurl_access(llcache_handle_get_url(c->llcache)));
+ NSLOG(netsurf, INFO, "content %p %s", c,
+ nsurl_access(llcache_handle_get_url(c->llcache)));
if (c->handler->close != NULL)
c->handler->close(c);
}
@@ -1472,7 +1481,7 @@ nserror content__clone(const struct content *c, struct content *nc)
*/
nserror content_abort(struct content *c)
{
- LOG("Aborting %p", c);
+ NSLOG(netsurf, INFO, "Aborting %p", c);
if (c->handler->stop != NULL)
c->handler->stop(c);
diff --git a/content/fetch.c b/content/fetch.c
index a69d3e4cf..fc72d13f9 100644
--- a/content/fetch.c
+++ b/content/fetch.c
@@ -217,14 +217,16 @@ static void dump_rings(void)
q = queue_ring;
if (q) {
do {
- LOG("queue_ring: %s", nsurl_access(q->url));
+ NSLOG(netsurf, INFO, "queue_ring: %s",
+ nsurl_access(q->url));
q = q->r_next;
} while (q != queue_ring);
}
f = fetch_ring;
if (f) {
do {
- LOG("fetch_ring: %s", nsurl_access(f->url));
+ NSLOG(netsurf, INFO, "fetch_ring: %s",
+ nsurl_access(f->url));
f = f->r_next;
} while (f != fetch_ring);
}
@@ -341,7 +343,10 @@ void fetcher_quit(void)
* the reference count to allow the fetcher to
* be stopped.
*/
- LOG("Fetcher for scheme %s still has %d active users at quit.", lwc_string_data(fetchers[fetcherd].scheme), fetchers[fetcherd].refcount);
+ NSLOG(netsurf, INFO,
+ "Fetcher for scheme %s still has %d active users at quit.",
+ lwc_string_data(fetchers[fetcherd].scheme),
+ fetchers[fetcherd].refcount);
fetchers[fetcherd].refcount = 1;
}
@@ -753,9 +758,9 @@ void fetch_remove_from_queues(struct fetch *fetch)
RING_GETSIZE(struct fetch, fetch_ring, all_active);
RING_GETSIZE(struct fetch, queue_ring, all_queued);
- LOG("Fetch ring is now %d elements.", all_active);
+ NSLOG(netsurf, INFO, "Fetch ring is now %d elements.", all_active);
- LOG("Queue ring is now %d elements.", all_queued);
+ NSLOG(netsurf, INFO, "Queue ring is now %d elements.", all_queued);
#endif
}
diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c
index 7d0e40c24..a6146edb3 100644
--- a/content/fetchers/curl.c
+++ b/content/fetchers/curl.c
@@ -155,7 +155,8 @@ static void ns_X509_free(X509 *cert)
*/
static bool fetch_curl_initialise(lwc_string *scheme)
{
- LOG("Initialise cURL fetcher for %s", lwc_string_data(scheme));
+ NSLOG(netsurf, INFO, "Initialise cURL fetcher for %s",
+ lwc_string_data(scheme));
curl_fetchers_registered++;
return true; /* Always succeeds */
}
@@ -171,17 +172,20 @@ static void fetch_curl_finalise(lwc_string *scheme)
struct cache_handle *h;
curl_fetchers_registered--;
- LOG("Finalise cURL fetcher %s", lwc_string_data(scheme));
+ NSLOG(netsurf, INFO, "Finalise cURL fetcher %s",
+ lwc_string_data(scheme));
if (curl_fetchers_registered == 0) {
CURLMcode codem;
/* All the fetchers have been finalised. */
- LOG("All cURL fetchers finalised, closing down cURL");
+ NSLOG(netsurf, INFO,
+ "All cURL fetchers finalised, closing down cURL");
curl_easy_cleanup(fetch_blank_curl);
codem = curl_multi_cleanup(fetch_curl_multi);
if (codem != CURLM_OK)
- LOG("curl_multi_cleanup failed: ignoring");
+ NSLOG(netsurf, INFO,
+ "curl_multi_cleanup failed: ignoring");
curl_global_cleanup();
}
@@ -251,7 +255,9 @@ fetch_curl_post_convert(const struct fetch_multipart_data *control)
"application/octet-stream",
CURLFORM_END);
if (code != CURL_FORMADD_OK)
- LOG("curl_formadd: %d (%s)", code, control->name);
+ NSLOG(netsurf, INFO,
+ "curl_formadd: %d (%s)", code,
+ control->name);
} else {
char *mimetype = guit->fetch->mimetype(control->value);
code = curl_formadd(&post, &last,
@@ -262,7 +268,11 @@ fetch_curl_post_convert(const struct fetch_multipart_data *control)
(mimetype != 0 ? mimetype : "text/plain"),
CURLFORM_END);
if (code != CURL_FORMADD_OK)
- LOG("curl_formadd: %d (%s=%s)", code, control->name, control->value);
+ NSLOG(netsurf, INFO,
+ "curl_formadd: %d (%s=%s)",
+ code,
+ control->name,
+ control->value);
free(mimetype);
}
free(leafname);
@@ -273,7 +283,9 @@ fetch_curl_post_convert(const struct fetch_multipart_data *control)
CURLFORM_COPYCONTENTS, control->value,
CURLFORM_END);
if (code != CURL_FORMADD_OK)
- LOG("curl_formadd: %d (%s=%s)", code, control->name, control->value);
+ NSLOG(netsurf, INFO,
+ "curl_formadd: %d (%s=%s)", code,
+ control->name, control->value);
}
}
@@ -321,7 +333,7 @@ fetch_curl_setup(struct fetch *parent_fetch,
fetch->fetch_handle = parent_fetch;
- LOG("fetch %p, url '%s'", fetch, nsurl_access(url));
+ NSLOG(netsurf, INFO, "fetch %p, url '%s'", fetch, nsurl_access(url));
/* construct a new fetch structure */
fetch->curl_handle = NULL;
@@ -776,7 +788,7 @@ static void fetch_curl_abort(void *vf)
{
struct curl_fetch_info *f = (struct curl_fetch_info *)vf;
assert(f);
- LOG("fetch %p, url '%s'", f, nsurl_access(f->url));
+ NSLOG(netsurf, INFO, "fetch %p, url '%s'", f, nsurl_access(f->url));
if (f->curl_handle) {
f->abort = true;
} else {
@@ -796,7 +808,7 @@ static void fetch_curl_stop(struct curl_fetch_info *f)
CURLMcode codem;
assert(f);
- LOG("fetch %p, url '%s'", f, nsurl_access(f->url));
+ NSLOG(netsurf, INFO, "fetch %p, url '%s'", f, nsurl_access(f->url));
if (f->curl_handle) {
/* remove from curl multi handle */
@@ -864,7 +876,7 @@ static bool fetch_curl_process_headers(struct curl_fetch_info *f)
assert(code == CURLE_OK);
}
http_code = f->http_code;
- LOG("HTTP status code %li", http_code);
+ NSLOG(netsurf, INFO, "HTTP status code %li", http_code);
if (http_code == 304 && !f->post_urlenc && !f->post_multipart) {
/* Not Modified && GET request */
@@ -875,7 +887,7 @@ static bool fetch_curl_process_headers(struct curl_fetch_info *f)
/* handle HTTP redirects (3xx response codes) */
if (300 <= http_code && http_code < 400 && f->location != 0) {
- LOG("FETCH_REDIRECT, '%s'", f->location);
+ NSLOG(netsurf, INFO, "FETCH_REDIRECT, '%s'", f->location);
msg.type = FETCH_REDIRECT;
msg.data.redirect = f->location;
fetch_send_callback(&msg, f->fetch_handle);
@@ -1037,7 +1049,7 @@ static void fetch_curl_done(CURL *curl_handle, CURLcode result)
assert(code == CURLE_OK);
abort_fetch = f->abort;
- LOG("done %s", nsurl_access(f->url));
+ NSLOG(netsurf, INFO, "done %s", nsurl_access(f->url));
if ((abort_fetch == false) &&
(result == CURLE_OK ||
@@ -1082,7 +1094,7 @@ static void fetch_curl_done(CURL *curl_handle, CURLcode result)
memset(f->cert_data, 0, sizeof(f->cert_data));
cert = true;
} else {
- LOG("Unknown cURL response code %d", result);
+ NSLOG(netsurf, INFO, "Unknown cURL response code %d", result);
error = true;
}
@@ -1146,7 +1158,8 @@ static void fetch_curl_poll(lwc_string *scheme_ignored)
&exc_fd_set, &max_fd);
assert(codem == CURLM_OK);
- LOG("Curl file descriptor states (maxfd=%i):", max_fd);
+ NSLOG(netsurf, INFO,
+ "Curl file descriptor states (maxfd=%i):", max_fd);
for (i = 0; i <= max_fd; i++) {
bool read = false;
bool write = false;
@@ -1162,10 +1175,10 @@ static void fetch_curl_poll(lwc_string *scheme_ignored)
error = true;
}
if (read || write || error) {
- LOG(" fd %i: %s %s %s", i,
- read ? "read" : " ",
- write ? "write" : " ",
- error ? "error" : " ");
+ NSLOG(netsurf, INFO, " fd %i: %s %s %s", i,
+ read ? "read" : " ",
+ write ? "write" : " ",
+ error ? "error" : " ");
}
}
}
@@ -1174,7 +1187,8 @@ static void fetch_curl_poll(lwc_string *scheme_ignored)
do {
codem = curl_multi_perform(fetch_curl_multi, &running);
if (codem != CURLM_OK && codem != CURLM_CALL_MULTI_PERFORM) {
- LOG("curl_multi_perform: %i %s", codem, curl_multi_strerror(codem));
+ NSLOG(netsurf, INFO, "curl_multi_perform: %i %s",
+ codem, curl_multi_strerror(codem));
guit->misc->warning("MiscError", curl_multi_strerror(codem));
return;
}
@@ -1336,7 +1350,7 @@ fetch_curl_header(char *data, size_t size, size_t nmemb, void *_f)
free(f->location);
f->location = malloc(size);
if (!f->location) {
- LOG("malloc failed");
+ NSLOG(netsurf, INFO, "malloc failed");
return size;
}
SKIP_ST(9);
@@ -1427,17 +1441,17 @@ nserror fetch_curl_register(void)
.finalise = fetch_curl_finalise
};
- LOG("curl_version %s", curl_version());
+ NSLOG(netsurf, INFO, "curl_version %s", curl_version());
code = curl_global_init(CURL_GLOBAL_ALL);
if (code != CURLE_OK) {
- LOG("curl_global_init failed.");
+ NSLOG(netsurf, INFO, "curl_global_init failed.");
return NSERROR_INIT_FAILED;
}
fetch_curl_multi = curl_multi_init();
if (!fetch_curl_multi) {
- LOG("curl_multi_init failed.");
+ NSLOG(netsurf, INFO, "curl_multi_init failed.");
return NSERROR_INIT_FAILED;
}
@@ -1465,7 +1479,7 @@ nserror fetch_curl_register(void)
*/
fetch_blank_curl = curl_easy_init();
if (!fetch_blank_curl) {
- LOG("curl_easy_init failed");
+ NSLOG(netsurf, INFO, "curl_easy_init failed");
return NSERROR_INIT_FAILED;
}
@@ -1497,11 +1511,12 @@ nserror fetch_curl_register(void)
if (nsoption_charp(ca_bundle) &&
strcmp(nsoption_charp(ca_bundle), "")) {
- LOG("ca_bundle: '%s'", nsoption_charp(ca_bundle));
+ NSLOG(netsurf, INFO, "ca_bundle: '%s'",
+ nsoption_charp(ca_bundle));
SETOPT(CURLOPT_CAINFO, nsoption_charp(ca_bundle));
}
if (nsoption_charp(ca_path) && strcmp(nsoption_charp(ca_path), "")) {
- LOG("ca_path: '%s'", nsoption_charp(ca_path));
+ NSLOG(netsurf, INFO, "ca_path: '%s'", nsoption_charp(ca_path));
SETOPT(CURLOPT_CAPATH, nsoption_charp(ca_path));
}
@@ -1513,7 +1528,8 @@ nserror fetch_curl_register(void)
curl_with_openssl = false;
}
- LOG("cURL %slinked against openssl", curl_with_openssl ? "" : "not ");
+ NSLOG(netsurf, INFO, "cURL %slinked against openssl",
+ curl_with_openssl ? "" : "not ");
/* cURL initialised okay, register the fetchers */
@@ -1532,19 +1548,21 @@ nserror fetch_curl_register(void)
}
if (fetcher_add(scheme, &fetcher_ops) != NSERROR_OK) {
- LOG("Unable to register cURL fetcher for %s", data->protocols[i]);
+ NSLOG(netsurf, INFO,
+ "Unable to register cURL fetcher for %s",
+ data->protocols[i]);
}
}
return NSERROR_OK;
curl_easy_setopt_failed:
- LOG("curl_easy_setopt failed.");
+ NSLOG(netsurf, INFO, "curl_easy_setopt failed.");
return NSERROR_INIT_FAILED;
#if LIBCURL_VERSION_NUM >= 0x071e00
curl_multi_setopt_failed:
- LOG("curl_multi_setopt failed.");
+ NSLOG(netsurf, INFO, "curl_multi_setopt failed.");
return NSERROR_INIT_FAILED;
#endif
}
diff --git a/content/fetchers/data.c b/content/fetchers/data.c
index cb99e6ff2..5ba021fd3 100644
--- a/content/fetchers/data.c
+++ b/content/fetchers/data.c
@@ -57,14 +57,16 @@ static struct fetch_data_context *ring = NULL;
static bool fetch_data_initialise(lwc_string *scheme)
{
- LOG("fetch_data_initialise called for %s", lwc_string_data(scheme));
+ NSLOG(netsurf, INFO, "fetch_data_initialise called for %s",
+ lwc_string_data(scheme));
return true;
}
static void fetch_data_finalise(lwc_string *scheme)
{
- LOG("fetch_data_finalise called for %s", lwc_string_data(scheme));
+ NSLOG(netsurf, INFO, "fetch_data_finalise called for %s",
+ lwc_string_data(scheme));
}
static bool fetch_data_can_fetch(const nsurl *url)
@@ -147,7 +149,7 @@ static bool fetch_data_process(struct fetch_data_context *c)
* data must still be there.
*/
- LOG("url: %.140s", c->url);
+ NSLOG(netsurf, INFO, "url: %.140s", c->url);
if (strlen(c->url) < 6) {
/* 6 is the minimum possible length (data:,) */
@@ -259,8 +261,10 @@ static void fetch_data_poll(lwc_string *scheme)
char header[64];
fetch_set_http_code(c->parent_fetch, 200);
- LOG("setting data: MIME type to %s, length to %" PRIsizet,
- c->mimetype, c->datalen);
+ NSLOG(netsurf, INFO,
+ "setting data: MIME type to %s, length to %"PRIsizet,
+ c->mimetype,
+ c->datalen);
/* Any callback can result in the fetch being aborted.
* Therefore, we _must_ check for this after _every_
* call to fetch_data_send_callback().
@@ -296,7 +300,8 @@ static void fetch_data_poll(lwc_string *scheme)
fetch_data_send_callback(&msg, c);
}
} else {
- LOG("Processing of %s failed!", c->url);
+ NSLOG(netsurf, INFO, "Processing of %s failed!",
+ c->url);
/* Ensure that we're unlocked here. If we aren't,
* then fetch_data_process() is broken.
diff --git a/content/fetchers/resource.c b/content/fetchers/resource.c
index b8b4b191f..78757733e 100644
--- a/content/fetchers/resource.c
+++ b/content/fetchers/resource.c
@@ -276,14 +276,16 @@ static bool fetch_resource_initialise(lwc_string *scheme)
&e->data,
&e->data_len);
if (res == NSERROR_OK) {
- LOG("direct data for %s", fetch_resource_paths[i]);
+ NSLOG(netsurf, INFO, "direct data for %s",
+ fetch_resource_paths[i]);
fetch_resource_path_count++;
} else {
e->redirect_url = guit->fetch->get_resource_url(fetch_resource_paths[i]);
if (e->redirect_url == NULL) {
lwc_string_unref(e->path);
} else {
- LOG("redirect url for %s", fetch_resource_paths[i]);
+ NSLOG(netsurf, INFO, "redirect url for %s",
+ fetch_resource_paths[i]);
fetch_resource_path_count++;
}
}
diff --git a/content/fs_backing_store.c b/content/fs_backing_store.c
index 9d410654b..648565088 100644
--- a/content/fs_backing_store.c
+++ b/content/fs_backing_store.c
@@ -519,11 +519,12 @@ invalidate_entry(struct store_state *state, struct store_entry *bse)
* This entry cannot be immediately removed as it has
* associated allocation so wait for allocation release.
*/
- LOG("invalidating entry with referenced allocation");
+ NSLOG(netsurf, INFO,
+ "invalidating entry with referenced allocation");
return NSERROR_OK;
}
- LOG("Removing entry for %p", bse);
+ NSLOG(netsurf, INFO, "Removing entry for %p", bse);
/* remove the entry from the index */
ret = remove_store_entry(state, &bse);
@@ -533,12 +534,12 @@ invalidate_entry(struct store_state *state, struct store_entry *bse)
ret = invalidate_element(state, bse, ENTRY_ELEM_META);
if (ret != NSERROR_OK) {
- LOG("Error invalidating metadata element");
+ NSLOG(netsurf, INFO, "Error invalidating metadata element");
}
ret = invalidate_element(state, bse, ENTRY_ELEM_DATA);
if (ret != NSERROR_OK) {
- LOG("Error invalidating data element");
+ NSLOG(netsurf, INFO, "Error invalidating data element");
}
return NSERROR_OK;
@@ -620,8 +621,10 @@ static nserror store_evict(struct store_state *state)
return NSERROR_OK;
}
- LOG("Evicting entries to reduce %"PRIu64" by %"PRIsizet,
- state->total_alloc, state->hysteresis);
+ NSLOG(netsurf, INFO,
+ "Evicting entries to reduce %"PRIu64" by %"PRIsizet,
+ state->total_alloc,
+ state->hysteresis);
/* allocate storage for the list */
elist = malloc(sizeof(entry_ident_t) * state->last_entry);
@@ -658,7 +661,8 @@ static nserror store_evict(struct store_state *state)
free(elist);
- LOG("removed %"PRIsizet" in %d entries", removed, ent);
+ NSLOG(netsurf, INFO, "removed %"PRIsizet" in %d entries", removed,
+ ent);
return ret;
}
@@ -773,7 +777,10 @@ static nserror write_blocks(struct store_state *state)
&state->blocks[elem_idx][bfidx].use_map[0],
BLOCK_USE_MAP_SIZE);
if (wr != BLOCK_USE_MAP_SIZE) {
- LOG("writing block file %d use index on file number %d failed", elem_idx, bfidx);
+ NSLOG(netsurf, INFO,
+ "writing block file %d use index on file number %d failed",
+ elem_idx,
+ bfidx);
goto wr_err;
}
written += wr;
@@ -829,19 +836,21 @@ static nserror set_block_extents(struct store_state *state)
return NSERROR_OK;
}
- LOG("Starting");
+ NSLOG(netsurf, INFO, "Starting");
for (elem_idx = 0; elem_idx < ENTRY_ELEM_COUNT; elem_idx++) {
for (bfidx = 0; bfidx < BLOCK_FILE_COUNT; bfidx++) {
if (state->blocks[elem_idx][bfidx].fd != -1) {
/* ensure block file is correct extent */
ftr = ftruncate(state->blocks[elem_idx][bfidx].fd, 1U << (log2_block_size[elem_idx] + BLOCK_ENTRY_COUNT));
if (ftr == -1) {
- LOG("Truncate failed errno:%d", errno);
+ NSLOG(netsurf, INFO,
+ "Truncate failed errno:%d",
+ errno);
}
}
}
}
- LOG("Complete");
+ NSLOG(netsurf, INFO, "Complete");
state->blocks_opened = false;
@@ -886,7 +895,7 @@ get_store_entry(struct store_state *state, nsurl *url, struct store_entry **bse)
entry_ident_t ident;
unsigned int sei; /* store entry index */
- LOG("url:%s", nsurl_access(url));
+ NSLOG(netsurf, INFO, "url:%s", nsurl_access(url));
/* use the url hash as the entry identifier */
ident = nsurl_hash(url);
@@ -894,13 +903,14 @@ get_store_entry(struct store_state *state, nsurl *url, struct store_entry **bse)
sei = BS_ENTRY_INDEX(ident, state);
if (sei == 0) {
- LOG("Failed to find ident 0x%x in index", ident);
+ NSLOG(netsurf, INFO, "Failed to find ident 0x%x in index",
+ ident);
return NSERROR_NOT_FOUND;
}
if (state->entries[sei].ident != ident) {
/* entry ident did not match */
- LOG("ident did not match entry");
+ NSLOG(netsurf, INFO, "ident did not match entry");
return NSERROR_NOT_FOUND;
}
@@ -975,7 +985,7 @@ set_store_entry(struct store_state *state,
nserror ret;
struct store_entry_element *elem;
- LOG("url:%s", nsurl_access(url));
+ NSLOG(netsurf, INFO, "url:%s", nsurl_access(url));
/* evict entries as required and ensure there is at least one
* new entry available.
@@ -1013,7 +1023,10 @@ set_store_entry(struct store_state *state,
* to see if the old entry is in use and if
* not prefer the newly stored entry instead?
*/
- LOG("Entry index collision trying to replace %x with %x", se->ident, ident);
+ NSLOG(netsurf, INFO,
+ "Entry index collision trying to replace %x with %x",
+ se->ident,
+ ident);
return NSERROR_PERMISSION;
}
}
@@ -1026,7 +1039,8 @@ set_store_entry(struct store_state *state,
/* this entry cannot be removed as it has associated
* allocation.
*/
- LOG("attempt to overwrite entry with in use data");
+ NSLOG(netsurf, INFO,
+ "attempt to overwrite entry with in use data");
return NSERROR_PERMISSION;
}
@@ -1085,7 +1099,7 @@ store_open(struct store_state *state,
fname = store_fname(state, ident, elem_idx);
if (fname == NULL) {
- LOG("filename error");
+ NSLOG(netsurf, INFO, "filename error");
return -1;
}
@@ -1093,13 +1107,14 @@ store_open(struct store_state *state,
if (openflags & O_CREAT) {
ret = netsurf_mkdir_all(fname);
if (ret != NSERROR_OK) {
- LOG("file path \"%s\" could not be created", fname);
+ NSLOG(netsurf, INFO,
+ "file path \"%s\" could not be created", fname);
free(fname);
return -1;
}
}
- LOG("opening %s", fname);
+ NSLOG(netsurf, INFO, "opening %s", fname);
fd = open(fname, openflags, S_IRUSR | S_IWUSR);
free(fname);
@@ -1126,9 +1141,9 @@ build_entrymap(struct store_state *state)
{
unsigned int eloop;
- LOG("Allocating %ld bytes for max of %d buckets",
- (1 << state->ident_bits) * sizeof(entry_index_t),
- 1 << state->ident_bits);
+ NSLOG(netsurf, INFO, "Allocating %ld bytes for max of %d buckets",
+ (1 << state->ident_bits) * sizeof(entry_index_t),
+ 1 << state->ident_bits);
state->addrmap = calloc(1 << state->ident_bits, sizeof(entry_index_t));
if (state->addrmap == NULL) {
@@ -1204,10 +1219,12 @@ read_entries(struct store_state *state)
entries_size = (1 << state->entry_bits) * sizeof(struct store_entry);
- LOG("Allocating %"PRIsizet" bytes for max of %d entries of %ld length elements %ld length",
- entries_size, 1 << state->entry_bits,
- sizeof(struct store_entry),
- sizeof(struct store_entry_element));
+ NSLOG(netsurf, INFO,
+ "Allocating %"PRIsizet" bytes for max of %d entries of %ld length elements %ld length",
+ entries_size,
+ 1 << state->entry_bits,
+ sizeof(struct store_entry),
+ sizeof(struct store_entry_element));
state->entries = calloc(1, entries_size);
if (state->entries == NULL) {
@@ -1222,7 +1239,8 @@ read_entries(struct store_state *state)
close(fd);
if (rd > 0) {
state->last_entry = rd / sizeof(struct store_entry);
- LOG("Read %d entries", state->last_entry);
+ NSLOG(netsurf, INFO, "Read %d entries",
+ state->last_entry);
}
} else {
/* could rebuild entries from fs */
@@ -1253,7 +1271,7 @@ read_blocks(struct store_state *state)
return ret;
}
- LOG("Initialising block use map from %s", fname);
+ NSLOG(netsurf, INFO, "Initialising block use map from %s", fname);
fd = open(fname, O_RDWR);
free(fname);
@@ -1265,7 +1283,10 @@ read_blocks(struct store_state *state)
&state->blocks[elem_idx][bfidx].use_map[0],
BLOCK_USE_MAP_SIZE);
if (rd <= 0) {
- LOG("reading block file %d use index on file number %d failed", elem_idx, bfidx);
+ NSLOG(netsurf, INFO,
+ "reading block file %d use index on file number %d failed",
+ elem_idx,
+ bfidx);
goto rd_err;
}
}
@@ -1274,7 +1295,7 @@ read_blocks(struct store_state *state)
close(fd);
} else {
- LOG("Initialising block use map to defaults");
+ NSLOG(netsurf, INFO, "Initialising block use map to defaults");
/* ensure block 0 (invalid sentinel) is skipped */
state->blocks[ENTRY_ELEM_DATA][0].use_map[0] = 1;
state->blocks[ENTRY_ELEM_META][0].use_map[0] = 1;
@@ -1344,7 +1365,7 @@ write_control(struct store_state *state)
return ret;
}
- LOG("writing control file \"%s\"", fname);
+ NSLOG(netsurf, INFO, "writing control file \"%s\"", fname);
ret = netsurf_mkdir_all(fname);
if (ret != NSERROR_OK) {
@@ -1392,7 +1413,7 @@ read_control(struct store_state *state)
return ret;
}
- LOG("opening control file \"%s\"", fname);
+ NSLOG(netsurf, INFO, "opening control file \"%s\"", fname);
fcontrol = fopen(fname, "rb");
@@ -1509,7 +1530,8 @@ initialise(const struct llcache_store_parameters *parameters)
/* read store control and create new if required */
ret = read_control(newstate);
if (ret != NSERROR_OK) {
- LOG("read control failed %s", messages_get_errorcode(ret));
+ NSLOG(netsurf, INFO, "read control failed %s",
+ messages_get_errorcode(ret));
ret = write_control(newstate);
if (ret == NSERROR_OK) {
unlink_entries(newstate);
@@ -1558,15 +1580,17 @@ initialise(const struct llcache_store_parameters *parameters)
storestate = newstate;
- LOG("FS backing store init successful");
+ NSLOG(netsurf, INFO, "FS backing store init successful");
- LOG("path:%s limit:%"PRIsizet" hyst:%"PRIsizet" addr:%d entries:%d",
- newstate->path,
- newstate->limit,
- newstate->hysteresis,
- newstate->ident_bits,
- newstate->entry_bits);
- LOG("Using %"PRIu64"/%"PRIsizet, newstate->total_alloc, newstate->limit);
+ NSLOG(netsurf, INFO,
+ "path:%s limit:%"PRIsizet" hyst:%"PRIsizet" addr:%d entries:%d",
+ newstate->path,
+ newstate->limit,
+ newstate->hysteresis,
+ newstate->ident_bits,
+ newstate->entry_bits);
+ NSLOG(netsurf, INFO, "Using %"PRIu64"/%"PRIsizet,
+ newstate->total_alloc, newstate->limit);
return NSERROR_OK;
}
@@ -1605,14 +1629,15 @@ finalise(void)
/* avoid division by zero */
if (op_count > 0) {
- LOG("Cache total/hit/miss/fail (counts) %d/%"PRIsizet"/%"PRIsizet"/%d (100%%/%"PRIsizet"%%/%"PRIsizet"%%/%d%%)",
- op_count,
- storestate->hit_count,
- storestate->miss_count,
- 0,
- (storestate->hit_count * 100) / op_count,
- (storestate->miss_count * 100) / op_count,
- 0);
+ NSLOG(netsurf, INFO,
+ "Cache total/hit/miss/fail (counts) %d/%"PRIsizet"/%"PRIsizet"/%d (100%%/%"PRIsizet"%%/%"PRIsizet"%%/%d%%)",
+ op_count,
+ storestate->hit_count,
+ storestate->miss_count,
+ 0,
+ (storestate->hit_count * 100) / op_count,
+ (storestate->miss_count * 100) / op_count,
+ 0);
}
free(storestate->path);
@@ -1646,7 +1671,7 @@ static nserror store_write_block(struct store_state *state,
state->blocks[elem_idx][bf].fd = store_open(state, bf,
elem_idx + ENTRY_ELEM_COUNT, O_CREAT | O_RDWR);
if (state->blocks[elem_idx][bf].fd == -1) {
- LOG("Open failed errno %d", errno);
+ NSLOG(netsurf, INFO, "Open failed errno %d", errno);
return NSERROR_SAVE_FAILED;
}
@@ -1661,21 +1686,21 @@ static nserror store_write_block(struct store_state *state,
bse->elem[elem_idx].size,
offst);
if (wr != (ssize_t)bse->elem[elem_idx].size) {
- LOG("Write failed %"PRIssizet" of %d bytes from %p at 0x%jx block %d errno %d",
- wr,
- bse->elem[elem_idx].size,
- bse->elem[elem_idx].data,
- (uintmax_t)offst,
- bse->elem[elem_idx].block,
- errno);
+ NSLOG(netsurf, INFO,
+ "Write failed %"PRIssizet" of %d bytes from %p at 0x%jx block %d errno %d",
+ wr,
+ bse->elem[elem_idx].size,
+ bse->elem[elem_idx].data,
+ (uintmax_t)offst,
+ bse->elem[elem_idx].block,
+ errno);
return NSERROR_SAVE_FAILED;
}
- LOG("Wrote %"PRIssizet" bytes from %p at 0x%jx block %d",
- wr,
- bse->elem[elem_idx].data,
- (uintmax_t)offst,
- bse->elem[elem_idx].block);
+ NSLOG(netsurf, INFO,
+ "Wrote %"PRIssizet" bytes from %p at 0x%jx block %d", wr,
+ bse->elem[elem_idx].data, (uintmax_t)offst,
+ bse->elem[elem_idx].block);
return NSERROR_OK;
}
@@ -1699,7 +1724,7 @@ static nserror store_write_file(struct store_state *state,
fd = store_open(state, bse->ident, elem_idx, O_CREAT | O_WRONLY);
if (fd < 0) {
perror("");
- LOG("Open failed %d errno %d", fd, errno);
+ NSLOG(netsurf, INFO, "Open failed %d errno %d", fd, errno);
return NSERROR_SAVE_FAILED;
}
@@ -1708,17 +1733,19 @@ static nserror store_write_file(struct store_state *state,
close(fd);
if (wr != (ssize_t)bse->elem[elem_idx].size) {
- LOG("Write failed %"PRIssizet" of %d bytes from %p errno %d",
- wr,
- bse->elem[elem_idx].size,
- bse->elem[elem_idx].data,
- err);
+ NSLOG(netsurf, INFO,
+ "Write failed %"PRIssizet" of %d bytes from %p errno %d",
+ wr,
+ bse->elem[elem_idx].size,
+ bse->elem[elem_idx].data,
+ err);
/** @todo Delete the file? */
return NSERROR_SAVE_FAILED;
}
- LOG("Wrote %"PRIssizet" bytes from %p", wr, bse->elem[elem_idx].data);
+ NSLOG(netsurf, INFO, "Wrote %"PRIssizet" bytes from %p", wr,
+ bse->elem[elem_idx].data);
return NSERROR_OK;
}
@@ -1759,7 +1786,7 @@ store(nsurl *url,
/* set the store entry up */
ret = set_store_entry(storestate, url, elem_idx, data, datalen, &bse);
if (ret != NSERROR_OK) {
- LOG("store entry setting failed");
+ NSLOG(netsurf, INFO, "store entry setting failed");
return ret;
}
@@ -1782,7 +1809,7 @@ static nserror entry_release_alloc(struct store_entry_element *elem)
if ((elem->flags & ENTRY_ELEM_FLAG_HEAP) != 0) {
elem->ref--;
if (elem->ref == 0) {
- LOG("freeing %p", elem->data);
+ NSLOG(netsurf, INFO, "freeing %p", elem->data);
free(elem->data);
elem->flags &= ~ENTRY_ELEM_FLAG_HEAP;
}
@@ -1814,7 +1841,7 @@ static nserror store_read_block(struct store_state *state,
state->blocks[elem_idx][bf].fd = store_open(state, bf,
elem_idx + ENTRY_ELEM_COUNT, O_CREAT | O_RDWR);
if (state->blocks[elem_idx][bf].fd == -1) {
- LOG("Open failed errno %d", errno);
+ NSLOG(netsurf, INFO, "Open failed errno %d", errno);
return NSERROR_SAVE_FAILED;
}
@@ -1829,21 +1856,21 @@ static nserror store_read_block(struct store_state *state,
bse->elem[elem_idx].size,
offst);
if (rd != (ssize_t)bse->elem[elem_idx].size) {
- LOG("Failed reading %"PRIssizet" of %d bytes into %p from 0x%jx block %d errno %d",
- rd,
- bse->elem[elem_idx].size,
- bse->elem[elem_idx].data,
- (uintmax_t)offst,
- bse->elem[elem_idx].block,
- errno);
+ NSLOG(netsurf, INFO,
+ "Failed reading %"PRIssizet" of %d bytes into %p from 0x%jx block %d errno %d",
+ rd,
+ bse->elem[elem_idx].size,
+ bse->elem[elem_idx].data,
+ (uintmax_t)offst,
+ bse->elem[elem_idx].block,
+ errno);
return NSERROR_SAVE_FAILED;
}
- LOG("Read %"PRIssizet" bytes into %p from 0x%jx block %d",
- rd,
- bse->elem[elem_idx].data,
- (uintmax_t)offst,
- bse->elem[elem_idx].block);
+ NSLOG(netsurf, INFO,
+ "Read %"PRIssizet" bytes into %p from 0x%jx block %d", rd,
+ bse->elem[elem_idx].data, (uintmax_t)offst,
+ bse->elem[elem_idx].block);
return NSERROR_OK;
}
@@ -1868,7 +1895,7 @@ static nserror store_read_file(struct store_state *state,
/* separate file in backing store */
fd = store_open(storestate, bse->ident, elem_idx, O_RDONLY);
if (fd < 0) {
- LOG("Open failed %d errno %d", fd, errno);
+ NSLOG(netsurf, INFO, "Open failed %d errno %d", fd, errno);
/** @todo should this invalidate the entry? */
return NSERROR_NOT_FOUND;
}
@@ -1878,8 +1905,10 @@ static nserror store_read_file(struct store_state *state,
bse->elem[elem_idx].data + tot,
bse->elem[elem_idx].size - tot);
if (rd <= 0) {
- LOG("read error returned %"PRIssizet" errno %d",
- rd, errno);
+ NSLOG(netsurf, INFO,
+ "read error returned %"PRIssizet" errno %d",
+ rd,
+ errno);
ret = NSERROR_NOT_FOUND;
break;
}
@@ -1888,7 +1917,8 @@ static nserror store_read_file(struct store_state *state,
close(fd);
- LOG("Read %"PRIsizet" bytes into %p", tot, bse->elem[elem_idx].data);
+ NSLOG(netsurf, INFO, "Read %"PRIsizet" bytes into %p", tot,
+ bse->elem[elem_idx].data);
return ret;
}
@@ -1921,13 +1951,14 @@ fetch(nsurl *url,
/* fetch store entry */
ret = get_store_entry(storestate, url, &bse);
if (ret != NSERROR_OK) {
- LOG("entry not found");
+ NSLOG(netsurf, INFO, "entry not found");
storestate->miss_count++;
return ret;
}
storestate->hit_count++;
- LOG("retrieving cache data for url:%s", nsurl_access(url));
+ NSLOG(netsurf, INFO, "retrieving cache data for url:%s",
+ nsurl_access(url));
/* calculate the entry element index */
if ((bsflags & BACKING_STORE_META) != 0) {
@@ -1942,16 +1973,20 @@ fetch(nsurl *url,
/* use the existing allocation and bump the ref count. */
elem->ref++;
- LOG("Using existing entry (%p) allocation %p refs:%d", bse, elem->data, elem->ref);
+ NSLOG(netsurf, INFO,
+ "Using existing entry (%p) allocation %p refs:%d", bse,
+ elem->data, elem->ref);
} else {
/* allocate from the heap */
elem->data = malloc(elem->size);
if (elem->data == NULL) {
- LOG("Failed to create new heap allocation");
+ NSLOG(netsurf, INFO,
+ "Failed to create new heap allocation");
return NSERROR_NOMEM;
}
- LOG("Created new heap allocation %p", elem->data);
+ NSLOG(netsurf, INFO, "Created new heap allocation %p",
+ elem->data);
/* mark the entry as having a valid heap allocation */
elem->flags |= ENTRY_ELEM_FLAG_HEAP;
@@ -2000,7 +2035,7 @@ static nserror release(nsurl *url, enum backing_store_flags bsflags)
ret = get_store_entry(storestate, url, &bse);
if (ret != NSERROR_OK) {
- LOG("entry not found");
+ NSLOG(netsurf, INFO, "entry not found");
return ret;
}
diff --git a/content/handlers/css/css.c b/content/handlers/css/css.c
index 0a8ffdd5a..93efd6a1b 100644
--- a/content/handlers/css/css.c
+++ b/content/handlers/css/css.c
@@ -321,9 +321,11 @@ static css_error nscss_convert_css_data(struct content_css_data *c)
const char *url;
if (css_stylesheet_get_url(c->sheet, &url) == CSS_OK) {
- LOG("Failed converting %p %s (%d)", c, url, error);
+ NSLOG(netsurf, INFO, "Failed converting %p %s (%d)",
+ c, url, error);
} else {
- LOG("Failed converting %p (%d)", c, error);
+ NSLOG(netsurf, INFO, "Failed converting %p (%d)", c,
+ error);
}
}
@@ -598,7 +600,9 @@ css_error nscss_handle_import(void *pw, css_stylesheet *parent,
nsurl_unref(ns_ref);
#ifdef NSCSS_IMPORT_TRACE
- LOG("Import %d '%s' -> (handle: %p ctx: %p)", c->import_count, lwc_string_data(url), c->imports[c->import_count].c, ctx);
+ NSLOG(netsurf, INFO, "Import %d '%s' -> (handle: %p ctx: %p)",
+ c->import_count, lwc_string_data(url),
+ c->imports[c->import_count].c, ctx);
#endif
c->import_count++;
@@ -621,7 +625,7 @@ nserror nscss_import(hlcache_handle *handle,
css_error error = CSS_OK;
#ifdef NSCSS_IMPORT_TRACE
- LOG("Event %d for %p (%p)", event->type, handle, ctx);
+ NSLOG(netsurf, INFO, "Event %d for %p (%p)", event->type, handle, ctx);
#endif
assert(ctx->css->imports[ctx->index].c == handle);
@@ -663,7 +667,8 @@ css_error nscss_import_complete(nscss_import_ctx *ctx)
error = nscss_register_imports(ctx->css);
#ifdef NSCSS_IMPORT_TRACE
- LOG("Destroying import context %p for %d", ctx, ctx->index);
+ NSLOG(netsurf, INFO, "Destroying import context %p for %d", ctx,
+ ctx->index);
#endif
/* No longer need import context */
diff --git a/content/handlers/css/hints.c b/content/handlers/css/hints.c
index 9dfcf402b..08fe438c1 100644
--- a/content/handlers/css/hints.c
+++ b/content/handlers/css/hints.c
@@ -1615,7 +1615,7 @@ css_error node_presentational_hint(void *pw, void *node,
}
#ifdef LOG_STATS
- LOG("Properties with hints: %i", hint_ctx.len);
+ NSLOG(netsurf, INFO, "Properties with hints: %i", hint_ctx.len);
#endif
css_hint_get_hints(hints, nhints);
diff --git a/content/handlers/css/select.c b/content/handlers/css/select.c
index daa3b4087..328d6a711 100644
--- a/content/handlers/css/select.c
+++ b/content/handlers/css/select.c
@@ -175,20 +175,20 @@ css_stylesheet *nscss_create_inline_style(const uint8_t *data, size_t len,
error = css_stylesheet_create(&params, &sheet);
if (error != CSS_OK) {
- LOG("Failed creating sheet: %d", error);
+ NSLOG(netsurf, INFO, "Failed creating sheet: %d", error);
return NULL;
}
error = css_stylesheet_append_data(sheet, data, len);
if (error != CSS_OK && error != CSS_NEEDDATA) {
- LOG("failed appending data: %d", error);
+ NSLOG(netsurf, INFO, "failed appending data: %d", error);
css_stylesheet_destroy(sheet);
return NULL;
}
error = css_stylesheet_data_done(sheet);
if (error != CSS_OK) {
- LOG("failed completing parse: %d", error);
+ NSLOG(netsurf, INFO, "failed completing parse: %d", error);
css_stylesheet_destroy(sheet);
return NULL;
}
@@ -214,7 +214,8 @@ static void nscss_dom_user_data_handler(dom_node_operation operation,
CSS_NODE_CLONED,
NULL, src, dst, data);
if (error != CSS_OK)
- LOG("Failed to clone libcss_node_data.");
+ NSLOG(netsurf, INFO,
+ "Failed to clone libcss_node_data.");
break;
case DOM_NODE_RENAMED:
@@ -222,7 +223,8 @@ static void nscss_dom_user_data_handler(dom_node_operation operation,
CSS_NODE_MODIFIED,
NULL, src, NULL, data);
if (error != CSS_OK)
- LOG("Failed to update libcss_node_data.");
+ NSLOG(netsurf, INFO,
+ "Failed to update libcss_node_data.");
break;
case DOM_NODE_IMPORTED:
@@ -232,11 +234,12 @@ static void nscss_dom_user_data_handler(dom_node_operation operation,
CSS_NODE_DELETED,
NULL, src, NULL, data);
if (error != CSS_OK)
- LOG("Failed to delete libcss_node_data.");
+ NSLOG(netsurf, INFO,
+ "Failed to delete libcss_node_data.");
break;
default:
- LOG("User data operation not handled.");
+ NSLOG(netsurf, INFO, "User data operation not handled.");
assert(0);
}
}
diff --git a/content/handlers/image/ico.c b/content/handlers/image/ico.c
index d1865a3b4..85aab9f64 100644
--- a/content/handlers/image/ico.c
+++ b/content/handlers/image/ico.c
@@ -160,7 +160,7 @@ static bool nsico_convert(struct content *c)
bmp = ico_find(ico->ico, 255, 255);
if (bmp == NULL) {
/* return error */
- LOG("Failed to select icon");
+ NSLOG(netsurf, INFO, "Failed to select icon");
return false;
}
@@ -183,7 +183,7 @@ static bool nsico_redraw(struct content *c, struct content_redraw_data *data,
bmp = ico_find(ico->ico, data->width, data->height);
if (bmp == NULL) {
/* return error */
- LOG("Failed to select icon");
+ NSLOG(netsurf, INFO, "Failed to select icon");
return false;
}
@@ -192,7 +192,7 @@ static bool nsico_redraw(struct content *c, struct content_redraw_data *data,
if (bmp_decode(bmp) != BMP_OK) {
return false;
} else {
- LOG("Decoding bitmap");
+ NSLOG(netsurf, INFO, "Decoding bitmap");
guit->bitmap->modified(bmp->bitmap);
}
@@ -255,7 +255,7 @@ static void *nsico_get_internal(const struct content *c, void *context)
bmp = ico_find(ico->ico, 16, 16);
if (bmp == NULL) {
/* return error */
- LOG("Failed to select icon");
+ NSLOG(netsurf, INFO, "Failed to select icon");
return NULL;
}
diff --git a/content/handlers/image/image_cache.c b/content/handlers/image/image_cache.c
index 02107f75f..7fba11fb9 100644
--- a/content/handlers/image/image_cache.c
+++ b/content/handlers/image/image_cache.c
@@ -256,11 +256,12 @@ static void image_cache__free_bitmap(struct image_cache_entry_s *centry)
{
if (centry->bitmap != NULL) {
#ifdef IMAGE_CACHE_VERBOSE
- LOG("Freeing bitmap %p size %d age %d redraw count %d",
- centry->bitmap,
- centry->bitmap_size,
- image_cache->current_age - centry->bitmap_age,
- centry->redraw_count);
+ NSLOG(netsurf, INFO,
+ "Freeing bitmap %p size %d age %d redraw count %d",
+ centry->bitmap,
+ centry->bitmap_size,
+ image_cache->current_age - centry->bitmap_age,
+ centry->redraw_count);
#endif
guit->bitmap->destroy(centry->bitmap);
centry->bitmap = NULL;
@@ -281,7 +282,7 @@ static void image_cache__free_bitmap(struct image_cache_entry_s *centry)
static void image_cache__free_entry(struct image_cache_entry_s *centry)
{
#ifdef IMAGE_CACHE_VERBOSE
- LOG("freeing %p ", centry);
+ NSLOG(netsurf, INFO, "freeing %p ", centry);
#endif
if (centry->redraw_count == 0) {
@@ -331,7 +332,7 @@ static void image_cache__background_update(void *p)
icache->current_age += icache->params.bg_clean_time;
#ifdef IMAGE_CACHE_VERBOSE
- LOG("Cache age %ds", icache->current_age / 1000);
+ NSLOG(netsurf, INFO, "Cache age %ds", icache->current_age / 1000);
#endif
image_cache__clean(icache);
@@ -383,13 +384,16 @@ bool image_cache_speculate(struct content *c)
if ((image_cache->total_bitmap_size < image_cache->params.limit) &&
(c->size <= image_cache->params.speculative_small)) {
#ifdef IMAGE_CACHE_VERBOSE
- LOG("content size (%d) is smaller than minimum (%d)", c->size, SPECULATE_SMALL);
+ NSLOG(netsurf, INFO,
+ "content size (%d) is smaller than minimum (%d)",
+ c->size,
+ SPECULATE_SMALL);
#endif
decision = true;
}
#ifdef IMAGE_CACHE_VERBOSE
- LOG("returning %d", decision);
+ NSLOG(netsurf, INFO, "returning %d", decision);
#endif
return decision;
}
@@ -422,8 +426,10 @@ image_cache_init(const struct image_cache_parameters *image_cache_parameters)
image_cache__background_update,
image_cache);
- LOG("Image cache initialised with a limit of %" PRIsizet " hysteresis of %"PRIsizet,
- image_cache->params.limit, image_cache->params.hysteresis);
+ NSLOG(netsurf, INFO,
+ "Image cache initialised with a limit of %"PRIsizet" hysteresis of %"PRIsizet,
+ image_cache->params.limit,
+ image_cache->params.hysteresis);
return NSERROR_OK;
}
@@ -435,8 +441,8 @@ nserror image_cache_fini(void)
guit->misc->schedule(-1, image_cache__background_update, image_cache);
- LOG("Size at finish %" PRIsizet " (in %d)",
- image_cache->total_bitmap_size, image_cache->bitmap_count);
+ NSLOG(netsurf, INFO, "Size at finish %"PRIsizet" (in %d)",
+ image_cache->total_bitmap_size, image_cache->bitmap_count);
while (image_cache->entries != NULL) {
image_cache__free_entry(image_cache->entries);
@@ -446,11 +452,13 @@ nserror image_cache_fini(void)
image_cache->miss_count +
image_cache->fail_count;
- LOG("Age %ds", image_cache->current_age / 1000);
- LOG("Peak size %" PRIsizet " (in %d)",
- image_cache->max_bitmap_size, image_cache->max_bitmap_size_count);
- LOG("Peak image count %d (size %" PRIsizet ")",
- image_cache->max_bitmap_count, image_cache->max_bitmap_count_size);
+ NSLOG(netsurf, INFO, "Age %ds", image_cache->current_age / 1000);
+ NSLOG(netsurf, INFO, "Peak size %"PRIsizet" (in %d)",
+ image_cache->max_bitmap_size,
+ image_cache->max_bitmap_size_count);
+ NSLOG(netsurf, INFO, "Peak image count %d (size %"PRIsizet")",
+ image_cache->max_bitmap_count,
+ image_cache->max_bitmap_count_size);
if (op_count > 0) {
uint64_t op_size;
@@ -459,35 +467,39 @@ nserror image_cache_fini(void)
image_cache->miss_size +
image_cache->fail_size;
- LOG("Cache total/hit/miss/fail (counts) %d/%d/%d/%d (100%%/%d%%/%d%%/%d%%)",
- op_count,
- image_cache->hit_count,
- image_cache->miss_count,
- image_cache->fail_count,
- (image_cache->hit_count * 100) / op_count,
- (image_cache->miss_count * 100) / op_count,
- (image_cache->fail_count * 100) / op_count);
- LOG("Cache total/hit/miss/fail (size) %"PRIu64"/%"PRIu64"/%"PRIu64"/%"PRIu64" (100%%/%"PRId64"%%/%"PRId64"%%/%"PRId64"%%)",
- op_size,
- image_cache->hit_size,
- image_cache->miss_size,
- image_cache->fail_size,
- (image_cache->hit_size * 100) / op_size,
- (image_cache->miss_size * 100) / op_size,
- (image_cache->fail_size * 100) / op_size);
+ NSLOG(netsurf, INFO,
+ "Cache total/hit/miss/fail (counts) %d/%d/%d/%d (100%%/%d%%/%d%%/%d%%)",
+ op_count,
+ image_cache->hit_count,
+ image_cache->miss_count,
+ image_cache->fail_count,
+ (image_cache->hit_count * 100) / op_count,
+ (image_cache->miss_count * 100) / op_count,
+ (image_cache->fail_count * 100) / op_count);
+ NSLOG(netsurf, INFO,
+ "Cache total/hit/miss/fail (size) %"PRIu64"/%"PRIu64"/%"PRIu64"/%"PRIu64" (100%%/%"PRId64"%%/%"PRId64"%%/%"PRId64"%%)",
+ op_size,
+ image_cache->hit_size,
+ image_cache->miss_size,
+ image_cache->fail_size,
+ (image_cache->hit_size * 100) / op_size,
+ (image_cache->miss_size * 100) / op_size,
+ (image_cache->fail_size * 100) / op_size);
}
- LOG("Total images never rendered: %d (includes %d that were converted)",
- image_cache->total_unrendered,
- image_cache->specultive_miss_count);
+ NSLOG(netsurf, INFO,
+ "Total images never rendered: %d (includes %d that were converted)",
+ image_cache->total_unrendered,
+ image_cache->specultive_miss_count);
- LOG("Total number of excessive conversions: %d (from %d images converted more than once)",
- image_cache->total_extra_conversions,
- image_cache->total_extra_conversions_count);
+ NSLOG(netsurf, INFO,
+ "Total number of excessive conversions: %d (from %d images converted more than once)",
+ image_cache->total_extra_conversions,
+ image_cache->total_extra_conversions_count);
- LOG("Bitmap of size %d had most (%d) conversions",
- image_cache->peak_conversions_size,
- image_cache->peak_conversions);
+ NSLOG(netsurf, INFO, "Bitmap of size %d had most (%d) conversions",
+ image_cache->peak_conversions_size,
+ image_cache->peak_conversions);
free(image_cache);
@@ -519,7 +531,8 @@ nserror image_cache_add(struct content *content,
centry->bitmap_size = content->width * content->height * 4;
}
- LOG("centry %p, content %p, bitmap %p", centry, content, bitmap);
+ NSLOG(netsurf, INFO, "centry %p, content %p, bitmap %p", centry,
+ content, bitmap);
centry->convert = convert;
@@ -558,7 +571,8 @@ nserror image_cache_remove(struct content *content)
/* get the cache entry */
centry = image_cache__find(content);
if (centry == NULL) {
- LOG("Could not find cache entry for content (%p)", content);
+ NSLOG(netsurf, INFO,
+ "Could not find cache entry for content (%p)", content);
return NSERROR_NOT_FOUND;
}
@@ -788,7 +802,8 @@ bool image_cache_redraw(struct content *c,
/* get the cache entry */
centry = image_cache__find(c);
if (centry == NULL) {
- LOG("Could not find cache entry for content (%p)", c);
+ NSLOG(netsurf, INFO,
+ "Could not find cache entry for content (%p)", c);
return false;
}
@@ -827,7 +842,8 @@ void image_cache_destroy(struct content *content)
/* get the cache entry */
centry = image_cache__find(content);
if (centry == NULL) {
- LOG("Could not find cache entry for content (%p)", content);
+ NSLOG(netsurf, INFO,
+ "Could not find cache entry for content (%p)", content);
} else {
image_cache__free_entry(centry);
}
diff --git a/content/handlers/image/jpeg.c b/content/handlers/image/jpeg.c
index c5aca1c9b..44b1c5271 100644
--- a/content/handlers/image/jpeg.c
+++ b/content/handlers/image/jpeg.c
@@ -142,7 +142,7 @@ static void nsjpeg_term_source(j_decompress_ptr cinfo)
static void nsjpeg_error_log(j_common_ptr cinfo)
{
cinfo->err->format_message(cinfo, nsjpeg_error_buffer);
- LOG("%s", nsjpeg_error_buffer);
+ NSLOG(netsurf, INFO, "%s", nsjpeg_error_buffer);
}
@@ -156,7 +156,7 @@ static void nsjpeg_error_exit(j_common_ptr cinfo)
jmp_buf *setjmp_buffer = (jmp_buf *) cinfo->client_data;
cinfo->err->format_message(cinfo, nsjpeg_error_buffer);
- LOG("%s", nsjpeg_error_buffer);
+ NSLOG(netsurf, INFO, "%s", nsjpeg_error_buffer);
longjmp(*setjmp_buffer, 1);
}
diff --git a/content/handlers/image/nssprite.c b/content/handlers/image/nssprite.c
index c9fe1b585..269c24356 100644
--- a/content/handlers/image/nssprite.c
+++ b/content/handlers/image/nssprite.c
@@ -48,10 +48,10 @@ typedef struct nssprite_content {
#define ERRCHK(x) do { \
rosprite_error err = x; \
if (err == ROSPRITE_EOF) { \
- LOG("Got ROSPRITE_EOF when loading sprite file"); \
+ NSLOG(netsurf, INFO, "Got ROSPRITE_EOF when loading sprite file"); \
goto ro_sprite_error; \
} else if (err == ROSPRITE_BADMODE) { \
- LOG("Got ROSPRITE_BADMODE when loading sprite file"); \
+ NSLOG(netsurf, INFO, "Got ROSPRITE_BADMODE when loading sprite file"); \
goto ro_sprite_error; \
} else if (err == ROSPRITE_OK) { \
} else { \
diff --git a/content/handlers/image/png.c b/content/handlers/image/png.c
index 288f6c3e4..7a4ce3010 100644
--- a/content/handlers/image/png.c
+++ b/content/handlers/image/png.c
@@ -74,7 +74,7 @@ enum nspng_cberr {
*/
static void nspng_warning(png_structp png_ptr, png_const_charp warning_message)
{
- LOG("%s", warning_message);
+ NSLOG(netsurf, INFO, "%s", warning_message);
}
/**
@@ -82,7 +82,7 @@ static void nspng_warning(png_structp png_ptr, png_const_charp warning_message)
*/
static void nspng_error(png_structp png_ptr, png_const_charp error_message)
{
- LOG("%s", error_message);
+ NSLOG(netsurf, INFO, "%s", error_message);
longjmp(png_jmpbuf(png_ptr), CBERR_LIBPNG);
}
@@ -175,10 +175,8 @@ static void info_callback(png_structp png_s, png_infop info)
png_c->rowbytes = png_get_rowbytes(png_s, info);
png_c->interlace = (interlace == PNG_INTERLACE_ADAM7);
- LOG("size %li * %li, rowbytes %" PRIsizet,
- (unsigned long)width,
- (unsigned long)height,
- png_c->rowbytes);
+ NSLOG(netsurf, INFO, "size %li * %li, rowbytes %"PRIsizet,
+ (unsigned long)width, (unsigned long)height, png_c->rowbytes);
}
static void row_callback(png_structp png_s, png_bytep new_row,
@@ -260,7 +258,7 @@ static nserror nspng_create_png_data(nspng_content *png_c)
if (setjmp(png_jmpbuf(png_c->png))) {
png_destroy_read_struct(&png_c->png, &png_c->info, 0);
- LOG("Failed to set callbacks");
+ NSLOG(netsurf, INFO, "Failed to set callbacks");
png_c->png = NULL;
png_c->info = NULL;
@@ -350,7 +348,8 @@ static bool nspng_process_data(struct content *c, const char *data,
* up png conversion and signal the content
* error
*/
- LOG("Fatal PNG error during header, error content");
+ NSLOG(netsurf, INFO,
+ "Fatal PNG error during header, error content");
png_destroy_read_struct(&png_c->png, &png_c->info, 0);
png_c->png = NULL;
diff --git a/content/handlers/image/rsvg.c b/content/handlers/image/rsvg.c
index f6732e23f..ca2d81eeb 100644
--- a/content/handlers/image/rsvg.c
+++ b/content/handlers/image/rsvg.c
@@ -68,7 +68,7 @@ static nserror rsvg_create_svg_data(rsvg_content *c)
c->bitmap = NULL;
if ((c->rsvgh = rsvg_handle_new()) == NULL) {
- LOG("rsvg_handle_new() returned NULL.");
+ NSLOG(netsurf, INFO, "rsvg_handle_new() returned NULL.");
content_broadcast_errorcode(&c->base, NSERROR_NOMEM);
return NSERROR_NOMEM;
}
@@ -116,7 +116,8 @@ static bool rsvg_process_data(struct content *c, const char *data,
if (rsvg_handle_write(d->rsvgh, (const guchar *)data, (gsize)size,
&err) == FALSE) {
- LOG("rsvg_handle_write returned an error: %s", err->message);
+ NSLOG(netsurf, INFO,
+ "rsvg_handle_write returned an error: %s", err->message);
content_broadcast_errorcode(c, NSERROR_SVG_ERROR);
return false;
}
@@ -160,7 +161,8 @@ static bool rsvg_convert(struct content *c)
GError *err = NULL;
if (rsvg_handle_close(d->rsvgh, &err) == FALSE) {
- LOG("rsvg_handle_close returned an error: %s", err->message);
+ NSLOG(netsurf, INFO,
+ "rsvg_handle_close returned an error: %s", err->message);
content_broadcast_errorcode(c, NSERROR_SVG_ERROR);
return false;
}
@@ -177,7 +179,8 @@ static bool rsvg_convert(struct content *c)
if ((d->bitmap = guit->bitmap->create(c->width, c->height,
BITMAP_NEW)) == NULL) {
- LOG("Failed to create bitmap for rsvg render.");
+ NSLOG(netsurf, INFO,
+ "Failed to create bitmap for rsvg render.");
content_broadcast_errorcode(c, NSERROR_NOMEM);
return false;
}
@@ -187,13 +190,15 @@ static bool rsvg_convert(struct content *c)
CAIRO_FORMAT_ARGB32,
c->width, c->height,
guit->bitmap->get_rowstride(d->bitmap))) == NULL) {
- LOG("Failed to create Cairo image surface for rsvg render.");
+ NSLOG(netsurf, INFO,
+ "Failed to create Cairo image surface for rsvg render.");
content_broadcast_errorcode(c, NSERROR_NOMEM);
return false;
}
if ((d->ct = cairo_create(d->cs)) == NULL) {
- LOG("Failed to create Cairo drawing context for rsvg render.");
+ NSLOG(netsurf, INFO,
+ "Failed to create Cairo drawing context for rsvg render.");
content_broadcast_errorcode(c, NSERROR_NOMEM);
return false;
}
diff --git a/content/handlers/javascript/duktape/dukky.c b/content/handlers/javascript/duktape/dukky.c
index dd4378b7a..8cfeb3985 100644
--- a/content/handlers/javascript/duktape/dukky.c
+++ b/content/handlers/javascript/duktape/dukky.c
@@ -61,7 +61,8 @@ static duk_ret_t dukky_populate_object(duk_context *ctx, void *udata)
duk_get_prop(ctx, -2);
/* ... obj args prototab {proto/undefined} */
if (duk_is_undefined(ctx, -1)) {
- LOG("RuhRoh, couldn't find a prototype, HTMLUnknownElement it is");
+ NSLOG(netsurf, INFO,
+ "RuhRoh, couldn't find a prototype, HTMLUnknownElement it is");
duk_pop(ctx);
duk_push_string(ctx, PROTO_NAME(HTMLUNKNOWNELEMENT));
duk_get_prop(ctx, -2);
@@ -77,7 +78,7 @@ static duk_ret_t dukky_populate_object(duk_context *ctx, void *udata)
/* ... initfn obj[proto] args prototab proto */
duk_pop_2(ctx);
/* ... initfn obj[proto] args */
- LOG("Call the init function");
+ NSLOG(netsurf, INFO, "Call the init function");
duk_call(ctx, nargs + 1);
return 1; /* The object */
}
@@ -85,7 +86,7 @@ static duk_ret_t dukky_populate_object(duk_context *ctx, void *udata)
duk_ret_t dukky_create_object(duk_context *ctx, const char *name, int args)
{
duk_ret_t ret;
- LOG("name=%s nargs=%d", name+2, args);
+ NSLOG(netsurf, INFO, "name=%s nargs=%d", name + 2, args);
/* ... args */
duk_push_object(ctx);
/* ... args obj */
@@ -106,7 +107,7 @@ duk_ret_t dukky_create_object(duk_context *ctx, const char *name, int args)
if ((ret = duk_safe_call(ctx, dukky_populate_object, NULL, args + 3, 1))
!= DUK_EXEC_SUCCESS)
return ret;
- LOG("created");
+ NSLOG(netsurf, INFO, "created");
return DUK_EXEC_SUCCESS;
}
@@ -146,7 +147,7 @@ dukky_push_node_stacked(duk_context *ctx)
if (duk_safe_call(ctx, dukky_populate_object, NULL, 4, 1)
!= DUK_EXEC_SUCCESS) {
duk_set_top(ctx, top_at_fail);
- LOG("Boo and also hiss");
+ NSLOG(netsurf, INFO, "Boo and also hiss");
return false;
}
/* ... nodeptr klass nodes node */
@@ -384,13 +385,14 @@ dukky_push_node_klass(duk_context *ctx, struct dom_node *node)
err = dom_node_get_namespace(node, &namespace);
if (err != DOM_NO_ERR) {
/* Feck it, element */
- LOG("dom_node_get_namespace() failed");
+ NSLOG(netsurf, INFO,
+ "dom_node_get_namespace() failed");
duk_push_string(ctx, PROTO_NAME(ELEMENT));
break;
}
if (namespace == NULL) {
/* No namespace, -> element */
- LOG("no namespace");
+ NSLOG(netsurf, INFO, "no namespace");
duk_push_string(ctx, PROTO_NAME(ELEMENT));
break;
}
@@ -561,7 +563,7 @@ nserror js_newcontext(int timeout, jscallback *cb, void *cbctx,
duk_context *ctx;
jscontext *ret = calloc(1, sizeof(*ret));
*jsctx = NULL;
- LOG("Creating new duktape javascript context");
+ NSLOG(netsurf, INFO, "Creating new duktape javascript context");
if (ret == NULL) return NSERROR_NOMEM;
ctx = ret->ctx = duk_create_heap(
dukky_alloc_function,
@@ -584,7 +586,7 @@ nserror js_newcontext(int timeout, jscallback *cb, void *cbctx,
void js_destroycontext(jscontext *ctx)
{
- LOG("Destroying duktape javascript context");
+ NSLOG(netsurf, INFO, "Destroying duktape javascript context");
duk_destroy_heap(ctx->ctx);
free(ctx);
}
@@ -593,7 +595,9 @@ jsobject *js_newcompartment(jscontext *ctx, void *win_priv, void *doc_priv)
{
assert(ctx != NULL);
/* Pop any active thread off */
- LOG("Yay, new compartment, win_priv=%p, doc_priv=%p", win_priv, doc_priv);
+ NSLOG(netsurf, INFO,
+ "Yay, new compartment, win_priv=%p, doc_priv=%p", win_priv,
+ doc_priv);
duk_set_top(ctx->ctx, 0);
duk_push_thread(ctx->ctx);
ctx->thread = duk_require_context(ctx->ctx, -1);
@@ -659,15 +663,17 @@ bool js_exec(jscontext *ctx, const char *txt, size_t txtlen)
duk_get_prop_string(CTX, 0, "fileName");
duk_get_prop_string(CTX, 0, "lineNumber");
duk_get_prop_string(CTX, 0, "stack");
- LOG("Uncaught error in JS: %s: %s", duk_safe_to_string(CTX, 1),
- duk_safe_to_string(CTX, 2));
- LOG(" was at: %s line %s", duk_safe_to_string(CTX, 3),
- duk_safe_to_string(CTX, 4));
- LOG(" Stack trace: %s", duk_safe_to_string(CTX, 5));
+ NSLOG(netsurf, INFO, "Uncaught error in JS: %s: %s",
+ duk_safe_to_string(CTX, 1), duk_safe_to_string(CTX, 2));
+ NSLOG(netsurf, INFO, " was at: %s line %s",
+ duk_safe_to_string(CTX, 3), duk_safe_to_string(CTX, 4));
+ NSLOG(netsurf, INFO, " Stack trace: %s",
+ duk_safe_to_string(CTX, 5));
return false;
}
if (duk_get_top(CTX) == 0) duk_push_boolean(CTX, false);
- LOG("Returning %s", duk_get_boolean(CTX, 0) ? "true" : "false");
+ NSLOG(netsurf, INFO, "Returning %s",
+ duk_get_boolean(CTX, 0) ? "true" : "false");
return duk_get_boolean(CTX, 0);
}
@@ -782,7 +788,8 @@ bool dukky_get_current_value_of_event_handler(duk_context *ctx,
/* ... node fullhandlersrc filename */
if (duk_pcompile(ctx, DUK_COMPILE_FUNCTION) != 0) {
/* ... node err */
- LOG("Unable to proceed with handler, could not compile");
+ NSLOG(netsurf, INFO,
+ "Unable to proceed with handler, could not compile");
duk_pop_2(ctx);
return false;
}
@@ -816,29 +823,27 @@ static void dukky_generic_event_handler(dom_event *evt, void *pw)
duk_get_memory_functions(ctx, &funcs);
jsctx = funcs.udata;
- LOG("WOOP WOOP, An event:");
+ NSLOG(netsurf, INFO, "WOOP WOOP, An event:");
exc = dom_event_get_type(evt, &name);
if (exc != DOM_NO_ERR) {
- LOG("Unable to find the event name");
+ NSLOG(netsurf, INFO, "Unable to find the event name");
return;
}
- LOG("Event's name is %*s",
- dom_string_length(name), dom_string_data(name));
+ NSLOG(netsurf, INFO, "Event's name is %*s", dom_string_length(name),
+ dom_string_data(name));
exc = dom_event_get_event_phase(evt, &phase);
if (exc != DOM_NO_ERR) {
- LOG("Unable to get event phase");
+ NSLOG(netsurf, INFO, "Unable to get event phase");
return;
}
- LOG("Event phase is: %s (%d)",
- phase == DOM_CAPTURING_PHASE ? "capturing" :
- phase == DOM_AT_TARGET ? "at-target" :
- phase == DOM_BUBBLING_PHASE ? "bubbling" :
- "unknown", (int)phase);
+ NSLOG(netsurf, INFO, "Event phase is: %s (%d)",
+ phase == DOM_CAPTURING_PHASE ? "capturing" : phase == DOM_AT_TARGET ? "at-target" : phase == DOM_BUBBLING_PHASE ? "bubbling" : "unknown",
+ (int)phase);
exc = dom_event_get_current_target(evt, &targ);
if (exc != DOM_NO_ERR) {
dom_string_unref(name);
- LOG("Unable to find the event target");
+ NSLOG(netsurf, INFO, "Unable to find the event target");
return;
}
@@ -852,7 +857,8 @@ static void dukky_generic_event_handler(dom_event *evt, void *pw)
if (dukky_push_node(ctx, (dom_node *)targ) == false) {
dom_string_unref(name);
dom_node_unref(targ);
- LOG("Unable to push JS node representation?!");
+ NSLOG(netsurf, INFO,
+ "Unable to push JS node representation?!");
return;
}
/* ... node */
@@ -868,21 +874,26 @@ static void dukky_generic_event_handler(dom_event *evt, void *pw)
if (duk_pcall_method(ctx, 1) != 0) {
/* Failed to run the method */
/* ... err */
- LOG("OH NOES! An error running a callback. Meh.");
+ NSLOG(netsurf, INFO,
+ "OH NOES! An error running a callback. Meh.");
exc = dom_event_stop_immediate_propagation(evt);
if (exc != DOM_NO_ERR)
- LOG("WORSE! could not stop propagation");
+ NSLOG(netsurf, INFO,
+ "WORSE! could not stop propagation");
duk_get_prop_string(ctx, -1, "name");
duk_get_prop_string(ctx, -2, "message");
duk_get_prop_string(ctx, -3, "fileName");
duk_get_prop_string(ctx, -4, "lineNumber");
duk_get_prop_string(ctx, -5, "stack");
/* ... err name message fileName lineNumber stack */
- LOG("Uncaught error in JS: %s: %s", duk_safe_to_string(ctx, -5),
- duk_safe_to_string(ctx, -4));
- LOG(" was at: %s line %s", duk_safe_to_string(ctx, -3),
- duk_safe_to_string(ctx, -2));
- LOG(" Stack trace: %s", duk_safe_to_string(ctx, -1));
+ NSLOG(netsurf, INFO, "Uncaught error in JS: %s: %s",
+ duk_safe_to_string(ctx, -5),
+ duk_safe_to_string(ctx, -4));
+ NSLOG(netsurf, INFO, " was at: %s line %s",
+ duk_safe_to_string(ctx, -3),
+ duk_safe_to_string(ctx, -2));
+ NSLOG(netsurf, INFO, " Stack trace: %s",
+ duk_safe_to_string(ctx, -1));
duk_pop_n(ctx, 6);
/* ... */
@@ -962,21 +973,27 @@ handle_extras:
if (duk_pcall_method(ctx, 1) != 0) {
/* Failed to run the method */
/* ... copy handler err */
- LOG("OH NOES! An error running a callback. Meh.");
+ NSLOG(netsurf, INFO,
+ "OH NOES! An error running a callback. Meh.");
exc = dom_event_stop_immediate_propagation(evt);
if (exc != DOM_NO_ERR)
- LOG("WORSE! could not stop propagation");
+ NSLOG(netsurf, INFO,
+ "WORSE! could not stop propagation");
duk_get_prop_string(ctx, -1, "name");
duk_get_prop_string(ctx, -2, "message");
duk_get_prop_string(ctx, -3, "fileName");
duk_get_prop_string(ctx, -4, "lineNumber");
duk_get_prop_string(ctx, -5, "stack");
/* ... err name message fileName lineNumber stack */
- LOG("Uncaught error in JS: %s: %s", duk_safe_to_string(ctx, -5),
- duk_safe_to_string(ctx, -4));
- LOG(" was at: %s line %s", duk_safe_to_string(ctx, -3),
- duk_safe_to_string(ctx, -2));
- LOG(" Stack trace: %s", duk_safe_to_string(ctx, -1));
+ NSLOG(netsurf, INFO, "Uncaught error in JS: %s: %s",
+ duk_safe_to_string(ctx, -5),
+ duk_safe_to_string(ctx, -4));
+ NSLOG(netsurf, INFO,
+ " was at: %s line %s",
+ duk_safe_to_string(ctx, -3),
+ duk_safe_to_string(ctx, -2));
+ NSLOG(netsurf, INFO, " Stack trace: %s",
+ duk_safe_to_string(ctx, -1));
duk_pop_n(ctx, 7);
/* ... copy */
@@ -1034,11 +1051,12 @@ void dukky_register_event_listener_for(duk_context *ctx,
exc = dom_event_target_add_event_listener(
ele, name, listen, capture);
if (exc != DOM_NO_ERR) {
- LOG("Unable to register listener for %p.%*s",
- ele, dom_string_length(name), dom_string_data(name));
+ NSLOG(netsurf, INFO,
+ "Unable to register listener for %p.%*s", ele,
+ dom_string_length(name), dom_string_data(name));
} else {
- LOG("have registered listener for %p.%*s",
- ele, dom_string_length(name), dom_string_data(name));
+ NSLOG(netsurf, INFO, "have registered listener for %p.%*s",
+ ele, dom_string_length(name), dom_string_data(name));
}
dom_event_listener_unref(listen);
}
@@ -1205,7 +1223,8 @@ bool js_fire_event(jscontext *ctx, const char *type, struct dom_document *doc, s
dom_event *evt;
dom_event_target *body;
- LOG("Event: %s (doc=%p, target=%p)", type, doc, target);
+ NSLOG(netsurf, INFO, "Event: %s (doc=%p, target=%p)", type, doc,
+ target);
/** @todo Make this more generic, this only handles load and only
* targetting the window, so that we actually stand a chance of
@@ -1276,18 +1295,22 @@ bool js_fire_event(jscontext *ctx, const char *type, struct dom_document *doc, s
if (duk_pcall_method(CTX, 1) != 0) {
/* Failed to run the handler */
/* ... err */
- LOG("OH NOES! An error running a handler. Meh.");
+ NSLOG(netsurf, INFO,
+ "OH NOES! An error running a handler. Meh.");
duk_get_prop_string(CTX, -1, "name");
duk_get_prop_string(CTX, -2, "message");
duk_get_prop_string(CTX, -3, "fileName");
duk_get_prop_string(CTX, -4, "lineNumber");
duk_get_prop_string(CTX, -5, "stack");
/* ... err name message fileName lineNumber stack */
- LOG("Uncaught error in JS: %s: %s", duk_safe_to_string(CTX, -5),
- duk_safe_to_string(CTX, -4));
- LOG(" was at: %s line %s", duk_safe_to_string(CTX, -3),
- duk_safe_to_string(CTX, -2));
- LOG(" Stack trace: %s", duk_safe_to_string(CTX, -1));
+ NSLOG(netsurf, INFO, "Uncaught error in JS: %s: %s",
+ duk_safe_to_string(CTX, -5),
+ duk_safe_to_string(CTX, -4));
+ NSLOG(netsurf, INFO, " was at: %s line %s",
+ duk_safe_to_string(CTX, -3),
+ duk_safe_to_string(CTX, -2));
+ NSLOG(netsurf, INFO, " Stack trace: %s",
+ duk_safe_to_string(CTX, -1));
duk_pop_n(CTX, 6);
/* ... */
diff --git a/content/hlcache.c b/content/hlcache.c
index 2242b73af..33436f7ed 100644
--- a/content/hlcache.c
+++ b/content/hlcache.c
@@ -195,7 +195,7 @@ static void hlcache_content_callback(struct content *c, content_msg msg,
error = handle->cb(handle, &event, handle->pw);
if (error != NSERROR_OK)
- LOG("Error in callback: %d", error);
+ NSLOG(netsurf, INFO, "Error in callback: %d", error);
}
/**
@@ -566,7 +566,8 @@ void hlcache_finalise(void)
num_contents++;
}
- LOG("%d contents remain before cache drain", num_contents);
+ NSLOG(netsurf, INFO, "%d contents remain before cache drain",
+ num_contents);
/* Drain cache */
do {
@@ -580,14 +581,17 @@ void hlcache_finalise(void)
}
} while (num_contents > 0 && num_contents != prev_contents);
- LOG("%d contents remaining:", num_contents);
+ NSLOG(netsurf, INFO, "%d contents remaining:", num_contents);
for (entry = hlcache->content_list; entry != NULL; entry = entry->next) {
hlcache_handle entry_handle = { entry, NULL, NULL };
if (entry->content != NULL) {
- LOG(" %p : %s (%d users)", entry, nsurl_access(hlcache_handle_get_url(&entry_handle)), content_count_users(entry->content));
+ NSLOG(netsurf, INFO, " %p : %s (%d users)",
+ entry,
+ nsurl_access(hlcache_handle_get_url(&entry_handle)),
+ content_count_users(entry->content));
} else {
- LOG(" %p", entry);
+ NSLOG(netsurf, INFO, " %p", entry);
}
}
@@ -615,12 +619,13 @@ void hlcache_finalise(void)
hlcache->retrieval_ctx_ring = NULL;
}
- LOG("hit/miss %d/%d", hlcache->hit_count, hlcache->miss_count);
+ NSLOG(netsurf, INFO, "hit/miss %d/%d", hlcache->hit_count,
+ hlcache->miss_count);
free(hlcache);
hlcache = NULL;
- LOG("Finalising low-level cache");
+ NSLOG(netsurf, INFO, "Finalising low-level cache");
llcache_finalise();
}
diff --git a/content/llcache.c b/content/llcache.c
index eb300534d..b81aba84f 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -1331,13 +1331,13 @@ llcache_serialise_metadata(llcache_object *object,
overflow:
/* somehow we overflowed the buffer - hth? */
- LOG("Overflowed metadata buffer");
+ NSLOG(netsurf, INFO, "Overflowed metadata buffer");
free(data);
return NSERROR_INVALID;
operror:
/* output error */
- LOG("Output error");
+ NSLOG(netsurf, INFO, "Output error");
free(data);
return NSERROR_INVALID;
}
@@ -1374,7 +1374,7 @@ llcache_process_metadata(llcache_object *object)
size_t num_headers;
size_t hloop;
- LOG("Retrieving metadata");
+ NSLOG(netsurf, INFO, "Retrieving metadata");
/* attempt to retrieve object metadata from the backing store */
res = guit->llcache->fetch(object->url,
@@ -1385,7 +1385,7 @@ llcache_process_metadata(llcache_object *object)
return res;
}
- LOG("Processing retrieved data");
+ NSLOG(netsurf, INFO, "Processing retrieved data");
/* metadata line 1 is the url the metadata referrs to */
line = 1;
@@ -1408,8 +1408,8 @@ llcache_process_metadata(llcache_object *object)
* by simply skipping caching of this object.
*/
- LOG("Got metadata for %s instead of %s",
- nsurl_access(metadataurl), nsurl_access(object->url));
+ NSLOG(netsurf, INFO, "Got metadata for %s instead of %s",
+ nsurl_access(metadataurl), nsurl_access(object->url));
nsurl_unref(metadataurl);
@@ -1502,7 +1502,8 @@ llcache_process_metadata(llcache_object *object)
return NSERROR_OK;
format_error:
- LOG("metadata error on line %d error code %d\n", line, res);
+ NSLOG(netsurf, INFO, "metadata error on line %d error code %d\n",
+ line, res);
guit->llcache->release(object->url, BACKING_STORE_META);
return res;
@@ -1898,7 +1899,7 @@ static nserror llcache_fetch_redirect(llcache_object *object,
/* Forcibly stop redirecting if we've followed too many redirects */
#define REDIRECT_LIMIT 10
if (object->fetch.redirect_count > REDIRECT_LIMIT) {
- LOG("Too many nested redirects");
+ NSLOG(netsurf, INFO, "Too many nested redirects");
event.type = LLCACHE_EVENT_ERROR;
event.data.msg = messages_get("BadRedirect");
@@ -2493,8 +2494,10 @@ static void llcache_persist_slowcheck(void *p)
total_bandwidth = (llcache->total_written * 1000) / llcache->total_elapsed;
if (total_bandwidth < llcache->minimum_bandwidth) {
- LOG("Current bandwidth %" PRIu64 " less than minimum %" PRIsizet,
- total_bandwidth, llcache->minimum_bandwidth);
+ NSLOG(netsurf, INFO,
+ "Current bandwidth %"PRIu64" less than minimum %"PRIsizet,
+ total_bandwidth,
+ llcache->minimum_bandwidth);
guit->llcache->finalise();
}
}
@@ -2550,7 +2553,7 @@ static void llcache_persist(void *p)
* (bandwidth) for this run being exceeded.
*/
if (total_elapsed > llcache->time_quantum) {
- LOG("Overran timeslot");
+ NSLOG(netsurf, INFO, "Overran timeslot");
/* writeout has exhausted the available time.
* Either the writeout is slow or the last
* object was very large.
@@ -2920,12 +2923,14 @@ static nserror llcache_object_notify_users(llcache_object *object)
#ifdef LLCACHE_TRACE
if (handle->state != objstate) {
if (emitted_notify == false) {
- LOG("Notifying users of %p", object);
+ NSLOG(netsurf, INFO, "Notifying users of %p",
+ object);
emitted_notify = true;
}
- LOG("User %p state: %d Object state: %d", user,
- handle->state, objstate);
+ NSLOG(netsurf, INFO,
+ "User %p state: %d Object state: %d", user,
+ handle->state, objstate);
}
#endif
@@ -3364,7 +3369,8 @@ llcache_initialise(const struct llcache_parameters *prm)
llcache->fetch_attempts = prm->fetch_attempts;
llcache->all_caught_up = true;
- LOG("llcache initialising with a limit of %d bytes", llcache->limit);
+ NSLOG(netsurf, INFO, "llcache initialising with a limit of %d bytes",
+ llcache->limit);
/* backing store initialisation */
return guit->llcache->initialise(&prm->store);
@@ -3427,10 +3433,11 @@ void llcache_finalise(void)
llcache->total_elapsed;
}
- LOG("Backing store wrote %"PRIu64" bytes in %"PRIu64" ms "
- "(average %"PRIu64" bytes/second)",
- llcache->total_written, llcache->total_elapsed,
- total_bandwidth);
+ NSLOG(netsurf, INFO,
+ "Backing store wrote %"PRIu64" bytes in %"PRIu64" ms ""(average %"PRIu64" bytes/second)",
+ llcache->total_written,
+ llcache->total_elapsed,
+ total_bandwidth);
free(llcache);
llcache = NULL;
diff --git a/content/urldb.c b/content/urldb.c
index 313ec316d..add2a1d80 100644
--- a/content/urldb.c
+++ b/content/urldb.c
@@ -662,7 +662,8 @@ static bool urldb__host_is_ip_address(const char *host)
c[slash - host] = '\0';
sane_host = c;
host_len = slash - host;
- LOG("WARNING: called with non-host '%s'", host);
+ NSLOG(netsurf, INFO, "WARNING: called with non-host '%s'",
+ host);
}
if (strspn(sane_host, "0123456789abcdefABCDEF[].:") < host_len)
@@ -1292,7 +1293,7 @@ urldb_match_path(const struct path_data *parent,
assert(parent->segment == NULL);
if (path[0] != '/') {
- LOG("path is %s", path);
+ NSLOG(netsurf, INFO, "path is %s", path);
}
assert(path[0] == '/');
@@ -1422,12 +1423,14 @@ static void urldb_dump_paths(struct path_data *parent)
do {
if (p->segment != NULL) {
- LOG("\t%s : %u", lwc_string_data(p->scheme), p->port);
+ NSLOG(netsurf, INFO, "\t%s : %u",
+ lwc_string_data(p->scheme), p->port);
- LOG("\t\t'%s'", p->segment);
+ NSLOG(netsurf, INFO, "\t\t'%s'", p->segment);
for (i = 0; i != p->frag_cnt; i++) {
- LOG("\t\t\t#%s", p->fragment[i]);
+ NSLOG(netsurf, INFO, "\t\t\t#%s",
+ p->fragment[i]);
}
}
@@ -1457,10 +1460,10 @@ static void urldb_dump_hosts(struct host_part *parent)
struct host_part *h;
if (parent->part) {
- LOG("%s", parent->part);
+ NSLOG(netsurf, INFO, "%s", parent->part);
- LOG("\t%s invalid SSL certs",
- parent->permit_invalid_certs ? "Permits" : "Denies");
+ NSLOG(netsurf, INFO, "\t%s invalid SSL certs",
+ parent->permit_invalid_certs ? "Permits" : "Denies");
}
/* Dump path data */
@@ -1512,7 +1515,7 @@ static void urldb_dump_search(struct search_node *parent, int depth)
}
s[i]= 0;
- LOG("%s", s);
+ NSLOG(netsurf, INFO, "%s", s);
urldb_dump_search(parent->right, depth + 1);
}
@@ -2866,14 +2869,15 @@ nserror urldb_load(const char *filename)
assert(filename);
- LOG("Loading URL file %s", filename);
+ NSLOG(netsurf, INFO, "Loading URL file %s", filename);
if (url_bloom == NULL)
url_bloom = bloom_create(BLOOM_SIZE);
fp = fopen(filename, "r");
if (!fp) {
- LOG("Failed to open file '%s' for reading", filename);
+ NSLOG(netsurf, INFO, "Failed to open file '%s' for reading",
+ filename);
return NSERROR_NOT_FOUND;
}
@@ -2884,12 +2888,12 @@ nserror urldb_load(const char *filename)
version = atoi(s);
if (version < MIN_URL_FILE_VERSION) {
- LOG("Unsupported URL file version.");
+ NSLOG(netsurf, INFO, "Unsupported URL file version.");
fclose(fp);
return NSERROR_INVALID;
}
if (version > URL_FILE_VERSION) {
- LOG("Unknown URL file version.");
+ NSLOG(netsurf, INFO, "Unknown URL file version.");
fclose(fp);
return NSERROR_INVALID;
}
@@ -2919,13 +2923,13 @@ nserror urldb_load(const char *filename)
/* no URLs => try next host */
if (urls == 0) {
- LOG("No URLs for '%s'", host);
+ NSLOG(netsurf, INFO, "No URLs for '%s'", host);
continue;
}
h = urldb_add_host(host);
if (!h) {
- LOG("Failed adding host: '%s'", host);
+ NSLOG(netsurf, INFO, "Failed adding host: '%s'", host);
fclose(fp);
return NSERROR_NOMEM;
}
@@ -2976,7 +2980,8 @@ nserror urldb_load(const char *filename)
* Need a nsurl_save too.
*/
if (nsurl_create(url, &nsurl) != NSERROR_OK) {
- LOG("Failed inserting '%s'", url);
+ NSLOG(netsurf, INFO, "Failed inserting '%s'",
+ url);
fclose(fp);
return NSERROR_NOMEM;
}
@@ -2989,7 +2994,8 @@ nserror urldb_load(const char *filename)
/* Copy and merge path/query strings */
if (nsurl_get(nsurl, NSURL_PATH | NSURL_QUERY,
&path_query, &len) != NSERROR_OK) {
- LOG("Failed inserting '%s'", url);
+ NSLOG(netsurf, INFO, "Failed inserting '%s'",
+ url);
fclose(fp);
return NSERROR_NOMEM;
}
@@ -3000,7 +3006,8 @@ nserror urldb_load(const char *filename)
p = urldb_add_path(scheme_lwc, port, h, path_query,
fragment_lwc, nsurl);
if (!p) {
- LOG("Failed inserting '%s'", url);
+ NSLOG(netsurf, INFO, "Failed inserting '%s'",
+ url);
fclose(fp);
return NSERROR_NOMEM;
}
@@ -3044,7 +3051,7 @@ nserror urldb_load(const char *filename)
}
fclose(fp);
- LOG("Successfully loaded URL file");
+ NSLOG(netsurf, INFO, "Successfully loaded URL file");
#undef MAXIMUM_URL_LENGTH
return NSERROR_OK;
@@ -3060,7 +3067,8 @@ nserror urldb_save(const char *filename)
fp = fopen(filename, "w");
if (!fp) {
- LOG("Failed to open file '%s' for writing", filename);
+ NSLOG(netsurf, INFO, "Failed to open file '%s' for writing",
+ filename);
return NSERROR_SAVE_FAILED;
}
@@ -3472,7 +3480,7 @@ bool urldb_set_thumbnail(nsurl *url, struct bitmap *bitmap)
return false;
}
- LOG("Setting bitmap on %s", nsurl_access(url));
+ NSLOG(netsurf, INFO, "Setting bitmap on %s", nsurl_access(url));
if ((p->thumb) && (p->thumb != bitmap)) {
guit->bitmap->destroy(p->thumb);
@@ -3754,7 +3762,8 @@ bool urldb_set_cookie(const char *header, nsurl *url, nsurl *referer)
}
suffix = nspsl_getpublicsuffix(dot);
if (suffix == NULL) {
- LOG("domain %s was a public suffix domain", dot);
+ NSLOG(netsurf, INFO,
+ "domain %s was a public suffix domain", dot);
urldb_free_cookie(c);
goto error;
}
@@ -4161,7 +4170,7 @@ void urldb_load_cookies(const char *filename)
for (; *p && *p != '\t'; p++) \
; /* do nothing */ \
if (p >= end) { \
- LOG("Overran input"); \
+ NSLOG(netsurf, INFO, "Overran input"); \
continue; \
} \
*p++ = '\0'; \
@@ -4171,7 +4180,7 @@ void urldb_load_cookies(const char *filename)
for (; *p && *p == '\t'; p++) \
; /* do nothing */ \
if (p >= end) { \
- LOG("Overran input"); \
+ NSLOG(netsurf, INFO, "Overran input"); \
continue; \
} \
}
@@ -4200,7 +4209,8 @@ void urldb_load_cookies(const char *filename)
if (loaded_cookie_file_version <
MIN_COOKIE_FILE_VERSION) {
- LOG("Unsupported Cookie file version");
+ NSLOG(netsurf, INFO,
+ "Unsupported Cookie file version");
break;
}