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); --- render/box.c | 4 +- render/box_construct.c | 2 +- render/box_normalise.c | 27 +++++---- render/box_textarea.c | 4 +- render/form.c | 142 ++++++++++++++++++++++++++++++---------------- render/html.c | 71 ++++++++++++----------- render/html_css.c | 40 +++++++------ render/html_css_fetcher.c | 11 ++-- render/html_interaction.c | 2 +- render/html_object.c | 17 +++--- render/html_script.c | 49 +++++++++------- render/imagemap.c | 24 ++++++-- render/layout.c | 97 +++++++++++++++++++++---------- render/table.c | 7 ++- render/textplain.c | 4 +- 15 files changed, 314 insertions(+), 187 deletions(-) (limited to 'render') diff --git a/render/box.c b/render/box.c index 77cc15bc3..8b9c89ee6 100644 --- a/render/box.c +++ b/render/box.c @@ -1155,7 +1155,7 @@ bool box_handle_scrollbars(struct content *c, struct box *box, if (box->scroll_y == NULL) { data = malloc(sizeof(struct html_scrollbar_data)); if (data == NULL) { - LOG("malloc failed"); + NSLOG(netsurf, INFO, "malloc failed"); guit->misc->warning("NoMemory", 0); return false; } @@ -1176,7 +1176,7 @@ bool box_handle_scrollbars(struct content *c, struct box *box, if (box->scroll_x == NULL) { data = malloc(sizeof(struct html_scrollbar_data)); if (data == NULL) { - LOG("malloc failed"); + NSLOG(netsurf, INFO, "malloc failed"); guit->misc->warning("NoMemory", 0); return false; } diff --git a/render/box_construct.c b/render/box_construct.c index d0ffd9d83..549d9122f 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -1900,7 +1900,7 @@ bool box_frameset(BOX_SPECIAL_PARAMS) bool ok; if (content->frameset) { - LOG("Error: multiple framesets in document."); + NSLOG(netsurf, INFO, "Error: multiple framesets in document."); /* Don't convert children */ if (convert_children) *convert_children = false; diff --git a/render/box_normalise.c b/render/box_normalise.c index 5d36b99d7..9f78f75ac 100644 --- a/render/box_normalise.c +++ b/render/box_normalise.c @@ -111,7 +111,7 @@ bool box_normalise_block(struct box *block, html_content *c) assert(block != NULL); #ifdef BOX_NORMALISE_DEBUG - LOG("block %p, block->type %u", block, block->type); + NSLOG(netsurf, INFO, "block %p, block->type %u", block, block->type); #endif assert(block->type == BOX_BLOCK || block->type == BOX_INLINE_BLOCK || @@ -119,7 +119,8 @@ bool box_normalise_block(struct box *block, html_content *c) for (child = block->children; child != NULL; child = next_child) { #ifdef BOX_NORMALISE_DEBUG - LOG("child %p, child->type = %d", child, child->type); + NSLOG(netsurf, INFO, "child %p, child->type = %d", child, + child->type); #endif next_child = child->next; /* child may be destroyed */ @@ -223,7 +224,7 @@ bool box_normalise_table(struct box *table, html_content * c) assert(table->type == BOX_TABLE); #ifdef BOX_NORMALISE_DEBUG - LOG("table %p", table); + NSLOG(netsurf, INFO, "table %p", table); #endif col_info.num_columns = 1; @@ -337,7 +338,8 @@ bool box_normalise_table(struct box *table, html_content * c) struct box *row; #ifdef BOX_NORMALISE_DEBUG - LOG("table->children == 0, creating implied row"); + NSLOG(netsurf, INFO, + "table->children == 0, creating implied row"); #endif assert(table->style != NULL); @@ -399,7 +401,7 @@ bool box_normalise_table(struct box *table, html_content * c) return false; #ifdef BOX_NORMALISE_DEBUG - LOG("table %p done", table); + NSLOG(netsurf, INFO, "table %p done", table); #endif return true; @@ -585,7 +587,7 @@ bool box_normalise_table_row_group(struct box *row_group, assert(row_group->type == BOX_TABLE_ROW_GROUP); #ifdef BOX_NORMALISE_DEBUG - LOG("row_group %p", row_group); + NSLOG(netsurf, INFO, "row_group %p", row_group); #endif for (child = row_group->children; child != NULL; child = next_child) { @@ -677,7 +679,8 @@ bool box_normalise_table_row_group(struct box *row_group, if (row_group->children == NULL) { #ifdef BOX_NORMALISE_DEBUG - LOG("row_group->children == 0, inserting implied row"); + NSLOG(netsurf, INFO, + "row_group->children == 0, inserting implied row"); #endif assert(row_group->style != NULL); @@ -712,7 +715,7 @@ bool box_normalise_table_row_group(struct box *row_group, row_group->rows = group_row_count; #ifdef BOX_NORMALISE_DEBUG - LOG("row_group %p done", row_group); + NSLOG(netsurf, INFO, "row_group %p done", row_group); #endif return true; @@ -734,7 +737,7 @@ bool box_normalise_table_row(struct box *row, assert(row->type == BOX_TABLE_ROW); #ifdef BOX_NORMALISE_DEBUG - LOG("row %p", row); + NSLOG(netsurf, INFO, "row %p", row); #endif for (child = row->children; child != NULL; child = next_child) { @@ -843,7 +846,7 @@ bool box_normalise_table_row(struct box *row, col_info->num_rows++; #ifdef BOX_NORMALISE_DEBUG - LOG("row %p done", row); + NSLOG(netsurf, INFO, "row %p done", row); #endif return true; @@ -934,7 +937,7 @@ bool box_normalise_inline_container(struct box *cont, html_content * c) assert(cont->type == BOX_INLINE_CONTAINER); #ifdef BOX_NORMALISE_DEBUG - LOG("cont %p", cont); + NSLOG(netsurf, INFO, "cont %p", cont); #endif for (child = cont->children; child != NULL; child = next_child) { @@ -997,7 +1000,7 @@ bool box_normalise_inline_container(struct box *cont, html_content * c) } #ifdef BOX_NORMALISE_DEBUG - LOG("cont %p done", cont); + NSLOG(netsurf, INFO, "cont %p done", cont); #endif return true; diff --git a/render/box_textarea.c b/render/box_textarea.c index 1586d71c4..3b1e7750c 100644 --- a/render/box_textarea.c +++ b/render/box_textarea.c @@ -149,7 +149,9 @@ static void box_textarea_callback(void *data, struct textarea_msg *msg) break; default: - LOG("Drag type %d not handled.", msg->data.drag); + NSLOG(netsurf, INFO, + "Drag type %d not handled.", + msg->data.drag); /* This is a logic faliure in the * front end code so abort. */ diff --git a/render/form.c b/render/form.c index a8b96fefb..904272d3a 100644 --- a/render/form.c +++ b/render/form.c @@ -218,7 +218,8 @@ void form_free_control(struct form_control *control) struct form_control *c; assert(control != NULL); - LOG("Control:%p name:%p value:%p initial:%p", control, control->name, control->value, control->initial_value); + NSLOG(netsurf, INFO, "Control:%p name:%p value:%p initial:%p", + control, control->name, control->value, control->initial_value); free(control->name); free(control->value); free(control->initial_value); @@ -229,7 +230,9 @@ void form_free_control(struct form_control *control) for (option = control->data.select.items; option; option = next) { next = option->next; - LOG("select option:%p text:%p value:%p", option, option->text, option->value); + NSLOG(netsurf, INFO, + "select option:%p text:%p value:%p", option, + option->text, option->value); free(option->text); free(option->value); free(option); @@ -348,7 +351,7 @@ bool form_successful_controls_dom(struct form *_form, /** \todo Replace this call with something DOMish */ charset = form_acceptable_charset(_form); if (charset == NULL) { - LOG("failed to find charset"); + NSLOG(netsurf, INFO, "failed to find charset"); return false; } @@ -362,7 +365,7 @@ bool form_successful_controls_dom(struct form *_form, err = dom_html_form_element_get_elements(form, &form_elements); if (err != DOM_NO_ERR) { - LOG("Could not get form elements"); + NSLOG(netsurf, INFO, "Could not get form elements"); goto dom_no_memory; } @@ -370,7 +373,7 @@ bool form_successful_controls_dom(struct form *_form, err = dom_html_collection_get_length(form_elements, &element_count); if (err != DOM_NO_ERR) { - LOG("Could not get form element count"); + NSLOG(netsurf, INFO, "Could not get form element count"); goto dom_no_memory; } @@ -402,7 +405,8 @@ bool form_successful_controls_dom(struct form *_form, err = dom_html_collection_item(form_elements, index, &form_element); if (err != DOM_NO_ERR) { - LOG("Could not retrieve form element %d", index); + NSLOG(netsurf, INFO, + "Could not retrieve form element %d", index); goto dom_no_memory; } @@ -414,7 +418,7 @@ bool form_successful_controls_dom(struct form *_form, */ err = dom_node_get_node_name(form_element, &nodename); if (err != DOM_NO_ERR) { - LOG("Could not get node name"); + NSLOG(netsurf, INFO, "Could not get node name"); goto dom_no_memory; } @@ -423,14 +427,16 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_text_area_element *)form_element, &element_disabled); if (err != DOM_NO_ERR) { - LOG("Could not get text area disabled property"); + NSLOG(netsurf, INFO, + "Could not get text area disabled property"); goto dom_no_memory; } err = dom_html_text_area_element_get_name( (dom_html_text_area_element *)form_element, &inputname); if (err != DOM_NO_ERR) { - LOG("Could not get text area name property"); + NSLOG(netsurf, INFO, + "Could not get text area name property"); goto dom_no_memory; } } else if (dom_string_isequal(nodename, corestring_dom_SELECT)) { @@ -438,14 +444,16 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_select_element *)form_element, &element_disabled); if (err != DOM_NO_ERR) { - LOG("Could not get select disabled property"); + NSLOG(netsurf, INFO, + "Could not get select disabled property"); goto dom_no_memory; } err = dom_html_select_element_get_name( (dom_html_select_element *)form_element, &inputname); if (err != DOM_NO_ERR) { - LOG("Could not get select name property"); + NSLOG(netsurf, INFO, + "Could not get select name property"); goto dom_no_memory; } } else if (dom_string_isequal(nodename, corestring_dom_INPUT)) { @@ -453,14 +461,16 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_input_element *)form_element, &element_disabled); if (err != DOM_NO_ERR) { - LOG("Could not get input disabled property"); + NSLOG(netsurf, INFO, + "Could not get input disabled property"); goto dom_no_memory; } err = dom_html_input_element_get_name( (dom_html_input_element *)form_element, &inputname); if (err != DOM_NO_ERR) { - LOG("Could not get input name property"); + NSLOG(netsurf, INFO, + "Could not get input name property"); goto dom_no_memory; } } else if (dom_string_isequal(nodename, corestring_dom_BUTTON)) { @@ -468,21 +478,23 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_button_element *)form_element, &element_disabled); if (err != DOM_NO_ERR) { - LOG("Could not get button disabled property"); + NSLOG(netsurf, INFO, + "Could not get button disabled property"); goto dom_no_memory; } err = dom_html_button_element_get_name( (dom_html_button_element *)form_element, &inputname); if (err != DOM_NO_ERR) { - LOG("Could not get button name property"); + NSLOG(netsurf, INFO, + "Could not get button name property"); goto dom_no_memory; } } else { /* Unknown element type came through! */ - LOG("Unknown element type: %*s", - (int)dom_string_byte_length(nodename), - dom_string_data(nodename)); + NSLOG(netsurf, INFO, "Unknown element type: %*s", + (int)dom_string_byte_length(nodename), + dom_string_data(nodename)); goto dom_no_memory; } if (element_disabled) @@ -495,7 +507,8 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_text_area_element *)form_element, &inputvalue); if (err != DOM_NO_ERR) { - LOG("Could not get text area content"); + NSLOG(netsurf, INFO, + "Could not get text area content"); goto dom_no_memory; } } else if (dom_string_isequal(nodename, corestring_dom_SELECT)) { @@ -504,13 +517,15 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_select_element *)form_element, &options); if (err != DOM_NO_ERR) { - LOG("Could not get select options collection"); + NSLOG(netsurf, INFO, + "Could not get select options collection"); goto dom_no_memory; } err = dom_html_options_collection_get_length( options, &options_count); if (err != DOM_NO_ERR) { - LOG("Could not get select options collection length"); + NSLOG(netsurf, INFO, + "Could not get select options collection length"); goto dom_no_memory; } for(option_index = 0; option_index < options_count; @@ -527,14 +542,17 @@ bool form_successful_controls_dom(struct form *_form, err = dom_html_options_collection_item( options, option_index, &option_element); if (err != DOM_NO_ERR) { - LOG("Could not get options item %d", option_index); + NSLOG(netsurf, INFO, + "Could not get options item %d", + option_index); goto dom_no_memory; } err = dom_html_option_element_get_selected( (dom_html_option_element *)option_element, &selected); if (err != DOM_NO_ERR) { - LOG("Could not get option selected property"); + NSLOG(netsurf, INFO, + "Could not get option selected property"); goto dom_no_memory; } if (!selected) @@ -543,13 +561,15 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_option_element *)option_element, &inputvalue); if (err != DOM_NO_ERR) { - LOG("Could not get option value"); + NSLOG(netsurf, INFO, + "Could not get option value"); goto dom_no_memory; } success_new = calloc(1, sizeof(*success_new)); if (success_new == NULL) { - LOG("Could not allocate data for option"); + NSLOG(netsurf, INFO, + "Could not allocate data for option"); goto dom_no_memory; } @@ -558,12 +578,14 @@ bool form_successful_controls_dom(struct form *_form, success_new->name = ENCODE_ITEM(inputname); if (success_new->name == NULL) { - LOG("Could not encode name for option"); + NSLOG(netsurf, INFO, + "Could not encode name for option"); goto dom_no_memory; } success_new->value = ENCODE_ITEM(inputvalue); if (success_new->value == NULL) { - LOG("Could not encode value for option"); + NSLOG(netsurf, INFO, + "Could not encode value for option"); goto dom_no_memory; } } @@ -573,7 +595,8 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_button_element *) form_element, &inputtype); if (err != DOM_NO_ERR) { - LOG("Could not get button element type"); + NSLOG(netsurf, INFO, + "Could not get button element type"); goto dom_no_memory; } if (dom_string_caseless_isequal( @@ -593,7 +616,8 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_button_element *)form_element, &inputvalue); if (err != DOM_NO_ERR) { - LOG("Could not get submit button value"); + NSLOG(netsurf, INFO, + "Could not get submit button value"); goto dom_no_memory; } /* Drop through to report successful button */ @@ -610,7 +634,8 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_input_element *) form_element, &inputtype); if (err != DOM_NO_ERR) { - LOG("Could not get input element type"); + NSLOG(netsurf, INFO, + "Could not get input element type"); goto dom_no_memory; } if (dom_string_caseless_isequal( @@ -630,7 +655,8 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_input_element *)form_element, &inputvalue); if (err != DOM_NO_ERR) { - LOG("Could not get submit button value"); + NSLOG(netsurf, INFO, + "Could not get submit button value"); goto dom_no_memory; } /* Drop through to report the successful button */ @@ -648,11 +674,13 @@ bool form_successful_controls_dom(struct form *_form, corestring_dom___ns_key_image_coords_node_data, &coords); if (err != DOM_NO_ERR) { - LOG("Could not get image XY data"); + NSLOG(netsurf, INFO, + "Could not get image XY data"); goto dom_no_memory; } if (coords == NULL) { - LOG("No XY data on the image input"); + NSLOG(netsurf, INFO, + "No XY data on the image input"); goto dom_no_memory; } @@ -661,7 +689,8 @@ bool form_successful_controls_dom(struct form *_form, success_new = calloc(1, sizeof(*success_new)); if (success_new == NULL) { free(basename); - LOG("Could not allocate data for image.x"); + NSLOG(netsurf, INFO, + "Could not allocate data for image.x"); goto dom_no_memory; } @@ -671,13 +700,15 @@ bool form_successful_controls_dom(struct form *_form, success_new->name = malloc(strlen(basename) + 3); if (success_new->name == NULL) { free(basename); - LOG("Could not allocate name for image.x"); + NSLOG(netsurf, INFO, + "Could not allocate name for image.x"); goto dom_no_memory; } success_new->value = malloc(20); if (success_new->value == NULL) { free(basename); - LOG("Could not allocate value for image.x"); + NSLOG(netsurf, INFO, + "Could not allocate value for image.x"); goto dom_no_memory; } sprintf(success_new->name, "%s.x", basename); @@ -686,7 +717,8 @@ bool form_successful_controls_dom(struct form *_form, success_new = calloc(1, sizeof(*success_new)); if (success_new == NULL) { free(basename); - LOG("Could not allocate data for image.y"); + NSLOG(netsurf, INFO, + "Could not allocate data for image.y"); goto dom_no_memory; } @@ -696,13 +728,15 @@ bool form_successful_controls_dom(struct form *_form, success_new->name = malloc(strlen(basename) + 3); if (success_new->name == NULL) { free(basename); - LOG("Could not allocate name for image.y"); + NSLOG(netsurf, INFO, + "Could not allocate name for image.y"); goto dom_no_memory; } success_new->value = malloc(20); if (success_new->value == NULL) { free(basename); - LOG("Could not allocate value for image.y"); + NSLOG(netsurf, INFO, + "Could not allocate value for image.y"); goto dom_no_memory; } sprintf(success_new->name, "%s.y", basename); @@ -717,7 +751,8 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_input_element *)form_element, &checked); if (err != DOM_NO_ERR) { - LOG("Could not get input element checked"); + NSLOG(netsurf, INFO, + "Could not get input element checked"); goto dom_no_memory; } if (!checked) @@ -726,7 +761,8 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_input_element *)form_element, &inputvalue); if (err != DOM_NO_ERR) { - LOG("Could not get input element value"); + NSLOG(netsurf, INFO, + "Could not get input element value"); goto dom_no_memory; } if (inputvalue == NULL) { @@ -741,7 +777,8 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_input_element *)form_element, &inputvalue); if (err != DOM_NO_ERR) { - LOG("Could not get file value"); + NSLOG(netsurf, INFO, + "Could not get file value"); goto dom_no_memory; } err = dom_node_get_user_data( @@ -749,14 +786,16 @@ bool form_successful_controls_dom(struct form *_form, corestring_dom___ns_key_file_name_node_data, &rawfile_temp); if (err != DOM_NO_ERR) { - LOG("Could not get file rawname"); + NSLOG(netsurf, INFO, + "Could not get file rawname"); goto dom_no_memory; } rawfile_temp = strdup(rawfile_temp != NULL ? rawfile_temp : ""); if (rawfile_temp == NULL) { - LOG("Could not copy file rawname"); + NSLOG(netsurf, INFO, + "Could not copy file rawname"); goto dom_no_memory; } /* Fall out to the allocation */ @@ -765,7 +804,8 @@ bool form_successful_controls_dom(struct form *_form, dom_string_caseless_isequal( inputtype, corestring_dom_button)) { /* Skip these */ - LOG("Skipping RESET and BUTTON"); + NSLOG(netsurf, INFO, + "Skipping RESET and BUTTON"); continue; } else { /* Everything else is treated as text values */ @@ -773,7 +813,8 @@ bool form_successful_controls_dom(struct form *_form, (dom_html_input_element *)form_element, &inputvalue); if (err != DOM_NO_ERR) { - LOG("Could not get input value"); + NSLOG(netsurf, INFO, + "Could not get input value"); goto dom_no_memory; } /* Fall out to the allocation */ @@ -782,7 +823,8 @@ bool form_successful_controls_dom(struct form *_form, success_new = calloc(1, sizeof(*success_new)); if (success_new == NULL) { - LOG("Could not allocate data for generic"); + NSLOG(netsurf, INFO, + "Could not allocate data for generic"); goto dom_no_memory; } @@ -791,12 +833,14 @@ bool form_successful_controls_dom(struct form *_form, success_new->name = ENCODE_ITEM(inputname); if (success_new->name == NULL) { - LOG("Could not encode name for generic"); + NSLOG(netsurf, INFO, + "Could not encode name for generic"); goto dom_no_memory; } success_new->value = ENCODE_ITEM(inputvalue); if (success_new->value == NULL) { - LOG("Could not encode value for generic"); + NSLOG(netsurf, INFO, + "Could not encode value for generic"); goto dom_no_memory; } if (rawfile_temp != NULL) { diff --git a/render/html.c b/render/html.c index 62dec9e95..482259f1c 100644 --- a/render/html.c +++ b/render/html.c @@ -89,8 +89,8 @@ bool fire_dom_event(dom_string *type, dom_node *target, dom_event_unref(evt); return false; } - LOG("Dispatching '%*s' against %p", - dom_string_length(type), dom_string_data(type), target); + NSLOG(netsurf, INFO, "Dispatching '%*s' against %p", + dom_string_length(type), dom_string_data(type), target); exc = dom_event_target_dispatch_event(target, evt, &result); if (exc != DOM_NO_ERR) { result = false; @@ -111,7 +111,7 @@ static void html_box_convert_done(html_content *c, bool success) dom_exception exc; /* returned by libdom functions */ dom_node *html; - LOG("Done XML to box (%p)", c); + NSLOG(netsurf, INFO, "Done XML to box (%p)", c); /* Clean up and report error if unsuccessful or aborted */ if ((success == false) || (c->aborted)) { @@ -141,7 +141,7 @@ static void html_box_convert_done(html_content *c, bool success) /** @todo should this call html_object_free_objects(c); * like the other error paths */ - LOG("error retrieving html element from dom"); + NSLOG(netsurf, INFO, "error retrieving html element from dom"); content_broadcast_errorcode(&c->base, NSERROR_DOM); content_set_error(&c->base); return; @@ -150,7 +150,7 @@ static void html_box_convert_done(html_content *c, bool success) /* extract image maps - can't do this sensibly in dom_to_box */ err = imagemap_extract(c); if (err != NSERROR_OK) { - LOG("imagemap extraction failed"); + NSLOG(netsurf, INFO, "imagemap extraction failed"); html_object_free_objects(c); content_broadcast_errorcode(&c->base, err); content_set_error(&c->base); @@ -601,14 +601,14 @@ void html_finish_conversion(html_content *htmlc) } /* convert dom tree to box tree */ - LOG("DOM to box (%p)", htmlc); + NSLOG(netsurf, INFO, "DOM to box (%p)", htmlc); content_set_status(&htmlc->base, messages_get("Processing")); msg_data.explicit_status_text = NULL; content_broadcast(&htmlc->base, CONTENT_MSG_STATUS, &msg_data); exc = dom_document_get_document_element(htmlc->document, (void *) &html); if ((exc != DOM_NO_ERR) || (html == NULL)) { - LOG("error retrieving html element from dom"); + NSLOG(netsurf, INFO, "error retrieving html element from dom"); content_broadcast_errorcode(&htmlc->base, NSERROR_DOM); content_set_error(&htmlc->base); return; @@ -616,7 +616,7 @@ void html_finish_conversion(html_content *htmlc) error = dom_to_box(html, htmlc, html_box_convert_done); if (error != NSERROR_OK) { - LOG("box conversion failed"); + NSLOG(netsurf, INFO, "box conversion failed"); dom_node_unref(html); html_object_free_objects(htmlc); content_broadcast_errorcode(&htmlc->base, error); @@ -687,9 +687,10 @@ dom_default_action_DOMNodeInserted_cb(struct dom_event *evt, void *pw) content_broadcast(&htmlc->base, CONTENT_MSG_GETCTX, &msg_data); - LOG("javascript context: %p (htmlc: %p)", - htmlc->jscontext, - htmlc); + NSLOG(netsurf, INFO, + "javascript context: %p (htmlc: %p)", + htmlc->jscontext, + htmlc); } if (htmlc->jscontext != NULL) { js_handle_new_element(htmlc->jscontext, @@ -795,22 +796,22 @@ html_document_user_data_handler(dom_node_operation operation, switch (operation) { case DOM_NODE_CLONED: - LOG("Cloned"); + NSLOG(netsurf, INFO, "Cloned"); break; case DOM_NODE_RENAMED: - LOG("Renamed"); + NSLOG(netsurf, INFO, "Renamed"); break; case DOM_NODE_IMPORTED: - LOG("imported"); + NSLOG(netsurf, INFO, "imported"); break; case DOM_NODE_ADOPTED: - LOG("Adopted"); + NSLOG(netsurf, INFO, "Adopted"); break; case DOM_NODE_DELETED: /* This is the only path I expect */ break; default: - LOG("User data operation not handled."); + NSLOG(netsurf, INFO, "User data operation not handled."); assert(0); } } @@ -935,7 +936,7 @@ html_create_html_data(html_content *c, const http_parameter *params) lwc_string_unref(c->universal); c->universal = NULL; - LOG("Unable to set user data."); + NSLOG(netsurf, INFO, "Unable to set user data."); return NSERROR_DOM; } @@ -1142,11 +1143,11 @@ static bool html_convert(struct content *c) exc = dom_document_get_quirks_mode(htmlc->document, &htmlc->quirks); if (exc == DOM_NO_ERR) { html_css_quirks_stylesheets(htmlc); - LOG("quirks set to %d", htmlc->quirks); + NSLOG(netsurf, INFO, "quirks set to %d", htmlc->quirks); } htmlc->base.active--; /* the html fetch is no longer active */ - LOG("%d fetches active (%p)", htmlc->base.active, c); + NSLOG(netsurf, INFO, "%d fetches active (%p)", htmlc->base.active, c); /* The parse cannot be completed here because it may be paused * untill all the resources being fetched have completed. @@ -1199,11 +1200,11 @@ html_begin_conversion(html_content *htmlc) * complete to avoid repeating the completion pointlessly. */ if (htmlc->parse_completed == false) { - LOG("Completing parse (%p)", htmlc); + NSLOG(netsurf, INFO, "Completing parse (%p)", htmlc); /* complete parsing */ error = dom_hubbub_parser_completed(htmlc->parser); if (error != DOM_HUBBUB_OK) { - LOG("Parsing failed"); + NSLOG(netsurf, INFO, "Parsing failed"); content_broadcast_errorcode(&htmlc->base, libdom_hubbub_error_to_nserror(error)); @@ -1214,15 +1215,15 @@ html_begin_conversion(html_content *htmlc) } if (html_can_begin_conversion(htmlc) == false) { - LOG("Can't begin conversion (%p)", htmlc); + NSLOG(netsurf, INFO, "Can't begin conversion (%p)", htmlc); /* We can't proceed (see commentary above) */ return true; } /* Give up processing if we've been aborted */ if (htmlc->aborted) { - LOG("Conversion aborted (%p) (active: %u)", htmlc, - htmlc->base.active); + NSLOG(netsurf, INFO, "Conversion aborted (%p) (active: %u)", + htmlc, htmlc->base.active); content_set_error(&htmlc->base); content_broadcast_errorcode(&htmlc->base, NSERROR_STOPPED); return false; @@ -1258,7 +1259,7 @@ html_begin_conversion(html_content *htmlc) /* locate root element and ensure it is html */ exc = dom_document_get_document_element(htmlc->document, (void *) &html); if ((exc != DOM_NO_ERR) || (html == NULL)) { - LOG("error retrieving html element from dom"); + NSLOG(netsurf, INFO, "error retrieving html element from dom"); content_broadcast_errorcode(&htmlc->base, NSERROR_DOM); return false; } @@ -1268,7 +1269,7 @@ html_begin_conversion(html_content *htmlc) (node_name == NULL) || (!dom_string_caseless_lwc_isequal(node_name, corestring_lwc_html))) { - LOG("root element not html"); + NSLOG(netsurf, INFO, "root element not html"); content_broadcast_errorcode(&htmlc->base, NSERROR_DOM); dom_node_unref(html); return false; @@ -1374,7 +1375,8 @@ static void html_stop(struct content *c) break; default: - LOG("Unexpected status %d (%p)", c->status, c); + NSLOG(netsurf, INFO, "Unexpected status %d (%p)", c->status, + c); assert(0); } } @@ -1531,7 +1533,7 @@ static void html_destroy(struct content *c) html_content *html = (html_content *) c; struct form *f, *g; - LOG("content %p", c); + NSLOG(netsurf, INFO, "content %p", c); /* Destroy forms */ for (f = html->forms; f != NULL; f = g) { @@ -1920,7 +1922,7 @@ static void html__dom_user_data_handler(dom_node_operation operation, free(data); break; default: - LOG("User data operation not handled."); + NSLOG(netsurf, INFO, "User data operation not handled."); assert(0); } } @@ -1936,7 +1938,8 @@ static void html__set_file_gadget_filename(struct content *c, ret = guit->utf8->local_to_utf8(fn, 0, &utf8_fn); if (ret != NSERROR_OK) { assert(ret != NSERROR_BAD_ENCODING); - LOG("utf8 to local encoding conversion failed"); + NSLOG(netsurf, INFO, + "utf8 to local encoding conversion failed"); /* Load was for us - just no memory */ return; } @@ -2088,7 +2091,7 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file) if (ret != NSERROR_OK) { /* bad encoding shouldn't happen */ assert(ret != NSERROR_BAD_ENCODING); - LOG("local to utf8 encoding failed"); + NSLOG(netsurf, INFO, "local to utf8 encoding failed"); free(buffer); guit->misc->warning("NoMemory", NULL); return true; @@ -2154,19 +2157,19 @@ html_debug_dump(struct content *c, FILE *f, enum content_debug op) ret = NSERROR_OK; } else { if (htmlc->document == NULL) { - LOG("No document to dump"); + NSLOG(netsurf, INFO, "No document to dump"); return NSERROR_DOM; } exc = dom_document_get_document_element(htmlc->document, (void *) &html); if ((exc != DOM_NO_ERR) || (html == NULL)) { - LOG("Unable to obtain root node"); + NSLOG(netsurf, INFO, "Unable to obtain root node"); return NSERROR_DOM; } ret = libdom_dump_structure(html, f, 0); - LOG("DOM structure dump returning %d", ret); + NSLOG(netsurf, INFO, "DOM structure dump returning %d", ret); dom_node_unref(html); } diff --git a/render/html_css.c b/render/html_css.c index ad1470daf..303bee64d 100644 --- a/render/html_css.c +++ b/render/html_css.c @@ -103,18 +103,21 @@ html_convert_css_callback(hlcache_handle *css, switch (event->type) { case CONTENT_MSG_DONE: - LOG("done stylesheet slot %d '%s'", i, nsurl_access(hlcache_handle_get_url(css))); + NSLOG(netsurf, INFO, "done stylesheet slot %d '%s'", i, + nsurl_access(hlcache_handle_get_url(css))); parent->base.active--; - LOG("%d fetches active", parent->base.active); + NSLOG(netsurf, INFO, "%d fetches active", parent->base.active); break; case CONTENT_MSG_ERROR: - LOG("stylesheet %s failed: %s", nsurl_access(hlcache_handle_get_url(css)), event->data.error); + NSLOG(netsurf, INFO, "stylesheet %s failed: %s", + nsurl_access(hlcache_handle_get_url(css)), + event->data.error); case CONTENT_MSG_ERRORCODE: hlcache_handle_release(css); s->sheet = NULL; parent->base.active--; - LOG("%d fetches active", parent->base.active); + NSLOG(netsurf, INFO, "%d fetches active", parent->base.active); content_add_error(&parent->base, "?", 0); break; @@ -151,7 +154,7 @@ html_stylesheet_from_domnode(html_content *c, exc = dom_node_get_text_content(node, &style); if ((exc != DOM_NO_ERR) || (style == NULL)) { - LOG("No text content"); + NSLOG(netsurf, INFO, "No text content"); return NSERROR_OK; } @@ -182,7 +185,7 @@ html_stylesheet_from_domnode(html_content *c, nsurl_unref(url); c->base.active++; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", c->base.active); return NSERROR_OK; } @@ -254,13 +257,14 @@ static bool html_css_process_modified_style(html_content *c, error = html_stylesheet_from_domnode(c, s->node, &sheet); if (error != NSERROR_OK) { - LOG("Failed to update sheet"); + NSLOG(netsurf, INFO, "Failed to update sheet"); content_broadcast_errorcode(&c->base, error); return false; } if (sheet != NULL) { - LOG("Updating sheet %p with %p", s->sheet, sheet); + NSLOG(netsurf, INFO, "Updating sheet %p with %p", s->sheet, + sheet); if (s->sheet != NULL) { switch (content_get_status(s->sheet)) { @@ -269,7 +273,8 @@ static bool html_css_process_modified_style(html_content *c, default: hlcache_handle_abort(s->sheet); c->base.active--; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", + c->base.active); } hlcache_handle_release(s->sheet); } @@ -314,7 +319,9 @@ bool html_css_update_style(html_content *c, dom_node *style) s = html_create_style_element(c, style); } if (s == NULL) { - LOG("Could not find or create inline stylesheet for %p", style); + NSLOG(netsurf, INFO, + "Could not find or create inline stylesheet for %p", + style); return false; } @@ -418,7 +425,8 @@ bool html_css_process_link(html_content *htmlc, dom_node *node) } dom_string_unref(href); - LOG("linked stylesheet %i '%s'", htmlc->stylesheet_count, nsurl_access(joined)); + NSLOG(netsurf, INFO, "linked stylesheet %i '%s'", + htmlc->stylesheet_count, nsurl_access(joined)); /* extend stylesheets array to allow for new sheet */ stylesheets = realloc(htmlc->stylesheets, @@ -453,7 +461,7 @@ bool html_css_process_link(html_content *htmlc, dom_node *node) htmlc->stylesheet_count++; htmlc->base.active++; - LOG("%d fetches active", htmlc->base.active); + NSLOG(netsurf, INFO, "%d fetches active", htmlc->base.active); return true; @@ -518,7 +526,7 @@ nserror html_css_quirks_stylesheets(html_content *c) } c->base.active++; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", c->base.active); } return ns_error; @@ -562,7 +570,7 @@ nserror html_css_new_stylesheets(html_content *c) } c->base.active++; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", c->base.active); if (nsoption_bool(block_advertisements)) { @@ -576,7 +584,7 @@ nserror html_css_new_stylesheets(html_content *c) } c->base.active++; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", c->base.active); } @@ -589,7 +597,7 @@ nserror html_css_new_stylesheets(html_content *c) } c->base.active++; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", c->base.active); return ns_error; } diff --git a/render/html_css_fetcher.c b/render/html_css_fetcher.c index 9eda6aeb7..0f8809a42 100644 --- a/render/html_css_fetcher.c +++ b/render/html_css_fetcher.c @@ -61,13 +61,15 @@ static html_css_fetcher_context *ring = NULL; static bool html_css_fetcher_initialise(lwc_string *scheme) { - LOG("html_css_fetcher_initialise called for %s", lwc_string_data(scheme)); + NSLOG(netsurf, INFO, "html_css_fetcher_initialise called for %s", + lwc_string_data(scheme)); return true; } static void html_css_fetcher_finalise(lwc_string *scheme) { - LOG("html_css_fetcher_finalise called for %s", lwc_string_data(scheme)); + NSLOG(netsurf, INFO, "html_css_fetcher_finalise called for %s", + lwc_string_data(scheme)); } static bool html_css_fetcher_can_fetch(const nsurl *url) @@ -251,7 +253,8 @@ static void html_css_fetcher_poll(lwc_string *scheme) html_css_fetcher_send_callback(&msg, c); } } else { - LOG("Processing of %s failed!", nsurl_access(c->url)); + NSLOG(netsurf, INFO, "Processing of %s failed!", + nsurl_access(c->url)); /* Ensure that we're unlocked here. If we aren't, * then html_css_fetcher_process() is broken. @@ -290,7 +293,7 @@ nserror html_css_fetcher_register(void) if (lwc_intern_string("x-ns-css", SLEN("x-ns-css"), &scheme) != lwc_error_ok) { - LOG("could not intern \"x-ns-css\"."); + NSLOG(netsurf, INFO, "could not intern \"x-ns-css\"."); return NSERROR_INIT_FAILED; } diff --git a/render/html_interaction.c b/render/html_interaction.c index 1ae9801c6..55da3cc03 100644 --- a/render/html_interaction.c +++ b/render/html_interaction.c @@ -289,7 +289,7 @@ html__image_coords_dom_user_data_handler(dom_node_operation operation, break; default: - LOG("User data operation not handled."); + NSLOG(netsurf, INFO, "User data operation not handled."); assert(0); } } diff --git a/render/html_object.c b/render/html_object.c index c86c57520..e98bdba0b 100644 --- a/render/html_object.c +++ b/render/html_object.c @@ -160,7 +160,7 @@ html_object_callback(hlcache_handle *object, case CONTENT_MSG_DONE: c->base.active--; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", c->base.active); html_object_done(box, object, o->background); @@ -191,7 +191,8 @@ html_object_callback(hlcache_handle *object, if (box != NULL) { c->base.active--; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", + c->base.active); content_add_error(&c->base, "?", 0); html_object_failed(box, c, o->background); @@ -503,7 +504,8 @@ static bool html_replace_object(struct content_html_object *object, nsurl *url) /* remove existing object */ if (content_get_status(object->content) != CONTENT_STATUS_DONE) { c->base.active--; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", + c->base.active); } hlcache_handle_release(object->content); @@ -524,7 +526,7 @@ static bool html_replace_object(struct content_html_object *object, nsurl *url) for (page = c; page != NULL; page = page->page) { page->base.active++; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", c->base.active); page->base.status = CONTENT_STATUS_READY; } @@ -607,7 +609,8 @@ nserror html_object_abort_objects(html_content *htmlc) object->content = NULL; if (object->box != NULL) { htmlc->base.active--; - LOG("%d fetches active", htmlc->base.active); + NSLOG(netsurf, INFO, "%d fetches active", + htmlc->base.active); } break; @@ -645,7 +648,7 @@ nserror html_object_free_objects(html_content *html) struct content_html_object *victim = html->object_list; if (victim->content != NULL) { - LOG("object %p", victim->content); + NSLOG(netsurf, INFO, "object %p", victim->content); if (content_get_type(victim->content) == CONTENT_HTML) { guit->misc->schedule(-1, html_object_refresh, victim); @@ -707,7 +710,7 @@ bool html_fetch_object(html_content *c, nsurl *url, struct box *box, c->num_objects++; if (box != NULL) { c->base.active++; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", c->base.active); } return true; diff --git a/render/html_script.c b/render/html_script.c index 6ed74c5c4..186e5203b 100644 --- a/render/html_script.c +++ b/render/html_script.c @@ -165,19 +165,22 @@ convert_script_async_cb(hlcache_handle *script, break; case CONTENT_MSG_DONE: - LOG("script %d done '%s'", i, nsurl_access(hlcache_handle_get_url(script))); + NSLOG(netsurf, INFO, "script %d done '%s'", i, + nsurl_access(hlcache_handle_get_url(script))); parent->base.active--; - LOG("%d fetches active", parent->base.active); + NSLOG(netsurf, INFO, "%d fetches active", parent->base.active); break; case CONTENT_MSG_ERROR: - LOG("script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), event->data.error); + NSLOG(netsurf, INFO, "script %s failed: %s", + nsurl_access(hlcache_handle_get_url(script)), + event->data.error); case CONTENT_MSG_ERRORCODE: hlcache_handle_release(script); s->data.handle = NULL; parent->base.active--; - LOG("%d fetches active", parent->base.active); + NSLOG(netsurf, INFO, "%d fetches active", parent->base.active); content_add_error(&parent->base, "?", 0); break; @@ -219,19 +222,22 @@ convert_script_defer_cb(hlcache_handle *script, switch (event->type) { case CONTENT_MSG_DONE: - LOG("script %d done '%s'", i, nsurl_access(hlcache_handle_get_url(script))); + NSLOG(netsurf, INFO, "script %d done '%s'", i, + nsurl_access(hlcache_handle_get_url(script))); parent->base.active--; - LOG("%d fetches active", parent->base.active); + NSLOG(netsurf, INFO, "%d fetches active", parent->base.active); break; case CONTENT_MSG_ERROR: - LOG("script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), event->data.error); + NSLOG(netsurf, INFO, "script %s failed: %s", + nsurl_access(hlcache_handle_get_url(script)), + event->data.error); case CONTENT_MSG_ERRORCODE: hlcache_handle_release(script); s->data.handle = NULL; parent->base.active--; - LOG("%d fetches active", parent->base.active); + NSLOG(netsurf, INFO, "%d fetches active", parent->base.active); content_add_error(&parent->base, "?", 0); break; @@ -274,9 +280,10 @@ convert_script_sync_cb(hlcache_handle *script, switch (event->type) { case CONTENT_MSG_DONE: - LOG("script %d done '%s'", i, nsurl_access(hlcache_handle_get_url(script))); + NSLOG(netsurf, INFO, "script %d done '%s'", i, + nsurl_access(hlcache_handle_get_url(script))); parent->base.active--; - LOG("%d fetches active", parent->base.active); + NSLOG(netsurf, INFO, "%d fetches active", parent->base.active); s->already_started = true; @@ -293,20 +300,22 @@ convert_script_sync_cb(hlcache_handle *script, /* continue parse */ err = dom_hubbub_parser_pause(parent->parser, false); if (err != DOM_HUBBUB_OK) { - LOG("unpause returned 0x%x", err); + NSLOG(netsurf, INFO, "unpause returned 0x%x", err); } break; case CONTENT_MSG_ERROR: - LOG("script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), event->data.error); + NSLOG(netsurf, INFO, "script %s failed: %s", + nsurl_access(hlcache_handle_get_url(script)), + event->data.error); case CONTENT_MSG_ERRORCODE: hlcache_handle_release(script); s->data.handle = NULL; parent->base.active--; - LOG("%d fetches active", parent->base.active); + NSLOG(netsurf, INFO, "%d fetches active", parent->base.active); content_add_error(&parent->base, "?", 0); s->already_started = true; @@ -314,7 +323,7 @@ convert_script_sync_cb(hlcache_handle *script, /* continue parse */ err = dom_hubbub_parser_pause(parent->parser, false); if (err != DOM_HUBBUB_OK) { - LOG("unpause returned 0x%x", err); + NSLOG(netsurf, INFO, "unpause returned 0x%x", err); } break; @@ -360,7 +369,8 @@ exec_src_script(html_content *c, return DOM_HUBBUB_NOMEM; } - LOG("script %i '%s'", c->scripts_count, nsurl_access(joined)); + NSLOG(netsurf, INFO, "script %i '%s'", c->scripts_count, + nsurl_access(joined)); /* there are three ways to process the script tag at this point: * @@ -438,11 +448,11 @@ exec_src_script(html_content *c, */ /* mark duff script fetch as already started */ nscript->already_started = true; - LOG("Fetch failed with error %d", ns_error); + NSLOG(netsurf, INFO, "Fetch failed with error %d", ns_error); } else { /* update base content active fetch count */ c->base.active++; - LOG("%d fetches active", c->base.active); + NSLOG(netsurf, INFO, "%d fetches active", c->base.active); switch (script_type) { case HTML_SCRIPT_SYNC: @@ -525,14 +535,15 @@ html_process_script(void *ctx, dom_node *node) msg_data.jscontext = &c->jscontext; content_broadcast(&c->base, CONTENT_MSG_GETCTX, &msg_data); - LOG("javascript context %p ", c->jscontext); + NSLOG(netsurf, INFO, "javascript context %p ", c->jscontext); if (c->jscontext == NULL) { /* no context and it could not be created, abort */ return DOM_HUBBUB_OK; } } - LOG("content %p parser %p node %p", c, c->parser, node); + NSLOG(netsurf, INFO, "content %p parser %p node %p", c, c->parser, + node); exc = dom_element_get_attribute(node, corestring_dom_type, &mimetype); if (exc != DOM_NO_ERR || mimetype == NULL) { diff --git a/render/imagemap.c b/render/imagemap.c index 6e2504bdc..0d3b42a1b 100644 --- a/render/imagemap.c +++ b/render/imagemap.c @@ -241,21 +241,35 @@ void imagemap_dump(html_content *c) map = c->imagemaps[i]; while (map != NULL) { - LOG("Imagemap: %s", map->key); + NSLOG(netsurf, INFO, "Imagemap: %s", map->key); for (entry = map->list; entry; entry = entry->next) { switch (entry->type) { case IMAGEMAP_DEFAULT: - LOG("\tDefault: %s", nsurl_access(entry->url)); + NSLOG(netsurf, INFO, "\tDefault: %s", + nsurl_access(entry->url)); break; case IMAGEMAP_RECT: - LOG("\tRectangle: %s: [(%d,%d),(%d,%d)]", nsurl_access(entry->url), entry->bounds.rect.x0, entry->bounds.rect.y0, entry->bounds.rect.x1, entry->bounds.rect.y1); + NSLOG(netsurf, INFO, + "\tRectangle: %s: [(%d,%d),(%d,%d)]", + nsurl_access(entry->url), + entry->bounds.rect.x0, + entry->bounds.rect.y0, + entry->bounds.rect.x1, + entry->bounds.rect.y1); break; case IMAGEMAP_CIRCLE: - LOG("\tCircle: %s: [(%d,%d),%d]", nsurl_access(entry->url), entry->bounds.circle.x, entry->bounds.circle.y, entry->bounds.circle.r); + NSLOG(netsurf, INFO, + "\tCircle: %s: [(%d,%d),%d]", + nsurl_access(entry->url), + entry->bounds.circle.x, + entry->bounds.circle.y, + entry->bounds.circle.r); break; case IMAGEMAP_POLY: - LOG("\tPolygon: %s:", nsurl_access(entry->url)); + NSLOG(netsurf, INFO, + "\tPolygon: %s:", + nsurl_access(entry->url)); for (j = 0; j != entry->bounds.poly.num; j++) { fprintf(stderr, "(%d,%d) ", diff --git a/render/layout.c b/render/layout.c index 6782fdfc6..962b4d403 100644 --- a/render/layout.c +++ b/render/layout.c @@ -343,7 +343,7 @@ layout_minmax_line(struct box *first, b->type == BOX_INLINE_END); #ifdef LAYOUT_DEBUG - LOG("%p: min %i, max %i", b, min, max); + NSLOG(netsurf, INFO, "%p: min %i, max %i", b, min, max); #endif if (b->type == BOX_BR) { @@ -625,7 +625,7 @@ layout_minmax_line(struct box *first, *line_max = max; #ifdef LAYOUT_DEBUG - LOG("line_min %i, line_max %i", min, max); + NSLOG(netsurf, INFO, "line_min %i, line_max %i", min, max); #endif assert(b != first); @@ -1470,7 +1470,7 @@ find_sides(struct box *fl, int fy0, fy1, fx0, fx1; #ifdef LAYOUT_DEBUG - LOG("y0 %i, y1 %i, x0 %i, x1 %i", y0, y1, *x0, *x1); + NSLOG(netsurf, INFO, "y0 %i, y1 %i, x0 %i, x1 %i", y0, y1, *x0, *x1); #endif *left = *right = 0; @@ -1501,7 +1501,8 @@ find_sides(struct box *fl, } #ifdef LAYOUT_DEBUG - LOG("x0 %i, x1 %i, left %p, right %p", *x0, *x1, *left, *right); + NSLOG(netsurf, INFO, "x0 %i, x1 %i, left %p, right %p", *x0, *x1, + *left, *right); #endif } @@ -1965,13 +1966,17 @@ static bool layout_table(struct box *table, int available_width, /* calculate width required by cells */ for (i = 0; i != columns; i++) { #ifdef LAYOUT_DEBUG - LOG("table %p, column %u: type %s, width %i, min %i, max %i", table, i, ((const char *[]){ + NSLOG(netsurf, INFO, + "table %p, column %u: type %s, width %i, min %i, max %i", + table, + i, ((const char *[]){ "UNKNOWN", "FIXED", "AUTO", "PERCENT", - "RELATIVE" - })[col[i].type], col[i].width, col[i].min, col[i].max); + "RELATIVE", + })[col[i].type], col[i].width, col[i].min, + col[i].max); #endif if (col[i].positioned) { @@ -1991,14 +1996,16 @@ static bool layout_table(struct box *table, int available_width, required_width += col[i].min; #ifdef LAYOUT_DEBUG - LOG("required_width %i", required_width); + NSLOG(netsurf, INFO, "required_width %i", required_width); #endif } required_width += (columns + 1 - positioned_columns) * border_spacing_h; #ifdef LAYOUT_DEBUG - LOG("width %i, min %i, max %i, auto %i, required %i", table_width, table->min_width, table->max_width, auto_width, required_width); + NSLOG(netsurf, INFO, + "width %i, min %i, max %i, auto %i, required %i", table_width, + table->min_width, table->max_width, auto_width, required_width); #endif if (auto_width < required_width) { @@ -2449,7 +2456,8 @@ static bool layout_block_object(struct box *block) assert(block->object); #ifdef LAYOUT_DEBUG - LOG("block %p, object %s, width %i", block, hlcache_handle_get_url(block->object), block->width); + NSLOG(netsurf, INFO, "block %p, object %s, width %i", block, + hlcache_handle_get_url(block->object), block->width); #endif if (content_get_type(block->object) == CONTENT_HTML) { @@ -2747,7 +2755,7 @@ layout_block_context(struct box *block, } #ifdef LAYOUT_DEBUG - LOG("box %p, cx %i, cy %i", box, cx, cy); + NSLOG(netsurf, INFO, "box %p, cx %i, cy %i", box, cx, cy); #endif /* Layout (except tables). */ @@ -3625,7 +3633,8 @@ static void layout_compute_relative_offset(struct box *box, int *x, int *y) } #ifdef LAYOUT_DEBUG - LOG("left %i, right %i, top %i, bottom %i", left, right, top, bottom); + NSLOG(netsurf, INFO, "left %i, right %i, top %i, bottom %i", left, + right, top, bottom); #endif *x = left; @@ -3888,8 +3897,11 @@ layout_text_box_split(html_content *content, else c2->parent->last = c2; #ifdef LAYOUT_DEBUG - LOG("split_box %p len: %u \"%.*s\"", split_box, split_box->length, split_box->length, split_box->text); - LOG(" new_box %p len: %u \"%.*s\"", c2, c2->length, c2->length, c2->text); + NSLOG(netsurf, INFO, "split_box %p len: %u \"%.*s\"", + split_box, split_box->length, split_box->length, + split_box->text); + NSLOG(netsurf, INFO, " new_box %p len: %u \"%.*s\"", c2, + c2->length, c2->length, c2->text); #endif return true; } @@ -4080,7 +4092,8 @@ place_float_below(struct box *c, int width, int cx, int y, struct box *cont) y : cont->cached_place_below_level; #ifdef LAYOUT_DEBUG - LOG("c %p, width %i, cx %i, y %i, cont %p", c, width, cx, y, cont); + NSLOG(netsurf, INFO, "c %p, width %i, cx %i, y %i, cont %p", c, + width, cx, y, cont); #endif do { @@ -4159,7 +4172,15 @@ layout_line(struct box *first, plot_font_style_t fstyle; #ifdef LAYOUT_DEBUG - LOG("first %p, first->text '%.*s', width %i, y %i, cx %i, cy %i", first, (int)first->length, first->text, *width, *y, cx, cy); + NSLOG(netsurf, INFO, + "first %p, first->text '%.*s', width %i, y %i, cx %i, cy %i", + first, + (int)first->length, + first->text, + *width, + *y, + cx, + cy); #endif /* find sides at top of line */ @@ -4190,7 +4211,7 @@ layout_line(struct box *first, * body executed at least once * keep in sync with the loop in layout_minmax_line() */ #ifdef LAYOUT_DEBUG - LOG("x0 %i, x1 %i, x1 - x0 %i", x0, x1, x1 - x0); + NSLOG(netsurf, INFO, "x0 %i, x1 %i, x1 - x0 %i", x0, x1, x1 - x0); #endif for (x = 0, b = first; x <= x1 - x0 && b != 0; b = b->next) { @@ -4203,7 +4224,7 @@ layout_line(struct box *first, b->type == BOX_INLINE_END); #ifdef LAYOUT_DEBUG - LOG("pass 1: b %p, x %i", b, x); + NSLOG(netsurf, INFO, "pass 1: b %p, x %i", b, x); #endif if (b->type == BOX_BR) @@ -4414,12 +4435,12 @@ layout_line(struct box *first, /* pass 2: place boxes in line: loop body executed at least once */ #ifdef LAYOUT_DEBUG - LOG("x0 %i, x1 %i, x1 - x0 %i", x0, x1, x1 - x0); + NSLOG(netsurf, INFO, "x0 %i, x1 %i, x1 - x0 %i", x0, x1, x1 - x0); #endif for (x = x_previous = 0, b = first; x <= x1 - x0 && b; b = b->next) { #ifdef LAYOUT_DEBUG - LOG("pass 2: b %p, x %i", b, x); + NSLOG(netsurf, INFO, "pass 2: b %p, x %i", b, x); #endif if (b->type == BOX_INLINE_BLOCK && @@ -4489,7 +4510,7 @@ layout_line(struct box *first, } else { /* float */ #ifdef LAYOUT_DEBUG - LOG("float %p", b); + NSLOG(netsurf, INFO, "float %p", b); #endif d = b->children; @@ -4501,7 +4522,8 @@ layout_line(struct box *first, return false; #ifdef LAYOUT_DEBUG - LOG("%p : %d %d", d, d->margin[TOP], d->border[TOP].width); + NSLOG(netsurf, INFO, "%p : %d %d", d, d->margin[TOP], + d->border[TOP].width); #endif d->x = d->margin[LEFT] + d->border[LEFT].width; @@ -4654,7 +4676,7 @@ layout_line(struct box *first, } x += space_before + w; #ifdef LAYOUT_DEBUG - LOG("forcing"); + NSLOG(netsurf, INFO, "forcing"); #endif } else if ((split == 0 || x1 - x0 <= x + space_before + w) && inline_count == 1) { @@ -4664,11 +4686,16 @@ layout_line(struct box *first, used_height = 0; if (left) { #ifdef LAYOUT_DEBUG - LOG("cy %i, left->y %i, left->height %i", cy, left->y, left->height); + NSLOG(netsurf, INFO, + "cy %i, left->y %i, left->height %i", + cy, + left->y, + left->height); #endif used_height = left->y + left->height - cy + 1; #ifdef LAYOUT_DEBUG - LOG("used_height %i", used_height); + NSLOG(netsurf, INFO, "used_height %i", + used_height); #endif } if (right && used_height < @@ -4680,20 +4707,22 @@ layout_line(struct box *first, b = split_box; #ifdef LAYOUT_DEBUG - LOG("moving below float"); + NSLOG(netsurf, INFO, "moving below float"); #endif } else if (split == 0 || x1 - x0 <= x + space_before + w) { /* first word of box doesn't fit so leave box for next * line */ b = split_box; #ifdef LAYOUT_DEBUG - LOG("leaving for next line"); + NSLOG(netsurf, INFO, "leaving for next line"); #endif } else { /* fit as many words as possible */ assert(split != 0); #ifdef LAYOUT_DEBUG - LOG("'%.*s' %i %zu %i", (int)split_box->length, split_box->text, x1 - x0, split, w); + NSLOG(netsurf, INFO, "'%.*s' %i %zu %i", + (int)split_box->length, split_box->text, + x1 - x0, split, w); #endif if (split != split_box->length) { if (!layout_text_box_split(content, &fstyle, @@ -4703,7 +4732,7 @@ layout_line(struct box *first, } x += space_before + w; #ifdef LAYOUT_DEBUG - LOG("fitting words"); + NSLOG(netsurf, INFO, "fitting words"); #endif } move_y = true; @@ -4843,7 +4872,13 @@ bool layout_inline_container(struct box *inline_container, int width, assert(inline_container->type == BOX_INLINE_CONTAINER); #ifdef LAYOUT_DEBUG - LOG("inline_container %p, width %i, cont %p, cx %i, cy %i", inline_container, width, cont, cx, cy); + NSLOG(netsurf, INFO, + "inline_container %p, width %i, cont %p, cx %i, cy %i", + inline_container, + width, + cont, + cx, + cy); #endif has_text_children = false; @@ -4873,7 +4908,7 @@ bool layout_inline_container(struct box *inline_container, int width, */ for (c = inline_container->children; c; ) { #ifdef LAYOUT_DEBUG - LOG("c %p", c); + NSLOG(netsurf, INFO, "c %p", c); #endif curwidth = inline_container->width; if (!layout_line(c, &curwidth, &y, cx, cy + y, cont, first_line, diff --git a/render/table.c b/render/table.c index acf00c70e..3210fde2d 100644 --- a/render/table.c +++ b/render/table.c @@ -219,13 +219,14 @@ bool table_calculate_column_types(struct box *table) #ifdef TABLE_DEBUG for (i = 0; i != table->columns; i++) - LOG("table %p, column %u: type %s, width %i", table, i, ((const char *[]){ + NSLOG(netsurf, INFO, + "table %p, column %u: type %s, width %i", table, i, ((const char *[]){ "UNKNOWN", "FIXED", "AUTO", "PERCENT", - "RELATIVE" - })[col[i].type], col[i].width); + "RELATIVE", + })[col[i].type], col[i].width); #endif return true; diff --git a/render/textplain.c b/render/textplain.c index 2f2d757c8..ab2d55955 100644 --- a/render/textplain.c +++ b/render/textplain.c @@ -423,7 +423,7 @@ static void textplain_reformat(struct content *c, int width, int height) size_t line_start; nserror res; - LOG("content %p w:%d h:%d", c, width, height); + NSLOG(netsurf, INFO, "content %p w:%d h:%d", c, width, height); /* compute available columns (assuming monospaced font) - use 8 * characters for better accuracy @@ -522,7 +522,7 @@ static void textplain_reformat(struct content *c, int width, int height) return; no_memory: - LOG("out of memory (line_count %lu)", line_count); + NSLOG(netsurf, INFO, "out of memory (line_count %lu)", line_count); return; } -- cgit v1.2.3