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); --- 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 +- 11 files changed, 179 insertions(+), 145 deletions(-) (limited to 'frontends/framebuffer') 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; } } -- cgit v1.2.3