From 9e81082355a54daf468589f5c4f351d869ec5a21 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 6 Sep 2017 18:27:19 +0100 Subject: Use coccinelle to change logging macro calls in c++ for F in $(git ls-files '*.cpp');do spatch --c++ --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); --- frontends/beos/bitmap.cpp | 7 ++++--- frontends/beos/fetch_rsrc.cpp | 22 +++++++++++++++------- frontends/beos/gui.cpp | 21 +++++++++++---------- frontends/beos/plotters.cpp | 4 ++-- frontends/beos/scaffolding.cpp | 16 ++++++++++------ frontends/beos/schedule.cpp | 16 ++++++++++------ frontends/beos/throbber.cpp | 16 +++++++++++----- frontends/beos/window.cpp | 23 ++++++++++++++--------- 8 files changed, 77 insertions(+), 48 deletions(-) (limited to 'frontends/beos') diff --git a/frontends/beos/bitmap.cpp b/frontends/beos/bitmap.cpp index 68d8442ab..c4b008755 100644 --- a/frontends/beos/bitmap.cpp +++ b/frontends/beos/bitmap.cpp @@ -377,7 +377,7 @@ nsbeos_bitmap_get_pretile_x(struct bitmap* bitmap) if (!bitmap->pretile_x) { int width = bitmap->primary->Bounds().Width() + 1; int xmult = (MIN_PRETILE_WIDTH + width - 1)/width; - LOG("Pretiling %p for X*%d", bitmap, xmult); + NSLOG(netsurf, INFO, "Pretiling %p for X*%d", bitmap, xmult); bitmap->pretile_x = nsbeos_bitmap_generate_pretile(bitmap->primary, xmult, 1); } return bitmap->pretile_x; @@ -396,7 +396,7 @@ nsbeos_bitmap_get_pretile_y(struct bitmap* bitmap) if (!bitmap->pretile_y) { int height = bitmap->primary->Bounds().Height() + 1; int ymult = (MIN_PRETILE_HEIGHT + height - 1)/height; - LOG("Pretiling %p for Y*%d", bitmap, ymult); + NSLOG(netsurf, INFO, "Pretiling %p for Y*%d", bitmap, ymult); bitmap->pretile_y = nsbeos_bitmap_generate_pretile(bitmap->primary, 1, ymult); } return bitmap->pretile_y; @@ -416,7 +416,8 @@ nsbeos_bitmap_get_pretile_xy(struct bitmap* bitmap) int height = bitmap->primary->Bounds().Height() + 1; int xmult = (MIN_PRETILE_WIDTH + width - 1)/width; int ymult = (MIN_PRETILE_HEIGHT + height - 1)/height; - LOG("Pretiling %p for X*%d Y*%d", bitmap, xmult, ymult); + NSLOG(netsurf, INFO, "Pretiling %p for X*%d Y*%d", bitmap, + xmult, ymult); bitmap->pretile_xy = nsbeos_bitmap_generate_pretile(bitmap->primary, xmult, ymult); } return bitmap->pretile_xy; diff --git a/frontends/beos/fetch_rsrc.cpp b/frontends/beos/fetch_rsrc.cpp index e77f4c96e..ae3648354 100644 --- a/frontends/beos/fetch_rsrc.cpp +++ b/frontends/beos/fetch_rsrc.cpp @@ -71,13 +71,15 @@ BResources *gAppResources = NULL; static bool fetch_rsrc_initialise(lwc_string *scheme) { - LOG("fetch_rsrc_initialise called for %s", lwc_string_data(scheme)); + NSLOG(netsurf, INFO, "fetch_rsrc_initialise called for %s", + lwc_string_data(scheme)); return true; } static void fetch_rsrc_finalise(lwc_string *scheme) { - LOG("fetch_rsrc_finalise called for %s", lwc_string_data(scheme)); + NSLOG(netsurf, INFO, "fetch_rsrc_finalise called for %s", + lwc_string_data(scheme)); } static bool fetch_rsrc_can_fetch(const nsurl *url) @@ -162,7 +164,7 @@ static bool fetch_rsrc_process(struct fetch_rsrc_context *c) * rsrc://[TYPE][@NUM]/name[,mime] */ - LOG("*** Processing %s", c->url); + NSLOG(netsurf, INFO, "*** Processing %s", c->url); if (strlen(c->url) < 7) { /* 7 is the minimum possible length (rsrc://) */ @@ -199,11 +201,13 @@ static bool fetch_rsrc_process(struct fetch_rsrc_context *c) uint8 c1, c2, c3, c4; if (sscanf(params, "%c%c%c%c", &c1, &c2, &c3, &c4) > 3) { type = c1 << 24 | c2 << 16 | c3 << 8 | c4; - LOG("fetch_rsrc: type:%4.4s\n", (char *)&type); + NSLOG(netsurf, INFO, "fetch_rsrc: type:%4.4s\n", + (char *)&type); } } - LOG("fetch_rsrc: 0x%08lx, %ld, '%s'\n", type, id, c->name); + NSLOG(netsurf, INFO, "fetch_rsrc: 0x%08lx, %ld, '%s'\n", type, id, + c->name); bool found; if (id) @@ -278,7 +282,10 @@ static void fetch_rsrc_poll(lwc_string *scheme) char header[64]; fetch_set_http_code(c->parent_fetch, 200); - LOG("setting rsrc: MIME type to %s, length to %zd", c->mimetype, c->datalen); + NSLOG(netsurf, INFO, + "setting rsrc: MIME type to %s, length to %zd", + c->mimetype, + c->datalen); /* Any callback can result in the fetch being aborted. * Therefore, we _must_ check for this after _every_ * call to fetch_rsrc_send_callback(). @@ -308,7 +315,8 @@ static void fetch_rsrc_poll(lwc_string *scheme) fetch_rsrc_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_rsrc_process() is broken. diff --git a/frontends/beos/gui.cpp b/frontends/beos/gui.cpp index d3321b58d..f2c991777 100644 --- a/frontends/beos/gui.cpp +++ b/frontends/beos/gui.cpp @@ -112,7 +112,7 @@ static int sEventPipe[2]; /* exported function defined in beos/gui.h */ nserror beos_warn_user(const char *warning, const char *detail) { - LOG("warn_user: %s (%s)", warning, detail); + NSLOG(netsurf, INFO, "warn_user: %s (%s)", warning, detail); BAlert *alert; BString text(warning); if (detail) @@ -354,14 +354,15 @@ static void check_homedir(void) if (err < B_OK) { /* we really can't continue without a home directory. */ - LOG("Can't find user settings directory - nowhere to store state!"); + NSLOG(netsurf, INFO, + "Can't find user settings directory - nowhere to store state!"); die("NetSurf needs to find the user settings directory in order to run.\n"); } path.Append("NetSurf"); err = create_directory(path.Path(), 0644); if (err < B_OK) { - LOG("Unable to create %s", path.Path()); + NSLOG(netsurf, INFO, "Unable to create %s", path.Path()); die("NetSurf could not create its settings directory.\n"); } } @@ -387,7 +388,7 @@ static nsurl *gui_get_resource_url(const char *path) path = "favicon.png"; u << path; - LOG("(%s) -> '%s'\n", path, u.String()); + NSLOG(netsurf, INFO, "(%s) -> '%s'\n", path, u.String()); nsurl_create(u.String(), &url); return url; } @@ -588,7 +589,7 @@ static void gui_init(int argc, char** argv) die("Unable to load throbber image.\n"); find_resource(buf, "Choices", "%/Choices"); - LOG("Using '%s' as Preferences file", buf); + NSLOG(netsurf, INFO, "Using '%s' as Preferences file", buf); options_file_location = strdup(buf); nsoption_read(buf, NULL); @@ -631,12 +632,12 @@ static void gui_init(int argc, char** argv) if (nsoption_charp(cookie_file) == NULL) { find_resource(buf, "Cookies", "%/Cookies"); - LOG("Using '%s' as Cookies file", buf); + NSLOG(netsurf, INFO, "Using '%s' as Cookies file", buf); nsoption_set_charp(cookie_file, strdup(buf)); } if (nsoption_charp(cookie_jar) == NULL) { find_resource(buf, "Cookies", "%/Cookies"); - LOG("Using '%s' as Cookie Jar file", buf); + NSLOG(netsurf, INFO, "Using '%s' as Cookie Jar file", buf); nsoption_set_charp(cookie_jar, strdup(buf)); } if ((nsoption_charp(cookie_file) == NULL) || @@ -645,13 +646,13 @@ static void gui_init(int argc, char** argv) if (nsoption_charp(url_file) == NULL) { find_resource(buf, "URLs", "%/URLs"); - LOG("Using '%s' as URL file", buf); + NSLOG(netsurf, INFO, "Using '%s' as URL file", buf); nsoption_set_charp(url_file, strdup(buf)); } if (nsoption_charp(ca_path) == NULL) { find_resource(buf, "certs", "/etc/ssl/certs"); - LOG("Using '%s' as certificate path", buf); + NSLOG(netsurf, INFO, "Using '%s' as certificate path", buf); nsoption_set_charp(ca_path, strdup(buf)); } @@ -1038,7 +1039,7 @@ int main(int argc, char** argv) char path[12]; sprintf(path,"%.2s/Messages", getenv("LC_MESSAGES")); - LOG("Loading messages from resource %s\n", path); + NSLOG(netsurf, INFO, "Loading messages from resource %s\n", path); const uint8_t* res = (const uint8_t*)resources.LoadResource('data', path, &size); if (size > 0 && res != NULL) { diff --git a/frontends/beos/plotters.cpp b/frontends/beos/plotters.cpp index c77e6353e..c4903e045 100644 --- a/frontends/beos/plotters.cpp +++ b/frontends/beos/plotters.cpp @@ -538,7 +538,7 @@ nsbeos_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"); return NSERROR_INVALID; } @@ -563,7 +563,7 @@ nsbeos_plot_path(const struct redraw_context *ctx, shape.BezierTo(pt); i += 7; } else { - LOG("bad path command %f", p[i]); + NSLOG(netsurf, INFO, "bad path command %f", p[i]); return NSERROR_INVALID; } } diff --git a/frontends/beos/scaffolding.cpp b/frontends/beos/scaffolding.cpp index 7efdb5962..e6fb6e5a1 100644 --- a/frontends/beos/scaffolding.cpp +++ b/frontends/beos/scaffolding.cpp @@ -796,7 +796,7 @@ int32 nsbeos_replicant_main_thread(void *_arg) static void nsbeos_window_destroy_event(NSBrowserWindow *window, nsbeos_scaffolding *g, BMessage *event) { - LOG("Being Destroyed = %d", g->being_destroyed); + NSLOG(netsurf, INFO, "Being Destroyed = %d", g->being_destroyed); if (--open_windows == 0) nsbeos_done = true; @@ -854,7 +854,9 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m bw = nsbeos_get_browser_for_gui(scaffold->top_level); bool reloadAll = false; - LOG("nsbeos_scaffolding_dispatch_event() what = 0x%08lx", message->what); + NSLOG(netsurf, INFO, + "nsbeos_scaffolding_dispatch_event() what = 0x%08lx", + message->what); switch (message->what) { case B_QUIT_REQUESTED: nsbeos_scaffolding_destroy(scaffold); @@ -997,7 +999,7 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m browser_window_key_press(bw, NS_KEY_PASTE); break; case B_SELECT_ALL: - LOG("Selecting all text"); + NSLOG(netsurf, INFO, "Selecting all text"); browser_window_key_press(bw, NS_KEY_SELECT_ALL); break; case B_NETPOSITIVE_BACK: @@ -1359,7 +1361,8 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m void nsbeos_scaffolding_destroy(nsbeos_scaffolding *scaffold) { - LOG("Being Destroyed = %d", scaffold->being_destroyed); + NSLOG(netsurf, INFO, "Being Destroyed = %d", + scaffold->being_destroyed); if (scaffold->being_destroyed) return; scaffold->being_destroyed = 1; nsbeos_window_destroy_event(scaffold->window, scaffold, NULL); @@ -1444,7 +1447,7 @@ static void recursively_set_menu_items_target(BMenu *menu, BHandler *handler) void nsbeos_attach_toplevel_view(nsbeos_scaffolding *g, BView *view) { - LOG("Attaching view to scaffolding %p", g); + NSLOG(netsurf, INFO, "Attaching view to scaffolding %p", g); // this is a replicant,... and it went bad if (!g->window) { @@ -1722,7 +1725,8 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel) { struct beos_scaffolding *g = (struct beos_scaffolding *)malloc(sizeof(*g)); - LOG("Constructing a scaffold of %p for gui_window %p", g, toplevel); + NSLOG(netsurf, INFO, + "Constructing a scaffold of %p for gui_window %p", g, toplevel); g->top_level = toplevel; g->being_destroyed = 0; diff --git a/frontends/beos/schedule.cpp b/frontends/beos/schedule.cpp index e96e56d81..552a7cd49 100644 --- a/frontends/beos/schedule.cpp +++ b/frontends/beos/schedule.cpp @@ -58,7 +58,8 @@ nsbeos_schedule_kill_callback(void *_target, void *_match) _nsbeos_callback_t *match = (_nsbeos_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, INFO, "Found match for %p(%p), killing.", + target->callback, target->context); target->callback = NULL; target->context = NULL; target->callback_killed = true; @@ -69,7 +70,8 @@ nsbeos_schedule_kill_callback(void *_target, void *_match) static void schedule_remove(void (*callback)(void *p), void *p) { - LOG("schedule_remove() for %p(%p)", cb->callback, cb->context); + NSLOG(netsurf, INFO, "schedule_remove() for %p(%p)", cb->callback, + cb->context); if (callbacks == NULL) return; _nsbeos_callback_t cb_match; @@ -81,7 +83,7 @@ schedule_remove(void (*callback)(void *p), void *p) nserror beos_schedule(int t, void (*callback)(void *p), void *p) { - LOG("t:%d cb:%p p:%p", t, cb->callback, cb->context); + NSLOG(netsurf, INFO, "t:%d cb:%p p:%p", t, cb->callback, cb->context); if (callbacks == NULL) { callbacks = new BList; @@ -111,7 +113,7 @@ nserror beos_schedule(int t, void (*callback)(void *p), void *p) bool schedule_run(void) { - LOG("schedule_run()"); + NSLOG(netsurf, INFO, "schedule_run()"); earliest_callback_timeout = B_INFINITE_TIMEOUT; if (callbacks == NULL) @@ -120,7 +122,8 @@ schedule_run(void) bigtime_t now = system_time(); int32 i; - LOG("Checking %ld callbacks to for deadline.", this_run->CountItems()); + NSLOG(netsurf, INFO, "Checking %ld callbacks to for deadline.", + this_run->CountItems()); /* Run all the callbacks which made it this far. */ for (i = 0; i < callbacks->CountItems(); ) { @@ -132,7 +135,8 @@ schedule_run(void) i++; continue; } - LOG("Running callbacks %p(%p).", cb->callback, cb->context); + NSLOG(netsurf, INFO, "Running callbacks %p(%p).", + cb->callback, cb->context); if (!cb->callback_killed) cb->callback(cb->context); callbacks->RemoveItem(cb); diff --git a/frontends/beos/throbber.cpp b/frontends/beos/throbber.cpp index fe40b3edc..27ed42352 100644 --- a/frontends/beos/throbber.cpp +++ b/frontends/beos/throbber.cpp @@ -50,14 +50,17 @@ bool nsbeos_throbber_initialise_from_png(const int frames, ...) if (frames < 2) { /* we need at least two frames - one for idle, one for active */ - LOG("Insufficent number of frames in throbber animation!"); - LOG("(called with %d frames, where 2 is a minimum.)", frames); + NSLOG(netsurf, INFO, + "Insufficent number of frames in throbber animation!"); + NSLOG(netsurf, INFO, + "(called with %d frames, where 2 is a minimum.)", + frames); return false; } BResources *res = get_app_resources(); if (res == NULL) { - LOG("Can't find resources for throbber!"); + NSLOG(netsurf, INFO, "Can't find resources for throbber!"); return false; } @@ -74,14 +77,17 @@ bool nsbeos_throbber_initialise_from_png(const int frames, ...) data = res->LoadResource('data', fn, &size); throb->framedata[i] = NULL; if (!data) { - LOG("Error when loading resource %s", fn); + NSLOG(netsurf, INFO, "Error when loading resource %s", + fn); errors_when_loading = true; continue; } BMemoryIO mem(data, size); throb->framedata[i] = BTranslationUtils::GetBitmap(&mem); if (throb->framedata[i] == NULL) { - LOG("Error when loading %s: GetBitmap() returned NULL", fn); + NSLOG(netsurf, INFO, + "Error when loading %s: GetBitmap() returned NULL", + fn); errors_when_loading = true; } } diff --git a/frontends/beos/window.cpp b/frontends/beos/window.cpp index fde818df2..c6e2aadfc 100644 --- a/frontends/beos/window.cpp +++ b/frontends/beos/window.cpp @@ -354,7 +354,8 @@ static struct gui_window *gui_window_create(struct browser_window *bw, return 0; } - 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; @@ -436,19 +437,21 @@ void nsbeos_dispatch_event(BMessage *message) continue; if (gui && gui != z) { - LOG("discarding event for destroyed gui_window"); + NSLOG(netsurf, INFO, + "discarding event for destroyed gui_window"); delete message; return; } if (scaffold && (!y || scaffold != y->scaffold)) { - LOG("discarding event for destroyed scaffolding"); + NSLOG(netsurf, INFO, + "discarding event for destroyed scaffolding"); delete message; return; } // messages for top-level if (scaffold) { - LOG("dispatching to top-level"); + NSLOG(netsurf, INFO, "dispatching to top-level"); nsbeos_scaffolding_dispatch_event(scaffold, message); delete message; return; @@ -763,7 +766,8 @@ void nsbeos_window_keypress_event(BView *view, gui_window *g, BMessage *event) if (!numbytes) numbytes = strlen(bytes); - LOG("mods 0x%08lx key %ld raw %ld byte[0] %d", mods, key, raw_char, buff[0]); + NSLOG(netsurf, INFO, "mods 0x%08lx key %ld raw %ld byte[0] %d", mods, + key, raw_char, buff[0]); char byte; if (numbytes == 1) { @@ -930,10 +934,10 @@ static void gui_window_destroy(struct gui_window *g) g->next->prev = g->prev; - LOG("Destroying gui_window %p", g); + NSLOG(netsurf, INFO, "Destroying 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->view == NULL) return; @@ -1090,8 +1094,9 @@ static void gui_window_update_extent(struct gui_window *g) x_max -= g->view->Bounds().Width() + 1; y_max -= g->view->Bounds().Height() + 1; - LOG("x_max = %d y_max = %d x_prop = %f y_prop = %f\n", - x_max, y_max, x_prop, y_prop); + NSLOG(netsurf, INFO, + "x_max = %d y_max = %d x_prop = %f y_prop = %f\n", x_max, + y_max, x_prop, y_prop); if (g->view->ScrollBar(B_HORIZONTAL)) { g->view->ScrollBar(B_HORIZONTAL)->SetRange(0, x_max); -- cgit v1.2.3