From 75018632a9b953aafeae6f4e8aea607fd1d89dca Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 6 Sep 2017 18:28:12 +0100 Subject: 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); --- 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 ++++++++++--------- 18 files changed, 183 insertions(+), 128 deletions(-) (limited to 'desktop') 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; } -- cgit v1.2.3