From 75018632a9b953aafeae6f4e8aea607fd1d89dca Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 6 Sep 2017 18:28:12 +0100 Subject: [PATCH] Use coccinelle to change logging macro calls in c files for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done @@ expression E; @@ -LOG(E); +NSLOG(netsurf, INFO, E); @@ expression E, E1; @@ -LOG(E, E1); +NSLOG(netsurf, INFO, E, E1); @@ expression E, E1, E2; @@ -LOG(E, E1, E2); +NSLOG(netsurf, INFO, E, E1, E2); @@ expression E, E1, E2, E3; @@ -LOG(E, E1, E2, E3); +NSLOG(netsurf, INFO, E, E1, E2, E3); @@ expression E, E1, E2, E3, E4; @@ -LOG(E, E1, E2, E3, E4); +NSLOG(netsurf, INFO, E, E1, E2, E3, E4); @@ expression E, E1, E2, E3, E4, E5; @@ -LOG(E, E1, E2, E3, E4, E5); +NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5); @@ expression E, E1, E2, E3, E4, E5, E6; @@ -LOG(E, E1, E2, E3, E4, E5, E6); +NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6); @@ expression E, E1, E2, E3, E4, E5, E6, E7; @@ -LOG(E, E1, E2, E3, E4, E5, E6, E7); +NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7); --- content/content.c | 29 ++- content/fetch.c | 15 +- content/fetchers/curl.c | 80 ++++--- content/fetchers/data.c | 17 +- content/fetchers/resource.c | 6 +- content/fs_backing_store.c | 225 +++++++++++-------- content/handlers/css/css.c | 15 +- content/handlers/css/hints.c | 2 +- content/handlers/css/select.c | 17 +- content/handlers/image/ico.c | 8 +- content/handlers/image/image_cache.c | 110 +++++---- content/handlers/image/jpeg.c | 4 +- content/handlers/image/nssprite.c | 4 +- content/handlers/image/png.c | 15 +- content/handlers/image/rsvg.c | 17 +- content/handlers/javascript/duktape/dukky.c | 131 ++++++----- content/hlcache.c | 19 +- content/llcache.c | 45 ++-- content/urldb.c | 60 ++--- desktop/browser.c | 43 ++-- desktop/browser_history.c | 7 +- desktop/cookie_manager.c | 11 +- desktop/font_haru.c | 24 +- desktop/frames.c | 6 +- desktop/global_history.c | 15 +- desktop/hotlist.c | 27 ++- desktop/knockout.c | 8 +- desktop/mouse.c | 2 +- desktop/netsurf.c | 30 +-- desktop/print.c | 6 +- desktop/save_complete.c | 11 +- desktop/save_pdf.c | 43 ++-- desktop/save_text.c | 8 +- desktop/searchweb.c | 14 +- desktop/sslcert_viewer.c | 8 +- desktop/textarea.c | 29 +-- desktop/treeview.c | 19 +- frontends/amiga/arexx.c | 2 +- frontends/amiga/bitmap.c | 12 +- frontends/amiga/cookies.c | 2 +- frontends/amiga/corewindow.c | 5 +- frontends/amiga/drag.c | 3 +- frontends/amiga/dt_anim.c | 14 +- frontends/amiga/dt_picture.c | 6 +- frontends/amiga/dt_sound.c | 17 +- frontends/amiga/filetype.c | 8 +- frontends/amiga/font.c | 12 +- frontends/amiga/font_bullet.c | 21 +- frontends/amiga/font_cache.c | 14 +- frontends/amiga/font_diskfont.c | 4 +- frontends/amiga/font_scan.c | 24 +- frontends/amiga/gui.c | 79 ++++--- frontends/amiga/gui_menu.c | 3 +- frontends/amiga/history.c | 2 +- frontends/amiga/history_local.c | 2 +- frontends/amiga/hotlist.c | 2 +- frontends/amiga/memory.c | 73 +++--- frontends/amiga/misc.c | 2 +- frontends/amiga/os3support.c | 18 +- frontends/amiga/plotters.c | 29 ++- frontends/amiga/plugin_hack.c | 20 +- frontends/amiga/schedule.c | 11 +- frontends/amiga/selectmenu.c | 3 +- frontends/amiga/sslcert.c | 2 +- frontends/atari/bitmap.c | 32 +-- frontends/atari/certview.c | 16 +- frontends/atari/cookies.c | 15 +- frontends/atari/ctxmenu.c | 7 +- frontends/atari/deskmenu.c | 64 +++--- frontends/atari/download.c | 14 +- frontends/atari/filetype.c | 4 +- frontends/atari/findfile.c | 18 +- frontends/atari/gui.c | 55 ++--- frontends/atari/history.c | 15 +- frontends/atari/hotlist.c | 21 +- frontends/atari/osspec.c | 6 +- frontends/atari/plot/font_freetype.c | 23 +- frontends/atari/plot/font_internal.c | 2 +- frontends/atari/plot/font_vdi.c | 2 +- frontends/atari/plot/plot.c | 5 +- frontends/atari/rootwin.c | 45 ++-- frontends/atari/schedule.c | 25 ++- frontends/atari/search.c | 12 +- frontends/atari/settings.c | 6 +- frontends/atari/statusbar.c | 4 +- frontends/atari/toolbar.c | 15 +- frontends/atari/treeview.c | 6 +- frontends/atari/verify_ssl.c | 8 +- frontends/framebuffer/bitmap.c | 11 +- frontends/framebuffer/clipboard.c | 4 +- frontends/framebuffer/convert_font.c | 198 ++++++++-------- frontends/framebuffer/fbtk/event.c | 4 +- frontends/framebuffer/fbtk/fbtk.c | 22 +- frontends/framebuffer/fbtk/scroll.c | 4 +- frontends/framebuffer/fetch.c | 2 +- frontends/framebuffer/font_freetype.c | 19 +- frontends/framebuffer/framebuffer.c | 15 +- frontends/framebuffer/gui.c | 39 ++-- frontends/framebuffer/schedule.c | 6 +- frontends/gtk/cookies.c | 7 +- frontends/gtk/corewindow.c | 4 +- frontends/gtk/download.c | 2 +- frontends/gtk/fetch.c | 3 +- frontends/gtk/gdk.c | 2 +- frontends/gtk/global_history.c | 7 +- frontends/gtk/gui.c | 65 +++--- frontends/gtk/hotlist.c | 7 +- frontends/gtk/layout_pango.c | 4 +- frontends/gtk/local_history.c | 2 +- frontends/gtk/login.c | 2 +- frontends/gtk/plotters.c | 4 +- frontends/gtk/preferences.c | 11 +- frontends/gtk/print.c | 28 ++- frontends/gtk/resources.c | 50 +++-- frontends/gtk/scaffolding.c | 33 +-- frontends/gtk/schedule.c | 14 +- frontends/gtk/ssl_cert.c | 2 +- frontends/gtk/tabs.c | 8 +- frontends/gtk/throbber.c | 6 +- frontends/gtk/toolbar.c | 5 +- frontends/gtk/viewdata.c | 23 +- frontends/gtk/window.c | 27 +-- frontends/monkey/browser.c | 2 +- frontends/monkey/dispatch.c | 2 +- frontends/monkey/filetype.c | 3 +- frontends/monkey/main.c | 8 +- frontends/monkey/schedule.c | 7 +- frontends/riscos/401login.c | 5 +- frontends/riscos/bitmap.c | 32 ++- frontends/riscos/buffer.c | 36 ++- frontends/riscos/configure.c | 32 ++- frontends/riscos/configure/con_language.c | 6 +- frontends/riscos/configure/con_theme.c | 23 +- frontends/riscos/content-handlers/artworks.c | 32 ++- frontends/riscos/content-handlers/draw.c | 6 +- frontends/riscos/content-handlers/sprite.c | 5 +- frontends/riscos/cookies.c | 4 +- frontends/riscos/corewindow.c | 97 ++++---- frontends/riscos/dialog.c | 53 +++-- frontends/riscos/download.c | 152 +++++++++---- frontends/riscos/filetype.c | 37 +-- frontends/riscos/font.c | 75 ++++--- frontends/riscos/global_history.c | 4 +- frontends/riscos/gui.c | 116 ++++++---- frontends/riscos/gui/button_bar.c | 30 ++- frontends/riscos/gui/progress_bar.c | 18 +- frontends/riscos/gui/status_bar.c | 62 +++-- frontends/riscos/gui/throbber.c | 11 +- frontends/riscos/gui/url_bar.c | 48 ++-- frontends/riscos/help.c | 22 +- frontends/riscos/hotlist.c | 7 +- frontends/riscos/iconbar.c | 6 +- frontends/riscos/image.c | 20 +- frontends/riscos/local_history.c | 47 ++-- frontends/riscos/menus.c | 31 ++- frontends/riscos/message.c | 8 +- frontends/riscos/mouse.c | 5 +- frontends/riscos/plotters.c | 104 +++++---- frontends/riscos/print.c | 77 +++++-- frontends/riscos/query.c | 21 +- frontends/riscos/save.c | 116 +++++++--- frontends/riscos/save_draw.c | 12 +- frontends/riscos/schedule.c | 2 +- frontends/riscos/sslcert.c | 36 +-- frontends/riscos/textarea.c | 127 +++++++---- frontends/riscos/textselection.c | 38 ++-- frontends/riscos/theme.c | 44 ++-- frontends/riscos/theme_install.c | 5 +- frontends/riscos/toolbar.c | 48 ++-- frontends/riscos/ucstables.c | 7 +- frontends/riscos/uri.c | 6 +- frontends/riscos/url_complete.c | 66 ++++-- frontends/riscos/url_protocol.c | 19 +- frontends/riscos/wimp.c | 135 +++++++---- frontends/riscos/wimp_event.c | 76 +++++-- frontends/riscos/window.c | 193 ++++++++++------ frontends/windows/about.c | 8 +- frontends/windows/bitmap.c | 32 +-- frontends/windows/corewindow.c | 10 +- frontends/windows/download.c | 8 +- frontends/windows/drawable.c | 30 +-- frontends/windows/filetype.c | 2 +- frontends/windows/findfile.c | 4 +- frontends/windows/gui.c | 4 +- frontends/windows/main.c | 13 +- frontends/windows/plot.c | 18 +- frontends/windows/prefs.c | 3 +- frontends/windows/schedule.c | 6 +- frontends/windows/ssl_cert.c | 11 +- frontends/windows/window.c | 84 ++++--- render/box.c | 4 +- render/box_construct.c | 2 +- render/box_normalise.c | 27 ++- render/box_textarea.c | 4 +- render/form.c | 142 ++++++++---- render/html.c | 71 +++--- render/html_css.c | 40 ++-- render/html_css_fetcher.c | 11 +- render/html_interaction.c | 2 +- render/html_object.c | 17 +- render/html_script.c | 49 ++-- render/imagemap.c | 24 +- render/layout.c | 97 +++++--- render/table.c | 7 +- render/textplain.c | 4 +- test/urldbtest.c | 13 +- utils/filename.c | 32 ++- utils/hashtable.c | 10 +- utils/idna.c | 38 +++- utils/messages.c | 25 ++- utils/nsoption.c | 10 +- utils/nsurl/nsurl.c | 6 +- utils/nsurl/parse.c | 27 +-- utils/useragent.c | 3 +- utils/utf8.c | 5 +- 215 files changed, 3497 insertions(+), 2170 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(¶ms, &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; } diff --git a/desktop/browser.c b/desktop/browser.c index 8d57a2ab5..6cadc54ac 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -171,7 +171,7 @@ browser_window_redraw(struct browser_window *bw, nserror res; if (bw == NULL) { - LOG("NULL browser window"); + NSLOG(netsurf, INFO, "NULL browser window"); return false; } @@ -336,7 +336,7 @@ browser_window_redraw(struct browser_window *bw, bool browser_window_redraw_ready(struct browser_window *bw) { if (bw == NULL) { - LOG("NULL browser window"); + NSLOG(netsurf, INFO, "NULL browser window"); return false; } else if (bw->current_content != NULL) { /* Can't render locked contents */ @@ -415,7 +415,8 @@ void browser_window_set_position(struct browser_window *bw, int x, int y) bw->x = x; bw->y = y; } else { - LOG("Asked to set position of front end window."); + NSLOG(netsurf, INFO, + "Asked to set position of front end window."); assert(0); } } @@ -811,7 +812,7 @@ nserror browser_window_debug(struct browser_window *bw, enum content_debug op) static bool slow_script(void *ctx) { static int count = 0; - LOG("Continuing execution %d", count); + NSLOG(netsurf, INFO, "Continuing execution %d", count); count++; if (count > 1) { count = 0; @@ -982,11 +983,12 @@ browser_window_download(struct browser_window *bw, /* no internal handler for this type, call out to frontend */ error = guit->misc->launch_url(url); } else if (error != NSERROR_OK) { - LOG("Failed to fetch download: %d", error); + NSLOG(netsurf, INFO, "Failed to fetch download: %d", error); } else { error = download_context_create(l, root->window); if (error != NSERROR_OK) { - LOG("Failed creating download context: %d", error); + NSLOG(netsurf, INFO, + "Failed creating download context: %d", error); llcache_handle_abort(l); llcache_handle_release(l); } @@ -1114,7 +1116,8 @@ browser_window_favicon_callback(hlcache_handle *c, error = nsurl_create("resource:favicon.ico", &nsurl); if (error != NSERROR_OK) { - LOG("Unable to create default location url"); + NSLOG(netsurf, INFO, + "Unable to create default location url"); } else { hlcache_handle_retrieve(nsurl, HLCACHE_RETRIEVE_SNIFF_TYPE, @@ -1204,7 +1207,8 @@ browser_window_update_favicon(hlcache_handle *c, error = nsurl_create("resource:favicon.ico", &nsurl); } if (error != NSERROR_OK) { - LOG("Unable to create default location url"); + NSLOG(netsurf, INFO, + "Unable to create default location url"); return; } } else { @@ -1212,9 +1216,11 @@ browser_window_update_favicon(hlcache_handle *c, } if (link == NULL) { - LOG("fetching general favicon from '%s'", nsurl_access(nsurl)); + NSLOG(netsurf, INFO, "fetching general favicon from '%s'", + nsurl_access(nsurl)); } else { - LOG("fetching favicon rel:%s '%s'", lwc_string_data(link->rel), nsurl_access(nsurl)); + NSLOG(netsurf, INFO, "fetching favicon rel:%s '%s'", + lwc_string_data(link->rel), nsurl_access(nsurl)); } hlcache_handle_retrieve(nsurl, HLCACHE_RETRIEVE_SNIFF_TYPE, @@ -1811,7 +1817,7 @@ static void browser_window_destroy_internal(struct browser_window *bw) { assert(bw); - LOG("Destroying window"); + NSLOG(netsurf, INFO, "Destroying window"); if (bw->children != NULL || bw->iframes != NULL) { browser_window_destroy_children(bw); @@ -1831,7 +1837,8 @@ static void browser_window_destroy_internal(struct browser_window *bw) /* The ugly cast here is so the reformat function can be * passed a gui window pointer in its API rather than void* */ - LOG("Clearing reformat schedule for browser window %p", bw); + NSLOG(netsurf, INFO, + "Clearing reformat schedule for browser window %p", bw); guit->misc->schedule(-1, scheduled_reformat, bw); /* If this brower window is not the root window, and has focus, unset @@ -1911,7 +1918,8 @@ static void browser_window_destroy_internal(struct browser_window *bw) free(bw->name); free(bw->status.text); bw->status.text = NULL; - LOG("Status text cache match:miss %d:%d", bw->status.match, bw->status.miss); + NSLOG(netsurf, INFO, "Status text cache match:miss %d:%d", + bw->status.match, bw->status.miss); } /** @@ -2004,14 +2012,14 @@ browser_window_navigate(struct browser_window *bw, assert(bw); assert(url); - LOG("bw %p, url %s", bw, nsurl_access(url)); + NSLOG(netsurf, INFO, "bw %p, url %s", bw, nsurl_access(url)); /* don't allow massively nested framesets */ for (cur = bw; cur->parent; cur = cur->parent) { depth++; } if (depth > FRAME_DEPTH) { - LOG("frame depth too high."); + NSLOG(netsurf, INFO, "frame depth too high."); return NSERROR_FRAME_DEPTH; } @@ -2103,7 +2111,7 @@ browser_window_navigate(struct browser_window *bw, browser_window_remove_caret(bw, false); browser_window_destroy_children(bw); - LOG("Loading '%s'", nsurl_access(url)); + NSLOG(netsurf, INFO, "Loading '%s'", nsurl_access(url)); browser_window_set_status(bw, messages_get("Loading")); bw->history_add = (flags & BW_NAVIGATE_HISTORY); @@ -2319,7 +2327,8 @@ void browser_window_set_dimensions(struct browser_window *bw, bw->width = width; bw->height = height; } else { - LOG("Asked to set dimensions of front end window."); + NSLOG(netsurf, INFO, + "Asked to set dimensions of front end window."); assert(0); } } diff --git a/desktop/browser_history.c b/desktop/browser_history.c index dbbc67daf..c7d010419 100644 --- a/desktop/browser_history.c +++ b/desktop/browser_history.c @@ -286,7 +286,7 @@ nserror browser_window_history_clone(const struct browser_window *existing, new_history->start = browser_window_history__clone_entry(new_history, new_history->start); if (!new_history->start) { - LOG("Insufficient memory to clone history"); + NSLOG(netsurf, INFO, "Insufficient memory to clone history"); browser_window_history_destroy(clone); clone->history = NULL; return NSERROR_NOMEM; @@ -351,7 +351,8 @@ nserror browser_window_history_add(struct browser_window *bw, * loading */ bitmap = urldb_get_thumbnail(nsurl); if (bitmap == NULL) { - LOG("Creating thumbnail for %s", nsurl_access(nsurl)); + NSLOG(netsurf, INFO, "Creating thumbnail for %s", + nsurl_access(nsurl)); bitmap = guit->bitmap->create(WIDTH, HEIGHT, BITMAP_NEW | BITMAP_CLEAR_MEMORY | BITMAP_OPAQUE); @@ -366,7 +367,7 @@ nserror browser_window_history_add(struct browser_window *bw, /* Thumbnailing failed. Ignore it * silently but clean up bitmap. */ - LOG("Thumbnail renderfailed"); + NSLOG(netsurf, INFO, "Thumbnail renderfailed"); guit->bitmap->destroy(bitmap); bitmap = NULL; } diff --git a/desktop/cookie_manager.c b/desktop/cookie_manager.c index 5429f6864..987a85c0c 100644 --- a/desktop/cookie_manager.c +++ b/desktop/cookie_manager.c @@ -718,7 +718,8 @@ static void cookie_manager_delete_entry(struct cookie_manager_entry *e) urldb_delete_cookie(domain, path, name); } else { - LOG("Delete cookie fail: ""need domain, path, and name."); + NSLOG(netsurf, INFO, + "Delete cookie fail: ""need domain, path, and name."); } } @@ -788,7 +789,7 @@ nserror cookie_manager_init(struct core_window_callback_table *cw_t, return err; } - LOG("Generating cookie manager data"); + NSLOG(netsurf, INFO, "Generating cookie manager data"); /* Init. cookie manager treeview entry fields */ err = cookie_manager_init_entry_fields(); @@ -825,7 +826,7 @@ nserror cookie_manager_init(struct core_window_callback_table *cw_t, /* Inform client of window height */ treeview_get_height(cm_ctx.tree); - LOG("Generated cookie manager data"); + NSLOG(netsurf, INFO, "Generated cookie manager data"); return NSERROR_OK; } @@ -837,7 +838,7 @@ nserror cookie_manager_fini(void) int i; nserror err; - LOG("Finalising cookie manager"); + NSLOG(netsurf, INFO, "Finalising cookie manager"); cm_ctx.built = false; @@ -860,7 +861,7 @@ nserror cookie_manager_fini(void) return err; } - LOG("Finalised cookie manager"); + NSLOG(netsurf, INFO, "Finalised cookie manager"); return err; } diff --git a/desktop/font_haru.c b/desktop/font_haru.c index caa751bcb..f92d89197 100644 --- a/desktop/font_haru.c +++ b/desktop/font_haru.c @@ -74,7 +74,10 @@ const struct font_functions haru_nsfont = { static void error_handler(HPDF_STATUS error_no, HPDF_STATUS detail_no, void *user_data) { - LOG("ERROR: in font_haru \n\terror_no=%x\n\tdetail_no=%d\n", (HPDF_UINT)error_no, (HPDF_UINT)detail_no); + NSLOG(netsurf, INFO, + "ERROR: in font_haru \n\terror_no=%x\n\tdetail_no=%d\n", + (HPDF_UINT)error_no, + (HPDF_UINT)detail_no); #ifdef FONT_HARU_DEBUG exit(1); #endif @@ -143,7 +146,9 @@ bool haru_nsfont_width(const plot_font_style_t *fstyle, *width = width_real; #ifdef FONT_HARU_DEBUG - LOG("Measuring string: %s ; Calculated width: %f %i", string_nt, width_real, *width); + NSLOG(netsurf, INFO, + "Measuring string: %s ; Calculated width: %f %i", string_nt, + width_real, *width); #endif free(string_nt); HPDF_Free(pdf); @@ -201,7 +206,11 @@ bool haru_nsfont_position_in_string(const plot_font_style_t *fstyle, *actual_x = real_width; #ifdef FONT_HARU_DEBUG - LOG("Position in string: %s at x: %i; Calculated position: %i", string_nt, x, *char_offset); + NSLOG(netsurf, INFO, + "Position in string: %s at x: %i; Calculated position: %i", + string_nt, + x, + *char_offset); #endif free(string_nt); HPDF_Free(pdf); @@ -246,7 +255,12 @@ bool haru_nsfont_split(const plot_font_style_t *fstyle, HPDF_TRUE, &real_width); #ifdef FONT_HARU_DEBUG - LOG("Splitting string: %s for width: %i ; Calculated position: %i Calculated real_width: %f", string_nt, x, *char_offset, real_width); + NSLOG(netsurf, INFO, + "Splitting string: %s for width: %i ; Calculated position: %i Calculated real_width: %f", + string_nt, + x, + *char_offset, + real_width); #endif *char_offset = offset - 1; @@ -327,7 +341,7 @@ bool haru_nsfont_apply_style(const plot_font_style_t *fstyle, strcat(font_name, "-Roman"); #ifdef FONT_HARU_DEBUG - LOG("Setting font: %s", font_name); + NSLOG(netsurf, INFO, "Setting font: %s", font_name); #endif size = fstyle->size; diff --git a/desktop/frames.c b/desktop/frames.c index 9eefefe02..e22287630 100644 --- a/desktop/frames.c +++ b/desktop/frames.c @@ -354,9 +354,11 @@ nserror browser_window_create_frameset(struct browser_window *bw, window->parent = bw; if (window->name) - LOG("Created frame '%s'", window->name); + NSLOG(netsurf, INFO, "Created frame '%s'", + window->name); else - LOG("Created frame (unnamed)"); + NSLOG(netsurf, INFO, + "Created frame (unnamed)"); } } diff --git a/desktop/global_history.c b/desktop/global_history.c index a19349f51..e6993212c 100644 --- a/desktop/global_history.c +++ b/desktop/global_history.c @@ -596,7 +596,7 @@ static nserror global_history_initialise_time(void) /* get the current time */ t = time(NULL); if (t == -1) { - LOG("time info unaviable"); + NSLOG(netsurf, INFO, "time info unaviable"); return NSERROR_UNKNOWN; } @@ -607,7 +607,7 @@ static nserror global_history_initialise_time(void) full_time->tm_hour = 0; t = mktime(full_time); if (t == -1) { - LOG("mktime failed"); + NSLOG(netsurf, INFO, "mktime failed"); return NSERROR_UNKNOWN; } @@ -729,7 +729,7 @@ nserror global_history_init(struct core_window_callback_table *cw_t, return err; } - LOG("Loading global history"); + NSLOG(netsurf, INFO, "Loading global history"); /* Init. global history treeview time */ err = global_history_initialise_time(); @@ -785,7 +785,7 @@ nserror global_history_init(struct core_window_callback_table *cw_t, /* Inform client of window height */ treeview_get_height(gh_ctx.tree); - LOG("Loaded global history"); + NSLOG(netsurf, INFO, "Loaded global history"); return NSERROR_OK; } @@ -797,7 +797,7 @@ nserror global_history_fini(void) int i; nserror err; - LOG("Finalising global history"); + NSLOG(netsurf, INFO, "Finalising global history"); gh_ctx.built = false; @@ -815,7 +815,7 @@ nserror global_history_fini(void) return err; } - LOG("Finalised global history"); + NSLOG(netsurf, INFO, "Finalised global history"); return err; } @@ -832,7 +832,8 @@ nserror global_history_add(nsurl *url) data = urldb_get_url_data(url); if (data == NULL) { - LOG("Can't add URL to history that's not present in urldb."); + NSLOG(netsurf, INFO, + "Can't add URL to history that's not present in urldb."); return NSERROR_BAD_PARAMETER; } diff --git a/desktop/hotlist.c b/desktop/hotlist.c index 0f5be77c9..13a52d0da 100644 --- a/desktop/hotlist.c +++ b/desktop/hotlist.c @@ -138,7 +138,8 @@ static nserror hotlist_save(const char *path) /* Replace any old hotlist file with the one we just saved */ if (rename(temp_path, path) != 0) { res = NSERROR_SAVE_FAILED; - LOG("Error renaming hotlist: %s.", strerror(errno)); + NSLOG(netsurf, INFO, "Error renaming hotlist: %s.", + strerror(errno)); goto cleanup; } @@ -652,20 +653,20 @@ static nserror hotlist_load_entry(dom_node *li, hotlist_load_ctx *ctx) /* The li must contain an "a" element */ a = libdom_find_first_element(li, corestring_lwc_a); if (a == NULL) { - LOG("Missing in
  • "); + NSLOG(netsurf, INFO, "Missing in
  • "); return NSERROR_INVALID; } derror = dom_node_get_text_content(a, &title1); if (derror != DOM_NO_ERR) { - LOG("No title"); + NSLOG(netsurf, INFO, "No title"); dom_node_unref(a); return NSERROR_INVALID; } derror = dom_element_get_attribute(a, corestring_dom_href, &url1); if (derror != DOM_NO_ERR || url1 == NULL) { - LOG("No URL"); + NSLOG(netsurf, INFO, "No URL"); dom_string_unref(title1); dom_node_unref(a); return NSERROR_INVALID; @@ -683,7 +684,8 @@ static nserror hotlist_load_entry(dom_node *li, hotlist_load_ctx *ctx) dom_string_unref(url1); if (err != NSERROR_OK) { - LOG("Failed normalising '%s'", dom_string_data(url1)); + NSLOG(netsurf, INFO, "Failed normalising '%s'", + dom_string_data(url1)); if (title1 != NULL) { dom_string_unref(title1); @@ -763,7 +765,8 @@ nserror hotlist_load_directory_cb(dom_node *node, void *ctx) error = dom_node_get_text_content(node, &title); if (error != DOM_NO_ERR || title == NULL) { - LOG("Empty

    or memory exhausted."); + NSLOG(netsurf, INFO, + "Empty

    or memory exhausted."); dom_string_unref(name); return NSERROR_DOM; } @@ -861,7 +864,7 @@ static nserror hotlist_load(const char *path, bool *loaded) /* Handle no path */ if (path == NULL) { - LOG("No hotlist file path provided."); + NSLOG(netsurf, INFO, "No hotlist file path provided."); return NSERROR_OK; } @@ -1283,7 +1286,7 @@ nserror hotlist_init( return err; } - LOG("Loading hotlist"); + NSLOG(netsurf, INFO, "Loading hotlist"); hl_ctx.tree = NULL; hl_ctx.built = false; @@ -1329,7 +1332,7 @@ nserror hotlist_init( * the treeview is built. */ hl_ctx.built = true; - LOG("Loaded hotlist"); + NSLOG(netsurf, INFO, "Loaded hotlist"); return NSERROR_OK; } @@ -1375,7 +1378,7 @@ nserror hotlist_fini(void) int i; nserror err; - LOG("Finalising hotlist"); + NSLOG(netsurf, INFO, "Finalising hotlist"); /* Remove any existing scheduled save callback */ guit->misc->schedule(-1, hotlist_schedule_save_cb, NULL); @@ -1384,7 +1387,7 @@ nserror hotlist_fini(void) /* Save the hotlist */ err = hotlist_save(hl_ctx.save_path); if (err != NSERROR_OK) { - LOG("Problem saving the hotlist."); + NSLOG(netsurf, INFO, "Problem saving the hotlist."); } free(hl_ctx.save_path); @@ -1403,7 +1406,7 @@ nserror hotlist_fini(void) return err; } - LOG("Finalised hotlist"); + NSLOG(netsurf, INFO, "Finalised hotlist"); return err; } diff --git a/desktop/knockout.c b/desktop/knockout.c index 7e964fc84..6dbf4ebcf 100644 --- a/desktop/knockout.c +++ b/desktop/knockout.c @@ -267,7 +267,9 @@ static nserror knockout_plot_flush(const struct redraw_context *ctx) /* debugging information */ #ifdef KNOCKOUT_DEBUG - LOG("Entries are %i/%i, %i/%i, %i/%i", knockout_entry_cur, KNOCKOUT_ENTRIES, knockout_box_cur, KNOCKOUT_BOXES, knockout_polygon_cur, KNOCKOUT_POLYGONS); + NSLOG(netsurf, INFO, "Entries are %i/%i, %i/%i, %i/%i", + knockout_entry_cur, KNOCKOUT_ENTRIES, knockout_box_cur, + KNOCKOUT_BOXES, knockout_polygon_cur, KNOCKOUT_POLYGONS); #endif for (i = 0; i < knockout_entry_cur; i++) { @@ -702,8 +704,8 @@ knockout_plot_clip(const struct redraw_context *ctx, const struct rect *clip) if (clip->x1 < clip->x0 || clip->y0 > clip->y1) { #ifdef KNOCKOUT_DEBUG - LOG("bad clip rectangle %i %i %i %i", - clip->x0, clip->y0, clip->x1, clip->y1); + NSLOG(netsurf, INFO, "bad clip rectangle %i %i %i %i", + clip->x0, clip->y0, clip->x1, clip->y1); #endif return NSERROR_BAD_SIZE; } diff --git a/desktop/mouse.c b/desktop/mouse.c index 6d22fd461..d22910582 100644 --- a/desktop/mouse.c +++ b/desktop/mouse.c @@ -30,5 +30,5 @@ */ void browser_mouse_state_dump(browser_mouse_state mouse) { - LOG("mouse state: %s %s %s %s %s %s %s %s %s %s %s %s %s %s", mouse & BROWSER_MOUSE_PRESS_1 ? "P1" : " ", mouse & BROWSER_MOUSE_PRESS_2 ? "P2" : " ", mouse & BROWSER_MOUSE_CLICK_1 ? "C1" : " ", mouse & BROWSER_MOUSE_CLICK_2 ? "C2" : " ", mouse & BROWSER_MOUSE_DOUBLE_CLICK ? "DC" : " ", mouse & BROWSER_MOUSE_TRIPLE_CLICK ? "TC" : " ", mouse & BROWSER_MOUSE_DRAG_1 ? "D1" : " ", mouse & BROWSER_MOUSE_DRAG_2 ? "D2" : " ", mouse & BROWSER_MOUSE_DRAG_ON ? "DO" : " ", mouse & BROWSER_MOUSE_HOLDING_1 ? "H1" : " ", mouse & BROWSER_MOUSE_HOLDING_2 ? "H2" : " ", mouse & BROWSER_MOUSE_MOD_1 ? "M1" : " ", mouse & BROWSER_MOUSE_MOD_2 ? "M2" : " ", mouse & BROWSER_MOUSE_MOD_3 ? "M3" : " "); + NSLOG(netsurf, INFO, "mouse state: %s %s %s %s %s %s %s %s %s %s %s %s %s %s", mouse & BROWSER_MOUSE_PRESS_1 ? "P1" : " ", mouse & BROWSER_MOUSE_PRESS_2 ? "P2" : " ", mouse & BROWSER_MOUSE_CLICK_1 ? "C1" : " ", mouse & BROWSER_MOUSE_CLICK_2 ? "C2" : " ", mouse & BROWSER_MOUSE_DOUBLE_CLICK ? "DC" : " ", mouse & BROWSER_MOUSE_TRIPLE_CLICK ? "TC" : " ", mouse & BROWSER_MOUSE_DRAG_1 ? "D1" : " ", mouse & BROWSER_MOUSE_DRAG_2 ? "D2" : " ", mouse & BROWSER_MOUSE_DRAG_ON ? "DO" : " ", mouse & BROWSER_MOUSE_HOLDING_1 ? "H1" : " ", mouse & BROWSER_MOUSE_HOLDING_2 ? "H2" : " ", mouse & BROWSER_MOUSE_MOD_1 ? "M1" : " ", mouse & BROWSER_MOUSE_MOD_2 ? "M2" : " ", mouse & BROWSER_MOUSE_MOD_3 ? "M3" : " "); } diff --git a/desktop/netsurf.c b/desktop/netsurf.c index 3baa936f3..8aa949a5a 100644 --- a/desktop/netsurf.c +++ b/desktop/netsurf.c @@ -89,7 +89,8 @@ static void netsurf_lwc_iterator(lwc_string *str, void *pw) { - LOG("[%3u] %.*s", str->refcnt, (int)lwc_string_length(str), lwc_string_data(str)); + NSLOG(netsurf, INFO, "[%3u] %.*s", str->refcnt, + (int)lwc_string_length(str), lwc_string_data(str)); } /** @@ -165,8 +166,9 @@ nserror netsurf_init(const char *store_path) if (hlcache_parameters.llcache.limit < MINIMUM_MEMORY_CACHE_SIZE) { hlcache_parameters.llcache.limit = MINIMUM_MEMORY_CACHE_SIZE; - LOG("Setting minimum memory cache size %" PRIsizet, - hlcache_parameters.llcache.limit); + NSLOG(netsurf, INFO, + "Setting minimum memory cache size %"PRIsizet, + hlcache_parameters.llcache.limit); } /* Set up the max attempts made to fetch a timing out resource */ @@ -243,19 +245,19 @@ void netsurf_exit(void) { hlcache_stop(); - LOG("Closing GUI"); + NSLOG(netsurf, INFO, "Closing GUI"); guit->misc->quit(); - LOG("Finalising JavaScript"); + NSLOG(netsurf, INFO, "Finalising JavaScript"); js_finalise(); - LOG("Finalising Web Search"); + NSLOG(netsurf, INFO, "Finalising Web Search"); search_web_finalise(); - LOG("Finalising high-level cache"); + NSLOG(netsurf, INFO, "Finalising high-level cache"); hlcache_finalise(); - LOG("Closing fetches"); + NSLOG(netsurf, INFO, "Closing fetches"); fetcher_quit(); /* dump any remaining cache entries */ @@ -264,21 +266,21 @@ void netsurf_exit(void) /* Clean up after content handlers */ content_factory_fini(); - LOG("Closing utf8"); + NSLOG(netsurf, INFO, "Closing utf8"); utf8_finalise(); - LOG("Destroying URLdb"); + NSLOG(netsurf, INFO, "Destroying URLdb"); urldb_destroy(); - LOG("Destroying System colours"); + NSLOG(netsurf, INFO, "Destroying System colours"); ns_system_colour_finalize(); - LOG("Destroying Messages"); + NSLOG(netsurf, INFO, "Destroying Messages"); messages_destroy(); corestrings_fini(); - LOG("Remaining lwc strings:"); + NSLOG(netsurf, INFO, "Remaining lwc strings:"); lwc_iterate_strings(netsurf_lwc_iterator, NULL); - LOG("Exited successfully"); + NSLOG(netsurf, INFO, "Exited successfully"); } diff --git a/desktop/print.c b/desktop/print.c index 37172b7c1..54cc5451a 100644 --- a/desktop/print.c +++ b/desktop/print.c @@ -126,8 +126,10 @@ print_apply_settings(hlcache_handle *content, struct print_settings *settings) content_reformat(content, false, page_content_width, 0); - LOG("New layout applied.New height = %d ; New width = %d ", - content_get_height(content), content_get_width(content)); + NSLOG(netsurf, INFO, + "New layout applied.New height = %d ; New width = %d ", + content_get_height(content), + content_get_width(content)); return true; } diff --git a/desktop/save_complete.c b/desktop/save_complete.c index d6fb2feb1..cd1ac53b4 100644 --- a/desktop/save_complete.c +++ b/desktop/save_complete.c @@ -168,7 +168,7 @@ static bool save_complete_save_buffer(save_complete_ctx *ctx, fp = fopen(fname, "wb"); if (fp == NULL) { free(fname); - LOG("fopen(): errno = %i", errno); + NSLOG(netsurf, INFO, "fopen(): errno = %i", errno); guit->misc->warning("SaveError", strerror(errno)); return false; } @@ -1044,7 +1044,7 @@ static bool save_complete_node_handler(dom_node *node, } else if (type == DOM_DOCUMENT_NODE) { /* Do nothing */ } else { - LOG("Unhandled node type: %d", type); + NSLOG(netsurf, INFO, "Unhandled node type: %d", type); } return true; @@ -1075,7 +1075,7 @@ static bool save_complete_save_html_document(save_complete_ctx *ctx, fp = fopen(fname, "wb"); if (fp == NULL) { free(fname); - LOG("fopen(): errno = %i", errno); + NSLOG(netsurf, INFO, "fopen(): errno = %i", errno); guit->misc->warning("SaveError", strerror(errno)); return false; } @@ -1154,7 +1154,7 @@ static bool save_complete_inventory(save_complete_ctx *ctx) fp = fopen(fname, "w"); free(fname); if (fp == NULL) { - LOG("fopen(): errno = %i", errno); + NSLOG(netsurf, INFO, "fopen(): errno = %i", errno); guit->misc->warning("SaveError", strerror(errno)); return false; } @@ -1182,7 +1182,8 @@ static nserror regcomp_wrapper(regex_t *preg, const char *regex, int cflags) if (r) { char errbuf[200]; regerror(r, preg, errbuf, sizeof errbuf); - LOG("Failed to compile regexp '%s': %s\n", regex, errbuf); + NSLOG(netsurf, INFO, "Failed to compile regexp '%s': %s\n", + regex, errbuf); return NSERROR_INIT_FAILED; } return NSERROR_OK; diff --git a/desktop/save_pdf.c b/desktop/save_pdf.c index d303eca7c..83e3d4f31 100644 --- a/desktop/save_pdf.c +++ b/desktop/save_pdf.c @@ -171,7 +171,8 @@ bool pdf_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *psty { DashPattern_e dash; #ifdef PDF_DEBUG - LOG("%d %d %d %d %f %X", x0, y0, x1, y1, page_height - y0, pstyle->fill_colour); + NSLOG(netsurf, INFO, "%d %d %d %d %f %X", x0, y0, x1, y1, + page_height - y0, pstyle->fill_colour); #endif if (pstyle->fill_type != PLOT_OP_TYPE_NONE) { @@ -262,7 +263,7 @@ bool pdf_plot_polygon(const int *p, unsigned int n, const plot_style_t *style) #ifdef PDF_DEBUG int pmaxx = p[0], pmaxy = p[1]; int pminx = p[0], pminy = p[1]; - LOG("."); + NSLOG(netsurf, INFO, "."); #endif if (n == 0) return true; @@ -281,7 +282,8 @@ bool pdf_plot_polygon(const int *p, unsigned int n, const plot_style_t *style) } #ifdef PDF_DEBUG - LOG("%d %d %d %d %f", pminx, pminy, pmaxx, pmaxy, page_height - pminy); + NSLOG(netsurf, INFO, "%d %d %d %d %f", pminx, pminy, pmaxx, pmaxy, + page_height - pminy); #endif HPDF_Page_Fill(pdf_page); @@ -294,7 +296,8 @@ bool pdf_plot_polygon(const int *p, unsigned int n, const plot_style_t *style) bool pdf_plot_clip(const struct rect *clip) { #ifdef PDF_DEBUG - LOG("%d %d %d %d", clip->x0, clip->y0, clip->x1, clip->y1); + NSLOG(netsurf, INFO, "%d %d %d %d", clip->x0, clip->y0, clip->x1, + clip->y1); #endif /*Normalize cllipping area - to prevent overflows. @@ -314,7 +317,7 @@ bool pdf_plot_text(int x, int y, const char *text, size_t length, const plot_font_style_t *fstyle) { #ifdef PDF_DEBUG - LOG(". %d %d %.*s", x, y, (int)length, text); + NSLOG(netsurf, INFO, ". %d %d %.*s", x, y, (int)length, text); #endif char *word; HPDF_Font pdf_font; @@ -347,7 +350,7 @@ bool pdf_plot_text(int x, int y, const char *text, size_t length, bool pdf_plot_disc(int x, int y, int radius, const plot_style_t *style) { #ifdef PDF_DEBUG - LOG("."); + NSLOG(netsurf, INFO, "."); #endif if (style->fill_type != PLOT_OP_TYPE_NONE) { apply_clip_and_mode(false, @@ -378,7 +381,8 @@ bool pdf_plot_disc(int x, int y, int radius, const plot_style_t *style) bool pdf_plot_arc(int x, int y, int radius, int angle1, int angle2, const plot_style_t *style) { #ifdef PDF_DEBUG - LOG("%d %d %d %d %d %X", x, y, radius, angle1, angle2, style->stroke_colour); + NSLOG(netsurf, INFO, "%d %d %d %d %d %X", x, y, radius, angle1, + angle2, style->stroke_colour); #endif /* FIXME: line width 1 is ok ? */ @@ -406,7 +410,8 @@ bool pdf_plot_bitmap_tile(int x, int y, int width, int height, HPDF_REAL max_width, max_height; #ifdef PDF_DEBUG - LOG("%d %d %d %d %p 0x%x", x, y, width, height, bitmap, bg); + NSLOG(netsurf, INFO, "%d %d %d %d %p 0x%x", x, y, width, height, + bitmap, bg); #endif if (width == 0 || height == 0) return true; @@ -483,7 +488,8 @@ HPDF_Image pdf_extract_image(struct bitmap *bitmap) rgb_buffer = (unsigned char *)malloc(3 * img_width * img_height); alpha_buffer = (unsigned char *)malloc(img_width * img_height); if (rgb_buffer == NULL || alpha_buffer == NULL) { - LOG("Not enough memory to create RGB buffer"); + NSLOG(netsurf, INFO, + "Not enough memory to create RGB buffer"); free(rgb_buffer); free(alpha_buffer); return NULL; @@ -607,7 +613,7 @@ bool pdf_plot_path(const float *p, unsigned int n, colour fill, float width, bool empty_path; #ifdef PDF_DEBUG - LOG("."); + NSLOG(netsurf, INFO, "."); #endif if (n == 0) @@ -649,7 +655,7 @@ bool pdf_plot_path(const float *p, unsigned int n, colour fill, float width, i += 7; empty_path = false; } else { - LOG("bad path command %f", p[i]); + NSLOG(netsurf, INFO, "bad path command %f", p[i]); return false; } } @@ -685,7 +691,7 @@ bool pdf_begin(struct print_settings *print_settings) HPDF_Free(pdf_doc); pdf_doc = HPDF_New(error_handler, NULL); if (!pdf_doc) { - LOG("Error creating pdf_doc"); + NSLOG(netsurf, INFO, "Error creating pdf_doc"); return false; } @@ -708,7 +714,7 @@ bool pdf_begin(struct print_settings *print_settings) pdf_page = NULL; #ifdef PDF_DEBUG - LOG("pdf_begin finishes"); + NSLOG(netsurf, INFO, "pdf_begin finishes"); #endif return true; } @@ -717,7 +723,7 @@ bool pdf_begin(struct print_settings *print_settings) bool pdf_next_page(void) { #ifdef PDF_DEBUG - LOG("pdf_next_page begins"); + NSLOG(netsurf, INFO, "pdf_next_page begins"); #endif clip_update_needed = false; if (pdf_page != NULL) { @@ -745,7 +751,7 @@ bool pdf_next_page(void) pdfw_gs_save(pdf_page); #ifdef PDF_DEBUG - LOG("%f %f", page_width, page_height); + NSLOG(netsurf, INFO, "%f %f", page_width, page_height); #endif return true; @@ -755,7 +761,7 @@ bool pdf_next_page(void) void pdf_end(void) { #ifdef PDF_DEBUG - LOG("pdf_end begins"); + NSLOG(netsurf, INFO, "pdf_end begins"); #endif clip_update_needed = false; if (pdf_page != NULL) { @@ -780,7 +786,7 @@ void pdf_end(void) else save_pdf(settings->output); #ifdef PDF_DEBUG - LOG("pdf_end finishes"); + NSLOG(netsurf, INFO, "pdf_end finishes"); #endif } @@ -819,7 +825,8 @@ nserror save_pdf(const char *path) static void error_handler(HPDF_STATUS error_no, HPDF_STATUS detail_no, void *user_data) { - LOG("ERROR:\n\terror_no=%x\n\tdetail_no=%d\n", (HPDF_UINT)error_no, (HPDF_UINT)detail_no); + NSLOG(netsurf, INFO, "ERROR:\n\terror_no=%x\n\tdetail_no=%d\n", + (HPDF_UINT)error_no, (HPDF_UINT)detail_no); #ifdef PDF_DEBUG exit(1); #endif diff --git a/desktop/save_text.c b/desktop/save_text.c index e63c96eb9..791ae9201 100644 --- a/desktop/save_text.c +++ b/desktop/save_text.c @@ -75,7 +75,8 @@ void save_as_text(struct hlcache_handle *c, char *path) free(save.block); if (ret != NSERROR_OK) { - LOG("failed to convert to local encoding, return %d", ret); + NSLOG(netsurf, INFO, + "failed to convert to local encoding, return %d", ret); return; } @@ -84,12 +85,13 @@ void save_as_text(struct hlcache_handle *c, char *path) int res = fputs(result, out); if (res < 0) { - LOG("Warning: write failed"); + NSLOG(netsurf, INFO, "Warning: write failed"); } res = fputs("\n", out); if (res < 0) { - LOG("Warning: failed writing trailing newline"); + NSLOG(netsurf, INFO, + "Warning: failed writing trailing newline"); } fclose(out); diff --git a/desktop/searchweb.c b/desktop/searchweb.c index fb7ecc082..8933fc9fa 100644 --- a/desktop/searchweb.c +++ b/desktop/searchweb.c @@ -289,13 +289,16 @@ search_web_ico_callback(hlcache_handle *ico, switch (event->type) { case CONTENT_MSG_DONE: - LOG("icon '%s' retrieved", nsurl_access(hlcache_handle_get_url(ico))); + NSLOG(netsurf, INFO, "icon '%s' retrieved", + nsurl_access(hlcache_handle_get_url(ico))); guit->search_web->provider_update(provider->name, content_get_bitmap(ico)); break; case CONTENT_MSG_ERROR: - LOG("icon %s error: %s", nsurl_access(hlcache_handle_get_url(ico)), event->data.error); + NSLOG(netsurf, INFO, "icon %s error: %s", + nsurl_access(hlcache_handle_get_url(ico)), + event->data.error); case CONTENT_MSG_ERRORCODE: hlcache_handle_release(ico); /* clear reference to released handle */ @@ -439,7 +442,8 @@ default_ico_callback(hlcache_handle *ico, switch (event->type) { case CONTENT_MSG_DONE: - LOG("default icon '%s' retrieved", nsurl_access(hlcache_handle_get_url(ico))); + NSLOG(netsurf, INFO, "default icon '%s' retrieved", + nsurl_access(hlcache_handle_get_url(ico))); /* only set to default icon if providers icon has no handle */ if (ctx->providers[search_web_ctx.current].ico_handle == NULL) { @@ -450,7 +454,9 @@ default_ico_callback(hlcache_handle *ico, break; case CONTENT_MSG_ERROR: - LOG("icon %s error: %s", nsurl_access(hlcache_handle_get_url(ico)), event->data.error); + NSLOG(netsurf, INFO, "icon %s error: %s", + nsurl_access(hlcache_handle_get_url(ico)), + event->data.error); case CONTENT_MSG_ERRORCODE: hlcache_handle_release(ico); /* clear reference to released handle */ diff --git a/desktop/sslcert_viewer.c b/desktop/sslcert_viewer.c index e7f87bd9d..f40af5968 100644 --- a/desktop/sslcert_viewer.c +++ b/desktop/sslcert_viewer.c @@ -391,7 +391,7 @@ sslcert_viewer_init(struct core_window_callback_table *cw_t, return err; } - LOG("Building certificate viewer"); + NSLOG(netsurf, INFO, "Building certificate viewer"); /* Init. certificate chain treeview entry fields */ err = sslcert_init_entry_fields(ssl_d); @@ -417,7 +417,7 @@ sslcert_viewer_init(struct core_window_callback_table *cw_t, } } - LOG("Built certificate viewer"); + NSLOG(netsurf, INFO, "Built certificate viewer"); return NSERROR_OK; } @@ -452,7 +452,7 @@ nserror sslcert_viewer_fini(struct sslcert_session_data *ssl_d) int i; nserror err; - LOG("Finalising ssl certificate viewer"); + NSLOG(netsurf, INFO, "Finalising ssl certificate viewer"); /* Destroy the treeview */ err = treeview_destroy(ssl_d->tree); @@ -470,7 +470,7 @@ nserror sslcert_viewer_fini(struct sslcert_session_data *ssl_d) return err; } - LOG("Finalised ssl certificate viewer"); + NSLOG(netsurf, INFO, "Finalised ssl certificate viewer"); return err; } diff --git a/desktop/textarea.c b/desktop/textarea.c index 65ee8b82f..1cbb767f6 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -828,7 +828,7 @@ static bool textarea_reflow_singleline(struct textarea *ta, size_t b_off, ta->lines = malloc(LINE_CHUNK_SIZE * sizeof(struct line_info)); if (ta->lines == NULL) { - LOG("malloc failed"); + NSLOG(netsurf, INFO, "malloc failed"); return false; } ta->lines_alloc_size = LINE_CHUNK_SIZE; @@ -852,7 +852,7 @@ static bool textarea_reflow_singleline(struct textarea *ta, size_t b_off, char *temp = realloc(ta->password.data, b_len + TA_ALLOC_STEP); if (temp == NULL) { - LOG("realloc failed"); + NSLOG(netsurf, INFO, "realloc failed"); return false; } @@ -936,7 +936,8 @@ static bool textarea_reflow_multiline(struct textarea *ta, if (ta->lines == NULL) { ta->lines = calloc(sizeof(struct line_info), LINE_CHUNK_SIZE); if (ta->lines == NULL) { - LOG("Failed to allocate memory for textarea lines"); + NSLOG(netsurf, INFO, + "Failed to allocate memory for textarea lines"); return false; } ta->lines_alloc_size = LINE_CHUNK_SIZE; @@ -1053,7 +1054,7 @@ static bool textarea_reflow_multiline(struct textarea *ta, (line + 2 + LINE_CHUNK_SIZE) * sizeof(struct line_info)); if (temp == NULL) { - LOG("realloc failed"); + NSLOG(netsurf, INFO, "realloc failed"); return false; } @@ -1334,7 +1335,7 @@ static bool textarea_insert_text(struct textarea *ta, const char *text, char *temp = realloc(ta->text.data, b_len + ta->text.len + TA_ALLOC_STEP); if (temp == NULL) { - LOG("realloc failed"); + NSLOG(netsurf, INFO, "realloc failed"); return false; } @@ -1484,7 +1485,7 @@ static bool textarea_replace_text_internal(struct textarea *ta, size_t b_start, rep_len + ta->text.len - (b_end - b_start) + TA_ALLOC_STEP); if (temp == NULL) { - LOG("realloc failed"); + NSLOG(netsurf, INFO, "realloc failed"); return false; } @@ -1561,7 +1562,7 @@ static bool textarea_copy_to_undo_buffer(struct textarea *ta, char *temp = realloc(undo->text.data, b_offset + len + TA_ALLOC_STEP); if (temp == NULL) { - LOG("realloc failed"); + NSLOG(netsurf, INFO, "realloc failed"); return false; } @@ -1575,7 +1576,7 @@ static bool textarea_copy_to_undo_buffer(struct textarea *ta, (undo->next_detail + 128) * sizeof(struct textarea_undo_detail)); if (temp == NULL) { - LOG("realloc failed"); + NSLOG(netsurf, INFO, "realloc failed"); return false; } @@ -1835,13 +1836,13 @@ struct textarea *textarea_create(const textarea_flags flags, flags & TEXTAREA_PASSWORD)); if (callback == NULL) { - LOG("no callback provided"); + NSLOG(netsurf, INFO, "no callback provided"); return NULL; } ret = malloc(sizeof(struct textarea)); if (ret == NULL) { - LOG("malloc failed"); + NSLOG(netsurf, INFO, "malloc failed"); return NULL; } @@ -1888,7 +1889,7 @@ struct textarea *textarea_create(const textarea_flags flags, ret->text.data = malloc(TA_ALLOC_STEP); if (ret->text.data == NULL) { - LOG("malloc failed"); + NSLOG(netsurf, INFO, "malloc failed"); free(ret); return NULL; } @@ -1900,7 +1901,7 @@ struct textarea *textarea_create(const textarea_flags flags, if (flags & TEXTAREA_PASSWORD) { ret->password.data = malloc(TA_ALLOC_STEP); if (ret->password.data == NULL) { - LOG("malloc failed"); + NSLOG(netsurf, INFO, "malloc failed"); free(ret->text.data); free(ret); return NULL; @@ -1975,7 +1976,7 @@ bool textarea_set_text(struct textarea *ta, const char *text) if (len >= ta->text.alloc) { char *temp = realloc(ta->text.data, len + TA_ALLOC_STEP); if (temp == NULL) { - LOG("realloc failed"); + NSLOG(netsurf, INFO, "realloc failed"); return false; } ta->text.data = temp; @@ -2062,7 +2063,7 @@ int textarea_get_text(struct textarea *ta, char *buf, unsigned int len) } if (len < ta->text.len) { - LOG("buffer too small"); + NSLOG(netsurf, INFO, "buffer too small"); return -1; } diff --git a/desktop/treeview.c b/desktop/treeview.c index fe3aa94c3..259ec0590 100644 --- a/desktop/treeview.c +++ b/desktop/treeview.c @@ -1601,7 +1601,7 @@ treeview_cw_attach(treeview *tree, assert(cw != NULL); if (tree->cw_t != NULL || tree->cw_h != NULL) { - LOG("Treeview already attached."); + NSLOG(netsurf, INFO, "Treeview already attached."); return NSERROR_UNKNOWN; } tree->cw_t = cw_t; @@ -1666,7 +1666,7 @@ treeview_node_expand_internal(treeview *tree, treeview_node *node) if (node->flags & TV_NFLAGS_EXPANDED) { /* What madness is this? */ - LOG("Tried to expand an expanded node."); + NSLOG(netsurf, INFO, "Tried to expand an expanded node."); return NSERROR_OK; } @@ -1824,7 +1824,7 @@ treeview_node_contract_internal(treeview *tree, treeview_node *node) if ((node->flags & TV_NFLAGS_EXPANDED) == false) { /* What madness is this? */ - LOG("Tried to contract a contracted node."); + NSLOG(netsurf, INFO, "Tried to contract a contracted node."); return NSERROR_OK; } @@ -2771,7 +2771,7 @@ static nserror treeview_move_selection(treeview *tree, struct rect *rect) break; default: - LOG("Bad drop target for move."); + NSLOG(netsurf, INFO, "Bad drop target for move."); return NSERROR_BAD_PARAMETER; } @@ -4403,7 +4403,7 @@ nserror treeview_init(void) return NSERROR_OK; } - LOG("Initialising treeview module"); + NSLOG(netsurf, INFO, "Initialising treeview module"); font_pt_size = nsoption_int(treeview_font_size); if (font_pt_size <= 0) { @@ -4434,7 +4434,7 @@ nserror treeview_init(void) tree_g.initialised++; - LOG("Initialised treeview module"); + NSLOG(netsurf, INFO, "Initialised treeview module"); return NSERROR_OK; } @@ -4450,11 +4450,12 @@ nserror treeview_fini(void) return NSERROR_OK; } else if (tree_g.initialised == 0) { - LOG("Warning: tried to finalise uninitialised treeview module"); + NSLOG(netsurf, INFO, + "Warning: tried to finalise uninitialised treeview module"); return NSERROR_OK; } - LOG("Finalising treeview module"); + NSLOG(netsurf, INFO, "Finalising treeview module"); for (i = 0; i < TREE_RES_LAST; i++) { hlcache_handle_release(treeview_res[i].c); @@ -4471,7 +4472,7 @@ nserror treeview_fini(void) tree_g.initialised--; - LOG("Finalised treeview module"); + NSLOG(netsurf, INFO, "Finalised treeview module"); return NSERROR_OK; } diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c index 7bb2f5882..9484ee92b 100644 --- a/frontends/amiga/arexx.c +++ b/frontends/amiga/arexx.c @@ -173,7 +173,7 @@ void ami_arexx_execute(char *script) if((lock = Lock(script, ACCESS_READ))) { DevNameFromLock(lock, full_script_path, 1024, DN_FULLPATH); - LOG("Executing script: %s", full_script_path); + NSLOG(netsurf, INFO, "Executing script: %s", full_script_path); ami_arexx_command(full_script_path, NULL); UnLock(lock); } diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c index 533b416fa..757b55965 100644 --- a/frontends/amiga/bitmap.c +++ b/frontends/amiga/bitmap.c @@ -161,7 +161,10 @@ static void amiga_bitmap_unmap_buffer(void *p) struct bitmap *bm = p; if((nsoption_bool(use_extmem) == true) && (bm->pixdata != NULL)) { - LOG("Unmapping ExtMem object %p for bitmap %p", bm->iextmem, bm); + NSLOG(netsurf, INFO, + "Unmapping ExtMem object %p for bitmap %p", + bm->iextmem, + bm); bm->iextmem->Unmap(bm->pixdata, bm->size); bm->pixdata = NULL; } @@ -176,7 +179,10 @@ unsigned char *amiga_bitmap_get_buffer(void *bitmap) #ifdef __amigaos4__ if(nsoption_bool(use_extmem) == true) { if(bm->pixdata == NULL) { - LOG("Mapping ExtMem object %p for bitmap %p", bm->iextmem, bm); + NSLOG(netsurf, INFO, + "Mapping ExtMem object %p for bitmap %p", + bm->iextmem, + bm); bm->pixdata = bm->iextmem->Map(NULL, bm->size, 0LL, 0); } @@ -723,7 +729,7 @@ void ami_bitmap_fini(void) static nserror bitmap_render(struct bitmap *bitmap, struct hlcache_handle *content) { #ifdef __amigaos4__ - LOG("Entering bitmap_render"); + NSLOG(netsurf, INFO, "Entering bitmap_render"); int plot_width; int plot_height; diff --git a/frontends/amiga/cookies.c b/frontends/amiga/cookies.c index fd71a9c2a..45e883fde 100644 --- a/frontends/amiga/cookies.c +++ b/frontends/amiga/cookies.c @@ -364,7 +364,7 @@ nserror ami_cookies_present(void) res = ami_cookies_create_window(ncwin); if (res != NSERROR_OK) { - LOG("SSL UI builder init failed"); + NSLOG(netsurf, INFO, "SSL UI builder init failed"); ami_utf8_free(ncwin->core.wintitle); free(ncwin); return res; diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c index 1a94dd3b2..243146a3a 100644 --- a/frontends/amiga/corewindow.c +++ b/frontends/amiga/corewindow.c @@ -315,7 +315,7 @@ static void ami_cw_redraw_queue(struct ami_corewindow *ami_cw, bool draw) if(IsMinListEmpty(ami_cw->deferred_rects)) return; if(draw == false) { - LOG("Ignoring deferred box redraw queue"); + NSLOG(netsurf, INFO, "Ignoring deferred box redraw queue"); } // else should probably show busy pointer node = (struct nsObject *)GetHead((struct List *)ami_cw->deferred_rects); @@ -378,7 +378,8 @@ ami_cw_redraw(struct ami_corewindow *ami_cw, const struct rect *restrict r) nsobj = AddObject(ami_cw->deferred_rects, AMINS_RECT); nsobj->objstruct = deferred_rect; } else { - LOG("Ignoring duplicate or subset of queued box redraw"); + NSLOG(netsurf, INFO, + "Ignoring duplicate or subset of queued box redraw"); } ami_schedule(1, ami_cw_redraw_cb, ami_cw); } diff --git a/frontends/amiga/drag.c b/frontends/amiga/drag.c index a8d3aa9f9..ec0ee3c6a 100644 --- a/frontends/amiga/drag.c +++ b/frontends/amiga/drag.c @@ -188,7 +188,8 @@ void ami_drag_save(struct Window *win) break; default: - LOG("Unsupported drag save operation %d", drag_save); + NSLOG(netsurf, INFO, + "Unsupported drag save operation %d", drag_save); break; } diff --git a/frontends/amiga/dt_anim.c b/frontends/amiga/dt_anim.c index 2493c41ee..bd049206c 100644 --- a/frontends/amiga/dt_anim.c +++ b/frontends/amiga/dt_anim.c @@ -162,7 +162,7 @@ nserror amiga_dt_anim_create(const content_handler *handler, bool amiga_dt_anim_convert(struct content *c) { - LOG("amiga_dt_anim_convert"); + NSLOG(netsurf, INFO, "amiga_dt_anim_convert"); amiga_dt_anim_content *plugin = (amiga_dt_anim_content *) c; union content_msg_data msg_data; @@ -246,7 +246,7 @@ void amiga_dt_anim_destroy(struct content *c) { amiga_dt_anim_content *plugin = (amiga_dt_anim_content *) c; - LOG("amiga_dt_anim_destroy"); + NSLOG(netsurf, INFO, "amiga_dt_anim_destroy"); if (plugin->bitmap != NULL) amiga_bitmap_destroy(plugin->bitmap); @@ -263,7 +263,7 @@ bool amiga_dt_anim_redraw(struct content *c, amiga_dt_anim_content *plugin = (amiga_dt_anim_content *) c; bitmap_flags_t flags = BITMAPF_NONE; - LOG("amiga_dt_anim_redraw"); + NSLOG(netsurf, INFO, "amiga_dt_anim_redraw"); if (data->repeat_x) flags |= BITMAPF_REPEAT_X; @@ -290,20 +290,20 @@ bool amiga_dt_anim_redraw(struct content *c, void amiga_dt_anim_open(struct content *c, struct browser_window *bw, struct content *page, struct object_params *params) { - LOG("amiga_dt_anim_open"); + NSLOG(netsurf, INFO, "amiga_dt_anim_open"); return; } void amiga_dt_anim_close(struct content *c) { - LOG("amiga_dt_anim_close"); + NSLOG(netsurf, INFO, "amiga_dt_anim_close"); return; } void amiga_dt_anim_reformat(struct content *c, int width, int height) { - LOG("amiga_dt_anim_reformat"); + NSLOG(netsurf, INFO, "amiga_dt_anim_reformat"); return; } @@ -312,7 +312,7 @@ nserror amiga_dt_anim_clone(const struct content *old, struct content **newc) amiga_dt_anim_content *plugin; nserror error; - LOG("amiga_dt_anim_clone"); + NSLOG(netsurf, INFO, "amiga_dt_anim_clone"); plugin = calloc(1, sizeof(amiga_dt_anim_content)); if (plugin == NULL) diff --git a/frontends/amiga/dt_picture.c b/frontends/amiga/dt_picture.c index 73f6c47c1..88ce1c834 100644 --- a/frontends/amiga/dt_picture.c +++ b/frontends/amiga/dt_picture.c @@ -174,7 +174,7 @@ static char *amiga_dt_picture_datatype(struct content *c) static struct bitmap *amiga_dt_picture_cache_convert(struct content *c) { - LOG("amiga_dt_picture_cache_convert"); + NSLOG(netsurf, INFO, "amiga_dt_picture_cache_convert"); union content_msg_data msg_data; UBYTE *bm_buffer; @@ -210,7 +210,7 @@ static struct bitmap *amiga_dt_picture_cache_convert(struct content *c) bool amiga_dt_picture_convert(struct content *c) { - LOG("amiga_dt_picture_convert"); + NSLOG(netsurf, INFO, "amiga_dt_picture_convert"); int width, height; char *title; @@ -256,7 +256,7 @@ nserror amiga_dt_picture_clone(const struct content *old, struct content **newc) struct content *adt; nserror error; - LOG("amiga_dt_picture_clone"); + NSLOG(netsurf, INFO, "amiga_dt_picture_clone"); adt = calloc(1, sizeof(struct content)); if (adt == NULL) diff --git a/frontends/amiga/dt_sound.c b/frontends/amiga/dt_sound.c index eda60edc1..e0f48da83 100644 --- a/frontends/amiga/dt_sound.c +++ b/frontends/amiga/dt_sound.c @@ -76,7 +76,7 @@ static const content_handler amiga_dt_sound_content_handler = { static void amiga_dt_sound_play(Object *dto) { - LOG("Playing..."); + NSLOG(netsurf, INFO, "Playing..."); IDoMethod(dto, DTM_TRIGGER, NULL, STM_PLAY, NULL); } @@ -126,7 +126,7 @@ nserror amiga_dt_sound_create(const content_handler *handler, amiga_dt_sound_content *plugin; nserror error; - LOG("amiga_dt_sound_create"); + NSLOG(netsurf, INFO, "amiga_dt_sound_create"); plugin = calloc(1, sizeof(amiga_dt_sound_content)); if (plugin == NULL) @@ -146,7 +146,7 @@ nserror amiga_dt_sound_create(const content_handler *handler, bool amiga_dt_sound_convert(struct content *c) { - LOG("amiga_dt_sound_convert"); + NSLOG(netsurf, INFO, "amiga_dt_sound_convert"); amiga_dt_sound_content *plugin = (amiga_dt_sound_content *) c; int width = 50, height = 50; @@ -180,7 +180,7 @@ void amiga_dt_sound_destroy(struct content *c) { amiga_dt_sound_content *plugin = (amiga_dt_sound_content *) c; - LOG("amiga_dt_sound_destroy"); + NSLOG(netsurf, INFO, "amiga_dt_sound_destroy"); DisposeDTObject(plugin->dto); @@ -199,7 +199,7 @@ bool amiga_dt_sound_redraw(struct content *c, }; struct rect rect; - LOG("amiga_dt_sound_redraw"); + NSLOG(netsurf, INFO, "amiga_dt_sound_redraw"); rect.x0 = data->x; rect.y0 = data->y; @@ -226,7 +226,7 @@ void amiga_dt_sound_open(struct content *c, struct browser_window *bw, amiga_dt_sound_content *plugin = (amiga_dt_sound_content *) c; struct object_param *param; - LOG("amiga_dt_sound_open"); + NSLOG(netsurf, INFO, "amiga_dt_sound_open"); plugin->immediate = false; @@ -234,7 +234,8 @@ void amiga_dt_sound_open(struct content *c, struct browser_window *bw, { do { - LOG("%s = %s", param->name, param->value); + NSLOG(netsurf, INFO, "%s = %s", param->name, + param->value); if((strcmp(param->name, "autoplay") == 0) && (strcmp(param->value, "true") == 0)) plugin->immediate = true; if((strcmp(param->name, "autoStart") == 0) && @@ -255,7 +256,7 @@ nserror amiga_dt_sound_clone(const struct content *old, struct content **newc) amiga_dt_sound_content *plugin; nserror error; - LOG("amiga_dt_sound_clone"); + NSLOG(netsurf, INFO, "amiga_dt_sound_clone"); plugin = calloc(1, sizeof(amiga_dt_sound_content)); if (plugin == NULL) diff --git a/frontends/amiga/filetype.c b/frontends/amiga/filetype.c index a0449d848..0e535de07 100644 --- a/frontends/amiga/filetype.c +++ b/frontends/amiga/filetype.c @@ -185,7 +185,7 @@ nserror ami_mime_init(const char *mimefile) struct nsObject *node; struct ami_mime_entry *mimeentry; - LOG("mimetypes file: %s", mimefile); + NSLOG(netsurf, INFO, "mimetypes file: %s", mimefile); if(ami_mime_list == NULL) ami_mime_list = NewObjList(); @@ -642,6 +642,10 @@ void ami_mime_dump(void) struct ami_mime_entry *mimeentry; while((mimeentry = ami_mime_entry_locate(NULL, AMI_MIME_MIMETYPE, &node))) { - LOG("%s DT=\"%s\" TYPE=\"%s\" CMD=\"%s\"", mimeentry->mimetype ? lwc_string_data(mimeentry->mimetype) : "", mimeentry->datatype ? lwc_string_data(mimeentry->datatype) : "", mimeentry->filetype ? lwc_string_data(mimeentry->filetype) : "", mimeentry->plugincmd ? lwc_string_data(mimeentry->plugincmd) : ""); + NSLOG(netsurf, INFO, "%s DT=\"%s\" TYPE=\"%s\" CMD=\"%s\"", + mimeentry->mimetype ? lwc_string_data(mimeentry->mimetype) : "", + mimeentry->datatype ? lwc_string_data(mimeentry->datatype) : "", + mimeentry->filetype ? lwc_string_data(mimeentry->filetype) : "", + mimeentry->plugincmd ? lwc_string_data(mimeentry->plugincmd) : ""); }; } diff --git a/frontends/amiga/font.c b/frontends/amiga/font.c index 22a0f4a4a..63172623f 100644 --- a/frontends/amiga/font.c +++ b/frontends/amiga/font.c @@ -51,7 +51,8 @@ void ami_font_setdevicedpi(int id) struct DisplayInfo dinfo; if(nsoption_bool(bitmap_fonts) == true) { - LOG("WARNING: Using diskfont.library for text. Forcing DPI to 72."); + NSLOG(netsurf, INFO, + "WARNING: Using diskfont.library for text. Forcing DPI to 72."); nsoption_set_int(screen_ydpi, 72); } @@ -79,7 +80,14 @@ void ami_font_setdevicedpi(int id) xdpi = (yres * ydpi) / xres; - LOG("XDPI = %ld, YDPI = %ld (DisplayInfo resolution %d x %d, corrected %d x %d)", xdpi, ydpi, dinfo.Resolution.x, dinfo.Resolution.y, xres, yres); + NSLOG(netsurf, INFO, + "XDPI = %ld, YDPI = %ld (DisplayInfo resolution %d x %d, corrected %d x %d)", + xdpi, + ydpi, + dinfo.Resolution.x, + dinfo.Resolution.y, + xres, + yres); } } } diff --git a/frontends/amiga/font_bullet.c b/frontends/amiga/font_bullet.c index fd41c29a2..c8ad34c04 100644 --- a/frontends/amiga/font_bullet.c +++ b/frontends/amiga/font_bullet.c @@ -361,7 +361,7 @@ static struct ami_font_cache_node *ami_font_open(const char *font, bool critical if(!nodedata->font) { - LOG("Requested font not found: %s", font); + NSLOG(netsurf, INFO, "Requested font not found: %s", font); if(critical == true) amiga_warn_user("CompError", font); free(nodedata); return NULL; @@ -369,21 +369,28 @@ static struct ami_font_cache_node *ami_font_open(const char *font, bool critical nodedata->bold = (char *)GetTagData(OT_BName, 0, nodedata->font->olf_OTagList); if(nodedata->bold) - LOG("Bold font defined for %s is %s", font, nodedata->bold); + NSLOG(netsurf, INFO, "Bold font defined for %s is %s", font, + nodedata->bold); else - LOG("Warning: No designed bold font defined for %s", font); + NSLOG(netsurf, INFO, + "Warning: No designed bold font defined for %s", font); nodedata->italic = (char *)GetTagData(OT_IName, 0, nodedata->font->olf_OTagList); if(nodedata->italic) - LOG("Italic font defined for %s is %s", font, nodedata->italic); + NSLOG(netsurf, INFO, "Italic font defined for %s is %s", + font, nodedata->italic); else - LOG("Warning: No designed italic font defined for %s", font); + NSLOG(netsurf, INFO, + "Warning: No designed italic font defined for %s", font); nodedata->bolditalic = (char *)GetTagData(OT_BIName, 0, nodedata->font->olf_OTagList); if(nodedata->bolditalic) - LOG("Bold-italic font defined for %s is %s", font, nodedata->bolditalic); + NSLOG(netsurf, INFO, "Bold-italic font defined for %s is %s", + font, nodedata->bolditalic); else - LOG("Warning: No designed bold-italic font defined for %s", font); + NSLOG(netsurf, INFO, + "Warning: No designed bold-italic font defined for %s", + font); ami_font_cache_insert(nodedata, font); return nodedata; diff --git a/frontends/amiga/font_cache.c b/frontends/amiga/font_cache.c index 3d8330979..86e2381c0 100644 --- a/frontends/amiga/font_cache.c +++ b/frontends/amiga/font_cache.c @@ -69,7 +69,10 @@ static void ami_font_cache_cleanup(struct SkipList *skiplist) SubTime(&curtime, &node->lastused); if(curtime.Seconds > 300) { - LOG("Freeing font %p not used for %ld seconds", node->skip_node.sn_Key, curtime.Seconds); + NSLOG(netsurf, INFO, + "Freeing font %p not used for %ld seconds", + node->skip_node.sn_Key, + curtime.Seconds); ami_font_bullet_close(node); RemoveSkipNode(skiplist, node->skip_node.sn_Key); } @@ -98,7 +101,10 @@ static void ami_font_cache_cleanup(struct MinList *ami_font_cache_list) SubTime(&curtime, &fnode->lastused); if(curtime.Seconds > 300) { - LOG("Freeing %s not used for %ld seconds", node->dtz_Node.ln_Name, curtime.Seconds); + NSLOG(netsurf, INFO, + "Freeing %s not used for %ld seconds", + node->dtz_Node.ln_Name, + curtime.Seconds); DelObject(node); } } while((node=nnode)); @@ -146,7 +152,7 @@ struct ami_font_cache_node *ami_font_cache_locate(const char *font) return nodedata; } - LOG("Font cache miss: %s (%lx)", font, hash); + NSLOG(netsurf, INFO, "Font cache miss: %s (%lx)", font, hash); return NULL; } @@ -180,7 +186,7 @@ void ami_font_cache_insert(struct ami_font_cache_node *nodedata, const char *fon void ami_font_cache_fini(void) { - LOG("Cleaning up font cache"); + NSLOG(netsurf, INFO, "Cleaning up font cache"); ami_schedule(-1, (void *)ami_font_cache_cleanup, ami_font_cache_list); #ifdef __amigaos4__ ami_font_cache_del_skiplist(ami_font_cache_list); diff --git a/frontends/amiga/font_diskfont.c b/frontends/amiga/font_diskfont.c index 7abc4379b..658829237 100644 --- a/frontends/amiga/font_diskfont.c +++ b/frontends/amiga/font_diskfont.c @@ -55,7 +55,7 @@ static struct TextFont *ami_font_bm_open(struct RastPort *rp, const plot_font_st (fstyle->size == prev_fstyle->size) && (fstyle->flags == prev_fstyle->flags) && (fstyle->weight == prev_fstyle->weight)) { - LOG("(using current font)"); + NSLOG(netsurf, INFO, "(using current font)"); return prev_font; } @@ -99,7 +99,7 @@ static struct TextFont *ami_font_bm_open(struct RastPort *rp, const plot_font_st snprintf(font, MAX_FONT_NAME_SIZE, "%s.font", fontname); tattr.ta_Name = font; tattr.ta_YSize = fstyle->size / FONT_SIZE_SCALE; - LOG("font: %s/%d", tattr.ta_Name, tattr.ta_YSize); + NSLOG(netsurf, INFO, "font: %s/%d", tattr.ta_Name, tattr.ta_YSize); if(prev_font != NULL) CloseFont(prev_font); diff --git a/frontends/amiga/font_scan.c b/frontends/amiga/font_scan.c index 932179e3e..cb37f97fa 100644 --- a/frontends/amiga/font_scan.c +++ b/frontends/amiga/font_scan.c @@ -255,7 +255,8 @@ static ULONG ami_font_scan_font(const char *fontname, lwc_string **glypharray) #ifdef __amigaos4__ if(EObtainInfo(AMI_OFONT_ENGINE, OT_UnicodeRanges, &unicoderanges, TAG_END) == 0) { if(unicoderanges & UCR_SURROGATES) { - LOG("%s supports UTF-16 surrogates", fontname); + NSLOG(netsurf, INFO, "%s supports UTF-16 surrogates", + fontname); if (nsoption_charp(font_surrogate) == NULL) { nsoption_set_charp(font_surrogate, (char *)strdup(fontname)); } @@ -292,10 +293,11 @@ static ULONG ami_font_scan_fonts(struct MinList *list, do { nnode = (struct nsObject *)GetSucc((struct Node *)node); ami_font_scan_gui_update(win, node->dtz_Node.ln_Name, font_num, total); - LOG("Scanning %s", node->dtz_Node.ln_Name); + NSLOG(netsurf, INFO, "Scanning %s", node->dtz_Node.ln_Name); found = ami_font_scan_font(node->dtz_Node.ln_Name, glypharray); total += found; - LOG("Found %ld new glyphs (total = %ld)", found, total); + NSLOG(netsurf, INFO, "Found %ld new glyphs (total = %ld)", + found, total); font_num++; } while((node = nnode)); @@ -344,7 +346,9 @@ static ULONG ami_font_scan_list(struct MinList *list) if(node) { node->dtz_Node.ln_Name = strdup(af[i].af_Attr.ta_Name); found++; - LOG("Added %s", af[i].af_Attr.ta_Name); + NSLOG(netsurf, INFO, + "Added %s", + af[i].af_Attr.ta_Name); } } } @@ -382,7 +386,8 @@ static ULONG ami_font_scan_load(const char *filename, lwc_string **glypharray) rargs = AllocDosObjectTags(DOS_RDARGS, TAG_DONE); if((fh = FOpen(filename, MODE_OLDFILE, 0))) { - LOG("Loading font glyph cache from %s", filename); + NSLOG(netsurf, INFO, "Loading font glyph cache from %s", + filename); while(FGets(fh, (STRPTR)&buffer, 256) != 0) { @@ -423,7 +428,8 @@ void ami_font_scan_save(const char *filename, lwc_string **glypharray) BPTR fh = 0; if((fh = FOpen(filename, MODE_NEWFILE, 0))) { - LOG("Writing font glyph cache to %s", filename); + NSLOG(netsurf, INFO, "Writing font glyph cache to %s", + filename); FPrintf(fh, "; This file is auto-generated. To re-create the cache, delete this file.\n"); FPrintf(fh, "; This file is parsed using ReadArgs() with the following template:\n"); FPrintf(fh, "; CODE/A,FONT/A\n;\n"); @@ -482,7 +488,7 @@ void ami_font_scan_init(const char *filename, bool force_scan, bool save, found = ami_font_scan_load(filename, glypharray); if(found == 0) { - LOG("Creating new font glyph cache"); + NSLOG(netsurf, INFO, "Creating new font glyph cache"); if((list = NewObjList())) { /* add preferred fonts list */ @@ -504,7 +510,7 @@ void ami_font_scan_init(const char *filename, bool force_scan, bool save, if(nsoption_bool(font_unicode_only) == false) entries += ami_font_scan_list(list); - LOG("Found %ld fonts", entries); + NSLOG(netsurf, INFO, "Found %ld fonts", entries); win = ami_font_scan_gui_open(entries); found = ami_font_scan_fonts(list, win, glypharray); @@ -517,6 +523,6 @@ void ami_font_scan_init(const char *filename, bool force_scan, bool save, } } - LOG("Initialised with %ld glyphs", found); + NSLOG(netsurf, INFO, "Initialised with %ld glyphs", found); } diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c index 44bba2d90..387c2151c 100644 --- a/frontends/amiga/gui.c +++ b/frontends/amiga/gui.c @@ -342,7 +342,9 @@ bool ami_gui_map_filename(char **remapped, const char *restrict path, } if(found == false) *remapped = strdup(file); - else LOG("Remapped %s to %s in path %s using %s", file, *remapped, path, map); + else NSLOG(netsurf, INFO, + "Remapped %s to %s in path %s using %s", file, + *remapped, path, map); free(mapfile); @@ -365,7 +367,7 @@ static bool ami_gui_check_resource(char *fullpath, const char *file) found = true; } - if(found) LOG("Found %s", fullpath); + if(found) NSLOG(netsurf, INFO, "Found %s", fullpath); free(remapped); return found; @@ -842,7 +844,7 @@ static void ami_openscreen(void) } if(screen_signal == -1) screen_signal = AllocSignal(-1); - LOG("Screen signal %d", screen_signal); + NSLOG(netsurf, INFO, "Screen signal %d", screen_signal); scrn = OpenScreenTags(NULL, /**\todo specify screen depth */ SA_DisplayID, id, @@ -918,19 +920,22 @@ static struct RDArgs *ami_gui_commandline(int *restrict argc, char ** argv, if((args = ReadArgs(template, rarray, NULL))) { if(rarray[A_URL]) { - LOG("URL %s specified on command line", - (char *)rarray[A_URL]); + NSLOG(netsurf, INFO, + "URL %s specified on command line", + (char *)rarray[A_URL]); temp_homepage_url = strdup((char *)rarray[A_URL]); /**\todo allow IDNs */ } if(rarray[A_USERSDIR]) { - LOG("USERSDIR %s specified on command line", - (char *)rarray[A_USERSDIR]); + NSLOG(netsurf, INFO, + "USERSDIR %s specified on command line", + (char *)rarray[A_USERSDIR]); users_dir = ASPrintf("%s", rarray[A_USERSDIR]); } if(rarray[A_FORCE]) { - LOG("FORCE specified on command line"); + NSLOG(netsurf, INFO, + "FORCE specified on command line"); cli_force = true; } @@ -950,7 +955,7 @@ static struct RDArgs *ami_gui_commandline(int *restrict argc, char ** argv, */ } } else { - LOG("ReadArgs failed to parse command line"); + NSLOG(netsurf, INFO, "ReadArgs failed to parse command line"); } FreeArgs(args); @@ -2790,7 +2795,9 @@ static void ami_handle_applib(void) { struct ApplicationCustomMsg *applibcustmsg = (struct ApplicationCustomMsg *)applibmsg; - LOG("Ringhio BackMsg received: %s", applibcustmsg->customMsg); + NSLOG(netsurf, INFO, + "Ringhio BackMsg received: %s", + applibcustmsg->customMsg); ami_download_parse_backmsg(applibcustmsg->customMsg); } @@ -2826,7 +2833,7 @@ void ami_get_msg(void) NULL, (unsigned int *)&signalmask) != -1) { signal = signalmask; } else { - LOG("waitselect() returned error"); + NSLOG(netsurf, INFO, "waitselect() returned error"); /* \todo Fix Ctrl-C handling. * WaitSelect() from bsdsocket.library returns -1 if the task was * signalled with a Ctrl-C. waitselect() from newlib.library does not. @@ -3035,11 +3042,13 @@ static void ami_gui_close_screen(struct Screen *scrn, BOOL locked_screen, BOOL d if(donotwait == TRUE) return; ULONG scrnsig = 1 << screen_signal; - LOG("Waiting for visitor windows to close... (signal)"); + NSLOG(netsurf, INFO, + "Waiting for visitor windows to close... (signal)"); Wait(scrnsig); while (CloseScreen(scrn) == FALSE) { - LOG("Waiting for visitor windows to close... (polling)"); + NSLOG(netsurf, INFO, + "Waiting for visitor windows to close... (polling)"); Delay(50); } @@ -3081,11 +3090,11 @@ static void gui_quit(void) ami_font_fini(); ami_help_free(); - LOG("Freeing menu items"); + NSLOG(netsurf, INFO, "Freeing menu items"); ami_ctxmenu_free(); ami_menu_free_glyphs(); - LOG("Freeing mouse pointers"); + NSLOG(netsurf, INFO, "Freeing mouse pointers"); ami_mouse_pointers_free(); ami_file_req_free(); @@ -3099,7 +3108,7 @@ static void gui_quit(void) ami_clipboard_free(); ami_gui_resources_free(); - LOG("Closing screen"); + NSLOG(netsurf, INFO, "Closing screen"); ami_gui_close_screen(scrn, locked_screen, FALSE); if(nsscreentitle) FreeVec(nsscreentitle); } @@ -3109,7 +3118,7 @@ char *ami_gui_get_cache_favicon_name(nsurl *url, bool only_if_avail) STRPTR filename = NULL; if ((filename = ASPrintf("%s/%x", current_user_faviconcache, nsurl_hash(url)))) { - LOG("favicon cache location: %s", filename); + NSLOG(netsurf, INFO, "favicon cache location: %s", filename); if (only_if_avail == true) { BPTR lock = 0; @@ -3723,7 +3732,8 @@ static nserror amiga_window_invalidate_area(struct gui_window *g, nsobj = AddObject(g->deferred_rects, AMINS_RECT); nsobj->objstruct = deferred_rect; } else { - LOG("Ignoring duplicate or subset of queued box redraw"); + NSLOG(netsurf, INFO, + "Ignoring duplicate or subset of queued box redraw"); } } ami_schedule_redraw(g->shared, false); @@ -3912,7 +3922,7 @@ gui_window_create(struct browser_window *bw, ULONG defer_layout = TRUE; ULONG idcmp_sizeverify = IDCMP_SIZEVERIFY; - LOG("Creating window"); + NSLOG(netsurf, INFO, "Creating window"); if (!scrn) ami_openscreenfirst(); @@ -4056,7 +4066,7 @@ gui_window_create(struct browser_window *bw, (strcmp(nsoption_charp(pubscreen_name), "Workbench") == 0)) iconifygadget = TRUE; - LOG("Creating menu"); + NSLOG(netsurf, INFO, "Creating menu"); struct Menu *menu = ami_gui_menu_create(g->shared); NewList(&g->shared->tab_list); @@ -4178,7 +4188,7 @@ gui_window_create(struct browser_window *bw, BitMapEnd; } - LOG("Creating window object"); + NSLOG(netsurf, INFO, "Creating window object"); g->shared->objects[OID_MAIN] = WindowObj, WA_ScreenTitle, ami_gui_get_screen_title(), @@ -4456,11 +4466,11 @@ gui_window_create(struct browser_window *bw, EndWindow; } - LOG("Opening window"); + NSLOG(netsurf, INFO, "Opening window"); g->shared->win = (struct Window *)RA_OpenWindow(g->shared->objects[OID_MAIN]); - LOG("Window opened, adding border gadgets"); + NSLOG(netsurf, INFO, "Window opened, adding border gadgets"); if(!g->shared->win) { @@ -4796,7 +4806,7 @@ static void ami_gui_window_update_box_deferred(struct gui_window *g, bool draw) if(draw == true) { ami_set_pointer(g->shared, GUI_POINTER_WAIT, false); } else { - LOG("Ignoring deferred box redraw queue"); + NSLOG(netsurf, INFO, "Ignoring deferred box redraw queue"); } node = (struct nsObject *)GetHead((struct List *)g->deferred_rects); @@ -4841,7 +4851,8 @@ bool ami_gui_window_update_box_deferred_check(struct MinList *deferred_rects, (new_rect->y0 <= rect->y0) && (new_rect->x1 >= rect->x1) && (new_rect->y1 >= rect->y1)) { - LOG("Removing queued redraw that is a subset of new box redraw"); + NSLOG(netsurf, INFO, + "Removing queued redraw that is a subset of new box redraw"); ami_memory_itempool_free(mempool, node->objstruct, sizeof(struct rect)); DelObjectNoFree(node); /* Don't return - we might find more */ @@ -5414,20 +5425,20 @@ Object *ami_gui_splash_open(void) EndWindow; if(win_obj == NULL) { - LOG("Splash window object not created"); + NSLOG(netsurf, INFO, "Splash window object not created"); return NULL; } - LOG("Attempting to open splash window..."); + NSLOG(netsurf, INFO, "Attempting to open splash window..."); win = RA_OpenWindow(win_obj); if(win == NULL) { - LOG("Splash window did not open"); + NSLOG(netsurf, INFO, "Splash window did not open"); return NULL; } if(bm_obj == NULL) { - LOG("BitMap object not created"); + NSLOG(netsurf, INFO, "BitMap object not created"); return NULL; } @@ -5489,14 +5500,14 @@ void ami_gui_splash_close(Object *win_obj) { if(win_obj == NULL) return; - LOG("Closing splash window"); + NSLOG(netsurf, INFO, "Closing splash window"); DisposeObject(win_obj); } static void gui_file_gadget_open(struct gui_window *g, struct hlcache_handle *hl, struct form_control *gadget) { - LOG("File open dialog request for %p/%p", g, gadget); + NSLOG(netsurf, INFO, "File open dialog request for %p/%p", g, gadget); if(AslRequestTags(filereq, ASLFR_Window, g->shared->win, @@ -5531,7 +5542,7 @@ static char *ami_gui_get_user_dir(STRPTR current_user) user = GetVar("user", temp, 1024, GVF_GLOBAL_ONLY); current_user = ASPrintf("%s", (user == -1) ? "Default" : temp); } - LOG("User: %s", current_user); + NSLOG(netsurf, INFO, "User: %s", current_user); if(users_dir == NULL) { users_dir = ASPrintf("%s", USERS_DIR); @@ -5583,7 +5594,7 @@ static char *ami_gui_get_user_dir(STRPTR current_user) FreeVec(users_dir); FreeVec(current_user); - LOG("User dir: %s", current_user_dir); + NSLOG(netsurf, INFO, "User dir: %s", current_user_dir); if((lock = CreateDirTree(current_user_dir))) UnLock(lock); @@ -5810,7 +5821,7 @@ int main(int argc, char** argv) AddPart(script, nsoption_charp(arexx_startup), 1024); ami_arexx_execute(script); - LOG("Entering main loop"); + NSLOG(netsurf, INFO, "Entering main loop"); while (!ami_quit) { ami_get_msg(); diff --git a/frontends/amiga/gui_menu.c b/frontends/amiga/gui_menu.c index 6ee0800f8..756f5e66c 100644 --- a/frontends/amiga/gui_menu.c +++ b/frontends/amiga/gui_menu.c @@ -584,7 +584,8 @@ ULONG ami_gui_menu_number(int item) break; default: - LOG("WARNING: Unrecognised menu item %d", item); + NSLOG(netsurf, INFO, + "WARNING: Unrecognised menu item %d", item); menu_num = 0; break; } diff --git a/frontends/amiga/history.c b/frontends/amiga/history.c index 7fc1ec333..e724f3e70 100644 --- a/frontends/amiga/history.c +++ b/frontends/amiga/history.c @@ -438,7 +438,7 @@ nserror ami_history_global_present(void) res = ami_history_global_create_window(ncwin); if (res != NSERROR_OK) { - LOG("SSL UI builder init failed"); + NSLOG(netsurf, INFO, "SSL UI builder init failed"); ami_utf8_free(ncwin->core.wintitle); free(ncwin); return res; diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c index c293f5909..0ae9cc040 100644 --- a/frontends/amiga/history_local.c +++ b/frontends/amiga/history_local.c @@ -261,7 +261,7 @@ nserror ami_history_local_present(struct gui_window *gw) res = ami_history_local_create_window(ncwin); if (res != NSERROR_OK) { - LOG("SSL UI builder init failed"); + NSLOG(netsurf, INFO, "SSL UI builder init failed"); ami_utf8_free(ncwin->core.wintitle); free(ncwin); return res; diff --git a/frontends/amiga/hotlist.c b/frontends/amiga/hotlist.c index c0a6b6f58..c7efe9148 100644 --- a/frontends/amiga/hotlist.c +++ b/frontends/amiga/hotlist.c @@ -563,7 +563,7 @@ nserror ami_hotlist_present(void) res = ami_hotlist_create_window(ncwin); if (res != NSERROR_OK) { - LOG("SSL UI builder init failed"); + NSLOG(netsurf, INFO, "SSL UI builder init failed"); ami_utf8_free(ncwin->core.wintitle); free(ncwin); return res; diff --git a/frontends/amiga/memory.c b/frontends/amiga/memory.c index d371d2585..35ca9697f 100755 --- a/frontends/amiga/memory.c +++ b/frontends/amiga/memory.c @@ -50,23 +50,38 @@ void *ami_memory_clear_alloc(size_t size, UBYTE value) static int ami_memory_slab_usage_cb(const struct __slab_usage_information * sui) { if(sui->sui_slab_index <= 1) { - LOG("clib2 slab usage:"); - LOG(" The size of all slabs, in bytes: %ld", sui->sui_slab_size); - LOG(" Number of allocations which are not managed by slabs: %ld", - sui->sui_num_single_allocations); - LOG(" Total number of bytes allocated for memory not managed by slabs: %ld", - sui->sui_total_single_allocation_size); - LOG(" Number of slabs currently in play: %ld", sui->sui_num_slabs); - LOG(" Number of currently unused slabs: %ld", sui->sui_num_empty_slabs); - LOG(" Number of slabs in use which are completely filled with data: %ld", - sui->sui_num_full_slabs); - LOG(" Total number of bytes allocated for all slabs: %ld", - sui->sui_total_slab_allocation_size); + NSLOG(netsurf, INFO, "clib2 slab usage:"); + NSLOG(netsurf, INFO, + " The size of all slabs, in bytes: %ld", + sui->sui_slab_size); + NSLOG(netsurf, INFO, + " Number of allocations which are not managed by slabs: %ld", + sui->sui_num_single_allocations); + NSLOG(netsurf, INFO, + " Total number of bytes allocated for memory not managed by slabs: %ld", + sui->sui_total_single_allocation_size); + NSLOG(netsurf, INFO, + " Number of slabs currently in play: %ld", + sui->sui_num_slabs); + NSLOG(netsurf, INFO, + " Number of currently unused slabs: %ld", + sui->sui_num_empty_slabs); + NSLOG(netsurf, INFO, + " Number of slabs in use which are completely filled with data: %ld", + sui->sui_num_full_slabs); + NSLOG(netsurf, INFO, + " Total number of bytes allocated for all slabs: %ld", + sui->sui_total_slab_allocation_size); } - LOG("Slab %d", sui->sui_slab_index); - LOG(" Memory chunk size managed by this slab: %ld", sui->sui_chunk_size); - LOG(" Number of memory chunks that fit in this slab: %ld", sui->sui_num_chunks); - LOG(" Number of memory chunks used in this slab: %ld", sui->sui_num_chunks_used); + NSLOG(netsurf, INFO, "Slab %d", sui->sui_slab_index); + NSLOG(netsurf, INFO, " Memory chunk size managed by this slab: %ld", + sui->sui_chunk_size); + NSLOG(netsurf, INFO, + " Number of memory chunks that fit in this slab: %ld", + sui->sui_num_chunks); + NSLOG(netsurf, INFO, + " Number of memory chunks used in this slab: %ld", + sui->sui_num_chunks_used); return 0; } @@ -74,16 +89,20 @@ static int ami_memory_slab_usage_cb(const struct __slab_usage_information * sui) static int ami_memory_slab_alloc_cb(const struct __slab_allocation_information *sai) { if(sai->sai_allocation_index <= 1) { - LOG("clib2 allocation usage:"); - LOG(" Number of allocations which are not managed by slabs: %ld", - sai->sai_num_single_allocations); - LOG(" Total number of bytes allocated for memory not managed by slabs: %ld", - sai->sai_total_single_allocation_size); + NSLOG(netsurf, INFO, "clib2 allocation usage:"); + NSLOG(netsurf, INFO, + " Number of allocations which are not managed by slabs: %ld", + sai->sai_num_single_allocations); + NSLOG(netsurf, INFO, + " Total number of bytes allocated for memory not managed by slabs: %ld", + sai->sai_total_single_allocation_size); } - LOG("Alloc %d", sai->sai_allocation_index); - LOG(" Size of this allocation, as requested: %ld", sai->sai_allocation_size); - LOG(" Total size of this allocation, including management data: %ld", - sai->sai_total_allocation_size); + NSLOG(netsurf, INFO, "Alloc %d", sai->sai_allocation_index); + NSLOG(netsurf, INFO, " Size of this allocation, as requested: %ld", + sai->sai_allocation_size); + NSLOG(netsurf, INFO, + " Total size of this allocation, including management data: %ld", + sai->sai_total_allocation_size); return 0; } @@ -111,13 +130,13 @@ void ami_memory_slab_dump(BPTR fh) static void ami_memory_low_mem_handler(void *p) { if(low_mem_status == PURGE_STEP1) { - LOG("Purging llcache"); + NSLOG(netsurf, INFO, "Purging llcache"); llcache_clean(true); low_mem_status = PURGE_DONE_STEP1; } if(low_mem_status == PURGE_STEP2) { - LOG("Purging unused slabs"); + NSLOG(netsurf, INFO, "Purging unused slabs"); __free_unused_slabs(); low_mem_status = PURGE_DONE_STEP2; } diff --git a/frontends/amiga/misc.c b/frontends/amiga/misc.c index 5ca4f906a..532d2f182 100755 --- a/frontends/amiga/misc.c +++ b/frontends/amiga/misc.c @@ -46,7 +46,7 @@ static LONG ami_misc_req(const char *message, uint32 type) { LONG ret = 0; - LOG("%s", message); + NSLOG(netsurf, INFO, "%s", message); #ifdef __amigaos4__ ret = TimedDosRequesterTags( TDR_TitleString, messages_get("NetSurf"), diff --git a/frontends/amiga/os3support.c b/frontends/amiga/os3support.c index 6dc95795f..378bc04cc 100644 --- a/frontends/amiga/os3support.c +++ b/frontends/amiga/os3support.c @@ -216,13 +216,13 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl fh = Open(fontpath, MODE_OLDFILE); if(fh == 0) { - LOG("Unable to open FONT %s", fontpath); + NSLOG(netsurf, INFO, "Unable to open FONT %s", fontpath); FreeVec(fontpath); return NULL; } if(Read(fh, &fch, sizeof(struct FontContentsHeader)) != sizeof(struct FontContentsHeader)) { - LOG("Unable to read FONT %s", fontpath); + NSLOG(netsurf, INFO, "Unable to read FONT %s", fontpath); FreeVec(fontpath); Close(fh); return NULL; @@ -231,7 +231,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl Close(fh); if(fch.fch_FileID != OFCH_ID) { - LOG("%s is not an outline font!", fontpath); + NSLOG(netsurf, INFO, "%s is not an outline font!", fontpath); FreeVec(fontpath); return NULL; } @@ -242,7 +242,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl if(p) *p = '.'; if(fh == 0) { - LOG("Unable to open OTAG %s", otagpath); + NSLOG(netsurf, INFO, "Unable to open OTAG %s", otagpath); FreeVec(otagpath); return NULL; } @@ -250,7 +250,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl size = GetFileSize(fh); buffer = (UBYTE *)malloc(size); if(buffer == NULL) { - LOG("Unable to allocate memory"); + NSLOG(netsurf, INFO, "Unable to allocate memory"); Close(fh); FreeVec(otagpath); return NULL; @@ -262,7 +262,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl /* The first tag is supposed to be OT_FileIdent and should equal 'size' */ struct TagItem *tag = (struct TagItem *)buffer; if((tag->ti_Tag != OT_FileIdent) || (tag->ti_Data != (ULONG)size)) { - LOG("Invalid OTAG file"); + NSLOG(netsurf, INFO, "Invalid OTAG file"); free(buffer); FreeVec(otagpath); return NULL; @@ -277,10 +277,10 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl /* Find OT_Engine and open the font engine */ if(ti = FindTagItem(OT_Engine, buffer)) { - LOG("Using font engine %s", ti->ti_Data); + NSLOG(netsurf, INFO, "Using font engine %s", ti->ti_Data); fname = ASPrintf("%s.library", ti->ti_Data); } else { - LOG("Cannot find OT_Engine tag"); + NSLOG(netsurf, INFO, "Cannot find OT_Engine tag"); free(buffer); FreeVec(otagpath); return NULL; @@ -289,7 +289,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl BulletBase = (struct BulletBase *)OpenLibrary(fname, 0L); if(BulletBase == NULL) { - LOG("Unable to open font engine %s", fname); + NSLOG(netsurf, INFO, "Unable to open font engine %s", fname); free(buffer); FreeVec(fname); FreeVec(otagpath); diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c index e31d470a6..dc2c16724 100644 --- a/frontends/amiga/plotters.c +++ b/frontends/amiga/plotters.c @@ -131,7 +131,7 @@ struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit struct gui_globals *gg = malloc(sizeof(struct gui_globals)); if(force32bit == false) depth = GetBitMapAttr(scrn->RastPort.BitMap, BMA_DEPTH); - LOG("Screen depth = %d", depth); + NSLOG(netsurf, INFO, "Screen depth = %d", depth); #ifdef __amigaos4__ if(depth < 16) { @@ -241,7 +241,8 @@ struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit gg->open_num = -1; init_layers_count++; - LOG("Layer initialised (total: %d)", init_layers_count); + NSLOG(netsurf, INFO, "Layer initialised (total: %d)", + init_layers_count); return gg; } @@ -328,7 +329,8 @@ static ULONG ami_plot_obtain_pen(struct MinList *shared_pens, ULONG colr) (colr & 0x00ff0000) << 8, NULL); - if(pen == -1) LOG("WARNING: Cannot allocate pen for ABGR:%lx", colr); + if(pen == -1) NSLOG(netsurf, INFO, + "WARNING: Cannot allocate pen for ABGR:%lx", colr); if((shared_pens != NULL) && (pool_pens != NULL)) { if((node = (struct ami_plot_pen *)ami_memory_itempool_alloc(pool_pens, sizeof(struct ami_plot_pen)))) { @@ -849,17 +851,17 @@ ami_polygon(const struct redraw_context *ctx, ami_plot_setapen(glob, glob->rp, style->fill_colour); if (AreaMove(glob->rp,p[0],p[1]) == -1) { - LOG("AreaMove: vector list full"); + NSLOG(netsurf, INFO, "AreaMove: vector list full"); } for (uint32 k = 1; k < n; k++) { if (AreaDraw(glob->rp,p[k*2],p[(k*2)+1]) == -1) { - LOG("AreaDraw: vector list full"); + NSLOG(netsurf, INFO, "AreaDraw: vector list full"); } } if (AreaEnd(glob->rp) == -1) { - LOG("AreaEnd: error"); + NSLOG(netsurf, INFO, "AreaEnd: error"); } return NSERROR_OK; @@ -900,7 +902,7 @@ ami_path(const struct redraw_context *ctx, } if (p[0] != PLOTTER_PATH_MOVE) { - LOG("Path does not start with move"); + NSLOG(netsurf, INFO, "Path does not start with move"); return NSERROR_INVALID; } @@ -922,7 +924,8 @@ ami_path(const struct redraw_context *ctx, if (p[i] == PLOTTER_PATH_MOVE) { if (pstyle->fill_colour != NS_TRANSPARENT) { if (AreaMove(glob->rp, p[i+1], p[i+2]) == -1) { - LOG("AreaMove: vector list full"); + NSLOG(netsurf, INFO, + "AreaMove: vector list full"); } } else { Move(glob->rp, p[i+1], p[i+2]); @@ -936,7 +939,7 @@ ami_path(const struct redraw_context *ctx, } else if (p[i] == PLOTTER_PATH_CLOSE) { if (pstyle->fill_colour != NS_TRANSPARENT) { if (AreaEnd(glob->rp) == -1) { - LOG("AreaEnd: error"); + NSLOG(netsurf, INFO, "AreaEnd: error"); } } else { Draw(glob->rp, start_p.x, start_p.y); @@ -945,7 +948,8 @@ ami_path(const struct redraw_context *ctx, } else if (p[i] == PLOTTER_PATH_LINE) { if (pstyle->fill_colour != NS_TRANSPARENT) { if (AreaDraw(glob->rp, p[i+1], p[i+2]) == -1) { - LOG("AreaDraw: vector list full"); + NSLOG(netsurf, INFO, + "AreaDraw: vector list full"); } } else { Draw(glob->rp, p[i+1], p[i+2]); @@ -965,7 +969,8 @@ ami_path(const struct redraw_context *ctx, ami_bezier(&cur_p, &p_a, &p_b, &p_c, t, &p_r); if (pstyle->fill_colour != NS_TRANSPARENT) { if (AreaDraw(glob->rp, p_r.x, p_r.y) == -1) { - LOG("AreaDraw: vector list full"); + NSLOG(netsurf, INFO, + "AreaDraw: vector list full"); } } else { Draw(glob->rp, p_r.x, p_r.y); @@ -975,7 +980,7 @@ ami_path(const struct redraw_context *ctx, cur_p.y = p_c.y; i += 7; } else { - LOG("bad path command %f", p[i]); + NSLOG(netsurf, INFO, "bad path command %f", p[i]); /* End path for safety if using Area commands */ if (pstyle->fill_colour != NS_TRANSPARENT) { AreaEnd(glob->rp); diff --git a/frontends/amiga/plugin_hack.c b/frontends/amiga/plugin_hack.c index 2327f9190..4fd1f03f7 100644 --- a/frontends/amiga/plugin_hack.c +++ b/frontends/amiga/plugin_hack.c @@ -82,7 +82,8 @@ nserror amiga_plugin_hack_init(void) if(node) { - LOG("plugin_hack registered %s", lwc_string_data(type)); + NSLOG(netsurf, INFO, "plugin_hack registered %s", + lwc_string_data(type)); error = content_factory_register_handler( lwc_string_data(type), @@ -123,7 +124,7 @@ nserror amiga_plugin_hack_create(const content_handler *handler, bool amiga_plugin_hack_convert(struct content *c) { - LOG("amiga_plugin_hack_convert"); + NSLOG(netsurf, INFO, "amiga_plugin_hack_convert"); content_set_ready(c); content_set_done(c); @@ -137,7 +138,7 @@ void amiga_plugin_hack_destroy(struct content *c) { amiga_plugin_hack_content *plugin = (amiga_plugin_hack_content *) c; - LOG("amiga_plugin_hack_destroy %p", plugin); + NSLOG(netsurf, INFO, "amiga_plugin_hack_destroy %p", plugin); return; } @@ -155,7 +156,7 @@ bool amiga_plugin_hack_redraw(struct content *c, struct rect rect; nserror res; - LOG("amiga_plugin_hack_redraw"); + NSLOG(netsurf, INFO, "amiga_plugin_hack_redraw"); rect.x0 = data->x; rect.y0 = data->y; @@ -187,7 +188,8 @@ bool amiga_plugin_hack_redraw(struct content *c, void amiga_plugin_hack_open(struct content *c, struct browser_window *bw, struct content *page, struct object_params *params) { - LOG("amiga_plugin_hack_open %s", nsurl_access(content_get_url(c))); + NSLOG(netsurf, INFO, "amiga_plugin_hack_open %s", + nsurl_access(content_get_url(c))); if(c) { @@ -201,13 +203,13 @@ void amiga_plugin_hack_open(struct content *c, struct browser_window *bw, void amiga_plugin_hack_close(struct content *c) { - LOG("amiga_plugin_hack_close"); + NSLOG(netsurf, INFO, "amiga_plugin_hack_close"); return; } void amiga_plugin_hack_reformat(struct content *c, int width, int height) { - LOG("amiga_plugin_hack_reformat"); + NSLOG(netsurf, INFO, "amiga_plugin_hack_reformat"); c->width = width; c->height = height; @@ -220,7 +222,7 @@ nserror amiga_plugin_hack_clone(const struct content *old, struct content **newc amiga_plugin_hack_content *plugin; nserror error; - LOG("amiga_plugin_hack_clone"); + NSLOG(netsurf, INFO, "amiga_plugin_hack_clone"); plugin = calloc(1, sizeof(amiga_plugin_hack_content)); if (plugin == NULL) @@ -267,7 +269,7 @@ void amiga_plugin_hack_execute(struct hlcache_handle *c) if(full_cmd) { #ifdef __amigaos4__ - LOG("Attempting to execute %s", full_cmd); + NSLOG(netsurf, INFO, "Attempting to execute %s", full_cmd); in = Open("NIL:", MODE_OLDFILE); out = Open("NIL:", MODE_NEWFILE); diff --git a/frontends/amiga/schedule.c b/frontends/amiga/schedule.c index bfafe9c88..30a36815c 100644 --- a/frontends/amiga/schedule.c +++ b/frontends/amiga/schedule.c @@ -218,9 +218,10 @@ static void ami_schedule_dump(void) GetSysTime(&tv); Amiga2Date(tv.Seconds, &clockdata); - LOG("Current time = %d-%d-%d %d:%d:%d.%d", clockdata.mday, clockdata.month, clockdata.year, - clockdata.hour, clockdata.min, clockdata.sec, tv.Microseconds); - LOG("Events remaining in queue:"); + NSLOG(netsurf, INFO, "Current time = %d-%d-%d %d:%d:%d.%d", + clockdata.mday, clockdata.month, clockdata.year, + clockdata.hour, clockdata.min, clockdata.sec, tv.Microseconds); + NSLOG(netsurf, INFO, "Events remaining in queue:"); iterator = pblHeapIterator(schedule_list); @@ -231,9 +232,9 @@ static void ami_schedule_dump(void) nscb, clockdata.mday, clockdata.month, clockdata.year, clockdata.hour, clockdata.min, clockdata.sec, nscb->tv.Microseconds, nscb->callback, nscb->p); if(CheckIO((struct IORequest *)nscb) == NULL) { - LOG("-> ACTIVE"); + NSLOG(netsurf, INFO, "-> ACTIVE"); } else { - LOG("-> COMPLETE"); + NSLOG(netsurf, INFO, "-> COMPLETE"); } }; diff --git a/frontends/amiga/selectmenu.c b/frontends/amiga/selectmenu.c index f3a11b67a..8a8614136 100644 --- a/frontends/amiga/selectmenu.c +++ b/frontends/amiga/selectmenu.c @@ -58,7 +58,8 @@ BOOL ami_selectmenu_is_safe(void) BOOL popupmenu_lib_ok = FALSE; if((PopupMenuBase = OpenLibrary("popupmenu.library", 53))) { - LOG("popupmenu.library v%d.%d", PopupMenuBase->lib_Version, PopupMenuBase->lib_Revision); + NSLOG(netsurf, INFO, "popupmenu.library v%d.%d", + PopupMenuBase->lib_Version, PopupMenuBase->lib_Revision); if(LIB_IS_AT_LEAST((struct Library *)PopupMenuBase, 53, 11)) popupmenu_lib_ok = TRUE; CloseLibrary(PopupMenuBase); diff --git a/frontends/amiga/sslcert.c b/frontends/amiga/sslcert.c index eeb34108a..136b918fc 100644 --- a/frontends/amiga/sslcert.c +++ b/frontends/amiga/sslcert.c @@ -317,7 +317,7 @@ nserror ami_cert_verify(struct nsurl *url, res = ami_crtvrfy_create_window(ncwin); if (res != NSERROR_OK) { - LOG("SSL UI builder init failed"); + NSLOG(netsurf, INFO, "SSL UI builder init failed"); ami_utf8_free(ncwin->core.wintitle); ami_utf8_free(ncwin->sslerr); ami_utf8_free(ncwin->sslaccept); diff --git a/frontends/atari/bitmap.c b/frontends/atari/bitmap.c index cbb719586..ae42da837 100644 --- a/frontends/atari/bitmap.c +++ b/frontends/atari/bitmap.c @@ -81,7 +81,9 @@ static void *atari_bitmap_create_ex( int w, int h, short bpp, int rowstride, uns { struct bitmap * bitmap; - LOG("width %d (rowstride: %d, bpp: %d), height %d, state %u", w, rowstride, bpp, h, state); + NSLOG(netsurf, INFO, + "width %d (rowstride: %d, bpp: %d), height %d, state %u", w, + rowstride, bpp, h, state); if( rowstride == 0) { rowstride = bpp * w; @@ -107,10 +109,10 @@ static void *atari_bitmap_create_ex( int w, int h, short bpp, int rowstride, uns } else { free(bitmap); bitmap=NULL; - LOG("Out of memory!"); + NSLOG(netsurf, INFO, "Out of memory!"); } } - LOG("bitmap %p", bitmap); + NSLOG(netsurf, INFO, "bitmap %p", bitmap); return bitmap; } @@ -194,7 +196,7 @@ static unsigned char *bitmap_get_buffer(void *bitmap) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return NULL; } @@ -218,7 +220,7 @@ size_t atari_bitmap_get_rowstride(void *bitmap) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return 0; } return bm->rowstride; @@ -231,7 +233,7 @@ void atari_bitmap_destroy(void *bitmap) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return; } @@ -272,11 +274,12 @@ static void bitmap_set_opaque(void *bitmap, bool opaque) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return; } - LOG("setting bitmap %p to %s", bm, opaque ? "opaque" : "transparent"); + NSLOG(netsurf, INFO, "setting bitmap %p to %s", bm, + opaque ? "opaque" : "transparent"); bm->opaque = opaque; } @@ -293,7 +296,7 @@ static bool bitmap_test_opaque(void *bitmap) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return false; } @@ -305,11 +308,12 @@ static bool bitmap_test_opaque(void *bitmap) while (tst-- > 0) { if (bm->pixdata[(tst << 2) + 3] != 0xff) { - LOG("bitmap %p has transparency", bm); + NSLOG(netsurf, INFO, + "bitmap %p has transparency", bm); return false; } } - LOG("bitmap %p is opaque", bm); + NSLOG(netsurf, INFO, "bitmap %p is opaque", bm); return true; } @@ -320,7 +324,7 @@ bool atari_bitmap_get_opaque(void *bitmap) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return false; } @@ -334,7 +338,7 @@ int atari_bitmap_get_width(void *bitmap) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return 0; } @@ -348,7 +352,7 @@ int atari_bitmap_get_height(void *bitmap) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return 0; } return(bm->height); diff --git a/frontends/atari/certview.c b/frontends/atari/certview.c index 6950d31f8..80d18a059 100644 --- a/frontends/atari/certview.c +++ b/frontends/atari/certview.c @@ -81,7 +81,7 @@ static nserror atari_sslcert_viewer_init_phase2(struct core_window *cw, assert(ssl_d); - LOG("cw %p", cw); + NSLOG(netsurf, INFO, "cw %p", cw); return(sslcert_viewer_init(cb_t, cw, ssl_d)); } @@ -97,7 +97,7 @@ static void atari_sslcert_viewer_finish(struct core_window *cw) /* This will also free the session data: */ sslcert_viewer_fini(cvwin->ssl_session_data); - LOG("cw %p", cw); + NSLOG(netsurf, INFO, "cw %p", cw); } static void atari_sslcert_viewer_draw(struct core_window *cw, int x, @@ -123,7 +123,7 @@ static void atari_sslcert_viewer_keypress(struct core_window *cw, uint32_t ucs4) cvwin = (struct atari_sslcert_viewer_s *)atari_treeview_get_user_data(cw); - LOG("ucs4: %"PRIu32, ucs4); + NSLOG(netsurf, INFO, "ucs4: %"PRIu32, ucs4); sslcert_viewer_keypress(cvwin->ssl_session_data, ucs4); } @@ -150,14 +150,14 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) short retval = 0; OBJECT *toolbar; - LOG("win %p", win); + NSLOG(netsurf, INFO, "win %p", win); if(ev_out->emo_events & MU_MESAG){ switch (msg[0]) { case WM_TOOLBAR: toolbar = gemtk_obj_get_tree(TOOLBAR_SSL_CERT); - LOG("CERTVIEWER WM_TOOLBAR"); + NSLOG(netsurf, INFO, "CERTVIEWER WM_TOOLBAR"); tv = (struct core_window*) gemtk_wm_get_user_data(win); assert(tv); cvwin = (struct atari_sslcert_viewer_s *) @@ -238,7 +238,7 @@ static void atari_sslcert_viewer_init(struct atari_sslcert_viewer_s * cvwin, if (cvwin->tv == NULL) { /* handle it properly, clean up previous allocs */ - LOG("Failed to allocate treeview"); + NSLOG(netsurf, INFO, "Failed to allocate treeview"); return; } @@ -280,7 +280,7 @@ static void atari_sslcert_viewer_destroy(struct atari_sslcert_viewer_s * cvwin) assert(cvwin->init); assert(cvwin->window); - LOG("cvwin %p", cvwin); + NSLOG(netsurf, INFO, "cvwin %p", cvwin); if (atari_treeview_is_open(cvwin->tv)) atari_treeview_close(cvwin->tv); @@ -289,5 +289,5 @@ static void atari_sslcert_viewer_destroy(struct atari_sslcert_viewer_s * cvwin) cvwin->window = NULL; atari_treeview_delete(cvwin->tv); free(cvwin); - LOG("done"); + NSLOG(netsurf, INFO, "done"); } diff --git a/frontends/atari/cookies.c b/frontends/atari/cookies.c index 9045009fc..df2de0d4c 100644 --- a/frontends/atari/cookies.c +++ b/frontends/atari/cookies.c @@ -63,7 +63,7 @@ static nserror atari_cookie_manager_init_phase2(struct core_window *cw, struct core_window_callback_table *cb_t) { - LOG("cw %p",cw); + NSLOG(netsurf, INFO, "cw %p", cw); return(cookie_manager_init(cb_t, cw)); } @@ -71,7 +71,7 @@ atari_cookie_manager_init_phase2(struct core_window *cw, static void atari_cookie_manager_finish(struct core_window *cw) { - LOG("cw %p",cw); + NSLOG(netsurf, INFO, "cw %p", cw); cookie_manager_fini(); } @@ -89,7 +89,7 @@ atari_cookie_manager_draw(struct core_window *cw, static void atari_cookie_manager_keypress(struct core_window *cw, uint32_t ucs4) { - LOG("ucs4: %"PRIu32, ucs4); + NSLOG(netsurf, INFO, "ucs4: %"PRIu32, ucs4); cookie_manager_keypress(ucs4); } @@ -108,13 +108,13 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) { short retval = 0; - LOG("win %p", win); + NSLOG(netsurf, INFO, "win %p", win); if (ev_out->emo_events & MU_MESAG) { switch (msg[0]) { case WM_TOOLBAR: - LOG("WM_TOOLBAR"); + NSLOG(netsurf, INFO, "WM_TOOLBAR"); break; case WM_CLOSED: @@ -158,7 +158,8 @@ void atari_cookie_manager_init(void) if (atari_cookie_manager.tv == NULL) { /* handle it properly, clean up previous allocs */ - LOG("Failed to allocate treeview"); + NSLOG(netsurf, INFO, + "Failed to allocate treeview"); return; } @@ -209,7 +210,7 @@ void atari_cookie_manager_destroy(void) atari_treeview_delete(atari_cookie_manager.tv); atari_cookie_manager.init = false; } - LOG("done"); + NSLOG(netsurf, INFO, "done"); } diff --git a/frontends/atari/ctxmenu.c b/frontends/atari/ctxmenu.c index e25d8e522..ef4f01ae2 100644 --- a/frontends/atari/ctxmenu.c +++ b/frontends/atari/ctxmenu.c @@ -288,7 +288,9 @@ void context_popup(struct gui_window * gw, short x, short y) /* the GEMDOS cmdline contains the length of the commandline in the first byte: */ cmdline[0] = (unsigned char)strlen(tempfile); - LOG("Creating temporay source file: %s\n", tempfile); + NSLOG(netsurf, INFO, + "Creating temporay source file: %s\n", + tempfile); fp_tmpfile = fopen(tempfile, "w"); if (fp_tmpfile != NULL){ fwrite(data, size, 1, fp_tmpfile); @@ -306,7 +308,8 @@ void context_popup(struct gui_window * gw, short x, short y) } } else { - LOG("Invalid content!"); + NSLOG(netsurf, INFO, + "Invalid content!"); } } else { form_alert(0, "[1][Set option \"atari_editor\".][OK]"); diff --git a/frontends/atari/deskmenu.c b/frontends/atari/deskmenu.c index addba2764..32dfd7084 100644 --- a/frontends/atari/deskmenu.c +++ b/frontends/atari/deskmenu.c @@ -208,7 +208,7 @@ static void __CDECL menu_new_win(short item, short title, void *data) nserror error; const char *addr; - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); if (nsoption_charp(homepage_url) != NULL) { addr = nsoption_charp(homepage_url); @@ -236,7 +236,7 @@ static void __CDECL menu_open_url(short item, short title, void *data) { struct gui_window * gw; struct browser_window * bw ; - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); gw = input_window; if( gw == NULL ) { @@ -251,7 +251,7 @@ static void __CDECL menu_open_url(short item, short title, void *data) static void __CDECL menu_open_file(short item, short title, void *data) { - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); const char * filename = file_select(messages_get("OpenFile"), ""); if( filename != NULL ){ @@ -280,7 +280,7 @@ static void __CDECL menu_open_file(short item, short title, void *data) static void __CDECL menu_close_win(short item, short title, void *data) { - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); if( input_window == NULL ) return; gui_window_destroy( input_window ); @@ -288,7 +288,7 @@ static void __CDECL menu_close_win(short item, short title, void *data) static void __CDECL menu_save_page(short item, short title, void *data) { - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); static bool init = true; bool is_folder=false; const char * path; @@ -319,7 +319,7 @@ static void __CDECL menu_quit(short item, short title, void *data) { short buff[8]; memset( &buff, 0, sizeof(short)*8 ); - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); gemtk_wm_send_msg(NULL, AP_TERM, 0, 0, 0, 0); } @@ -331,21 +331,21 @@ static void __CDECL menu_cut(short item, short title, void *data) static void __CDECL menu_copy(short item, short title, void *data) { - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); if( input_window != NULL ) browser_window_key_press( input_window->browser->bw, NS_KEY_COPY_SELECTION); } static void __CDECL menu_paste(short item, short title, void *data) { - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); if( input_window != NULL ) browser_window_key_press( input_window->browser->bw, NS_KEY_PASTE); } static void __CDECL menu_find(short item, short title, void *data) { - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); if (input_window != NULL) { if (input_window->search) { window_close_search(input_window->root); @@ -358,13 +358,13 @@ static void __CDECL menu_find(short item, short title, void *data) static void __CDECL menu_choices(short item, short title, void *data) { - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); open_settings(); } static void __CDECL menu_stop(short item, short title, void *data) { - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); if( input_window == NULL ) return; @@ -378,7 +378,7 @@ static void __CDECL menu_reload(short item, short title, void *data) if(input_window == NULL) return; toolbar_reload_click(input_window->root->toolbar); - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); } @@ -408,7 +408,7 @@ static void __CDECL menu_dec_scale(short item, short title, void *data) static void __CDECL menu_toolbars(short item, short title, void *data) { static int state = 0; - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); if( input_window != null && input_window->root->toolbar != null ){ state = !state; // TODO: implement toolbar hide @@ -418,7 +418,7 @@ static void __CDECL menu_toolbars(short item, short title, void *data) static void __CDECL menu_savewin(short item, short title, void *data) { - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); if (input_window && input_window->browser) { GRECT rect; wind_get_grect(gemtk_wm_get_handle(input_window->root->win), WF_CURRXYWH, @@ -438,7 +438,7 @@ static void __CDECL menu_savewin(short item, short title, void *data) static void __CDECL menu_debug_render(short item, short title, void *data) { - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); html_redraw_debug = !html_redraw_debug; if( input_window != NULL ) { if ( input_window->browser != NULL @@ -469,7 +469,7 @@ static void __CDECL menu_bg_images(short item, short title, void *data) static void __CDECL menu_back(short item, short title, void *data) { - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); if( input_window == NULL ) return; toolbar_back_click(input_window->root->toolbar); @@ -477,7 +477,7 @@ static void __CDECL menu_back(short item, short title, void *data) static void __CDECL menu_forward(short item, short title, void *data) { - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); if( input_window == NULL ) return; toolbar_forward_click(input_window->root->toolbar); @@ -485,7 +485,7 @@ static void __CDECL menu_forward(short item, short title, void *data) static void __CDECL menu_home(short item, short title, void *data) { - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); if( input_window == NULL ) return; toolbar_home_click(input_window->root->toolbar); @@ -493,20 +493,20 @@ static void __CDECL menu_home(short item, short title, void *data) static void __CDECL menu_lhistory(short item, short title, void *data) { - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); if( input_window == NULL ) return; } static void __CDECL menu_ghistory(short item, short title, void *data) { - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); atari_global_history_open(); } static void __CDECL menu_add_bookmark(short item, short title, void *data) { - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); if (input_window) { if( browser_window_has_content(input_window->browser->bw) ){ atari_hotlist_add_page( @@ -519,26 +519,26 @@ static void __CDECL menu_add_bookmark(short item, short title, void *data) static void __CDECL menu_bookmarks(short item, short title, void *data) { - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); atari_hotlist_open(); } static void __CDECL menu_cookies(short item, short title, void *data) { - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); atari_cookie_manager_open(); } static void __CDECL menu_vlog(short item, short title, void *data) { - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); verbose_log = !verbose_log; menu_icheck(h_gem_menu, MAINMENU_M_VLOG, (verbose_log) ? 1 : 0); } static void __CDECL menu_help_content(short item, short title, void *data) { - LOG("%s", __FUNCTION__); + NSLOG(netsurf, INFO, "%s", __FUNCTION__); } /* @@ -580,14 +580,16 @@ static void register_menu_str( struct s_menu_item_evnt * mi ) while (i > 2) { if ((strncmp(" ", &str[i], 2) == 0) && (strlen(&str[i]) > 2)) { // "Standard" Keyboard Shortcut Element found: - LOG("Standard Keyboard Shortcut: \"%s\"\n", &str[i]); + NSLOG(netsurf, INFO, + "Standard Keyboard Shortcut: \"%s\"\n", &str[i]); x = i+2; is_std_shortcut = true; break; } if( str[i] == '['){ - LOG("Keyboard Shortcut: \"%s\"\n", &str[i]); + NSLOG(netsurf, INFO, "Keyboard Shortcut: \"%s\"\n", + &str[i]); // "Custom" Keyboard Shortcut Element found (identified by [): x = i; break; @@ -662,8 +664,12 @@ static void register_menu_str( struct s_menu_item_evnt * mi ) } } - LOG("Registered keyboard shortcut for \"%s\" => mod: %d, ""keycode: %ld, ascii: %c\n", - str, accel->mod, accel->keycode, accel->ascii); + NSLOG(netsurf, INFO, + "Registered keyboard shortcut for \"%s\" => mod: %d, ""keycode: %ld, ascii: %c\n", + str, + accel->mod, + accel->keycode, + accel->ascii); } } diff --git a/frontends/atari/download.c b/frontends/atari/download.c index d756e6694..7a1c7d2b7 100644 --- a/frontends/atari/download.c +++ b/frontends/atari/download.c @@ -194,7 +194,7 @@ static void on_close(struct gui_download_window * dw) static void gui_download_window_destroy( struct gui_download_window * gdw) { - LOG("gdw %p", gdw); + NSLOG(netsurf, INFO, "gdw %p", gdw); if (gdw->status == NSATARI_DOWNLOAD_WORKING) { download_context_abort(gdw->ctx); @@ -253,7 +253,8 @@ gui_download_window_create(download_context *ctx, struct gui_window *parent) char alert[200]; - LOG("Creating download window for gui window: %p", parent); + NSLOG(netsurf, INFO, "Creating download window for gui window: %p", + parent); /* TODO: Implement real form and use messages file strings! */ @@ -330,7 +331,8 @@ gui_download_window_create(download_context *ctx, struct gui_window *parent) gemtk_wm_set_toolbar_redraw_func(gdw->guiwin, toolbar_redraw_cb); strncpy((char*)&gdw->lbl_file, filename, MAX_SLEN_LBL_FILE-1); - LOG("created download: %s (total size: %d)", gdw->destination, gdw->size_total); + NSLOG(netsurf, INFO, "created download: %s (total size: %d)", + gdw->destination, gdw->size_total); GRECT work, curr; work.g_x = 0; @@ -357,7 +359,7 @@ static nserror gui_download_window_data(struct gui_download_window *dw, uint32_t tnow = clck / (CLOCKS_PER_SEC>>3); uint32_t sdiff = (clck / (CLOCKS_PER_SEC)) - dw->start; - LOG("dw %p",dw); + NSLOG(netsurf, INFO, "dw %p", dw); if (dw->abort == true){ dw->status = NSATARI_DOWNLOAD_CANCELED; @@ -405,7 +407,7 @@ static nserror gui_download_window_data(struct gui_download_window *dw, static void gui_download_window_error(struct gui_download_window *dw, const char *error_msg) { - LOG("%s", error_msg); + NSLOG(netsurf, INFO, "%s", error_msg); strncpy((char*)&dw->lbl_file, error_msg, MAX_SLEN_LBL_FILE-1); dw->status = NSATARI_DOWNLOAD_ERROR; @@ -416,7 +418,7 @@ static void gui_download_window_error(struct gui_download_window *dw, static void gui_download_window_done(struct gui_download_window *dw) { - LOG("dw %p", dw); + NSLOG(netsurf, INFO, "dw %p", dw); // TODO: change abort to close dw->status = NSATARI_DOWNLOAD_COMPLETE; diff --git a/frontends/atari/filetype.c b/frontends/atari/filetype.c index d27076e9c..706347137 100644 --- a/frontends/atari/filetype.c +++ b/frontends/atari/filetype.c @@ -36,7 +36,7 @@ const char *fetch_filetype(const char *unix_path) char * res = (char*)"text/html"; l = strlen(unix_path); - LOG("unix path: %s", unix_path); + NSLOG(netsurf, INFO, "unix path: %s", unix_path); /* This line is added for devlopment versions running from the root dir: */ if( strchr( unix_path, (int)'.' ) ){ @@ -85,6 +85,6 @@ const char *fetch_filetype(const char *unix_path) } } - LOG("mime type: %s", res); + NSLOG(netsurf, INFO, "mime type: %s", res); return( res ); } diff --git a/frontends/atari/findfile.c b/frontends/atari/findfile.c index 45ca6d916..8784727bc 100644 --- a/frontends/atari/findfile.c +++ b/frontends/atari/findfile.c @@ -31,7 +31,7 @@ char * local_file_to_url( const char * filename ) #define BACKSLASH 0x5C char * url; - LOG("in: %s", filename); + NSLOG(netsurf, INFO, "in: %s", filename); if( strlen(filename) <= 2){ return( NULL ); @@ -55,7 +55,7 @@ char * local_file_to_url( const char * filename ) free(fname_local); - LOG("out: %s", url); + NSLOG(netsurf, INFO, "out: %s", url); return( url ); #undef BACKSLASH @@ -81,10 +81,10 @@ char * atari_find_resource(char *buf, const char *filename, const char *def) { char *cdir = NULL; char t[PATH_MAX]; - LOG("%s (def: %s)", filename, def); + NSLOG(netsurf, INFO, "%s (def: %s)", filename, def); strcpy(t, NETSURF_GEM_RESPATH); strcat(t, filename); - LOG("checking %s", (char *)&t); + NSLOG(netsurf, INFO, "checking %s", (char *)&t); if (gemdos_realpath(t, buf) != NULL) { if (access(buf, R_OK) == 0) { return buf; @@ -92,7 +92,7 @@ char * atari_find_resource(char *buf, const char *filename, const char *def) } strcpy(t, "./"); strcat(t, filename); - LOG("checking %s", (char *)&t); + NSLOG(netsurf, INFO, "checking %s", (char *)&t); if (gemdos_realpath(t, buf) != NULL) { if (access(buf, R_OK) == 0) { return buf; @@ -104,7 +104,7 @@ char * atari_find_resource(char *buf, const char *filename, const char *def) strcpy(t, cdir); strcat(t, "/.netsurf/"); strcat(t, filename); - LOG("checking %s", (char *)&t); + NSLOG(netsurf, INFO, "checking %s", (char *)&t); if (gemdos_realpath(t, buf) != NULL) { if (access(buf, R_OK) == 0) return buf; @@ -116,19 +116,19 @@ char * atari_find_resource(char *buf, const char *filename, const char *def) if (gemdos_realpath(cdir, buf) != NULL) { strcat(buf, "/"); strcat(buf, filename); - LOG("checking %s", (char *)&t); + NSLOG(netsurf, INFO, "checking %s", (char *)&t); if (access(buf, R_OK) == 0) return buf; } } if (def[0] == '~') { snprintf(t, PATH_MAX, "%s%s", getenv("HOME"), def + 1); - LOG("checking %s", (char *)&t); + NSLOG(netsurf, INFO, "checking %s", (char *)&t); if (gemdos_realpath(t, buf) == NULL) { strcpy(buf, t); } } else { - LOG("checking %s", (char *)def); + NSLOG(netsurf, INFO, "checking %s", (char *)def); if (gemdos_realpath(def, buf) == NULL) { strcpy(buf, def); } diff --git a/frontends/atari/gui.c b/frontends/atari/gui.c index 4876d3106..a400285d3 100644 --- a/frontends/atari/gui.c +++ b/frontends/atari/gui.c @@ -139,11 +139,11 @@ static void atari_poll(void) evnt_multi_fast(&aes_event_in, aes_msg_out, &aes_event_out); if(gemtk_wm_dispatch_event(&aes_event_in, &aes_event_out, aes_msg_out) == 0) { if( (aes_event_out.emo_events & MU_MESAG) != 0 ) { - LOG("WM: %d\n", aes_msg_out[0]); + NSLOG(netsurf, INFO, "WM: %d\n", aes_msg_out[0]); switch(aes_msg_out[0]) { case MN_SELECTED: - LOG("Menu Item: %d\n", aes_msg_out[4]); + NSLOG(netsurf, INFO, "Menu Item: %d\n", aes_msg_out[4]); deskmenu_dispatch_item(aes_msg_out[3], aes_msg_out[4]); break; @@ -195,13 +195,14 @@ gui_window_create(struct browser_window *bw, gui_window_create_flags flags) { struct gui_window *gw=NULL; - LOG("gw: %p, BW: %p, existing %p, flags: %d\n", gw, bw, existing, (int)flags); + NSLOG(netsurf, INFO, "gw: %p, BW: %p, existing %p, flags: %d\n", gw, bw, + existing, (int)flags); gw = calloc(1, sizeof(struct gui_window)); if (gw == NULL) return NULL; - LOG("new window: %p, bw: %p\n", gw, bw); + NSLOG(netsurf, INFO, "new window: %p, bw: %p\n", gw, bw); window_create(gw, bw, existing, WIDGET_STATUSBAR|WIDGET_TOOLBAR|WIDGET_RESIZE\ |WIDGET_SCROLL); if (gw->root->win) { @@ -253,7 +254,7 @@ void gui_window_destroy(struct gui_window *gw) if (gw == NULL) return; - LOG("%s\n", __FUNCTION__); + NSLOG(netsurf, INFO, "%s\n", __FUNCTION__); if (input_window == gw) { gui_set_input_gui_window(NULL); @@ -444,7 +445,8 @@ gui_window_set_scroll(struct gui_window *gw, const struct rect *rect) return NSERROR_BAD_PARAMETER; } - LOG("scroll (gui_window: %p) %d, %d\n", gw, rect->x0, rect->y0); + NSLOG(netsurf, INFO, "scroll (gui_window: %p) %d, %d\n", gw, rect->x0, + rect->y0); window_scroll_by(gw->root, rect->x0, rect->y0); return NSERROR_OK; @@ -771,7 +773,8 @@ static void gui_401login_open(nsurl *url, const char *realm, char * out = NULL; bres = login_form_do( url, (char*)realm, &out); if (bres) { - LOG("url: %s, realm: %s, auth: %s\n", nsurl_access(url), realm, out); + NSLOG(netsurf, INFO, "url: %s, realm: %s, auth: %s\n", + nsurl_access(url), realm, out); urldb_set_auth_details(url, realm, out); } if (out != NULL) { @@ -789,7 +792,7 @@ gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs, void *cbpw) { struct sslcert_session_data *data; - LOG("url %s", nsurl_access(url)); + NSLOG(netsurf, INFO, "url %s", nsurl_access(url)); // TODO: localize string int b = form_alert(1, "[2][SSL Verify failed, continue?][Continue|Abort|Details...]"); @@ -812,7 +815,8 @@ gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs, void gui_set_input_gui_window(struct gui_window *gw) { - LOG("Setting input window from: %p to %p\n", input_window, gw); + NSLOG(netsurf, INFO, "Setting input window from: %p to %p\n", + input_window, gw); input_window = gw; } @@ -823,7 +827,7 @@ struct gui_window * gui_get_input_window(void) static void gui_quit(void) { - LOG("quitting"); + NSLOG(netsurf, INFO, "quitting"); struct gui_window *gw = window_list; struct gui_window *tmp = window_list; @@ -852,9 +856,9 @@ static void gui_quit(void) rsrc_free(); - LOG("Shutting down plotter"); + NSLOG(netsurf, INFO, "Shutting down plotter"); plot_finalise(); - LOG("done"); + NSLOG(netsurf, INFO, "done"); } /** @@ -866,7 +870,7 @@ process_cmdline(int argc, char** argv) int opt; bool set_default_dimensions = true; - LOG("argc %d, argv %p", argc, argv); + NSLOG(netsurf, INFO, "argc %d, argv %p", argc, argv); if ((nsoption_int(window_width) != 0) && (nsoption_int(window_height) != 0)) { @@ -959,7 +963,7 @@ static nserror set_defaults(struct nsoption_s *defaults) /* Set defaults for absent option strings */ nsoption_setnull_charp(cookie_file, strdup("cookies")); if (nsoption_charp(cookie_file) == NULL) { - LOG("Failed initialising string options"); + NSLOG(netsurf, INFO, "Failed initialising string options"); return NSERROR_BAD_PARAMETER; } return NSERROR_OK; @@ -976,7 +980,7 @@ static void gui_init(int argc, char** argv) OBJECT * cursors; atari_find_resource(buf, "netsurf.rsc", "./res/netsurf.rsc"); - LOG("Using RSC file: %s ", (char *)&buf); + NSLOG(netsurf, INFO, "Using RSC file: %s ", (char *)&buf); if (rsrc_load(buf)==0) { char msg[1024]; @@ -1012,15 +1016,16 @@ static void gui_init(int argc, char** argv) create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_HELP, cursors, &gem_cursors.help); - LOG("Enabling core select menu"); + NSLOG(netsurf, INFO, "Enabling core select menu"); nsoption_set_bool(core_select_menu, true); - LOG("Loading url.db from: %s", nsoption_charp(url_file)); + NSLOG(netsurf, INFO, "Loading url.db from: %s", nsoption_charp(url_file)); if( strlen(nsoption_charp(url_file)) ) { urldb_load(nsoption_charp(url_file)); } - LOG("Loading cookies from: %s", nsoption_charp(cookie_file)); + NSLOG(netsurf, INFO, "Loading cookies from: %s", + nsoption_charp(cookie_file)); if( strlen(nsoption_charp(cookie_file)) ) { urldb_load_cookies(nsoption_charp(cookie_file)); } @@ -1028,10 +1033,10 @@ static void gui_init(int argc, char** argv) if (process_cmdline(argc,argv) != true) die("unable to process command line.\n"); - LOG("Initializing NKC..."); + NSLOG(netsurf, INFO, "Initializing NKC..."); nkc_init(); - LOG("Initializing plotters..."); + NSLOG(netsurf, INFO, "Initializing plotters..."); struct redraw_context ctx = { .interactive = true, .background_images = true, @@ -1172,18 +1177,18 @@ int main(int argc, char** argv) ret = messages_add_from_file(messages); /* common initialisation */ - LOG("Initialising core..."); + NSLOG(netsurf, INFO, "Initialising core..."); ret = netsurf_init(store); if (ret != NSERROR_OK) { die("NetSurf failed to initialise"); } - LOG("Initializing GUI..."); + NSLOG(netsurf, INFO, "Initializing GUI..."); gui_init(argc, argv); graf_mouse( ARROW , NULL); - LOG("Creating initial browser window..."); + NSLOG(netsurf, INFO, "Creating initial browser window..."); addr = option_homepage_url; if (strncmp(addr, "file://", 7) && strncmp(addr, "http://", 7)) { if (stat(addr, &stat_buf) == 0) { @@ -1205,7 +1210,7 @@ int main(int argc, char** argv) if (ret != NSERROR_OK) { atari_warn_user(messages_get_errorcode(ret), 0); } else { - LOG("Entering Atari event mainloop..."); + NSLOG(netsurf, INFO, "Entering Atari event mainloop..."); while (!atari_quit) { atari_poll(); } @@ -1219,7 +1224,7 @@ int main(int argc, char** argv) fclose(stdout); fclose(stderr); #endif - LOG("exit_gem"); + NSLOG(netsurf, INFO, "exit_gem"); exit_gem(); return 0; diff --git a/frontends/atari/history.c b/frontends/atari/history.c index 56aafd056..ec602684f 100644 --- a/frontends/atari/history.c +++ b/frontends/atari/history.c @@ -39,13 +39,13 @@ static nserror atari_global_history_init_phase2(struct core_window *cw, struct core_window_callback_table *cb_t) { - LOG("cw %p", cw); + NSLOG(netsurf, INFO, "cw %p", cw); return(global_history_init(cb_t, cw)); } static void atari_global_history_finish(struct core_window *cw) { - LOG("cw %p", cw); + NSLOG(netsurf, INFO, "cw %p", cw); global_history_fini(); } @@ -58,7 +58,7 @@ static void atari_global_history_draw(struct core_window *cw, int x, static void atari_global_history_keypress(struct core_window *cw, uint32_t ucs4) { - LOG("ucs4: %"PRIu32, ucs4); + NSLOG(netsurf, INFO, "ucs4: %"PRIu32, ucs4); global_history_keypress(ucs4); } @@ -67,7 +67,7 @@ atari_global_history_mouse_action(struct core_window *cw, browser_mouse_state mouse, int x, int y) { - LOG("x: %d, y: %d\n", x, y); + NSLOG(netsurf, INFO, "x: %d, y: %d\n", x, y); global_history_mouse_action(mouse, x, y); } @@ -82,7 +82,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) { short retval = 0; - LOG("win %p", win); + NSLOG(netsurf, INFO, "win %p", win); if (ev_out->emo_events & MU_MESAG) { switch (msg[0]) { @@ -134,7 +134,8 @@ void atari_global_history_init(void) if (atari_global_history.tv == NULL) { /* handle it properly, clean up previous allocs */ - LOG("Failed to allocate treeview"); + NSLOG(netsurf, INFO, + "Failed to allocate treeview"); return; } } @@ -181,7 +182,7 @@ void atari_global_history_destroy(void) atari_treeview_delete(atari_global_history.tv); atari_global_history.init = false; } - LOG("done"); + NSLOG(netsurf, INFO, "done"); } void atari_global_history_redraw(void) diff --git a/frontends/atari/hotlist.c b/frontends/atari/hotlist.c index 659b3a562..3a54c98eb 100644 --- a/frontends/atari/hotlist.c +++ b/frontends/atari/hotlist.c @@ -72,13 +72,13 @@ static struct atari_treeview_callbacks atari_hotlist_treeview_callbacks = { static nserror atari_hotlist_init_phase2(struct core_window *cw, struct core_window_callback_table *cb_t) { - LOG("cw:%p", cw); + NSLOG(netsurf, INFO, "cw:%p", cw); return hotlist_manager_init(cb_t, cw); } static void atari_hotlist_finish(struct core_window *cw) { - LOG("cw:%p", cw); + NSLOG(netsurf, INFO, "cw:%p", cw); hotlist_fini(); } @@ -93,7 +93,7 @@ static void atari_hotlist_keypress(struct core_window *cw, uint32_t ucs4) { //GUIWIN *gemtk_win; //GRECT area; - LOG("ucs4: %"PRIu32 , ucs4); + NSLOG(netsurf, INFO, "ucs4: %"PRIu32, ucs4); hotlist_keypress(ucs4); //gemtk_win = atari_treeview_get_gemtk_window(cw); //atari_treeview_get_grect(cw, TREEVIEW_AREA_CONTENT, &area); @@ -104,7 +104,7 @@ static void atari_hotlist_mouse_action(struct core_window *cw, browser_mouse_state mouse, int x, int y) { - LOG("x: %d, y: %d\n", x, y); + NSLOG(netsurf, INFO, "x: %d, y: %d\n", x, y); hotlist_mouse_action(mouse, x, y); } @@ -123,7 +123,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) GRECT tb_area; GUIWIN * gemtk_win; - LOG("gw:%p", win); + NSLOG(netsurf, INFO, "gw:%p", win); tv = (struct atari_treeview_window*) gemtk_wm_get_user_data(win); cw = (struct core_window *)tv; @@ -132,7 +132,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) switch (msg[0]) { case WM_TOOLBAR: - LOG("WM_TOOLBAR"); + NSLOG(netsurf, INFO, "WM_TOOLBAR"); toolbar = gemtk_obj_get_tree(TOOLBAR_HOTLIST); @@ -198,7 +198,7 @@ void atari_hotlist_init(void) strncpy( (char*)&hl.path, nsoption_charp(hotlist_file), PATH_MAX-1 ); } - LOG("Hotlist: %s", (char *)&hl.path); + NSLOG(netsurf, INFO, "Hotlist: %s", (char *)&hl.path); hotlist_init(hl.path, hl.path); if( hl.window == NULL ){ @@ -224,7 +224,8 @@ void atari_hotlist_init(void) if (hl.tv == NULL) { /* handle it properly, clean up previous allocs */ - LOG("Failed to allocate treeview"); + NSLOG(netsurf, INFO, + "Failed to allocate treeview"); return; } @@ -276,7 +277,7 @@ void atari_hotlist_destroy(void) atari_treeview_delete(hl.tv); hl.init = false; } - LOG("done"); + NSLOG(netsurf, INFO, "done"); } void atari_hotlist_redraw(void) @@ -299,7 +300,7 @@ void atari_hotlist_add_page( const char * url, const char * title ) return; if (hotlist_has_url(nsurl)) { - LOG("URL already added as Bookmark"); + NSLOG(netsurf, INFO, "URL already added as Bookmark"); nsurl_unref(nsurl); return; } diff --git a/frontends/atari/osspec.c b/frontends/atari/osspec.c index f64402e8d..ca042f164 100644 --- a/frontends/atari/osspec.c +++ b/frontends/atari/osspec.c @@ -119,14 +119,14 @@ char *gemdos_realpath(const char * path, char * rpath) return(rpath); } - LOG("realpath in: %s\n", path); + NSLOG(netsurf, INFO, "realpath in: %s\n", path); r = realpath(path, work); if (r != NULL) { unx2dos((const char *)r, rpath); - LOG("realpath out: %s\n", rpath); + NSLOG(netsurf, INFO, "realpath out: %s\n", rpath); return(rpath); } else { - LOG("realpath out: NULL!\n"); + NSLOG(netsurf, INFO, "realpath out: NULL!\n"); } return (NULL); } diff --git a/frontends/atari/plot/font_freetype.c b/frontends/atari/plot/font_freetype.c index 17d3c3bfd..1688e978b 100644 --- a/frontends/atari/plot/font_freetype.c +++ b/frontends/atari/plot/font_freetype.c @@ -154,11 +154,12 @@ static FT_Error ft_face_requester(FTC_FaceID face_id, FT_Library library, FT_Po error = FT_New_Face(library, ft_face->fontfile, ft_face->index, face); if (error) { - LOG("Could not find font (code %d)\n", error); + NSLOG(netsurf, INFO, "Could not find font (code %d)\n", error); } else { error = FT_Select_Charmap(*face, FT_ENCODING_UNICODE); if (error) { - LOG("Could not select charmap (code %d)\n", error); + NSLOG(netsurf, INFO, + "Could not select charmap (code %d)\n", error); } else { for (cidx = 0; cidx < (*face)->num_charmaps; cidx++) { if ((*face)->charmap == (*face)->charmaps[cidx]) { @@ -168,7 +169,7 @@ static FT_Error ft_face_requester(FTC_FaceID face_id, FT_Library library, FT_Po } } } - LOG("Loaded face from %s\n", ft_face->fontfile); + NSLOG(netsurf, INFO, "Loaded face from %s\n", ft_face->fontfile); return error; } @@ -190,7 +191,9 @@ ft_new_face(const char *option, const char *resname, const char *fontfile) } error = FTC_Manager_LookupFace(ft_cmanager, (FTC_FaceID)newf, &aface); if (error) { - LOG("Could not find font face %s (code %d)\n", fontfile, error); + NSLOG(netsurf, INFO, + "Could not find font face %s (code %d)\n", fontfile, + error); free(newf); newf = font_faces[FONT_FACE_DEFAULT]; /* use default */ } @@ -292,7 +295,8 @@ static bool ft_font_init(void) /* freetype library initialise */ error = FT_Init_FreeType( &library ); if (error) { - LOG("Freetype could not initialised (code %d)\n", error); + NSLOG(netsurf, INFO, + "Freetype could not initialised (code %d)\n", error); return false; } @@ -311,7 +315,9 @@ static bool ft_font_init(void) NULL, &ft_cmanager); if (error) { - LOG("Freetype could not initialise cache manager (code %d)\n", error); + NSLOG(netsurf, INFO, + "Freetype could not initialise cache manager (code %d)\n", + error); FT_Done_FreeType(library); return false; } @@ -330,7 +336,8 @@ static bool ft_font_init(void) FONT_PKG_PATH FONT_FILE_SANS ); if (font_faces[FONT_FACE_SANS_SERIF] == NULL) { - LOG("Could not find default font (code %d)\n", error); + NSLOG(netsurf, INFO, + "Could not find default font (code %d)\n", error); FTC_Manager_Done(ft_cmanager); FT_Done_FreeType(library); return false; @@ -688,7 +695,7 @@ int ctor_font_plotter_freetype( FONT_PLOTTER self ) self->draw_glyph = draw_glyph8; } - LOG("%s: %s\n", (char *)__FILE__, __FUNCTION__); + NSLOG(netsurf, INFO, "%s: %s\n", (char *)__FILE__, __FUNCTION__); if( !init ) { ft_font_init(); fontbmp = atari_bitmap_create(48, 48, 0); diff --git a/frontends/atari/plot/font_internal.c b/frontends/atari/plot/font_internal.c index 3575bc3e1..709697f74 100644 --- a/frontends/atari/plot/font_internal.c +++ b/frontends/atari/plot/font_internal.c @@ -96,7 +96,7 @@ int ctor_font_plotter_internal( FONT_PLOTTER self ) self->str_split = str_split; self->pixel_pos = pixel_pos; self->text = text; - LOG("%s: %s\n", (char *)__FILE__, __FUNCTION__); + NSLOG(netsurf, INFO, "%s: %s\n", (char *)__FILE__, __FUNCTION__); if( !init ) { vdih = self->vdi_handle; fontbmp = atari_bitmap_create(48, 48, 0); diff --git a/frontends/atari/plot/font_vdi.c b/frontends/atari/plot/font_vdi.c index ef5499207..7cd82ddc9 100644 --- a/frontends/atari/plot/font_vdi.c +++ b/frontends/atari/plot/font_vdi.c @@ -70,7 +70,7 @@ int ctor_font_plotter_vdi( FONT_PLOTTER self ) self->str_split = str_split; self->pixel_pos = pixel_pos; self->text = text; - LOG("%s: %s\n", (char *)__FILE__, __FUNCTION__); + NSLOG(netsurf, INFO, "%s: %s\n", (char *)__FILE__, __FUNCTION__); if( !init ) { vdih = self->vdi_handle; } diff --git a/frontends/atari/plot/plot.c b/frontends/atari/plot/plot.c index 2324f82d9..14c670352 100644 --- a/frontends/atari/plot/plot.c +++ b/frontends/atari/plot/plot.c @@ -1628,7 +1628,7 @@ int plot_init(const struct redraw_context *ctx, char *fdrvrname) short work_out[57]; atari_plot_vdi_handle=graf_handle(&dummy, &dummy, &dummy, &dummy); v_opnvwk(work_in, &atari_plot_vdi_handle, work_out); - LOG("Plot VDI handle: %d", atari_plot_vdi_handle); + NSLOG(netsurf, INFO, "Plot VDI handle: %d", atari_plot_vdi_handle); } read_vdi_sysinfo(atari_plot_vdi_handle, &vdi_sysinfo); if(verbose_log) { @@ -1640,7 +1640,8 @@ int plot_init(const struct redraw_context *ctx, char *fdrvrname) atari_font_flags, &err); if (err) { const char * desc = plot_err_str(err); - LOG("Unable to load font plotter %s -> %s", fdrvrname, desc ); + NSLOG(netsurf, INFO, "Unable to load font plotter %s -> %s", + fdrvrname, desc); die("font plotter"); } diff --git a/frontends/atari/rootwin.c b/frontends/atari/rootwin.c index 0b77cbba5..6576eac77 100644 --- a/frontends/atari/rootwin.c +++ b/frontends/atari/rootwin.c @@ -105,7 +105,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) switch (msg[0]) { case WM_REDRAW: - LOG("WM_REDRAW"); + NSLOG(netsurf, INFO, "WM_REDRAW"); on_redraw(data->rootwin, msg); break; @@ -113,7 +113,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) case WM_SIZED: case WM_MOVED: case WM_FULLED: - LOG("WM_SIZED"); + NSLOG(netsurf, INFO, "WM_SIZED"); on_resized(data->rootwin); break; @@ -132,7 +132,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) case WM_TOPPED: case WM_NEWTOP: case WM_UNICONIFY: - LOG("WM_TOPPED"); + NSLOG(netsurf, INFO, "WM_TOPPED"); gui_set_input_gui_window(data->rootwin->active_gui_window); //window_restore_active_gui_window(data->rootwin); // TODO: use something like "restore_active_gui_window_state()" @@ -143,7 +143,8 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) // TODO: this needs to iterate through all gui windows and // check if the rootwin is this window... if (data->rootwin->active_gui_window != NULL) { - LOG("WM_CLOSED initiated destroy for bw %p", data->rootwin->active_gui_window->browser->bw); + NSLOG(netsurf, INFO, "WM_CLOSED initiated destroy for bw %p", + data->rootwin->active_gui_window->browser->bw); browser_window_destroy( data->rootwin->active_gui_window->browser->bw); } @@ -166,13 +167,16 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) // handle key uint16_t nkc = gem_to_norm( (short)ev_out->emo_kmeta, (short)ev_out->emo_kreturn); - LOG("rootwin MU_KEYBD input, nkc: %x\n", nkc); + NSLOG(netsurf, INFO, "rootwin MU_KEYBD input, nkc: %x\n", nkc); retval = on_window_key_input(data->rootwin, nkc); // printf("on_window_key_input: %d\n", retval); } if ((ev_out->emo_events & MU_BUTTON) != 0) { - LOG("rootwin MU_BUTTON input, x: %d, y: %d\n", ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_x); + NSLOG(netsurf, INFO, + "rootwin MU_BUTTON input, x: %d, y: %d\n", + ev_out->emo_mouse.p_x, + ev_out->emo_mouse.p_x); window_get_grect(data->rootwin, BROWSER_AREA_CONTENT, &area); if (POINT_WITHIN(ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y, @@ -312,13 +316,13 @@ void window_unref_gui_window(ROOTWIN *rootwin, struct gui_window *gw) struct gui_window *w; input_window = NULL; - LOG("window: %p, gui_window: %p", rootwin, gw); + NSLOG(netsurf, INFO, "window: %p, gui_window: %p", rootwin, gw); w = window_list; // find the next active tab: while( w != NULL ) { if(w->root == rootwin && w != gw) { - LOG("activating next tab %p", w); + NSLOG(netsurf, INFO, "activating next tab %p", w); gui_set_input_gui_window(w); break; } @@ -338,7 +342,7 @@ int window_destroy(ROOTWIN *rootwin) assert(rootwin != NULL); - LOG("%p", rootwin); + NSLOG(netsurf, INFO, "%p", rootwin); if (gemtk_wm_get_user_data(rootwin->win) != NULL) { free(gemtk_wm_get_user_data(rootwin->win)); @@ -404,7 +408,7 @@ void window_restore_active_gui_window(ROOTWIN *rootwin) GRECT tb_area; struct gui_window *gw; - LOG("rootwin %p", rootwin); + NSLOG(netsurf, INFO, "rootwin %p", rootwin); assert(rootwin->active_gui_window); @@ -499,7 +503,7 @@ void window_set_focus(struct s_gui_win_root *rootwin, assert(rootwin != NULL); if (rootwin->focus.type != type || rootwin->focus.element != element) { - LOG("Set focus: %p (%d)\n", element, type); + NSLOG(netsurf, INFO, "Set focus: %p (%d)\n", element, type); rootwin->focus.type = type; rootwin->focus.element = element; switch( type ) { @@ -563,11 +567,11 @@ void window_set_active_gui_window(ROOTWIN *rootwin, struct gui_window *gw) { struct gui_window *old_gw = rootwin->active_gui_window; - LOG("gw %p",gw); + NSLOG(netsurf, INFO, "gw %p", gw); if (rootwin->active_gui_window != NULL) { if(rootwin->active_gui_window == gw) { - LOG("nothing to do..."); + NSLOG(netsurf, INFO, "nothing to do..."); return; } } @@ -576,7 +580,7 @@ void window_set_active_gui_window(ROOTWIN *rootwin, struct gui_window *gw) rootwin->active_gui_window = gw; if (old_gw != NULL) { - LOG("restoring window..."); + NSLOG(netsurf, INFO, "restoring window..."); window_restore_active_gui_window(rootwin); } } @@ -651,7 +655,7 @@ void window_open_search(ROOTWIN *rootwin, bool reformat) GRECT area; OBJECT *obj; - LOG("rootwin %p", rootwin); + NSLOG(netsurf, INFO, "rootwin %p", rootwin); gw = rootwin->active_gui_window; bw = gw->browser->bw; @@ -1478,7 +1482,13 @@ static void on_file_dropped(ROOTWIN *rootwin, short msg[8]) buff[size] = 0; - LOG("file: %s, ext: %s, size: %ld dropped at: %d,%d\n", (char *)buff, (char *)&ext, size, mx, my); + NSLOG(netsurf, INFO, + "file: %s, ext: %s, size: %ld dropped at: %d,%d\n", + (char *)buff, + (char *)&ext, + size, + mx, + my); gui_window_get_scroll(gw, &sx, &sy); @@ -1500,7 +1510,8 @@ static void on_file_dropped(ROOTWIN *rootwin, short msg[8]) if (ret != NSERROR_OK) { free(buff); /* A bad encoding should never happen */ - LOG("utf8_from_local_encoding failed"); + NSLOG(netsurf, INFO, + "utf8_from_local_encoding failed"); assert(ret != NSERROR_BAD_ENCODING); /* no memory */ goto error; diff --git a/frontends/atari/schedule.c b/frontends/atari/schedule.c index 48980426d..a8d06e499 100644 --- a/frontends/atari/schedule.c +++ b/frontends/atari/schedule.c @@ -71,7 +71,7 @@ static nserror schedule_remove(void (*callback)(void *p), void *p) return NSERROR_OK; } - LOG("removing %p, %p", callback, p); + NSLOG(netsurf, INFO, "removing %p, %p", callback, p); cur_nscb = schedule_list; prev_nscb = NULL; @@ -80,7 +80,9 @@ static nserror schedule_remove(void (*callback)(void *p), void *p) if ((cur_nscb->callback == callback) && (cur_nscb->p == p)) { /* item to remove */ - LOG("callback entry %p removing %p(%p)", cur_nscb, cur_nscb->callback, cur_nscb->p); + NSLOG(netsurf, INFO, + "callback entry %p removing %p(%p)", cur_nscb, + cur_nscb->callback, cur_nscb->p); /* remove callback */ unlnk_nscb = cur_nscb; @@ -118,7 +120,8 @@ nserror atari_schedule(int ival, void (*callback)(void *p), void *p) nscb->timeout = MS_NOW() + ival; - LOG("adding callback %p for %p(%p) at %d ms", nscb, callback, p, nscb->timeout); + NSLOG(netsurf, INFO, "adding callback %p for %p(%p) at %d ms", nscb, + callback, p, nscb->timeout); nscb->callback = callback; nscb->p = p; @@ -164,7 +167,9 @@ int schedule_run(void) prev_nscb->next = unlnk_nscb->next; } - LOG("callback entry %p running %p(%p)", unlnk_nscb, unlnk_nscb->callback, unlnk_nscb->p); + NSLOG(netsurf, INFO, + "callback entry %p running %p(%p)", unlnk_nscb, + unlnk_nscb->callback, unlnk_nscb->p); /* call callback */ unlnk_nscb->callback(unlnk_nscb->p); @@ -173,7 +178,7 @@ int schedule_run(void) /* need to deal with callback modifying the list. */ if (schedule_list == NULL) { - LOG("schedule_list == NULL"); + NSLOG(netsurf, INFO, "schedule_list == NULL"); return -1; /* no more callbacks scheduled */ } @@ -198,7 +203,8 @@ int schedule_run(void) /* make rettime relative to now and convert to ms */ nexttime = nexttime - now; - LOG("returning time to next event as %ldms", nexttime); + NSLOG(netsurf, INFO, "returning time to next event as %ldms", + nexttime); /*return next event time in milliseconds (24days max wait) */ return nexttime; @@ -210,14 +216,15 @@ void list_schedule(void) { struct nscallback *cur_nscb; - LOG("schedule list at ms clock %ld", MS_NOW()); + NSLOG(netsurf, INFO, "schedule list at ms clock %ld", MS_NOW()); cur_nscb = schedule_list; while (cur_nscb != NULL) { - LOG("Schedule %p at %ld", cur_nscb, cur_nscb->timeout); + NSLOG(netsurf, INFO, "Schedule %p at %ld", cur_nscb, + cur_nscb->timeout); cur_nscb = cur_nscb->next; } - LOG("Maxmium callbacks scheduled: %d", max_scheduled); + NSLOG(netsurf, INFO, "Maxmium callbacks scheduled: %d", max_scheduled); } diff --git a/frontends/atari/search.c b/frontends/atari/search.c index 4da7f16a3..8df4ad676 100644 --- a/frontends/atari/search.c +++ b/frontends/atari/search.c @@ -67,7 +67,7 @@ struct gui_search_table *atari_search_table = &search_table; */ void nsatari_search_set_status(bool found, void *p) { - LOG("%p set status: %d\n", p, found); + NSLOG(netsurf, INFO, "%p set status: %d\n", p, found); // TODO: maybe update GUI } @@ -80,7 +80,7 @@ void nsatari_search_set_status(bool found, void *p) void nsatari_search_set_hourglass(bool active, void *p) { SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p; - LOG("active: %d, session: %p", active, p); + NSLOG(netsurf, INFO, "active: %d, session: %p", active, p); if (active) { gui_window_set_pointer(s->g, GUI_POINTER_PROGRESS); } else { @@ -99,7 +99,7 @@ void nsatari_search_set_hourglass(bool active, void *p) */ void nsatari_search_add_recent(const char *string, void *p) { - LOG("%p add recent: %s\n", p, string); + NSLOG(netsurf, INFO, "%p add recent: %s\n", p, string); } @@ -115,7 +115,7 @@ void nsatari_search_set_forward_state(bool active, void *p) GRECT area; SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p; /* deactivate back cb */ - LOG("%p: set forward state: %d\n", p, active); + NSLOG(netsurf, INFO, "%p: set forward state: %d\n", p, active); gw = s->g; @@ -142,7 +142,7 @@ void nsatari_search_set_back_state(bool active, void *p) GRECT area; SEARCH_FORM_SESSION s = (SEARCH_FORM_SESSION)p; /* deactivate back cb */ - LOG("%p: set back state: %d\n", p, active); + NSLOG(netsurf, INFO, "%p: set back state: %d\n", p, active); s->state.back_avail = active; gw = s->g; @@ -224,7 +224,7 @@ void nsatari_search_restore_form( struct s_search_form_session *s, OBJECT *obj) void nsatari_search_session_destroy(struct s_search_form_session *s) { if (s != NULL) { - LOG("session %p", s); + NSLOG(netsurf, INFO, "session %p", s); browser_window_search_clear(s->g->browser->bw); free(s); } diff --git a/frontends/atari/settings.c b/frontends/atari/settings.c index ed1fb2e45..ac4afa315 100644 --- a/frontends/atari/settings.c +++ b/frontends/atari/settings.c @@ -172,7 +172,7 @@ static char **read_locales(void) atari_warn_user("Failed to load locales: %s",buf); return(NULL); } else { - LOG("Reading locales from: %s...", buf); + NSLOG(netsurf, INFO, "Reading locales from: %s...", buf); } /* Count items: */ @@ -980,12 +980,12 @@ void open_settings(void) void close_settings(void) { - LOG("closing"); + NSLOG(netsurf, INFO, "closing"); gemtk_wm_remove(settings_guiwin); settings_guiwin = NULL; wind_close(h_aes_win); wind_delete(h_aes_win); h_aes_win = 0; - LOG("Done"); + NSLOG(netsurf, INFO, "Done"); } diff --git a/frontends/atari/statusbar.c b/frontends/atari/statusbar.c index 3a216f9a8..fe2008c82 100644 --- a/frontends/atari/statusbar.c +++ b/frontends/atari/statusbar.c @@ -166,7 +166,7 @@ CMP_STATUSBAR sb_create( struct gui_window * gw ) void sb_destroy( CMP_STATUSBAR s ) { - LOG("%s\n", __FUNCTION__); + NSLOG(netsurf, INFO, "%s\n", __FUNCTION__); if( s ) { if( s->comp ){ mt_CompDelete( &app, s->comp ); @@ -206,7 +206,7 @@ CMP_STATUSBAR sb_create( struct gui_window * gw ) void sb_destroy( CMP_STATUSBAR s ) { - LOG("%s\n", __FUNCTION__); + NSLOG(netsurf, INFO, "%s\n", __FUNCTION__); if( s ) { free( s ); } diff --git a/frontends/atari/toolbar.c b/frontends/atari/toolbar.c index 1b9371763..fdfedcbee 100644 --- a/frontends/atari/toolbar.c +++ b/frontends/atari/toolbar.c @@ -269,7 +269,7 @@ struct s_toolbar *toolbar_create(struct s_gui_win_root *owner) int i; struct s_toolbar *t; - LOG("owner %p", owner); + NSLOG(netsurf, INFO, "owner %p", owner); assert(init == true); @@ -327,8 +327,9 @@ struct s_toolbar *toolbar_create(struct s_gui_win_root *owner) t->throbber.max_index = THROBBER_MAX_INDEX; t->throbber.running = false; - LOG("created toolbar: %p, root: %p, textarea: %p, throbber: %p", - t, owner, t->url.textarea, &t->throbber); + NSLOG(netsurf, INFO, + "created toolbar: %p, root: %p, textarea: %p, throbber: %p", t, + owner, t->url.textarea, &t->throbber); return( t ); } @@ -458,7 +459,7 @@ toolbar_update_buttons(struct s_toolbar *tb, struct browser_window *bw, short button) { - LOG("tb %p", tb); + NSLOG(netsurf, INFO, "tb %p", tb); struct s_tb_button * bt; bool enable = false; @@ -582,7 +583,7 @@ void toolbar_set_dimensions(struct s_toolbar *tb, GRECT *area) void toolbar_set_url(struct s_toolbar *tb, const char *text) { - LOG("tb %p", tb); + NSLOG(netsurf, INFO, "tb %p", tb); textarea_set_text(tb->url.textarea, text); @@ -668,7 +669,7 @@ bool toolbar_text_input(struct s_toolbar *tb, char *text) { bool handled = true; - LOG("tb %p", tb); + NSLOG(netsurf, INFO, "tb %p", tb); return(handled); } @@ -757,7 +758,7 @@ void toolbar_mouse_input(struct s_toolbar *tb, short obj, short button) short mx, my, mb, kstat; struct gui_window * gw; - LOG("tb %p", tb); + NSLOG(netsurf, INFO, "tb %p", tb); if (obj==TOOLBAR_AREA_URL) { diff --git a/frontends/atari/treeview.c b/frontends/atari/treeview.c index abc1fa780..23db41309 100644 --- a/frontends/atari/treeview.c +++ b/frontends/atari/treeview.c @@ -362,8 +362,8 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) on_keybd_event(cw, ev_out, msg); } if ((ev_out->emo_events & MU_BUTTON) != 0 ) { - LOG("Treeview click at: %d,%d\n", - ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y); + NSLOG(netsurf, INFO, "Treeview click at: %d,%d\n", + ev_out->emo_mouse.p_x, ev_out->emo_mouse.p_y); on_mbutton_event(cw, ev_out, msg); } @@ -541,7 +541,7 @@ atari_treeview_create(GUIWIN *win, struct atari_treeview_callbacks * callbacks, tv = calloc(1, sizeof(struct atari_treeview_window)); if (tv == NULL) { - LOG("calloc failed"); + NSLOG(netsurf, INFO, "calloc failed"); atari_warn_user(messages_get_errorcode(NSERROR_NOMEM), 0); return NULL; } diff --git a/frontends/atari/verify_ssl.c b/frontends/atari/verify_ssl.c index 33136eebd..b099fe488 100644 --- a/frontends/atari/verify_ssl.c +++ b/frontends/atari/verify_ssl.c @@ -80,7 +80,9 @@ static void __CDECL cert_info_draw( WINDOW * win, short buf[8], void * data) if( line == NULL ) return; - LOG("Cert info draw, win: %p, data: %p, scrollx: %d", win, data, dp->scrollx ); + NSLOG(netsurf, INFO, + "Cert info draw, win: %p, data: %p, scrollx: %d", win, data, + dp->scrollx); WindGet( win, WF_WORKXYWH, &x, &y, &w, &h ); /*using static values here, as RsrcUserDraw has mem leaks & a very small stack */ @@ -158,7 +160,7 @@ static void do_popup( WINDOW *win, int index, int mode, void *data) char * items[dp->num_certs]; short x, y; unsigned int i; - LOG("do_popup: num certs: %d", dp->num_certs); + NSLOG(netsurf, INFO, "do_popup: num certs: %d", dp->num_certs); for( i = 0; inum_certs; i++) { items[i] = malloc( 48 ); strncpy(items[i], (char*)&dp->cert_infos_n[i].issuer, 46 ); @@ -246,7 +248,7 @@ verify_ssl_form_do(const char * url, break; case VERIFY_BT_SCROLL_R: - LOG("scroll r!"); + NSLOG(netsurf, INFO, "scroll r!"); cont = true; dp.scrollx += 1; if( dp.scrollx > (dp.cols - (272 / 8 )) ) diff --git a/frontends/framebuffer/bitmap.c b/frontends/framebuffer/bitmap.c index 027e0122b..59f68bba5 100644 --- a/frontends/framebuffer/bitmap.c +++ b/frontends/framebuffer/bitmap.c @@ -51,7 +51,8 @@ static void *bitmap_create(int width, int height, unsigned int state) { nsfb_t *bm; - LOG("width %d, height %d, state %u", width, height, state); + NSLOG(netsurf, INFO, "width %d, height %d, state %u", width, height, + state); bm = nsfb_new(NSFB_SURFACE_RAM); if (bm == NULL) { @@ -69,7 +70,7 @@ static void *bitmap_create(int width, int height, unsigned int state) return NULL; } - LOG("bitmap %p", bm); + NSLOG(netsurf, INFO, "bitmap %p", bm); return bm; } @@ -197,11 +198,11 @@ static bool bitmap_test_opaque(void *bitmap) while (tst-- > 0) { if (bmpptr[(tst << 2) + 3] != 0xff) { - LOG("bitmap %p has transparency", bm); + NSLOG(netsurf, INFO, "bitmap %p has transparency", bm); return false; } } - LOG("bitmap %p is opaque", bm); + NSLOG(netsurf, INFO, "bitmap %p is opaque", bm); return true; } @@ -282,7 +283,7 @@ bitmap_render(struct bitmap *bitmap, nsfb_get_geometry(tbm, &width, &height, NULL); - LOG("width %d, height %d", width, height); + NSLOG(netsurf, INFO, "width %d, height %d", width, height); /* Calculate size of buffer to render the content into */ /* We get the width from the content width, unless it exceeds 1024, diff --git a/frontends/framebuffer/clipboard.c b/frontends/framebuffer/clipboard.c index 1254c36f3..20a00e038 100644 --- a/frontends/framebuffer/clipboard.c +++ b/frontends/framebuffer/clipboard.c @@ -53,8 +53,8 @@ static void gui_get_clipboard(char **buffer, size_t *length) if (gui_clipboard.length > 0) { assert(gui_clipboard.buffer != NULL); - LOG("Pasting %zd bytes: \"%s\"\n", - gui_clipboard.length, gui_clipboard.buffer); + NSLOG(netsurf, INFO, "Pasting %zd bytes: \"%s\"\n", + gui_clipboard.length, gui_clipboard.buffer); *buffer = malloc(gui_clipboard.length); diff --git a/frontends/framebuffer/convert_font.c b/frontends/framebuffer/convert_font.c index 010af857a..6d7c4d44e 100644 --- a/frontends/framebuffer/convert_font.c +++ b/frontends/framebuffer/convert_font.c @@ -278,7 +278,8 @@ bool generate_font_header(const char *path, struct font_data *data) fp = fopen(path, "wb"); if (fp == NULL) { - LOG(LOG_ERROR, "Couldn't open header file \"%s\"\n", path); + NSLOG(netsurf, INFO, LOG_ERROR, + "Couldn't open header file \"%s\"\n", path); return false; } @@ -315,7 +316,8 @@ bool generate_font_source(const char *path, struct font_data *data) fp = fopen(path, "wb"); if (fp == NULL) { - LOG(LOG_ERROR, "Couldn't open output file \"%s\"\n", path); + NSLOG(netsurf, INFO, LOG_ERROR, + "Couldn't open output file \"%s\"\n", path); return false; } @@ -413,14 +415,14 @@ static bool add_glyph_to_data(glyph_entry *add, int id, int style, d->e[d->glyphs++] = e; e->index = d->glyphs; if (d->glyphs >= 0xfffd) { - LOG(LOG_ERROR, " Too many glyphs for internal data " - "representation\n"); + NSLOG(netsurf, INFO, LOG_ERROR, + " Too many glyphs for internal data ""representation\n"); return false; } } else { /* Duplicate glyph */ - LOG(LOG_DEBUG, " U+%.4X (%s) is duplicate\n", - id, short_labels[style]); + NSLOG(netsurf, INFO, LOG_DEBUG, + " U+%.4X (%s) is duplicate\n", id, short_labels[style]); } /* Find glyph's section */ @@ -432,8 +434,8 @@ static bool add_glyph_to_data(glyph_entry *add, int id, int style, size_t size = (d->sec_count[style] + 1) * SECTION_SIZE; uint16_t *temp = realloc(d->sections[style], size); if (temp == NULL) { - LOG(LOG_ERROR, " Couldn't increase sections " - "allocation\n"); + NSLOG(netsurf, INFO, LOG_ERROR, + " Couldn't increase sections ""allocation\n"); return false; } memset(temp + d->sec_count[style] * 256, 0, @@ -456,47 +458,50 @@ static bool check_glyph_data_valid(int pos, char c) if (pos == 44) { if (c != '\n') { - LOG(LOG_ERROR, " Invalid glyph data: " - "expecting '\\n', got '%c' (%i)\n", - c, c); + NSLOG(netsurf, INFO, LOG_ERROR, + " Invalid glyph data: ""expecting '\\n', got '%c' (%i)\n", + c, + c); return false; } else { return true; } } else if (pos < 3) { if (c != ' ') { - LOG(LOG_ERROR, " Invalid glyph data: " - "expecting ' ', got '%c' (%i)\n", - c, c); + NSLOG(netsurf, INFO, LOG_ERROR, + " Invalid glyph data: ""expecting ' ', got '%c' (%i)\n", + c, + c); return false; } else { return true; } } else if (offset == 0) { if (c != '\n' && c != ' ') { - LOG(LOG_ERROR, " Invalid glyph data: " - "expecting '\\n' or ' ', " - "got '%c' (%i)\n", - c, c); + NSLOG(netsurf, INFO, LOG_ERROR, + " Invalid glyph data: ""expecting '\\n' or ' ', ""got '%c' (%i)\n", + c, + c); return false; } else { return true; } } else if (offset < 3) { if (c != ' ') { - LOG(LOG_ERROR, " Invalid glyph data: " - "expecting ' ', got '%c' (%i)\n", - c, c); + NSLOG(netsurf, INFO, LOG_ERROR, + " Invalid glyph data: ""expecting ' ', got '%c' (%i)\n", + c, + c); return false; } else { return true; } } else if (offset >= 3 && pos < 11) { if (c != '.' && c != '#') { - LOG(LOG_ERROR, " Invalid glyph data: " - "expecting '.' or '#', " - "got '%c' (%i)\n", - c, c); + NSLOG(netsurf, INFO, LOG_ERROR, + " Invalid glyph data: ""expecting '.' or '#', ""got '%c' (%i)\n", + c, + c); return false; } else { return true; @@ -505,10 +510,10 @@ static bool check_glyph_data_valid(int pos, char c) /* offset must be >=3 */ if (c != '.' && c != '#' && c != ' ') { - LOG(LOG_ERROR, " Invalid glyph data: " - "expecting '.', '#', or ' ', " - "got '%c' (%i)\n", - c, c); + NSLOG(netsurf, INFO, LOG_ERROR, + " Invalid glyph data: ""expecting '.', '#', or ' ', ""got '%c' (%i)\n", + c, + c); return false; } @@ -697,11 +702,11 @@ static bool parse_glyph_data(struct parse_context *ctx, char c, /* Check that character is valid */ if (check_glyph_data_valid(ctx->data.in_gd.pos, c) == false) { - LOG(LOG_ERROR, " Error in U+%.4X data: " - "glyph line: %i, pos: %i\n", - ctx->id, - ctx->data.in_gd.line, - ctx->data.in_gd.pos); + NSLOG(netsurf, INFO, LOG_ERROR, + " Error in U+%.4X data: ""glyph line: %i, pos: %i\n", + ctx->id, + ctx->data.in_gd.line, + ctx->data.in_gd.pos); goto error; } @@ -712,8 +717,8 @@ static bool parse_glyph_data(struct parse_context *ctx, char c, ctx->data.in_gd.e[glyph] = calloc(sizeof(struct glyph_entry), 1); if (ctx->data.in_gd.e[glyph] == NULL) { - LOG(LOG_ERROR, " Couldn't allocate memory for " - "glyph entry\n"); + NSLOG(netsurf, INFO, LOG_ERROR, + " Couldn't allocate memory for ""glyph entry\n"); goto error; } @@ -735,18 +740,17 @@ static bool parse_glyph_data(struct parse_context *ctx, char c, if (c == '\n') { if (ctx->data.in_gd.line == 0) { if (ctx->data.in_gd.e[0] == NULL) { - LOG(LOG_ERROR, " Error in U+%.4X data: " - "\"Regular\" glyph style must " - "be present\n", ctx->id); + NSLOG(netsurf, INFO, LOG_ERROR, + " Error in U+%.4X data: ""\"Regular\" glyph style must ""be present\n", + ctx->id); goto error; } } else if (ctx->data.in_gd.styles != ctx->data.in_gd.line_styles) { - LOG(LOG_ERROR, " Error in U+%.4X data: " - "glyph line: %i " - "styles don't match first line\n", - ctx->id, - ctx->data.in_gd.line); + NSLOG(netsurf, INFO, LOG_ERROR, + " Error in U+%.4X data: ""glyph line: %i ""styles don't match first line\n", + ctx->id, + ctx->data.in_gd.line); goto error; } @@ -764,10 +768,10 @@ static bool parse_glyph_data(struct parse_context *ctx, char c, ctx->count[i] += 1; if (glyph_is_codepoint(ctx->data.in_gd.e[i], ctx->id, i)) { - LOG(LOG_DEBUG, " U+%.4X (%s) is " - "codepoint\n", - ctx->id, - short_labels[i]); + NSLOG(netsurf, INFO, LOG_DEBUG, + " U+%.4X (%s) is ""codepoint\n", + ctx->id, + short_labels[i]); ctx->codepoints += 1; free(ctx->data.in_gd.e[i]); ctx->data.in_gd.e[i] = NULL; @@ -810,7 +814,8 @@ static bool get_hex_digit_value(char c, int *v) else if (c >= 'A' && c <= 'F') *v = (10 + c - 'A'); else { - LOG(LOG_ERROR, "Invalid hex digit '%c' (%i)\n", c, c); + NSLOG(netsurf, INFO, LOG_ERROR, + "Invalid hex digit '%c' (%i)\n", c, c); return false; } @@ -847,14 +852,16 @@ static bool parse_chunk(struct parse_context *ctx, const char *buf, size_t len, while (pos < end) { if (*pos == '\r') { - LOG(LOG_ERROR, "Detected \'\\r\': Bad line ending\n"); + NSLOG(netsurf, INFO, LOG_ERROR, + "Detected \'\\r\': Bad line ending\n"); return false; } switch (ctx->state) { case START: if (*pos != '*') { - LOG(LOG_ERROR, "First character must be '*'\n"); + NSLOG(netsurf, INFO, LOG_ERROR, + "First character must be '*'\n"); printf("Got: %c (%i)\n", *pos, *pos); return false; } @@ -866,12 +873,13 @@ static bool parse_chunk(struct parse_context *ctx, const char *buf, size_t len, case IN_HEADER: if (ctx->data.in_header.new_line == true) { if (*pos != '*') { - LOG(LOG_INFO, " Got header " - "(%i bytes)\n", - d->header_len); - LOG(LOG_DEBUG, " Header:\n\n%.*s\n", - d->header_len, - d->header); + NSLOG(netsurf, INFO, LOG_INFO, + " Got header ""(%i bytes)\n", + d->header_len); + NSLOG(netsurf, INFO, LOG_DEBUG, + " Header:\n\n%.*s\n", + d->header_len, + d->header); ctx->data.before_id.new_line = false; ctx->data.before_id.u = false; ctx->state = BEFORE_ID; @@ -886,9 +894,9 @@ static bool parse_chunk(struct parse_context *ctx, const char *buf, size_t len, } if (d->header_len == HEADER_MAX) { - LOG(LOG_ERROR, " Header too long " - "(>%i bytes)\n", - d->header_len); + NSLOG(netsurf, INFO, LOG_ERROR, + " Header too long ""(>%i bytes)\n", + d->header_len); return false; } @@ -922,7 +930,8 @@ static bool parse_chunk(struct parse_context *ctx, const char *buf, size_t len, ok = assemble_codepoint(pos, ctx->data.g_id.c++, &ctx->id); if (!ok) { - LOG(LOG_ERROR, " Invalid glyph ID\n"); + NSLOG(netsurf, INFO, LOG_ERROR, + " Invalid glyph ID\n"); return false; } @@ -994,8 +1003,8 @@ static bool parse_chunk(struct parse_context *ctx, const char *buf, size_t len, } for (i = 0; i < 4; i++) { - LOG(LOG_DEBUG, " %s: %i gylphs\n", labels[i], - ctx->count[i] - count[i]); + NSLOG(netsurf, INFO, LOG_DEBUG, " %s: %i gylphs\n", + labels[i], ctx->count[i] - count[i]); } return true; @@ -1019,13 +1028,15 @@ bool load_font(const char *path, struct font_data **data) fp = fopen(path, "rb"); if (fp == NULL) { - LOG(LOG_ERROR, "Couldn't open font data file\n"); + NSLOG(netsurf, INFO, LOG_ERROR, + "Couldn't open font data file\n"); return false; } d = calloc(sizeof(struct font_data), 1); if (d == NULL) { - LOG(LOG_ERROR, "Couldn't allocate memory for font data\n"); + NSLOG(netsurf, INFO, LOG_ERROR, + "Couldn't allocate memory for font data\n"); fclose(fp); return false; } @@ -1034,18 +1045,19 @@ bool load_font(const char *path, struct font_data **data) fseek(fp, 0L, SEEK_END); file_len = ftell(fp); if (file_len == -1) { - LOG(LOG_ERROR, "Could not size input file\n"); + NSLOG(netsurf, INFO, LOG_ERROR, "Could not size input file\n"); free(d); fclose(fp); return false; } fseek(fp, 0L, SEEK_SET); - LOG(LOG_DEBUG, "Input size: %zu bytes\n", file_len); + NSLOG(netsurf, INFO, LOG_DEBUG, "Input size: %zu bytes\n", file_len); /* Allocate buffer for data chunks */ buf = malloc(CHUNK_SIZE); if (buf == NULL) { - LOG(LOG_ERROR, "Couldn't allocate memory for input buffer\n"); + NSLOG(netsurf, INFO, LOG_ERROR, + "Couldn't allocate memory for input buffer\n"); free(d); fclose(fp); return false; @@ -1054,20 +1066,24 @@ bool load_font(const char *path, struct font_data **data) /* Initialise parser */ parse_init(&ctx); - LOG(LOG_DEBUG, "Using chunk size of %i bytes\n", CHUNK_SIZE); + NSLOG(netsurf, INFO, LOG_DEBUG, "Using chunk size of %i bytes\n", + CHUNK_SIZE); /* Parse the input file in chunks */ for (done = 0; done < file_len; done += CHUNK_SIZE) { - LOG(LOG_INFO, "Parsing input chunk %zu\n", done / CHUNK_SIZE); + NSLOG(netsurf, INFO, LOG_INFO, "Parsing input chunk %zu\n", + done / CHUNK_SIZE); /* Read chunk */ len = fread(buf, 1, CHUNK_SIZE, fp); if (file_len - done < CHUNK_SIZE && len != file_len - done) { - LOG(LOG_WARNING, "Last chunk has suspicious size\n"); + NSLOG(netsurf, INFO, LOG_WARNING, + "Last chunk has suspicious size\n"); } else if (file_len - done >= CHUNK_SIZE && len != CHUNK_SIZE) { - LOG(LOG_ERROR, "Problem reading file\n"); + NSLOG(netsurf, INFO, LOG_ERROR, + "Problem reading file\n"); free(buf); free(d); fclose(fp); @@ -1082,29 +1098,33 @@ bool load_font(const char *path, struct font_data **data) fclose(fp); return false; } - LOG(LOG_DEBUG, "Parsed %zu bytes\n", done + len); + NSLOG(netsurf, INFO, LOG_DEBUG, "Parsed %zu bytes\n", + done + len); } fclose(fp); if (ctx.state != BEFORE_ID) { - LOG(LOG_ERROR, "Unexpected end of file\n"); + NSLOG(netsurf, INFO, LOG_ERROR, "Unexpected end of file\n"); free(buf); free(d); return false; } - LOG(LOG_INFO, "Parsing complete:\n"); + NSLOG(netsurf, INFO, LOG_INFO, "Parsing complete:\n"); count = 0; for (i = 0; i < 4; i++) { - LOG(LOG_INFO, " %s: %i gylphs\n", labels[i], ctx.count[i]); + NSLOG(netsurf, INFO, LOG_INFO, " %s: %i gylphs\n", + labels[i], ctx.count[i]); count += ctx.count[i]; } - LOG(LOG_RESULT, " Total %i gylphs " - "(of which %i unique, %i codepoints, %i duplicates)\n", - count, d->glyphs, ctx.codepoints, - count - d->glyphs - ctx.codepoints); + NSLOG(netsurf, INFO, LOG_RESULT, + " Total %i gylphs ""(of which %i unique, %i codepoints, %i duplicates)\n", + count, + d->glyphs, + ctx.codepoints, + count - d->glyphs - ctx.codepoints); free(buf); @@ -1115,16 +1135,9 @@ bool load_font(const char *path, struct font_data **data) static void log_usage(const char *argv0) { level = LOG_INFO; - LOG(LOG_INFO, - "Usage:\n" - "\t%s [options] \n" - "\n" - "Options:\n" - "\t--help -h Display this text\n" - "\t--quiet -q Don't show warnings\n" - "\t--verbose -v Verbose output\n" - "\t--debug -d Full debug output\n", - argv0); + NSLOG(netsurf, INFO, LOG_INFO, + "Usage:\n""\t%s [options] \n""\n""Options:\n""\t--help -h Display this text\n""\t--quiet -q Don't show warnings\n""\t--verbose -v Verbose output\n""\t--debug -d Full debug output\n", + argv0); } int main(int argc, char** argv) @@ -1187,8 +1200,9 @@ int main(int argc, char** argv) in_path = argv[optind]; out_path = argv[optind + 1]; - LOG(LOG_DEBUG, "Using input path: \"%s\"\n", in_path); - LOG(LOG_DEBUG, "Using output path: \"%s\"\n", out_path); + NSLOG(netsurf, INFO, LOG_DEBUG, "Using input path: \"%s\"\n", in_path); + NSLOG(netsurf, INFO, LOG_DEBUG, "Using output path: \"%s\"\n", + out_path); ok = load_font(in_path, &data); if (!ok) { diff --git a/frontends/framebuffer/fbtk/event.c b/frontends/framebuffer/fbtk/event.c index a48e63809..84c6c3791 100644 --- a/frontends/framebuffer/fbtk/event.c +++ b/frontends/framebuffer/fbtk/event.c @@ -51,7 +51,7 @@ fbtk_input(fbtk_widget_t *root, nsfb_event_t *event) /* obtain widget with input focus */ input = root->u.root.input; if (input == NULL) { - LOG("No widget has input focus."); + NSLOG(netsurf, INFO, "No widget has input focus."); return; /* no widget with input */ } @@ -84,7 +84,7 @@ fbtk_click(fbtk_widget_t *widget, nsfb_event_t *event) x = fbtk_get_absx(clicked); y = fbtk_get_absy(clicked); - LOG("clicked %p at %d,%d", clicked, x, y); + NSLOG(netsurf, INFO, "clicked %p at %d,%d", clicked, x, y); /* post the click */ fbtk_post_callback(clicked, FBTK_CBT_CLICK, event, cloc.x0 - x, cloc.y0 - y); diff --git a/frontends/framebuffer/fbtk/fbtk.c b/frontends/framebuffer/fbtk/fbtk.c index c63a6d8c9..a0b0f6660 100644 --- a/frontends/framebuffer/fbtk/fbtk.c +++ b/frontends/framebuffer/fbtk/fbtk.c @@ -53,7 +53,7 @@ dump_tk_tree(fbtk_widget_t *widget) int indent = 0; while (widget != NULL) { - LOG("%*s%p", indent, "", widget); + NSLOG(netsurf, INFO, "%*s%p", indent, "", widget); if (widget->first_child != NULL) { widget = widget->first_child; indent += 6; @@ -101,7 +101,9 @@ fbtk_request_redraw(fbtk_widget_t *widget) widget->redraw.height = widget->height; #ifdef FBTK_LOGGING - LOG("redrawing %p %d,%d %d,%d", widget, widget->redraw.x, widget->redraw.y, widget->redraw.width, widget->redraw.height); + NSLOG(netsurf, INFO, "redrawing %p %d,%d %d,%d", widget, + widget->redraw.x, widget->redraw.y, widget->redraw.width, + widget->redraw.height); #endif cwidget = widget->last_child; @@ -122,7 +124,7 @@ fbtk_request_redraw(fbtk_widget_t *widget) int fbtk_set_mapping(fbtk_widget_t *widget, bool map) { - LOG("setting mapping on %p to %d", widget, map); + NSLOG(netsurf, INFO, "setting mapping on %p to %d", widget, map); widget->mapped = map; if (map) { fbtk_request_redraw(widget); @@ -145,7 +147,7 @@ swap_siblings(fbtk_widget_t *lw) assert(rw != NULL); - LOG("Swapping %p with %p", lw, rw); + NSLOG(netsurf, INFO, "Swapping %p with %p", lw, rw); before = lw->prev; after = rw->next; @@ -411,7 +413,8 @@ fbtk_get_root_widget(fbtk_widget_t *widget) /* check root widget was found */ if (widget->type != FB_WIDGET_TYPE_ROOT) { - LOG("Widget with null parent that is not the root widget!"); + NSLOG(netsurf, INFO, + "Widget with null parent that is not the root widget!"); return NULL; } @@ -552,7 +555,8 @@ fbtk_widget_new(fbtk_widget_t *parent, return NULL; #ifdef FBTK_LOGGING - LOG("creating %p %d,%d %d,%d", neww, x, y, width, height); + NSLOG(netsurf, INFO, "creating %p %d,%d %d,%d", neww, x, y, width, + height); #endif /* make new window fit inside parent */ @@ -575,7 +579,8 @@ fbtk_widget_new(fbtk_widget_t *parent, } #ifdef FBTK_LOGGING - LOG("using %p %d,%d %d,%d", neww, x, y, width, height); + NSLOG(netsurf, INFO, "using %p %d,%d %d,%d", neww, x, y, width, + height); #endif /* set values */ neww->type = type; @@ -635,7 +640,8 @@ do_redraw(nsfb_t *nsfb, fbtk_widget_t *widget) plot_ctx.y1 = plot_ctx.y0 + widget->redraw.height; #ifdef FBTK_LOGGING - LOG("clipping %p %d,%d %d,%d", widget, plot_ctx.x0, plot_ctx.y0, plot_ctx.x1, plot_ctx.y1); + NSLOG(netsurf, INFO, "clipping %p %d,%d %d,%d", widget, + plot_ctx.x0, plot_ctx.y0, plot_ctx.x1, plot_ctx.y1); #endif if (nsfb_plot_set_clip(nsfb, &plot_ctx) == true) { fbtk_post_callback(widget, FBTK_CBT_REDRAW); diff --git a/frontends/framebuffer/fbtk/scroll.c b/frontends/framebuffer/fbtk/scroll.c index cc98fb2dd..b056ac81f 100644 --- a/frontends/framebuffer/fbtk/scroll.c +++ b/frontends/framebuffer/fbtk/scroll.c @@ -334,7 +334,7 @@ hscroll_redraw(fbtk_widget_t *widget, fbtk_callback_info *cbi) hpos = 0; } - LOG("hscroll %d", hscroll); + NSLOG(netsurf, INFO, "hscroll %d", hscroll); rect.x0 = bbox.x0 + 3 + hpos; rect.y0 = bbox.y0 + 5; @@ -362,7 +362,7 @@ hscrolll_click(fbtk_widget_t *widget, fbtk_callback_info *cbi) newpos = scrollw->u.scroll.minimum; if (newpos == scrollw->u.scroll.position) { - LOG("horiz scroll was the same %d", newpos); + NSLOG(netsurf, INFO, "horiz scroll was the same %d", newpos); return 0; } diff --git a/frontends/framebuffer/fetch.c b/frontends/framebuffer/fetch.c index 801b87a74..23cbb4f21 100644 --- a/frontends/framebuffer/fetch.c +++ b/frontends/framebuffer/fetch.c @@ -65,7 +65,7 @@ static nsurl *get_resource_url(const char *path) static const char *fetch_filetype(const char *unix_path) { int l; - LOG("unix path %s", unix_path); + NSLOG(netsurf, INFO, "unix path %s", unix_path); l = strlen(unix_path); if (2 < l && strcasecmp(unix_path + l - 3, "css") == 0) return "text/css"; diff --git a/frontends/framebuffer/font_freetype.c b/frontends/framebuffer/font_freetype.c index e7c07f5ff..9e47e4b99 100644 --- a/frontends/framebuffer/font_freetype.c +++ b/frontends/framebuffer/font_freetype.c @@ -90,12 +90,13 @@ ft_face_requester(FTC_FaceID face_id, error = FT_New_Face(library, fb_face->fontfile, fb_face->index, face); if (error) { - LOG("Could not find font (code %d)", error); + NSLOG(netsurf, INFO, "Could not find font (code %d)", error); } else { error = FT_Select_Charmap(*face, FT_ENCODING_UNICODE); if (error) { - LOG("Could not select charmap (code %d)", error); + NSLOG(netsurf, INFO, + "Could not select charmap (code %d)", error); } else { for (cidx = 0; cidx < (*face)->num_charmaps; cidx++) { if ((*face)->charmap == (*face)->charmaps[cidx]) { @@ -105,7 +106,7 @@ ft_face_requester(FTC_FaceID face_id, } } } - LOG("Loaded face from %s", fb_face->fontfile); + NSLOG(netsurf, INFO, "Loaded face from %s", fb_face->fontfile); return error; } @@ -132,7 +133,8 @@ fb_new_face(const char *option, const char *resname, const char *fontname) error = FTC_Manager_LookupFace(ft_cmanager, (FTC_FaceID)newf, &aface); if (error) { - LOG("Could not find font face %s (code %d)", fontname, error); + NSLOG(netsurf, INFO, "Could not find font face %s (code %d)", + fontname, error); free(newf->fontfile); free(newf); newf = NULL; @@ -152,7 +154,8 @@ bool fb_font_init(void) /* freetype library initialise */ error = FT_Init_FreeType( &library ); if (error) { - LOG("Freetype could not initialised (code %d)", error); + NSLOG(netsurf, INFO, + "Freetype could not initialised (code %d)", error); return false; } @@ -172,7 +175,9 @@ bool fb_font_init(void) NULL, &ft_cmanager); if (error) { - LOG("Freetype could not initialise cache manager (code %d)", error); + NSLOG(netsurf, INFO, + "Freetype could not initialise cache manager (code %d)", + error); FT_Done_FreeType(library); return false; } @@ -189,7 +194,7 @@ bool fb_font_init(void) NETSURF_FB_FONT_SANS_SERIF); if (fb_face == NULL) { /* The sans serif font is the default and must be found. */ - LOG("Could not find the default font"); + NSLOG(netsurf, INFO, "Could not find the default font"); FTC_Manager_Done(ft_cmanager); FT_Done_FreeType(library); return false; diff --git a/frontends/framebuffer/framebuffer.c b/frontends/framebuffer/framebuffer.c index de8a3695d..2ccc75062 100644 --- a/frontends/framebuffer/framebuffer.c +++ b/frontends/framebuffer/framebuffer.c @@ -271,7 +271,7 @@ framebuffer_plot_path(const struct redraw_context *ctx, float width, const float transform[6]) { - LOG("path unimplemented"); + NSLOG(netsurf, INFO, "path unimplemented"); return NSERROR_OK; } @@ -564,7 +564,7 @@ static bool framebuffer_format_from_bpp(int bpp, enum nsfb_format_e *fmt) break; default: - LOG("Bad bits per pixel (%d)\n", bpp); + NSLOG(netsurf, INFO, "Bad bits per pixel (%d)\n", bpp); return false; } @@ -586,18 +586,19 @@ framebuffer_initialise(const char *fename, int width, int height, int bpp) fbtype = nsfb_type_from_name(fename); if (fbtype == NSFB_SURFACE_NONE) { - LOG("The %s surface is not available from libnsfb\n", fename); + NSLOG(netsurf, INFO, + "The %s surface is not available from libnsfb\n", fename); return NULL; } nsfb = nsfb_new(fbtype); if (nsfb == NULL) { - LOG("Unable to create %s fb surface\n", fename); + NSLOG(netsurf, INFO, "Unable to create %s fb surface\n", fename); return NULL; } if (nsfb_set_geometry(nsfb, width, height, fbfmt) == -1) { - LOG("Unable to set surface geometry\n"); + NSLOG(netsurf, INFO, "Unable to set surface geometry\n"); nsfb_free(nsfb); return NULL; } @@ -605,7 +606,7 @@ framebuffer_initialise(const char *fename, int width, int height, int bpp) nsfb_cursor_init(nsfb); if (nsfb_init(nsfb) == -1) { - LOG("Unable to initialise nsfb surface\n"); + NSLOG(netsurf, INFO, "Unable to initialise nsfb surface\n"); nsfb_free(nsfb); return NULL; } @@ -625,7 +626,7 @@ framebuffer_resize(nsfb_t *nsfb, int width, int height, int bpp) } if (nsfb_set_geometry(nsfb, width, height, fbfmt) == -1) { - LOG("Unable to change surface geometry\n"); + NSLOG(netsurf, INFO, "Unable to change surface geometry\n"); return false; } diff --git a/frontends/framebuffer/gui.c b/frontends/framebuffer/gui.c index 1460c77f6..ebd0b7b66 100644 --- a/frontends/framebuffer/gui.c +++ b/frontends/framebuffer/gui.c @@ -120,7 +120,7 @@ static void die(const char *error) */ static nserror fb_warn_user(const char *warning, const char *detail) { - LOG("%s %s", warning, detail); + NSLOG(netsurf, INFO, "%s %s", warning, detail); return NSERROR_OK; } @@ -153,7 +153,7 @@ widget_scroll_y(struct gui_window *gw, int y, bool abs) int content_width, content_height; int height; - LOG("window scroll"); + NSLOG(netsurf, INFO, "window scroll"); if (abs) { bwidget->pany = y - bwidget->scrolly; } else { @@ -237,7 +237,7 @@ fb_pan(fbtk_widget_t *widget, height = fbtk_get_height(widget); width = fbtk_get_width(widget); - LOG("panning %d, %d", bwidget->panx, bwidget->pany); + NSLOG(netsurf, INFO, "panning %d, %d", bwidget->panx, bwidget->pany); x = fbtk_get_absx(widget); y = fbtk_get_absy(widget); @@ -413,7 +413,8 @@ fb_browser_window_redraw(fbtk_widget_t *widget, fbtk_callback_info *cbi) bwidget = fbtk_get_userpw(widget); if (bwidget == NULL) { - LOG("browser widget from widget %p was null", widget); + NSLOG(netsurf, INFO, + "browser widget from widget %p was null", widget); return -1; } @@ -465,7 +466,7 @@ process_cmdline(int argc, char** argv) {0, 0, 0, 0 } }; /* no long options */ - LOG("argc %d, argv %p", argc, argv); + NSLOG(netsurf, INFO, "argc %d, argv %p", argc, argv); fename = "sdl"; febpp = 32; @@ -534,7 +535,7 @@ static nserror set_defaults(struct nsoption_s *defaults) if (nsoption_charp(cookie_file) == NULL || nsoption_charp(cookie_jar) == NULL) { - LOG("Failed initialising cookie options"); + NSLOG(netsurf, INFO, "Failed initialising cookie options"); return NSERROR_BAD_PARAMETER; } @@ -612,7 +613,7 @@ static void framebuffer_run(void) static void gui_quit(void) { - LOG("gui_quit"); + NSLOG(netsurf, INFO, "gui_quit"); urldb_save_cookies(nsoption_charp(cookie_jar)); @@ -639,7 +640,8 @@ fb_browser_window_click(fbtk_widget_t *widget, fbtk_callback_info *cbi) cbi->event->type != NSFB_EVENT_KEY_UP) return 0; - LOG("browser window clicked at %d,%d", cbi->x, cbi->y); + NSLOG(netsurf, INFO, "browser window clicked at %d,%d", cbi->x, + cbi->y); switch (cbi->event->type) { case NSFB_EVENT_KEY_DOWN: @@ -824,7 +826,7 @@ fb_browser_window_input(fbtk_widget_t *widget, fbtk_callback_info *cbi) static fbtk_modifier_type modifier = FBTK_MOD_CLEAR; int ucs4 = -1; - LOG("got value %d", cbi->event->value.keycode); + NSLOG(netsurf, INFO, "got value %d", cbi->event->value.keycode); switch (cbi->event->type) { case NSFB_EVENT_KEY_DOWN: @@ -1200,7 +1202,7 @@ create_toolbar(struct gui_window *gw, toolbar_layout = NSFB_TOOLBAR_DEFAULT_LAYOUT; } - LOG("Using toolbar layout %s", toolbar_layout); + NSLOG(netsurf, INFO, "Using toolbar layout %s", toolbar_layout); itmtype = toolbar_layout; @@ -1234,7 +1236,7 @@ create_toolbar(struct gui_window *gw, (*itmtype != 0) && (xdir !=0)) { - LOG("toolbar adding %c", *itmtype); + NSLOG(netsurf, INFO, "toolbar adding %c", *itmtype); switch (*itmtype) { @@ -1376,7 +1378,9 @@ create_toolbar(struct gui_window *gw, default: widget = NULL; xdir = 0; - LOG("Unknown element %c in toolbar layout", *itmtype); + NSLOG(netsurf, INFO, + "Unknown element %c in toolbar layout", + *itmtype); break; } @@ -1385,7 +1389,7 @@ create_toolbar(struct gui_window *gw, xpos += (xdir * (fbtk_get_width(widget) + padding)); } - LOG("xpos is %d", xpos); + NSLOG(netsurf, INFO, "xpos is %d", xpos); itmtype += xdir; } @@ -1595,7 +1599,7 @@ create_normal_browser_window(struct gui_window *gw, int furniture_width) int statusbar_width = 0; int toolbar_height = nsoption_int(fb_toolbar_size); - LOG("Normal window"); + NSLOG(netsurf, INFO, "Normal window"); gw->window = fbtk_create_window(fbtk, 0, 0, 0, 0, 0); @@ -1626,7 +1630,8 @@ create_normal_browser_window(struct gui_window *gw, int furniture_width) false); fbtk_set_handler(gw->status, FBTK_CBT_POINTERENTER, set_ptr_default_move, NULL); - LOG("status bar %p at %d,%d", gw->status, fbtk_get_absx(gw->status), fbtk_get_absy(gw->status)); + NSLOG(netsurf, INFO, "status bar %p at %d,%d", gw->status, + fbtk_get_absx(gw->status), fbtk_get_absy(gw->status)); /* create horizontal scrollbar */ gw->hscroll = fbtk_create_hscroll(gw->window, @@ -2183,7 +2188,7 @@ main(int argc, char** argv) /* create an initial browser window */ - LOG("calling browser_window_create"); + NSLOG(netsurf, INFO, "calling browser_window_create"); ret = nsurl_create(feurl, &url); if (ret == NSERROR_OK) { @@ -2205,7 +2210,7 @@ main(int argc, char** argv) netsurf_exit(); if (fb_font_finalise() == false) - LOG("Font finalisation failed."); + NSLOG(netsurf, INFO, "Font finalisation failed."); /* finalise options */ nsoption_finalise(nsoptions, nsoptions_default); diff --git a/frontends/framebuffer/schedule.c b/frontends/framebuffer/schedule.c index 581ad72f1..c94cead44 100644 --- a/frontends/framebuffer/schedule.c +++ b/frontends/framebuffer/schedule.c @@ -203,12 +203,14 @@ void list_schedule(void) gettimeofday(&tv, NULL); - LOG("schedule list at %ld:%ld", tv.tv_sec, tv.tv_usec); + NSLOG(netsurf, INFO, "schedule list at %ld:%ld", tv.tv_sec, + tv.tv_usec); cur_nscb = schedule_list; while (cur_nscb != NULL) { - LOG("Schedule %p at %ld:%ld", cur_nscb, cur_nscb->tv.tv_sec, cur_nscb->tv.tv_usec); + NSLOG(netsurf, INFO, "Schedule %p at %ld:%ld", cur_nscb, + cur_nscb->tv.tv_sec, cur_nscb->tv.tv_usec); cur_nscb = cur_nscb->next; } } diff --git a/frontends/gtk/cookies.c b/frontends/gtk/cookies.c index 500cd07f6..1f7833cca 100644 --- a/frontends/gtk/cookies.c +++ b/frontends/gtk/cookies.c @@ -164,8 +164,9 @@ static void nsgtk_cookies_init_menu(struct nsgtk_cookie_window *ncwin) w = GTK_WIDGET(gtk_builder_get_object(ncwin->builder, event->widget)); if (w == NULL) { - LOG("Unable to connect menu widget ""%s""", - event->widget); + NSLOG(netsurf, INFO, + "Unable to connect menu widget ""%s""", + event->widget); } else { g_signal_connect(G_OBJECT(w), "activate", @@ -253,7 +254,7 @@ static nserror nsgtk_cookies_init(void) res = nsgtk_builder_new_from_resname("cookies", &ncwin->builder); if (res != NSERROR_OK) { - LOG("Cookie UI builder init failed"); + NSLOG(netsurf, INFO, "Cookie UI builder init failed"); free(ncwin); return res; } diff --git a/frontends/gtk/corewindow.c b/frontends/gtk/corewindow.c index ddc61c717..53ee17333 100644 --- a/frontends/gtk/corewindow.c +++ b/frontends/gtk/corewindow.c @@ -413,14 +413,14 @@ nsgtk_cw_keypress_event(GtkWidget *widget, GdkEventKey *event, gpointer g) if (res == NSERROR_OK) { return TRUE; } else if (res != NSERROR_NOT_IMPLEMENTED) { - LOG("%s", messages_get_errorcode(res)); + NSLOG(netsurf, INFO, "%s", messages_get_errorcode(res)); return FALSE; } /* deal with unprocessed keypress */ res = nsgtk_cw_key(nsgtk_cw, nskey); if (res != NSERROR_OK) { - LOG("%s", messages_get_errorcode(res)); + NSLOG(netsurf, INFO, "%s", messages_get_errorcode(res)); return FALSE; } return TRUE; diff --git a/frontends/gtk/download.c b/frontends/gtk/download.c index 8c8161459..576960271 100644 --- a/frontends/gtk/download.c +++ b/frontends/gtk/download.c @@ -475,7 +475,7 @@ nserror nsgtk_download_init(void) res = nsgtk_builder_new_from_resname("downloads", &builder); if (res != NSERROR_OK) { - LOG("Download UI builder init failed"); + NSLOG(netsurf, INFO, "Download UI builder init failed"); return res; } diff --git a/frontends/gtk/fetch.c b/frontends/gtk/fetch.c index 154f43708..7286aec34 100644 --- a/frontends/gtk/fetch.c +++ b/frontends/gtk/fetch.c @@ -90,7 +90,8 @@ void gtk_fetch_filetype_init(const char *mimefile) fh = fopen(mimefile, "r"); if (fh == NULL) { - LOG("Unable to open a mime.types file, so using a minimal one for you."); + NSLOG(netsurf, INFO, + "Unable to open a mime.types file, so using a minimal one for you."); return; } diff --git a/frontends/gtk/gdk.c b/frontends/gtk/gdk.c index 9ed90bd8e..fd82af5b2 100644 --- a/frontends/gtk/gdk.c +++ b/frontends/gtk/gdk.c @@ -86,7 +86,7 @@ nsgdk_pixbuf_get_from_surface(cairo_surface_t *surface, int scwidth, int scheigh if (cairo_surface_status(scsurface) != CAIRO_STATUS_SUCCESS) { cairo_surface_destroy(scsurface); g_object_unref(pixbuf); - LOG("Surface creation failed"); + NSLOG(netsurf, INFO, "Surface creation failed"); return NULL; } diff --git a/frontends/gtk/global_history.c b/frontends/gtk/global_history.c index 360eb4e1a..f204168d0 100644 --- a/frontends/gtk/global_history.c +++ b/frontends/gtk/global_history.c @@ -214,8 +214,9 @@ nsgtk_global_history_init_menu(struct nsgtk_global_history_window *ghwin) w = GTK_WIDGET(gtk_builder_get_object(ghwin->builder, event->widget)); if (w == NULL) { - LOG("Unable to connect menu widget ""%s""", - event->widget); + NSLOG(netsurf, INFO, + "Unable to connect menu widget ""%s""", + event->widget); } else { g_signal_connect(G_OBJECT(w), "activate", @@ -306,7 +307,7 @@ static nserror nsgtk_global_history_init(void) res = nsgtk_builder_new_from_resname("globalhistory", &ncwin->builder); if (res != NSERROR_OK) { - LOG("History UI builder init failed"); + NSLOG(netsurf, INFO, "History UI builder init failed"); free(ncwin); return res; } diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c index a183e521f..6a61b3d06 100644 --- a/frontends/gtk/gui.c +++ b/frontends/gtk/gui.c @@ -208,7 +208,8 @@ static nserror set_defaults(struct nsoption_s *defaults) (nsoption_charp(hotlist_path) == NULL) || (nsoption_charp(downloads_directory) == NULL) || (nsoption_charp(ca_path) == NULL)) { - LOG("Failed initialising default resource paths"); + NSLOG(netsurf, INFO, + "Failed initialising default resource paths"); return NSERROR_BAD_PARAMETER; } @@ -238,7 +239,7 @@ static nserror nsgtk_init(int argc, char** argv, char **respath) error = nsgtk_builder_new_from_resname("warning", &warning_builder); if (error != NSERROR_OK) { - LOG("Unable to initialise warning dialog"); + NSLOG(netsurf, INFO, "Unable to initialise warning dialog"); return error; } @@ -248,7 +249,7 @@ static nserror nsgtk_init(int argc, char** argv, char **respath) error = nsgdk_pixbuf_new_from_resname("netsurf.xpm", &win_default_icon_pixbuf); if (error == NSERROR_OK) { - LOG("Seting default window icon"); + NSLOG(netsurf, INFO, "Seting default window icon"); gtk_window_set_default_icon(win_default_icon_pixbuf); } @@ -256,7 +257,8 @@ static nserror nsgtk_init(int argc, char** argv, char **respath) resource_filename = filepath_find(respath, "SearchEngines"); search_web_init(resource_filename); if (resource_filename != NULL) { - LOG("Using '%s' as Search Engines file", resource_filename); + NSLOG(netsurf, INFO, "Using '%s' as Search Engines file", + resource_filename); free(resource_filename); } @@ -278,7 +280,7 @@ static nserror nsgtk_init(int argc, char** argv, char **respath) /* initialise throbber */ error = nsgtk_throbber_init(); if (error != NSERROR_OK) { - LOG("Unable to initialise throbber."); + NSLOG(netsurf, INFO, "Unable to initialise throbber."); return error; } @@ -300,12 +302,12 @@ static nserror nsgtk_init(int argc, char** argv, char **respath) * window. */ browser_set_dpi(gdk_screen_get_resolution(gdk_screen_get_default())); - LOG("Set CSS DPI to %d", browser_get_dpi()); + NSLOG(netsurf, INFO, "Set CSS DPI to %d", browser_get_dpi()); /* Initialise top level UI elements */ error = nsgtk_download_init(); if (error != NSERROR_OK) { - LOG("Unable to initialise download window."); + NSLOG(netsurf, INFO, "Unable to initialise download window."); return error; } @@ -426,7 +428,7 @@ static void gui_quit(void) { nserror res; - LOG("Quitting GUI"); + NSLOG(netsurf, INFO, "Quitting GUI"); /* Ensure all scaffoldings are destroyed before we go into exit */ nsgtk_download_destroy(); @@ -435,32 +437,34 @@ static void gui_quit(void) res = nsgtk_cookies_destroy(); if (res != NSERROR_OK) { - LOG("Error finalising cookie viewer: %s", - messages_get_errorcode(res)); + NSLOG(netsurf, INFO, "Error finalising cookie viewer: %s", + messages_get_errorcode(res)); } res = nsgtk_local_history_destroy(); if (res != NSERROR_OK) { - LOG("Error finalising local history viewer: %s", - messages_get_errorcode(res)); + NSLOG(netsurf, INFO, + "Error finalising local history viewer: %s", + messages_get_errorcode(res)); } res = nsgtk_global_history_destroy(); if (res != NSERROR_OK) { - LOG("Error finalising global history viewer: %s", - messages_get_errorcode(res)); + NSLOG(netsurf, INFO, + "Error finalising global history viewer: %s", + messages_get_errorcode(res)); } res = nsgtk_hotlist_destroy(); if (res != NSERROR_OK) { - LOG("Error finalising hotlist viewer: %s", - messages_get_errorcode(res)); + NSLOG(netsurf, INFO, "Error finalising hotlist viewer: %s", + messages_get_errorcode(res)); } res = hotlist_fini(); if (res != NSERROR_OK) { - LOG("Error finalising hotlist: %s", - messages_get_errorcode(res)); + NSLOG(netsurf, INFO, "Error finalising hotlist: %s", + messages_get_errorcode(res)); } free(nsgtk_config_home); @@ -492,7 +496,7 @@ nserror nsgtk_warning(const char *warning, const char *detail) static GtkWindow *nsgtk_warning_window; GtkLabel *WarningLabel; - LOG("%s %s", warning, detail ? detail : ""); + NSLOG(netsurf, INFO, "%s %s", warning, detail ? detail : ""); fflush(stdout); nsgtk_warning_window = GTK_WINDOW(gtk_builder_get_object(warning_builder, "wndWarning")); @@ -600,7 +604,7 @@ static void nsgtk_pdf_password(char **owner_pass, char **user_pass, char *path) res = nsgtk_builder_new_from_resname("password", &password_builder); if (res != NSERROR_OK) { - LOG("Password UI builder init failed"); + NSLOG(netsurf, INFO, "Password UI builder init failed"); return; } @@ -821,7 +825,7 @@ static nserror get_config_home(char **config_home_out) if (home_dir != NULL) { ret = check_dirname(home_dir, ".netsurf", &config_home); if (ret == NSERROR_OK) { - LOG("\"%s\"", config_home); + NSLOG(netsurf, INFO, "\"%s\"", config_home); *config_home_out = config_home; return ret; } @@ -861,7 +865,7 @@ static nserror get_config_home(char **config_home_out) } } - LOG("\"%s\"", config_home); + NSLOG(netsurf, INFO, "\"%s\"", config_home); *config_home_out = config_home; return NSERROR_OK; @@ -874,7 +878,7 @@ static nserror create_config_home(char **config_home_out) char *xdg_config_dir; nserror ret; - LOG("Attempting to create configuration directory"); + NSLOG(netsurf, INFO, "Attempting to create configuration directory"); /* $XDG_CONFIG_HOME defines the base directory * relative to which user specific configuration files @@ -910,7 +914,7 @@ static nserror create_config_home(char **config_home_out) /* strip the trailing separator */ config_home[strlen(config_home) - 1] = 0; - LOG("\"%s\"", config_home); + NSLOG(netsurf, INFO, "\"%s\"", config_home); *config_home_out = config_home; @@ -959,7 +963,7 @@ static nserror get_cache_home(char **cache_home_out) } } - LOG("\"%s\"", cache_home); + NSLOG(netsurf, INFO, "\"%s\"", cache_home); *cache_home_out = cache_home; return NSERROR_OK; @@ -972,7 +976,7 @@ static nserror create_cache_home(char **cache_home_out) char *xdg_cache_dir; nserror ret; - LOG("Attempting to create configuration directory"); + NSLOG(netsurf, INFO, "Attempting to create configuration directory"); /* $XDG_CACHE_HOME defines the base directory * relative to which user specific cache files @@ -1008,7 +1012,7 @@ static nserror create_cache_home(char **cache_home_out) /* strip the trailing separator */ cache_home[strlen(cache_home) - 1] = 0; - LOG("\"%s\"", cache_home); + NSLOG(netsurf, INFO, "\"%s\"", cache_home); *cache_home_out = cache_home; @@ -1115,7 +1119,8 @@ int main(int argc, char** argv) ret = create_config_home(&nsgtk_config_home); } if (ret != NSERROR_OK) { - LOG("Unable to locate a configuration directory."); + NSLOG(netsurf, INFO, + "Unable to locate a configuration directory."); nsgtk_config_home = NULL; } @@ -1155,7 +1160,7 @@ int main(int argc, char** argv) if (ret != NSERROR_OK) { fprintf(stderr, "Unable to load translated messages (%s)\n", messages_get_errorcode(ret)); - LOG("Unable to load translated messages"); + NSLOG(netsurf, INFO, "Unable to load translated messages"); /** \todo decide if message load faliure should be fatal */ } @@ -1166,7 +1171,7 @@ int main(int argc, char** argv) ret = create_cache_home(&cache_home); } if (ret != NSERROR_OK) { - LOG("Unable to locate a cache directory."); + NSLOG(netsurf, INFO, "Unable to locate a cache directory."); } /* core initialisation */ diff --git a/frontends/gtk/hotlist.c b/frontends/gtk/hotlist.c index 936573a0b..843e47736 100644 --- a/frontends/gtk/hotlist.c +++ b/frontends/gtk/hotlist.c @@ -236,8 +236,9 @@ static void nsgtk_hotlist_init_menu(struct nsgtk_hotlist_window *hlwin) w = GTK_WIDGET(gtk_builder_get_object(hlwin->builder, event->widget)); if (w == NULL) { - LOG("Unable to connect menu widget ""%s""", - event->widget); + NSLOG(netsurf, INFO, + "Unable to connect menu widget ""%s""", + event->widget); } else { g_signal_connect(G_OBJECT(w), "activate", @@ -326,7 +327,7 @@ static nserror nsgtk_hotlist_init(void) res = nsgtk_builder_new_from_resname("hotlist", &ncwin->builder); if (res != NSERROR_OK) { - LOG("Hotlist UI builder init failed"); + NSLOG(netsurf, INFO, "Hotlist UI builder init failed"); free(ncwin); return res; } diff --git a/frontends/gtk/layout_pango.c b/frontends/gtk/layout_pango.c index fb065b127..300278648 100644 --- a/frontends/gtk/layout_pango.c +++ b/frontends/gtk/layout_pango.c @@ -42,12 +42,12 @@ static PangoLayout *nsfont_pango_layout = NULL; static inline void nsfont_pango_check(void) { if (nsfont_pango_context == NULL) { - LOG("Creating nsfont_pango_context."); + NSLOG(netsurf, INFO, "Creating nsfont_pango_context."); nsfont_pango_context = gdk_pango_context_get(); } if (nsfont_pango_layout == NULL) { - LOG("Creating nsfont_pango_layout."); + NSLOG(netsurf, INFO, "Creating nsfont_pango_layout."); nsfont_pango_layout = pango_layout_new(nsfont_pango_context); } } diff --git a/frontends/gtk/local_history.c b/frontends/gtk/local_history.c index cc9580130..35b7a4ad6 100644 --- a/frontends/gtk/local_history.c +++ b/frontends/gtk/local_history.c @@ -148,7 +148,7 @@ nsgtk_local_history_init(struct browser_window *bw, res = nsgtk_builder_new_from_resname("localhistory", &ncwin->builder); if (res != NSERROR_OK) { - LOG("Local history UI builder init failed"); + NSLOG(netsurf, INFO, "Local history UI builder init failed"); free(ncwin); return res; } diff --git a/frontends/gtk/login.c b/frontends/gtk/login.c index 3e29903fe..91d8b37f0 100644 --- a/frontends/gtk/login.c +++ b/frontends/gtk/login.c @@ -222,7 +222,7 @@ void gui_401login_open(nsurl *url, res = create_login_window(url, host, realm, cb, cbpw); if (res != NSERROR_OK) { - LOG("Login init failed"); + NSLOG(netsurf, INFO, "Login init failed"); /* creating login failed so cancel navigation */ cb(false, cbpw); diff --git a/frontends/gtk/plotters.c b/frontends/gtk/plotters.c index c57b03294..88e7760c6 100644 --- a/frontends/gtk/plotters.c +++ b/frontends/gtk/plotters.c @@ -413,7 +413,7 @@ nsgtk_plot_path(const struct redraw_context *ctx, return NSERROR_OK; if (p[0] != PLOTTER_PATH_MOVE) { - LOG("Path does not start with move"); + NSLOG(netsurf, INFO, "Path does not start with move"); return NSERROR_INVALID; } @@ -451,7 +451,7 @@ nsgtk_plot_path(const struct redraw_context *ctx, p[i+5], p[i+6]); i += 7; } else { - LOG("bad path command %f", p[i]); + NSLOG(netsurf, INFO, "bad path command %f", p[i]); /* Reset matrix for safety */ cairo_set_matrix(current_cr, &old_ctm); return NSERROR_INVALID; diff --git a/frontends/gtk/preferences.c b/frontends/gtk/preferences.c index e51e77014..65f41ed27 100644 --- a/frontends/gtk/preferences.c +++ b/frontends/gtk/preferences.c @@ -621,7 +621,7 @@ comboboxLanguage_add_from_file(GtkListStore *liststore, gtk_list_store_clear(liststore); - LOG("Used %s for languages", file_location); + NSLOG(netsurf, INFO, "Used %s for languages", file_location); while (fgets(buf, sizeof(buf), fp)) { /* Ignore blank lines */ if (buf[0] == '\0') @@ -668,7 +668,7 @@ nsgtk_preferences_comboboxLanguage_realize(GtkWidget *widget, const char *accept_language; if (priv->content_language == NULL) { - LOG("content language list store unavailable"); + NSLOG(netsurf, INFO, "content language list store unavailable"); return; } @@ -697,7 +697,7 @@ nsgtk_preferences_comboboxLanguage_realize(GtkWidget *widget, } } if (res != NSERROR_OK) { - LOG("error populatiung languages combo"); + NSLOG(netsurf, INFO, "error populatiung languages combo"); } } @@ -989,14 +989,15 @@ GtkWidget* nsgtk_preferences(struct browser_window *bw, GtkWindow *parent) res = nsgtk_builder_new_from_resname("options", &preferences_builder); if (res != NSERROR_OK) { - LOG("Preferences UI builder init failed"); + NSLOG(netsurf, INFO, "Preferences UI builder init failed"); return NULL; } priv->dialog = gtk_builder_get_object(preferences_builder, "dialogPreferences"); if (priv->dialog == NULL) { - LOG("Unable to get object for preferences dialog"); + NSLOG(netsurf, INFO, + "Unable to get object for preferences dialog"); /* release builder as were done with it */ g_object_unref(G_OBJECT(preferences_builder)); return NULL; diff --git a/frontends/gtk/print.c b/frontends/gtk/print.c index 54edeee61..8f71230a6 100644 --- a/frontends/gtk/print.c +++ b/frontends/gtk/print.c @@ -145,8 +145,9 @@ static inline void nsgtk_print_set_dashed(void) static nserror nsgtk_print_plot_clip(const struct redraw_context *ctx, const struct rect *clip) { - LOG("Clipping. x0: %i ;\t y0: %i ;\t x1: %i ;\t y1: %i", - clip->x0, clip->y0, clip->x1, clip->y1); + NSLOG(netsurf, INFO, + "Clipping. x0: %i ;\t y0: %i ;\t x1: %i ;\t y1: %i", clip->x0, + clip->y0, clip->x1, clip->y1); /* Normalize cllipping area - to prevent overflows. * See comment in pdf_plot_fill. */ @@ -324,8 +325,8 @@ nsgtk_print_plot_rectangle(const struct redraw_context *ctx, const plot_style_t *style, const struct rect *rect) { - LOG("x0: %i ;\t y0: %i ;\t x1: %i ;\t y1: %i", - rect->x0, rect->y0, rect->x1, rect->y1); + NSLOG(netsurf, INFO, "x0: %i ;\t y0: %i ;\t x1: %i ;\t y1: %i", + rect->x0, rect->y0, rect->x1, rect->y1); if (style->fill_type != PLOT_OP_TYPE_NONE) { int x0,y0,x1,y1; @@ -395,7 +396,7 @@ nsgtk_print_plot_polygon(const struct redraw_context *ctx, { unsigned int i; - LOG("Plotting polygon."); + NSLOG(netsurf, INFO, "Plotting polygon."); nsgtk_print_set_colour(style->fill_colour); nsgtk_print_set_solid(); @@ -403,11 +404,12 @@ nsgtk_print_plot_polygon(const struct redraw_context *ctx, cairo_set_line_width(gtk_print_current_cr, 0); cairo_move_to(gtk_print_current_cr, p[0], p[1]); - LOG("Starting line at: %i\t%i", p[0], p[1]); + NSLOG(netsurf, INFO, "Starting line at: %i\t%i", p[0], p[1]); for (i = 1; i != n; i++) { cairo_line_to(gtk_print_current_cr, p[i * 2], p[i * 2 + 1]); - LOG("Drawing line to: %i\t%i", p[i * 2], p[i * 2 + 1]); + NSLOG(netsurf, INFO, "Drawing line to: %i\t%i", p[i * 2], + p[i * 2 + 1]); } cairo_fill(gtk_print_current_cr); @@ -700,7 +702,7 @@ void gtk_print_signal_begin_print (GtkPrintOperation *operation, int page_number; double height_on_page, height_to_print; - LOG("Begin print"); + NSLOG(netsurf, INFO, "Begin print"); settings = user_data; @@ -719,7 +721,11 @@ void gtk_print_signal_begin_print (GtkPrintOperation *operation, } else { - LOG("page_width: %f ;page_height: %f; content height: %lf", settings->page_width, settings->page_height, height_to_print); + NSLOG(netsurf, INFO, + "page_width: %f ;page_height: %f; content height: %lf", + settings->page_width, + settings->page_height, + height_to_print); height_on_page = settings->page_height; height_on_page = height_on_page - @@ -743,7 +749,7 @@ void gtk_print_signal_begin_print (GtkPrintOperation *operation, void gtk_print_signal_draw_page(GtkPrintOperation *operation, GtkPrintContext *context, gint page_nr, gpointer user_data) { - LOG("Draw Page"); + NSLOG(netsurf, INFO, "Draw Page"); gtk_print_current_cr = gtk_print_context_get_cairo_context(context); print_draw_next_page(>k_printer, settings); } @@ -755,7 +761,7 @@ void gtk_print_signal_draw_page(GtkPrintOperation *operation, void gtk_print_signal_end_print(GtkPrintOperation *operation, GtkPrintContext *context, gpointer user_data) { - LOG("End print"); + NSLOG(netsurf, INFO, "End print"); print_cleanup(content_to_print, >k_printer, user_data); } diff --git a/frontends/gtk/resources.c b/frontends/gtk/resources.c index 4f9afb034..c07548b01 100644 --- a/frontends/gtk/resources.c +++ b/frontends/gtk/resources.c @@ -198,7 +198,8 @@ init_resource(char **respath, struct nsgtk_resource_s *resource) /* found an entry in the resources */ resource->path = resname; resource->type = NSGTK_RESOURCE_GLIB; - LOG("Found gresource path %s", resource->path); + NSLOG(netsurf, INFO, "Found gresource path %s", + resource->path); return NSERROR_OK; } /*LOG("gresource \"%s\" not found", resname);*/ @@ -221,7 +222,8 @@ init_resource(char **respath, struct nsgtk_resource_s *resource) /* found an entry in the resources */ resource->path = resname; resource->type = NSGTK_RESOURCE_GLIB; - LOG("Found gresource path %s", resource->path); + NSLOG(netsurf, INFO, "Found gresource path %s", + resource->path); return NSERROR_OK; } /*LOG("gresource \"%s\" not found", resname);*/ @@ -231,8 +233,9 @@ init_resource(char **respath, struct nsgtk_resource_s *resource) resname = filepath_find(respath, resource->name); if (resname == NULL) { - LOG("Unable to find resource %s on resource path", - resource->name); + NSLOG(netsurf, INFO, + "Unable to find resource %s on resource path", + resource->name); return NSERROR_NOT_FOUND; } @@ -240,7 +243,7 @@ init_resource(char **respath, struct nsgtk_resource_s *resource) resource->path = resname; resource->type = NSGTK_RESOURCE_FILE; - LOG("Found file resource path %s", resource->path); + NSLOG(netsurf, INFO, "Found file resource path %s", resource->path); return NSERROR_OK; } @@ -295,21 +298,21 @@ init_pixbuf_resource(char **respath, struct nsgtk_resource_s *resource) if (strncmp(resource->name, "menu_cursor.png", resource->len) == 0) { resource->path = (char *)&menu_cursor_pixdata[0]; resource->type = NSGTK_RESOURCE_INLINE; - LOG("Found builtin for %s", resource->name); + NSLOG(netsurf, INFO, "Found builtin for %s", resource->name); return NSERROR_OK; } if (strncmp(resource->name, "netsurf.xpm", resource->len) == 0) { resource->path = (char *)&netsurf_pixdata[0]; resource->type = NSGTK_RESOURCE_INLINE; - LOG("Found builtin for %s", resource->name); + NSLOG(netsurf, INFO, "Found builtin for %s", resource->name); return NSERROR_OK; } if (strncmp(resource->name, "favicon.png", resource->len) == 0) { resource->path = (char *)&favicon_pixdata[0]; resource->type = NSGTK_RESOURCE_INLINE; - LOG("Found builtin for %s", resource->name); + NSLOG(netsurf, INFO, "Found builtin for %s", resource->name); return NSERROR_OK; } #endif @@ -389,13 +392,13 @@ static void list_gresource(void) G_RESOURCE_LOOKUP_FLAGS_NONE, &gerror); if (gerror) { - LOG("gerror %s", gerror->message); + NSLOG(netsurf, INFO, "gerror %s", gerror->message); g_error_free(gerror); } else { cur = reslist; while (cur != NULL && *cur != NULL) { - LOG("gres %s", *cur); + NSLOG(netsurf, INFO, "gres %s", *cur); cur++; } g_strfreev(reslist); @@ -488,12 +491,17 @@ nsgdk_pixbuf_new_from_resname(const char *resname, GdkPixbuf **pixbuf_out) if (new_pixbuf == NULL) { if (error != NULL) { - LOG("Unable to create pixbuf from file for %s with path %s \"%s\"", - resource->name, resource->path, error->message); + NSLOG(netsurf, INFO, + "Unable to create pixbuf from file for %s with path %s \"%s\"", + resource->name, + resource->path, + error->message); g_error_free(error); } else { - LOG("Unable to create pixbuf from file for %s with path %s", - resource->name, resource->path); + NSLOG(netsurf, INFO, + "Unable to create pixbuf from file for %s with path %s", + resource->name, + resource->path); } return NSERROR_INIT_FAILED; } @@ -521,8 +529,11 @@ nsgtk_builder_new_from_resname(const char *resname, GtkBuilder **builder_out) if (!gtk_builder_add_from_file(new_builder, ui_res->path, &error)) { - LOG("Unable to add UI builder from file for %s with path %s \"%s\"", - ui_res->name, ui_res->path, error->message); + NSLOG(netsurf, INFO, + "Unable to add UI builder from file for %s with path %s \"%s\"", + ui_res->name, + ui_res->path, + error->message); g_error_free(error); g_object_unref(G_OBJECT(new_builder)); return NSERROR_INIT_FAILED; @@ -531,8 +542,11 @@ nsgtk_builder_new_from_resname(const char *resname, GtkBuilder **builder_out) if (!nsgtk_builder_add_from_resource(new_builder, ui_res->path, &error)) { - LOG("Unable to add UI builder from resource for %s with path %s \"%s\"", - ui_res->name, ui_res->path, error->message); + NSLOG(netsurf, INFO, + "Unable to add UI builder from resource for %s with path %s \"%s\"", + ui_res->name, + ui_res->path, + error->message); g_error_free(error); g_object_unref(G_OBJECT(new_builder)); return NSERROR_INIT_FAILED; diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c index 25f36c5d3..cbc46cbc5 100644 --- a/frontends/gtk/scaffolding.c +++ b/frontends/gtk/scaffolding.c @@ -269,7 +269,7 @@ static void scaffolding_window_destroy(GtkWidget *widget, gpointer data) { struct nsgtk_scaffolding *gs = data; - LOG("scaffold:%p", gs); + NSLOG(netsurf, INFO, "scaffold:%p", gs); nsgtk_local_history_hide(); @@ -282,7 +282,7 @@ static void scaffolding_window_destroy(GtkWidget *widget, gpointer data) gs->next->prev = gs->prev; } - LOG("scaffold list head: %p", scaf_list); + NSLOG(netsurf, INFO, "scaffold list head: %p", scaf_list); if (scaf_list == NULL) { /* no more open windows - stop the browser */ @@ -805,7 +805,10 @@ MULTIHANDLER(savepage) path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fc)); d = opendir(path); if (d == NULL) { - LOG("Unable to open directory %s for complete save: %s", path, strerror(errno)); + NSLOG(netsurf, INFO, + "Unable to open directory %s for complete save: %s", + path, + strerror(errno)); if (errno == ENOTDIR) nsgtk_warning("NoDirError", path); else @@ -837,7 +840,7 @@ MULTIHANDLER(pdf) char *url_name; nserror res; - LOG("Print preview (generating PDF) started."); + NSLOG(netsurf, INFO, "Print preview (generating PDF) started."); res = nsurl_nice(browser_window_get_url(bw), &url_name, true); if (res != NSERROR_OK) { @@ -1221,10 +1224,10 @@ MULTIHANDLER(selectall) struct browser_window *bw = nsgtk_get_browser_window(g->top_level); if (nsgtk_widget_has_focus(GTK_WIDGET(g->url_bar))) { - LOG("Selecting all URL bar text"); + NSLOG(netsurf, INFO, "Selecting all URL bar text"); gtk_editable_select_region(GTK_EDITABLE(g->url_bar), 0, -1); } else { - LOG("Selecting all document text"); + NSLOG(netsurf, INFO, "Selecting all document text"); browser_window_key_press(bw, NS_KEY_SELECT_ALL); } @@ -1590,7 +1593,8 @@ MULTIHANDLER(localhistory) res = nsgtk_local_history_present(g->window, bw); if (res != NSERROR_OK) { - LOG("Unable to initialise local history window."); + NSLOG(netsurf, INFO, + "Unable to initialise local history window."); } return TRUE; } @@ -1600,7 +1604,8 @@ MULTIHANDLER(globalhistory) nserror res; res = nsgtk_global_history_present(); if (res != NSERROR_OK) { - LOG("Unable to initialise global history window."); + NSLOG(netsurf, INFO, + "Unable to initialise global history window."); } return TRUE; } @@ -1620,7 +1625,7 @@ MULTIHANDLER(showbookmarks) nserror res; res = nsgtk_hotlist_present(); if (res != NSERROR_OK) { - LOG("Unable to initialise bookmark window."); + NSLOG(netsurf, INFO, "Unable to initialise bookmark window."); } return TRUE; } @@ -1630,7 +1635,7 @@ MULTIHANDLER(showcookies) nserror res; res = nsgtk_cookies_present(); if (res != NSERROR_OK) { - LOG("Unable to initialise cookies window."); + NSLOG(netsurf, INFO, "Unable to initialise cookies window."); } return TRUE; } @@ -2073,7 +2078,8 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel) return NULL; } - LOG("Constructing a scaffold of %p for gui_window %p", gs, toplevel); + NSLOG(netsurf, INFO, + "Constructing a scaffold of %p for gui_window %p", gs, toplevel); gs->top_level = toplevel; @@ -2278,7 +2284,7 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel) /* finally, show the window. */ gtk_widget_show(GTK_WIDGET(gs->window)); - LOG("creation complete"); + NSLOG(netsurf, INFO, "creation complete"); return gs; } @@ -2466,7 +2472,8 @@ gui_search_web_provider_update(const char *provider_name, GdkPixbuf *srch_pixbuf = NULL; char *searchcontent; - LOG("name:%s bitmap %p", provider_name, provider_bitmap); + NSLOG(netsurf, INFO, "name:%s bitmap %p", provider_name, + provider_bitmap); if (provider_bitmap != NULL) { srch_pixbuf = nsgdk_pixbuf_get_from_surface(provider_bitmap->surface, 16, 16); diff --git a/frontends/gtk/schedule.c b/frontends/gtk/schedule.c index cf0333388..201432097 100644 --- a/frontends/gtk/schedule.c +++ b/frontends/gtk/schedule.c @@ -21,14 +21,10 @@ #include #include "utils/errors.h" +#include "utils/log.h" #include "gtk/schedule.h" -#ifdef DEBUG_GTK_SCHEDULE -#include "utils/log.h" -#else -#define LOG(format, args...) ((void) 0) -#endif /** Killable callback closure embodiment. */ typedef struct { @@ -50,7 +46,7 @@ nsgtk_schedule_generic_callback(gpointer data) _nsgtk_callback_t *cb = (_nsgtk_callback_t *)(data); if (cb->callback_killed) { /* This callback instance has been killed. */ - LOG("CB at %p already dead.", cb); + NSLOG(netsurf, DEBUG, "CB at %p already dead.", cb); } queued_callbacks = g_list_remove(queued_callbacks, cb); pending_callbacks = g_list_append(pending_callbacks, cb); @@ -64,7 +60,8 @@ nsgtk_schedule_kill_callback(void *_target, void *_match) _nsgtk_callback_t *match = (_nsgtk_callback_t *)_match; if ((target->callback == match->callback) && (target->context == match->context)) { - LOG("Found match for %p(%p), killing.", target->callback, target->context); + NSLOG(netsurf, DEBUG, "Found match for %p(%p), killing.", + target->callback, target->context); target->callback = NULL; target->context = NULL; target->callback_killed = true; @@ -122,7 +119,8 @@ schedule_run(void) /* Clear the pending list. */ pending_callbacks = NULL; - LOG("Captured a run of %d callbacks to fire.", g_list_length(this_run)); + NSLOG(netsurf, DEBUG, "Captured a run of %d callbacks to fire.", + g_list_length(this_run)); /* Run all the callbacks which made it this far. */ while (this_run != NULL) { diff --git a/frontends/gtk/ssl_cert.c b/frontends/gtk/ssl_cert.c index 5388f0194..9d98db1f6 100644 --- a/frontends/gtk/ssl_cert.c +++ b/frontends/gtk/ssl_cert.c @@ -183,7 +183,7 @@ nserror gtk_cert_verify(struct nsurl *url, res = nsgtk_builder_new_from_resname("ssl", &ncwin->builder); if (res != NSERROR_OK) { - LOG("SSL UI builder init failed"); + NSLOG(netsurf, INFO, "SSL UI builder init failed"); free(ncwin); return res; } diff --git a/frontends/gtk/tabs.c b/frontends/gtk/tabs.c index 6adce3a06..dbe9d405b 100644 --- a/frontends/gtk/tabs.c +++ b/frontends/gtk/tabs.c @@ -147,18 +147,20 @@ nsgtk_tab_switch_page_after(GtkNotebook *notebook, if ((srcpagenum != -1) && (srcpagenum != (gint)selpagenum)) { /* ensure the add tab is not actually selected */ - LOG("src %d sel %d", srcpagenum, selpagenum); + NSLOG(netsurf, INFO, "src %d sel %d", srcpagenum, + selpagenum); srcpage = gtk_notebook_get_nth_page(notebook, srcpagenum); gw = g_object_get_data(G_OBJECT(srcpage), "gui_window"); if ((gw != NULL) && (nsgtk_get_scaffold(gw) != NULL)) { error = nsgtk_scaffolding_new_tab(gw); if (error != NSERROR_OK) { - LOG("Failed to open new tab."); + NSLOG(netsurf, INFO, + "Failed to open new tab."); } } } } else { - LOG("sel %d", selpagenum); + NSLOG(netsurf, INFO, "sel %d", selpagenum); /* tab with page in it */ gw = g_object_get_data(G_OBJECT(selpage), "gui_window"); if (gw != NULL) { diff --git a/frontends/gtk/throbber.c b/frontends/gtk/throbber.c index 9392c3909..b8efceca1 100644 --- a/frontends/gtk/throbber.c +++ b/frontends/gtk/throbber.c @@ -59,12 +59,14 @@ nserror nsgtk_throbber_init(void) if (res != NSERROR_OK) { break; } - LOG("%s",resname); + NSLOG(netsurf, INFO, "%s", resname); } if (frame < 1) { /* we need at least two frames - one for idle, one for active */ - LOG("Insufficent number of frames (%d) in throbber animation.", frame); + NSLOG(netsurf, INFO, + "Insufficent number of frames (%d) in throbber animation.", + frame); res = NSERROR_INIT_FAILED; } diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c index 1f8dbbb7c..0ca26c92d 100644 --- a/frontends/gtk/toolbar.c +++ b/frontends/gtk/toolbar.c @@ -971,7 +971,8 @@ static nserror nsgtk_toolbar_customization_save(struct nsgtk_scaffolding *g) nsgtk_scaffolding_button(g, tbidx)->location); if (plen == order_len) { /* ran out of space, bail early */ - LOG("toolbar ordering exceeded available space"); + NSLOG(netsurf, INFO, + "toolbar ordering exceeded available space"); break; } cur += plen; @@ -1110,7 +1111,7 @@ static void nsgtk_toolbar_window_open(struct nsgtk_scaffolding *g) res = nsgtk_builder_new_from_resname("toolbar", &window->builder); if (res != NSERROR_OK) { - LOG("Toolbar UI builder init failed"); + NSLOG(netsurf, INFO, "Toolbar UI builder init failed"); nsgtk_warning(messages_get("NoMemory"), 0); nsgtk_toolbar_cancel_clicked(NULL, g); free(theme); diff --git a/frontends/gtk/viewdata.c b/frontends/gtk/viewdata.c index 6ed9dd9ac..d633238d0 100644 --- a/frontends/gtk/viewdata.c +++ b/frontends/gtk/viewdata.c @@ -371,7 +371,7 @@ window_init(const char *title, res = nsgtk_builder_new_from_resname("viewdata", &newctx->builder); if (res != NSERROR_OK) { - LOG("Viewdata UI builder init failed"); + NSLOG(netsurf, INFO, "Viewdata UI builder init failed"); free(newctx); return res; } @@ -381,7 +381,7 @@ window_init(const char *title, window = GTK_WINDOW(gtk_builder_get_object(newctx->builder, "ViewDataWindow")); if (window == NULL) { - LOG("Unable to find window in builder "); + NSLOG(netsurf, INFO, "Unable to find window in builder "); /* free the builder */ g_object_unref(G_OBJECT(newctx->builder)); @@ -616,7 +616,7 @@ static char** xdg_data_strvec(void) xdg_data_home, xdg_data_dirs); } - LOG("%s", xdg_data_path); + NSLOG(netsurf, INFO, "%s", xdg_data_path); svec = filepath_path_to_strvec(xdg_data_path); free(xdg_data_path); @@ -651,7 +651,7 @@ static char *xdg_get_default_app(const char *path, const char *mimetype) fname = malloc(fname_len); snprintf(fname, fname_len, "%s/applications/defaults.list", path); - LOG("Checking %s", fname); + NSLOG(netsurf, INFO, "Checking %s", fname); fp = fopen(fname, "r"); free(fname); @@ -674,8 +674,11 @@ static char *xdg_get_default_app(const char *path, const char *mimetype) ret = strdup(line + mimetype_len + 1); - LOG("Found line match for %s length %zu\n", mimetype, rd); - LOG("Result %s", ret); + NSLOG(netsurf, INFO, + "Found line match for %s length %zu\n", + mimetype, + rd); + NSLOG(netsurf, INFO, "Result %s", ret); break; } @@ -714,7 +717,7 @@ static char *xdg_get_exec_cmd(const char *path, const char *desktop) fname = malloc(fname_len); snprintf(fname, fname_len, "%s/applications/%s", path, desktop); - LOG("Checking %s", fname); + NSLOG(netsurf, INFO, "Checking %s", fname); fp = fopen(fname, "r"); free(fname); @@ -735,8 +738,8 @@ static char *xdg_get_exec_cmd(const char *path, const char *desktop) ret = strdup(line + SLEN("Exec=")); - LOG("Found Exec length %zu", rd); - LOG("Result %s", ret); + NSLOG(netsurf, INFO, "Found Exec length %zu", rd); + NSLOG(netsurf, INFO, "Result %s", ret); break; } @@ -801,7 +804,7 @@ static char **build_exec_argv(const char *fname, const char *exec_cmd) argv[aidx] = exec_arg(start, cur - start, fname); if (argv[aidx] != NULL) { - LOG("adding \"%s\"", argv[aidx]); + NSLOG(netsurf, INFO, "adding \"%s\"", argv[aidx]); aidx++; } } diff --git a/frontends/gtk/window.c b/frontends/gtk/window.c index d32f4573a..7f24d40ac 100644 --- a/frontends/gtk/window.c +++ b/frontends/gtk/window.c @@ -458,7 +458,7 @@ nsgtk_window_scroll_event(GtkWidget *widget, break; #endif default: - LOG("Unhandled mouse scroll direction"); + NSLOG(netsurf, INFO, "Unhandled mouse scroll direction"); return TRUE; } @@ -741,7 +741,7 @@ gui_window_create(struct browser_window *bw, res = nsgtk_builder_new_from_resname("tabcontents", &tab_builder); if (res != NSERROR_OK) { - LOG("Tab contents UI builder init failed"); + NSLOG(netsurf, INFO, "Tab contents UI builder init failed"); return NULL; } @@ -754,7 +754,8 @@ gui_window_create(struct browser_window *bw, return NULL; } - LOG("Creating gui window %p for browser window %p", g, bw); + NSLOG(netsurf, INFO, "Creating gui window %p for browser window %p", + g, bw); g->bw = bw; g->mouse.state = 0; @@ -903,10 +904,10 @@ void nsgtk_window_destroy_browser(struct gui_window *gw) static void gui_window_destroy(struct gui_window *g) { - LOG("gui_window: %p", g); + NSLOG(netsurf, INFO, "gui_window: %p", g); assert(g != NULL); assert(g->bw != NULL); - LOG("scaffolding: %p", g->scaffold); + NSLOG(netsurf, INFO, "scaffolding: %p", g->scaffold); if (g->prev) { g->prev->next = g->next; @@ -918,7 +919,7 @@ static void gui_window_destroy(struct gui_window *g) g->next->prev = g->prev; } - LOG("window list head: %p", window_list); + NSLOG(netsurf, INFO, "window list head: %p", window_list); } /** @@ -940,13 +941,13 @@ static void gui_window_set_icon(struct gui_window *gw, struct hlcache_handle *ic if (icon != NULL) { icon_bitmap = content_get_bitmap(icon); if (icon_bitmap != NULL) { - LOG("Using %p bitmap", icon_bitmap); + NSLOG(netsurf, INFO, "Using %p bitmap", icon_bitmap); gw->icon = nsgdk_pixbuf_get_from_surface(icon_bitmap->surface, 16, 16); } } if (gw->icon == NULL) { - LOG("Using default favicon"); + NSLOG(netsurf, INFO, "Using default favicon"); g_object_ref(favicon_pixbuf); gw->icon = favicon_pixbuf; } @@ -1236,7 +1237,7 @@ gui_window_get_dimensions(struct gui_window *gw, *width /= scale; *height /= scale; } - LOG("gw:%p width:%i height:%i", gw, *width, *height); + NSLOG(netsurf, INFO, "gw:%p width:%i height:%i", gw, *width, *height); return NSERROR_OK; } @@ -1269,8 +1270,8 @@ static void gui_window_create_form_select_menu(struct gui_window *g, item = 0; option = form_select_get_option(control, item); while (option != NULL) { - LOG("Item %"PRIdPTR" option %p text %s", - item, option, option->text); + NSLOG(netsurf, INFO, "Item %"PRIdPTR" option %p text %s", + item, option, option->text); menu_item = gtk_check_menu_item_new_with_label(option->text); if (option->selected) { gtk_check_menu_item_set_active( @@ -1313,10 +1314,10 @@ gui_window_file_gadget_open(struct gui_window *g, NSGTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); - LOG("*** open dialog: %p", dialog); + NSLOG(netsurf, INFO, "*** open dialog: %p", dialog); int ret = gtk_dialog_run(GTK_DIALOG(dialog)); - LOG("*** return value: %d", ret); + NSLOG(netsurf, INFO, "*** return value: %d", ret); if (ret == GTK_RESPONSE_ACCEPT) { char *filename; diff --git a/frontends/monkey/browser.c b/frontends/monkey/browser.c index 16d33010d..1fbbbf0b1 100644 --- a/frontends/monkey/browser.c +++ b/frontends/monkey/browser.c @@ -471,7 +471,7 @@ monkey_window_handle_redraw(int argc, char **argv) clip.y1 = atoi(argv[6]); } - LOG("Issue redraw"); + NSLOG(netsurf, INFO, "Issue redraw"); fprintf(stdout, "WINDOW REDRAW WIN %d START\n", atoi(argv[2])); browser_window_redraw(gw->bw, gw->scrollx, gw->scrolly, &clip, &ctx); fprintf(stdout, "WINDOW REDRAW WIN %d STOP\n", atoi(argv[2])); diff --git a/frontends/monkey/dispatch.c b/frontends/monkey/dispatch.c index b531f05f9..e60325cf1 100644 --- a/frontends/monkey/dispatch.c +++ b/frontends/monkey/dispatch.c @@ -40,7 +40,7 @@ monkey_register_handler(const char *cmd, handle_command_fn fn) { monkey_cmdhandler_t *ret = calloc(sizeof(*ret), 1); if (ret == NULL) { - LOG("Unable to allocate handler"); + NSLOG(netsurf, INFO, "Unable to allocate handler"); return NSERROR_NOMEM; } ret->cmd = strdup(cmd); diff --git a/frontends/monkey/filetype.c b/frontends/monkey/filetype.c index 20bd1edad..979796baf 100644 --- a/frontends/monkey/filetype.c +++ b/frontends/monkey/filetype.c @@ -85,7 +85,8 @@ void monkey_fetch_filetype_init(const char *mimefile) fh = fopen(mimefile, "r"); if (fh == NULL) { - LOG("Unable to open a mime.types file, so using a minimal one for you."); + NSLOG(netsurf, INFO, + "Unable to open a mime.types file, so using a minimal one for you."); return; } diff --git a/frontends/monkey/main.c b/frontends/monkey/main.c index 1bea02471..d697f271f 100644 --- a/frontends/monkey/main.c +++ b/frontends/monkey/main.c @@ -278,20 +278,20 @@ static void monkey_run(void) /* setup timeout */ switch (schedtm) { case -1: - LOG("Iterate blocking"); + NSLOG(netsurf, INFO, "Iterate blocking"); fprintf(stdout, "GENERIC POLL BLOCKING\n"); timeout = NULL; break; case 0: - LOG("Iterate immediate"); + NSLOG(netsurf, INFO, "Iterate immediate"); tv.tv_sec = 0; tv.tv_usec = 0; timeout = &tv; break; default: - LOG("Iterate non-blocking"); + NSLOG(netsurf, INFO, "Iterate non-blocking"); fprintf(stdout, "GENERIC POLL TIMED %d\n", schedtm); tv.tv_sec = schedtm / 1000; /* miliseconds to seconds */ tv.tv_usec = (schedtm % 1000) * 1000; /* remainder to microseconds */ @@ -361,7 +361,7 @@ main(int argc, char **argv) messages = filepath_find(respaths, "Messages"); ret = messages_add_from_file(messages); if (ret != NSERROR_OK) { - LOG("Messages failed to load"); + NSLOG(netsurf, INFO, "Messages failed to load"); } /* common initialisation */ diff --git a/frontends/monkey/schedule.c b/frontends/monkey/schedule.c index af1144a0e..b34bd5aa5 100644 --- a/frontends/monkey/schedule.c +++ b/frontends/monkey/schedule.c @@ -204,13 +204,14 @@ void monkey_schedule_list(void) gettimeofday(&tv, NULL); - LOG("schedule list at %lld:%ld", (long long)tv.tv_sec, tv.tv_usec); + NSLOG(netsurf, INFO, "schedule list at %lld:%ld", + (long long)tv.tv_sec, tv.tv_usec); cur_nscb = schedule_list; while (cur_nscb != NULL) { - LOG("Schedule %p at %lld:%ld", - cur_nscb, (long long)cur_nscb->tv.tv_sec, cur_nscb->tv.tv_usec); + NSLOG(netsurf, INFO, "Schedule %p at %lld:%ld", cur_nscb, + (long long)cur_nscb->tv.tv_sec, cur_nscb->tv.tv_usec); cur_nscb = cur_nscb->next; } } diff --git a/frontends/riscos/401login.c b/frontends/riscos/401login.c index a23c01c90..4b2deb16b 100644 --- a/frontends/riscos/401login.c +++ b/frontends/riscos/401login.c @@ -191,7 +191,8 @@ void ro_gui_401login_close(wimp_w w) error = xwimp_delete_window(w); if (error) { - LOG("xwimp_delete_window: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x:%s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } ro_gui_wimp_event_finalise(w); @@ -212,7 +213,7 @@ bool ro_gui_401login_apply(wimp_w w) auth = malloc(strlen(session->uname) + strlen(session->pwd) + 2); if (!auth) { - LOG("calloc failed"); + NSLOG(netsurf, INFO, "calloc failed"); ro_warn_user("NoMemory", 0); return false; } diff --git a/frontends/riscos/bitmap.c b/frontends/riscos/bitmap.c index 1a3524633..d554d54b4 100644 --- a/frontends/riscos/bitmap.c +++ b/frontends/riscos/bitmap.c @@ -287,7 +287,10 @@ bool riscos_bitmap_save(void *vbitmap, const char *path, unsigned flags) error = xosspriteop_save_sprite_file(osspriteop_USER_AREA, (bitmap->sprite_area), path); if (error) { - LOG("xosspriteop_save_sprite_file: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosspriteop_save_sprite_file: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("SaveError", error->errmess); return false; } @@ -347,7 +350,8 @@ bool riscos_bitmap_save(void *vbitmap, const char *path, unsigned flags) error = xosfind_openoutw(0, path, NULL, &fw); if (error) { - LOG("xosfind_openoutw: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfind_openoutw: 0x%x: %s", + error->errnum, error->errmess); free(chunk_buf); ro_warn_user("SaveError", error->errmess); return false; @@ -361,7 +365,8 @@ bool riscos_bitmap_save(void *vbitmap, const char *path, unsigned flags) if (!error) error = xosgbpb_writew(fw, (byte*)p, image_size, NULL); if (error) { - LOG("xosgbpb_writew: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosgbpb_writew: 0x%x: %s", + error->errnum, error->errmess); free(chunk_buf); xosfind_closew(fw); ro_warn_user("SaveError", error->errmess); @@ -406,7 +411,10 @@ bool riscos_bitmap_save(void *vbitmap, const char *path, unsigned flags) } error = xosgbpb_writew(fw, (byte*)chunk_buf, dp-chunk_buf, NULL); if (error) { - LOG("xosgbpb_writew: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosgbpb_writew: 0x%x: %s", + error->errnum, + error->errmess); free(chunk_buf); xosfind_closew(fw); ro_warn_user("SaveError", error->errmess); @@ -416,13 +424,15 @@ bool riscos_bitmap_save(void *vbitmap, const char *path, unsigned flags) error = xosfind_closew(fw); if (error) { - LOG("xosfind_closew: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfind_closew: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("SaveError", error->errmess); } error = xosfile_set_type(path, osfile_TYPE_SPRITE); if (error) { - LOG("xosfile_set_type: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfile_set_type: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("SaveError", error->errmess); } @@ -509,7 +519,8 @@ void riscos_bitmap_overlay_sprite(struct bitmap *bitmap, (osspriteop_id)s, &w, &h, NULL, NULL); if (error) { - LOG("xosspriteop_read_sprite_info: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosspriteop_read_sprite_info: 0x%x:%s", + error->errnum, error->errmess); return; } sp_offset = ((s->width + 1) * 4) - w; @@ -591,7 +602,7 @@ static osspriteop_area *thumbnail_create_8bpp(struct bitmap *bitmap) sprite_area = (osspriteop_area *)malloc(area_size); if (!sprite_area) { - LOG("no memory for malloc()"); + NSLOG(netsurf, INFO, "no memory for malloc()"); return NULL; } sprite_area->size = area_size; @@ -759,7 +770,8 @@ static void thumbnail_test(void) area_size = sizeof(osspriteop_area) + sizeof(osspriteop_header) + sizeof(int); if ((sprite_area = (osspriteop_area *)malloc(area_size)) == NULL) { - LOG("Insufficient memory to perform sprite test."); + NSLOG(netsurf, INFO, + "Insufficient memory to perform sprite test."); return; } sprite_area->size = area_size + 1; @@ -791,7 +803,7 @@ nserror riscos_bitmap_render(struct bitmap *bitmap, assert(content); assert(bitmap); - LOG("content %p in bitmap %p", content, bitmap); + NSLOG(netsurf, INFO, "content %p in bitmap %p", content, bitmap); /* check if we have access to 32bpp sprites natively */ if (thumbnail_32bpp_available == -1) { diff --git a/frontends/riscos/buffer.c b/frontends/riscos/buffer.c index 7176c1c1c..c63a270db 100644 --- a/frontends/riscos/buffer.c +++ b/frontends/riscos/buffer.c @@ -107,7 +107,12 @@ void ro_gui_buffer_open(wimp_draw *redraw) */ if ((clipping.x1 < clipping.x0) || (clipping.y1 < clipping.y0)) { - LOG("Invalid clipping rectangle (%i, %i) to (%i,%i)", clipping.x0, clipping.y0, clipping.x1, clipping.y1); + NSLOG(netsurf, INFO, + "Invalid clipping rectangle (%i, %i) to (%i,%i)", + clipping.x0, + clipping.y0, + clipping.x1, + clipping.y1); return; } @@ -138,7 +143,7 @@ void ro_gui_buffer_open(wimp_draw *redraw) (word_width * sprite_size.y * 4) + palette_size; buffer = (osspriteop_area *)malloc(total_size); if (!buffer) { - LOG("Failed to allocate memory"); + NSLOG(netsurf, INFO, "Failed to allocate memory"); ro_gui_buffer_free(); return; } @@ -149,7 +154,8 @@ void ro_gui_buffer_open(wimp_draw *redraw) mode = tinct_SPRITE_MODE; #else if ((error = xwimpreadsysinfo_wimp_mode(&mode)) != NULL) { - LOG("Error reading mode '%s'", error->errmess); + NSLOG(netsurf, INFO, "Error reading mode '%s'", + error->errmess); ro_gui_buffer_free(); return; } @@ -177,7 +183,9 @@ void ro_gui_buffer_open(wimp_draw *redraw) error = xos_read_vdu_variables(PTR_OS_VDU_VAR_LIST(&vars), (int *)&vals); if (error) { - LOG("Error reading mode properties '%s'", error->errmess); + NSLOG(netsurf, INFO, + "Error reading mode properties '%s'", + error->errmess); ro_gui_buffer_free(); return; } @@ -233,7 +241,9 @@ void ro_gui_buffer_open(wimp_draw *redraw) } break; default: - LOG("Unhandled 16bpp format from flags %d", vals.flags); + NSLOG(netsurf, INFO, + "Unhandled 16bpp format from flags %d", + vals.flags); ro_gui_buffer_free(); return; } @@ -261,13 +271,16 @@ void ro_gui_buffer_open(wimp_draw *redraw) } break; default: - LOG("Unhandled 32bpp data format from flags %d", vals.flags); + NSLOG(netsurf, INFO, + "Unhandled 32bpp data format from flags %d", + vals.flags); ro_gui_buffer_free(); return; } break; default: - LOG("Unhandled NCOLOUR value %d", vals.ncolour); + NSLOG(netsurf, INFO, "Unhandled NCOLOUR value %d", + vals.ncolour); ro_gui_buffer_free(); return; } @@ -305,7 +318,7 @@ void ro_gui_buffer_open(wimp_draw *redraw) buffer, buffer_name, palette, clipping.x0, clipping.y0, clipping.x1, clipping.y1)) != NULL) { - LOG("Grab error '%s'", error->errmess); + NSLOG(netsurf, INFO, "Grab error '%s'", error->errmess); ro_gui_buffer_free(); return; } @@ -314,7 +327,7 @@ void ro_gui_buffer_open(wimp_draw *redraw) */ if ((error = xosspriteop_read_save_area_size(osspriteop_PTR, buffer, (osspriteop_id)(buffer + 1), &size)) != NULL) { - LOG("Save area error '%s'", error->errmess); + NSLOG(netsurf, INFO, "Save area error '%s'", error->errmess); ro_gui_buffer_free(); return; } @@ -329,7 +342,7 @@ void ro_gui_buffer_open(wimp_draw *redraw) if ((error = xosspriteop_switch_output_to_sprite(osspriteop_PTR, buffer, (osspriteop_id)(buffer + 1), save_area, &context0, &context1, &context2, &context3)) != NULL) { - LOG("Switching error '%s'", error->errmess); + NSLOG(netsurf, INFO, "Switching error '%s'", error->errmess); free(save_area); ro_gui_buffer_free(); return; @@ -345,7 +358,8 @@ void ro_gui_buffer_open(wimp_draw *redraw) */ if ((error = xos_set_ecf_origin(-ro_plot_origin_x, -ro_plot_origin_y)) != NULL) { - LOG("Invalid ECF origin: '%s'", error->errmess); + NSLOG(netsurf, INFO, "Invalid ECF origin: '%s'", + error->errmess); } } diff --git a/frontends/riscos/configure.c b/frontends/riscos/configure.c index 9d28616ec..f4dced55b 100644 --- a/frontends/riscos/configure.c +++ b/frontends/riscos/configure.c @@ -212,7 +212,10 @@ void ro_gui_configure_open_window(wimp_open *open) y + configure_icon_height - CONFIGURE_ICON_PADDING_V); if (error) { - LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_resize_icon: 0x%x: %s", + error->errnum, + error->errmess); } x += configure_icon_width; l++; @@ -225,7 +228,8 @@ void ro_gui_configure_open_window(wimp_open *open) error = xwimp_force_redraw(configure_window, 0, -16384, 16384, 0); if (error) { - LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_force_redraw: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -248,7 +252,8 @@ void ro_gui_configure_open_window(wimp_open *open) extent.y0 = -max_height; error = xwimp_set_extent(open->w, &extent); if (error) { - LOG("xwimp_set_extent: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -259,7 +264,8 @@ void ro_gui_configure_open_window(wimp_open *open) /* open the window */ error = xwimp_open_window(open); if (error) { - LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -276,7 +282,7 @@ void ro_gui_configure_register(const char *window, /* create our tool */ tool = calloc(sizeof(struct configure_tool), 1); if (!tool) { - LOG("Insufficient memory for calloc()"); + NSLOG(netsurf, INFO, "Insufficient memory for calloc()"); die("Insufficient memory"); return; /* For the benefit of scan-build */ } @@ -284,7 +290,7 @@ void ro_gui_configure_register(const char *window, tool->translated[0] = '\0'; tool->validation = malloc(strlen(window) + 2); if (!tool->validation) { - LOG("Insufficient memory for malloc()"); + NSLOG(netsurf, INFO, "Insufficient memory for malloc()"); die("Insufficient memory"); } sprintf(tool->validation, "S%s", window); @@ -311,7 +317,8 @@ void ro_gui_configure_register(const char *window, CONFIGURE_TOOL_TRANSLATED_SIZE; error = xwimp_create_icon(&new_icon, &tool->i); if (error) { - LOG("xwimp_create_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_icon: 0x%x: %s", + error->errnum, error->errmess); die(error->errmess); } @@ -360,7 +367,8 @@ bool ro_gui_configure_translate(void) error = xosbyte1(osbyte_ALPHABET_NUMBER, 127, 0, &alphabet); if (error) { - LOG("failed reading alphabet: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "failed reading alphabet: 0x%x: %s", + error->errnum, error->errmess); /* assume Latin1 */ alphabet = territory_ALPHABET_LATIN1; } @@ -381,7 +389,10 @@ bool ro_gui_configure_translate(void) error = xwimptextop_string_width(tool->translated, strlen(tool->translated), &icon_width); if (error) { - LOG("xwimptextop_string_width: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimptextop_string_width: 0x%x: %s", + error->errnum, + error->errmess); return false; } icon_width += CONFIGURE_ICON_PADDING_H; @@ -395,7 +406,8 @@ bool ro_gui_configure_translate(void) configure_icon_width, 0); if (error) { - LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_resize_icon: 0x%x: %s", + error->errnum, error->errmess); } } diff --git a/frontends/riscos/configure/con_language.c b/frontends/riscos/configure/con_language.c index 2030c65c0..77e4f6cb4 100644 --- a/frontends/riscos/configure/con_language.c +++ b/frontends/riscos/configure/con_language.c @@ -98,7 +98,8 @@ bool ro_gui_options_language_ok(wimp_w w) if (temp) { nsoption_set_charp(language, temp); } else { - LOG("No memory to duplicate language code"); + NSLOG(netsurf, INFO, + "No memory to duplicate language code"); ro_warn_user("NoMemory", 0); } } @@ -113,7 +114,8 @@ bool ro_gui_options_language_ok(wimp_w w) if (temp) { nsoption_set_charp(accept_language,temp); } else { - LOG("No memory to duplicate language code"); + NSLOG(netsurf, INFO, + "No memory to duplicate language code"); ro_warn_user("NoMemory", 0); } } diff --git a/frontends/riscos/configure/con_theme.c b/frontends/riscos/configure/con_theme.c index fb0d3dfb0..28195dea9 100644 --- a/frontends/riscos/configure/con_theme.c +++ b/frontends/riscos/configure/con_theme.c @@ -104,20 +104,23 @@ bool ro_gui_options_theme_initialise(wimp_w w) return false; error = xwimp_create_window(&theme_pane_definition, &theme_pane); if (error) { - LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s", + error->errnum, error->errmess); return false; } state.w = w; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); return false; } icon_state.w = w; icon_state.i = THEME_PANE_AREA; error = xwimp_get_icon_state(&icon_state); if (error) { - LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s", + error->errnum, error->errmess); return false; } state.w = theme_pane; @@ -126,7 +129,8 @@ bool ro_gui_options_theme_initialise(wimp_w w) state.visible.x0 += icon_state.icon.extent.x0 + 16; state.visible.y0 = state.visible.y1 + icon_state.icon.extent.y0 + 16; state.visible.y1 += icon_state.icon.extent.y1 - 28; - LOG("Y0 = %i, y1 = %i", icon_state.icon.extent.y0, icon_state.icon.extent.y1); + NSLOG(netsurf, INFO, "Y0 = %i, y1 = %i", icon_state.icon.extent.y0, + icon_state.icon.extent.y1); error = xwimp_open_window_nested(PTR_WIMP_OPEN(&state), w, wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT << wimp_CHILD_XORIGIN_SHIFT | @@ -141,7 +145,8 @@ bool ro_gui_options_theme_initialise(wimp_w w) wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT << wimp_CHILD_TS_EDGE_SHIFT); if (error) { - LOG("xwimp_open_window_nested: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_open_window_nested: 0x%x: %s", + error->errnum, error->errmess); return false; } @@ -176,7 +181,8 @@ void ro_gui_options_theme_finalise(wimp_w w) ro_gui_wimp_event_finalise(theme_pane); error = xwimp_delete_window(theme_pane); if (error) { - LOG("xwimp_delete_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } theme_pane = 0; @@ -269,7 +275,7 @@ void ro_gui_options_theme_load(void) ro_toolbar_rebuild(toolbar); toolbar_display = calloc(sizeof(struct toolbar_display), 1); if (!toolbar_display) { - LOG("No memory for calloc()"); + NSLOG(netsurf, INFO, "No memory for calloc()"); ro_warn_user("NoMemory", 0); return; } @@ -291,7 +297,8 @@ void ro_gui_options_theme_load(void) state.w = theme_pane; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } diff --git a/frontends/riscos/content-handlers/artworks.c b/frontends/riscos/content-handlers/artworks.c index d6f6da318..8ec4edcae 100644 --- a/frontends/riscos/content-handlers/artworks.c +++ b/frontends/riscos/content-handlers/artworks.c @@ -183,7 +183,7 @@ bool artworks_convert(struct content *c) xos_read_var_val_size("Alias$LoadArtWorksModules", 0, os_VARTYPE_STRING, &used, NULL, NULL); if (used >= 0) { - LOG("Alias$LoadArtWorksModules not defined"); + NSLOG(netsurf, INFO, "Alias$LoadArtWorksModules not defined"); msg_data.error = messages_get("AWNotSeen"); content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; @@ -192,7 +192,8 @@ bool artworks_convert(struct content *c) /* load the modules, or do nothing if they're already loaded */ error = xos_cli("LoadArtWorksModules"); if (error) { - LOG("xos_cli: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xos_cli: 0x%x: %s", error->errnum, + error->errmess); msg_data.error = error->errmess; content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; @@ -202,7 +203,8 @@ bool artworks_convert(struct content *c) error = (os_error*)_swix(AWRender_FileInitAddress, _OUT(0) | _OUT(1), &init_routine, &init_workspace); if (error) { - LOG("AWRender_FileInitAddress: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "AWRender_FileInitAddress: 0x%x: %s", + error->errnum, error->errmess); msg_data.error = error->errmess; content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; @@ -212,7 +214,8 @@ bool artworks_convert(struct content *c) &aw->render_routine, &aw->render_workspace); if (error) { - LOG("AWRender_RenderAddress: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "AWRender_RenderAddress: 0x%x: %s", + error->errnum, error->errmess); msg_data.error = error->errmess; content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; @@ -224,7 +227,8 @@ bool artworks_convert(struct content *c) error = awrender_init(&source_data, &source_size, init_routine, init_workspace); if (error) { - LOG("awrender_init: 0x%x : %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "awrender_init: 0x%x : %s", + error->errnum, error->errmess); msg_data.error = error->errmess; content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; @@ -239,13 +243,15 @@ bool artworks_convert(struct content *c) &aw->y1); if (error) { - LOG("AWRender_DocBounds: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "AWRender_DocBounds: 0x%x: %s", + error->errnum, error->errmess); msg_data.error = error->errmess; content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; } - LOG("bounding box: %d,%d,%d,%d", aw->x0, aw->y0, aw->x1, aw->y1); + NSLOG(netsurf, INFO, "bounding box: %d,%d,%d,%d", aw->x0, aw->y0, + aw->x1, aw->y1); /* create the resizable workspace required by the ArtWorksRenderer rendering routine */ @@ -253,7 +259,8 @@ bool artworks_convert(struct content *c) aw->size = INITIAL_BLOCK_SIZE; aw->block = malloc(INITIAL_BLOCK_SIZE); if (!aw->block) { - LOG("failed to create block for ArtworksRenderer"); + NSLOG(netsurf, INFO, + "failed to create block for ArtworksRenderer"); msg_data.error = messages_get("NoMemory"); content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; @@ -368,13 +375,15 @@ bool artworks_redraw(struct content *c, struct content_redraw_data *data, error = xos_read_vdu_variables(PTR_OS_VDU_VAR_LIST(&vars), vals); if (error) { - LOG("xos_read_vdu_variables: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xos_read_vdu_variables: 0x%x: %s", + error->errnum, error->errmess); return false; } error = xwimp_read_palette((os_palette*)&vals[3]); if (error) { - LOG("xwimp_read_palette: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_read_palette: 0x%x: %s", + error->errnum, error->errmess); return false; } @@ -393,7 +402,8 @@ bool artworks_redraw(struct content *c, struct content_redraw_data *data, aw->render_workspace); if (error) { - LOG("awrender_render: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "awrender_render: 0x%x: %s", + error->errnum, error->errmess); return false; } diff --git a/frontends/riscos/content-handlers/draw.c b/frontends/riscos/content-handlers/draw.c index 4627b19c0..bb66f9dbb 100644 --- a/frontends/riscos/content-handlers/draw.c +++ b/frontends/riscos/content-handlers/draw.c @@ -126,7 +126,8 @@ bool draw_convert(struct content *c) error = xdrawfile_bbox(0, (drawfile_diagram *) data, (int) source_size, 0, &bbox); if (error) { - LOG("xdrawfile_bbox: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xdrawfile_bbox: 0x%x: %s", + error->errnum, error->errmess); msg_data.error = error->errmess; content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; @@ -208,7 +209,8 @@ bool draw_redraw(struct content *c, struct content_redraw_data *data, error = xdrawfile_render(0, (drawfile_diagram *) src_data, (int) source_size, &matrix, 0, 0); if (error) { - LOG("xdrawfile_render: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xdrawfile_render: 0x%x: %s", + error->errnum, error->errmess); return false; } diff --git a/frontends/riscos/content-handlers/sprite.c b/frontends/riscos/content-handlers/sprite.c index 5cbade4e5..3556aa555 100644 --- a/frontends/riscos/content-handlers/sprite.c +++ b/frontends/riscos/content-handlers/sprite.c @@ -135,7 +135,10 @@ bool sprite_convert(struct content *c) (osspriteop_id) ((char *) area + area->first), &w, &h, NULL, NULL); if (error) { - LOG("xosspriteop_read_sprite_info: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosspriteop_read_sprite_info: 0x%x: %s", + error->errnum, + error->errmess); msg_data.error = error->errmess; content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; diff --git a/frontends/riscos/cookies.c b/frontends/riscos/cookies.c index 614bc3d10..125d04356 100644 --- a/frontends/riscos/cookies.c +++ b/frontends/riscos/cookies.c @@ -445,12 +445,12 @@ nserror ro_gui_cookies_present(void) res = ro_cookie_init(); if (res == NSERROR_OK) { - LOG("Presenting"); + NSLOG(netsurf, INFO, "Presenting"); ro_gui_dialog_open_top(cookie_window->core.wh, cookie_window->core.toolbar, 600, 800); } else { - LOG("Failed presenting code %d", res); + NSLOG(netsurf, INFO, "Failed presenting code %d", res); } return res; diff --git a/frontends/riscos/corewindow.c b/frontends/riscos/corewindow.c index 77dd1c375..84177aa90 100644 --- a/frontends/riscos/corewindow.c +++ b/frontends/riscos/corewindow.c @@ -63,22 +63,22 @@ static void update_scrollbars(struct ro_corewindow *ro_cw, wimp_open *open) int extent_height; os_box extent; - LOG("RO corewindow context %p", ro_cw); + NSLOG(netsurf, INFO, "RO corewindow context %p", ro_cw); /* extent of content in not smaller than window so start there */ extent_width = open->visible.x1 - open->visible.x0; extent_height = open->visible.y0 - open->visible.y1; - LOG("extent w:%d h:%d content w:%d h:%d origin h:%d", - extent_width, extent_height, - ro_cw->content_width, ro_cw->content_height, ro_cw->origin_y); + NSLOG(netsurf, INFO, + "extent w:%d h:%d content w:%d h:%d origin h:%d", extent_width, + extent_height, ro_cw->content_width, ro_cw->content_height, + ro_cw->origin_y); if (ro_cw->content_width > extent_width) { extent_width = ro_cw->content_width; } if (extent_height > (ro_cw->origin_y + ro_cw->content_height)) { extent_height = ro_cw->origin_y + ro_cw->content_height; } - LOG("extent w:%d h:%d", - extent_width, extent_height); + NSLOG(netsurf, INFO, "extent w:%d h:%d", extent_width, extent_height); extent.x0 = 0; extent.y0 = extent_height; extent.x1 = extent_width; @@ -86,15 +86,15 @@ static void update_scrollbars(struct ro_corewindow *ro_cw, wimp_open *open) error = xwimp_set_extent(ro_cw->wh, &extent); if (error) { - LOG("xwimp_set_extent: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s", + error->errnum, error->errmess); return; } error = xwimp_open_window(open); if (error) { - LOG("xwimp_open_window: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s", + error->errnum, error->errmess); } } @@ -130,8 +130,8 @@ static void ro_cw_redraw(wimp_draw *redraw) error = xwimp_get_rectangle(redraw, &more); } if (error != NULL) { - LOG("xwimp_redraw_window: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_redraw_window: 0x%x: %s", + error->errnum, error->errmess); } } @@ -145,7 +145,7 @@ static void ro_cw_scroll(wimp_scroll *scroll) wimp_open open; ro_cw = (struct ro_corewindow *)ro_gui_wimp_event_get_user_data(scroll->w); - LOG("RO corewindow context %p", ro_cw); + NSLOG(netsurf, INFO, "RO corewindow context %p", ro_cw); page_x = scroll->visible.x1 - scroll->visible.x0 - 32; page_y = scroll->visible.y1 - scroll->visible.y0 - 32; @@ -202,8 +202,8 @@ static void ro_cw_scroll(wimp_scroll *scroll) error = xwimp_open_window(&open); if (error) { - LOG("xwimp_open_window: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s", + error->errnum, error->errmess); } } @@ -231,18 +231,18 @@ static void ro_cw_mouse_at(wimp_pointer *pointer, void *data) ro_cw = (struct ro_corewindow *)ro_gui_wimp_event_get_user_data(pointer->w); if (ro_cw == NULL) { - LOG("no corewindow conext for window: 0x%x", - (unsigned int)pointer->w); + NSLOG(netsurf, INFO, "no corewindow conext for window: 0x%x", + (unsigned int)pointer->w); return; } - LOG("RO corewindow context %p", ro_cw); + NSLOG(netsurf, INFO, "RO corewindow context %p", ro_cw); /* Not a Menu click. */ state.w = pointer->w; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); return; } @@ -285,14 +285,15 @@ static void ro_cw_drag_end(wimp_dragged *drag, void *data) error = xwimp_drag_box((wimp_drag *) -1); if (error) { - LOG("xwimp_drag_box: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_drag_box: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } error = xwimp_auto_scroll(0, NULL, NULL); if (error) { - LOG("xwimp_auto_scroll: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_auto_scroll: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -345,12 +346,13 @@ ro_cw_drag_start(struct ro_corewindow *ro_cw, break; } - LOG("Drag start..."); + NSLOG(netsurf, INFO, "Drag start..."); error = xwimp_drag_box_with_flags(&drag, wimp_DRAG_BOX_KEEP_IN_LINE | wimp_DRAG_BOX_CLIP); if (error) { - LOG("xwimp_drag_box: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_drag_box: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } else { auto_scroll.w = ro_cw->wh; @@ -364,7 +366,8 @@ ro_cw_drag_start(struct ro_corewindow *ro_cw, error = xwimp_auto_scroll(wimp_AUTO_SCROLL_ENABLE_VERTICAL, &auto_scroll, NULL); if (error) { - LOG("xwimp_auto_scroll: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_auto_scroll: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -388,8 +391,8 @@ static void ro_cw_pointer_leaving(wimp_leaving *leaving, void *data) ro_cw = (struct ro_corewindow *)ro_gui_wimp_event_get_user_data(leaving->w); if (ro_cw == NULL) { - LOG("no corewindow conext for window: 0x%x", - (unsigned int)leaving->w); + NSLOG(netsurf, INFO, "no corewindow conext for window: 0x%x", + (unsigned int)leaving->w); return; } @@ -439,14 +442,14 @@ static bool ro_cw_mouse_click(wimp_pointer *pointer) struct ro_corewindow *ro_cw; ro_cw = (struct ro_corewindow *)ro_gui_wimp_event_get_user_data(pointer->w); - LOG("RO corewindow context %p", ro_cw); + NSLOG(netsurf, INFO, "RO corewindow context %p", ro_cw); state.w = ro_cw->wh; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); return false; } @@ -517,7 +520,7 @@ static bool ro_cw_keypress(wimp_key *key) nserror res; ro_cw = (struct ro_corewindow *)ro_gui_wimp_event_get_user_data(key->w); - LOG("RO corewindow context %p", ro_cw); + NSLOG(netsurf, INFO, "RO corewindow context %p", ro_cw); c = (uint32_t) key->c; @@ -640,8 +643,8 @@ static void cw_tb_size(void *ctx) state.w = ro_cw->wh; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); return; } @@ -649,8 +652,8 @@ static void cw_tb_size(void *ctx) 0, state.visible.y0 - state.visible.y1, state.visible.x1 - state.visible.x0, 0); if (error) { - LOG("xwimp_force_redraw: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_force_redraw: 0x%x: %s", + error->errnum, error->errmess); return; } } @@ -759,8 +762,10 @@ ro_cw_invalidate(struct core_window *cw, const struct rect *r) info.w = ro_cw->wh; error = xwimp_get_window_info_header_only(&info); if (error) { - LOG("xwimp_get_window_info_header_only: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_window_info_header_only: 0x%x: %s", + error->errnum, + error->errmess); return NSERROR_INVALID; } } else { @@ -775,8 +780,8 @@ ro_cw_invalidate(struct core_window *cw, const struct rect *r) info.extent.x0, info.extent.y0, info.extent.x1, info.extent.y1); if (error) { - LOG("xwimp_force_redraw: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_force_redraw: 0x%x: %s", + error->errnum, error->errmess); return NSERROR_INVALID; } return NSERROR_OK; @@ -794,8 +799,8 @@ ro_cw_update_size(struct core_window *cw, int width, int height) wimp_window_state state; os_error *error; - LOG("content resize from w:%d h:%d to w:%d h:%d", - ro_cw->content_width, ro_cw->content_height, width, height); + NSLOG(netsurf, INFO, "content resize from w:%d h:%d to w:%d h:%d", + ro_cw->content_width, ro_cw->content_height, width, height); ro_cw->content_width = width * 2; ro_cw->content_height = -(2 * height); @@ -803,8 +808,8 @@ ro_cw_update_size(struct core_window *cw, int width, int height) state.w = ro_cw->wh; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); return; } @@ -848,8 +853,8 @@ ro_cw_get_window_dimensions(struct core_window *cw, int *width, int *height) state.w = ro_cw->wh; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); return; } diff --git a/frontends/riscos/dialog.c b/frontends/riscos/dialog.c index 6414778db..a50d1289b 100644 --- a/frontends/riscos/dialog.c +++ b/frontends/riscos/dialog.c @@ -220,7 +220,8 @@ wimp_w ro_gui_dialog_create(const char *template_name) window->sprite_area = gui_sprites; error = xwimp_create_window(window, &w); if (error) { - LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s", + error->errnum, error->errmess); xwimp_close_template(); die(error->errmess); } @@ -259,12 +260,13 @@ wimp_window * ro_gui_dialog_load_template(const char *template_name) error = xwimp_load_template(wimp_GET_SIZE, 0, 0, wimp_NO_FONTS, name, 0, &window_size, &data_size, &context); if (error) { - LOG("xwimp_load_template: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_load_template: 0x%x: %s", + error->errnum, error->errmess); xwimp_close_template(); die(error->errmess); } if (!context) { - LOG("template '%s' missing", template_name); + NSLOG(netsurf, INFO, "template '%s' missing", template_name); xwimp_close_template(); die("Template"); } @@ -281,7 +283,8 @@ wimp_window * ro_gui_dialog_load_template(const char *template_name) error = xwimp_load_template(window, data, data + data_size, wimp_NO_FONTS, name, 0, 0, 0, 0); if (error) { - LOG("xwimp_load_template: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_load_template: 0x%x: %s", + error->errnum, error->errmess); xwimp_close_template(); die(error->errmess); } @@ -309,7 +312,8 @@ void ro_gui_dialog_open(wimp_w w) state.w = w; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -356,7 +360,8 @@ void ro_gui_dialog_close(wimp_w close) */ error = xwimp_get_caret_position(&caret); if (error) { - LOG("xwimp_get_caret_position: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_caret_position: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } else if (caret.w == close) { /* Check if we are a persistent window */ @@ -367,7 +372,10 @@ void ro_gui_dialog_close(wimp_w close) 32, -1); /* parent may have been closed first */ if ((error) && (error->errnum != 0x287)) { - LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_set_caret_position: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -375,7 +383,8 @@ void ro_gui_dialog_close(wimp_w close) error = xwimp_close_window(close); if (error) { - LOG("xwimp_close_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -460,7 +469,8 @@ void ro_gui_dialog_open_at_pointer(wimp_w w) /* get the pointer position */ error = xwimp_get_pointer_info(&ptr); if (error) { - LOG("xwimp_get_pointer_info: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -483,7 +493,8 @@ void ro_gui_dialog_open_xy(wimp_w w, int x, int y) state.w = w; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -498,7 +509,8 @@ void ro_gui_dialog_open_xy(wimp_w w, int x, int y) * on screen */ error = xwimp_close_window(w); if (error) { - LOG("xwimp_close_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -527,7 +539,10 @@ static void ro_gui_dialog_open_centre_parent(wimp_w parent, wimp_w child) state.w = parent; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_window_state: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -544,7 +559,8 @@ static void ro_gui_dialog_open_centre_parent(wimp_w parent, wimp_w child) state.w = child; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -607,7 +623,7 @@ void ro_gui_dialog_add_persistent(wimp_w parent, wimp_w w) { return; } } - LOG("Unable to map persistent dialog to parent."); + NSLOG(netsurf, INFO, "Unable to map persistent dialog to parent."); return; } @@ -636,7 +652,9 @@ void ro_gui_dialog_close_persistent(wimp_w parent) { w = persistent_dialog[i].dialog; ro_gui_dialog_close(w); if (ro_gui_wimp_event_close_window(w)) - LOG("Persistent dialog close event: 0x%x", (unsigned)w); + NSLOG(netsurf, INFO, + "Persistent dialog close event: 0x%x", + (unsigned)w); persistent_dialog[i].parent = NULL; persistent_dialog[i].dialog = NULL; } @@ -713,7 +731,7 @@ static bool ro_gui_dialog_open_url_init(void) if ((definition->icons[ICON_OPENURL_URL].flags & wimp_ICON_INDIRECTED) == 0) { - LOG("open_url URL icon not indirected"); + NSLOG(netsurf, INFO, "open_url URL icon not indirected"); xwimp_close_template(); die("Template"); } @@ -731,7 +749,8 @@ static bool ro_gui_dialog_open_url_init(void) error = xwimp_create_window(definition, &dialog_openurl); if (error != NULL) { - LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s", + error->errnum, error->errmess); xwimp_close_template(); die(error->errmess); } diff --git a/frontends/riscos/download.c b/frontends/riscos/download.c index 561409ed1..bdc705426 100644 --- a/frontends/riscos/download.c +++ b/frontends/riscos/download.c @@ -261,7 +261,10 @@ static nserror download_ro_filetype(download_context *ctx, bits *ftype_out) mime_type = download_context_get_mime_type(ctx); error = xmimemaptranslate_mime_type_to_filetype(mime_type, &ftype); if (error) { - LOG("xmimemaptranslate_mime_type_to_filetype: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xmimemaptranslate_mime_type_to_filetype: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("MiscError", error->errmess); ftype = 0xffd; } @@ -339,7 +342,8 @@ gui_download_window_create(download_context *ctx, struct gui_window *gui) error = xosfind_openoutw(osfind_NO_PATH | osfind_ERROR_IF_DIR, temp_name, 0, &dw->file); if (error) { - LOG("xosfind_openoutw: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfind_openoutw: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("SaveError", error->errmess); free(dw); return 0; @@ -372,7 +376,7 @@ gui_download_window_create(download_context *ctx, struct gui_window *gui) filename = strdup(temp_name); if (filename == NULL) { - LOG("Failed to establish download filename."); + NSLOG(netsurf, INFO, "Failed to establish download filename."); ro_warn_user("SaveError", error->errmess); free(dw); return 0; @@ -404,7 +408,7 @@ gui_download_window_create(download_context *ctx, struct gui_window *gui) if (err != NSERROR_OK) { /* badenc should never happen */ assert(err !=NSERROR_BAD_ENCODING); - LOG("utf8_to_local_encoding failed"); + NSLOG(netsurf, INFO, "utf8_to_local_encoding failed"); ro_warn_user("NoMemory", 0); free(dw); return 0; @@ -430,7 +434,8 @@ gui_download_window_create(download_context *ctx, struct gui_window *gui) /* create and open the download window */ error = xwimp_create_window(download_template, &dw->window); if (error) { - LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); free(dw); return 0; @@ -485,7 +490,8 @@ static void gui_download_window_error(struct gui_download_window *dw, wimp_COLOUR_RED << wimp_ICON_FG_COLOUR_SHIFT, wimp_ICON_FG_COLOUR); if (error) { - LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -493,7 +499,8 @@ static void gui_download_window_error(struct gui_download_window *dw, error = xwimp_set_icon_state(dw->window, ICON_DOWNLOAD_PATH, wimp_ICON_SHADED, 0); if (error) { - LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -501,7 +508,8 @@ static void gui_download_window_error(struct gui_download_window *dw, error = xwimp_set_icon_state(dw->window, ICON_DOWNLOAD_ICON, wimp_ICON_SHADED, wimp_ICON_SHADED); if (error) { - LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -528,11 +536,13 @@ static nserror gui_download_window_data(struct gui_download_window *dw, error = xosgbpb_writew(dw->file, (const byte *) data, size, &unwritten); if (error) { - LOG("xosgbpb_writew: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosgbpb_writew: 0x%x: %s", + error->errnum, error->errmess); msg = error->errmess; } else if (unwritten) { - LOG("xosgbpb_writew: unwritten %i", unwritten); + NSLOG(netsurf, INFO, "xosgbpb_writew: unwritten %i", + unwritten); msg = messages_get("Unwritten"); } else { @@ -555,20 +565,29 @@ static nserror gui_download_window_data(struct gui_download_window *dw, error = xwimp_set_icon_state(dw->window, ICON_DOWNLOAD_ICON, wimp_ICON_SHADED, 0); if (error) { - LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_set_icon_state: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } error = xwimp_set_icon_state(dw->window, ICON_DOWNLOAD_DESTINATION, wimp_ICON_DELETED, wimp_ICON_DELETED); if (error) { - LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_set_icon_state: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } error = xwimp_set_icon_state(dw->window, ICON_DOWNLOAD_PATH, wimp_ICON_DELETED, 0); if (error) { - LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_set_icon_state: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -717,13 +736,15 @@ void ro_gui_download_update_status(struct gui_download_window *dw) download_progress_x0 + width, download_progress_y1); if (error) { - LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_resize_icon: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } error = xwimp_set_icon_state(dw->window, ICON_DOWNLOAD_STATUS, 0, 0); if (error) { - LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -759,13 +780,17 @@ void ro_gui_download_window_hide_caret(struct gui_download_window *dw) error = xwimp_get_caret_position(&caret); if (error) { - LOG("xwimp_get_caret_position: 0x%x : %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_caret_position: 0x%x : %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } else if (caret.w == dw->window) { error = xwimp_set_caret_position(dw->window, (wimp_i)-1, 0, 0, 1 << 25, -1); if (error) { - LOG("xwimp_get_caret_position: 0x%x : %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_caret_position: 0x%x : %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -791,7 +816,8 @@ static void gui_download_window_done(struct gui_download_window *dw) error = xosfind_closew(dw->file); if (error) { - LOG("xosfind_closew: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfind_closew: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("SaveError", error->errmess); } dw->file = 0; @@ -800,7 +826,8 @@ static void gui_download_window_done(struct gui_download_window *dw) error = xosfile_set_type(dw->path, dw->file_type); if (error) { - LOG("xosfile_set_type: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfile_set_type: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("SaveError", error->errmess); } @@ -856,7 +883,8 @@ bool ro_gui_download_click(wimp_pointer *pointer) *dot = 0; error = xos_cli(command); if (error) { - LOG("xos_cli: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xos_cli: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("MiscError", error->errmess); } } @@ -929,7 +957,8 @@ static void ro_gui_download_drag_end(wimp_dragged *drag, void *data) error = xwimp_get_pointer_info(&pointer); if (error) { - LOG("xwimp_get_pointer_info: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -959,7 +988,10 @@ static void ro_gui_download_drag_end(wimp_dragged *drag, void *data) error = xwimp_send_message_to_window(wimp_USER_MESSAGE, &message, pointer.w, pointer.i, 0); if (error) { - LOG("xwimp_send_message_to_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_send_message_to_window: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -1011,7 +1043,10 @@ char *ro_gui_download_canonicalise(const char *path) error = xosfscontrol_canonicalise_path(path, NULL, NULL, NULL, 0, &spare); if (error) { - LOG("xosfscontrol_canonicalise_path: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosfscontrol_canonicalise_path: 0x%x: %s", + error->errnum, + error->errmess); return NULL; } @@ -1020,7 +1055,10 @@ char *ro_gui_download_canonicalise(const char *path) error = xosfscontrol_canonicalise_path(path, buf, NULL, NULL, 1 - spare, NULL); if (error) { - LOG("xosfscontrol_canonicalise_path: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosfscontrol_canonicalise_path: 0x%x: %s", + error->errnum, + error->errmess); free(buf); return NULL; @@ -1065,13 +1103,17 @@ bool ro_gui_download_check_space(struct gui_download_window *dw, error = xosfscontrol_free_space64(dir, &free_lo, &free_hi, &max_file, NULL, NULL); if (error) { - LOG("xosfscontrol_free_space64: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfscontrol_free_space64: 0x%x: %s", + error->errnum, error->errmess); free_hi = 0; error = xosfscontrol_free_space(dir, (int*)&free_lo, &max_file, NULL); if (error) { - LOG("xosfscontrol_free_space: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosfscontrol_free_space: 0x%x: %s", + error->errnum, + error->errmess); /* close our eyes and hope */ free(dir); return true; @@ -1108,7 +1150,10 @@ bool ro_gui_download_check_space(struct gui_download_window *dw, error = xosargs_read_allocation(dw->file, &allocation); if (error) { - LOG("xosargs_read_allocation: 0x%x : %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosargs_read_allocation: 0x%x : %s", + error->errnum, + error->errmess); } else { space += allocation; @@ -1147,7 +1192,8 @@ os_error *ro_gui_download_move(struct gui_download_window *dw, error = xosfind_closew(dw->file); dw->file = 0; if (error) { - LOG("xosfind_closew: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfind_closew: 0x%x: %s", + error->errnum, error->errmess); return error; } } @@ -1165,11 +1211,13 @@ os_error *ro_gui_download_move(struct gui_download_window *dw, osfscontrol_COPY_LOOK, 0, 0, 0, 0, 0); if (error) { - LOG("xosfscontrol_copy: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfscontrol_copy: 0x%x: %s", + error->errnum, error->errmess); return error; } } else if (error) { - LOG("xosfscontrol_rename: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfscontrol_rename: 0x%x: %s", + error->errnum, error->errmess); return error; } @@ -1179,20 +1227,23 @@ os_error *ro_gui_download_move(struct gui_download_window *dw, fileswitch_ATTR_OWNER_READ | fileswitch_ATTR_OWNER_WRITE); if (error) { - LOG("xosfile_write: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfile_write: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("SaveError", error->errmess); } error = xosfind_openupw(osfind_NO_PATH | osfind_ERROR_IF_DIR, dest_file, 0, &dw->file); if (error) { - LOG("xosfind_openupw: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfind_openupw: 0x%x: %s", + error->errnum, error->errmess); return error; } error = xosargs_set_ptrw(dw->file, dw->received); if (error) { - LOG("xosargs_set_ptrw: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosargs_set_ptrw: 0x%x: %s", + error->errnum, error->errmess); return error; } @@ -1201,7 +1252,8 @@ os_error *ro_gui_download_move(struct gui_download_window *dw, error = xosfile_set_type(dest_file, dw->file_type); if (error) { - LOG("xosfile_set_type: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfile_set_type: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("SaveError", error->errmess); } } @@ -1273,7 +1325,8 @@ bool ro_gui_download_save(struct gui_download_window *dw, error = xosfile_read_stamped(file_name, &obj_type, NULL, NULL, NULL, NULL, NULL); if (error) { - LOG("xosfile_read_stamped: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfile_read_stamped: 0x%x:%s", + error->errnum, error->errmess); return false; } @@ -1309,12 +1362,16 @@ bool ro_gui_download_save(struct gui_download_window *dw, error = xosfind_openupw(osfind_NO_PATH | osfind_ERROR_IF_DIR, temp_name, 0, &dw->file); if (error) { - LOG("xosfind_openupw: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfind_openupw: 0x%x: %s", + error->errnum, error->errmess); } else { error = xosargs_set_ptrw(dw->file, dw->received); if (error) { - LOG("xosargs_set_ptrw: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosargs_set_ptrw: 0x%x: %s", + error->errnum, + error->errmess); } } @@ -1336,7 +1393,8 @@ bool ro_gui_download_save(struct gui_download_window *dw, error = xwimp_set_icon_state(dw->window, ICON_DOWNLOAD_ICON, wimp_ICON_SHADED, wimp_ICON_SHADED); if (error) { - LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -1349,13 +1407,15 @@ bool ro_gui_download_save(struct gui_download_window *dw, error = xwimp_set_icon_state(dw->window, ICON_DOWNLOAD_PATH, wimp_ICON_DELETED, wimp_ICON_DELETED); if (error) { - LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } error = xwimp_set_icon_state(dw->window, ICON_DOWNLOAD_DESTINATION, wimp_ICON_DELETED, 0); if (error) { - LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -1401,7 +1461,8 @@ void ro_gui_download_send_dataload(struct gui_download_window *dw) * for the rather depressing details. */ if (error && error->errnum != error_WIMP_BAD_HANDLE) { - LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -1482,7 +1543,8 @@ bool ro_gui_download_window_destroy(struct gui_download_window *dw, bool quit) /* delete window */ error = xwimp_delete_window(dw->window); if (error) { - LOG("xwimp_delete_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } ro_gui_wimp_event_finalise(dw->window); @@ -1491,7 +1553,8 @@ bool ro_gui_download_window_destroy(struct gui_download_window *dw, bool quit) if (dw->file) { error = xosfind_closew(dw->file); if (error) { - LOG("xosfind_closew: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfind_closew: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("SaveError", error->errmess); } } @@ -1502,7 +1565,8 @@ bool ro_gui_download_window_destroy(struct gui_download_window *dw, bool quit) error = xosfile_delete(temp_name, 0, 0, 0, 0, 0); if (error) { - LOG("xosfile_delete: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfile_delete: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("SaveError", error->errmess); } } diff --git a/frontends/riscos/filetype.c b/frontends/riscos/filetype.c index 75ff41414..73651cd63 100644 --- a/frontends/riscos/filetype.c +++ b/frontends/riscos/filetype.c @@ -72,7 +72,7 @@ const char *fetch_filetype(const char *unix_path) int objtype; if (!path) { - LOG("Insufficient memory for calloc"); + NSLOG(netsurf, INFO, "Insufficient memory for calloc"); ro_warn_user("NoMemory", 0); return "application/riscos"; } @@ -80,7 +80,7 @@ const char *fetch_filetype(const char *unix_path) /* convert path to RISC OS format and read file type */ r = __riscosify(unix_path, 0, __RISCOSIFY_NO_SUFFIX, path, len, 0); if (r == 0) { - LOG("__riscosify failed"); + NSLOG(netsurf, INFO, "__riscosify failed"); free(path); return "application/riscos"; } @@ -88,7 +88,9 @@ const char *fetch_filetype(const char *unix_path) error = xosfile_read_stamped_no_path(path, &objtype, 0, 0, 0, 0, &file_type); if (error) { - LOG("xosfile_read_stamped_no_path failed: %s", error->errmess); + NSLOG(netsurf, INFO, + "xosfile_read_stamped_no_path failed: %s", + error->errmess); free(path); return "application/riscos"; } @@ -108,7 +110,10 @@ const char *fetch_filetype(const char *unix_path) slash+1, &temp); if (error) /* ignore error and leave file_type alone */ - LOG("xmimemaptranslate_extension_to_filetype: ""0x%x %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xmimemaptranslate_extension_to_filetype: ""0x%x %s", + error->errnum, + error->errmess); else file_type = temp; } @@ -126,7 +131,7 @@ const char *fetch_filetype(const char *unix_path) /* not in internal table, so ask MimeMap */ error = xmimemaptranslate_filetype_to_mime_type(file_type, type_buf); if (error) { - LOG("0x%x %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "0x%x %s", error->errnum, error->errmess); free(path); return "application/riscos"; } @@ -139,7 +144,7 @@ const char *fetch_filetype(const char *unix_path) free(path); - LOG("mime type '%s'", type_buf); + NSLOG(netsurf, INFO, "mime type '%s'", type_buf); return (const char *)type_buf; } @@ -155,14 +160,15 @@ char *fetch_mimetype(const char *ro_path) struct type_entry *t; if (!mime) { - LOG("Insufficient memory for calloc"); + NSLOG(netsurf, INFO, "Insufficient memory for calloc"); ro_warn_user("NoMemory", 0); return 0; } e = xosfile_read_no_path(ro_path, &objtype, &load, 0, 0, 0); if (e) { - LOG("xosfile_read_no_path: 0x%x: %s", e->errnum, e->errmess); + NSLOG(netsurf, INFO, "xosfile_read_no_path: 0x%x: %s", + e->errnum, e->errmess); free(mime); return 0; } @@ -188,7 +194,7 @@ char *fetch_mimetype(const char *ro_path) if (e) /* if we get an error here, simply ignore it and * leave filetype unchanged */ - LOG("0x%x %s", e->errnum, e->errmess); + NSLOG(netsurf, INFO, "0x%x %s", e->errnum, e->errmess); else filetype = load; } @@ -205,7 +211,10 @@ char *fetch_mimetype(const char *ro_path) /* not in internal table, so ask MimeMap */ e = xmimemaptranslate_filetype_to_mime_type(filetype, mime); if (e) { - LOG("xmimemaptranslate_filetype_to_mime_type: 0x%x: %s", e->errnum, e->errmess); + NSLOG(netsurf, INFO, + "xmimemaptranslate_filetype_to_mime_type: 0x%x: %s", + e->errnum, + e->errmess); free(mime); return 0; } @@ -322,7 +331,7 @@ bits ro_filetype_from_unix_path(const char *unix_path) bits file_type; if (!path) { - LOG("Insufficient memory for calloc"); + NSLOG(netsurf, INFO, "Insufficient memory for calloc"); ro_warn_user("NoMemory", 0); return osfile_TYPE_DATA; } @@ -330,7 +339,7 @@ bits ro_filetype_from_unix_path(const char *unix_path) /* convert path to RISC OS format and read file type */ r = __riscosify(unix_path, 0, __RISCOSIFY_NO_SUFFIX, path, len, 0); if (r == 0) { - LOG("__riscosify failed"); + NSLOG(netsurf, INFO, "__riscosify failed"); free(path); return osfile_TYPE_DATA; } @@ -338,7 +347,9 @@ bits ro_filetype_from_unix_path(const char *unix_path) error = xosfile_read_stamped_no_path(path, 0, 0, 0, 0, 0, &file_type); if (error) { - LOG("xosfile_read_stamped_no_path failed: %s", error->errmess); + NSLOG(netsurf, INFO, + "xosfile_read_stamped_no_path failed: %s", + error->errmess); free(path); return osfile_TYPE_DATA; } diff --git a/frontends/riscos/font.c b/frontends/riscos/font.c index 560afc785..8913efeeb 100644 --- a/frontends/riscos/font.c +++ b/frontends/riscos/font.c @@ -65,7 +65,8 @@ static void nsfont_check_fonts(void) ".FixFonts", 0); die("FontBadInst"); } else { - LOG("xfont_find_font: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xfont_find_font: 0x%x: %s", + error->errnum, error->errmess); snprintf(s, sizeof s, messages_get("FontError"), error->errmess); die(s); @@ -74,7 +75,8 @@ static void nsfont_check_fonts(void) error = xfont_lose_font(font); if (error) { - LOG("xfont_lose_font: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xfont_lose_font: 0x%x: %s", + error->errnum, error->errmess); snprintf(s, sizeof s, messages_get("FontError"), error->errmess); die(s); @@ -118,17 +120,20 @@ void nsfont_init(void) nsfont_check_fonts(); - LOG("Initialise RUfl"); + NSLOG(netsurf, INFO, "Initialise RUfl"); code = rufl_init(); if (code != rufl_OK) { if (code == rufl_FONT_MANAGER_ERROR) - LOG("rufl_init: rufl_FONT_MANAGER_ERROR: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess); + NSLOG(netsurf, INFO, + "rufl_init: rufl_FONT_MANAGER_ERROR: 0x%x: %s", + rufl_fm_error->errnum, + rufl_fm_error->errmess); else - LOG("rufl_init: 0x%x", code); + NSLOG(netsurf, INFO, "rufl_init: 0x%x", code); die("The Unicode font library could not be initialized. " "Please report this to the developers."); } - LOG("RUfl initialised"); + NSLOG(netsurf, INFO, "RUfl initialised"); if (rufl_family_list_entries == 0) die("No fonts could be found. At least one font must be " @@ -162,9 +167,10 @@ const char *nsfont_fallback_font(void) const char *fallback = "Homerton"; if (!nsfont_exists(fallback)) { - LOG("Homerton not found, dumping RUfl family list"); + NSLOG(netsurf, INFO, + "Homerton not found, dumping RUfl family list"); for (unsigned int i = 0; i < rufl_family_list_entries; i++) { - LOG("'%s'", rufl_family_list[i]); + NSLOG(netsurf, INFO, "'%s'", rufl_family_list[i]); } fallback = rufl_family_list[0]; } @@ -230,9 +236,12 @@ ro_font_width(const plot_font_style_t *fstyle, width); if (code != rufl_OK) { if (code == rufl_FONT_MANAGER_ERROR) - LOG("rufl_width: rufl_FONT_MANAGER_ERROR: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess); + NSLOG(netsurf, INFO, + "rufl_width: rufl_FONT_MANAGER_ERROR: 0x%x: %s", + rufl_fm_error->errnum, + rufl_fm_error->errmess); else - LOG("rufl_width: 0x%x", code); + NSLOG(netsurf, INFO, "rufl_width: 0x%x", code); /* ro_warn_user("MiscError", "font error"); */ *width = 0; return NSERROR_INVALID; @@ -276,9 +285,12 @@ ro_font_position(const plot_font_style_t *fstyle, x * 2, char_offset, actual_x); if (code != rufl_OK) { if (code == rufl_FONT_MANAGER_ERROR) - LOG("rufl_x_to_offset: rufl_FONT_MANAGER_ERROR: ""0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess); + NSLOG(netsurf, INFO, + "rufl_x_to_offset: rufl_FONT_MANAGER_ERROR: ""0x%x: %s", + rufl_fm_error->errnum, + rufl_fm_error->errmess); else - LOG("rufl_x_to_offset: 0x%x", code); + NSLOG(netsurf, INFO, "rufl_x_to_offset: 0x%x", code); /* ro_warn_user("MiscError", "font error"); */ *char_offset = 0; *actual_x = 0; @@ -335,10 +347,12 @@ ro_font_split(const plot_font_style_t *fstyle, x * 2, char_offset, actual_x); if (code != rufl_OK) { if (code == rufl_FONT_MANAGER_ERROR) { - LOG("rufl_split: rufl_FONT_MANAGER_ERROR: ""0x%x: %s", - rufl_fm_error->errnum, rufl_fm_error->errmess); + NSLOG(netsurf, INFO, + "rufl_split: rufl_FONT_MANAGER_ERROR: ""0x%x: %s", + rufl_fm_error->errnum, + rufl_fm_error->errmess); } else { - LOG("rufl_split: 0x%x", code); + NSLOG(netsurf, INFO, "rufl_split: 0x%x", code); } /* ro_warn_user("MiscError", "font error"); */ *char_offset = 0; @@ -370,10 +384,12 @@ ro_font_split(const plot_font_style_t *fstyle, actual_x); if (code != rufl_OK) { if (code == rufl_FONT_MANAGER_ERROR) { - LOG("rufl_width: rufl_FONT_MANAGER_ERROR: 0x%x: %s", - rufl_fm_error->errnum, rufl_fm_error->errmess); + NSLOG(netsurf, INFO, + "rufl_width: rufl_FONT_MANAGER_ERROR: 0x%x: %s", + rufl_fm_error->errnum, + rufl_fm_error->errmess); } else { - LOG("rufl_width: 0x%x", code); + NSLOG(netsurf, INFO, "rufl_width: 0x%x", code); } /* ro_warn_user("MiscError", "font error"); */ *char_offset = 0; @@ -416,9 +432,12 @@ bool nsfont_paint(const plot_font_style_t *fstyle, const char *string, string, length, x, y, flags); if (code != rufl_OK) { if (code == rufl_FONT_MANAGER_ERROR) { - LOG("rufl_paint: rufl_FONT_MANAGER_ERROR: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess); + NSLOG(netsurf, INFO, + "rufl_paint: rufl_FONT_MANAGER_ERROR: 0x%x: %s", + rufl_fm_error->errnum, + rufl_fm_error->errmess); } else { - LOG("rufl_paint: 0x%x", code); + NSLOG(netsurf, INFO, "rufl_paint: 0x%x", code); } } @@ -513,7 +532,8 @@ ro_gui_wimp_desktop_font(char *family, error = xwimpreadsysinfo_font(&font_handle, NULL); if (error) { - LOG("xwimpreadsysinfo_font: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimpreadsysinfo_font: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); goto failsafe; } @@ -525,20 +545,22 @@ ro_gui_wimp_desktop_font(char *family, error = xfont_read_identifier(font_handle, NULL, &used); if (error) { - LOG("xfont_read_identifier: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xfont_read_identifier: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("MiscError", error->errmess); goto failsafe; } if (family_size < (size_t) used + 1) { - LOG("desktop font name too long"); + NSLOG(netsurf, INFO, "desktop font name too long"); goto failsafe; } error = xfont_read_defn(font_handle, (byte *) family, &ptx, &pty, NULL, NULL, NULL, NULL); if (error) { - LOG("xfont_read_defn: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xfont_read_defn: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("MiscError", error->errmess); goto failsafe; } @@ -550,7 +572,7 @@ ro_gui_wimp_desktop_font(char *family, } } - LOG("desktop font \"%s\"", family); + NSLOG(netsurf, INFO, "desktop font \"%s\"", family); if (strcasestr(family, ".Medium")) style = rufl_WEIGHT_500; @@ -566,7 +588,8 @@ ro_gui_wimp_desktop_font(char *family, *psize = max(ptx, pty); *pstyle = style; - LOG("family \"%s\", size %i, style %i", family, *psize, style); + NSLOG(netsurf, INFO, "family \"%s\", size %i, style %i", family, + *psize, style); return; diff --git a/frontends/riscos/global_history.c b/frontends/riscos/global_history.c index d122a4d7f..7dfc58317 100644 --- a/frontends/riscos/global_history.c +++ b/frontends/riscos/global_history.c @@ -474,12 +474,12 @@ nserror ro_gui_global_history_present(void) res = ro_global_history_init(); if (res == NSERROR_OK) { - LOG("Presenting"); + NSLOG(netsurf, INFO, "Presenting"); ro_gui_dialog_open_top(global_history_window->core.wh, global_history_window->core.toolbar, 600, 800); } else { - LOG("Failed presenting code %d", res); + NSLOG(netsurf, INFO, "Failed presenting code %d", res); } return res; diff --git a/frontends/riscos/gui.c b/frontends/riscos/gui.c index 576e1ff12..51ea37066 100644 --- a/frontends/riscos/gui.c +++ b/frontends/riscos/gui.c @@ -307,7 +307,7 @@ static nserror set_defaults(struct nsoption_s *defaults) if (nsoption_charp(ca_bundle) == NULL || nsoption_charp(cookie_file) == NULL || nsoption_charp(cookie_jar) == NULL) { - LOG("Failed initialising default options"); + NSLOG(netsurf, INFO, "Failed initialising default options"); return NSERROR_BAD_PARAMETER; } @@ -430,7 +430,7 @@ static void ro_gui_signal(int sig) if (used) { int curr_slot; xwimp_slot_size(-1, -1, &curr_slot, 0, 0); - LOG("saving WimpSlot, size 0x%x", curr_slot); + NSLOG(netsurf, INFO, "saving WimpSlot, size 0x%x", curr_slot); xosfile_save("$.NetSurf_Slot", 0x8000, 0, (byte *) 0x8000, (byte *) 0x8000 + curr_slot); @@ -440,7 +440,11 @@ static void ro_gui_signal(int sig) byte *base_address; xosdynamicarea_read(__dynamic_num, &size, &base_address, 0, 0, 0, 0, 0); - LOG("saving DA %i, base %p, size 0x%x", __dynamic_num, base_address, size); + NSLOG(netsurf, INFO, + "saving DA %i, base %p, size 0x%x", + __dynamic_num, + base_address, + size); xosfile_save("$.NetSurf_DA", (bits) base_address, 0, base_address, @@ -452,7 +456,7 @@ static void ro_gui_signal(int sig) * defines a coredump directory. */ const _kernel_oserror *err = __unixlib_write_coredump (NULL); if (err != NULL) - LOG("Coredump failed: %s", err->errmess); + NSLOG(netsurf, INFO, "Coredump failed: %s", err->errmess); #endif xhourglass_colours(old_sand, old_glass, 0, 0); @@ -536,7 +540,8 @@ static char *ro_gui_uri_file_parse(const char *file_name, char **uri_title) *uri_title = NULL; fp = fopen(file_name, "rb"); if (!fp) { - LOG("fopen(\"%s\", \"rb\"): %i: %s", file_name, errno, strerror(errno)); + NSLOG(netsurf, INFO, "fopen(\"%s\", \"rb\"): %i: %s", + file_name, errno, strerror(errno)); ro_warn_user("LoadError", strerror(errno)); return 0; } @@ -597,14 +602,16 @@ static char *ro_gui_url_file_parse(const char *file_name) fp = fopen(file_name, "r"); if (!fp) { - LOG("fopen(\"%s\", \"r\"): %i: %s", file_name, errno, strerror(errno)); + NSLOG(netsurf, INFO, "fopen(\"%s\", \"r\"): %i: %s", + file_name, errno, strerror(errno)); ro_warn_user("LoadError", strerror(errno)); return 0; } if (!fgets(line, sizeof line, fp)) { if (ferror(fp)) { - LOG("fgets: %i: %s", errno, strerror(errno)); + NSLOG(netsurf, INFO, "fgets: %i: %s", errno, + strerror(errno)); ro_warn_user("LoadError", strerror(errno)); } else ro_warn_user("LoadError", messages_get("EmptyError")); @@ -641,7 +648,8 @@ static char *ro_gui_ieurl_file_parse(const char *file_name) fp = fopen(file_name, "r"); if (!fp) { - LOG("fopen(\"%s\", \"r\"): %i: %s", file_name, errno, strerror(errno)); + NSLOG(netsurf, INFO, "fopen(\"%s\", \"r\"): %i: %s", + file_name, errno, strerror(errno)); ro_warn_user("LoadError", strerror(errno)); return 0; } @@ -660,7 +668,7 @@ static char *ro_gui_ieurl_file_parse(const char *file_name) } } if (ferror(fp)) { - LOG("fgets: %i: %s", errno, strerror(errno)); + NSLOG(netsurf, INFO, "fgets: %i: %s", errno, strerror(errno)); ro_warn_user("LoadError", strerror(errno)); fclose(fp); return 0; @@ -732,7 +740,8 @@ static void ro_msg_dataopen(wimp_message *message) message->your_ref = message->my_ref; oserror = xwimp_send_message(wimp_USER_MESSAGE, message, message->sender); if (oserror) { - LOG("xwimp_send_message: 0x%x: %s", oserror->errnum, oserror->errmess); + NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s", + oserror->errnum, oserror->errmess); ro_warn_user("WimpError", oserror->errmess); return; } @@ -855,7 +864,8 @@ static void ro_msg_dataload(wimp_message *message) oserror = xwimp_send_message(wimp_USER_MESSAGE, message, message->sender); if (oserror) { - LOG("xwimp_send_message: 0x%x: %s", oserror->errnum, oserror->errmess); + NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s", + oserror->errnum, oserror->errmess); ro_warn_user("WimpError", oserror->errmess); return; } @@ -925,7 +935,10 @@ static void ro_msg_datasave(wimp_message *message) error = xwimp_send_message(wimp_USER_MESSAGE, (wimp_message*)dataxfer, message->sender); if (error) { - LOG("xwimp_send_message: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_send_message: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -977,7 +990,8 @@ static void ro_msg_prequit(wimp_message *message) error = xwimp_send_message(wimp_USER_MESSAGE_ACKNOWLEDGE, message, message->sender); if (error) { - LOG("xwimp_send_message: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x:%s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -1003,7 +1017,8 @@ static void ro_msg_save_desktop(wimp_message *message) } if (error) { - LOG("xosgbpb_writew/xos_bputw: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosgbpb_writew/xos_bputw: 0x%x:%s", + error->errnum, error->errmess); ro_warn_user("SaveError", error->errmess); /* we must cancel the save by acknowledging the message */ @@ -1011,7 +1026,8 @@ static void ro_msg_save_desktop(wimp_message *message) error = xwimp_send_message(wimp_USER_MESSAGE_ACKNOWLEDGE, message, message->sender); if (error) { - LOG("xwimp_send_message: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x:%s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -1062,7 +1078,8 @@ static void ro_gui_get_screen_properties(void) error = xos_read_vdu_variables(PTR_OS_VDU_VAR_LIST(&vars), vals); if (error) { - LOG("xos_read_vdu_variables: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xos_read_vdu_variables: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("MiscError", error->errmess); return; } @@ -1079,9 +1096,9 @@ static void ro_gui_check_resolvers(void) char *resolvers; resolvers = getenv("Inet$Resolvers"); if (resolvers && resolvers[0]) { - LOG("Inet$Resolvers '%s'", resolvers); + NSLOG(netsurf, INFO, "Inet$Resolvers '%s'", resolvers); } else { - LOG("Inet$Resolvers not set or empty"); + NSLOG(netsurf, INFO, "Inet$Resolvers not set or empty"); ro_warn_user("Resolvers", 0); } } @@ -1196,7 +1213,8 @@ static nserror gui_init(int argc, char** argv) PTR_WIMP_MESSAGE_LIST(&task_messages), 0, &task_handle); if (error) { - LOG("xwimp_initialise: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_initialise: 0x%x: %s", + error->errnum, error->errmess); die(error->errmess); } /* Register message handlers */ @@ -1234,7 +1252,8 @@ static nserror gui_init(int argc, char** argv) die("Failed to locate Templates resource."); error = xwimp_open_template(path); if (error) { - LOG("xwimp_open_template failed: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_open_template failed: 0x%x: %s", + error->errnum, error->errmess); die(error->errmess); } @@ -1275,7 +1294,7 @@ static nserror gui_init(int argc, char** argv) /* parse command-line arguments */ if (argc == 2) { - LOG("parameters: '%s'", argv[1]); + NSLOG(netsurf, INFO, "parameters: '%s'", argv[1]); /* this is needed for launching URI files */ if (strcasecmp(argv[1], "-nowin") == 0) { return NSERROR_OK; @@ -1283,7 +1302,8 @@ static nserror gui_init(int argc, char** argv) ret = nsurl_create(NETSURF_HOMEPAGE, &url); } else if (argc == 3) { - LOG("parameters: '%s' '%s'", argv[1], argv[2]); + NSLOG(netsurf, INFO, "parameters: '%s' '%s'", argv[1], + argv[2]); open_window = true; /* HTML files */ @@ -1294,7 +1314,7 @@ static nserror gui_init(int argc, char** argv) else if (strcasecmp(argv[1], "-urlf") == 0) { char *urlf = ro_gui_url_file_parse(argv[2]); if (!urlf) { - LOG("allocation failed"); + NSLOG(netsurf, INFO, "allocation failed"); die("Insufficient memory for URL"); } ret = nsurl_create(urlf, &url); @@ -1306,7 +1326,8 @@ static nserror gui_init(int argc, char** argv) } /* Unknown => exit here. */ else { - LOG("Unknown parameters: '%s' '%s'", argv[1], argv[2]); + NSLOG(netsurf, INFO, "Unknown parameters: '%s' '%s'", + argv[1], argv[2]); return NSERROR_BAD_PARAMETER; } } @@ -1354,7 +1375,8 @@ const char *ro_gui_default_language(void) /* choose a language from the configured country number */ error = xosbyte_read(osbyte_VAR_COUNTRY_NUMBER, &country); if (error) { - LOG("xosbyte_read failed: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosbyte_read failed: 0x%x: %s", + error->errnum, error->errmess); country = 1; } switch (country) { @@ -1405,7 +1427,10 @@ static nserror ro_path_to_nsurl(const char *path, struct nsurl **url_out) /* calculate the canonical risc os path */ error = xosfscontrol_canonicalise_path(path, 0, 0, 0, 0, &spare); if (error) { - LOG("xosfscontrol_canonicalise_path failed: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosfscontrol_canonicalise_path failed: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("PathToURL", error->errmess); return NSERROR_NOT_FOUND; } @@ -1418,7 +1443,10 @@ static nserror ro_path_to_nsurl(const char *path, struct nsurl **url_out) error = xosfscontrol_canonicalise_path(path, canonical_path, 0, 0, 1 - spare, 0); if (error) { - LOG("xosfscontrol_canonicalise_path failed: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosfscontrol_canonicalise_path failed: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("PathToURL", error->errmess); free(canonical_path); return NSERROR_NOT_FOUND; @@ -1428,7 +1456,7 @@ static nserror ro_path_to_nsurl(const char *path, struct nsurl **url_out) unix_path = __unixify(canonical_path, __RISCOSIFY_NO_REVERSE_SUFFIX, NULL, 0, 0); if (unix_path == NULL) { - LOG("__unixify failed: %s", canonical_path); + NSLOG(netsurf, INFO, "__unixify failed: %s", canonical_path); free(canonical_path); return NSERROR_BAD_PARAMETER; } @@ -1446,7 +1474,7 @@ static nserror ro_path_to_nsurl(const char *path, struct nsurl **url_out) urllen = strlen(escaped_path) + FILE_SCHEME_PREFIX_LEN + 1; url = malloc(urllen); if (url == NULL) { - LOG("Unable to allocate url"); + NSLOG(netsurf, INFO, "Unable to allocate url"); free(escaped_path); return NSERROR_NOMEM; } @@ -1596,7 +1624,8 @@ static void ro_gui_keypress_cb(void *pw) if (ro_gui_wimp_event_keypress(key) == false) { os_error *error = xwimp_process_key(key->c); if (error) { - LOG("xwimp_process_key: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_process_key: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -1633,7 +1662,8 @@ static void ro_gui_keypress(wimp_key *key) } else if (ro_gui_wimp_event_keypress(key) == false) { os_error *error = xwimp_process_key(key->c); if (error) { - LOG("xwimp_process_key: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_process_key: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -1905,7 +1935,8 @@ void ro_gui_open_window_request(wimp_open *open) error = xwimp_open_window(open); if (error) { - LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -1926,7 +1957,8 @@ static void ro_gui_view_source_bounce(wimp_message *message) sprintf(command, "@RunType_FFF %s", filename); error = xwimp_start_task(command, 0); if (error) { - LOG("xwimp_start_task failed: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_start_task failed: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -1989,7 +2021,7 @@ void ro_gui_view_source(struct hlcache_handle *c) r = __riscosify(full_name, 0, __RISCOSIFY_NO_SUFFIX, message.file_name, 212, 0); if (r == 0) { - LOG("__riscosify failed"); + NSLOG(netsurf, INFO, "__riscosify failed"); return; } message.file_name[211] = '\0'; @@ -1999,7 +2031,10 @@ void ro_gui_view_source(struct hlcache_handle *c) (byte *) source_data, (byte *) source_data + source_size); if (error) { - LOG("xosfile_save_stamped failed: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosfile_save_stamped failed: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("MiscError", error->errmess); return; } @@ -2069,7 +2104,7 @@ static void ro_gui_choose_language(void) */ nserror ro_warn_user(const char *warning, const char *detail) { - LOG("%s %s", warning, detail); + NSLOG(netsurf, INFO, "%s %s", warning, detail); if (dialog_warning) { char warn_buffer[300]; @@ -2113,7 +2148,7 @@ void die(const char * const error) { os_error warn_error; - LOG("%s", error); + NSLOG(netsurf, INFO, "%s", error); warn_error.errnum = 1; /* \todo: reasonable ? */ strncpy(warn_error.errmess, messages_get(error), @@ -2350,7 +2385,7 @@ void ro_gui_dump_browser_window(struct browser_window *bw) /* open file for dump */ FILE *stream = fopen(".WWW.NetSurf.dump", "w"); if (!stream) { - LOG("fopen: errno %i", errno); + NSLOG(netsurf, INFO, "fopen: errno %i", errno); ro_warn_user("SaveError", strerror(errno)); return; } @@ -2363,7 +2398,8 @@ void ro_gui_dump_browser_window(struct browser_window *bw) error = xwimp_start_task("Filer_Run .WWW.NetSurf.dump", 0); if (error) { - LOG("xwimp_start_task failed: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_start_task failed: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -2403,7 +2439,7 @@ static char *get_cachepath(void) cachedir = getenv("Cache$Dir"); if ((cachedir == NULL) || (cachedir[0] == 0)) { - LOG("cachedir was null"); + NSLOG(netsurf, INFO, "cachedir was null"); return NULL; } ret = netsurf_mkpath(&cachepath, NULL, 2, cachedir, "NetSurf"); diff --git a/frontends/riscos/gui/button_bar.c b/frontends/riscos/gui/button_bar.c index 6ecd7cffa..34ae39ae5 100644 --- a/frontends/riscos/gui/button_bar.c +++ b/frontends/riscos/gui/button_bar.c @@ -138,7 +138,7 @@ struct button_bar *ro_gui_button_bar_create(struct theme_descriptor *theme, button_bar = malloc(sizeof(struct button_bar)); if (button_bar == NULL) { - LOG("No memory for malloc()"); + NSLOG(netsurf, INFO, "No memory for malloc()"); return NULL; } @@ -538,7 +538,10 @@ bool ro_gui_button_bar_icon_update(struct button_bar *button_bar) error = xwimp_create_icon(&icon, &button->icon); if (error) { - LOG("xwimp_create_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_create_icon: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); button->icon = -1; return false; @@ -548,7 +551,10 @@ bool ro_gui_button_bar_icon_update(struct button_bar *button_bar) error = xwimp_delete_icon(button_bar->window, button->icon); if (error != NULL) { - LOG("xwimp_delete_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_delete_icon: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -598,7 +604,10 @@ bool ro_gui_button_bar_icon_resize(struct button_bar *button_bar) button->y_pos + button->y_size); if (error != NULL) { - LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_resize_icon: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); button->icon = -1; return false; @@ -769,7 +778,10 @@ bool ro_gui_button_bar_click(struct button_bar *button_bar, button_bar->sprites, sprite, &box, NULL); if (error) - LOG("xdragasprite_start: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xdragasprite_start: 0x%x: %s", + error->errnum, + error->errmess); ro_mouse_drag_start(ro_gui_button_bar_drag_end, NULL, NULL, NULL); @@ -870,7 +882,8 @@ void ro_gui_button_bar_drag_end(wimp_dragged *drag, void *data) error = xwimp_get_pointer_info(&pointer); if (error) { - LOG("xwimp_get_pointer_info: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -880,7 +893,8 @@ void ro_gui_button_bar_drag_end(wimp_dragged *drag, void *data) state.w = drag_start->window; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -1068,7 +1082,7 @@ char *ro_gui_button_bar_get_config(struct button_bar *button_bar) config = malloc(size); if (config == NULL) { - LOG("No memory for malloc()"); + NSLOG(netsurf, INFO, "No memory for malloc()"); ro_warn_user("NoMemory", 0); return NULL; } diff --git a/frontends/riscos/gui/progress_bar.c b/frontends/riscos/gui/progress_bar.c index c47c2af7d..06d89dbf4 100644 --- a/frontends/riscos/gui/progress_bar.c +++ b/frontends/riscos/gui/progress_bar.c @@ -137,7 +137,8 @@ struct progress_bar *ro_gui_progress_bar_create(void) error = xwimp_create_window((wimp_window *)&progress_bar_definition, &pb->w); if (error) { - LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s", + error->errnum, error->errmess); free(pb); return NULL; } @@ -165,7 +166,8 @@ void ro_gui_progress_bar_destroy(struct progress_bar *pb) ro_gui_wimp_event_finalise(pb->w); error = xwimp_delete_window(pb->w); if (error) { - LOG("xwimp_delete_window: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x:%s", + error->errnum, error->errmess); } free(pb); @@ -327,7 +329,8 @@ void ro_gui_progress_bar_update(struct progress_bar *pb, int width, int height) redraw.box.x0 = cur.x1; error = xwimp_update_window(&redraw, &more); if (error) { - LOG("Error getting update window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "Error getting update window: 0x%x: %s", + error->errnum, error->errmess); return; } if (more) @@ -351,7 +354,8 @@ void ro_gui_progress_bar_redraw(wimp_draw *redraw) error = xwimp_redraw_window(redraw, &more); if (error) { - LOG("xwimp_redraw_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_redraw_window: 0x%x: %s", + error->errnum, error->errmess); return; } if (more) @@ -385,7 +389,8 @@ void ro_gui_progress_bar_animate(void *p) redraw.box = pb->visible; error = xwimp_update_window(&redraw, &more); if (error != NULL) { - LOG("Error getting update window: '%s'", error->errmess); + NSLOG(netsurf, INFO, "Error getting update window: '%s'", + error->errmess); return; } if (more) @@ -533,7 +538,8 @@ void ro_gui_progress_bar_redraw_window(wimp_draw *redraw, } error = xwimp_get_rectangle(redraw, &more); if (error) { - LOG("xwimp_get_rectangle: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_rectangle: 0x%x: %s", + error->errnum, error->errmess); return; } } diff --git a/frontends/riscos/gui/status_bar.c b/frontends/riscos/gui/status_bar.c index bcaf3baf9..dd1aab639 100644 --- a/frontends/riscos/gui/status_bar.c +++ b/frontends/riscos/gui/status_bar.c @@ -131,7 +131,8 @@ struct status_bar *ro_gui_status_bar_create(wimp_w parent, unsigned int width) error = xwimp_create_window((wimp_window *)&status_bar_definition, &sb->w); if (error) { - LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s", + error->errnum, error->errmess); free(sb); return NULL; } @@ -165,7 +166,8 @@ void ro_gui_status_bar_destroy(struct status_bar *sb) ro_gui_wimp_event_finalise(sb->w); error = xwimp_delete_window(sb->w); if (error) { - LOG("xwimp_delete_window: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x:%s", + error->errnum, error->errmess); } ro_gui_progress_bar_destroy(sb->pb); @@ -222,7 +224,8 @@ void ro_gui_status_bar_set_visible(struct status_bar *sb, bool visible) } else { os_error *error = xwimp_close_window(sb->w); if (error) { - LOG("xwimp_close_window: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x:%s", + error->errnum, error->errmess); } } } @@ -275,14 +278,15 @@ void ro_gui_status_bar_set_progress_range(struct status_bar *sb, old_range = ro_gui_progress_bar_get_range(sb->pb); ro_gui_progress_bar_set_range(sb->pb, range); - LOG("Ranges are %i vs %i", old_range, range); + NSLOG(netsurf, INFO, "Ranges are %i vs %i", old_range, range); if ((old_range == 0) && (range != 0)) { ro_gui_status_position_progress_bar(sb); } else if ((old_range != 0) && (range == 0)) { os_error *error = xwimp_close_window( ro_gui_progress_bar_get_window(sb->pb)); if (error) { - LOG("xwimp_close_window: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x:%s", + error->errnum, error->errmess); } } } @@ -354,7 +358,8 @@ void ro_gui_status_bar_resize(struct status_bar *sb) state.w = sb->parent; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); return; } window_width = state.visible.x1 - state.visible.x0; @@ -377,7 +382,8 @@ void ro_gui_status_bar_resize(struct status_bar *sb) extent.y1 = status_height - 4; error = xwimp_set_extent(sb->w, &extent); if (error) { - LOG("xwimp_set_extent: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s", + error->errnum, error->errmess); return; } @@ -405,7 +411,10 @@ void ro_gui_status_bar_resize(struct status_bar *sb) wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT << wimp_CHILD_TS_EDGE_SHIFT); if (error) { - LOG("xwimp_open_window_nested: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_open_window_nested: 0x%x: %s", + error->errnum, + error->errmess); return; } ro_gui_status_position_progress_bar(sb); @@ -413,7 +422,8 @@ void ro_gui_status_bar_resize(struct status_bar *sb) status_width - WIDGET_WIDTH, 0, status_width, status_height - 4); if (error) { - LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_resize_icon: 0x%x: %s", + error->errnum, error->errmess); return; } @@ -454,7 +464,8 @@ void ro_gui_status_bar_redraw(wimp_draw *redraw) /* redraw the window */ error = xwimp_redraw_window(redraw, &more); if (error) { - LOG("xwimp_redraw_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_redraw_window: 0x%x: %s", + error->errnum, error->errmess); return; } while (more) { @@ -463,7 +474,10 @@ void ro_gui_status_bar_redraw(wimp_draw *redraw) error = xcolourtrans_set_font_colours(font_CURRENT, 0xeeeeee00, 0x00000000, 14, 0, 0, 0); if (error) { - LOG("xcolourtrans_set_font_colours: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xcolourtrans_set_font_colours: 0x%x: %s", + error->errnum, + error->errmess); return; } code = rufl_paint(ro_gui_desktop_font_family, @@ -474,10 +488,13 @@ void ro_gui_status_bar_redraw(wimp_draw *redraw) rufl_BLEND_FONT); if (code != rufl_OK) { if (code == rufl_FONT_MANAGER_ERROR) - LOG("rufl_FONT_MANAGER_ERROR: 0x%x: %s", - rufl_fm_error->errnum, rufl_fm_error->errmess); + NSLOG(netsurf, INFO, + "rufl_FONT_MANAGER_ERROR: 0x%x: %s", + rufl_fm_error->errnum, + rufl_fm_error->errmess); else - LOG("rufl_paint: 0x%x", code); + NSLOG(netsurf, INFO, + "rufl_paint: 0x%x", code); } } @@ -493,7 +510,8 @@ void ro_gui_status_bar_redraw(wimp_draw *redraw) error = xwimp_get_rectangle(redraw, &more); if (error) { - LOG("xwimp_get_rectangle: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_rectangle: 0x%x: %s", + error->errnum, error->errmess); return; } } @@ -532,7 +550,10 @@ bool ro_gui_status_bar_click(wimp_pointer *pointer) drag.initial.y1 = pointer->pos.y; error = xwimp_drag_box(&drag); if (error) { - LOG("xwimp_drag_box: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_drag_box: 0x%x: %s", + error->errnum, + error->errmess); } break; } @@ -557,7 +578,8 @@ void ro_gui_status_bar_open(wimp_open *open) state.w = sb->parent; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); return; } window_width = state.visible.x1 - state.visible.x0; @@ -596,7 +618,8 @@ void ro_gui_status_position_progress_bar(struct status_bar *sb) state.w = sb->w; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); return; } @@ -626,7 +649,8 @@ void ro_gui_status_position_progress_bar(struct status_bar *sb) wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT << wimp_CHILD_TS_EDGE_SHIFT); if (error) { - LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s", + error->errnum, error->errmess); } /* update the progress bar display on non-standard width */ diff --git a/frontends/riscos/gui/throbber.c b/frontends/riscos/gui/throbber.c index a326f806c..f3b79a68e 100644 --- a/frontends/riscos/gui/throbber.c +++ b/frontends/riscos/gui/throbber.c @@ -81,7 +81,7 @@ struct throbber *ro_gui_throbber_create(struct theme_descriptor *theme) throbber = malloc(sizeof(struct throbber)); if (throbber == NULL) { - LOG("No memory for malloc()"); + NSLOG(netsurf, INFO, "No memory for malloc()"); return NULL; } @@ -248,7 +248,8 @@ bool ro_gui_throbber_icon_update(struct throbber *throbber) error = xwimp_create_icon(&icon, &throbber->icon); if (error != NULL) { - LOG("xwimp_create_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_icon: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); throbber->icon = -1; return false; @@ -259,7 +260,8 @@ bool ro_gui_throbber_icon_update(struct throbber *throbber) } else if (throbber->hidden && throbber->icon != -1) { error = xwimp_delete_icon(throbber->window, throbber->icon); if (error != NULL) { - LOG("xwimp_delete_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_delete_icon: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -295,7 +297,8 @@ bool ro_gui_throbber_icon_resize(struct throbber *throbber) throbber->extent.x0, throbber->extent.y0, throbber->extent.x1, throbber->extent.y1); if (error != NULL) { - LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_resize_icon: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); throbber->icon = -1; return false; diff --git a/frontends/riscos/gui/url_bar.c b/frontends/riscos/gui/url_bar.c index a5ec3f8c6..ee5c689df 100644 --- a/frontends/riscos/gui/url_bar.c +++ b/frontends/riscos/gui/url_bar.c @@ -140,7 +140,7 @@ struct url_bar *ro_gui_url_bar_create(struct theme_descriptor *theme) url_bar = malloc(sizeof(struct url_bar)); if (url_bar == NULL) { - LOG("No memory for malloc()"); + NSLOG(netsurf, INFO, "No memory for malloc()"); return NULL; } @@ -240,7 +240,8 @@ static bool ro_gui_url_bar_icon_resize(struct url_bar *url_bar, bool full) url_bar->container_icon, x0, y0, x1, y1); if (error != NULL) { - LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_resize_icon: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); url_bar->container_icon = -1; return false; @@ -260,7 +261,8 @@ static bool ro_gui_url_bar_icon_resize(struct url_bar *url_bar, bool full) url_bar->suggest_icon, x0, y0, x1, y1); if (error != NULL) { - LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_resize_icon: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); url_bar->suggest_icon = -1; return false; @@ -281,7 +283,8 @@ static bool ro_gui_url_bar_icon_resize(struct url_bar *url_bar, bool full) url_bar->text_icon, x0, y0, x1, y1); if (error != NULL) { - LOG("xwimp_resize_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_resize_icon: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); url_bar->text_icon = -1; return false; @@ -362,7 +365,8 @@ static bool ro_gui_url_bar_icon_update(struct url_bar *url_bar) wimp_ICON_BUTTON_TYPE_SHIFT); error = xwimp_create_icon(&icon, &url_bar->container_icon); if (error != NULL) { - LOG("xwimp_create_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_icon: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); url_bar->container_icon = -1; return false; @@ -373,7 +377,8 @@ static bool ro_gui_url_bar_icon_update(struct url_bar *url_bar) error = xwimp_delete_icon(url_bar->window, url_bar->container_icon); if (error != NULL) { - LOG("xwimp_delete_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_delete_icon: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -399,7 +404,8 @@ static bool ro_gui_url_bar_icon_update(struct url_bar *url_bar) wimp_ICON_BUTTON_TYPE_SHIFT); error = xwimp_create_icon(&icon, &url_bar->text_icon); if (error) { - LOG("xwimp_create_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_icon: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); url_bar->text_icon = -1; return false; @@ -410,7 +416,8 @@ static bool ro_gui_url_bar_icon_update(struct url_bar *url_bar) error = xwimp_delete_icon(url_bar->window, url_bar->text_icon); if (error != NULL) { - LOG("xwimp_delete_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_delete_icon: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -430,7 +437,8 @@ static bool ro_gui_url_bar_icon_update(struct url_bar *url_bar) wimp_ICON_BUTTON_TYPE_SHIFT); error = xwimp_create_icon(&icon, &url_bar->suggest_icon); if (error) { - LOG("xwimp_create_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_icon: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -450,7 +458,8 @@ static bool ro_gui_url_bar_icon_update(struct url_bar *url_bar) error = xwimp_delete_icon(url_bar->window, url_bar->suggest_icon); if (error != NULL) { - LOG("xwimp_delete_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_delete_icon: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -940,7 +949,8 @@ bool ro_gui_url_bar_take_caret(struct url_bar *url_bar) error = xwimp_set_caret_position(url_bar->window, url_bar->text_icon, -1, -1, -1, 0); if (error) { - LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_caret_position: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; @@ -977,7 +987,7 @@ void ro_gui_url_bar_set_url(struct url_bar *url_bar, const char *url, if (err != NSERROR_OK) { /* A bad encoding should never happen, so assert this */ assert(err != NSERROR_BAD_ENCODING); - LOG("utf8_to_enc failed"); + NSLOG(netsurf, INFO, "utf8_to_enc failed"); /* Paranoia */ local_text = NULL; } @@ -993,7 +1003,8 @@ void ro_gui_url_bar_set_url(struct url_bar *url_bar, const char *url, if (strlen(local_url) >= url_bar->text_size) { url_bar->text_buffer[0] = '\0'; ro_warn_user("LongURL", NULL); - LOG("Long URL (%zu chars): %s", strlen(url), url); + NSLOG(netsurf, INFO, "Long URL (%zu chars): %s", strlen(url), + url); } else { strncpy(url_bar->text_buffer, local_url, url_bar->text_size - 1); @@ -1021,7 +1032,8 @@ void ro_gui_url_bar_set_url(struct url_bar *url_bar, const char *url, error = xwimp_get_caret_position(&caret); if (error) { - LOG("xwimp_get_caret_position: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_caret_position: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -1034,7 +1046,10 @@ void ro_gui_url_bar_set_url(struct url_bar *url_bar, const char *url, error = xwimp_set_caret_position(url_bar->window, url_bar->text_icon, 0, 0, -1, strlen(set_url)); if (error) { - LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_set_caret_position: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -1123,7 +1138,8 @@ bool ro_gui_url_bar_get_url_extent(struct url_bar *url_bar, os_box *extent) state.i = url_bar->container_icon; error = xwimp_get_icon_state(&state); if (error) { - LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } diff --git a/frontends/riscos/help.c b/frontends/riscos/help.c index b6871c5eb..952b3f2d1 100644 --- a/frontends/riscos/help.c +++ b/frontends/riscos/help.c @@ -166,7 +166,8 @@ void ro_gui_interactive_help_request(wimp_message *message) error = xwimp_get_menu_state(wimp_GIVEN_WINDOW_AND_ICON, &menu_tree, window, icon); if (error) { - LOG("xwimp_get_menu_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_menu_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -269,7 +270,8 @@ static void ro_gui_interactive_help_broadcast(wimp_message *message, error = xwimp_send_message(wimp_USER_MESSAGE, (wimp_message *)reply, reply->sender); if (error) { - LOG("xwimp_send_message: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -297,7 +299,10 @@ bool ro_gui_interactive_help_available(void) error = xtaskmanager_enumerate_tasks(context, &task, sizeof(taskmanager_task), &context, 0); if (error) { - LOG("xtaskmanager_enumerate_tasks: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xtaskmanager_enumerate_tasks: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("MiscError", error->errmess); } @@ -334,7 +339,8 @@ void ro_gui_interactive_help_start(void) if ((help_start) && (help_start[0])) { error = xwimp_start_task("", &task); if (error) { - LOG("xwimp_start_tast: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_start_tast: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -344,7 +350,8 @@ void ro_gui_interactive_help_start(void) if (!task) { error = xwimp_start_task("Resources:$.Apps.!Help", &task); if (error) { - LOG("xwimp_start_tast: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_start_tast: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -354,7 +361,10 @@ void ro_gui_interactive_help_start(void) if (task) { error = xos_read_monotonic_time(&help_time); if (error) { - LOG("xwimp_read_monotonic_time: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_read_monotonic_time: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } } diff --git a/frontends/riscos/hotlist.c b/frontends/riscos/hotlist.c index b055d1bec..b0ed1e2f4 100644 --- a/frontends/riscos/hotlist.c +++ b/frontends/riscos/hotlist.c @@ -548,19 +548,20 @@ nserror ro_gui_hotlist_present(void) return NSERROR_OK; } - LOG("xos_cli: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xos_cli: 0x%x: %s", error->errnum, + error->errmess); ro_warn_user("Failed to launch external hotlist: %s", error->errmess); } res = ro_hotlist_init(); if (res == NSERROR_OK) { - LOG("Presenting"); + NSLOG(netsurf, INFO, "Presenting"); ro_gui_dialog_open_top(hotlist_window->core.wh, hotlist_window->core.toolbar, 600, 800); } else { - LOG("Failed presenting code %d", res); + NSLOG(netsurf, INFO, "Failed presenting code %d", res); } return res; diff --git a/frontends/riscos/iconbar.c b/frontends/riscos/iconbar.c index 3430ed2f0..23f97258b 100644 --- a/frontends/riscos/iconbar.c +++ b/frontends/riscos/iconbar.c @@ -95,7 +95,8 @@ void ro_gui_iconbar_initialise(void) { "!netsurf" } } }; error = xwimp_create_icon(&icon, 0); if (error) { - LOG("xwimp_create_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_icon: 0x%x: %s", + error->errnum, error->errmess); die(error->errmess); } @@ -238,7 +239,8 @@ bool ro_gui_iconbar_menu_select(wimp_w w, wimp_i i, wimp_menu *menu, return true; case APPLICATION_QUIT: if (ro_gui_prequit()) { - LOG("QUIT in response to user request"); + NSLOG(netsurf, INFO, + "QUIT in response to user request"); riscos_done = true; } return true; diff --git a/frontends/riscos/image.c b/frontends/riscos/image.c index acbe62d98..30cb30096 100644 --- a/frontends/riscos/image.c +++ b/frontends/riscos/image.c @@ -142,7 +142,8 @@ bool image_redraw_tinct(osspriteop_id header, int x, int y, } if (error) { - LOG("xtinct_plotscaled%s: 0x%x: %s", (alpha ? "alpha" : ""), error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xtinct_plotscaled%s: 0x%x: %s", + (alpha ? "alpha" : ""), error->errnum, error->errmess); return false; } @@ -176,13 +177,16 @@ bool image_redraw_os(osspriteop_id header, int x, int y, int req_width, colourtrans_CURRENT_PALETTE, 0, colourtrans_GIVEN_SPRITE, 0, 0, &size); if (error) { - LOG("xcolourtrans_generate_table_for_sprite: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xcolourtrans_generate_table_for_sprite: 0x%x: %s", + error->errnum, + error->errmess); return false; } table = calloc(size, sizeof(char)); if (!table) { - LOG("malloc failed"); + NSLOG(netsurf, INFO, "malloc failed"); ro_warn_user("NoMemory", 0); return false; } @@ -193,7 +197,10 @@ bool image_redraw_os(osspriteop_id header, int x, int y, int req_width, colourtrans_CURRENT_PALETTE, table, colourtrans_GIVEN_SPRITE, 0, 0, 0); if (error) { - LOG("xcolourtrans_generate_table_for_sprite: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xcolourtrans_generate_table_for_sprite: 0x%x: %s", + error->errnum, + error->errmess); free(table); return false; } @@ -208,7 +215,10 @@ bool image_redraw_os(osspriteop_id header, int x, int y, int req_width, x, (int)(y - req_height), 8, &f, table); if (error) { - LOG("xosspriteop_put_sprite_scaled: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosspriteop_put_sprite_scaled: 0x%x: %s", + error->errnum, + error->errmess); free(table); return false; } diff --git a/frontends/riscos/local_history.c b/frontends/riscos/local_history.c index f9f1f2e01..bbe6a1d12 100644 --- a/frontends/riscos/local_history.c +++ b/frontends/riscos/local_history.c @@ -154,8 +154,8 @@ ro_local_history_tooltip(struct ro_local_history_window *lhw, int x, int y) /* not over a tree entry => close tooltip window. */ error = xwimp_close_window(dialog_tooltip); if (error) { - LOG("xwimp_close_window: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return NSERROR_NOMEM; } @@ -167,8 +167,8 @@ ro_local_history_tooltip(struct ro_local_history_window *lhw, int x, int y) nsurl_length(url) > 256 ? 256 : nsurl_length(url), &width); if (error) { - LOG("xwimptextop_string_width: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimptextop_string_width: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); nsurl_unref(url); return NSERROR_NOMEM; @@ -182,8 +182,8 @@ ro_local_history_tooltip(struct ro_local_history_window *lhw, int x, int y) ic.i = 0; error = xwimp_get_icon_state(&ic); if (error) { - LOG("xwimp_get_icon_state: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return NSERROR_NOMEM; } @@ -191,8 +191,8 @@ ro_local_history_tooltip(struct ro_local_history_window *lhw, int x, int y) ic.icon.extent.x0, ic.icon.extent.y0, width + 16, ic.icon.extent.y1); if (error) { - LOG("xwimp_resize_icon: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_resize_icon: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return NSERROR_NOMEM; } @@ -200,8 +200,8 @@ ro_local_history_tooltip(struct ro_local_history_window *lhw, int x, int y) state.w = dialog_tooltip; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return NSERROR_NOMEM; } @@ -211,15 +211,16 @@ ro_local_history_tooltip(struct ro_local_history_window *lhw, int x, int y) box.y0 = -36; error = xwimp_set_extent(dialog_tooltip, &box); if (error) { - LOG("xwimp_set_extent: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return NSERROR_NOMEM; } error = xwimp_get_pointer_info(&pointer); if (error) { - LOG("xwimp_get_pointer_info: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return NSERROR_NOMEM; } @@ -233,8 +234,8 @@ ro_local_history_tooltip(struct ro_local_history_window *lhw, int x, int y) /* open window */ error = xwimp_open_window(PTR_WIMP_OPEN(&state)); if (error) { - LOG("xwimp_open_window: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return NSERROR_NOMEM; } @@ -363,8 +364,8 @@ ro_local_history_open(struct ro_local_history_window *lhw, wimp_w parent) box.y0 = -height; error = xwimp_set_extent(lhw->core.wh, &box); if (error) { - LOG("xwimp_set_extent: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return NSERROR_NOMEM; } @@ -373,8 +374,8 @@ ro_local_history_open(struct ro_local_history_window *lhw, wimp_w parent) state.w = lhw->core.wh; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return NSERROR_NOMEM; } @@ -385,8 +386,8 @@ ro_local_history_open(struct ro_local_history_window *lhw, wimp_w parent) state.next = wimp_HIDDEN; error = xwimp_open_window(PTR_WIMP_OPEN(&state)); if (error) { - LOG("xwimp_open_window: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return NSERROR_NOMEM; } @@ -403,10 +404,10 @@ nserror ro_gui_local_history_present(wimp_w parent, struct browser_window *bw) res = ro_local_history_init(bw, &local_history_window); if (res == NSERROR_OK) { - LOG("Presenting"); + NSLOG(netsurf, INFO, "Presenting"); res = ro_local_history_open(local_history_window, parent); } else { - LOG("Failed presenting error code %d", res); + NSLOG(netsurf, INFO, "Failed presenting error code %d", res); } return res; diff --git a/frontends/riscos/menus.c b/frontends/riscos/menus.c index d46afa28e..a6e978a6c 100644 --- a/frontends/riscos/menus.c +++ b/frontends/riscos/menus.c @@ -232,7 +232,8 @@ void ro_gui_menu_create(wimp_menu *menu, int x, int y, wimp_w w) current_menu_open = true; error = xwimp_create_menu(menu, x - 64, y); if (error) { - LOG("xwimp_create_menu: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_menu: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("MenuError", error->errmess); ro_gui_menu_closed(); } @@ -258,14 +259,16 @@ void ro_gui_popup_menu(wimp_menu *menu, wimp_w w, wimp_i i) icon_state.i = i; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("MenuError", error->errmess); return; } error = xwimp_get_icon_state(&icon_state); if (error) { - LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("MenuError", error->errmess); return; } @@ -291,7 +294,8 @@ void ro_gui_menu_destroy(void) error = xwimp_create_menu(wimp_CLOSE_MENU, 0, 0); if (error) { - LOG("xwimp_create_menu: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_menu: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("MenuError", error->errmess); } @@ -354,7 +358,8 @@ void ro_gui_menu_selection(wimp_selection *selection) /* re-open the menu for Adjust clicks */ error = xwimp_get_pointer_info(&pointer); if (error) { - LOG("xwimp_get_pointer_info: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); ro_gui_menu_closed(); return; @@ -420,7 +425,8 @@ void ro_gui_menu_warning(wimp_message_menu_warning *warning) error = xwimp_create_sub_menu(menu_entry->sub_menu, warning->pos.x, warning->pos.y); if (error) { - LOG("xwimp_create_sub_menu: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_sub_menu: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("MenuError", error->errmess); } } @@ -485,7 +491,8 @@ void ro_gui_menu_refresh(wimp_menu *menu) os_error *error; error = xwimp_create_menu(current_menu, 0, 0); if (error) { - LOG("xwimp_create_menu: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_menu: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("MenuError", error->errmess); } } @@ -851,7 +858,8 @@ int ro_gui_menu_get_checksum(void) error = xwimp_get_menu_state((wimp_menu_state_flags)0, &menu_tree, 0, 0); if (error) { - LOG("xwimp_get_menu_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_menu_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("MenuError", error->errmess); return 0; } @@ -894,7 +902,8 @@ bool ro_gui_menu_translate(struct menu_definition *menu) /* read current alphabet */ error = xosbyte1(osbyte_ALPHABET_NUMBER, 127, 0, &alphabet); if (error) { - LOG("failed reading alphabet: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "failed reading alphabet: 0x%x: %s", + error->errnum, error->errmess); /* assume Latin1 */ alphabet = territory_ALPHABET_LATIN1; } @@ -909,7 +918,7 @@ bool ro_gui_menu_translate(struct menu_definition *menu) 0, &translated); if (err != NSERROR_OK) { assert(err != NSERROR_BAD_ENCODING); - LOG("utf8_to_enc failed"); + NSLOG(netsurf, INFO, "utf8_to_enc failed"); return false; } @@ -926,7 +935,7 @@ bool ro_gui_menu_translate(struct menu_definition *menu) 0, &translated); if (err != NSERROR_OK) { assert(err != NSERROR_BAD_ENCODING); - LOG("utf8_to_enc failed"); + NSLOG(netsurf, INFO, "utf8_to_enc failed"); return false; } diff --git a/frontends/riscos/message.c b/frontends/riscos/message.c index 1c54ea0b7..7a0216185 100644 --- a/frontends/riscos/message.c +++ b/frontends/riscos/message.c @@ -64,7 +64,8 @@ bool ro_message_send_message(wimp_event_no event, wimp_message *message, /* send a message */ error = xwimp_send_message(event, message, task); if (error) { - LOG("xwimp_send_message: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -101,7 +102,10 @@ bool ro_message_send_message_to_window(wimp_event_no event, wimp_message *messag /* send a message */ error = xwimp_send_message_to_window(event, message, to_w, to_i, to_t); if (error) { - LOG("xwimp_send_message_to_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_send_message_to_window: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); return false; } diff --git a/frontends/riscos/mouse.c b/frontends/riscos/mouse.c index a0cc0e7ce..89184cff3 100644 --- a/frontends/riscos/mouse.c +++ b/frontends/riscos/mouse.c @@ -81,7 +81,8 @@ void ro_mouse_poll(void) error = xwimp_get_pointer_info(&pointer); if (error) { - LOG("xwimp_get_pointer_info: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -194,7 +195,7 @@ void ro_mouse_track_start(void (*poll_end)(wimp_leaving *leaving, void *data), ro_mouse_ignore_leaving_event == false) ro_mouse_poll_end_callback(NULL, ro_mouse_poll_data); - LOG("Unexpected mouse track termination."); + NSLOG(netsurf, INFO, "Unexpected mouse track termination."); ro_mouse_ignore_leaving_event = false; ro_mouse_poll_end_callback = NULL; diff --git a/frontends/riscos/plotters.c b/frontends/riscos/plotters.c index b459ba1f9..2fbd12aeb 100644 --- a/frontends/riscos/plotters.c +++ b/frontends/riscos/plotters.c @@ -79,15 +79,16 @@ ro_plot_draw_path(const draw_path * const path, error = xcolourtrans_set_gcol(c << 8, 0, os_ACTION_OVERWRITE, 0, 0); if (error) { - LOG("xcolourtrans_set_gcol: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xcolourtrans_set_gcol: 0x%x: %s", + error->errnum, error->errmess); return NSERROR_INVALID; } error = xdraw_stroke(path, 0, 0, 0, width * 2 * 256, &line_style, dash_pattern); if (error) { - LOG("xdraw_stroke: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xdraw_stroke: 0x%x: %s", error->errnum, + error->errmess); return NSERROR_INVALID; } @@ -115,8 +116,8 @@ ro_plot_clip(const struct redraw_context *ctx, const struct rect *clip) int clip_y1 = ro_plot_origin_y - clip->y1 * 2; if (clip_x1 < clip_x0 || clip_y0 < clip_y1) { - LOG("bad clip rectangle %i %i %i %i", - clip_x0, clip_y0, clip_x1, clip_y1); + NSLOG(netsurf, INFO, "bad clip rectangle %i %i %i %i", + clip_x0, clip_y0, clip_x1, clip_y1); return NSERROR_BAD_SIZE; } @@ -132,7 +133,8 @@ ro_plot_clip(const struct redraw_context *ctx, const struct rect *clip) error = xos_writen(buf, 9); if (error) { - LOG("xos_writen: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xos_writen: 0x%x: %s", error->errnum, + error->errmess); return NSERROR_INVALID; } @@ -173,8 +175,8 @@ ro_plot_arc(const struct redraw_context *ctx, os_ACTION_OVERWRITE, 0, 0); if (error) { - LOG("xcolourtrans_set_gcol: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xcolourtrans_set_gcol: 0x%x: %s", + error->errnum, error->errmess); return NSERROR_INVALID; } @@ -188,19 +190,22 @@ ro_plot_arc(const struct redraw_context *ctx, error = xos_plot(os_MOVE_TO, x, y); /* move to centre */ if (error) { - LOG("xos_plot: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xos_plot: 0x%x: %s", error->errnum, + error->errmess); return NSERROR_INVALID; } error = xos_plot(os_MOVE_TO, sx, sy); /* move to start */ if (error) { - LOG("xos_plot: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xos_plot: 0x%x: %s", error->errnum, + error->errmess); return NSERROR_INVALID; } error = xos_plot(os_PLOT_ARC | os_PLOT_TO, ex, ey); /* arc to end */ if (error) { - LOG("xos_plot: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xos_plot: 0x%x: %s", error->errnum, + error->errmess); return NSERROR_INVALID; } @@ -230,20 +235,24 @@ ro_plot_disc(const struct redraw_context *ctx, error = xcolourtrans_set_gcol(style->fill_colour << 8, 0, os_ACTION_OVERWRITE, 0, 0); if (error) { - LOG("xcolourtrans_set_gcol: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xcolourtrans_set_gcol: 0x%x: %s", + error->errnum, + error->errmess); return NSERROR_INVALID; } error = xos_plot(os_MOVE_TO, ro_plot_origin_x + x * 2, ro_plot_origin_y - y * 2); if (error) { - LOG("xos_plot: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xos_plot: 0x%x: %s", + error->errnum, error->errmess); return NSERROR_INVALID; } error = xos_plot(os_PLOT_CIRCLE | os_PLOT_BY, radius * 2, 0); if (error) { - LOG("xos_plot: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xos_plot: 0x%x: %s", + error->errnum, error->errmess); return NSERROR_INVALID; } } @@ -253,22 +262,26 @@ ro_plot_disc(const struct redraw_context *ctx, error = xcolourtrans_set_gcol(style->stroke_colour << 8, 0, os_ACTION_OVERWRITE, 0, 0); if (error) { - LOG("xcolourtrans_set_gcol: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xcolourtrans_set_gcol: 0x%x: %s", + error->errnum, + error->errmess); return NSERROR_INVALID; } error = xos_plot(os_MOVE_TO, ro_plot_origin_x + x * 2, ro_plot_origin_y - y * 2); if (error) { - LOG("xos_plot: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xos_plot: 0x%x: %s", + error->errnum, error->errmess); return NSERROR_INVALID; } error = xos_plot(os_PLOT_CIRCLE_OUTLINE | os_PLOT_BY, radius * 2, 0); if (error) { - LOG("xos_plot: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xos_plot: 0x%x: %s", + error->errnum, error->errmess); return NSERROR_INVALID; } } @@ -343,8 +356,10 @@ ro_plot_rectangle(const struct redraw_context *ctx, colourtrans_USE_ECFS_GCOL, os_ACTION_OVERWRITE, 0, 0); if (error) { - LOG("xcolourtrans_set_gcol: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xcolourtrans_set_gcol: 0x%x: %s", + error->errnum, + error->errmess); return NSERROR_INVALID; } @@ -352,7 +367,8 @@ ro_plot_rectangle(const struct redraw_context *ctx, ro_plot_origin_x + rect->x0 * 2, ro_plot_origin_y - rect->y0 * 2 - 1); if (error) { - LOG("xos_plot: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xos_plot: 0x%x: %s", + error->errnum, error->errmess); return NSERROR_INVALID; } @@ -360,7 +376,8 @@ ro_plot_rectangle(const struct redraw_context *ctx, ro_plot_origin_x + rect->x1 * 2 - 1, ro_plot_origin_y - rect->y1 * 2); if (error) { - LOG("xos_plot: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xos_plot: 0x%x: %s", + error->errnum, error->errmess); return NSERROR_INVALID; } } @@ -441,13 +458,14 @@ ro_plot_polygon(const struct redraw_context *ctx, error = xcolourtrans_set_gcol(style->fill_colour << 8, 0, os_ACTION_OVERWRITE, 0, 0); if (error) { - LOG("xcolourtrans_set_gcol: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xcolourtrans_set_gcol: 0x%x: %s", + error->errnum, error->errmess); return NSERROR_INVALID; } error = xdraw_fill((draw_path *) path, 0, 0, 0); if (error) { - LOG("xdraw_fill: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xdraw_fill: 0x%x: %s", error->errnum, + error->errmess); return NSERROR_INVALID; } @@ -494,13 +512,13 @@ ro_plot_path(const struct redraw_context *ctx, } if (p[0] != PLOTTER_PATH_MOVE) { - LOG("path doesn't start with a move"); + NSLOG(netsurf, INFO, "path doesn't start with a move"); goto error; } path = malloc(sizeof *path * (n + 10)); if (!path) { - LOG("out of memory"); + NSLOG(netsurf, INFO, "out of memory"); goto error; } @@ -528,7 +546,7 @@ ro_plot_path(const struct redraw_context *ctx, path[i + 6] = -p[i + 6] * 2 * 256; i += 7; } else { - LOG("bad path command %f", p[i]); + NSLOG(netsurf, INFO, "bad path command %f", p[i]); goto error; } } @@ -546,15 +564,17 @@ ro_plot_path(const struct redraw_context *ctx, error = xcolourtrans_set_gcol(pstyle->fill_colour << 8, 0, os_ACTION_OVERWRITE, 0, 0); if (error) { - LOG("xcolourtrans_set_gcol: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xcolourtrans_set_gcol: 0x%x: %s", + error->errnum, + error->errmess); goto error; } error = xdraw_fill((draw_path *) path, 0, &trfm, 0); if (error) { - LOG("xdraw_stroke: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xdraw_stroke: 0x%x: %s", + error->errnum, error->errmess); goto error; } } @@ -563,16 +583,18 @@ ro_plot_path(const struct redraw_context *ctx, error = xcolourtrans_set_gcol(pstyle->stroke_colour << 8, 0, os_ACTION_OVERWRITE, 0, 0); if (error) { - LOG("xcolourtrans_set_gcol: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xcolourtrans_set_gcol: 0x%x: %s", + error->errnum, + error->errmess); goto error; } error = xdraw_stroke((draw_path *) path, 0, &trfm, 0, width * 2 * 256, &line_style, 0); if (error) { - LOG("xdraw_stroke: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xdraw_stroke: 0x%x: %s", + error->errnum, error->errmess); goto error; } } @@ -623,7 +645,7 @@ ro_plot_bitmap(const struct redraw_context *ctx, buffer = riscos_bitmap_get_buffer(bitmap); if (!buffer) { - LOG("bitmap_get_buffer failed"); + NSLOG(netsurf, INFO, "bitmap_get_buffer failed"); return NSERROR_INVALID; } @@ -669,8 +691,10 @@ ro_plot_text(const struct redraw_context *ctx, fstyle->background << 8, fstyle->foreground << 8, 14, 0, 0, 0); if (error) { - LOG("xcolourtrans_set_font_colours: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xcolourtrans_set_font_colours: 0x%x: %s", + error->errnum, + error->errmess); return NSERROR_INVALID; } diff --git a/frontends/riscos/print.c b/frontends/riscos/print.c index b7ddd4e53..d965baff4 100644 --- a/frontends/riscos/print.c +++ b/frontends/riscos/print.c @@ -169,7 +169,8 @@ void ro_gui_print_prepare(struct gui_window *g) /* Read Printer Driver name */ error = xpdriver_info(0, 0, 0, 0, &desc, 0, 0, 0); if (error) { - LOG("xpdriver_info: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xpdriver_info: 0x%x: %s", + error->errnum, error->errmess); printers_exists = false; } @@ -306,7 +307,8 @@ void print_send_printsave(struct hlcache_handle *h) e = xwimp_send_message(wimp_USER_MESSAGE_RECORDED, (wimp_message *)&m, 0); if (e) { - LOG("xwimp_send_message: 0x%x: %s", e->errnum, e->errmess); + NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s", + e->errnum, e->errmess); ro_warn_user("WimpError", e->errmess); ro_print_cleanup(); } @@ -330,7 +332,8 @@ bool print_send_printtypeknown(wimp_message *m) m->action = message_PRINT_TYPE_KNOWN; e = xwimp_send_message(wimp_USER_MESSAGE, m, m->sender); if (e) { - LOG("xwimp_send_message: 0x%x: %s", e->errnum, e->errmess); + NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s", + e->errnum, e->errmess); ro_warn_user("WimpError", e->errmess); return false; } @@ -436,7 +439,8 @@ bool ro_print_ack(wimp_message *m) /* read printer driver type */ error = xpdriver_info(&info_type, 0, 0, 0, 0, 0, 0, 0); if (error) { - LOG("xpdriver_info: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xpdriver_info: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("PrintError", error->errmess); ro_print_cleanup(); return true; @@ -461,7 +465,8 @@ bool ro_print_ack(wimp_message *m) error = xwimp_send_message(wimp_USER_MESSAGE_RECORDED, m, m->sender); if (error) { - LOG("xwimp_send_message: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); /* and delete temporary file */ xosfile_delete(m->data.data_xfer.file_name, @@ -533,7 +538,8 @@ bool print_document(struct gui_window *g, const char *filename) /* read printer driver features */ error = xpdriver_info(0, 0, 0, &features, 0, 0, 0, 0); if (error) { - LOG("xpdriver_info: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xpdriver_info: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("PrintError", error->errmess); return false; } @@ -541,7 +547,8 @@ bool print_document(struct gui_window *g, const char *filename) /* read page size */ error = xpdriver_page_size(0, 0, &left, &bottom, &right, &top); if (error) { - LOG("xpdriver_page_size: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xpdriver_page_size: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("PrintError", error->errmess); return false; } @@ -564,7 +571,8 @@ bool print_document(struct gui_window *g, const char *filename) error = xosfind_openoutw(osfind_NO_PATH | osfind_ERROR_IF_DIR | osfind_ERROR_IF_ABSENT, filename, 0, &fhandle); if (error) { - LOG("xosfind_openoutw: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfind_openoutw: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("PrintError", error->errmess); return false; } @@ -572,7 +580,8 @@ bool print_document(struct gui_window *g, const char *filename) /* select print job */ error = xpdriver_select_jobw(fhandle, "NetSurf", &old_job); if (error) { - LOG("xpdriver_select_jobw: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xpdriver_select_jobw: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("PrintError", error->errmess); xosfind_closew(fhandle); return false; @@ -632,18 +641,23 @@ bool print_document(struct gui_window *g, const char *filename) /* give page rectangle */ error = xpdriver_give_rectangle(0, &b, &t, &p, os_COLOUR_WHITE); if (error) { - LOG("xpdriver_give_rectangle: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xpdriver_give_rectangle: 0x%x: %s", + error->errnum, + error->errmess); error_message = error->errmess; goto error; } - LOG("given rectangle: [(%d, %d), (%d, %d)]", b.x0, b.y0, b.x1, b.y1); + NSLOG(netsurf, INFO, "given rectangle: [(%d, %d), (%d, %d)]", + b.x0, b.y0, b.x1, b.y1); /* and redraw the document */ error = xpdriver_draw_page(print_num_copies, &b, 0, 0, &more, 0); if (error) { - LOG("xpdriver_draw_page: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xpdriver_draw_page: 0x%x: %s", + error->errnum, error->errmess); error_message = error->errmess; goto error; } @@ -657,7 +671,9 @@ bool print_document(struct gui_window *g, const char *filename) .plot = &ro_plotters }; - LOG("redrawing area: [(%d, %d), (%d, %d)]", b.x0, b.y0, b.x1, b.y1); + NSLOG(netsurf, INFO, + "redrawing area: [(%d, %d), (%d, %d)]", b.x0, + b.y0, b.x1, b.y1); clip.x0 = (b.x0 - ro_plot_origin_x) / 2; clip.y0 = (ro_plot_origin_y - b.y1) / 2; clip.x1 = (b.x1 - ro_plot_origin_x) / 2; @@ -679,7 +695,10 @@ bool print_document(struct gui_window *g, const char *filename) error = xpdriver_get_rectangle(&b, &more, 0); if (error) { - LOG("xpdriver_get_rectangle: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xpdriver_get_rectangle: 0x%x: %s", + error->errnum, + error->errmess); error_message = error->errmess; goto error; } @@ -701,14 +720,16 @@ bool print_document(struct gui_window *g, const char *filename) error = (os_error *) _swix(PDriver_EndJob, _IN(0), (int) fhandle); if (error) { - LOG("xpdriver_end_jobw: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xpdriver_end_jobw: 0x%x: %s", + error->errnum, error->errmess); error_message = error->errmess; goto error; } error = xosfind_closew(fhandle); if (error) { - LOG("xosfind_closew: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfind_closew: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("PrintError", error->errmess); return false; } @@ -716,7 +737,10 @@ bool print_document(struct gui_window *g, const char *filename) if (old_job) { error = xpdriver_select_jobw(old_job, 0, 0); if (error) { - LOG("xpdriver_select_jobw: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xpdriver_select_jobw: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("PrintError", error->errmess); /* the printing succeeded anyway */ return true; @@ -855,11 +879,14 @@ print_fonts_plot_text(const struct redraw_context *ctx, text, length, 0, 0, print_fonts_callback, 0); if (code != rufl_OK) { if (code == rufl_FONT_MANAGER_ERROR) { - LOG("rufl_paint_callback: rufl_FONT_MANAGER_ERROR: ""0x%x: %s", - rufl_fm_error->errnum, rufl_fm_error->errmess); + NSLOG(netsurf, INFO, + "rufl_paint_callback: rufl_FONT_MANAGER_ERROR: ""0x%x: %s", + rufl_fm_error->errnum, + rufl_fm_error->errmess); print_fonts_error = rufl_fm_error->errmess; } else { - LOG("rufl_paint_callback: 0x%x", code); + NSLOG(netsurf, INFO, "rufl_paint_callback: 0x%x", + code); } return NSERROR_INVALID; } @@ -934,18 +961,22 @@ const char *print_declare_fonts(struct hlcache_handle *h) } for (i = 0; i != print_fonts_count; ++i) { - LOG("%u %s", i, print_fonts_list[i]); + NSLOG(netsurf, INFO, "%u %s", i, print_fonts_list[i]); error = xpdriver_declare_font(0, print_fonts_list[i], pdriver_KERNED); if (error) { - LOG("xpdriver_declare_font: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xpdriver_declare_font: 0x%x: %s", + error->errnum, + error->errmess); error_message = error->errmess; goto end; } } error = xpdriver_declare_font(0, 0, 0); if (error) { - LOG("xpdriver_declare_font: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xpdriver_declare_font: 0x%x: %s", + error->errnum, error->errmess); error_message = error->errmess; goto end; } diff --git a/frontends/riscos/query.c b/frontends/riscos/query.c index 1d7cf5120..49aea6321 100644 --- a/frontends/riscos/query.c +++ b/frontends/riscos/query.c @@ -175,7 +175,7 @@ query_id query_user_xy(const char *query, const char *detail, err = utf8_to_local_encoding(yes, 0, &local_text); if (err != NSERROR_OK) { assert(err != NSERROR_BAD_ENCODING); - LOG("utf8_to_local_encoding_failed"); + NSLOG(netsurf, INFO, "utf8_to_local_encoding_failed"); local_text = NULL; } @@ -191,7 +191,8 @@ query_id query_user_xy(const char *query, const char *detail, error = xwimptextop_string_width(icn->data.indirected_text.text, len, &width); if (error) { - LOG("xwimptextop_string_width: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimptextop_string_width: 0x%x:%s", + error->errnum, error->errmess); width = len * 16; } if (!query_yes_width) query_yes_width = icn->extent.x1 - icn->extent.x0; @@ -204,7 +205,7 @@ query_id query_user_xy(const char *query, const char *detail, err = utf8_to_local_encoding(no, 0, &local_text); if (err != NSERROR_OK) { assert(err != NSERROR_BAD_ENCODING); - LOG("utf8_to_local_encoding_failed"); + NSLOG(netsurf, INFO, "utf8_to_local_encoding_failed"); local_text = NULL; } @@ -222,7 +223,8 @@ query_id query_user_xy(const char *query, const char *detail, icn->extent.x1 = tx - 16; error = xwimptextop_string_width(icn->data.indirected_text.text, len, &width); if (error) { - LOG("xwimptextop_string_width: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimptextop_string_width: 0x%x:%s", + error->errnum, error->errmess); width = len * 16; } width += 28; @@ -263,7 +265,8 @@ query_id query_user_xy(const char *query, const char *detail, error = xwimp_set_caret_position(qw->window, (wimp_i)-1, 0, 0, 1 << 25, -1); if (error) { - LOG("xwimp_get_caret_position: 0x%x : %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_caret_position: 0x%x : %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -307,7 +310,10 @@ void ro_gui_query_window_bring_to_front(query_id id) error = xwimp_set_caret_position(qw->window, (wimp_i)-1, 0, 0, 1 << 25, -1); if (error) { - LOG("xwimp_get_caret_position: 0x%x : %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_caret_position: 0x%x : %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -327,7 +333,8 @@ void ro_gui_query_close(wimp_w w) ro_gui_dialog_close(w); error = xwimp_delete_window(qw->window); if (error) { - LOG("xwimp_delete_window: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x:%s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } ro_gui_wimp_event_finalise(w); diff --git a/frontends/riscos/save.c b/frontends/riscos/save.c index bed0f5dd1..76ce6d3e5 100644 --- a/frontends/riscos/save.c +++ b/frontends/riscos/save.c @@ -166,7 +166,8 @@ wimp_w ro_gui_saveas_create(const char *template_name) error = xosmodule_alloc(area_size, (void **) &area); if (error) { - LOG("xosmodule_alloc: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosmodule_alloc: 0x%x: %s", + error->errnum, error->errmess); xwimp_close_template(); die(error->errmess); } else { @@ -176,7 +177,10 @@ wimp_w ro_gui_saveas_create(const char *template_name) error = xosspriteop_clear_sprites(osspriteop_USER_AREA, saveas_area); if (error) { - LOG("xosspriteop_clear_sprites: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosspriteop_clear_sprites: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("MiscError", error->errmess); xosmodule_free(saveas_area); @@ -192,7 +196,8 @@ wimp_w ro_gui_saveas_create(const char *template_name) /* create window */ error = xwimp_create_window(window, &w); if (error) { - LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s", + error->errnum, error->errmess); xwimp_close_template(); die(error->errmess); } @@ -212,7 +217,8 @@ void ro_gui_saveas_quit(void) if (saveas_area) { os_error *error = xosmodule_free(saveas_area); if (error) { - LOG("xosmodule_free: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosmodule_free: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("MiscError", error->errmess); } saveas_area = NULL; @@ -239,14 +245,14 @@ ro_gui_save_create_thumbnail(struct hlcache_handle *h, const char *name) bitmap = riscos_bitmap_create(34, 34, BITMAP_NEW | BITMAP_OPAQUE | BITMAP_CLEAR_MEMORY); if (!bitmap) { - LOG("Thumbnail initialisation failed."); + NSLOG(netsurf, INFO, "Thumbnail initialisation failed."); return false; } riscos_bitmap_render(bitmap, h); area = riscos_bitmap_convert_8bpp(bitmap); riscos_bitmap_destroy(bitmap); if (!area) { - LOG("Thumbnail conversion failed."); + NSLOG(netsurf, INFO, "Thumbnail conversion failed."); return false; } @@ -391,7 +397,10 @@ ro_gui_save_set_state(struct hlcache_handle *h, gui_save_type save_type, } if (error) { - LOG("ro_gui_wimp_get_sprite: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "ro_gui_wimp_get_sprite: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("MiscError", error->errmess); } else { /* the sprite area should always be large enough for @@ -501,7 +510,8 @@ static void ro_gui_save_drag_end(wimp_dragged *drag, void *data) error = xwimp_get_pointer_info(&pointer); if (error) { - LOG("xwimp_get_pointer_info: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -627,7 +637,8 @@ static void ro_gui_save_done(void) error = xwimp_send_message(wimp_USER_MESSAGE, message, message->sender); if (error) { - LOG("xwimp_send_message: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("SaveError", error->errmess); } } @@ -667,7 +678,10 @@ static void ro_gui_save_done(void) ro_gui_dialog_close(dialog_saveas); error = xwimp_create_menu(wimp_CLOSE_MENU, 0, 0); if (error) { - LOG("xwimp_create_menu: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_create_menu: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("MenuError", error->errmess); } } @@ -770,8 +784,8 @@ static void ro_gui_save_set_file_type(const char *path, lwc_string *mime_type) error = xosfile_set_type(path, rotype); if (error != NULL) { - LOG("xosfile_set_type: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfile_set_type: 0x%x: %s", + error->errnum, error->errmess); } } @@ -798,7 +812,8 @@ static bool ro_gui_save_complete(struct hlcache_handle *h, char *path) /* Create dir */ error = xosfile_create_dir(path, 0); if (error) { - LOG("xosfile_create_dir: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfile_create_dir: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("SaveError", error->errmess); return false; } @@ -807,7 +822,7 @@ static bool ro_gui_save_complete(struct hlcache_handle *h, char *path) snprintf(buf, sizeof buf, "%s.!Run", path); fp = fopen(buf, "w"); if (!fp) { - LOG("fopen(): errno = %i", errno); + NSLOG(netsurf, INFO, "fopen(): errno = %i", errno); ro_warn_user("SaveError", strerror(errno)); return false; } @@ -816,7 +831,8 @@ static bool ro_gui_save_complete(struct hlcache_handle *h, char *path) fclose(fp); error = xosfile_set_type(buf, 0xfeb); if (error) { - LOG("xosfile_set_type: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfile_set_type: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("SaveError", error->errmess); return false; } @@ -825,7 +841,8 @@ static bool ro_gui_save_complete(struct hlcache_handle *h, char *path) snprintf(buf, sizeof buf, "%s.!RunImage", path); fp = fopen(buf, "w"); if (!fp) { - LOG("Creating !RunImage failed: errno = %i", errno); + NSLOG(netsurf, INFO, "Creating !RunImage failed: errno = %i", + errno); } else { fclose(fp); } @@ -851,7 +868,10 @@ static bool ro_gui_save_complete(struct hlcache_handle *h, char *path) error = xosspriteop_save_sprite_file(osspriteop_NAME, saveas_area, buf); if (error) { - LOG("xosspriteop_save_sprite_file: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosspriteop_save_sprite_file: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("SaveError", error->errmess); return false; } @@ -897,7 +917,10 @@ static bool ro_gui_save_object_native(struct hlcache_handle *h, char *path) (byte *) source_data, (byte *) source_data + source_size); if (error != NULL) { - LOG("xosfile_save_stamped: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosfile_save_stamped: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("SaveError", error->errmess); return false; } @@ -947,7 +970,8 @@ ro_gui_save_content(struct hlcache_handle *h, char *path, bool force_overwrite) error = xosfile_read_stamped(path, &obj_type, NULL, NULL, NULL, NULL, NULL); if (error) { - LOG("xosfile_read_stamped: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfile_read_stamped: 0x%x:%s", + error->errnum, error->errmess); ro_warn_user("SaveError", error->errmess); return false; } @@ -1003,7 +1027,10 @@ ro_gui_save_content(struct hlcache_handle *h, char *path, bool force_overwrite) (byte *) source_data, (byte *) source_data + source_size); if (error) { - LOG("xosfile_save_stamped: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosfile_save_stamped: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("SaveError", error->errmess); return false; } @@ -1029,14 +1056,20 @@ ro_gui_save_content(struct hlcache_handle *h, char *path, bool force_overwrite) return false; error = xosfile_set_type(path, 0xfaf); if (error) - LOG("xosfile_set_type: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosfile_set_type: 0x%x: %s", + error->errnum, + error->errmess); break; case GUI_SAVE_HISTORY_EXPORT_HTML: if (global_history_export(path, NULL) != NSERROR_OK) return false; error = xosfile_set_type(path, 0xfaf); if (error) - LOG("xosfile_set_type: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosfile_set_type: 0x%x: %s", + error->errnum, + error->errmess); break; case GUI_SAVE_TEXT_SELECTION: @@ -1056,7 +1089,10 @@ ro_gui_save_content(struct hlcache_handle *h, char *path, bool force_overwrite) return ro_gui_save_clipboard(path); default: - LOG("Unexpected content type: %d, path %s", gui_save_current_type, path); + NSLOG(netsurf, INFO, + "Unexpected content type: %d, path %s", + gui_save_current_type, + path); return false; } return true; @@ -1121,7 +1157,8 @@ void gui_drag_save_object(struct gui_window *g, error = xwimp_get_pointer_info(&pointer); if (error) { - LOG("xwimp_get_pointer_info: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -1158,7 +1195,8 @@ void gui_drag_save_selection(struct gui_window *g, const char *selection) error = xwimp_get_pointer_info(&pointer); if (error) { - LOG("xwimp_get_pointer_info: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -1210,8 +1248,8 @@ void ro_gui_drag_save_link(gui_save_type save_type, const nsurl *url, error = xwimp_get_pointer_info(&pointer); if (error) { - LOG("xwimp_get_pointer_info: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -1252,7 +1290,10 @@ void ro_gui_drag_icon(int x, int y, const char *sprite) saveas_area, (osspriteop_id)sprite, NULL); if (error) { if (error->errnum != error_SPRITE_OP_DOESNT_EXIST) { - LOG("xosspriteop_select_sprite: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosspriteop_select_sprite: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("MiscError", error->errmess); } } @@ -1272,7 +1313,8 @@ void ro_gui_drag_icon(int x, int y, const char *sprite) return; } - LOG("xdragasprite_start: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xdragasprite_start: 0x%x: %s", + error->errnum, error->errmess); } drag.type = wimp_DRAG_USER_FIXED; @@ -1285,7 +1327,8 @@ void ro_gui_drag_icon(int x, int y, const char *sprite) error = xwimp_drag_box(&drag); if (error) { - LOG("xwimp_drag_box: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_drag_box: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("DragError", error->errmess); } else { dragbox_active = true; @@ -1323,14 +1366,20 @@ void ro_gui_drag_box_cancel(void) if (using_dragasprite) { error = xdragasprite_stop(); if (error) { - LOG("xdragasprite_stop: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xdragasprite_stop: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } } else { error = xwimp_drag_box(NULL); if (error) { - LOG("xwimp_drag_box: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_drag_box: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -1384,7 +1433,8 @@ void ro_gui_save_datasave_ack(wimp_message *message) default: if (!gui_save_content) { - LOG("unexpected DataSaveAck: gui_save_content not set"); + NSLOG(netsurf, INFO, + "unexpected DataSaveAck: gui_save_content not set"); return; } break; diff --git a/frontends/riscos/save_draw.c b/frontends/riscos/save_draw.c index 1e0bc1ec6..9ee730434 100644 --- a/frontends/riscos/save_draw.c +++ b/frontends/riscos/save_draw.c @@ -54,7 +54,7 @@ static int ro_save_draw_height; */ static nserror ro_save_draw_error(pencil_code code) { - LOG("code %i", code); + NSLOG(netsurf, INFO, "code %i", code); switch (code) { case pencil_OK: @@ -333,13 +333,13 @@ ro_save_draw_path(const struct redraw_context *ctx, return NSERROR_OK; if (p[0] != PLOTTER_PATH_MOVE) { - LOG("path doesn't start with a move"); + NSLOG(netsurf, INFO, "path doesn't start with a move"); return NSERROR_INVALID; } path = malloc(sizeof *path * (n + 10)); if (!path) { - LOG("out of memory"); + NSLOG(netsurf, INFO, "out of memory"); return NSERROR_INVALID; } @@ -389,7 +389,7 @@ ro_save_draw_path(const struct redraw_context *ctx, i += 7; empty_path = false; } else { - LOG("bad path command %f", p[i]); + NSLOG(netsurf, INFO, "bad path command %f", p[i]); free(path); return NSERROR_INVALID; } @@ -624,8 +624,8 @@ bool save_as_draw(struct hlcache_handle *h, const char *path) (byte *) drawfile_buffer, (byte *) drawfile_buffer + drawfile_size); if (error) { - LOG("xosfile_save_stamped failed: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfile_save_stamped failed: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("SaveError", error->errmess); pencil_free(ro_save_draw_diagram); return false; diff --git a/frontends/riscos/schedule.c b/frontends/riscos/schedule.c index 54308b7a9..cb44d906d 100644 --- a/frontends/riscos/schedule.c +++ b/frontends/riscos/schedule.c @@ -108,7 +108,7 @@ nserror riscos_schedule(int t, void (*callback)(void *p), void *p) entry = malloc(sizeof *entry); if (!entry) { - LOG("malloc failed"); + NSLOG(netsurf, INFO, "malloc failed"); return NSERROR_NOMEM; } diff --git a/frontends/riscos/sslcert.c b/frontends/riscos/sslcert.c index 85b84456e..4d81268f4 100644 --- a/frontends/riscos/sslcert.c +++ b/frontends/riscos/sslcert.c @@ -82,14 +82,14 @@ static void ro_gui_cert_release_window(struct ro_cert_window *certw) error = xwimp_delete_window(certw->wh); if (error) { - LOG("xwimp_delete_window: 0x%x:%s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x:%s", + error->errnum, error->errmess); } error = xwimp_delete_window(certw->core.wh); if (error) { - LOG("xwimp_delete_window: 0x%x:%s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x:%s", + error->errnum, error->errmess); } free(certw); @@ -165,16 +165,16 @@ static nserror cert_attach_pane(wimp_w parent, wimp_w pane) winfo.w = pane; error = xwimp_get_window_info_header_only(&winfo); if (error) { - LOG("xwimp_get_window_info: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_info: 0x%x: %s", + error->errnum, error->errmess); return NSERROR_INIT_FAILED; } wstate.w = parent; error = xwimp_get_window_state(&wstate); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); return NSERROR_INIT_FAILED; } @@ -182,8 +182,8 @@ static nserror cert_attach_pane(wimp_w parent, wimp_w pane) istate.i = ICON_SSL_PANE; error = xwimp_get_icon_state(&istate); if (error) { - LOG("xwimp_get_icon_state: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s", + error->errnum, error->errmess); return NSERROR_INIT_FAILED; } @@ -211,8 +211,8 @@ static nserror cert_attach_pane(wimp_w parent, wimp_w pane) if (set_extent) { error = xwimp_set_extent(pane, &(winfo.extent)); if (error) { - LOG("xwimp_set_extent: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s", + error->errnum, error->errmess); return NSERROR_INIT_FAILED; } } @@ -225,8 +225,8 @@ static nserror cert_attach_pane(wimp_w parent, wimp_w pane) wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT << wimp_CHILD_LS_EDGE_SHIFT | wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT << wimp_CHILD_RS_EDGE_SHIFT); if (error) { - LOG("xwimp_open_window_nested: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_open_window_nested: 0x%x: %s", + error->errnum, error->errmess); return NSERROR_INIT_FAILED; } @@ -336,8 +336,8 @@ gui_cert_verify(nsurl *url, /* Create the SSL window */ error = xwimp_create_window(dialog_cert_template, &ncwin->wh); if (error) { - LOG("xwimp_create_window: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s", + error->errnum, error->errmess); free(ncwin); return NSERROR_INIT_FAILED; } @@ -345,8 +345,8 @@ gui_cert_verify(nsurl *url, /* create ssl viewer pane window */ error = xwimp_create_window(cert_tree_template, &ncwin->core.wh); if (error) { - LOG("xwimp_create_window: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s", + error->errnum, error->errmess); free(ncwin); return NSERROR_INIT_FAILED; } diff --git a/frontends/riscos/textarea.c b/frontends/riscos/textarea.c index d9872927c..6f41c640b 100644 --- a/frontends/riscos/textarea.c +++ b/frontends/riscos/textarea.c @@ -138,7 +138,7 @@ uintptr_t ro_textarea_create(wimp_w parent, wimp_i icon, unsigned int flags, ret = malloc(sizeof(struct text_area)); if (!ret) { - LOG("malloc failed"); + NSLOG(netsurf, INFO, "malloc failed"); return 0; } @@ -148,7 +148,7 @@ uintptr_t ro_textarea_create(wimp_w parent, wimp_i icon, unsigned int flags, ret->flags = flags; ret->text = malloc(64); if (!ret->text) { - LOG("malloc failed"); + NSLOG(netsurf, INFO, "malloc failed"); free(ret); return 0; } @@ -160,7 +160,7 @@ uintptr_t ro_textarea_create(wimp_w parent, wimp_i icon, unsigned int flags, // ret->selection_end = (unsigned int)-1; ret->font_family = strdup(font_family ? font_family : "Corpus"); if (!ret->font_family) { - LOG("strdup failed"); + NSLOG(netsurf, INFO, "strdup failed"); free(ret->text); free(ret); return 0; @@ -181,7 +181,8 @@ uintptr_t ro_textarea_create(wimp_w parent, wimp_i icon, unsigned int flags, text_area_definition.title_fg = wimp_COLOUR_BLACK; error = xwimp_create_window(&text_area_definition, &ret->window); if (error) { - LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s", + error->errnum, error->errmess); free(ret->font_family); free(ret->text); free(ret); @@ -228,7 +229,8 @@ bool ro_textarea_update(uintptr_t self) state.w = ta->parent; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); return false; } @@ -236,7 +238,8 @@ bool ro_textarea_update(uintptr_t self) istate.i = ta->icon; error = xwimp_get_icon_state(&istate); if (error) { - LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s", + error->errnum, error->errmess); return false; } @@ -267,7 +270,8 @@ bool ro_textarea_update(uintptr_t self) error = xwimp_set_extent(ta->window, &extent); if (error) { - LOG("xwimp_set_extent: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s", + error->errnum, error->errmess); return false; } @@ -282,7 +286,8 @@ bool ro_textarea_update(uintptr_t self) wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT << wimp_CHILD_RS_EDGE_SHIFT); if (error) { - LOG("xwimp_open_window_nested: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_open_window_nested: 0x%x: %s", + error->errnum, error->errmess); return false; } @@ -307,7 +312,8 @@ void ro_textarea_destroy(uintptr_t self) error = xwimp_delete_window(ta->window); if (error) { - LOG("xwimp_delete_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x: %s", + error->errnum, error->errmess); } ro_gui_wimp_event_finalise(ta->window); @@ -331,14 +337,14 @@ bool ro_textarea_set_text(uintptr_t self, const char *text) ta = (struct text_area *)self; if (!ta || ta->magic != MAGIC) { - LOG("magic doesn't match"); + NSLOG(netsurf, INFO, "magic doesn't match"); return true; } if (len >= ta->text_alloc) { char *temp = realloc(ta->text, len + 64); if (!temp) { - LOG("realloc failed"); + NSLOG(netsurf, INFO, "realloc failed"); return false; } ta->text = temp; @@ -368,7 +374,7 @@ int ro_textarea_get_text(uintptr_t self, char *buf, unsigned int len) ta = (struct text_area *)self; if (!ta || ta->magic != MAGIC) { - LOG("magic doesn't match"); + NSLOG(netsurf, INFO, "magic doesn't match"); return -1; } @@ -378,7 +384,7 @@ int ro_textarea_get_text(uintptr_t self, char *buf, unsigned int len) } if (len < ta->text_len) { - LOG("buffer too small"); + NSLOG(netsurf, INFO, "buffer too small"); return -1; } @@ -403,7 +409,7 @@ void ro_textarea_insert_text(uintptr_t self, unsigned int index, ta = (struct text_area *)self; if (!ta || ta->magic != MAGIC) { - LOG("magic doesn't match"); + NSLOG(netsurf, INFO, "magic doesn't match"); return; } @@ -420,7 +426,7 @@ void ro_textarea_insert_text(uintptr_t self, unsigned int index, if (b_len + ta->text_len >= ta->text_alloc) { char *temp = realloc(ta->text, b_len + ta->text_len + 64); if (!temp) { - LOG("realloc failed"); + NSLOG(netsurf, INFO, "realloc failed"); return; } @@ -457,7 +463,7 @@ void ro_textarea_replace_text(uintptr_t self, unsigned int start, ta = (struct text_area *)self; if (!ta || ta->magic != MAGIC) { - LOG("magic doesn't match"); + NSLOG(netsurf, INFO, "magic doesn't match"); return; } @@ -491,7 +497,7 @@ void ro_textarea_replace_text(uintptr_t self, unsigned int start, char *temp = realloc(ta->text, b_len + ta->text_len - (b_end - b_start) + 64); if (!temp) { - LOG("realloc failed"); + NSLOG(netsurf, INFO, "realloc failed"); return; } @@ -532,7 +538,7 @@ void ro_textarea_set_caret(uintptr_t self, unsigned int caret) ta = (struct text_area *)self; if (!ta || ta->magic != MAGIC) { - LOG("magic doesn't match"); + NSLOG(netsurf, INFO, "magic doesn't match"); return; } @@ -574,9 +580,10 @@ void ro_textarea_set_caret(uintptr_t self, unsigned int caret) b_off - ta->lines[ta->caret_pos.line].b_start, &x); if (code != rufl_OK) { if (code == rufl_FONT_MANAGER_ERROR) - LOG("rufl_width: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess); + NSLOG(netsurf, INFO, "rufl_width: 0x%x: %s", + rufl_fm_error->errnum, rufl_fm_error->errmess); else - LOG("rufl_width: 0x%x", code); + NSLOG(netsurf, INFO, "rufl_width: 0x%x", code); return; } @@ -585,7 +592,8 @@ void ro_textarea_set_caret(uintptr_t self, unsigned int caret) ta->line_height / 4 + ta->line_spacing, os_line_height.y, -1); if (error) { - LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_caret_position: 0x%x: %s", + error->errnum, error->errmess); return; } } @@ -609,7 +617,7 @@ void ro_textarea_set_caret_xy(uintptr_t self, int x, int y) ta = (struct text_area *)self; if (!ta || ta->magic != MAGIC) { - LOG("magic doesn't match"); + NSLOG(netsurf, INFO, "magic doesn't match"); return; } @@ -623,7 +631,8 @@ void ro_textarea_set_caret_xy(uintptr_t self, int x, int y) state.w = ta->window; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); return; } @@ -644,9 +653,10 @@ void ro_textarea_set_caret_xy(uintptr_t self, int x, int y) x, &b_off, &x); if (code != rufl_OK) { if (code == rufl_FONT_MANAGER_ERROR) - LOG("rufl_x_to_offset: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess); + NSLOG(netsurf, INFO, "rufl_x_to_offset: 0x%x: %s", + rufl_fm_error->errnum, rufl_fm_error->errmess); else - LOG("rufl_x_to_offset: 0x%x", code); + NSLOG(netsurf, INFO, "rufl_x_to_offset: 0x%x", code); return; } @@ -670,7 +680,7 @@ unsigned int ro_textarea_get_caret(uintptr_t self) ta = (struct text_area *)self; if (!ta || ta->magic != MAGIC) { - LOG("magic doesn't match"); + NSLOG(netsurf, INFO, "magic doesn't match"); return -1; } @@ -711,7 +721,7 @@ void ro_textarea_reflow(struct text_area *ta, unsigned int line) ta->lines = malloc(LINE_CHUNK_SIZE * sizeof(struct line_info)); if (!ta->lines) { - LOG("malloc failed"); + NSLOG(netsurf, INFO, "malloc failed"); return; } } @@ -734,9 +744,13 @@ void ro_textarea_reflow(struct text_area *ta, unsigned int line) &b_off, &x); if (code != rufl_OK) { if (code == rufl_FONT_MANAGER_ERROR) - LOG("rufl_x_to_offset: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess); + NSLOG(netsurf, INFO, + "rufl_x_to_offset: 0x%x: %s", + rufl_fm_error->errnum, + rufl_fm_error->errmess); else - LOG("rufl_x_to_offset: 0x%x", code); + NSLOG(netsurf, INFO, + "rufl_x_to_offset: 0x%x", code); return; } @@ -745,7 +759,7 @@ void ro_textarea_reflow(struct text_area *ta, unsigned int line) (line_count + LINE_CHUNK_SIZE) * sizeof(struct line_info)); if (!temp) { - LOG("realloc failed"); + NSLOG(netsurf, INFO, "realloc failed"); return; } @@ -809,7 +823,8 @@ void ro_textarea_reflow(struct text_area *ta, unsigned int line) error = xwimp_set_extent(ta->window, &extent); if (error) { - LOG("xwimp_set_extent: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s", + error->errnum, error->errmess); return; } @@ -826,7 +841,10 @@ void ro_textarea_reflow(struct text_area *ta, unsigned int line) error = xwimp_get_window_state_and_nesting(&state, &parent, &linkage); if (error) { - LOG("xwimp_get_window_state_and_nesting: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_window_state_and_nesting: 0x%x: %s", + error->errnum, + error->errmess); return; } @@ -839,7 +857,10 @@ void ro_textarea_reflow(struct text_area *ta, unsigned int line) state.w = ta->window; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_window_state: 0x%x: %s", + error->errnum, + error->errmess); return; } @@ -853,7 +874,10 @@ void ro_textarea_reflow(struct text_area *ta, unsigned int line) error = xwimp_open_window_nested(PTR_WIMP_OPEN(&state), parent, linkage); if (error) { - LOG("xwimp_open_window_nested: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_open_window_nested: 0x%x: %s", + error->errnum, + error->errmess); return; } @@ -1009,7 +1033,10 @@ bool ro_textarea_key_press(wimp_key *key) (wimp_message*)&keypress, ta->parent, ta->icon, 0); if (error) { - LOG("xwimp_send_message: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_send_message: 0x%x:%s", + error->errnum, + error->errmess); } break; } @@ -1060,7 +1087,8 @@ void ro_textarea_redraw_internal(wimp_draw *redraw, bool update) else error = xwimp_redraw_window(redraw, &more); if (error) { - LOG("xwimp_redraw_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_redraw_window: 0x%x: %s", + error->errnum, error->errmess); return; } @@ -1076,13 +1104,17 @@ void ro_textarea_redraw_internal(wimp_draw *redraw, bool update) colourtrans_SET_BG_GCOL | colourtrans_USE_ECFS_GCOL, os_ACTION_OVERWRITE, 0, 0); if (error) { - LOG("xcolourtrans_set_gcol: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xcolourtrans_set_gcol: 0x%x: %s", + error->errnum, + error->errmess); return; } error = xos_clg(); if (error) { - LOG("xos_clg: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xos_clg: 0x%x: %s", + error->errnum, error->errmess); return; } @@ -1113,7 +1145,10 @@ void ro_textarea_redraw_internal(wimp_draw *redraw, bool update) 0xD9D9D900 : 0xFFFFFF00, 0x00000000, 14, 0, 0, 0); if (error) { - LOG("xcolourtrans_set_font_colours: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xcolourtrans_set_font_colours: 0x%x: %s", + error->errnum, + error->errmess); return; } @@ -1128,15 +1163,20 @@ void ro_textarea_redraw_internal(wimp_draw *redraw, bool update) rufl_BLEND_FONT); if (code != rufl_OK) { if (code == rufl_FONT_MANAGER_ERROR) - LOG("rufl_paint: rufl_FONT_MANAGER_ERROR: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess); + NSLOG(netsurf, INFO, + "rufl_paint: rufl_FONT_MANAGER_ERROR: 0x%x: %s", + rufl_fm_error->errnum, + rufl_fm_error->errmess); else - LOG("rufl_paint: 0x%x", code); + NSLOG(netsurf, INFO, + "rufl_paint: 0x%x", code); } } error = xwimp_get_rectangle(redraw, &more); if (error) { - LOG("xwimp_get_rectangle: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_rectangle: 0x%x: %s", + error->errnum, error->errmess); return; } } @@ -1153,7 +1193,8 @@ void ro_textarea_open(wimp_open *open) error = xwimp_open_window(open); if (error) { - LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s", + error->errnum, error->errmess); return; } } diff --git a/frontends/riscos/textselection.c b/frontends/riscos/textselection.c index 5a430c06f..efec96b56 100644 --- a/frontends/riscos/textselection.c +++ b/frontends/riscos/textselection.c @@ -92,12 +92,13 @@ void gui_start_selection(struct gui_window *g) wimp_drag drag; os_error *error; - LOG("starting text_selection drag"); + NSLOG(netsurf, INFO, "starting text_selection drag"); state.w = g->window; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -111,7 +112,8 @@ void gui_start_selection(struct gui_window *g) error = xwimp_send_message(wimp_USER_MESSAGE, (wimp_message*)&msg, wimp_BROADCAST); if (error) { - LOG("xwimp_send_message: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } owns_caret_and_selection = true; @@ -127,7 +129,8 @@ void gui_start_selection(struct gui_window *g) wimp_AUTO_SCROLL_ENABLE_HORIZONTAL, &scroll, 0); if (error) - LOG("xwimp_auto_scroll: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_auto_scroll: 0x%x: %s", + error->errnum, error->errmess); ro_mouse_drag_start(ro_gui_selection_drag_end, ro_gui_window_mouse_at, NULL, g); @@ -141,7 +144,8 @@ void gui_start_selection(struct gui_window *g) error = xwimp_drag_box(&drag); if (error) { - LOG("xwimp_drag_box: 0x%x : %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_drag_box: 0x%x : %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } last_start_window = g; @@ -166,17 +170,20 @@ static void ro_gui_selection_drag_end(wimp_dragged *drag, void *data) scroll.w = g->window; error = xwimp_auto_scroll(0, &scroll, 0); if (error) - LOG("xwimp_auto_scroll: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_auto_scroll: 0x%x: %s", + error->errnum, error->errmess); error = xwimp_drag_box((wimp_drag*)-1); if (error) { - LOG("xwimp_drag_box: 0x%x : %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_drag_box: 0x%x : %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } error = xwimp_get_pointer_info(&pointer); if (error) { - LOG("xwimp_get_pointer_info 0x%x : %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_pointer_info 0x%x : %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -217,7 +224,7 @@ static void gui_set_clipboard(const char *buffer, size_t length, wimp_full_message_claim_entity msg; os_error *error; - LOG("claiming clipboard"); + NSLOG(netsurf, INFO, "claiming clipboard"); msg.size = sizeof(msg); msg.your_ref = 0; @@ -227,13 +234,14 @@ static void gui_set_clipboard(const char *buffer, size_t length, error = xwimp_send_message(wimp_USER_MESSAGE, (wimp_message*)&msg, wimp_BROADCAST); if (error) { - LOG("xwimp_send_message: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } owns_clipboard = true; } - LOG("clipboard now holds %zd bytes", clip_length); + NSLOG(netsurf, INFO, "clipboard now holds %zd bytes", clip_length); } @@ -441,7 +449,7 @@ void ro_gui_selection_claim_entity(wimp_full_message_claim_entity *claim) /* ignore our own broadcasts! */ if (claim->sender != task_handle) { - LOG("%x", claim->flags); + NSLOG(netsurf, INFO, "%x", claim->flags); if (claim->flags & wimp_CLAIM_CARET_OR_SELECTION) { owns_caret_and_selection = false; @@ -524,7 +532,8 @@ bool ro_gui_save_clipboard(const char *path) free(local_cb); if (error) { - LOG("xosfile_save_stamped: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfile_save_stamped: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("SaveError", error->errmess); return false; } @@ -606,7 +615,8 @@ void ro_gui_selection_send_dragging(wimp_pointer *pointer) { wimp_full_message_dragging dragmsg; - LOG("sending DRAGGING to %p, %d", pointer->w, pointer->i); + NSLOG(netsurf, INFO, "sending DRAGGING to %p, %d", pointer->w, + pointer->i); dragmsg.size = offsetof(wimp_full_message_dragging, file_types) + 8; dragmsg.your_ref = 0; diff --git a/frontends/riscos/theme.c b/frontends/riscos/theme.c index b0b4ab879..661beb765 100644 --- a/frontends/riscos/theme.c +++ b/frontends/riscos/theme.c @@ -364,7 +364,7 @@ bool ro_gui_theme_add_descriptor(const char *folder, const char *leafname) /* create a full filename */ filename = malloc(strlen(folder) + strlen(leafname) + 2); if (!filename) { - LOG("No memory for malloc"); + NSLOG(netsurf, INFO, "No memory for malloc"); ro_warn_user("NoMemory", 0); return false; } @@ -374,7 +374,8 @@ bool ro_gui_theme_add_descriptor(const char *folder, const char *leafname) error = xosfind_openinw(osfind_NO_PATH, filename, 0, &file_handle); if (error) { - LOG("xosfind_openinw: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfind_openinw: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("FileError", error->errmess); free(filename); return false; @@ -389,7 +390,8 @@ bool ro_gui_theme_add_descriptor(const char *folder, const char *leafname) 0, &output_left); xosfind_closew(file_handle); if (error) { - LOG("xosbgpb_read_atw: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosbgpb_read_atw: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("FileError", error->errmess); free(filename); return false; @@ -403,7 +405,7 @@ bool ro_gui_theme_add_descriptor(const char *folder, const char *leafname) current = (struct theme_descriptor *)calloc(1, sizeof(struct theme_descriptor)); if (!current) { - LOG("calloc failed"); + NSLOG(netsurf, INFO, "calloc failed"); ro_warn_user("NoMemory", 0); free(filename); return false; @@ -521,7 +523,7 @@ bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list) descriptor->theme = (struct theme *)calloc(1, sizeof(struct theme)); if (!descriptor->theme) { - LOG("calloc() failed"); + NSLOG(netsurf, INFO, "calloc() failed"); ro_warn_user("NoMemory", 0); continue; } @@ -531,7 +533,10 @@ bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list) error = xosfile_read_stamped_no_path(descriptor->filename, &obj_type, 0, 0, &file_size, 0, 0); if (error) { - LOG("xosfile_read_stamped_no_path: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosfile_read_stamped_no_path: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("FileError", error->errmess); continue; } @@ -539,7 +544,7 @@ bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list) continue; raw_data = malloc(file_size); if (!raw_data) { - LOG("malloc() failed"); + NSLOG(netsurf, INFO, "malloc() failed"); ro_warn_user("NoMemory", 0); continue; } @@ -547,7 +552,10 @@ bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list) (byte *)raw_data, 0, 0, 0, 0, 0); if (error) { free(raw_data); - LOG("xosfile_load_stamped_no_path: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosfile_load_stamped_no_path: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("FileError", error->errmess); continue; } @@ -556,7 +564,10 @@ bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list) error = xsquash_decompress_return_sizes(-1, &workspace_size, 0); if (error) { free(raw_data); - LOG("xsquash_decompress_return_sizes: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xsquash_decompress_return_sizes: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("MiscError", error->errmess); continue; } @@ -566,7 +577,7 @@ bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list) if ((!decompressed) || (!workspace)) { free(decompressed); free(raw_data); - LOG("malloc() failed"); + NSLOG(netsurf, INFO, "malloc() failed"); ro_warn_user("NoMemory", 0); continue; } @@ -581,7 +592,8 @@ bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list) free(raw_data); if (error) { free(decompressed); - LOG("xsquash_decompress: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xsquash_decompress: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("MiscError", error->errmess); continue; } @@ -599,7 +611,10 @@ bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list) descriptor->theme->sprite_area, sprite_name, 16, i, 0); if (error) { - LOG("xosspriteop_return_name: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosspriteop_return_name: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("MiscError", error->errmess); continue; } @@ -614,7 +629,10 @@ bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list) &dimensions.x, &dimensions.y, (osbool *) 0, &mode); if (error) { - LOG("xosspriteop_read_sprite_info: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosspriteop_read_sprite_info: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("MiscError", error->errmess); continue; } diff --git a/frontends/riscos/theme_install.c b/frontends/riscos/theme_install.c index 43ecb4687..fbca9e4fa 100644 --- a/frontends/riscos/theme_install.c +++ b/frontends/riscos/theme_install.c @@ -182,7 +182,7 @@ bool ro_gui_theme_install_apply(wimp_w w) /* convert spaces to hard spaces */ theme_file = strdup(theme_install_descriptor.name); if (!theme_file) { - LOG("malloc failed"); + NSLOG(netsurf, INFO, "malloc failed"); ro_warn_user("NoMemory", 0); return false; } @@ -203,7 +203,8 @@ bool ro_gui_theme_install_apply(wimp_w w) (byte *) source_data, (byte *) source_data + source_size); if (error) { - LOG("xosfile_save_stamped: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfile_save_stamped: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("ThemeInstallErr", 0); free(theme_file); return false; diff --git a/frontends/riscos/toolbar.c b/frontends/riscos/toolbar.c index 2b5cb3415..758c90cc2 100644 --- a/frontends/riscos/toolbar.c +++ b/frontends/riscos/toolbar.c @@ -227,7 +227,7 @@ struct toolbar *ro_toolbar_create(struct theme_descriptor *descriptor, toolbar = calloc(sizeof(struct toolbar), 1); if (toolbar == NULL) { - LOG("No memory for malloc()"); + NSLOG(netsurf, INFO, "No memory for malloc()"); ro_warn_user("NoMemory", 0); return NULL; } @@ -366,7 +366,8 @@ bool ro_toolbar_rebuild(struct toolbar *toolbar) old_window = toolbar->toolbar_handle; error = xwimp_delete_window(toolbar->toolbar_handle); if (error) - LOG("xwimp_delete_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x: %s", + error->errnum, error->errmess); toolbar->toolbar_handle = NULL; } @@ -375,7 +376,8 @@ bool ro_toolbar_rebuild(struct toolbar *toolbar) error = xwimp_create_window(&ro_toolbar_window, &toolbar->toolbar_handle); if (error) { - LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -493,7 +495,8 @@ bool ro_toolbar_rebuild(struct toolbar *toolbar) icon.icon.data.indirected_text.size = 1; error = xwimp_create_icon(&icon, &toolbar->editor_div1); if (error) { - LOG("xwimp_create_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_icon: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); toolbar->editor_div1 = -1; } @@ -558,7 +561,10 @@ bool ro_toolbar_attach(struct toolbar *toolbar, wimp_w parent) wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT << wimp_CHILD_TS_EDGE_SHIFT); if (error) { - LOG("xwimp_open_window_nested: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_open_window_nested: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -568,7 +574,8 @@ bool ro_toolbar_attach(struct toolbar *toolbar, wimp_w parent) error = xwimp_close_window(toolbar->toolbar_handle); if (error) { - LOG("xwimp_close_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -601,7 +608,10 @@ bool ro_toolbar_process(struct toolbar *toolbar, int width, bool reformat) outline.w = toolbar->parent_handle; error = xwimp_get_window_outline(&outline); if (error) { - LOG("xwimp_get_window_outline: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_window_outline: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -621,7 +631,10 @@ bool ro_toolbar_process(struct toolbar *toolbar, int width, bool reformat) state.w = toolbar->parent_handle; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_window_state: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -647,7 +660,10 @@ bool ro_toolbar_process(struct toolbar *toolbar, int width, bool reformat) error = xwimp_set_extent(toolbar->toolbar_handle, &extent); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_window_state: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -935,7 +951,7 @@ void ro_toolbar_destroy(struct toolbar *toolbar) if (toolbar == NULL) return; - LOG("Destroying toolbar 0x%x", (unsigned int)toolbar); + NSLOG(netsurf, INFO, "Destroying toolbar 0x%x", (unsigned int)toolbar); /* Destroy the widgets. */ @@ -994,7 +1010,8 @@ void ro_toolbar_redraw(wimp_draw *redraw) error = xwimp_redraw_window(redraw, &more); if (error) { - LOG("xwimp_redraw_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_redraw_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -1013,7 +1030,8 @@ void ro_toolbar_redraw(wimp_draw *redraw) error = xwimp_get_rectangle(redraw, &more); if (error) { - LOG("xwimp_get_rectangle: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_rectangle: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -1046,7 +1064,8 @@ bool ro_toolbar_click(wimp_pointer *pointer) state.w = toolbar->toolbar_handle; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -1325,7 +1344,8 @@ const char *ro_toolbar_get_help_suffix(wimp_w w, wimp_i i, os_coord *pos, state.w = toolbar->toolbar_handle; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return NULL; } diff --git a/frontends/riscos/ucstables.c b/frontends/riscos/ucstables.c index 8e538ef95..3e31c992e 100644 --- a/frontends/riscos/ucstables.c +++ b/frontends/riscos/ucstables.c @@ -623,7 +623,8 @@ nserror utf8_from_local_encoding(const char *string, size_t len, char **result) off - prev_off, &temp, NULL); if (err != NSERROR_OK) { assert(err != NSERROR_BAD_ENCODING); - LOG("utf8_from_enc failed"); + NSLOG(netsurf, INFO, + "utf8_from_enc failed"); free(*result); return NSERROR_NOMEM; } @@ -665,7 +666,7 @@ nserror utf8_from_local_encoding(const char *string, size_t len, char **result) &temp, NULL); if (err != NSERROR_OK) { assert(err != NSERROR_BAD_ENCODING); - LOG("utf8_from_enc failed"); + NSLOG(netsurf, INFO, "utf8_from_enc failed"); free(*result); return NSERROR_NOMEM; } @@ -680,7 +681,7 @@ nserror utf8_from_local_encoding(const char *string, size_t len, char **result) /* and copy into more reasonably-sized buffer */ temp = realloc((*result), cur_off + 1); if (!temp) { - LOG("realloc failed"); + NSLOG(netsurf, INFO, "realloc failed"); free(*result); return NSERROR_NOMEM; } diff --git a/frontends/riscos/uri.c b/frontends/riscos/uri.c index a2f126b31..d79cfe56d 100644 --- a/frontends/riscos/uri.c +++ b/frontends/riscos/uri.c @@ -120,7 +120,8 @@ void ro_uri_bounce(wimp_message *msg) /* Get required buffer size */ e = xuri_request_uri(0, NULL, 0, message->handle, &size); if (e) { - LOG("xuri_request_uri: %d: %s", e->errnum, e->errmess); + NSLOG(netsurf, INFO, "xuri_request_uri: %d: %s", e->errnum, + e->errmess); return; } @@ -131,7 +132,8 @@ void ro_uri_bounce(wimp_message *msg) /* Get URI */ e = xuri_request_uri(0, uri_buf, size, message->handle, 0); if (e) { - LOG("xuri_request_uri: %d: %s", e->errnum, e->errmess); + NSLOG(netsurf, INFO, "xuri_request_uri: %d: %s", e->errnum, + e->errmess); free(uri_buf); return; } diff --git a/frontends/riscos/url_complete.c b/frontends/riscos/url_complete.c index 16c6e3a2e..82c2d2c67 100644 --- a/frontends/riscos/url_complete.c +++ b/frontends/riscos/url_complete.c @@ -171,7 +171,8 @@ bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key) -(url_complete_matches_selection + 1) * 44, 65536, -url_complete_matches_selection * 44); if (error) { - LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_force_redraw: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -210,7 +211,10 @@ bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key) state.w = parent; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_window_state: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -228,7 +232,10 @@ bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key) error = xwimp_force_redraw(dialog_url_complete, 0, -(i + 1) * 44, 65536, -i * 44); if (error) { - LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_force_redraw: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -281,7 +288,8 @@ bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key) 0, -(old_selection + 1) * 44, 65536, -old_selection * 44); if (error) { - LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_force_redraw: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -289,7 +297,8 @@ bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key) 0, -(url_complete_matches_selection + 1) * 44, 65536, -url_complete_matches_selection * 44); if (error) { - LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_force_redraw: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -320,7 +329,8 @@ bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key) state.w = dialog_url_complete; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return true; } @@ -335,7 +345,8 @@ bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key) error = xwimp_open_window(PTR_WIMP_OPEN(&state)); if (error) { - LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return true; } @@ -411,7 +422,8 @@ void ro_gui_url_complete_resize(struct toolbar *toolbar, wimp_open *open) state.w = dialog_url_complete; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -423,13 +435,14 @@ void ro_gui_url_complete_resize(struct toolbar *toolbar, wimp_open *open) toolbar_state.w = ro_toolbar_get_window(toolbar); error = xwimp_get_window_state(&toolbar_state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } if (!ro_toolbar_get_url_field_extent(toolbar, &url_extent)) { - LOG("Failed to read URL field extent."); + NSLOG(netsurf, INFO, "Failed to read URL field extent."); return; } @@ -438,7 +451,8 @@ void ro_gui_url_complete_resize(struct toolbar *toolbar, wimp_open *open) extent.x1 = 65536; error = xwimp_set_extent(dialog_url_complete, &extent); if (error) { - LOG("xwimp_set_extent: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -460,14 +474,16 @@ void ro_gui_url_complete_resize(struct toolbar *toolbar, wimp_open *open) if (state.visible.x1 - state.visible.x0 < 0) { error = xwimp_close_window(dialog_url_complete); if (error) { - LOG("xwimp_close_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } } else { error = xwimp_open_window_nested_with_flags(&state, (wimp_w)-1, 0); if (error) { - LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -507,7 +523,8 @@ bool ro_gui_url_complete_close(void) error = xwimp_close_window(dialog_url_complete); if (error) { - LOG("xwimp_close_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -547,7 +564,7 @@ void ro_gui_url_complete_redraw(wimp_draw *redraw) /* no matches? no redraw */ if (!url_complete_matches) { - LOG("Attempt to redraw with no matches made"); + NSLOG(netsurf, INFO, "Attempt to redraw with no matches made"); /* Fill is never used, so make it something obvious */ ro_gui_user_redraw(redraw, false, os_COLOUR_BLACK); return; @@ -582,7 +599,10 @@ void ro_gui_url_complete_redraw(wimp_draw *redraw) error = xwimp_plot_icon(&url_complete_icon); if (error) { - LOG("xwimp_plot_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_plot_icon: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -604,7 +624,10 @@ void ro_gui_url_complete_redraw(wimp_draw *redraw) url_complete_sprite.extent.y0 = -(line + 1) * 44; error = xwimp_plot_icon(&url_complete_sprite); if (error) { - LOG("xwimp_plot_icon: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_plot_icon: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -658,7 +681,8 @@ bool ro_gui_url_complete_click(wimp_pointer *pointer) state.w = dialog_url_complete; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -685,14 +709,16 @@ bool ro_gui_url_complete_click(wimp_pointer *pointer) 0, -(old_selection + 1) * 44, 65536, -old_selection * 44); if (error) { - LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_force_redraw: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } error = xwimp_force_redraw(dialog_url_complete, 0, -(url_complete_matches_selection + 1) * 44, 65536, -url_complete_matches_selection * 44); if (error) { - LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_force_redraw: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } } diff --git a/frontends/riscos/url_protocol.c b/frontends/riscos/url_protocol.c index 9a7ae062c..184aaeab0 100644 --- a/frontends/riscos/url_protocol.c +++ b/frontends/riscos/url_protocol.c @@ -75,17 +75,19 @@ void ro_url_message_received(wimp_message *message) } else { if (!url_message->indirect.url.offset) { - LOG("no URL in message"); + NSLOG(netsurf, INFO, "no URL in message"); return; } if (28 < message->size && url_message->indirect.body_file.offset) { - LOG("POST for URL message not implemented"); + NSLOG(netsurf, INFO, + "POST for URL message not implemented"); return; } if (url_message->indirect.url.offset < 28 || 236 <= url_message->indirect.url.offset) { - LOG("external pointers in URL message unimplemented"); + NSLOG(netsurf, INFO, + "external pointers in URL message unimplemented"); /* these messages have never been seen in the wild, * and there is the problem of invalid addresses which * would cause an abort */ @@ -122,7 +124,8 @@ void ro_url_message_received(wimp_message *message) error = xwimp_send_message(wimp_USER_MESSAGE_ACKNOWLEDGE, message, message->sender); if (error) { - LOG("xwimp_send_message: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -165,7 +168,8 @@ void ro_url_broadcast(const char *url) error = xwimp_send_message(wimp_USER_MESSAGE_RECORDED, (wimp_message *) &message, 0); if (error) { - LOG("xwimp_send_message: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -184,7 +188,7 @@ void ro_url_load(const char *url) colon = strchr(url, ':'); if (!colon) { - LOG("invalid url '%s'", url); + NSLOG(netsurf, INFO, "invalid url '%s'", url); return; } @@ -204,7 +208,8 @@ void ro_url_load(const char *url) error = xwimp_start_task(command, 0); if (error) { - LOG("xwimp_start_task: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_start_task: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } diff --git a/frontends/riscos/wimp.c b/frontends/riscos/wimp.c index abf099a55..d851ab59e 100644 --- a/frontends/riscos/wimp.c +++ b/frontends/riscos/wimp.c @@ -103,7 +103,10 @@ void ro_gui_wimp_cache_furniture_sizes(wimp_w w) furniture_sizes.border_widths.x1 = 40; error = xwimpextend_get_furniture_sizes(&furniture_sizes); if (error) { - LOG("xwimpextend_get_furniture_sizes: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimpextend_get_furniture_sizes: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -123,13 +126,15 @@ bool ro_gui_wimp_read_eig_factors(os_mode mode, int *xeig, int *yeig) error = xos_read_mode_variable(mode, os_MODEVAR_XEIG_FACTOR, xeig, 0); if (error) { - LOG("xos_read_mode_variable: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xos_read_mode_variable: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("MiscError", error->errmess); return false; } error = xos_read_mode_variable(mode, os_MODEVAR_YEIG_FACTOR, yeig, 0); if (error) { - LOG("xos_read_mode_variable: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xos_read_mode_variable: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("MiscError", error->errmess); return false; } @@ -196,14 +201,16 @@ void ro_gui_force_redraw_icon(wimp_w w, wimp_i i) ic.i = i; error = xwimp_get_icon_state(&ic); if (error) { - LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } error = xwimp_force_redraw(w, ic.icon.extent.x0, ic.icon.extent.y0, ic.icon.extent.x1, ic.icon.extent.y1); if (error) { - LOG("xwimp_force_redraw: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_force_redraw: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -235,7 +242,8 @@ const char *ro_gui_get_icon_string(wimp_w w, wimp_i i) ic.i = i; error = xwimp_get_icon_state(&ic); if (error) { - LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return NULL; } @@ -277,7 +285,7 @@ void ro_gui_set_icon_string(wimp_w w, wimp_i i, const char *text, bool is_utf8) if (err != NSERROR_OK) { /* A bad encoding should never happen, so assert this */ assert(err != NSERROR_BAD_ENCODING); - LOG("utf8_to_enc failed"); + NSLOG(netsurf, INFO, "utf8_to_enc failed"); /* Paranoia */ local_text = NULL; } @@ -292,7 +300,8 @@ void ro_gui_set_icon_string(wimp_w w, wimp_i i, const char *text, bool is_utf8) ic.i = i; error = xwimp_get_icon_state(&ic); if (error) { - LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); goto exit; } @@ -325,7 +334,10 @@ void ro_gui_set_icon_string(wimp_w w, wimp_i i, const char *text, bool is_utf8) (button_type == wimp_BUTTON_WRITE_CLICK_DRAG)) { error = xwimp_get_caret_position(&caret); if (error) { - LOG("xwimp_get_caret_position: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_caret_position: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); goto exit; } @@ -336,7 +348,10 @@ void ro_gui_set_icon_string(wimp_w w, wimp_i i, const char *text, bool is_utf8) error = xwimp_set_caret_position(w, i, caret.pos.x, caret.pos.y, -1, caret.index); if (error) { - LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_set_caret_position: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -433,7 +448,8 @@ void ro_gui_set_icon_selected_state(wimp_w w, wimp_i i, bool state) error = xwimp_set_icon_state(w, i, (state ? wimp_ICON_SELECTED : 0), wimp_ICON_SELECTED); if (error) { - LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -452,7 +468,8 @@ bool ro_gui_get_icon_selected_state(wimp_w w, wimp_i i) ic.i = i; error = xwimp_get_icon_state(&ic); if (error) { - LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -478,7 +495,8 @@ void ro_gui_set_icon_shaded_state(wimp_w w, wimp_i i, bool state) error = xwimp_set_icon_state(w, i, (state ? wimp_ICON_SHADED : 0), wimp_ICON_SHADED); if (error) { - LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } if (!state) @@ -487,7 +505,8 @@ void ro_gui_set_icon_shaded_state(wimp_w w, wimp_i i, bool state) /* ensure the caret is not in a shaded icon */ error = xwimp_get_caret_position(&caret); if (error) { - LOG("xwimp_get_caret_position: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_caret_position: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -499,7 +518,8 @@ void ro_gui_set_icon_shaded_state(wimp_w w, wimp_i i, bool state) /* lose the caret */ error = xwimp_set_caret_position((wimp_w)-1, (wimp_i)-1, -1, -1, -1, -1); if (error) { - LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_caret_position: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -540,7 +560,8 @@ void ro_gui_set_icon_deleted_state(wimp_w w, wimp_i i, bool state) error = xwimp_set_icon_state(w, i, (state ? wimp_ICON_DELETED : 0), wimp_ICON_DELETED); if (error) { - LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } if (!state) @@ -549,7 +570,8 @@ void ro_gui_set_icon_deleted_state(wimp_w w, wimp_i i, bool state) /* ensure the caret is not in a shaded icon */ error = xwimp_get_caret_position(&caret); if (error) { - LOG("xwimp_get_caret_position: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_caret_position: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -561,7 +583,8 @@ void ro_gui_set_icon_deleted_state(wimp_w w, wimp_i i, bool state) /* lose the caret */ error = xwimp_set_caret_position((wimp_w)-1, (wimp_i)-1, -1, -1, -1, -1); if (error) { - LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_caret_position: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -597,7 +620,8 @@ void ro_gui_set_icon_button_type(wimp_w w, wimp_i i, int type) error = xwimp_set_icon_state(w, i, wimp_ICON_BUTTON_TYPE, (type << wimp_ICON_BUTTON_TYPE_SHIFT)); if (error) { - LOG("xwimp_set_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -622,7 +646,8 @@ void ro_gui_set_icon_sprite(wimp_w w, wimp_i i, osspriteop_area *area, ic.i = i; error = xwimp_get_icon_state(&ic); if (error) { - LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -659,7 +684,8 @@ void ro_gui_set_window_title(wimp_w w, const char *text) window.w = w; error = xwimp_get_window_info_header_only((wimp_window_info *)&window); if (error) { - LOG("xwimp_get_window_info: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_info: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -670,7 +696,7 @@ void ro_gui_set_window_title(wimp_w w, const char *text) /* A bad encoding should never happen, * so assert this */ assert(err != NSERROR_BAD_ENCODING); - LOG("utf8_to_enc failed"); + NSLOG(netsurf, INFO, "utf8_to_enc failed"); return; } @@ -686,7 +712,8 @@ void ro_gui_set_window_title(wimp_w w, const char *text) */ error = xwimp_force_redraw_title(w); if (error) { - LOG("xwimp_force_redraw_title: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_force_redraw_title: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -713,7 +740,8 @@ bool ro_gui_set_caret_first(wimp_w w) win_state.w = w; error = xwimp_get_window_state(&win_state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -724,7 +752,8 @@ bool ro_gui_set_caret_first(wimp_w w) window.w = w; error = xwimp_get_window_info_header_only((wimp_window_info *)&window); if (error) { - LOG("xwimp_get_window_info: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_info: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -735,7 +764,10 @@ bool ro_gui_set_caret_first(wimp_w w) state.i = icon; error = xwimp_get_icon_state(&state); if (error) { - LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_icon_state: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -752,7 +784,10 @@ bool ro_gui_set_caret_first(wimp_w w) error = xwimp_set_caret_position(w, icon, 0, 0, -1, strlen(state.icon.data.indirected_text.text)); if (error) { - LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_set_caret_position: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } return true; @@ -778,7 +813,10 @@ osspriteop_area *ro_gui_load_sprite_file(const char *pathname) error = xosfile_read_stamped_no_path(pathname, &obj_type, 0, 0, &len, 0, 0); if (error) { - LOG("xosfile_read_stamped_no_path: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosfile_read_stamped_no_path: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("MiscError", error->errmess); return 0; } @@ -801,7 +839,10 @@ osspriteop_area *ro_gui_load_sprite_file(const char *pathname) error = xosspriteop_load_sprite_file(osspriteop_USER_AREA, area, pathname); if (error) { - LOG("xosspriteop_load_sprite_file: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosspriteop_load_sprite_file: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("MiscError", error->errmess); free(area); return 0; @@ -831,7 +872,10 @@ bool ro_gui_wimp_sprite_exists(const char *sprite) error = xwimpspriteop_select_sprite(sprite, 0); if (error) { if (error->errnum != error_SPRITE_OP_DOESNT_EXIST) { - LOG("xwimpspriteop_select_sprite: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimpspriteop_select_sprite: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("MiscError", error->errmess); } return false; @@ -904,7 +948,10 @@ bool ro_gui_wimp_get_sprite_dimensions(osspriteop_area *area, char *sprite, if (height != NULL) *height = dimensions.y; } else if (error->errnum != error_SPRITE_OP_DOESNT_EXIST) { - LOG("xosspriteop_read_sprite_info: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosspriteop_read_sprite_info: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("MiscError", error->errmess); return false; } @@ -929,7 +976,8 @@ void ro_gui_user_redraw(wimp_draw *redraw, bool user_fill, error = xwimp_redraw_window(redraw, &more); if (error) { - LOG("xwimp_redraw_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_redraw_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -939,14 +987,18 @@ void ro_gui_user_redraw(wimp_draw *redraw, bool user_fill, colourtrans_SET_BG_GCOL, os_ACTION_OVERWRITE, 0, 0); if (error) { - LOG("xcolourtrans_set_gcol: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xcolourtrans_set_gcol: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("MiscError", error->errmess); } os_clg(); } error = xwimp_get_rectangle(redraw, &more); if (error) { - LOG("xwimp_get_rectangle: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_rectangle: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -973,7 +1025,8 @@ void ro_gui_wimp_update_window_furniture(wimp_w w, wimp_window_flags bic_mask, state.w = w; error = xwimp_get_window_state_and_nesting(&state, &parent, &linkage); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -986,7 +1039,8 @@ void ro_gui_wimp_update_window_furniture(wimp_w w, wimp_window_flags bic_mask, state.next = wimp_HIDDEN; error = xwimp_open_window_nested_with_flags(&state, parent, linkage); if (error) { - LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -994,7 +1048,8 @@ void ro_gui_wimp_update_window_furniture(wimp_w w, wimp_window_flags bic_mask, if (!open) { error = xwimp_close_window(w); if (error) { - LOG("xwimp_close_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -1016,7 +1071,8 @@ bool ro_gui_wimp_check_window_furniture(wimp_w w, wimp_window_flags mask) state.w = w; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -1116,7 +1172,8 @@ void ro_gui_scroll(wimp_scroll *scroll) error = xwimp_open_window((wimp_open *) scroll); if (error) { - LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s", + error->errnum, error->errmess); } } diff --git a/frontends/riscos/wimp_event.c b/frontends/riscos/wimp_event.c index 015e87baf..cdca470da 100644 --- a/frontends/riscos/wimp_event.c +++ b/frontends/riscos/wimp_event.c @@ -156,7 +156,9 @@ bool ro_gui_wimp_event_memorise(wimp_w w) ro_gui_get_icon_string(window->w, event->i)); if (!event->previous_value.textual) { error = true; - LOG("Unable to store state for icon %i", event->i); + NSLOG(netsurf, INFO, + "Unable to store state for icon %i", + event->i); } break; case EVENT_CHECKBOX: @@ -267,7 +269,10 @@ bool ro_gui_wimp_event_transfer(wimp_w from, wimp_w to) struct event_window *window; int h; - LOG("Transferring all events from window 0x%x to window 0x%x", (unsigned int)from, (unsigned int)to); + NSLOG(netsurf, INFO, + "Transferring all events from window 0x%x to window 0x%x", + (unsigned int)from, + (unsigned int)to); window = ro_gui_wimp_event_remove_window(from); if (window == NULL || window->w != from) @@ -293,7 +298,8 @@ void ro_gui_wimp_event_finalise(wimp_w w) struct event_window *window; struct icon_event *event; - LOG("Removing all events for window 0x%x", (unsigned int)w); + NSLOG(netsurf, INFO, "Removing all events for window 0x%x", + (unsigned int)w); window = ro_gui_wimp_event_remove_window(w); if (!window) return; @@ -330,7 +336,8 @@ void ro_gui_wimp_event_deregister(wimp_w w, wimp_i i) struct event_window *window; struct icon_event *event, *parent, *child; - LOG("Removing all events for window 0x%x, icon %d", (unsigned int)w, (int)i); + NSLOG(netsurf, INFO, "Removing all events for window 0x%x, icon %d", + (unsigned int)w, (int)i); window = ro_gui_wimp_event_get_window(w); if (!window) return; @@ -344,7 +351,8 @@ void ro_gui_wimp_event_deregister(wimp_w w, wimp_i i) child = event->next; if (event->i == i) { - LOG("Removing event 0x%x", (unsigned int)event); + NSLOG(netsurf, INFO, "Removing event 0x%x", + (unsigned int)event); if (parent == NULL) window->first = child; @@ -576,7 +584,8 @@ bool ro_gui_wimp_event_menu_selection(wimp_w w, wimp_i i, wimp_menu *menu, ic.i = event->data.menu_gright.field; error = xwimp_get_icon_state(&ic); if (error) { - LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -586,7 +595,8 @@ bool ro_gui_wimp_event_menu_selection(wimp_w w, wimp_i i, wimp_menu *menu, return prepared; error = xwimp_get_caret_position(&caret); if (error) { - LOG("xwimp_get_caret_position: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_caret_position: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -594,7 +604,10 @@ bool ro_gui_wimp_event_menu_selection(wimp_w w, wimp_i i, wimp_menu *menu, error = xwimp_set_caret_position(window->w, event->data.menu_gright.field, -1, -1, -1, strlen(menu_entry->data.indirected_text.text)); if (error) { - LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_set_caret_position: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -666,7 +679,7 @@ bool ro_gui_wimp_event_mouse_click(wimp_pointer *pointer) for (search = window->first; search; search = search->next) if (search->i == event->data.linked_icon) break; if (!search) { - LOG("Incorrect reference."); + NSLOG(netsurf, INFO, "Incorrect reference."); return false; } stepping = search->data.numeric_field.stepping; @@ -703,13 +716,19 @@ bool ro_gui_wimp_event_mouse_click(wimp_pointer *pointer) open.w = pointer->w; error = xwimp_get_window_state(&open); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_window_state: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); return false; } error = xwimp_get_caret_position(&caret); if (error) { - LOG("xwimp_get_caret_position: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_caret_position: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -718,7 +737,10 @@ bool ro_gui_wimp_event_mouse_click(wimp_pointer *pointer) ro_gui_menu_destroy(); error = xwimp_open_window(PTR_WIMP_OPEN(&open)); if (error) { - LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_open_window: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -728,7 +750,10 @@ bool ro_gui_wimp_event_mouse_click(wimp_pointer *pointer) caret.pos.x, caret.pos.y, -1, caret.index); if (error) { - LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_set_caret_position: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -796,7 +821,8 @@ void ro_gui_wimp_event_prepare_gright_menu(wimp_w w, struct icon_event *event) ic.i = event->data.menu_gright.field; error = xwimp_get_icon_state(&ic); if (error) { - LOG("xwimp_get_icon_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_icon_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -903,7 +929,8 @@ bool ro_gui_wimp_event_keypress(wimp_key *key) */ error = xosbyte1(osbyte_ALPHABET_NUMBER, 127, 0, &t_alphabet); if (error) { - LOG("failed reading alphabet: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "failed reading alphabet: 0x%x: %s", + error->errnum, error->errmess); /* prevent any corruption of ucstable */ t_alphabet = alphabet; } @@ -917,7 +944,10 @@ bool ro_gui_wimp_event_keypress(wimp_key *key) error = xserviceinternational_get_ucs_conversion_table( alphabet, &unclaimed, &ostable); if (error != NULL) { - LOG("failed reading UCS conversion table: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "failed reading UCS conversion table: 0x%x: %s", + error->errnum, + error->errmess); /* Try using our own table instead */ ucstable = ucstable_from_alphabet(alphabet); } else if (unclaimed) { @@ -974,7 +1004,9 @@ bool ro_gui_wimp_event_keypress(wimp_key *key) /* If this ever happens, * RISC OS' UTF8 keyboard * drivers are broken */ - LOG("unexpected UTF8 start"" byte %x (ignoring)", c); + NSLOG(netsurf, INFO, + "unexpected UTF8 start"" byte %x (ignoring)", + c); return true; } /* Anything else is ASCII, so just @@ -985,7 +1017,9 @@ bool ro_gui_wimp_event_keypress(wimp_key *key) /* If this ever happens, * RISC OS' UTF8 keyboard * drivers are broken */ - LOG("unexpected keycode: ""%x (ignoring)", c); + NSLOG(netsurf, INFO, + "unexpected keycode: ""%x (ignoring)", + c); return true; } @@ -1074,7 +1108,8 @@ bool ro_gui_wimp_event_close_window(wimp_w w) { struct event_window *window; - LOG("Close event received for window 0x%x", (unsigned int)w); + NSLOG(netsurf, INFO, "Close event received for window 0x%x", + (unsigned int)w); if (w == ro_gui_wimp_event_submenu) ro_gui_wimp_event_submenu = 0; window = ro_gui_wimp_event_find_window(w); @@ -1615,7 +1650,8 @@ struct event_window *ro_gui_wimp_event_get_window(wimp_w w) if (window) return window; - LOG("Creating structure for window 0x%x", (unsigned int)w); + NSLOG(netsurf, INFO, "Creating structure for window 0x%x", + (unsigned int)w); window = calloc(1, sizeof(struct event_window)); if (!window) return NULL; diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c index 6dbcc325b..986e5c55d 100644 --- a/frontends/riscos/window.c +++ b/frontends/riscos/window.c @@ -206,7 +206,8 @@ gui_window_place_caret(struct gui_window *g, error = xwimp_set_caret_position(g->window, -1, x * 2, -(y + height) * 2, height * 2, -1); if (error) { - LOG("xwimp_set_caret_position: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_caret_position: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } } @@ -235,7 +236,10 @@ static void gui_window_set_extent(struct gui_window *g, int width, int height) state.w = g->window; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_window_state: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -266,7 +270,8 @@ static void gui_window_set_extent(struct gui_window *g, int width, int height) os_box extent = { 0, -height, width, toolbar_height }; error = xwimp_set_extent(g->window, &extent); if (error) { - LOG("xwimp_set_extent: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -309,7 +314,8 @@ static void ro_gui_window_open(wimp_open *open) state.w = g->window; error = xwimp_get_window_state_and_nesting(&state, &parent, &linkage); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -414,7 +420,8 @@ static void ro_gui_window_open(wimp_open *open) error = xwimp_open_window_nested_with_flags(&state, parent, linkage); if (error) { - LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -453,8 +460,10 @@ static void gui_window_update_extent(struct gui_window *g) info.w = g->window; error = xwimp_get_window_info_header_only(&info); if (error) { - LOG("xwimp_get_window_info_header_only: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_window_info_header_only: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -1046,7 +1055,8 @@ ro_gui_window_scroll_action(struct gui_window *g, state.w = g->window; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); return; } @@ -1060,7 +1070,8 @@ ro_gui_window_scroll_action(struct gui_window *g, error = xwimp_get_pointer_info(&pointer); if (error) { - LOG("xwimp_get_pointer_info 0x%x : %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_pointer_info 0x%x : %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -1180,7 +1191,8 @@ ro_gui_window_scroll_action(struct gui_window *g, error = xwimp_open_window((wimp_open *) &state); if (error) { - LOG("xwimp_open_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s", + error->errnum, error->errmess); } } } @@ -1218,7 +1230,8 @@ ro_gui_window_handle_local_keypress(struct gui_window *g, ro_error = xwimp_get_pointer_info(&pointer); if (ro_error) { - LOG("xwimp_get_pointer_info: 0x%x: %s\n", ro_error->errnum, ro_error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s\n", + ro_error->errnum, ro_error->errmess); ro_warn_user("WimpError", ro_error->errmess); return false; } @@ -1528,8 +1541,8 @@ static void ro_gui_window_close(wimp_w w) error = xwimp_get_pointer_info(&pointer); if (error) { - LOG("xwimp_get_pointer_info: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -1559,7 +1572,10 @@ static void ro_gui_window_close(wimp_w w) } error = xos_cli(temp_name); if (error) { - LOG("xos_cli: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xos_cli: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("MiscError", error->errmess); return; } @@ -1611,7 +1627,8 @@ static void ro_gui_window_redraw(wimp_draw *redraw) error = xwimp_redraw_window(redraw, &more); if (error) { - LOG("xwimp_redraw_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_redraw_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -1653,7 +1670,8 @@ static void ro_gui_window_redraw(wimp_draw *redraw) if (error && !(ro_gui_current_redraw_gui-> option.buffer_everything && error->errnum == error_WIMP_GET_RECT)) { - LOG("xwimp_get_rectangle: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_rectangle: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); ro_gui_current_redraw_gui = NULL; return; @@ -1971,7 +1989,7 @@ ro_gui_window_prepare_form_select_menu(struct gui_window *g, if (err != NSERROR_OK) { /* badenc should never happen */ assert(err != NSERROR_BAD_ENCODING); - LOG("utf8_to_local_encoding failed"); + NSLOG(netsurf, INFO, "utf8_to_local_encoding failed"); ro_warn_user("NoMemory", 0); ro_gui_menu_destroy(); return false; @@ -1997,7 +2015,7 @@ ro_gui_window_prepare_form_select_menu(struct gui_window *g, temp = cnv_space2nbsp(option->text); if (!temp) { - LOG("cnv_space2nbsp failed"); + NSLOG(netsurf, INFO, "cnv_space2nbsp failed"); ro_warn_user("NoMemory", 0); ro_gui_menu_destroy(); return false; @@ -2009,7 +2027,7 @@ ro_gui_window_prepare_form_select_menu(struct gui_window *g, /* A bad encoding should never happen, * so assert this */ assert(err != NSERROR_BAD_ENCODING); - LOG("utf8_to_enc failed"); + NSLOG(netsurf, INFO, "utf8_to_enc failed"); ro_warn_user("NoMemory", 0); ro_gui_menu_destroy(); return false; @@ -2831,7 +2849,10 @@ ro_gui_window_menu_select(wimp_w w, state.w = w; oserror = xwimp_get_window_state(&state); if (oserror) { - LOG("xwimp_get_window_state: 0x%x: %s", oserror->errnum, oserror->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_window_state: 0x%x: %s", + oserror->errnum, + oserror->errmess); ro_warn_user("WimpError", oserror->errmess); } nsoption_set_int(window_x, state.visible.x0); @@ -3209,7 +3230,10 @@ static struct gui_window *gui_window_create(struct browser_window *bw, state.w = existing->window; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_window_state: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } window.visible.x0 = state.visible.x0; @@ -3313,7 +3337,8 @@ static struct gui_window *gui_window_create(struct browser_window *bw, error = xwimp_create_window(&window, &g->window); if (error) { - LOG("xwimp_create_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); free(g); return 0; @@ -3382,8 +3407,8 @@ static struct gui_window *gui_window_create(struct browser_window *bw, state.w = g->window; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return g; } @@ -3459,7 +3484,8 @@ static void gui_window_destroy(struct gui_window *g) /* delete window */ error = xwimp_delete_window(w); if (error) { - LOG("xwimp_delete_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } ro_gui_wimp_event_finalise(w); @@ -3515,7 +3541,8 @@ static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy) state.w = g->window; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -3550,8 +3577,8 @@ gui_window_set_scroll(struct gui_window *g, const struct rect *rect) state.w = g->window; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return NSERROR_BAD_PARAMETER; } @@ -3731,8 +3758,8 @@ static void gui_window_remove_caret(struct gui_window *g) error = xwimp_get_caret_position(&caret); if (error) { - LOG("xwimp_get_caret_position: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_caret_position: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } @@ -3776,20 +3803,25 @@ static void ro_gui_window_scroll_end(wimp_dragged *drag, void *data) error = xwimp_drag_box((wimp_drag*)-1); if (error) { - LOG("xwimp_drag_box: 0x%x : %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_drag_box: 0x%x : %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } error = xwimp_get_pointer_info(&pointer); if (error) { - LOG("xwimp_get_pointer_info 0x%x : %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_pointer_info 0x%x : %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return; } error = xwimpspriteop_set_pointer_shape("ptr_default", 0x31, 0, 0, 0, 0); if (error) { - LOG("xwimpspriteop_set_pointer_shape: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimpspriteop_set_pointer_shape: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -3814,7 +3846,8 @@ static bool gui_window_scroll_start(struct gui_window *g) error = xwimp_get_pointer_info(&pointer); if (error) { - LOG("xwimp_get_pointer_info 0x%x : %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_pointer_info 0x%x : %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -3822,7 +3855,8 @@ static bool gui_window_scroll_start(struct gui_window *g) info.w = g->window; error = xwimp_get_window_info_header_only((wimp_window_info*)&info); if (error) { - LOG("xwimp_get_window_state: 0x%x : %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x : %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -3844,7 +3878,8 @@ static bool gui_window_scroll_start(struct gui_window *g) error = xwimp_drag_box(&drag); if (error) { - LOG("xwimp_drag_box: 0x%x : %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_drag_box: 0x%x : %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -3876,7 +3911,10 @@ gui_window_drag_start(struct gui_window *g, * duration */ os_error *error = xwimp_get_pointer_info(&pointer); if (error) { - LOG("xwimp_get_pointer_info 0x%x : %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_pointer_info 0x%x : %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -3893,7 +3931,8 @@ gui_window_drag_start(struct gui_window *g, error = xwimp_drag_box(&drag); if (error) { - LOG("xwimp_drag_box: 0x%x : %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_drag_box: 0x%x : %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -3955,7 +3994,8 @@ gui_window_create_form_select_menu(struct gui_window *g, error = xwimp_get_pointer_info(&pointer); if (error) { - LOG("xwimp_get_pointer_info: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_pointer_info: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); ro_gui_menu_destroy(); return; @@ -3988,7 +4028,8 @@ ro_gui_window_import_text(struct gui_window *g, const char *filename) error = xosfile_read_stamped(filename, &obj_type, NULL, NULL, &size, NULL, NULL); if (error) { - LOG("xosfile_read_stamped: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfile_read_stamped: 0x%x:%s", + error->errnum, error->errmess); ro_warn_user("FileError", error->errmess); return true; /* was for us, but it didn't work! */ } @@ -4007,7 +4048,8 @@ ro_gui_window_import_text(struct gui_window *g, const char *filename) NULL, NULL, NULL, NULL, NULL); if (error) { - LOG("xosfile_load_stamped: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosfile_load_stamped: 0x%x:%s", + error->errnum, error->errmess); ro_warn_user("LoadError", error->errmess); free(buf); return true; @@ -4017,7 +4059,7 @@ ro_gui_window_import_text(struct gui_window *g, const char *filename) if (ret != NSERROR_OK) { /* bad encoding shouldn't happen */ assert(ret != NSERROR_BAD_ENCODING); - LOG("utf8_from_local_encoding failed"); + NSLOG(netsurf, INFO, "utf8_from_local_encoding failed"); free(buf); ro_warn_user("NoMemory", NULL); return true; @@ -4206,8 +4248,10 @@ ro_gui_window_invalidate_area(struct gui_window *g, const struct rect *rect) info.w = g->window; error = xwimp_get_window_info_header_only(&info); if (error) { - LOG("xwimp_get_window_info_header_only: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_window_info_header_only: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); return NSERROR_INVALID; } @@ -4216,8 +4260,8 @@ ro_gui_window_invalidate_area(struct gui_window *g, const struct rect *rect) info.extent.x0, info.extent.y0, info.extent.x1, info.extent.y1); if (error) { - LOG("xwimp_force_redraw: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_force_redraw: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return NSERROR_INVALID; } @@ -4251,7 +4295,7 @@ ro_gui_window_invalidate_area(struct gui_window *g, const struct rect *rect) } cur = malloc(sizeof(struct update_box)); if (!cur) { - LOG("No memory for malloc."); + NSLOG(netsurf, INFO, "No memory for malloc."); return NSERROR_NOMEM; } @@ -4323,7 +4367,8 @@ bool ro_gui_window_dataload(struct gui_window *g, wimp_message *message) message->your_ref = message->my_ref; error = xwimp_send_message(wimp_USER_MESSAGE, message, message->sender); if (error) { - LOG("xwimp_send_message: 0x%x: %s\n", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x: %s\n", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } @@ -4375,12 +4420,14 @@ ro_gui_window_iconise(struct gui_window *g, wimp_full_message_window_info *wi) (osspriteop_id)overlay, &width, &height, NULL, NULL); if (error) { - LOG("xosspriteop_read_sprite_info: 0x%x: %s", - error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosspriteop_read_sprite_info: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("MiscError", error->errmess); overlay = NULL; } else if (sprite_bpp(overlay) != 8) { - LOG("overlay sprite is not 8bpp"); + NSLOG(netsurf, INFO, "overlay sprite is not 8bpp"); overlay = NULL; } } @@ -4389,7 +4436,7 @@ ro_gui_window_iconise(struct gui_window *g, wimp_full_message_window_info *wi) bitmap = riscos_bitmap_create(width, height, BITMAP_NEW | BITMAP_OPAQUE | BITMAP_CLEAR_MEMORY); if (!bitmap) { - LOG("Thumbnail initialisation failed."); + NSLOG(netsurf, INFO, "Thumbnail initialisation failed."); return; } riscos_bitmap_render(bitmap, h); @@ -4399,7 +4446,7 @@ ro_gui_window_iconise(struct gui_window *g, wimp_full_message_window_info *wi) area = riscos_bitmap_convert_8bpp(bitmap); riscos_bitmap_destroy(bitmap); if (!area) { - LOG("Thumbnail conversion failed."); + NSLOG(netsurf, INFO, "Thumbnail conversion failed."); return; } @@ -4420,7 +4467,8 @@ ro_gui_window_iconise(struct gui_window *g, wimp_full_message_window_info *wi) error = xosspriteop_save_sprite_file(osspriteop_USER_AREA, area, temp_fname); if (error) { - LOG("xosspriteop_save_sprite_file: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xosspriteop_save_sprite_file: 0x%x:%s", + error->errnum, error->errmess); ro_warn_user("MiscError", error->errmess); free(area); return; @@ -4428,7 +4476,10 @@ ro_gui_window_iconise(struct gui_window *g, wimp_full_message_window_info *wi) error = xwimpspriteop_merge_sprite_file(temp_fname); if (error) { - LOG("xwimpspriteop_merge_sprite_file: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimpspriteop_merge_sprite_file: 0x%x:%s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); remove(temp_fname); free(area); @@ -4453,7 +4504,8 @@ ro_gui_window_iconise(struct gui_window *g, wimp_full_message_window_info *wi) error = xwimp_send_message(wimp_USER_MESSAGE, (wimp_message*)wi, wi->sender); if (error) { - LOG("xwimp_send_message: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_send_message: 0x%x:%s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); } else { @@ -4479,7 +4531,10 @@ bool ro_gui_toolbar_dataload(struct gui_window *g, wimp_message *message) error = xwimp_send_message(wimp_USER_MESSAGE, message, message->sender); if (error) { - LOG("xwimp_send_message: 0x%x: %s\n", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_send_message: 0x%x: %s\n", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } return true; @@ -4536,7 +4591,8 @@ void ro_gui_window_update_boxes(void) error = xwimp_update_window(&update, &more); if (error) { - LOG("xwimp_update_window: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_update_window: 0x%x: %s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); continue; } @@ -4569,7 +4625,10 @@ void ro_gui_window_update_boxes(void) * found. This appears to be a bug in RISC OS. */ if (error && !(use_buffer && error->errnum == error_WIMP_GET_RECT)) { - LOG("xwimp_get_rectangle: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimp_get_rectangle: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); ro_gui_current_redraw_gui = NULL; continue; @@ -4685,7 +4744,8 @@ ro_gui_window_to_window_pos(struct gui_window *g, int x, int y, os_coord *pos) state.w = g->window; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x:%s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -4709,7 +4769,8 @@ bool ro_gui_window_to_screen_pos(struct gui_window *g, state.w = g->window; error = xwimp_get_window_state(&state); if (error) { - LOG("xwimp_get_window_state: 0x%x:%s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x:%s", + error->errnum, error->errmess); ro_warn_user("WimpError", error->errmess); return false; } @@ -4913,7 +4974,10 @@ void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape) error = xwimpspriteop_set_pointer_shape(entry->sprite_name, 1, entry->xactive, entry->yactive, 0, 0); if (error) { - LOG("xwimpspriteop_set_pointer_shape: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xwimpspriteop_set_pointer_shape: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } } else { @@ -4923,7 +4987,10 @@ void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape) (osspriteop_id) entry->sprite_name, 1, entry->xactive, entry->yactive, 0, 0); if (error) { - LOG("xosspriteop_set_pointer_shape: 0x%x: %s", error->errnum, error->errmess); + NSLOG(netsurf, INFO, + "xosspriteop_set_pointer_shape: 0x%x: %s", + error->errnum, + error->errmess); ro_warn_user("WimpError", error->errmess); } } diff --git a/frontends/windows/about.c b/frontends/windows/about.c index 65c81cd7d..2cd855b55 100644 --- a/frontends/windows/about.c +++ b/frontends/windows/about.c @@ -52,7 +52,7 @@ static BOOL init_about_dialog(HWND hwnd) hFont=CreateFont (26, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, "Arial"); if (hFont != NULL) { - LOG("Setting font object"); + NSLOG(netsurf, INFO, "Setting font object"); SendMessage(dlg_itm, WM_SETFONT, (WPARAM)hFont, 0); } @@ -85,7 +85,7 @@ static BOOL destroy_about_dialog(HWND hwnd) if (dlg_itm != NULL) { hFont = (HFONT)SendMessage(dlg_itm, WM_GETFONT, 0, 0); if (hFont != NULL) { - LOG("Destroyed font object"); + NSLOG(netsurf, INFO, "Destroyed font object"); DeleteObject(hFont); } } @@ -107,12 +107,12 @@ nsws_about_event_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) case WM_COMMAND: switch(LOWORD(wparam)) { case IDOK: - LOG("OK clicked"); + NSLOG(netsurf, INFO, "OK clicked"); EndDialog(hwnd, IDOK); break; case IDCANCEL: - LOG("Cancel clicked"); + NSLOG(netsurf, INFO, "Cancel clicked"); EndDialog(hwnd, IDOK); break; diff --git a/frontends/windows/bitmap.c b/frontends/windows/bitmap.c index f60dab613..1266adb61 100644 --- a/frontends/windows/bitmap.c +++ b/frontends/windows/bitmap.c @@ -52,7 +52,8 @@ void *win32_bitmap_create(int width, int height, unsigned int state) HBITMAP windib; uint8_t *pixdata; - LOG("width %d, height %d, state %u", width, height, state); + NSLOG(netsurf, INFO, "width %d, height %d, state %u", width, height, + state); pbmi = calloc(1, sizeof(BITMAPV5HEADER)); if (pbmi == NULL) { @@ -96,7 +97,7 @@ void *win32_bitmap_create(int width, int height, unsigned int state) bitmap->opaque = false; } - LOG("bitmap %p", bitmap); + NSLOG(netsurf, INFO, "bitmap %p", bitmap); return bitmap; } @@ -115,7 +116,7 @@ static unsigned char *bitmap_get_buffer(void *bitmap) { struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return NULL; } @@ -134,7 +135,7 @@ static size_t bitmap_get_rowstride(void *bitmap) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return 0; } @@ -152,7 +153,7 @@ void win32_bitmap_destroy(void *bitmap) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return; } @@ -195,11 +196,12 @@ static void bitmap_set_opaque(void *bitmap, bool opaque) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return; } - LOG("setting bitmap %p to %s", bm, opaque ? "opaque" : "transparent"); + NSLOG(netsurf, INFO, "setting bitmap %p to %s", bm, + opaque ? "opaque" : "transparent"); bm->opaque = opaque; } @@ -216,7 +218,7 @@ static bool bitmap_test_opaque(void *bitmap) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return false; } @@ -224,11 +226,11 @@ static bool bitmap_test_opaque(void *bitmap) while (tst-- > 0) { if (bm->pixdata[(tst << 2) + 3] != 0xff) { - LOG("bitmap %p has transparency", bm); + NSLOG(netsurf, INFO, "bitmap %p has transparency", bm); return false; } } - LOG("bitmap %p is opaque", bm); + NSLOG(netsurf, INFO, "bitmap %p is opaque", bm); return true; } @@ -243,7 +245,7 @@ static bool bitmap_get_opaque(void *bitmap) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return false; } @@ -255,7 +257,7 @@ static int bitmap_get_width(void *bitmap) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return 0; } @@ -267,7 +269,7 @@ static int bitmap_get_height(void *bitmap) struct bitmap *bm = bitmap; if (bitmap == NULL) { - LOG("NULL bitmap!"); + NSLOG(netsurf, INFO, "NULL bitmap!"); return 0; } @@ -328,8 +330,8 @@ bitmap_render(struct bitmap *bitmap, struct hlcache_handle *content) height = ((width * bitmap->height) + (bitmap->width / 2)) / bitmap->width; - LOG("bitmap %p for content %p width %d, height %d", - bitmap, content, width, height); + NSLOG(netsurf, INFO, "bitmap %p for content %p width %d, height %d", + bitmap, content, width, height); /* create two memory device contexts to put the bitmaps in */ bufferdc = CreateCompatibleDC(NULL); diff --git a/frontends/windows/corewindow.c b/frontends/windows/corewindow.c index 3c31c5e46..7d88ce7c4 100644 --- a/frontends/windows/corewindow.c +++ b/frontends/windows/corewindow.c @@ -155,7 +155,7 @@ nsw32_corewindow_vscroll(struct nsw32_corewindow *nsw32_cw, SCROLLINFO si; /* current scroll information */ SCROLLINFO usi; /* updated scroll infomation for scrollwindowex */ - LOG("VSCROLL"); + NSLOG(netsurf, INFO, "VSCROLL"); si.cbSize = sizeof(si); si.fMask = SIF_ALL; @@ -230,7 +230,7 @@ nsw32_corewindow_hscroll(struct nsw32_corewindow *nsw32_cw, SCROLLINFO si; /* current scroll information */ SCROLLINFO usi; /* updated scroll infomation for scrollwindowex */ - LOG("VSCROLL"); + NSLOG(netsurf, INFO, "VSCROLL"); si.cbSize = sizeof(si); si.fMask = SIF_ALL; @@ -450,7 +450,7 @@ nsw32_cw_update_size(struct core_window *cw, int width, int height) nsw32_cw->content_width = width; nsw32_cw->content_height = height; - LOG("new content size w:%d h:%d", width, height); + NSLOG(netsurf, INFO, "new content size w:%d h:%d", width, height); update_scrollbars(nsw32_cw); } @@ -527,7 +527,7 @@ nsw32_corewindow_init(HINSTANCE hInstance, CS_DBLCLKS; } - LOG("creating hInstance %p core window", hInstance); + NSLOG(netsurf, INFO, "creating hInstance %p core window", hInstance); nsw32_cw->hWnd = CreateWindowEx(0, windowclassname_corewindow, nsw32_cw->title, @@ -541,7 +541,7 @@ nsw32_corewindow_init(HINSTANCE hInstance, hInstance, NULL); if (nsw32_cw->hWnd == NULL) { - LOG("Window create failed"); + NSLOG(netsurf, INFO, "Window create failed"); return NSERROR_NOMEM; } diff --git a/frontends/windows/download.c b/frontends/windows/download.c index 3a969834e..dfcd2b5a4 100644 --- a/frontends/windows/download.c +++ b/frontends/windows/download.c @@ -253,7 +253,8 @@ gui_download_window_create(download_context *ctx, struct gui_window *gui) strcat(destination, "/"); if (strlen(destination) + strlen(filename) < PATH_MAX - 1) strcat(destination, filename); - LOG("download %s [%s] from %s to %s", filename, size, domain, destination); + NSLOG(netsurf, INFO, "download %s [%s] from %s to %s", filename, + size, domain, destination); w->title = filename; w->domain = domain; w->size = total_size; @@ -313,7 +314,8 @@ gui_download_window_data(struct gui_download_window *w, const char *data, struct timeval val; res = fwrite((void *)data, 1, size, w->file); if (res != size) - LOG("file write error %d of %d", size - res, size); + NSLOG(netsurf, INFO, "file write error %d of %d", size - res, + size); w->downloaded += res; w->progress = (unsigned int)(((long long)(w->downloaded) * 10000) / w->size); @@ -327,7 +329,7 @@ gui_download_window_data(struct gui_download_window *w, const char *data, static void gui_download_window_error(struct gui_download_window *w, const char *error_msg) { - LOG("error %s", error_msg); + NSLOG(netsurf, INFO, "error %s", error_msg); } static void gui_download_window_done(struct gui_download_window *w) diff --git a/frontends/windows/drawable.c b/frontends/windows/drawable.c index 28a76cfe8..f491e0a2a 100644 --- a/frontends/windows/drawable.c +++ b/frontends/windows/drawable.c @@ -83,7 +83,7 @@ nsws_drawable_vscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam) SCROLLINFO si; int mem; - LOG("VSCROLL %d", gw->requestscrolly); + NSLOG(netsurf, INFO, "VSCROLL %d", gw->requestscrolly); if (gw->requestscrolly != 0) return 0; @@ -157,7 +157,7 @@ nsws_drawable_hscroll(struct gui_window *gw, HWND hwnd, WPARAM wparam) SCROLLINFO si; int mem; - LOG("HSCROLL %d", gw->requestscrollx); + NSLOG(netsurf, INFO, "HSCROLL %d", gw->requestscrollx); if (gw->requestscrollx != 0) return 0; @@ -369,7 +369,8 @@ nsws_drawable_mouseup(struct gui_window *gw, (gw->bw == NULL)) return 0; - LOG("state 0x%x, press 0x%x", gw->mouse->state, press); + NSLOG(netsurf, INFO, "state 0x%x, press 0x%x", gw->mouse->state, + press); if ((gw->mouse->state & press) != 0) { gw->mouse->state &= ~press; gw->mouse->state |= click; @@ -383,10 +384,10 @@ nsws_drawable_mouseup(struct gui_window *gw, gw->mouse->state &= ~BROWSER_MOUSE_MOD_3; if ((gw->mouse->state & click) != 0) { - LOG("mouse click bw %p, state 0x%x, x %f, y %f", - gw->bw, gw->mouse->state, - (x + gw->scrollx) / gw->scale, - (y + gw->scrolly) / gw->scale); + NSLOG(netsurf, INFO, + "mouse click bw %p, state 0x%x, x %f, y %f", gw->bw, + gw->mouse->state, (x + gw->scrollx) / gw->scale, + (y + gw->scrolly) / gw->scale); browser_window_mouse_click(gw->bw, gw->mouse->state, @@ -430,10 +431,9 @@ nsws_drawable_mousedown(struct gui_window *gw, gw->mouse->pressed_x = (x + gw->scrollx) / gw->scale; gw->mouse->pressed_y = (y + gw->scrolly) / gw->scale; - LOG("mouse click bw %p, state %x, x %f, y %f", - gw->bw, gw->mouse->state, - (x + gw->scrollx) / gw->scale, - (y + gw->scrolly) / gw->scale); + NSLOG(netsurf, INFO, "mouse click bw %p, state %x, x %f, y %f", + gw->bw, gw->mouse->state, (x + gw->scrollx) / gw->scale, + (y + gw->scrolly) / gw->scale); browser_window_mouse_click(gw->bw, gw->mouse->state, (x + gw->scrollx) / gw->scale, @@ -466,7 +466,8 @@ nsws_drawable_mousemove(struct gui_window *gw, int x, int y) (abs(x - gw->mouse->pressed_x) >= 5) && (abs(y - gw->mouse->pressed_y) >= 5)) { - LOG("Drag start state 0x%x", gw->mouse->state); + NSLOG(netsurf, INFO, "Drag start state 0x%x", + gw->mouse->state); if ((gw->mouse->state & BROWSER_MOUSE_PRESS_1) != 0) { browser_window_mouse_click(gw->bw, BROWSER_MOUSE_DRAG_1, @@ -515,7 +516,8 @@ nsws_window_drawable_event_callback(HWND hwnd, gw = nsws_get_gui_window(hwnd); if (gw == NULL) { - LOG("Unable to find gui window structure for hwnd %p", hwnd); + NSLOG(netsurf, INFO, + "Unable to find gui window structure for hwnd %p", hwnd); return DefWindowProc(hwnd, msg, wparam, lparam); } @@ -604,7 +606,7 @@ nsws_window_create_drawable(HINSTANCE hinstance, if (hwnd == NULL) { win_perror("WindowCreateDrawable"); - LOG("Window creation failed"); + NSLOG(netsurf, INFO, "Window creation failed"); return NULL; } diff --git a/frontends/windows/filetype.c b/frontends/windows/filetype.c index d31434aeb..a5fd9e95e 100644 --- a/frontends/windows/filetype.c +++ b/frontends/windows/filetype.c @@ -39,7 +39,7 @@ static const char *fetch_filetype(const char *unix_path) { int l; - LOG("unix path %s", unix_path); + NSLOG(netsurf, INFO, "unix path %s", unix_path); l = strlen(unix_path); if (2 < l && strcasecmp(unix_path + l - 3, "css") == 0) return "text/css"; diff --git a/frontends/windows/findfile.c b/frontends/windows/findfile.c index e1c9595eb..e665530ba 100644 --- a/frontends/windows/findfile.c +++ b/frontends/windows/findfile.c @@ -99,7 +99,7 @@ char *nsws_find_resource(char *buf, const char *filename, const char *def) char t[PATH_MAX]; if (cdir != NULL) { - LOG("Found Home %s", cdir); + NSLOG(netsurf, INFO, "Found Home %s", cdir); strcpy(t, cdir); strcat(t, "/.netsurf/"); strcat(t, filename); @@ -126,7 +126,7 @@ char *nsws_find_resource(char *buf, const char *filename, const char *def) getcwd(t, PATH_MAX - SLEN("\\res\\") - strlen(filename)); strcat(t, "\\res\\"); strcat(t, filename); - LOG("looking in %s", t); + NSLOG(netsurf, INFO, "looking in %s", t); if ((realpath(t, buf) != NULL) && (access(buf, R_OK) == 0)) return buf; diff --git a/frontends/windows/gui.c b/frontends/windows/gui.c index 602dcd445..890bfae42 100644 --- a/frontends/windows/gui.c +++ b/frontends/windows/gui.c @@ -66,7 +66,7 @@ void win32_run(void) int timeout; /* timeout in miliseconds */ UINT timer_id = 0; - LOG("Starting messgae dispatcher"); + NSLOG(netsurf, INFO, "Starting messgae dispatcher"); while (!win32_quit) { /* run the scheduler and discover how long to wait for @@ -128,7 +128,7 @@ static void gui_get_clipboard(char **buffer, size_t *length) clipboard_handle = GetClipboardData(CF_TEXT); if (clipboard_handle != NULL) { content = GlobalLock(clipboard_handle); - LOG("pasting %s", content); + NSLOG(netsurf, INFO, "pasting %s", content); GlobalUnlock(clipboard_handle); } } diff --git a/frontends/windows/main.c b/frontends/windows/main.c index d019f10c7..98e90be80 100644 --- a/frontends/windows/main.c +++ b/frontends/windows/main.c @@ -99,7 +99,7 @@ static nserror get_config_home(char **config_home_out) *config_home_out = strdup(adPath); - LOG("using config path \"%s\"", *config_home_out); + NSLOG(netsurf, INFO, "using config path \"%s\"", *config_home_out); return NSERROR_OK; } @@ -343,15 +343,16 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd) /* Locate the correct user configuration directory path */ ret = get_config_home(&nsw32_config_home); if (ret != NSERROR_OK) { - LOG("Unable to locate a configuration directory."); + NSLOG(netsurf, INFO, + "Unable to locate a configuration directory."); nsw32_config_home = NULL; } /* Initialise user options */ ret = nsw32_option_init(&argc, argv); if (ret != NSERROR_OK) { - LOG("Options failed to initialise (%s)\n", - messages_get_errorcode(ret)); + NSLOG(netsurf, INFO, "Options failed to initialise (%s)\n", + messages_get_errorcode(ret)); return 1; } @@ -365,7 +366,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd) /* common initialisation */ ret = netsurf_init(NULL); if (ret != NSERROR_OK) { - LOG("NetSurf failed to initialise"); + NSLOG(netsurf, INFO, "NetSurf failed to initialise"); return 1; } @@ -392,7 +393,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd) addr = NETSURF_HOMEPAGE; } - LOG("calling browser_window_create"); + NSLOG(netsurf, INFO, "calling browser_window_create"); ret = nsurl_create(addr, &url); if (ret == NSERROR_OK) { diff --git a/frontends/windows/plot.c b/frontends/windows/plot.c index 1bd0ba4a0..f38fe7522 100644 --- a/frontends/windows/plot.c +++ b/frontends/windows/plot.c @@ -84,7 +84,7 @@ plot_block(COLORREF col, int x, int y, int width, int height) /* ensure the plot HDC is set */ if (plot_hdc == NULL) { - LOG("HDC not set on call to plotters"); + NSLOG(netsurf, INFO, "HDC not set on call to plotters"); return NSERROR_INVALID; } @@ -299,7 +299,7 @@ plot_bitmap(struct bitmap *bitmap, int x, int y, int width, int height) /* ensure the plot HDC is set */ if (plot_hdc == NULL) { - LOG("HDC not set on call to plotters"); + NSLOG(netsurf, INFO, "HDC not set on call to plotters"); return NSERROR_INVALID; } @@ -404,7 +404,7 @@ arc(const struct redraw_context *ctx, /* ensure the plot HDC is set */ if (plot_hdc == NULL) { - LOG("HDC not set on call to plotters"); + NSLOG(netsurf, INFO, "HDC not set on call to plotters"); return NSERROR_INVALID; } @@ -515,7 +515,7 @@ disc(const struct redraw_context *ctx, /* ensure the plot HDC is set */ if (plot_hdc == NULL) { - LOG("HDC not set on call to plotters"); + NSLOG(netsurf, INFO, "HDC not set on call to plotters"); return NSERROR_INVALID; } @@ -594,7 +594,7 @@ line(const struct redraw_context *ctx, /* ensure the plot HDC is set */ if (plot_hdc == NULL) { - LOG("HDC not set on call to plotters"); + NSLOG(netsurf, INFO, "HDC not set on call to plotters"); return NSERROR_INVALID; } @@ -661,7 +661,7 @@ rectangle(const struct redraw_context *ctx, /* ensure the plot HDC is set */ if (plot_hdc == NULL) { - LOG("HDC not set on call to plotters"); + NSLOG(netsurf, INFO, "HDC not set on call to plotters"); return NSERROR_INVALID; } @@ -744,7 +744,7 @@ polygon(const struct redraw_context *ctx, /* ensure the plot HDC is set */ if (plot_hdc == NULL) { - LOG("HDC not set on call to plotters"); + NSLOG(netsurf, INFO, "HDC not set on call to plotters"); return NSERROR_INVALID; } @@ -878,7 +878,7 @@ bitmap(const struct redraw_context *ctx, PLOT_LOG("Plotting %p at %d,%d by %d,%d",bitmap, x,y,width,height); if (bitmap == NULL) { - LOG("Passed null bitmap!"); + NSLOG(netsurf, INFO, "Passed null bitmap!"); return NSERROR_OK; } @@ -993,7 +993,7 @@ text(const struct redraw_context *ctx, /* ensure the plot HDC is set */ if (plot_hdc == NULL) { - LOG("HDC not set on call to plotters"); + NSLOG(netsurf, INFO, "HDC not set on call to plotters"); return NSERROR_INVALID; } diff --git a/frontends/windows/prefs.c b/frontends/windows/prefs.c index f84ee1c96..591b57426 100644 --- a/frontends/windows/prefs.c +++ b/frontends/windows/prefs.c @@ -304,7 +304,8 @@ static BOOL CALLBACK options_appearance_dialog_handler(HWND hwnd, case WM_COMMAND: - LOG("WM_COMMAND Identifier 0x%x",LOWORD(wparam)); + NSLOG(netsurf, INFO, "WM_COMMAND Identifier 0x%x", + LOWORD(wparam)); switch(LOWORD(wparam)) { case IDC_PREFS_PROXYTYPE: diff --git a/frontends/windows/schedule.c b/frontends/windows/schedule.c index eae6c1d63..d6a757246 100644 --- a/frontends/windows/schedule.c +++ b/frontends/windows/schedule.c @@ -216,12 +216,14 @@ void list_schedule(void) gettimeofday(&tv, NULL); - LOG("schedule list at %ld:%ld", tv.tv_sec, tv.tv_usec); + NSLOG(netsurf, INFO, "schedule list at %ld:%ld", tv.tv_sec, + tv.tv_usec); cur_nscb = schedule_list; while (cur_nscb != NULL) { - LOG("Schedule %p at %ld:%ld", cur_nscb, cur_nscb->tv.tv_sec, cur_nscb->tv.tv_usec); + NSLOG(netsurf, INFO, "Schedule %p at %ld:%ld", cur_nscb, + cur_nscb->tv.tv_sec, cur_nscb->tv.tv_usec); cur_nscb = cur_nscb->next; } } diff --git a/frontends/windows/ssl_cert.c b/frontends/windows/ssl_cert.c index fac211c11..4db061626 100644 --- a/frontends/windows/ssl_cert.c +++ b/frontends/windows/ssl_cert.c @@ -191,7 +191,7 @@ nserror nsw32_cert_verify(struct nsurl *url, return res; } - LOG("creating hInstance %p SSL window", hinst); + NSLOG(netsurf, INFO, "creating hInstance %p SSL window", hinst); ncwin->hWnd = CreateWindowEx(0, windowclassname_sslcert, "SSL Certificate viewer", @@ -208,7 +208,7 @@ nserror nsw32_cert_verify(struct nsurl *url, hinst, NULL); if (ncwin->hWnd == NULL) { - LOG("Window create failed"); + NSLOG(netsurf, INFO, "Window create failed"); return NSERROR_NOMEM; } @@ -375,8 +375,11 @@ nsw32_window_ssl_cert_command(HWND hwnd, int identifier, HWND ctrl_window) { - LOG("notification_code %x identifier %x ctrl_window %p", - notification_code, identifier, ctrl_window); + NSLOG(netsurf, INFO, + "notification_code %x identifier %x ctrl_window %p", + notification_code, + identifier, + ctrl_window); switch(identifier) { case IDC_SSLCERT_BTN_ACCEPT: diff --git a/frontends/windows/window.c b/frontends/windows/window.c index c72173697..20db25a56 100644 --- a/frontends/windows/window.c +++ b/frontends/windows/window.c @@ -88,7 +88,7 @@ static int get_window_dpi(HWND hwnd) ReleaseDC(hwnd, hdc); - LOG("FIX DPI %d", dpi); + NSLOG(netsurf, INFO, "FIX DPI %d", dpi); return dpi; } @@ -163,7 +163,8 @@ static HWND nsws_window_create(HINSTANCE hInstance, struct gui_window *gw) gw->mainmenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU_MAIN)); gw->rclick = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU_CONTEXT)); - LOG("creating hInstance %p GUI window %p", hInstance, gw); + NSLOG(netsurf, INFO, "creating hInstance %p GUI window %p", + hInstance, gw); hwnd = CreateWindowEx(0, windowclassname_main, "NetSurf Browser", @@ -181,7 +182,7 @@ static HWND nsws_window_create(HINSTANCE hInstance, struct gui_window *gw) NULL); if (hwnd == NULL) { - LOG("Window create failed"); + NSLOG(netsurf, INFO, "Window create failed"); return NULL; } @@ -194,9 +195,9 @@ static HWND nsws_window_create(HINSTANCE hInstance, struct gui_window *gw) (nsoption_int(window_height) >= 100) && (nsoption_int(window_x) >= 0) && (nsoption_int(window_y) >= 0)) { - LOG("Setting Window position %d,%d %d,%d", - nsoption_int(window_x), nsoption_int(window_y), - nsoption_int(window_width), nsoption_int(window_height)); + NSLOG(netsurf, INFO, "Setting Window position %d,%d %d,%d", + nsoption_int(window_x), nsoption_int(window_y), + nsoption_int(window_width), nsoption_int(window_height)); SetWindowPos(hwnd, HWND_TOP, nsoption_int(window_x), nsoption_int(window_y), @@ -227,47 +228,50 @@ nsws_window_toolbar_command(struct gui_window *gw, int identifier, HWND ctrl_window) { - LOG("notification_code %d identifier %d ctrl_window %p", - notification_code, identifier, ctrl_window); + NSLOG(netsurf, INFO, + "notification_code %d identifier %d ctrl_window %p", + notification_code, + identifier, + ctrl_window); switch(identifier) { case IDC_MAIN_URLBAR: switch (notification_code) { case EN_CHANGE: - LOG("EN_CHANGE"); + NSLOG(netsurf, INFO, "EN_CHANGE"); break; case EN_ERRSPACE: - LOG("EN_ERRSPACE"); + NSLOG(netsurf, INFO, "EN_ERRSPACE"); break; case EN_HSCROLL: - LOG("EN_HSCROLL"); + NSLOG(netsurf, INFO, "EN_HSCROLL"); break; case EN_KILLFOCUS: - LOG("EN_KILLFOCUS"); + NSLOG(netsurf, INFO, "EN_KILLFOCUS"); break; case EN_MAXTEXT: - LOG("EN_MAXTEXT"); + NSLOG(netsurf, INFO, "EN_MAXTEXT"); break; case EN_SETFOCUS: - LOG("EN_SETFOCUS"); + NSLOG(netsurf, INFO, "EN_SETFOCUS"); break; case EN_UPDATE: - LOG("EN_UPDATE"); + NSLOG(netsurf, INFO, "EN_UPDATE"); break; case EN_VSCROLL: - LOG("EN_VSCROLL"); + NSLOG(netsurf, INFO, "EN_VSCROLL"); break; default: - LOG("Unknown notification_code"); + NSLOG(netsurf, INFO, "Unknown notification_code"); break; } break; @@ -421,7 +425,7 @@ nsws_window_urlbar_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) case WM_DESTROY: hFont = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0); if (hFont != NULL) { - LOG("Destroyed font object"); + NSLOG(netsurf, INFO, "Destroyed font object"); DeleteObject(hFont); } @@ -502,12 +506,13 @@ nsws_window_urlbar_create(HINSTANCE hInstance, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, "Arial"); if (hFont != NULL) { - LOG("Setting font object"); + NSLOG(netsurf, INFO, "Setting font object"); SendMessage(hwnd, WM_SETFONT, (WPARAM)hFont, 0); } - LOG("Created url bar hwnd:%p, x:%d, y:%d, w:%d, h:%d", - hwnd, urlx, urly, urlwidth, urlheight); + NSLOG(netsurf, INFO, + "Created url bar hwnd:%p, x:%d, y:%d, w:%d, h:%d", hwnd, urlx, + urly, urlwidth, urlheight); return hwnd; } @@ -548,7 +553,7 @@ nsws_window_throbber_create(HINSTANCE hInstance, NULL); nsws_find_resource(avi, "throbber.avi", "windows/res/throbber.avi"); - LOG("setting throbber avi as %s", avi); + NSLOG(netsurf, INFO, "setting throbber avi as %s", avi); Animate_Open(hwnd, avi); if (gw->throbbing) { Animate_Play(hwnd, 0, -1, -1); @@ -576,7 +581,8 @@ get_imagelist(HINSTANCE hInstance, int resid, int bsize, int bcnt) HIMAGELIST hImageList; HBITMAP hScrBM; - LOG("resource id %d, bzize %d, bcnt %d", resid, bsize, bcnt); + NSLOG(netsurf, INFO, "resource id %d, bzize %d, bcnt %d", resid, + bsize, bcnt); hImageList = ImageList_Create(bsize, bsize, ILC_COLOR24 | ILC_MASK, 0, @@ -997,8 +1003,11 @@ nsws_window_command(HWND hwnd, { nserror ret; - LOG("notification_code %x identifier %x ctrl_window %p", - notification_code, identifier, ctrl_window); + NSLOG(netsurf, INFO, + "notification_code %x identifier %x ctrl_window %p", + notification_code, + identifier, + ctrl_window); switch(identifier) { @@ -1073,7 +1082,7 @@ nsws_window_command(HWND hwnd, HANDLE h = GetClipboardData(CF_TEXT); if (h != NULL) { char *content = GlobalLock(h); - LOG("pasting %s\n", content); + NSLOG(netsurf, INFO, "pasting %s\n", content); GlobalUnlock(h); } CloseClipboard(); @@ -1276,7 +1285,7 @@ nsws_window_command(HWND hwnd, int len = SendMessage(gw->urlbar, WM_GETTEXTLENGTH, 0, 0); char addr[len + 1]; SendMessage(gw->urlbar, WM_GETTEXT, (WPARAM)(len + 1), (LPARAM)addr); - LOG("launching %s\n", addr); + NSLOG(netsurf, INFO, "launching %s\n", addr); if (nsurl_create(addr, &url) != NSERROR_OK) { win32_warning("NoMemory", 0); @@ -1313,7 +1322,7 @@ nsws_window_command(HWND hwnd, */ static bool win32_window_get_scroll(struct gui_window *gw, int *sx, int *sy) { - LOG("get scroll"); + NSLOG(netsurf, INFO, "get scroll"); if (gw == NULL) return false; @@ -1410,7 +1419,8 @@ nsws_window_event_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) gw = nsws_get_gui_window(hwnd); if (gw == NULL) { - LOG("Unable to find gui window structure for hwnd %p", hwnd); + NSLOG(netsurf, INFO, + "Unable to find gui window structure for hwnd %p", hwnd); return DefWindowProc(hwnd, msg, wparam, lparam); } @@ -1463,7 +1473,7 @@ win32_window_create(struct browser_window *bw, { struct gui_window *gw; - LOG("Creating gui window for browser window %p", bw); + NSLOG(netsurf, INFO, "Creating gui window for browser window %p", bw); gw = calloc(1, sizeof(struct gui_window)); if (gw == NULL) { @@ -1484,7 +1494,7 @@ win32_window_create(struct browser_window *bw, gw->mouse = malloc(sizeof(struct browser_mouse)); if (gw->mouse == NULL) { free(gw); - LOG("Unable to allocate mouse state"); + NSLOG(netsurf, INFO, "Unable to allocate mouse state"); return NULL; } gw->mouse->gui = gw; @@ -1504,8 +1514,12 @@ win32_window_create(struct browser_window *bw, gw->statusbar = nsws_window_create_statusbar(hinst, gw->main, gw); gw->drawingarea = nsws_window_create_drawable(hinst, gw->main, gw); - LOG("new window: main:%p toolbar:%p statusbar %p drawingarea %p", - gw->main, gw->toolbar, gw->statusbar, gw->drawingarea); + NSLOG(netsurf, INFO, + "new window: main:%p toolbar:%p statusbar %p drawingarea %p", + gw->main, + gw->toolbar, + gw->statusbar, + gw->drawingarea); font_hwnd = gw->drawingarea; open_windows++; @@ -1556,7 +1570,7 @@ win32_window_get_dimensions(struct gui_window *gw, *width = gw->width; *height = gw->height; - LOG("gw:%p w=%d h=%d", gw, *width, *height); + NSLOG(netsurf, INFO, "gw:%p w=%d h=%d", gw, *width, *height); return NSERROR_OK; } @@ -1588,7 +1602,7 @@ static void win32_window_set_title(struct gui_window *w, const char *title) return; } - LOG("%p, title %s", w, title); + NSLOG(netsurf, INFO, "%p, title %s", w, title); fulltitle = malloc(strlen(title) + SLEN(" - NetSurf") + 1); if (fulltitle == NULL) { win32_warning("NoMemory", 0); diff --git a/render/box.c b/render/box.c index 77cc15bc3..8b9c89ee6 100644 --- a/render/box.c +++ b/render/box.c @@ -1155,7 +1155,7 @@ bool box_handle_scrollbars(struct content *c, struct box *box, if (box->scroll_y == NULL) { data = malloc(sizeof(struct html_scrollbar_data)); if (data == NULL) { - LOG("malloc failed"); + NSLOG(netsurf, INFO, "malloc failed"); guit->misc->warning("NoMemory", 0); return false; } @@ -1176,7 +1176,7 @@ bool box_handle_scrollbars(struct content *c, struct box *box, if (box->scroll_x == NULL) { data = malloc(sizeof(struct html_scrollbar_data)); if (data == NULL) { - LOG("malloc failed"); + NSLOG(netsurf, INFO, "malloc failed"); guit->misc->warning("NoMemory", 0); return false; } diff --git a/render/box_construct.c b/render/box_construct.c index d0ffd9d83..549d9122f 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -1900,7 +1900,7 @@ bool box_frameset(BOX_SPECIAL_PARAMS) bool ok; if (content->frameset) { - LOG("Error: multiple framesets in document."); + NSLOG(netsurf, INFO, "Error: multiple framesets in document."); /* Don't convert children */ if (convert_children) *convert_children = false; diff --git a/render/box_normalise.c b/render/box_normalise.c index 5d36b99d7..9f78f75ac 100644 --- a/render/box_normalise.c +++ b/render/box_normalise.c @@ -111,7 +111,7 @@ bool box_normalise_block(struct box *block, html_content *c) assert(block != NULL); #ifdef BOX_NORMALISE_DEBUG - LOG("block %p, block->type %u", block, block->type); + NSLOG(netsurf, INFO, "block %p, block->type %u", block, block->type); #endif assert(block->type == BOX_BLOCK || block->type == BOX_INLINE_BLOCK || @@ -119,7 +119,8 @@ bool box_normalise_block(struct box *block, html_content *c) for (child = block->children; child != NULL; child = next_child) { #ifdef BOX_NORMALISE_DEBUG - LOG("child %p, child->type = %d", child, child->type); + NSLOG(netsurf, INFO, "child %p, child->type = %d", child, + child->type); #endif next_child = child->next; /* child may be destroyed */ @@ -223,7 +224,7 @@ bool box_normalise_table(struct box *table, html_content * c) assert(table->type == BOX_TABLE); #ifdef BOX_NORMALISE_DEBUG - LOG("table %p", table); + NSLOG(netsurf, INFO, "table %p", table); #endif col_info.num_columns = 1; @@ -337,7 +338,8 @@ bool box_normalise_table(struct box *table, html_content * c) struct box *row; #ifdef BOX_NORMALISE_DEBUG - LOG("table->children == 0, creating implied row"); + NSLOG(netsurf, INFO, + "table->children == 0, creating implied row"); #endif assert(table->style != NULL); @@ -399,7 +401,7 @@ bool box_normalise_table(struct box *table, html_content * c) return false; #ifdef BOX_NORMALISE_DEBUG - LOG("table %p done", table); + NSLOG(netsurf, INFO, "table %p done", table); #endif return true; @@ -585,7 +587,7 @@ bool box_normalise_table_row_group(struct box *row_group, assert(row_group->type == BOX_TABLE_ROW_GROUP); #ifdef BOX_NORMALISE_DEBUG - LOG("row_group %p", row_group); + NSLOG(netsurf, INFO, "row_group %p", row_group); #endif for (child = row_group->children; child != NULL; child = next_child) { @@ -677,7 +679,8 @@ bool box_normalise_table_row_group(struct box *row_group, if (row_group->children == NULL) { #ifdef BOX_NORMALISE_DEBUG - LOG("row_group->children == 0, inserting implied row"); + NSLOG(netsurf, INFO, + "row_group->children == 0, inserting implied row"); #endif assert(row_group->style != NULL); @@ -712,7 +715,7 @@ bool box_normalise_table_row_group(struct box *row_group, row_group->rows = group_row_count; #ifdef BOX_NORMALISE_DEBUG - LOG("row_group %p done", row_group); + NSLOG(netsurf, INFO, "row_group %p done", row_group); #endif return true; @@ -734,7 +737,7 @@ bool box_normalise_table_row(struct box *row, assert(row->type == BOX_TABLE_ROW); #ifdef BOX_NORMALISE_DEBUG - LOG("row %p", row); + NSLOG(netsurf, INFO, "row %p", row); #endif for (child = row->children; child != NULL; child = next_child) { @@ -843,7 +846,7 @@ bool box_normalise_table_row(struct box *row, col_info->num_rows++; #ifdef BOX_NORMALISE_DEBUG - LOG("row %p done", row); + NSLOG(netsurf, INFO, "row %p done", row); #endif return true; @@ -934,7 +937,7 @@ bool box_normalise_inline_container(struct box *cont, html_content * c) assert(cont->type == BOX_INLINE_CONTAINER); #ifdef BOX_NORMALISE_DEBUG - LOG("cont %p", cont); + NSLOG(netsurf, INFO, "cont %p", cont); #endif for (child = cont->children; child != NULL; child = next_child) { @@ -997,7 +1000,7 @@ bool box_normalise_inline_container(struct box *cont, html_content * c) } #ifdef BOX_NORMALISE_DEBUG - LOG("cont %p done", cont); + NSLOG(netsurf, INFO, "cont %p done", cont); #endif return true; diff --git a/render/box_textarea.c b/render/box_textarea.c index 1586d71c4..3b1e7750c 100644 --- a/render/box_textarea.c +++ b/render/box_textarea.c @@ -149,7 +149,9 @@ static void box_textarea_callback(void *data, struct textarea_msg *msg) break; default: - LOG("Drag type %d not handled.", msg->data.drag); + NSLOG(netsurf, INFO, + "Drag type %d not handled.", + msg->data.drag); /* This is a logic faliure in the * front end code so abort. */ diff --git a/render/form.c b/render/form.c index a8b96fefb..904272d3a 100644 --- a/render/form.c +++ b/render/form.c @@ -218,7 +218,8 @@ void form_free_control(struct form_control *control) struct form_control *c; assert(control != NULL); - LOG("Control:%p name:%p value:%p initial:%p", control, control->name, control->value, control->initial_value); + NSLOG(netsurf, INFO, "Control:%p name:%p value:%p initial:%p", + control, control->name, control->value, control->initial_value); free(control->name); free(control->value); free(control->initial_value); @@ -229,7 +230,9 @@ void form_free_control(struct form_control *control) for (option = control->data.select.items; option; option = next) { next = option->next; - LOG("select option:%p text:%p value:%p", option, option->text, option->value); + NSLOG(netsurf, INFO, + "select option:%p text:%p value:%p", option, + option->text, option->value); free(option->text); free(option->value); free(option); @@ -348,7 +351,7 @@ bool form_successful_controls_dom(struct form *_form, /** \todo Replace this call with something DOMish */ charset = form_acceptable_charset(_form); if (charset == NULL) { - LOG("failed to find charset"); + NSLOG(netsurf, INFO, "failed to find charset"); return false; } @@ -362,7 +365,7 @@ bool form_successful_controls_dom(struct form *_form, err = dom_html_form_element_get_elements(form, &form_elements); if (err != DOM_NO_ERR) { - LOG("Could not get form elements"); + NSLOG(netsurf, INFO, "Could not get form elements"); goto dom_no_memory; } @@ -370,7 +373,7 @@ bool form_successful_controls_dom(struct form *_form, err = dom_html_collection_get_length(form_elements, &element_count); if (err != DOM_NO_ERR) { - LOG("Could not get form element count"); + NSLOG(netsurf, INFO, "Could not get form element count"); goto dom_no_memory; } @@ -402,7 +405,8 @@ bool form_successful_controls_dom(struct form *_form, err = dom_html_collection_item(form_elements, index, &form_element); if (err != DOM_NO_ERR) { - LOG("Could not retrieve form element %d", index); + NSLOG(netsurf, INFO, + "Could not retrieve form element %d", index); goto dom_no_memory; } @@ -414,7 +418,7 @@ bool form_successful_controls_dom(struct form *_form, */ err = dom_node_get_node_name(form_element, &nodename); if (err != DOM_NO_ERR) { - LOG("Could not get node name"); + NSLOG(netsurf, INFO, "Could not get node name"); goto dom_no_memory; } @@ -423,14 +427,16 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_text_area_element *)form_element, &element_disabled); if (err != DOM_NO_ERR) { - LOG("Could not get text area disabled property"); + NSLOG(netsurf, INFO, + "Could not get text area disabled property"); goto dom_no_memory; } err = dom_html_text_area_element_get_name( (dom_html_text_area_element *)form_element, &inputname); if (err != DOM_NO_ERR) { - LOG("Could not get text area name property"); + NSLOG(netsurf, INFO, + "Could not get text area name property"); goto dom_no_memory; } } else if (dom_string_isequal(nodename, corestring_dom_SELECT)) { @@ -438,14 +444,16 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_select_element *)form_element, &element_disabled); if (err != DOM_NO_ERR) { - LOG("Could not get select disabled property"); + NSLOG(netsurf, INFO, + "Could not get select disabled property"); goto dom_no_memory; } err = dom_html_select_element_get_name( (dom_html_select_element *)form_element, &inputname); if (err != DOM_NO_ERR) { - LOG("Could not get select name property"); + NSLOG(netsurf, INFO, + "Could not get select name property"); goto dom_no_memory; } } else if (dom_string_isequal(nodename, corestring_dom_INPUT)) { @@ -453,14 +461,16 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_input_element *)form_element, &element_disabled); if (err != DOM_NO_ERR) { - LOG("Could not get input disabled property"); + NSLOG(netsurf, INFO, + "Could not get input disabled property"); goto dom_no_memory; } err = dom_html_input_element_get_name( (dom_html_input_element *)form_element, &inputname); if (err != DOM_NO_ERR) { - LOG("Could not get input name property"); + NSLOG(netsurf, INFO, + "Could not get input name property"); goto dom_no_memory; } } else if (dom_string_isequal(nodename, corestring_dom_BUTTON)) { @@ -468,21 +478,23 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_button_element *)form_element, &element_disabled); if (err != DOM_NO_ERR) { - LOG("Could not get button disabled property"); + NSLOG(netsurf, INFO, + "Could not get button disabled property"); goto dom_no_memory; } err = dom_html_button_element_get_name( (dom_html_button_element *)form_element, &inputname); if (err != DOM_NO_ERR) { - LOG("Could not get button name property"); + NSLOG(netsurf, INFO, + "Could not get button name property"); goto dom_no_memory; } } else { /* Unknown element type came through! */ - LOG("Unknown element type: %*s", - (int)dom_string_byte_length(nodename), - dom_string_data(nodename)); + NSLOG(netsurf, INFO, "Unknown element type: %*s", + (int)dom_string_byte_length(nodename), + dom_string_data(nodename)); goto dom_no_memory; } if (element_disabled) @@ -495,7 +507,8 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_text_area_element *)form_element, &inputvalue); if (err != DOM_NO_ERR) { - LOG("Could not get text area content"); + NSLOG(netsurf, INFO, + "Could not get text area content"); goto dom_no_memory; } } else if (dom_string_isequal(nodename, corestring_dom_SELECT)) { @@ -504,13 +517,15 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_select_element *)form_element, &options); if (err != DOM_NO_ERR) { - LOG("Could not get select options collection"); + NSLOG(netsurf, INFO, + "Could not get select options collection"); goto dom_no_memory; } err = dom_html_options_collection_get_length( options, &options_count); if (err != DOM_NO_ERR) { - LOG("Could not get select options collection length"); + NSLOG(netsurf, INFO, + "Could not get select options collection length"); goto dom_no_memory; } for(option_index = 0; option_index < options_count; @@ -527,14 +542,17 @@ bool form_successful_controls_dom(struct form *_form, err = dom_html_options_collection_item( options, option_index, &option_element); if (err != DOM_NO_ERR) { - LOG("Could not get options item %d", option_index); + NSLOG(netsurf, INFO, + "Could not get options item %d", + option_index); goto dom_no_memory; } err = dom_html_option_element_get_selected( (dom_html_option_element *)option_element, &selected); if (err != DOM_NO_ERR) { - LOG("Could not get option selected property"); + NSLOG(netsurf, INFO, + "Could not get option selected property"); goto dom_no_memory; } if (!selected) @@ -543,13 +561,15 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_option_element *)option_element, &inputvalue); if (err != DOM_NO_ERR) { - LOG("Could not get option value"); + NSLOG(netsurf, INFO, + "Could not get option value"); goto dom_no_memory; } success_new = calloc(1, sizeof(*success_new)); if (success_new == NULL) { - LOG("Could not allocate data for option"); + NSLOG(netsurf, INFO, + "Could not allocate data for option"); goto dom_no_memory; } @@ -558,12 +578,14 @@ bool form_successful_controls_dom(struct form *_form, success_new->name = ENCODE_ITEM(inputname); if (success_new->name == NULL) { - LOG("Could not encode name for option"); + NSLOG(netsurf, INFO, + "Could not encode name for option"); goto dom_no_memory; } success_new->value = ENCODE_ITEM(inputvalue); if (success_new->value == NULL) { - LOG("Could not encode value for option"); + NSLOG(netsurf, INFO, + "Could not encode value for option"); goto dom_no_memory; } } @@ -573,7 +595,8 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_button_element *) form_element, &inputtype); if (err != DOM_NO_ERR) { - LOG("Could not get button element type"); + NSLOG(netsurf, INFO, + "Could not get button element type"); goto dom_no_memory; } if (dom_string_caseless_isequal( @@ -593,7 +616,8 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_button_element *)form_element, &inputvalue); if (err != DOM_NO_ERR) { - LOG("Could not get submit button value"); + NSLOG(netsurf, INFO, + "Could not get submit button value"); goto dom_no_memory; } /* Drop through to report successful button */ @@ -610,7 +634,8 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_input_element *) form_element, &inputtype); if (err != DOM_NO_ERR) { - LOG("Could not get input element type"); + NSLOG(netsurf, INFO, + "Could not get input element type"); goto dom_no_memory; } if (dom_string_caseless_isequal( @@ -630,7 +655,8 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_input_element *)form_element, &inputvalue); if (err != DOM_NO_ERR) { - LOG("Could not get submit button value"); + NSLOG(netsurf, INFO, + "Could not get submit button value"); goto dom_no_memory; } /* Drop through to report the successful button */ @@ -648,11 +674,13 @@ bool form_successful_controls_dom(struct form *_form, corestring_dom___ns_key_image_coords_node_data, &coords); if (err != DOM_NO_ERR) { - LOG("Could not get image XY data"); + NSLOG(netsurf, INFO, + "Could not get image XY data"); goto dom_no_memory; } if (coords == NULL) { - LOG("No XY data on the image input"); + NSLOG(netsurf, INFO, + "No XY data on the image input"); goto dom_no_memory; } @@ -661,7 +689,8 @@ bool form_successful_controls_dom(struct form *_form, success_new = calloc(1, sizeof(*success_new)); if (success_new == NULL) { free(basename); - LOG("Could not allocate data for image.x"); + NSLOG(netsurf, INFO, + "Could not allocate data for image.x"); goto dom_no_memory; } @@ -671,13 +700,15 @@ bool form_successful_controls_dom(struct form *_form, success_new->name = malloc(strlen(basename) + 3); if (success_new->name == NULL) { free(basename); - LOG("Could not allocate name for image.x"); + NSLOG(netsurf, INFO, + "Could not allocate name for image.x"); goto dom_no_memory; } success_new->value = malloc(20); if (success_new->value == NULL) { free(basename); - LOG("Could not allocate value for image.x"); + NSLOG(netsurf, INFO, + "Could not allocate value for image.x"); goto dom_no_memory; } sprintf(success_new->name, "%s.x", basename); @@ -686,7 +717,8 @@ bool form_successful_controls_dom(struct form *_form, success_new = calloc(1, sizeof(*success_new)); if (success_new == NULL) { free(basename); - LOG("Could not allocate data for image.y"); + NSLOG(netsurf, INFO, + "Could not allocate data for image.y"); goto dom_no_memory; } @@ -696,13 +728,15 @@ bool form_successful_controls_dom(struct form *_form, success_new->name = malloc(strlen(basename) + 3); if (success_new->name == NULL) { free(basename); - LOG("Could not allocate name for image.y"); + NSLOG(netsurf, INFO, + "Could not allocate name for image.y"); goto dom_no_memory; } success_new->value = malloc(20); if (success_new->value == NULL) { free(basename); - LOG("Could not allocate value for image.y"); + NSLOG(netsurf, INFO, + "Could not allocate value for image.y"); goto dom_no_memory; } sprintf(success_new->name, "%s.y", basename); @@ -717,7 +751,8 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_input_element *)form_element, &checked); if (err != DOM_NO_ERR) { - LOG("Could not get input element checked"); + NSLOG(netsurf, INFO, + "Could not get input element checked"); goto dom_no_memory; } if (!checked) @@ -726,7 +761,8 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_input_element *)form_element, &inputvalue); if (err != DOM_NO_ERR) { - LOG("Could not get input element value"); + NSLOG(netsurf, INFO, + "Could not get input element value"); goto dom_no_memory; } if (inputvalue == NULL) { @@ -741,7 +777,8 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_input_element *)form_element, &inputvalue); if (err != DOM_NO_ERR) { - LOG("Could not get file value"); + NSLOG(netsurf, INFO, + "Could not get file value"); goto dom_no_memory; } err = dom_node_get_user_data( @@ -749,14 +786,16 @@ bool form_successful_controls_dom(struct form *_form, corestring_dom___ns_key_file_name_node_data, &rawfile_temp); if (err != DOM_NO_ERR) { - LOG("Could not get file rawname"); + NSLOG(netsurf, INFO, + "Could not get file rawname"); goto dom_no_memory; } rawfile_temp = strdup(rawfile_temp != NULL ? rawfile_temp : ""); if (rawfile_temp == NULL) { - LOG("Could not copy file rawname"); + NSLOG(netsurf, INFO, + "Could not copy file rawname"); goto dom_no_memory; } /* Fall out to the allocation */ @@ -765,7 +804,8 @@ bool form_successful_controls_dom(struct form *_form, dom_string_caseless_isequal( inputtype, corestring_dom_button)) { /* Skip these */ - LOG("Skipping RESET and BUTTON"); + NSLOG(netsurf, INFO, + "Skipping RESET and BUTTON"); continue; } else { /* Everything else is treated as text values */ @@ -773,7 +813,8 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_input_element *)form_element, &inputvalue); if (err != DOM_NO_ERR) { - LOG("Could not get input value"); + NSLOG(netsurf, INFO, + "Could not get input value"); goto dom_no_memory; } /* Fall out to the allocation */ @@ -782,7 +823,8 @@ bool form_successful_controls_dom(struct form *_form, success_new = calloc(1, sizeof(*success_new)); if (success_new == NULL) { - LOG("Could not allocate data for generic"); + NSLOG(netsurf, INFO, + "Could not allocate data for generic"); goto dom_no_memory; } @@ -791,12 +833,14 @@ bool form_successful_controls_dom(struct form *_form, success_new->name = ENCODE_ITEM(inputname); if (success_new->name == NULL) { - LOG("Could not encode name for generic"); + NSLOG(netsurf, INFO, + "Could not encode name for generic"); goto dom_no_memory; } success_new->value = ENCODE_ITEM(inputvalue); if (success_new->value == NULL) { - LOG("Could not encode value for generic"); + NSLOG(netsurf, INFO, + "Could not encode value for generic"); goto dom_no_memory; } if (rawfile_temp != NULL) { diff --git a/render/html.c b/render/html.c index 62dec9e95..482259f1c 100644 --- a/render/html.c +++ b/render/html.c @@ -89,8 +89,8 @@ bool fire_dom_event(dom_string *type, dom_node *target, dom_event_unref(evt); return false; } - LOG("Dispatching '%*s' against %p", - dom_string_length(type), dom_string_data(type), target); + NSLOG(netsurf, INFO, "Dispatching '%*s' against %p", + dom_string_length(type), dom_string_data(type), target); exc = dom_event_target_dispatch_event(target, evt, &result); if (exc != DOM_NO_ERR) { result = false; @@ -111,7 +111,7 @@ static void html_box_convert_done(html_content *c, bool success) dom_exception exc; /* returned by libdom functions */ dom_node *html; - LOG("Done XML to box (%p)", c); + NSLOG(netsurf, INFO, "Done XML to box (%p)", c); /* Clean up and report error if unsuccessful or aborted */ if ((success == false) || (c->aborted)) { @@ -141,7 +141,7 @@ static void html_box_convert_done(html_content *c, bool success) /** @todo should this call html_object_free_objects(c); * like the other error paths */ - LOG("error retrieving html element from dom"); + NSLOG(netsurf, INFO, "error retrieving html element from dom"); content_broadcast_errorcode(&c->base, NSERROR_DOM); content_set_error(&c->base); return; @@ -150,7 +150,7 @@ static void html_box_convert_done(html_content *c, bool success) /* extract image maps - can't do this sensibly in dom_to_box */ err = imagemap_extract(c); if (err != NSERROR_OK) { - LOG("imagemap extraction failed"); + NSLOG(netsurf, INFO, "imagemap extraction failed"); html_object_free_objects(c); content_broadcast_errorcode(&c->base, err); content_set_error(&c->base); @@ -601,14 +601,14 @@ void html_finish_conversion(html_content *htmlc) } /* convert dom tree to box tree */ - LOG("DOM to box (%p)", htmlc); + NSLOG(netsurf, INFO, "DOM to box (%p)", htmlc); content_set_status(&htmlc->base, messages_get("Processing")); msg_data.explicit_status_text = NULL; content_broadcast(&htmlc->base, CONTENT_MSG_STATUS, &msg_data); exc = dom_document_get_document_element(htmlc->document, (void *) &html); if ((exc != DOM_NO_ERR) || (html == NULL)) { - LOG("error retrieving html element from dom"); + NSLOG(netsurf, INFO, "error retrieving html element from dom"); content_broadcast_errorcode(&htmlc->base, NSERROR_DOM); content_set_error(&htmlc->base); return; @@ -616,7 +616,7 @@ void html_finish_conversion(html_content *htmlc) error = dom_to_box(html, htmlc, html_box_convert_done); if (error != NSERROR_OK) { - LOG("box conversion failed"); + NSLOG(netsurf, INFO, "box conversion failed"); dom_node_unref(html); html_object_free_objects(htmlc); content_broadcast_errorcode(&htmlc->base, error); @@ -687,9 +687,10 @@ dom_default_action_DOMNodeInserted_cb(struct dom_event *evt, void *pw) content_broadcast(&htmlc->base, CONTENT_MSG_GETCTX, &msg_data); - LOG("javascript context: %p (htmlc: %p)", - htmlc->jscontext, - htmlc); + NSLOG(netsurf, INFO, + "javascript context: %p (htmlc: %p)", + htmlc->jscontext, + htmlc); } if (htmlc->jscontext != NULL) { js_handle_new_element(htmlc->jscontext, @@ -795,22 +796,22 @@ html_document_user_data_handler(dom_node_operation operation, switch (operation) { case DOM_NODE_CLONED: - LOG("Cloned"); + NSLOG(netsurf, INFO, "Cloned"); break; case DOM_NODE_RENAMED: - LOG("Renamed"); + NSLOG(netsurf, INFO, "Renamed"); break; case DOM_NODE_IMPORTED: - LOG("imported"); + NSLOG(netsurf, INFO, "imported"); break; case DOM_NODE_ADOPTED: - LOG("Adopted"); + NSLOG(netsurf, INFO, "Adopted"); break; case DOM_NODE_DELETED: /* This is the only path I expect */ break; default: - LOG("User data operation not handled."); + NSLOG(netsurf, INFO, "User data operation not handled."); assert(0); } } @@ -935,7 +936,7 @@ html_create_html_data(html_content *c, const http_parameter *params) lwc_string_unref(c->universal); c->universal = NULL; - LOG("Unable to set user data."); + NSLOG(netsurf, INFO, "Unable to set user data."); return NSERROR_DOM; } @@ -1142,11 +1143,11 @@ static bool html_convert(struct content *c) exc = dom_document_get_quirks_mode(htmlc->document, &htmlc->quirks); if (exc == DOM_NO_ERR) { html_css_quirks_stylesheets(htmlc); - LOG("quirks set to %d", htmlc->quirks); + NSLOG(netsurf, INFO, "quirks set to %d", htmlc->quirks); } htmlc->base.active--; /* the html fetch is no longer active */ - LOG("%d fetches active (%p)", htmlc->base.active, c); + NSLOG(netsurf, INFO, "%d fetches active (%p)", htmlc->base.active, c); /* The parse cannot be completed here because it may be paused * untill all the resources being fetched have completed. @@ -1199,11 +1200,11 @@ html_begin_conversion(html_content *htmlc) * complete to avoid repeating the completion pointlessly. */ if (htmlc->parse_completed == false) { - LOG("Completing parse (%p)", htmlc); + NSLOG(netsurf, INFO, "Completing parse (%p)", htmlc); /* complete parsing */ error = dom_hubbub_parser_completed(htmlc->parser); if (error != DOM_HUBBUB_OK) { - LOG("Parsing failed"); + NSLOG(netsurf, INFO, "Parsing failed"); content_broadcast_errorcode(&htmlc->base, libdom_hubbub_error_to_nserror(error)); @@ -1214,15 +1215,15 @@ html_begin_conversion(html_content *htmlc) } if (html_can_begin_conversion(htmlc) == false) { - LOG("Can't begin conversion (%p)", htmlc); + NSLOG(netsurf, INFO, "Can't begin conversion (%p)", htmlc); /* We can't proceed (see commentary above) */ return true; } /* Give up processing if we've been aborted */ if (htmlc->aborted) { - LOG("Conversion aborted (%p) (active: %u)", htmlc, - htmlc->base.active); + NSLOG(netsurf, INFO, "Conversion aborted (%p) (active: %u)", + htmlc, htmlc->base.active); content_set_error(&htmlc->base); content_broadcast_errorcode(&htmlc->base, NSERROR_STOPPED); return false; @@ -1258,7 +1259,7 @@ html_begin_conversion(html_content *htmlc) /* locate root element and ensure it is html */ exc = dom_document_get_document_element(htmlc->document, (void *) &html); if ((exc != DOM_NO_ERR) || (html == NULL)) { - LOG("error retrieving html element from dom"); + NSLOG(netsurf, INFO, "error retrieving html element from dom"); content_broadcast_errorcode(&htmlc->base, NSERROR_DOM); return false; } @@ -1268,7 +1269,7 @@ html_begin_conversion(html_content *htmlc) (node_name == NULL) || (!dom_string_caseless_lwc_isequal(node_name, corestring_lwc_html))) { - LOG("root element not html"); + NSLOG(netsurf, INFO, "root element not html"); content_broadcast_errorcode(&htmlc->base, NSERROR_DOM); dom_node_unref(html); return false; @@ -1374,7 +1375,8 @@ static void html_stop(struct content *c) break; default: - LOG("Unexpected status %d (%p)", c->status, c); + NSLOG(netsurf, INFO, "Unexpected status %d (%p)", c->status, + c); assert(0); } } @@ -1531,7 +1533,7 @@ static void html_destroy(struct content *c) html_content *html = (html_content *) c; struct form *f, *g; - LOG("content %p", c); + NSLOG(netsurf, INFO, "content %p", c); /* Destroy forms */ for (f = html->forms; f != NULL; f = g) { @@ -1920,7 +1922,7 @@ static void html__dom_user_data_handler(dom_node_operation operation, free(data); break; default: - LOG("User data operation not handled."); + NSLOG(netsurf, INFO, "User data operation not handled."); assert(0); } } @@ -1936,7 +1938,8 @@ static void html__set_file_gadget_filename(struct content *c, ret = guit->utf8->local_to_utf8(fn, 0, &utf8_fn); if (ret != NSERROR_OK) { assert(ret != NSERROR_BAD_ENCODING); - LOG("utf8 to local encoding conversion failed"); + NSLOG(netsurf, INFO, + "utf8 to local encoding conversion failed"); /* Load was for us - just no memory */ return; } @@ -2088,7 +2091,7 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file) if (ret != NSERROR_OK) { /* bad encoding shouldn't happen */ assert(ret != NSERROR_BAD_ENCODING); - LOG("local to utf8 encoding failed"); + NSLOG(netsurf, INFO, "local to utf8 encoding failed"); free(buffer); guit->misc->warning("NoMemory", NULL); return true; @@ -2154,19 +2157,19 @@ html_debug_dump(struct content *c, FILE *f, enum content_debug op) ret = NSERROR_OK; } else { if (htmlc->document == NULL) { - LOG("No document to dump"); + NSLOG(netsurf, INFO, "No document to dump"); return NSERROR_DOM; } exc = dom_document_get_document_element(htmlc->document, (void *) &html); if ((exc != DOM_NO_ERR) || (html == NULL)) { - LOG("Unable to obtain root node"); + NSLOG(netsurf, INFO, "Unable to obtain root node"); return NSERROR_DOM; } ret = libdom_dump_structure(html, f, 0); - LOG("DOM structure dump returning %d", ret); + NSLOG(netsurf, INFO, "DOM structure dump returning %d", ret); dom_node_unref(html); } diff --git a/render/html_css.c b/render/html_css.c index ad1470daf..303bee64d 100644 --- a/render/html_css.c +++ b/render/html_css.c @@ -103,18 +103,21 @@ html_convert_css_callback(hlcache_handle *css, switch (event->type) { case CONTENT_MSG_DONE: - LOG("done stylesheet slot %d '%s'", i, nsurl_access(hlcache_handle_get_url(css))); + NSLOG(netsurf, INFO, "done stylesheet slot %d '%s'", i, + nsurl_access(hlcache_handle_get_url(css))); parent->base.active--; - LOG("%d fetches active", parent->base.active); + NSLOG(netsurf, INFO, "%d fetches active", parent->base.active); break; case CONTENT_MSG_ERROR: - LOG("stylesheet %s failed: %s", nsurl_access(hlcache_handle_get_url(css)), event->data.error); + NSLOG(netsurf, INFO, "stylesheet %s failed: %s", + nsurl_access(hlcache_handle_get_url(css)), + event->data.error); case CONTENT_MSG_ERRORCODE: hlcache_handle_release(css); s->sheet = NULL; parent->base.active--; - LOG("%d fetches active", parent->base.active); + NSLOG(netsurf, INFO, "%d fetches active", parent->base.active); content_add_error(&parent->base, "?", 0); break; @@ -151,7 +154,7 @@ html_stylesheet_from_domnode(html_content *c, exc = dom_node_get_text_content(node, &style); if ((exc != DOM_NO_ERR) || (style == NULL)) { - LOG("No text content"); + NSLOG(netsurf, INFO, "No text content"); return NSERROR_OK; } @@ -182,7 +185,7 @@ html_stylesheet_from_domnode(html_content *c, nsurl_unref(url); c->base.active++; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", c->base.active); return NSERROR_OK; } @@ -254,13 +257,14 @@ static bool html_css_process_modified_style(html_content *c, error = html_stylesheet_from_domnode(c, s->node, &sheet); if (error != NSERROR_OK) { - LOG("Failed to update sheet"); + NSLOG(netsurf, INFO, "Failed to update sheet"); content_broadcast_errorcode(&c->base, error); return false; } if (sheet != NULL) { - LOG("Updating sheet %p with %p", s->sheet, sheet); + NSLOG(netsurf, INFO, "Updating sheet %p with %p", s->sheet, + sheet); if (s->sheet != NULL) { switch (content_get_status(s->sheet)) { @@ -269,7 +273,8 @@ static bool html_css_process_modified_style(html_content *c, default: hlcache_handle_abort(s->sheet); c->base.active--; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", + c->base.active); } hlcache_handle_release(s->sheet); } @@ -314,7 +319,9 @@ bool html_css_update_style(html_content *c, dom_node *style) s = html_create_style_element(c, style); } if (s == NULL) { - LOG("Could not find or create inline stylesheet for %p", style); + NSLOG(netsurf, INFO, + "Could not find or create inline stylesheet for %p", + style); return false; } @@ -418,7 +425,8 @@ bool html_css_process_link(html_content *htmlc, dom_node *node) } dom_string_unref(href); - LOG("linked stylesheet %i '%s'", htmlc->stylesheet_count, nsurl_access(joined)); + NSLOG(netsurf, INFO, "linked stylesheet %i '%s'", + htmlc->stylesheet_count, nsurl_access(joined)); /* extend stylesheets array to allow for new sheet */ stylesheets = realloc(htmlc->stylesheets, @@ -453,7 +461,7 @@ bool html_css_process_link(html_content *htmlc, dom_node *node) htmlc->stylesheet_count++; htmlc->base.active++; - LOG("%d fetches active", htmlc->base.active); + NSLOG(netsurf, INFO, "%d fetches active", htmlc->base.active); return true; @@ -518,7 +526,7 @@ nserror html_css_quirks_stylesheets(html_content *c) } c->base.active++; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", c->base.active); } return ns_error; @@ -562,7 +570,7 @@ nserror html_css_new_stylesheets(html_content *c) } c->base.active++; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", c->base.active); if (nsoption_bool(block_advertisements)) { @@ -576,7 +584,7 @@ nserror html_css_new_stylesheets(html_content *c) } c->base.active++; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", c->base.active); } @@ -589,7 +597,7 @@ nserror html_css_new_stylesheets(html_content *c) } c->base.active++; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", c->base.active); return ns_error; } diff --git a/render/html_css_fetcher.c b/render/html_css_fetcher.c index 9eda6aeb7..0f8809a42 100644 --- a/render/html_css_fetcher.c +++ b/render/html_css_fetcher.c @@ -61,13 +61,15 @@ static html_css_fetcher_context *ring = NULL; static bool html_css_fetcher_initialise(lwc_string *scheme) { - LOG("html_css_fetcher_initialise called for %s", lwc_string_data(scheme)); + NSLOG(netsurf, INFO, "html_css_fetcher_initialise called for %s", + lwc_string_data(scheme)); return true; } static void html_css_fetcher_finalise(lwc_string *scheme) { - LOG("html_css_fetcher_finalise called for %s", lwc_string_data(scheme)); + NSLOG(netsurf, INFO, "html_css_fetcher_finalise called for %s", + lwc_string_data(scheme)); } static bool html_css_fetcher_can_fetch(const nsurl *url) @@ -251,7 +253,8 @@ static void html_css_fetcher_poll(lwc_string *scheme) html_css_fetcher_send_callback(&msg, c); } } else { - LOG("Processing of %s failed!", nsurl_access(c->url)); + NSLOG(netsurf, INFO, "Processing of %s failed!", + nsurl_access(c->url)); /* Ensure that we're unlocked here. If we aren't, * then html_css_fetcher_process() is broken. @@ -290,7 +293,7 @@ nserror html_css_fetcher_register(void) if (lwc_intern_string("x-ns-css", SLEN("x-ns-css"), &scheme) != lwc_error_ok) { - LOG("could not intern \"x-ns-css\"."); + NSLOG(netsurf, INFO, "could not intern \"x-ns-css\"."); return NSERROR_INIT_FAILED; } diff --git a/render/html_interaction.c b/render/html_interaction.c index 1ae9801c6..55da3cc03 100644 --- a/render/html_interaction.c +++ b/render/html_interaction.c @@ -289,7 +289,7 @@ html__image_coords_dom_user_data_handler(dom_node_operation operation, break; default: - LOG("User data operation not handled."); + NSLOG(netsurf, INFO, "User data operation not handled."); assert(0); } } diff --git a/render/html_object.c b/render/html_object.c index c86c57520..e98bdba0b 100644 --- a/render/html_object.c +++ b/render/html_object.c @@ -160,7 +160,7 @@ html_object_callback(hlcache_handle *object, case CONTENT_MSG_DONE: c->base.active--; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", c->base.active); html_object_done(box, object, o->background); @@ -191,7 +191,8 @@ html_object_callback(hlcache_handle *object, if (box != NULL) { c->base.active--; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", + c->base.active); content_add_error(&c->base, "?", 0); html_object_failed(box, c, o->background); @@ -503,7 +504,8 @@ static bool html_replace_object(struct content_html_object *object, nsurl *url) /* remove existing object */ if (content_get_status(object->content) != CONTENT_STATUS_DONE) { c->base.active--; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", + c->base.active); } hlcache_handle_release(object->content); @@ -524,7 +526,7 @@ static bool html_replace_object(struct content_html_object *object, nsurl *url) for (page = c; page != NULL; page = page->page) { page->base.active++; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", c->base.active); page->base.status = CONTENT_STATUS_READY; } @@ -607,7 +609,8 @@ nserror html_object_abort_objects(html_content *htmlc) object->content = NULL; if (object->box != NULL) { htmlc->base.active--; - LOG("%d fetches active", htmlc->base.active); + NSLOG(netsurf, INFO, "%d fetches active", + htmlc->base.active); } break; @@ -645,7 +648,7 @@ nserror html_object_free_objects(html_content *html) struct content_html_object *victim = html->object_list; if (victim->content != NULL) { - LOG("object %p", victim->content); + NSLOG(netsurf, INFO, "object %p", victim->content); if (content_get_type(victim->content) == CONTENT_HTML) { guit->misc->schedule(-1, html_object_refresh, victim); @@ -707,7 +710,7 @@ bool html_fetch_object(html_content *c, nsurl *url, struct box *box, c->num_objects++; if (box != NULL) { c->base.active++; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", c->base.active); } return true; diff --git a/render/html_script.c b/render/html_script.c index 6ed74c5c4..186e5203b 100644 --- a/render/html_script.c +++ b/render/html_script.c @@ -165,19 +165,22 @@ convert_script_async_cb(hlcache_handle *script, break; case CONTENT_MSG_DONE: - LOG("script %d done '%s'", i, nsurl_access(hlcache_handle_get_url(script))); + NSLOG(netsurf, INFO, "script %d done '%s'", i, + nsurl_access(hlcache_handle_get_url(script))); parent->base.active--; - LOG("%d fetches active", parent->base.active); + NSLOG(netsurf, INFO, "%d fetches active", parent->base.active); break; case CONTENT_MSG_ERROR: - LOG("script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), event->data.error); + NSLOG(netsurf, INFO, "script %s failed: %s", + nsurl_access(hlcache_handle_get_url(script)), + event->data.error); case CONTENT_MSG_ERRORCODE: hlcache_handle_release(script); s->data.handle = NULL; parent->base.active--; - LOG("%d fetches active", parent->base.active); + NSLOG(netsurf, INFO, "%d fetches active", parent->base.active); content_add_error(&parent->base, "?", 0); break; @@ -219,19 +222,22 @@ convert_script_defer_cb(hlcache_handle *script, switch (event->type) { case CONTENT_MSG_DONE: - LOG("script %d done '%s'", i, nsurl_access(hlcache_handle_get_url(script))); + NSLOG(netsurf, INFO, "script %d done '%s'", i, + nsurl_access(hlcache_handle_get_url(script))); parent->base.active--; - LOG("%d fetches active", parent->base.active); + NSLOG(netsurf, INFO, "%d fetches active", parent->base.active); break; case CONTENT_MSG_ERROR: - LOG("script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), event->data.error); + NSLOG(netsurf, INFO, "script %s failed: %s", + nsurl_access(hlcache_handle_get_url(script)), + event->data.error); case CONTENT_MSG_ERRORCODE: hlcache_handle_release(script); s->data.handle = NULL; parent->base.active--; - LOG("%d fetches active", parent->base.active); + NSLOG(netsurf, INFO, "%d fetches active", parent->base.active); content_add_error(&parent->base, "?", 0); break; @@ -274,9 +280,10 @@ convert_script_sync_cb(hlcache_handle *script, switch (event->type) { case CONTENT_MSG_DONE: - LOG("script %d done '%s'", i, nsurl_access(hlcache_handle_get_url(script))); + NSLOG(netsurf, INFO, "script %d done '%s'", i, + nsurl_access(hlcache_handle_get_url(script))); parent->base.active--; - LOG("%d fetches active", parent->base.active); + NSLOG(netsurf, INFO, "%d fetches active", parent->base.active); s->already_started = true; @@ -293,20 +300,22 @@ convert_script_sync_cb(hlcache_handle *script, /* continue parse */ err = dom_hubbub_parser_pause(parent->parser, false); if (err != DOM_HUBBUB_OK) { - LOG("unpause returned 0x%x", err); + NSLOG(netsurf, INFO, "unpause returned 0x%x", err); } break; case CONTENT_MSG_ERROR: - LOG("script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), event->data.error); + NSLOG(netsurf, INFO, "script %s failed: %s", + nsurl_access(hlcache_handle_get_url(script)), + event->data.error); case CONTENT_MSG_ERRORCODE: hlcache_handle_release(script); s->data.handle = NULL; parent->base.active--; - LOG("%d fetches active", parent->base.active); + NSLOG(netsurf, INFO, "%d fetches active", parent->base.active); content_add_error(&parent->base, "?", 0); s->already_started = true; @@ -314,7 +323,7 @@ convert_script_sync_cb(hlcache_handle *script, /* continue parse */ err = dom_hubbub_parser_pause(parent->parser, false); if (err != DOM_HUBBUB_OK) { - LOG("unpause returned 0x%x", err); + NSLOG(netsurf, INFO, "unpause returned 0x%x", err); } break; @@ -360,7 +369,8 @@ exec_src_script(html_content *c, return DOM_HUBBUB_NOMEM; } - LOG("script %i '%s'", c->scripts_count, nsurl_access(joined)); + NSLOG(netsurf, INFO, "script %i '%s'", c->scripts_count, + nsurl_access(joined)); /* there are three ways to process the script tag at this point: * @@ -438,11 +448,11 @@ exec_src_script(html_content *c, */ /* mark duff script fetch as already started */ nscript->already_started = true; - LOG("Fetch failed with error %d", ns_error); + NSLOG(netsurf, INFO, "Fetch failed with error %d", ns_error); } else { /* update base content active fetch count */ c->base.active++; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", c->base.active); switch (script_type) { case HTML_SCRIPT_SYNC: @@ -525,14 +535,15 @@ html_process_script(void *ctx, dom_node *node) msg_data.jscontext = &c->jscontext; content_broadcast(&c->base, CONTENT_MSG_GETCTX, &msg_data); - LOG("javascript context %p ", c->jscontext); + NSLOG(netsurf, INFO, "javascript context %p ", c->jscontext); if (c->jscontext == NULL) { /* no context and it could not be created, abort */ return DOM_HUBBUB_OK; } } - LOG("content %p parser %p node %p", c, c->parser, node); + NSLOG(netsurf, INFO, "content %p parser %p node %p", c, c->parser, + node); exc = dom_element_get_attribute(node, corestring_dom_type, &mimetype); if (exc != DOM_NO_ERR || mimetype == NULL) { diff --git a/render/imagemap.c b/render/imagemap.c index 6e2504bdc..0d3b42a1b 100644 --- a/render/imagemap.c +++ b/render/imagemap.c @@ -241,21 +241,35 @@ void imagemap_dump(html_content *c) map = c->imagemaps[i]; while (map != NULL) { - LOG("Imagemap: %s", map->key); + NSLOG(netsurf, INFO, "Imagemap: %s", map->key); for (entry = map->list; entry; entry = entry->next) { switch (entry->type) { case IMAGEMAP_DEFAULT: - LOG("\tDefault: %s", nsurl_access(entry->url)); + NSLOG(netsurf, INFO, "\tDefault: %s", + nsurl_access(entry->url)); break; case IMAGEMAP_RECT: - LOG("\tRectangle: %s: [(%d,%d),(%d,%d)]", nsurl_access(entry->url), entry->bounds.rect.x0, entry->bounds.rect.y0, entry->bounds.rect.x1, entry->bounds.rect.y1); + NSLOG(netsurf, INFO, + "\tRectangle: %s: [(%d,%d),(%d,%d)]", + nsurl_access(entry->url), + entry->bounds.rect.x0, + entry->bounds.rect.y0, + entry->bounds.rect.x1, + entry->bounds.rect.y1); break; case IMAGEMAP_CIRCLE: - LOG("\tCircle: %s: [(%d,%d),%d]", nsurl_access(entry->url), entry->bounds.circle.x, entry->bounds.circle.y, entry->bounds.circle.r); + NSLOG(netsurf, INFO, + "\tCircle: %s: [(%d,%d),%d]", + nsurl_access(entry->url), + entry->bounds.circle.x, + entry->bounds.circle.y, + entry->bounds.circle.r); break; case IMAGEMAP_POLY: - LOG("\tPolygon: %s:", nsurl_access(entry->url)); + NSLOG(netsurf, INFO, + "\tPolygon: %s:", + nsurl_access(entry->url)); for (j = 0; j != entry->bounds.poly.num; j++) { fprintf(stderr, "(%d,%d) ", diff --git a/render/layout.c b/render/layout.c index 6782fdfc6..962b4d403 100644 --- a/render/layout.c +++ b/render/layout.c @@ -343,7 +343,7 @@ layout_minmax_line(struct box *first, b->type == BOX_INLINE_END); #ifdef LAYOUT_DEBUG - LOG("%p: min %i, max %i", b, min, max); + NSLOG(netsurf, INFO, "%p: min %i, max %i", b, min, max); #endif if (b->type == BOX_BR) { @@ -625,7 +625,7 @@ layout_minmax_line(struct box *first, *line_max = max; #ifdef LAYOUT_DEBUG - LOG("line_min %i, line_max %i", min, max); + NSLOG(netsurf, INFO, "line_min %i, line_max %i", min, max); #endif assert(b != first); @@ -1470,7 +1470,7 @@ find_sides(struct box *fl, int fy0, fy1, fx0, fx1; #ifdef LAYOUT_DEBUG - LOG("y0 %i, y1 %i, x0 %i, x1 %i", y0, y1, *x0, *x1); + NSLOG(netsurf, INFO, "y0 %i, y1 %i, x0 %i, x1 %i", y0, y1, *x0, *x1); #endif *left = *right = 0; @@ -1501,7 +1501,8 @@ find_sides(struct box *fl, } #ifdef LAYOUT_DEBUG - LOG("x0 %i, x1 %i, left %p, right %p", *x0, *x1, *left, *right); + NSLOG(netsurf, INFO, "x0 %i, x1 %i, left %p, right %p", *x0, *x1, + *left, *right); #endif } @@ -1965,13 +1966,17 @@ static bool layout_table(struct box *table, int available_width, /* calculate width required by cells */ for (i = 0; i != columns; i++) { #ifdef LAYOUT_DEBUG - LOG("table %p, column %u: type %s, width %i, min %i, max %i", table, i, ((const char *[]){ + NSLOG(netsurf, INFO, + "table %p, column %u: type %s, width %i, min %i, max %i", + table, + i, ((const char *[]){ "UNKNOWN", "FIXED", "AUTO", "PERCENT", - "RELATIVE" - })[col[i].type], col[i].width, col[i].min, col[i].max); + "RELATIVE", + })[col[i].type], col[i].width, col[i].min, + col[i].max); #endif if (col[i].positioned) { @@ -1991,14 +1996,16 @@ static bool layout_table(struct box *table, int available_width, required_width += col[i].min; #ifdef LAYOUT_DEBUG - LOG("required_width %i", required_width); + NSLOG(netsurf, INFO, "required_width %i", required_width); #endif } required_width += (columns + 1 - positioned_columns) * border_spacing_h; #ifdef LAYOUT_DEBUG - LOG("width %i, min %i, max %i, auto %i, required %i", table_width, table->min_width, table->max_width, auto_width, required_width); + NSLOG(netsurf, INFO, + "width %i, min %i, max %i, auto %i, required %i", table_width, + table->min_width, table->max_width, auto_width, required_width); #endif if (auto_width < required_width) { @@ -2449,7 +2456,8 @@ static bool layout_block_object(struct box *block) assert(block->object); #ifdef LAYOUT_DEBUG - LOG("block %p, object %s, width %i", block, hlcache_handle_get_url(block->object), block->width); + NSLOG(netsurf, INFO, "block %p, object %s, width %i", block, + hlcache_handle_get_url(block->object), block->width); #endif if (content_get_type(block->object) == CONTENT_HTML) { @@ -2747,7 +2755,7 @@ layout_block_context(struct box *block, } #ifdef LAYOUT_DEBUG - LOG("box %p, cx %i, cy %i", box, cx, cy); + NSLOG(netsurf, INFO, "box %p, cx %i, cy %i", box, cx, cy); #endif /* Layout (except tables). */ @@ -3625,7 +3633,8 @@ static void layout_compute_relative_offset(struct box *box, int *x, int *y) } #ifdef LAYOUT_DEBUG - LOG("left %i, right %i, top %i, bottom %i", left, right, top, bottom); + NSLOG(netsurf, INFO, "left %i, right %i, top %i, bottom %i", left, + right, top, bottom); #endif *x = left; @@ -3888,8 +3897,11 @@ layout_text_box_split(html_content *content, else c2->parent->last = c2; #ifdef LAYOUT_DEBUG - LOG("split_box %p len: %u \"%.*s\"", split_box, split_box->length, split_box->length, split_box->text); - LOG(" new_box %p len: %u \"%.*s\"", c2, c2->length, c2->length, c2->text); + NSLOG(netsurf, INFO, "split_box %p len: %u \"%.*s\"", + split_box, split_box->length, split_box->length, + split_box->text); + NSLOG(netsurf, INFO, " new_box %p len: %u \"%.*s\"", c2, + c2->length, c2->length, c2->text); #endif return true; } @@ -4080,7 +4092,8 @@ place_float_below(struct box *c, int width, int cx, int y, struct box *cont) y : cont->cached_place_below_level; #ifdef LAYOUT_DEBUG - LOG("c %p, width %i, cx %i, y %i, cont %p", c, width, cx, y, cont); + NSLOG(netsurf, INFO, "c %p, width %i, cx %i, y %i, cont %p", c, + width, cx, y, cont); #endif do { @@ -4159,7 +4172,15 @@ layout_line(struct box *first, plot_font_style_t fstyle; #ifdef LAYOUT_DEBUG - LOG("first %p, first->text '%.*s', width %i, y %i, cx %i, cy %i", first, (int)first->length, first->text, *width, *y, cx, cy); + NSLOG(netsurf, INFO, + "first %p, first->text '%.*s', width %i, y %i, cx %i, cy %i", + first, + (int)first->length, + first->text, + *width, + *y, + cx, + cy); #endif /* find sides at top of line */ @@ -4190,7 +4211,7 @@ layout_line(struct box *first, * body executed at least once * keep in sync with the loop in layout_minmax_line() */ #ifdef LAYOUT_DEBUG - LOG("x0 %i, x1 %i, x1 - x0 %i", x0, x1, x1 - x0); + NSLOG(netsurf, INFO, "x0 %i, x1 %i, x1 - x0 %i", x0, x1, x1 - x0); #endif for (x = 0, b = first; x <= x1 - x0 && b != 0; b = b->next) { @@ -4203,7 +4224,7 @@ layout_line(struct box *first, b->type == BOX_INLINE_END); #ifdef LAYOUT_DEBUG - LOG("pass 1: b %p, x %i", b, x); + NSLOG(netsurf, INFO, "pass 1: b %p, x %i", b, x); #endif if (b->type == BOX_BR) @@ -4414,12 +4435,12 @@ layout_line(struct box *first, /* pass 2: place boxes in line: loop body executed at least once */ #ifdef LAYOUT_DEBUG - LOG("x0 %i, x1 %i, x1 - x0 %i", x0, x1, x1 - x0); + NSLOG(netsurf, INFO, "x0 %i, x1 %i, x1 - x0 %i", x0, x1, x1 - x0); #endif for (x = x_previous = 0, b = first; x <= x1 - x0 && b; b = b->next) { #ifdef LAYOUT_DEBUG - LOG("pass 2: b %p, x %i", b, x); + NSLOG(netsurf, INFO, "pass 2: b %p, x %i", b, x); #endif if (b->type == BOX_INLINE_BLOCK && @@ -4489,7 +4510,7 @@ layout_line(struct box *first, } else { /* float */ #ifdef LAYOUT_DEBUG - LOG("float %p", b); + NSLOG(netsurf, INFO, "float %p", b); #endif d = b->children; @@ -4501,7 +4522,8 @@ layout_line(struct box *first, return false; #ifdef LAYOUT_DEBUG - LOG("%p : %d %d", d, d->margin[TOP], d->border[TOP].width); + NSLOG(netsurf, INFO, "%p : %d %d", d, d->margin[TOP], + d->border[TOP].width); #endif d->x = d->margin[LEFT] + d->border[LEFT].width; @@ -4654,7 +4676,7 @@ layout_line(struct box *first, } x += space_before + w; #ifdef LAYOUT_DEBUG - LOG("forcing"); + NSLOG(netsurf, INFO, "forcing"); #endif } else if ((split == 0 || x1 - x0 <= x + space_before + w) && inline_count == 1) { @@ -4664,11 +4686,16 @@ layout_line(struct box *first, used_height = 0; if (left) { #ifdef LAYOUT_DEBUG - LOG("cy %i, left->y %i, left->height %i", cy, left->y, left->height); + NSLOG(netsurf, INFO, + "cy %i, left->y %i, left->height %i", + cy, + left->y, + left->height); #endif used_height = left->y + left->height - cy + 1; #ifdef LAYOUT_DEBUG - LOG("used_height %i", used_height); + NSLOG(netsurf, INFO, "used_height %i", + used_height); #endif } if (right && used_height < @@ -4680,20 +4707,22 @@ layout_line(struct box *first, b = split_box; #ifdef LAYOUT_DEBUG - LOG("moving below float"); + NSLOG(netsurf, INFO, "moving below float"); #endif } else if (split == 0 || x1 - x0 <= x + space_before + w) { /* first word of box doesn't fit so leave box for next * line */ b = split_box; #ifdef LAYOUT_DEBUG - LOG("leaving for next line"); + NSLOG(netsurf, INFO, "leaving for next line"); #endif } else { /* fit as many words as possible */ assert(split != 0); #ifdef LAYOUT_DEBUG - LOG("'%.*s' %i %zu %i", (int)split_box->length, split_box->text, x1 - x0, split, w); + NSLOG(netsurf, INFO, "'%.*s' %i %zu %i", + (int)split_box->length, split_box->text, + x1 - x0, split, w); #endif if (split != split_box->length) { if (!layout_text_box_split(content, &fstyle, @@ -4703,7 +4732,7 @@ layout_line(struct box *first, } x += space_before + w; #ifdef LAYOUT_DEBUG - LOG("fitting words"); + NSLOG(netsurf, INFO, "fitting words"); #endif } move_y = true; @@ -4843,7 +4872,13 @@ bool layout_inline_container(struct box *inline_container, int width, assert(inline_container->type == BOX_INLINE_CONTAINER); #ifdef LAYOUT_DEBUG - LOG("inline_container %p, width %i, cont %p, cx %i, cy %i", inline_container, width, cont, cx, cy); + NSLOG(netsurf, INFO, + "inline_container %p, width %i, cont %p, cx %i, cy %i", + inline_container, + width, + cont, + cx, + cy); #endif has_text_children = false; @@ -4873,7 +4908,7 @@ bool layout_inline_container(struct box *inline_container, int width, */ for (c = inline_container->children; c; ) { #ifdef LAYOUT_DEBUG - LOG("c %p", c); + NSLOG(netsurf, INFO, "c %p", c); #endif curwidth = inline_container->width; if (!layout_line(c, &curwidth, &y, cx, cy + y, cont, first_line, diff --git a/render/table.c b/render/table.c index acf00c70e..3210fde2d 100644 --- a/render/table.c +++ b/render/table.c @@ -219,13 +219,14 @@ bool table_calculate_column_types(struct box *table) #ifdef TABLE_DEBUG for (i = 0; i != table->columns; i++) - LOG("table %p, column %u: type %s, width %i", table, i, ((const char *[]){ + NSLOG(netsurf, INFO, + "table %p, column %u: type %s, width %i", table, i, ((const char *[]){ "UNKNOWN", "FIXED", "AUTO", "PERCENT", - "RELATIVE" - })[col[i].type], col[i].width); + "RELATIVE", + })[col[i].type], col[i].width); #endif return true; diff --git a/render/textplain.c b/render/textplain.c index 2f2d757c8..ab2d55955 100644 --- a/render/textplain.c +++ b/render/textplain.c @@ -423,7 +423,7 @@ static void textplain_reformat(struct content *c, int width, int height) size_t line_start; nserror res; - LOG("content %p w:%d h:%d", c, width, height); + NSLOG(netsurf, INFO, "content %p w:%d h:%d", c, width, height); /* compute available columns (assuming monospaced font) - use 8 * characters for better accuracy @@ -522,7 +522,7 @@ static void textplain_reformat(struct content *c, int width, int height) return; no_memory: - LOG("out of memory (line_count %lu)", line_count); + NSLOG(netsurf, INFO, "out of memory (line_count %lu)", line_count); return; } diff --git a/test/urldbtest.c b/test/urldbtest.c index 75a7210b0..3cba8835f 100644 --- a/test/urldbtest.c +++ b/test/urldbtest.c @@ -143,7 +143,7 @@ static nsurl *make_url(const char *url) { nsurl *nsurl; if (nsurl_create(url, &nsurl) != NSERROR_OK) { - LOG("failed creating nsurl"); + NSLOG(netsurf, INFO, "failed creating nsurl"); exit(1); } return nsurl; @@ -229,9 +229,8 @@ static void urldb_lwc_iterator(lwc_string *str, void *pw) { int *scount = pw; - LOG("[%3u] %.*s", str->refcnt, - (int)lwc_string_length(str), - lwc_string_data(str)); + NSLOG(netsurf, INFO, "[%3u] %.*s", str->refcnt, + (int)lwc_string_length(str), lwc_string_data(str)); (*scount)++; } @@ -245,7 +244,7 @@ static void urldb_teardown(void) corestrings_fini(); - LOG("Remaining lwc strings:"); + NSLOG(netsurf, INFO, "Remaining lwc strings:"); lwc_iterate_strings(urldb_lwc_iterator, &scount); ck_assert_int_eq(scount, 0); } @@ -712,7 +711,7 @@ static int cb_count; static bool urldb_iterate_entries_cb(nsurl *url, const struct url_data *data) { - LOG("url: %s", nsurl_access(url)); + NSLOG(netsurf, INFO, "url: %s", nsurl_access(url)); /* fprintf(stderr, "url:%s\ntitle:%s\n\n",nsurl_access(url), data->title); */ cb_count++; return true; @@ -995,7 +994,7 @@ static TCase *urldb_case_create(void) static bool urldb_iterate_cookies_cb(const struct cookie_data *data) { - LOG("%p", data); + NSLOG(netsurf, INFO, "%p", data); /* fprintf(stderr, "domain:%s\npath:%s\nname:%s\n\n",data->domain, data->path, data->name);*/ return true; } diff --git a/utils/filename.c b/utils/filename.c index 9c95901a1..01a403fd9 100644 --- a/utils/filename.c +++ b/utils/filename.c @@ -84,7 +84,8 @@ const char *filename_request(void) /* no available slots - create a new directory */ dir = filename_create_directory(NULL); if (dir == NULL) { - LOG("Failed to create a new directory."); + NSLOG(netsurf, INFO, + "Failed to create a new directory."); return NULL; } i = 63; @@ -182,10 +183,12 @@ bool filename_initialise(void) for (start = directory; *start != '\0'; start++) { if (*start == '/') { *start = '\0'; - LOG("Creating \"%s\"", directory); + NSLOG(netsurf, INFO, "Creating \"%s\"", directory); ret = nsmkdir(directory, S_IRWXU); if (ret != 0 && errno != EEXIST) { - LOG("Failed to create directory \"%s\"", directory); + NSLOG(netsurf, INFO, + "Failed to create directory \"%s\"", + directory); free(directory); return false; } @@ -194,7 +197,7 @@ bool filename_initialise(void) } } - LOG("Temporary directory location: %s", directory); + NSLOG(netsurf, INFO, "Temporary directory location: %s", directory); ret = nsmkdir(directory, S_IRWXU); free(directory); @@ -280,7 +283,8 @@ bool filename_flush_directory(const char *folder, int depth) child[sizeof(child) - 1] = '\0'; if (stat(child, &statbuf) == -1) { - LOG("Unable to stat %s: %s", child, strerror(errno)); + NSLOG(netsurf, INFO, "Unable to stat %s: %s", child, + strerror(errno)); continue; } @@ -348,7 +352,8 @@ bool filename_flush_directory(const char *folder, int depth) filename_delete_recursive(child); if (remove(child)) - LOG("Failed to remove '%s'", child); + NSLOG(netsurf, INFO, "Failed to remove '%s'", + child); else changed = true; } else { @@ -387,7 +392,8 @@ bool filename_delete_recursive(char *folder) child[sizeof(child) - 1] = '\0'; if (stat(child, &statbuf) == -1) { - LOG("Unable to stat %s: %s", child, strerror(errno)); + NSLOG(netsurf, INFO, "Unable to stat %s: %s", child, + strerror(errno)); continue; } @@ -399,7 +405,7 @@ bool filename_delete_recursive(char *folder) } if (remove(child)) { - LOG("Failed to remove '%s'", child); + NSLOG(netsurf, INFO, "Failed to remove '%s'", child); closedir(parent); return false; } @@ -465,7 +471,7 @@ static struct directory *filename_create_directory(const char *prefix) /* allocate a new directory */ new_dir = malloc(sizeof(struct directory)); if (new_dir == NULL) { - LOG("No memory for malloc()"); + NSLOG(netsurf, INFO, "No memory for malloc()"); return NULL; } @@ -499,7 +505,9 @@ static struct directory *filename_create_directory(const char *prefix) * whilst we are running if there is an error, so we * don't report this yet and try to create the * structure normally. */ - LOG("Failed to create optimised structure '%s'", filename_directory); + NSLOG(netsurf, INFO, + "Failed to create optimised structure '%s'", + filename_directory); } } @@ -519,7 +527,9 @@ static struct directory *filename_create_directory(const char *prefix) if (!is_dir(filename_directory)) { if (nsmkdir(filename_directory, S_IRWXU)) { - LOG("Failed to create directory '%s'", filename_directory); + NSLOG(netsurf, INFO, + "Failed to create directory '%s'", + filename_directory); return NULL; } } diff --git a/utils/hashtable.c b/utils/hashtable.c index af100dfc9..3a1711da0 100644 --- a/utils/hashtable.c +++ b/utils/hashtable.c @@ -81,7 +81,7 @@ struct hash_table *hash_create(unsigned int chains) struct hash_table *r = malloc(sizeof(struct hash_table)); if (r == NULL) { - LOG("Not enough memory for hash table."); + NSLOG(netsurf, INFO, "Not enough memory for hash table."); return NULL; } @@ -89,7 +89,8 @@ struct hash_table *hash_create(unsigned int chains) r->chain = calloc(chains, sizeof(struct hash_entry *)); if (r->chain == NULL) { - LOG("Not enough memory for %d hash table chains.", chains); + NSLOG(netsurf, INFO, + "Not enough memory for %d hash table chains.", chains); free(r); return NULL; } @@ -134,7 +135,7 @@ bool hash_add(struct hash_table *ht, const char *key, const char *value) e = malloc(sizeof(struct hash_entry)); if (e == NULL) { - LOG("Not enough memory for hash entry."); + NSLOG(netsurf, INFO, "Not enough memory for hash entry."); return false; } @@ -144,7 +145,8 @@ bool hash_add(struct hash_table *ht, const char *key, const char *value) v = strlen(value) ; e->pairing = malloc(v + e->key_length + 2); if (e->pairing == NULL) { - LOG("Not enough memory for string duplication."); + NSLOG(netsurf, INFO, + "Not enough memory for string duplication."); free(e); return false; } diff --git a/utils/idna.c b/utils/idna.c index 34cc40f83..572882ecb 100644 --- a/utils/idna.c +++ b/utils/idna.c @@ -63,17 +63,17 @@ static nserror punycode_status_to_nserror(enum punycode_status status) break; case punycode_bad_input: - LOG("Bad input"); + NSLOG(netsurf, INFO, "Bad input"); ret = NSERROR_BAD_ENCODING; break; case punycode_big_output: - LOG("Output too big"); + NSLOG(netsurf, INFO, "Output too big"); ret = NSERROR_BAD_SIZE; break; case punycode_overflow: - LOG("Overflow"); + NSLOG(netsurf, INFO, "Overflow"); ret = NSERROR_NOSPACE; break; @@ -437,7 +437,8 @@ static bool idna__is_valid(int32_t *label, size_t len) /* 2. Check characters 3 and 4 are not '--'. */ if ((label[2] == 0x002d) && (label[3] == 0x002d)) { - LOG("Check failed: characters 2 and 3 are '--'"); + NSLOG(netsurf, INFO, + "Check failed: characters 2 and 3 are '--'"); return false; } @@ -447,7 +448,8 @@ static bool idna__is_valid(int32_t *label, size_t len) if ((unicode_props->category == UTF8PROC_CATEGORY_MN) || (unicode_props->category == UTF8PROC_CATEGORY_MC) || (unicode_props->category == UTF8PROC_CATEGORY_ME)) { - LOG("Check failed: character 0 is a combining mark"); + NSLOG(netsurf, INFO, + "Check failed: character 0 is a combining mark"); return false; } @@ -456,14 +458,20 @@ static bool idna__is_valid(int32_t *label, size_t len) /* 4. Check characters not DISALLOWED by RFC5892 */ if (idna_prop == IDNA_P_DISALLOWED) { - LOG("Check failed: character %" PRIsizet " (%x) is DISALLOWED", i, label[i]); + NSLOG(netsurf, INFO, + "Check failed: character %"PRIsizet" (%x) is DISALLOWED", + i, + label[i]); return false; } /* 5. Check CONTEXTJ characters conform to defined rules */ if (idna_prop == IDNA_P_CONTEXTJ) { if (idna__contextj_rule(label, i, len) == false) { - LOG("Check failed: character %" PRIsizet " (%x) does not conform to CONTEXTJ rule", i, label[i]); + NSLOG(netsurf, INFO, + "Check failed: character %"PRIsizet" (%x) does not conform to CONTEXTJ rule", + i, + label[i]); return false; } } @@ -472,14 +480,20 @@ static bool idna__is_valid(int32_t *label, size_t len) /** \todo optionally we can check conformance to this rule */ if (idna_prop == IDNA_P_CONTEXTO) { if (idna__contexto_rule(label[i]) == false) { - LOG("Check failed: character %" PRIsizet " (%x) has no CONTEXTO rule defined", i, label[i]); + NSLOG(netsurf, INFO, + "Check failed: character %"PRIsizet" (%x) has no CONTEXTO rule defined", + i, + label[i]); return false; } } /* 7. Check characters are not UNASSIGNED */ if (idna_prop == IDNA_P_UNASSIGNED) { - LOG("Check failed: character %" PRIsizet " (%x) is UNASSIGNED", i, label[i]); + NSLOG(netsurf, INFO, + "Check failed: character %"PRIsizet" (%x) is UNASSIGNED", + i, + label[i]); return false; } @@ -588,7 +602,8 @@ static bool idna__verify(const char *label, size_t len) return true; } - LOG("Re-encoded ACE label %s does not match input", ace); + NSLOG(netsurf, INFO, "Re-encoded ACE label %s does not match input", + ace); free(ace); return false; @@ -641,7 +656,8 @@ idna_encode(const char *host, size_t len, char **ace_host, size_t *ace_len) /* This is already a DNS-valid ASCII string */ if ((idna__is_ace(host, label_len) == true) && (idna__verify(host, label_len) == false)) { - LOG("Cannot verify ACE label %s", host); + NSLOG(netsurf, INFO, + "Cannot verify ACE label %s", host); return NSERROR_BAD_URL; } strncpy(fqdn_p, host, label_len); diff --git a/utils/messages.c b/utils/messages.c index be53eccd0..e2d45e9da 100644 --- a/utils/messages.c +++ b/utils/messages.c @@ -74,7 +74,8 @@ message_process_line(struct hash_table *hash, uint8_t *ln, int lnlen) value = colon + 1; if (hash_add(hash, (char *)ln, (char *)value) == false) { - LOG("Unable to add %s:%s to hash table", ln, value); + NSLOG(netsurf, INFO, "Unable to add %s:%s to hash table", ln, + value); return NSERROR_INVALID; } return NSERROR_OK; @@ -97,7 +98,9 @@ static nserror messages_load_ctx(const char *path, struct hash_table **ctx) fp = gzopen(path, "r"); if (!fp) { - LOG("Unable to open messages file \"%.100s\": %s", path, strerror(errno)); + NSLOG(netsurf, INFO, + "Unable to open messages file \"%.100s\": %s", path, + strerror(errno)); return NSERROR_NOT_FOUND; } @@ -112,7 +115,9 @@ static nserror messages_load_ctx(const char *path, struct hash_table **ctx) nctx = *ctx; } if (nctx == NULL) { - LOG("Unable to create hash table for messages file %s", path); + NSLOG(netsurf, INFO, + "Unable to create hash table for messages file %s", + path); gzclose(fp); return NSERROR_NOMEM; } @@ -131,7 +136,9 @@ static nserror messages_load_ctx(const char *path, struct hash_table **ctx) value = colon + 1; if (hash_add(nctx, s, value) == false) { - LOG("Unable to add %s:%s to hash table of %s", s, value, path); + NSLOG(netsurf, INFO, + "Unable to add %s:%s to hash table of %s", s, + value, path); gzclose(fp); if (*ctx == NULL) { hash_destroy(nctx); @@ -202,7 +209,7 @@ nserror messages_add_from_file(const char *path) return NSERROR_BAD_PARAMETER; } - LOG("Loading Messages from '%s'", path); + NSLOG(netsurf, INFO, "Loading Messages from '%s'", path); err = messages_load_ctx(path, &messages_hash); @@ -225,7 +232,7 @@ nserror messages_add_from_inline(const uint8_t *data, size_t data_size) messages_hash = hash_create(HASH_SIZE); } if (messages_hash == NULL) { - LOG("Unable to create hash table"); + NSLOG(netsurf, INFO, "Unable to create hash table"); return NSERROR_NOMEM; } @@ -238,7 +245,7 @@ nserror messages_add_from_inline(const uint8_t *data, size_t data_size) ret = inflateInit2(&strm, 32 + MAX_WBITS); if (ret != Z_OK) { - LOG("inflateInit returned %d", ret); + NSLOG(netsurf, INFO, "inflateInit returned %d", ret); return NSERROR_INVALID; } @@ -271,7 +278,7 @@ nserror messages_add_from_inline(const uint8_t *data, size_t data_size) } if (used == sizeof(s)) { /* entire buffer used and no newline */ - LOG("Overlength line"); + NSLOG(netsurf, INFO, "Overlength line"); used = 0; } } while (ret != Z_STREAM_END); @@ -279,7 +286,7 @@ nserror messages_add_from_inline(const uint8_t *data, size_t data_size) inflateEnd(&strm); if (ret != Z_STREAM_END) { - LOG("inflate returned %d", ret); + NSLOG(netsurf, INFO, "inflate returned %d", ret); return NSERROR_INVALID; } return NSERROR_OK; diff --git a/utils/nsoption.c b/utils/nsoption.c index 8f05a911b..15f89ca5d 100644 --- a/utils/nsoption.c +++ b/utils/nsoption.c @@ -648,11 +648,12 @@ nsoption_read(const char *path, struct nsoption_s *opts) fp = fopen(path, "r"); if (!fp) { - LOG("Failed to open file '%s'", path); + NSLOG(netsurf, INFO, "Failed to open file '%s'", path); return NSERROR_NOT_FOUND; } - LOG("Successfully opened '%s' for Options file", path); + NSLOG(netsurf, INFO, "Successfully opened '%s' for Options file", + path); while (fgets(s, NSOPTION_MAX_LINE_LEN, fp)) { char *colon, *value; @@ -718,7 +719,8 @@ nsoption_write(const char *path, fp = fopen(path, "w"); if (!fp) { - LOG("failed to open file '%s' for writing", path); + NSLOG(netsurf, INFO, "failed to open file '%s' for writing", + path); return NSERROR_NOT_FOUND; } @@ -798,7 +800,7 @@ nsoption_commandline(int *pargc, char **argv, struct nsoption_s *opts) /* arg+arglen is the option to set, val is the value */ - LOG("%.*s = %s", arglen, arg, val); + NSLOG(netsurf, INFO, "%.*s = %s", arglen, arg, val); for (entry_loop = 0; entry_loop < NSOPTION_LISTEND; diff --git a/utils/nsurl/nsurl.c b/utils/nsurl/nsurl.c index 7166a2707..3b0af9328 100644 --- a/utils/nsurl/nsurl.c +++ b/utils/nsurl/nsurl.c @@ -230,7 +230,8 @@ lwc_string *nsurl_get_component(const nsurl *url, nsurl_component part) lwc_string_ref(url->components.fragment) : NULL; default: - LOG("Unsupported value passed to part param."); + NSLOG(netsurf, INFO, + "Unsupported value passed to part param."); assert(0); } @@ -296,7 +297,8 @@ bool nsurl_has_component(const nsurl *url, nsurl_component part) return false; default: - LOG("Unsupported value passed to part param."); + NSLOG(netsurf, INFO, + "Unsupported value passed to part param."); assert(0); } diff --git a/utils/nsurl/parse.c b/utils/nsurl/parse.c index 7474a612d..ce6f4435d 100644 --- a/utils/nsurl/parse.c +++ b/utils/nsurl/parse.c @@ -451,19 +451,19 @@ static void nsurl__get_string_markers(const char * const url_s, } #ifdef NSURL_DEBUG - LOG("marker.start: %i", marker.start); - LOG("marker.scheme_end: %i", marker.scheme_end); - LOG("marker.authority: %i", marker.authority); + NSLOG(netsurf, INFO, "marker.start: %i", marker.start); + NSLOG(netsurf, INFO, "marker.scheme_end: %i", marker.scheme_end); + NSLOG(netsurf, INFO, "marker.authority: %i", marker.authority); - LOG("marker.colon_first: %i", marker.colon_first); - LOG("marker.at: %i", marker.at); - LOG("marker.colon_last: %i", marker.colon_last); + NSLOG(netsurf, INFO, "marker.colon_first: %i", marker.colon_first); + NSLOG(netsurf, INFO, "marker.at: %i", marker.at); + NSLOG(netsurf, INFO, "marker.colon_last: %i", marker.colon_last); - LOG("marker.path: %i", marker.path); - LOG("marker.query: %i", marker.query); - LOG("marker.fragment: %i", marker.fragment); + NSLOG(netsurf, INFO, "marker.path: %i", marker.path); + NSLOG(netsurf, INFO, "marker.query: %i", marker.query); + NSLOG(netsurf, INFO, "marker.fragment: %i", marker.fragment); - LOG("marker.end: %i", marker.end); + NSLOG(netsurf, INFO, "marker.end: %i", marker.end); #endif /* Got all the URL components pegged out now */ @@ -485,8 +485,8 @@ static size_t nsurl__remove_dot_segments(char *path, char *output) while (*path_pos != '\0') { #ifdef NSURL_DEBUG - LOG(" in:%s", path_pos); - LOG("out:%.*s", output_pos - output, output); + NSLOG(netsurf, INFO, " in:%s", path_pos); + NSLOG(netsurf, INFO, "out:%.*s", output_pos - output, output); #endif if (*path_pos == '.') { if (*(path_pos + 1) == '.' && @@ -1324,7 +1324,8 @@ nserror nsurl_join(const nsurl *base, const char *rel, nsurl **joined) assert(rel != NULL); #ifdef NSURL_DEBUG - LOG("base: \"%s\", rel: \"%s\"", nsurl_access(base), rel); + NSLOG(netsurf, INFO, "base: \"%s\", rel: \"%s\"", nsurl_access(base), + rel); #endif /* Peg out the URL sections */ diff --git a/utils/useragent.c b/utils/useragent.c index 72e45aada..b528dce4f 100644 --- a/utils/useragent.c +++ b/utils/useragent.c @@ -65,7 +65,8 @@ user_agent_build_string(void) core_user_agent_string = ua_string; - LOG("Built user agent \"%s\"", core_user_agent_string); + NSLOG(netsurf, INFO, "Built user agent \"%s\"", + core_user_agent_string); } /* This is a function so that later we can override it trivially */ diff --git a/utils/utf8.c b/utils/utf8.c index 5c930cd13..f0ac0c9b2 100644 --- a/utils/utf8.c +++ b/utils/utf8.c @@ -468,7 +468,8 @@ bool utf8_save_text(const char *utf8_text, const char *path) ret = guit->utf8->utf8_to_local(utf8_text, strlen(utf8_text), &conv); if (ret != NSERROR_OK) { - LOG("failed to convert to local encoding, return %d", ret); + NSLOG(netsurf, INFO, + "failed to convert to local encoding, return %d", ret); return false; } @@ -476,7 +477,7 @@ bool utf8_save_text(const char *utf8_text, const char *path) if (out) { int res = fputs(conv, out); if (res < 0) { - LOG("Warning: writing data failed"); + NSLOG(netsurf, INFO, "Warning: writing data failed"); } res = fputs("\n", out);