summaryrefslogtreecommitdiff
path: root/framebuffer
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-05-28 16:08:46 +0100
committerVincent Sanders <vince@kyllikki.org>2015-05-28 16:08:46 +0100
commitc105738fa36bb2400adc47399c5b878d252d1c86 (patch)
tree138eeb449e1bf51ee1726b5f820740aada0ccd0b /framebuffer
parent20f2c86a511f7913cf858e7bd3668b0b59663ba0 (diff)
downloadnetsurf-c105738fa36bb2400adc47399c5b878d252d1c86.tar.gz
netsurf-c105738fa36bb2400adc47399c5b878d252d1c86.tar.bz2
Change LOG() macro to be varadic
This changes the LOG macro to be varadic removing the need for all callsites to have double bracketing and allows for future improvement on how we use the logging macros. The callsites were changed with coccinelle and the changes checked by hand. Compile tested for several frontends but not all. A formatting annotation has also been added which allows the compiler to check the parameters and types passed to the logging.
Diffstat (limited to 'framebuffer')
-rw-r--r--framebuffer/bitmap.c10
-rw-r--r--framebuffer/clipboard.c4
-rw-r--r--framebuffer/fbtk/event.c4
-rw-r--r--framebuffer/fbtk/fbtk.c23
-rw-r--r--framebuffer/fbtk/scroll.c4
-rw-r--r--framebuffer/fetch.c2
-rw-r--r--framebuffer/font_freetype.c14
-rw-r--r--framebuffer/framebuffer.c14
-rw-r--r--framebuffer/gui.c34
-rw-r--r--framebuffer/misc.c2
-rw-r--r--framebuffer/schedule.c5
11 files changed, 54 insertions, 62 deletions
diff --git a/framebuffer/bitmap.c b/framebuffer/bitmap.c
index 9f5b02524..b4907ada6 100644
--- a/framebuffer/bitmap.c
+++ b/framebuffer/bitmap.c
@@ -51,7 +51,7 @@ static void *bitmap_create(int width, int height, unsigned int state)
{
nsfb_t *bm;
- LOG(("width %d, height %d, state %u",width,height,state));
+ LOG("width %d, height %d, state %u", width, height, state);
bm = nsfb_new(NSFB_SURFACE_RAM);
if (bm == NULL) {
@@ -69,7 +69,7 @@ static void *bitmap_create(int width, int height, unsigned int state)
return NULL;
}
- LOG(("bitmap %p", bm));
+ LOG("bitmap %p", bm);
return bm;
}
@@ -197,11 +197,11 @@ static bool bitmap_test_opaque(void *bitmap)
while (tst-- > 0) {
if (bmpptr[(tst << 2) + 3] != 0xff) {
- LOG(("bitmap %p has transparency",bm));
+ LOG("bitmap %p has transparency", bm);
return false;
}
}
- LOG(("bitmap %p is opaque", bm));
+ LOG("bitmap %p is opaque", bm);
return true;
}
@@ -282,7 +282,7 @@ bitmap_render(struct bitmap *bitmap,
nsfb_get_geometry(tbm, &width, &height, NULL);
- LOG(("width %d, height %d", width, height));
+ LOG("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/framebuffer/clipboard.c b/framebuffer/clipboard.c
index 323e8deff..05defe8f9 100644
--- a/framebuffer/clipboard.c
+++ b/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 %i bytes: \"%s\"\n", gui_clipboard.length,
- gui_clipboard.buffer));
+ LOG("Pasting %zd bytes: \"%s\"\n",
+ gui_clipboard.length, gui_clipboard.buffer);
*buffer = malloc(gui_clipboard.length);
diff --git a/framebuffer/fbtk/event.c b/framebuffer/fbtk/event.c
index 607db8984..aab150283 100644
--- a/framebuffer/fbtk/event.c
+++ b/framebuffer/fbtk/event.c
@@ -52,7 +52,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."));
+ LOG("No widget has input focus.");
return; /* no widget with input */
}
@@ -85,7 +85,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));
+ LOG("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/framebuffer/fbtk/fbtk.c b/framebuffer/fbtk/fbtk.c
index c36966c3e..882e5e5f2 100644
--- a/framebuffer/fbtk/fbtk.c
+++ b/framebuffer/fbtk/fbtk.c
@@ -52,7 +52,7 @@ dump_tk_tree(fbtk_widget_t *widget)
int indent = 0;
while (widget != NULL) {
- LOG(("%*s%p", indent, "", widget));
+ LOG("%*s%p", indent, "", widget);
if (widget->first_child != NULL) {
widget = widget->first_child;
indent += 6;
@@ -100,12 +100,7 @@ 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));
+ LOG("redrawing %p %d,%d %d,%d", widget, widget->redraw.x, widget->redraw.y, widget->redraw.width, widget->redraw.height);
#endif
cwidget = widget->last_child;
@@ -126,7 +121,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));
+ LOG("setting mapping on %p to %d", widget, map);
widget->mapped = map;
if (map) {
fbtk_request_redraw(widget);
@@ -149,7 +144,7 @@ swap_siblings(fbtk_widget_t *lw)
assert(rw != NULL);
- LOG(("Swapping %p with %p", lw, rw));
+ LOG("Swapping %p with %p", lw, rw);
before = lw->prev;
after = rw->next;
@@ -415,7 +410,7 @@ 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!"));
+ LOG("Widget with null parent that is not the root widget!");
return NULL;
}
@@ -556,7 +551,7 @@ fbtk_widget_new(fbtk_widget_t *parent,
return NULL;
#ifdef FBTK_LOGGING
- LOG(("creating %p %d,%d %d,%d", neww, x, y, width, height));
+ LOG("creating %p %d,%d %d,%d", neww, x, y, width, height);
#endif
/* make new window fit inside parent */
@@ -579,7 +574,7 @@ fbtk_widget_new(fbtk_widget_t *parent,
}
#ifdef FBTK_LOGGING
- LOG(("using %p %d,%d %d,%d", neww, x, y, width, height));
+ LOG("using %p %d,%d %d,%d", neww, x, y, width, height);
#endif
/* set values */
neww->type = type;
@@ -639,9 +634,7 @@ 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));
+ LOG("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/framebuffer/fbtk/scroll.c b/framebuffer/fbtk/scroll.c
index e91c3ef6e..c86c8a6de 100644
--- a/framebuffer/fbtk/scroll.c
+++ b/framebuffer/fbtk/scroll.c
@@ -334,7 +334,7 @@ hscroll_redraw(fbtk_widget_t *widget, fbtk_callback_info *cbi)
hpos = 0;
}
- LOG(("hscroll %d", hscroll));
+ LOG("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));
+ LOG("horiz scroll was the same %d", newpos);
return 0;
}
diff --git a/framebuffer/fetch.c b/framebuffer/fetch.c
index 6ae100734..24920fbbb 100644
--- a/framebuffer/fetch.c
+++ b/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));
+ LOG("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/framebuffer/font_freetype.c b/framebuffer/font_freetype.c
index c5a18da50..ec3ceab52 100644
--- a/framebuffer/font_freetype.c
+++ b/framebuffer/font_freetype.c
@@ -83,12 +83,12 @@ static FT_Error ft_face_requester(FTC_FaceID face_id, FT_Library library, FT_Po
error = FT_New_Face(library, fb_face->fontfile, fb_face->index, face);
if (error) {
- LOG(("Could not find font (code %d)", error));
+ LOG("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));
+ LOG("Could not select charmap (code %d)", error);
} else {
for (cidx = 0; cidx < (*face)->num_charmaps; cidx++) {
if ((*face)->charmap == (*face)->charmaps[cidx]) {
@@ -98,7 +98,7 @@ static FT_Error ft_face_requester(FTC_FaceID face_id, FT_Library library, FT_Po
}
}
}
- LOG(("Loaded face from %s", fb_face->fontfile));
+ LOG("Loaded face from %s", fb_face->fontfile);
return error;
}
@@ -123,7 +123,7 @@ 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));
+ LOG("Could not find font face %s (code %d)", fontname, error);
free(newf->fontfile);
free(newf);
newf = NULL;
@@ -143,7 +143,7 @@ bool fb_font_init(void)
/* freetype library initialise */
error = FT_Init_FreeType( &library );
if (error) {
- LOG(("Freetype could not initialised (code %d)", error));
+ LOG("Freetype could not initialised (code %d)", error);
return false;
}
@@ -163,7 +163,7 @@ bool fb_font_init(void)
NULL,
&ft_cmanager);
if (error) {
- LOG(("Freetype could not initialise cache manager (code %d)", error));
+ LOG("Freetype could not initialise cache manager (code %d)", error);
FT_Done_FreeType(library);
return false;
}
@@ -180,7 +180,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"));
+ LOG("Could not find the default font");
FTC_Manager_Done(ft_cmanager);
FT_Done_FreeType(library);
return false;
diff --git a/framebuffer/framebuffer.c b/framebuffer/framebuffer.c
index 927e6318f..97760cfc6 100644
--- a/framebuffer/framebuffer.c
+++ b/framebuffer/framebuffer.c
@@ -317,7 +317,7 @@ framebuffer_plot_path(const float *p,
colour c,
const float transform[6])
{
- LOG(("path unimplemented"));
+ LOG("path unimplemented");
return true;
}
@@ -375,7 +375,7 @@ static bool framebuffer_format_from_bpp(int bpp, enum nsfb_format_e *fmt)
break;
default:
- LOG(("Bad bits per pixel (%d)\n", bpp));
+ LOG("Bad bits per pixel (%d)\n", bpp);
return false;
}
@@ -397,18 +397,18 @@ 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));
+ LOG("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));
+ LOG("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"));
+ LOG("Unable to set surface geometry\n");
nsfb_free(nsfb);
return NULL;
}
@@ -416,7 +416,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"));
+ LOG("Unable to initialise nsfb surface\n");
nsfb_free(nsfb);
return NULL;
}
@@ -436,7 +436,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"));
+ LOG("Unable to change surface geometry\n");
return false;
}
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index 56fe41bc4..1c60bee2f 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -140,7 +140,7 @@ widget_scroll_y(struct gui_window *gw, int y, bool abs)
int content_width, content_height;
int height;
- LOG(("window scroll"));
+ LOG("window scroll");
if (abs) {
bwidget->pany = y - bwidget->scrolly;
} else {
@@ -224,7 +224,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));
+ LOG("panning %d, %d", bwidget->panx, bwidget->pany);
x = fbtk_get_absx(widget);
y = fbtk_get_absy(widget);
@@ -400,7 +400,7 @@ 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));
+ LOG("browser widget from widget %p was null", widget);
return -1;
}
@@ -452,7 +452,7 @@ process_cmdline(int argc, char** argv)
{0, 0, 0, 0 }
}; /* no long options */
- LOG(("argc %d, argv %p", argc, argv));
+ LOG("argc %d, argv %p", argc, argv);
fename = "sdl";
febpp = 32;
@@ -521,7 +521,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"));
+ LOG("Failed initialising cookie options");
return NSERROR_BAD_PARAMETER;
}
@@ -599,7 +599,7 @@ static void framebuffer_run(void)
static void gui_quit(void)
{
- LOG(("gui_quit"));
+ LOG("gui_quit");
urldb_save_cookies(nsoption_charp(cookie_jar));
@@ -626,7 +626,7 @@ 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));
+ LOG("browser window clicked at %d,%d", cbi->x, cbi->y);
switch (cbi->event->type) {
case NSFB_EVENT_KEY_DOWN:
@@ -809,7 +809,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));
+ LOG("got value %d", cbi->event->value.keycode);
switch (cbi->event->type) {
case NSFB_EVENT_KEY_DOWN:
@@ -1185,7 +1185,7 @@ create_toolbar(struct gui_window *gw,
toolbar_layout = NSFB_TOOLBAR_DEFAULT_LAYOUT;
}
- LOG(("Using toolbar layout %s", toolbar_layout));
+ LOG("Using toolbar layout %s", toolbar_layout);
itmtype = toolbar_layout;
@@ -1219,7 +1219,7 @@ create_toolbar(struct gui_window *gw,
(*itmtype != 0) &&
(xdir !=0)) {
- LOG(("toolbar adding %c", *itmtype));
+ LOG("toolbar adding %c", *itmtype);
switch (*itmtype) {
@@ -1361,7 +1361,7 @@ create_toolbar(struct gui_window *gw,
default:
widget = NULL;
xdir = 0;
- LOG(("Unknown element %c in toolbar layout", *itmtype));
+ LOG("Unknown element %c in toolbar layout", *itmtype);
break;
}
@@ -1370,7 +1370,7 @@ create_toolbar(struct gui_window *gw,
xpos += (xdir * (fbtk_get_width(widget) + padding));
}
- LOG(("xpos is %d",xpos));
+ LOG("xpos is %d", xpos);
itmtype += xdir;
}
@@ -1580,7 +1580,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"));
+ LOG("Normal window");
gw->window = fbtk_create_window(fbtk, 0, 0, 0, 0, 0);
@@ -1611,7 +1611,7 @@ 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)));
+ LOG("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,
@@ -2027,7 +2027,7 @@ gui_window_remove_caret(struct gui_window *g)
static void framebuffer_window_reformat(struct gui_window *gw)
{
/** @todo if we ever do zooming reformat should be implemented */
- LOG(("window:%p", gw));
+ LOG("window:%p", gw);
/*
browser_window_reformat(gw->bw, false, width, height);
@@ -2138,7 +2138,7 @@ main(int argc, char** argv)
/* create an initial browser window */
- LOG(("calling browser_window_create"));
+ LOG("calling browser_window_create");
ret = nsurl_create(feurl, &url);
if (ret == NSERROR_OK) {
@@ -2160,7 +2160,7 @@ main(int argc, char** argv)
netsurf_exit();
if (fb_font_finalise() == false)
- LOG(("Font finalisation failed."));
+ LOG("Font finalisation failed.");
/* finalise options */
nsoption_finalise(nsoptions, nsoptions_default);
diff --git a/framebuffer/misc.c b/framebuffer/misc.c
index 406a959d3..f1f96816a 100644
--- a/framebuffer/misc.c
+++ b/framebuffer/misc.c
@@ -27,7 +27,7 @@
void warn_user(const char *warning, const char *detail)
{
- LOG(("%s %s", warning, detail));
+ LOG("%s %s", warning, detail);
}
diff --git a/framebuffer/schedule.c b/framebuffer/schedule.c
index 151b6f99f..d75758197 100644
--- a/framebuffer/schedule.c
+++ b/framebuffer/schedule.c
@@ -203,13 +203,12 @@ void list_schedule(void)
gettimeofday(&tv, NULL);
- LOG(("schedule list at %ld:%ld", tv.tv_sec, tv.tv_usec));
+ LOG("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));
+ LOG("Schedule %p at %ld:%ld", cur_nscb, cur_nscb->tv.tv_sec, cur_nscb->tv.tv_usec);
cur_nscb = cur_nscb->next;
}
}