summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/form.cc34
-rw-r--r--src/html.cc136
-rw-r--r--src/table.cc22
3 files changed, 97 insertions, 95 deletions
diff --git a/src/form.cc b/src/form.cc
index e488a524..6703f64c 100644
--- a/src/form.cc
+++ b/src/form.cc
@@ -343,7 +343,7 @@ void Html_tag_open_form(DilloHtml *html, const char *tag, int tagsize)
HT2TB(html)->addParbreak (9, html->wordStyle ());
if (html->InFlags & IN_FORM) {
- BUG_MSG("nested forms\n");
+ BUG_MSG("nested forms");
return;
}
html->InFlags |= IN_FORM;
@@ -356,14 +356,14 @@ void Html_tag_open_form(DilloHtml *html, const char *tag, int tagsize)
if (!dStrAsciiCasecmp(attrbuf, "post")) {
method = DILLO_HTML_METHOD_POST;
} else if (dStrAsciiCasecmp(attrbuf, "get")) {
- BUG_MSG("Unknown form submission method \"%s\"\n", attrbuf);
+ BUG_MSG("Unknown form submission method \"%s\"", attrbuf);
}
}
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "action")))
action = a_Html_url_new(html, attrbuf, NULL, 0);
else {
if (html->DocType != DT_HTML || html->DocTypeVersion <= 4.01f)
- BUG_MSG("action attribute is required for <form>\n");
+ BUG_MSG("action attribute is required for <form>");
action = a_Url_dup(html->base_url);
}
content_type = DILLO_HTML_ENC_URLENCODED;
@@ -417,7 +417,7 @@ static int Html_input_get_size(DilloHtml *html, const char *attrbuf)
if (size < 1 || size > MAX_SIZE) {
int badSize = size;
size = (size < 1 ? 20 : MAX_SIZE);
- BUG_MSG("input size=%d, using size=%d instead\n", badSize, size);
+ BUG_MSG("input size=%d, using size=%d instead", badSize, size);
}
}
return size;
@@ -437,11 +437,11 @@ void Html_tag_open_input(DilloHtml *html, const char *tag, int tagsize)
ResourceFactory *factory;
if (html->InFlags & IN_SELECT) {
- BUG_MSG("<input> element inside <select>\n");
+ BUG_MSG("<input> element inside <select>");
return;
}
if (html->InFlags & IN_BUTTON) {
- BUG_MSG("<input> element inside <button>\n");
+ BUG_MSG("<input> element inside <button>");
return;
}
@@ -507,12 +507,12 @@ void Html_tag_open_input(DilloHtml *html, const char *tag, int tagsize)
DilloHtmlForm *form = html->getCurrentForm();
if (form->method != DILLO_HTML_METHOD_POST) {
valid = false;
- BUG_MSG("Forms with file input MUST use HTTP POST method\n");
+ BUG_MSG("Forms with file input MUST use HTTP POST method");
MSG("File input ignored in form not using HTTP POST method\n");
} else if (form->content_type != DILLO_HTML_ENC_MULTIPART) {
valid = false;
BUG_MSG("Forms with file input MUST use multipart/form-data"
- " encoding\n");
+ " encoding");
MSG("File input ignored in form not using multipart/form-data"
" encoding\n");
}
@@ -641,25 +641,25 @@ void Html_tag_content_textarea(DilloHtml *html, const char *tag, int tagsize)
cols = strtol(attrbuf, NULL, 10);
} else {
if (html->DocType != DT_HTML || html->DocTypeVersion <= 4.01f)
- BUG_MSG("cols attribute is required for <textarea>\n");
+ BUG_MSG("cols attribute is required for <textarea>");
cols = 20;
}
if (cols < 1 || cols > MAX_COLS) {
int badCols = cols;
cols = (cols < 1 ? 20 : MAX_COLS);
- BUG_MSG("textarea cols=%d, using cols=%d instead\n", badCols, cols);
+ BUG_MSG("textarea cols=%d, using cols=%d instead", badCols, cols);
}
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "rows"))) {
rows = strtol(attrbuf, NULL, 10);
} else {
if (html->DocType != DT_HTML || html->DocTypeVersion <= 4.01f)
- BUG_MSG("rows attribute is required for <textarea>\n");
+ BUG_MSG("rows attribute is required for <textarea>");
rows = 10;
}
if (rows < 1 || rows > MAX_ROWS) {
int badRows = rows;
rows = (rows < 1 ? 2 : MAX_ROWS);
- BUG_MSG("textarea rows=%d, using rows=%d instead\n", badRows, rows);
+ BUG_MSG("textarea rows=%d, using rows=%d instead", badRows, rows);
}
name = NULL;
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "name")))
@@ -799,11 +799,11 @@ void Html_tag_close_select(DilloHtml *html)
void Html_tag_open_optgroup(DilloHtml *html, const char *tag, int tagsize)
{
if (!(html->InFlags & IN_SELECT)) {
- BUG_MSG("<optgroup> element outside <select>\n");
+ BUG_MSG("<optgroup> element outside <select>");
return;
}
if (html->InFlags & IN_OPTGROUP) {
- BUG_MSG("nested <optgroup>\n");
+ BUG_MSG("nested <optgroup>");
return;
}
if (html->InFlags & IN_OPTION) {
@@ -821,7 +821,7 @@ void Html_tag_open_optgroup(DilloHtml *html, const char *tag, int tagsize)
bool enabled = (a_Html_get_attr(html, tag, tagsize, "disabled") == NULL);
if (!label) {
- BUG_MSG("label attribute is required for <optgroup>\n");
+ BUG_MSG("label attribute is required for <optgroup>");
label = strdup("");
}
@@ -859,7 +859,7 @@ void Html_tag_close_optgroup(DilloHtml *html)
void Html_tag_open_option(DilloHtml *html, const char *tag, int tagsize)
{
if (!(html->InFlags & IN_SELECT)) {
- BUG_MSG("<option> element outside <select>\n");
+ BUG_MSG("<option> element outside <select>");
return;
}
if (html->InFlags & IN_OPTION)
@@ -918,7 +918,7 @@ void Html_tag_open_button(DilloHtml *html, const char *tag, int tagsize)
inp_type = DILLO_HTML_INPUT_BUTTON_SUBMIT;
} else {
inp_type = DILLO_HTML_INPUT_UNKNOWN;
- BUG_MSG("Unknown button type: \"%s\"\n", type);
+ BUG_MSG("Unknown button type: \"%s\"", type);
}
if (inp_type != DILLO_HTML_INPUT_UNKNOWN) {
diff --git a/src/html.cc b/src/html.cc
index 4b2804f8..7a453eac 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -133,6 +133,8 @@ void DilloHtml::bugMessage(const char *format, ... )
{
va_list argp;
+ if (bw->num_page_bugs)
+ dStr_append_c(bw->page_bugs, '\n');
dStr_sprintfa(bw->page_bugs,
"HTML warning: line %d, ",
getCurrLineNumber());
@@ -159,13 +161,13 @@ DilloUrl *a_Html_url_new(DilloHtml *html,
const char *suffix = (n_ic) > 1 ? "s" : "";
n_ic_spc = URL_ILLEGAL_CHARS_SPC(url);
if (n_ic == n_ic_spc) {
- BUG_MSG("URL has %d illegal space%s ('%s')\n", n_ic, suffix, url_str);
+ BUG_MSG("URL has %d illegal space%s ('%s')", n_ic, suffix, url_str);
} else if (n_ic_spc == 0) {
- BUG_MSG("URL has %d illegal byte%s in {00-1F, 7F-FF} range ('%s')\n",
+ BUG_MSG("URL has %d illegal byte%s in {00-1F, 7F-FF} range ('%s')",
n_ic, suffix, url_str);
} else {
BUG_MSG("URL has %d illegal byte%s: "
- "%d space%s and %d in {00-1F, 7F-FF} range ('%s')\n",
+ "%d space%s and %d in {00-1F, 7F-FF} range ('%s')",
n_ic, suffix,
n_ic_spc, n_ic_spc > 1 ? "s" : "", n_ic-n_ic_spc, url_str);
}
@@ -291,7 +293,7 @@ void a_Html_tag_set_align_attr(DilloHtml *html, const char *tag, int tagsize)
TextAlignType textAlignType = TEXT_ALIGN_LEFT;
if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f)
- BUG_MSG("The align attribute is obsolete in HTML5.\n");
+ BUG_MSG("The align attribute is obsolete in HTML5.");
if (dStrAsciiCasecmp (align, "left") == 0)
textAlignType = TEXT_ALIGN_LEFT;
@@ -335,7 +337,7 @@ bool a_Html_tag_set_valign_attr(DilloHtml *html, const char *tag, int tagsize)
if ((attr = a_Html_get_attr(html, tag, tagsize, "valign"))) {
if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f)
- BUG_MSG("The valign attribute is obsolete in HTML5.\n");
+ BUG_MSG("The valign attribute is obsolete in HTML5.");
if (dStrAsciiCasecmp (attr, "top") == 0)
valign = VALIGN_TOP;
@@ -849,7 +851,7 @@ static const char *Html_parse_numeric_charref(DilloHtml *html, char *tok,
(html->DocType == DT_HTML && html->DocTypeVersion <= 4.01f))) {
char c = *s;
*s = '\0';
- BUG_MSG("character reference '&#%s' lacks ';'\n", tok);
+ BUG_MSG("character reference '&#%s' lacks ';'", tok);
*s = c;
}
/* Don't require ';' for old HTML, except that our current heuristic
@@ -874,7 +876,7 @@ static const char *Html_parse_numeric_charref(DilloHtml *html, char *tok,
*/
char c = *s;
*s = '\0';
- BUG_MSG("numeric character reference '&#%s' is not valid.\n", tok);
+ BUG_MSG("numeric character reference '&#%s' is not valid.", tok);
*s = c;
codepoint = (codepoint >= 145 && codepoint <= 151) ?
@@ -934,7 +936,7 @@ static const char *Html_parse_named_charref(DilloHtml *html, char *tok,
if (c != ';') {
if (prefs.show_extra_warnings && (html->DocType == DT_XHTML ||
(html->DocType == DT_HTML && html->DocTypeVersion <= 4.01f)))
- BUG_MSG("character reference '&%s' lacks ';'\n", tok);
+ BUG_MSG("character reference '&%s' lacks ';'", tok);
/* Don't require ';' for old HTML, except that our current heuristic
* is to require it in attributes to avoid cases like "&copy=1" found
@@ -961,7 +963,7 @@ static const char *Html_parse_named_charref(DilloHtml *html, char *tok,
if (!ret) {
c = *s;
*s = '\0';
- BUG_MSG("undefined character reference &%s\n", tok);
+ BUG_MSG("undefined character reference &%s", tok);
*s = c;
}
*entsize = s-tok+1;
@@ -992,7 +994,7 @@ static const char *Html_parse_entity(DilloHtml *html, const char *token,
} else if (prefs.show_extra_warnings &&
(!(html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f))) {
// HTML5 doesn't mind literal '&'s.
- BUG_MSG("literal '&'\n");
+ BUG_MSG("literal '&'");
}
dFree(tok);
@@ -1105,7 +1107,7 @@ static void Html_process_space(DilloHtml *html, const char *space,
break;
case '\t':
if (prefs.show_extra_warnings)
- BUG_MSG("TAB character inside <PRE>\n");
+ BUG_MSG("TAB character inside <PRE>");
offset = TAB_SIZE - html->pre_column % TAB_SIZE;
spaceCnt += offset;
html->pre_column += offset;
@@ -1324,7 +1326,7 @@ static void Html_tag_cleanup_to_idx(DilloHtml *html, int idx)
int toptag_idx = S_TOP(html)->tag_idx;
TagInfo toptag = Tags[toptag_idx];
if (s_sz > idx + 1 && toptag.EndTag != 'O')
- BUG_MSG(" - forcing close of open tag: <%s>\n", toptag.name);
+ BUG_MSG(" - forcing close of open tag: <%s>", toptag.name);
_MSG("Close: %*s%s\n", size," ", toptag.name);
if (toptag.close)
toptag.close(html);
@@ -1382,10 +1384,10 @@ static void Html_tag_cleanup_at_close(DilloHtml *html, int new_idx)
if (matched) {
Html_tag_cleanup_to_idx(html, stack_idx);
} else if (expected) {
- BUG_MSG("unexpected closing tag: </%s> -- expected </%s>.\n",
+ BUG_MSG("unexpected closing tag: </%s> -- expected </%s>.",
new_tag.name, Tags[tag_idx].name);
} else {
- BUG_MSG("unexpected closing tag: </%s>.\n", new_tag.name);
+ BUG_MSG("unexpected closing tag: </%s>.", new_tag.name);
}
}
@@ -1421,7 +1423,7 @@ static void Html_tag_cleanup_nested_inputs(DilloHtml *html, int new_idx)
}
if (matched) {
- BUG_MSG("attempt to nest <%s> element inside <%s> -- closing <%s>\n",
+ BUG_MSG("attempt to nest <%s> element inside <%s> -- closing <%s>",
Tags[new_idx].name, Tags[u_idx].name, Tags[u_idx].name);
Html_tag_cleanup_to_idx(html, stack_idx);
} else {
@@ -1491,7 +1493,7 @@ CssLength a_Html_parse_length (DilloHtml *html, const char *attr)
else {
/* allow only whitespaces */
if (*end && !isspace (*end)) {
- BUG_MSG("Garbage after length: %s\n", attr);
+ BUG_MSG("Garbage after length: %s", attr);
l = CSS_CREATE_LENGTH(0.0, CSS_LENGTH_TYPE_AUTO);
}
}
@@ -1511,7 +1513,7 @@ int32_t a_Html_color_parse(DilloHtml *html, const char *str,
int32_t color = a_Color_parse(str, default_color, &err);
if (err) {
- BUG_MSG("color \"%s\" is not in \"#RRGGBB\" format\n", str);
+ BUG_MSG("color \"%s\" is not in \"#RRGGBB\" format", str);
}
return color;
}
@@ -1529,7 +1531,7 @@ static int
if (!valid) {
BUG_MSG("'%s' value \"%s\" must not be empty and must not contain "
- "spaces.\n", attrname, val);
+ "spaces.", attrname, val);
}
return valid ? 1 : 0;
} else {
@@ -1541,7 +1543,7 @@ static int
if (val[i] || !(isascii(val[0]) && isalpha(val[0])))
BUG_MSG("'%s' value \"%s\" is not of the form "
- "[A-Za-z][A-Za-z0-9:_.-]*\n", attrname, val);
+ "[A-Za-z][A-Za-z0-9:_.-]*", attrname, val);
return !(val[i]);
}
@@ -1606,7 +1608,7 @@ static void Html_parse_doctype(DilloHtml *html, const char *tag, int tagsize)
_MSG("New: {%s}\n", ntag);
if (html->DocType != DT_NONE)
- BUG_MSG("Multiple DOCTYPE declarations.\n");
+ BUG_MSG("Multiple DOCTYPE declarations.");
/* The default DT_NONE type is TagSoup */
if (i > strlen(HTML_SGML_sig) && // avoid out of bounds reads!
@@ -1640,7 +1642,7 @@ static void Html_parse_doctype(DilloHtml *html, const char *tag, int tagsize)
}
if (html->DocType == DT_NONE) {
html->DocType = DT_UNRECOGNIZED;
- BUG_MSG("DOCTYPE not recognized:\n%s.\n", ntag);
+ BUG_MSG("DOCTYPE not recognized:\n%s.", ntag);
}
dFree(ntag);
}
@@ -1659,7 +1661,7 @@ static void Html_tag_open_html(DilloHtml *html, const char *tag, int tagsize)
++html->Num_HTML;
if (html->Num_HTML > 1) {
- BUG_MSG("HTML element was already open\n");
+ BUG_MSG("HTML element was already open");
html->ReqTagClose = true;
}
}
@@ -1678,7 +1680,7 @@ static void Html_tag_close_html(DilloHtml *html)
static void Html_tag_open_head(DilloHtml *html, const char *tag, int tagsize)
{
if (html->InFlags & IN_BODY) {
- BUG_MSG("HEAD element must go before the BODY section\n");
+ BUG_MSG("HEAD element must go before the BODY section");
html->ReqTagClose = true;
return;
}
@@ -1686,10 +1688,10 @@ static void Html_tag_open_head(DilloHtml *html, const char *tag, int tagsize)
if (html->Num_HEAD < UCHAR_MAX)
++html->Num_HEAD;
if (html->InFlags & IN_HEAD) {
- BUG_MSG("HEAD element was already open\n");
+ BUG_MSG("HEAD element was already open");
html->ReqTagClose = true;
} else if (html->Num_HEAD > 1) {
- BUG_MSG("HEAD section already finished -- ignoring\n");
+ BUG_MSG("HEAD section already finished -- ignoring");
html->ReqTagClose = true;
} else {
html->InFlags |= IN_HEAD;
@@ -1706,7 +1708,7 @@ static void Html_tag_close_head(DilloHtml *html)
if (html->Num_HEAD == 1) {
/* match for the well formed start of HEAD section */
if (html->Num_TITLE == 0)
- BUG_MSG("HEAD section lacks the TITLE element\n");
+ BUG_MSG("HEAD section lacks the TITLE element");
html->InFlags &= ~IN_HEAD;
@@ -1736,9 +1738,9 @@ static void Html_tag_open_title(DilloHtml *html, const char *tag, int tagsize)
if (html->Num_TITLE < UCHAR_MAX)
++html->Num_TITLE;
if (html->Num_TITLE > 1)
- BUG_MSG("A redundant TITLE element was found\n");
+ BUG_MSG("A redundant TITLE element was found");
} else {
- BUG_MSG("TITLE element must be inside the HEAD section -- ignoring\n");
+ BUG_MSG("TITLE element must be inside the HEAD section -- ignoring");
}
}
@@ -1786,7 +1788,7 @@ static void Html_tag_open_style(DilloHtml *html, const char *tag, int tagsize)
if (!(attrbuf = a_Html_get_attr(html, tag, tagsize, "type"))) {
if (html->DocType != DT_HTML || html->DocTypeVersion <= 4.01f)
- BUG_MSG("type attribute is required for <style>\n");
+ BUG_MSG("type attribute is required for <style>");
} else if (dStrAsciiCasecmp(attrbuf, "text/css")) {
html->loadCssFromStash = false;
}
@@ -1835,21 +1837,21 @@ static void Html_tag_open_body(DilloHtml *html, const char *tag, int tagsize)
++html->Num_BODY;
if (html->Num_BODY > 1) {
- BUG_MSG("BODY element was already open\n");
+ BUG_MSG("BODY element was already open");
html->ReqTagClose = true;
return;
}
if (html->InFlags & IN_HEAD) {
/* if we're here, it's bad XHTML, no need to recover */
- BUG_MSG("unclosed HEAD element\n");
+ BUG_MSG("unclosed HEAD element");
}
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "bgcolor"))) {
color = a_Html_color_parse(html, attrbuf, -1);
if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f)
- BUG_MSG("<body> bgcolor attribute is obsolete.\n");
+ BUG_MSG("<body> bgcolor attribute is obsolete.");
if (color != -1)
html->styleEngine->setNonCssHint (CSS_PROPERTY_BACKGROUND_COLOR,
@@ -1860,7 +1862,7 @@ static void Html_tag_open_body(DilloHtml *html, const char *tag, int tagsize)
color = a_Html_color_parse(html, attrbuf, -1);
if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f)
- BUG_MSG("<body> text attribute is obsolete.\n");
+ BUG_MSG("<body> text attribute is obsolete.");
if (color != -1)
html->styleEngine->setNonCssHint (CSS_PROPERTY_COLOR,
@@ -1872,13 +1874,13 @@ static void Html_tag_open_body(DilloHtml *html, const char *tag, int tagsize)
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "link"))) {
html->non_css_link_color = a_Html_color_parse(html, attrbuf, -1);
if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f)
- BUG_MSG("<body> link attribute is obsolete.\n");
+ BUG_MSG("<body> link attribute is obsolete.");
}
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "vlink"))) {
html->non_css_visited_color = a_Html_color_parse(html, attrbuf, -1);
if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f)
- BUG_MSG("<body> vlink attribute is obsolete.\n");
+ BUG_MSG("<body> vlink attribute is obsolete.");
}
html->dw->setStyle (html->style ());
@@ -2348,7 +2350,7 @@ static void Html_tag_content_map(DilloHtml *html, const char *tag, int tagsize)
DilloUrl *url;
if (html->InFlags & IN_MAP) {
- BUG_MSG("nested <map>\n");
+ BUG_MSG("nested <map>");
} else {
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "name"))) {
html->InFlags |= IN_MAP;
@@ -2358,7 +2360,7 @@ static void Html_tag_content_map(DilloHtml *html, const char *tag, int tagsize)
a_Url_free (url);
dFree(hash_name);
} else {
- BUG_MSG("name attribute is required for <map>\n");
+ BUG_MSG("name attribute is required for <map>");
}
}
}
@@ -2410,7 +2412,7 @@ misc::SimpleVector<int> *Html_read_coords(DilloHtml *html, const char *str)
if (!*newtail)
break;
if (*newtail != ',') {
- BUG_MSG("area coords must be integers separated by commas.\n");
+ BUG_MSG("area coords must be integers separated by commas.");
}
tail = newtail + 1;
}
@@ -2433,7 +2435,7 @@ static void
Shape *shape = NULL;
if (!(html->InFlags & IN_MAP)) {
- BUG_MSG("<area> element not inside <map>\n");
+ BUG_MSG("<area> element not inside <map>");
return;
}
attrbuf = a_Html_get_attr(html, tag, tagsize, "shape");
@@ -2449,7 +2451,7 @@ static void
} else if (dStrnAsciiCasecmp(attrbuf, "poly", 4) == 0) {
type = POLYGON;
} else {
- BUG_MSG("<area> unknown shape: \"%s\"\n", attrbuf);
+ BUG_MSG("<area> unknown shape: \"%s\"", attrbuf);
type = UNKNOWN;
}
if (type == RECTANGLE || type == CIRCLE || type == POLYGON) {
@@ -2459,7 +2461,7 @@ static void
if (type == RECTANGLE) {
if (coords->size() != 4)
- BUG_MSG("<area> rectangle must have four coordinate values\n");
+ BUG_MSG("<area> rectangle must have four coordinate values");
if (coords->size() >= 4)
shape = new Rectangle(coords->get(0),
coords->get(1),
@@ -2467,7 +2469,7 @@ static void
coords->get(3) - coords->get(1));
} else if (type == CIRCLE) {
if (coords->size() != 3)
- BUG_MSG("<area> circle must have three coordinate values\n");
+ BUG_MSG("<area> circle must have three coordinate values");
if (coords->size() >= 3)
shape = new Circle(coords->get(0), coords->get(1),
coords->get(2));
@@ -2475,7 +2477,7 @@ static void
Polygon *poly;
int i;
if (coords->size() % 2)
- BUG_MSG("<area> polygon with odd number of coordinates\n");
+ BUG_MSG("<area> polygon with odd number of coordinates");
shape = poly = new Polygon();
for (i = 0; i < (coords->size() / 2); i++)
poly->addPoint(coords->get(2*i), coords->get(2*i + 1));
@@ -2611,11 +2613,11 @@ static void Html_tag_open_source(DilloHtml *html, const char *tag,
const char *attrbuf;
if (!(html->InFlags & IN_MEDIA)) {
- BUG_MSG("<source> element not inside a media element.\n");
+ BUG_MSG("<source> element not inside a media element.");
return;
}
if (!(attrbuf = a_Html_get_attr(html, tag, tagsize, "src"))) {
- BUG_MSG("src attribute is required in <source> element.\n");
+ BUG_MSG("src attribute is required in <source> element.");
return;
} else {
DilloUrl *url = a_Html_url_new(html, attrbuf, NULL, 0);
@@ -2692,7 +2694,7 @@ static const char* Html_get_javascript_link(DilloHtml *html)
if ((ch == '"' || ch == '\'') &&
(p2 = strchr(Buf->str + i + 1 , ch))) {
p1 = Buf->str + i;
- BUG_MSG("link depends on javascript()\n");
+ BUG_MSG("link depends on javascript()");
dStr_truncate(Buf, p2 - Buf->str);
dStr_erase(Buf, 0, p1 - Buf->str + 1);
}
@@ -2707,7 +2709,7 @@ static void Html_add_anchor(DilloHtml *html, const char *name)
{
_MSG("Registering ANCHOR: %s\n", name);
if (!HT2TB(html)->addAnchor (name, html->style ()))
- BUG_MSG("Anchor names must be unique within the document ('%s')\n",name);
+ BUG_MSG("Anchor names must be unique within the document ('%s')",name);
/*
* According to Sec. 12.2.1 of the HTML 4.01 spec, "anchor names that
* differ only in case may not appear in the same document", but
@@ -2778,7 +2780,7 @@ static void Html_tag_open_a(DilloHtml *html, const char *tag, int tagsize)
if (!id || strcmp(nameVal, id)) {
if (id)
BUG_MSG("id ('%s') and name ('%s') attributes of <a> tag "
- "differ\n", id, nameVal);
+ "differ", id, nameVal);
Html_add_anchor(html, nameVal);
}
@@ -2854,7 +2856,7 @@ static void Html_tag_open_ul(DilloHtml *html, const char *tag, int tagsize)
html->styleEngine->setNonCssHint (CSS_PROPERTY_LIST_STYLE_TYPE,
CSS_TYPE_ENUM, list_style_type);
if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f)
- BUG_MSG("<ul> type attribute is obsolete.\n");
+ BUG_MSG("<ul> type attribute is obsolete.");
}
S_TOP(html)->list_type = HTML_LIST_UNORDERED;
@@ -2876,7 +2878,7 @@ static void Html_tag_open_dir(DilloHtml *html, const char *tag, int tagsize)
S_TOP(html)->ref_list_item = NULL;
if (prefs.show_extra_warnings)
- BUG_MSG("Obsolete list type; use <UL> instead\n");
+ BUG_MSG("Obsolete list type; use <UL> instead");
}
/*
@@ -2926,7 +2928,7 @@ static void Html_tag_open_ol(DilloHtml *html, const char *tag, int tagsize)
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "start")) &&
(n = (int) strtol(attrbuf, NULL, 10)) < 0) {
- BUG_MSG( "illegal '-' character in START attribute; Starting from 0\n");
+ BUG_MSG( "illegal '-' character in START attribute; Starting from 0");
n = 0;
}
S_TOP(html)->list_number = n;
@@ -2943,7 +2945,7 @@ static void Html_tag_open_li(DilloHtml *html, const char *tag, int tagsize)
const char *attrbuf;
if (S_TOP(html)->list_type == HTML_LIST_NONE)
- BUG_MSG("<li> outside <ul> or <ol>\n");
+ BUG_MSG("<li> outside <ul> or <ol>");
html->InFlags |= IN_LI;
@@ -2954,7 +2956,7 @@ static void Html_tag_open_li(DilloHtml *html, const char *tag, int tagsize)
// ordered
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "value")) &&
(*list_number = strtol(attrbuf, NULL, 10)) < 0) {
- BUG_MSG("illegal negative LIST VALUE attribute; Starting from 0\n");
+ BUG_MSG("illegal negative LIST VALUE attribute; Starting from 0");
*list_number = 0;
}
}
@@ -2981,7 +2983,7 @@ static void Html_tag_open_hr(DilloHtml *html, const char *tag, int tagsize)
width_ptr = a_Html_get_attr_wdef(html, tag, tagsize, "width", NULL);
if (width_ptr) {
if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f)
- BUG_MSG("<hr> width attribute is obsolete.\n");
+ BUG_MSG("<hr> width attribute is obsolete.");
html->styleEngine->setNonCssHint (CSS_PROPERTY_WIDTH,
CSS_TYPE_LENGTH_PERCENTAGE,
a_Html_parse_length (html, width_ptr));
@@ -2991,7 +2993,7 @@ static void Html_tag_open_hr(DilloHtml *html, const char *tag, int tagsize)
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "size"))) {
size = strtol(attrbuf, NULL, 10);
if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f)
- BUG_MSG("<hr> size attribute is obsolete.\n");
+ BUG_MSG("<hr> size attribute is obsolete.");
}
a_Html_tag_set_align_attr(html, tag, tagsize);
@@ -2999,7 +3001,7 @@ static void Html_tag_open_hr(DilloHtml *html, const char *tag, int tagsize)
/* TODO: evaluate attribute */
if (a_Html_get_attr(html, tag, tagsize, "noshade")) {
if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f)
- BUG_MSG("<hr> noshade attribute is obsolete.\n");
+ BUG_MSG("<hr> noshade attribute is obsolete.");
html->styleEngine->setNonCssHint (CSS_PROPERTY_BORDER_TOP_STYLE,
CSS_TYPE_ENUM, BORDER_SOLID);
html->styleEngine->setNonCssHint (CSS_PROPERTY_BORDER_BOTTOM_STYLE,
@@ -3154,7 +3156,7 @@ static void Html_tag_open_meta(DilloHtml *html, const char *tag, int tagsize)
/* only valid inside HEAD */
if (!(html->InFlags & IN_HEAD)) {
- BUG_MSG("META element must be inside the HEAD section\n");
+ BUG_MSG("META element must be inside the HEAD section");
return;
}
@@ -3187,7 +3189,7 @@ static void Html_tag_open_meta(DilloHtml *html, const char *tag, int tagsize)
if (a_Url_cmp(html->base_url, new_url) == 0) {
/* redirection loop, or empty url string: ignore */
- BUG_MSG("META refresh: %s\n",
+ BUG_MSG("META refresh: %s",
*mr_url ? "redirection loop" : "no target URL");
} else if (delay == 0) {
/* zero-delay redirection */
@@ -3312,7 +3314,7 @@ static void Html_tag_open_link(DilloHtml *html, const char *tag, int tagsize)
/* Ignore LINK outside HEAD */
if (!(html->InFlags & IN_HEAD)) {
- BUG_MSG("LINK element must be inside the HEAD section\n");
+ BUG_MSG("LINK element must be inside the HEAD section");
return;
}
/* Remote stylesheets enabled? */
@@ -3357,12 +3359,12 @@ static void Html_tag_open_base(DilloHtml *html, const char *tag, int tagsize)
a_Url_free(html->base_url);
html->base_url = BaseUrl;
} else {
- BUG_MSG("base URI is relative (it MUST be absolute)\n");
+ BUG_MSG("base URI is relative (it MUST be absolute)");
a_Url_free(BaseUrl);
}
}
} else {
- BUG_MSG("the BASE element must appear in the HEAD section\n");
+ BUG_MSG("the BASE element must appear in the HEAD section");
}
}
@@ -3700,7 +3702,7 @@ static void Html_stack_cleanup_at_open(DilloHtml *html, int new_idx)
/* we have an inline (or empty) container... */
if (Tags[oldtag_idx].EndTag == 'R') {
- BUG_MSG("<%s> is not allowed to contain <%s>. -- closing <%s>\n",
+ BUG_MSG("<%s> is not allowed to contain <%s>. -- closing <%s>",
Tags[oldtag_idx].name, Tags[new_idx].name,
Tags[oldtag_idx].name);
}
@@ -3729,7 +3731,7 @@ static void Html_test_section(DilloHtml *html, int new_idx, int IsCloseTag)
int tag_idx;
if (!(html->InFlags & IN_HTML) && html->DocType == DT_NONE)
- BUG_MSG("the required DOCTYPE declaration is missing.\n");
+ BUG_MSG("the required DOCTYPE declaration is missing.");
if (!(html->InFlags & IN_HTML)) {
tag = "<html>";
@@ -3845,7 +3847,7 @@ static void Html_check_html5_obsolete(DilloHtml *html, int ni)
}
for (int i = 0; i < 9; i++) {
if (indexes[i] == ni) {
- BUG_MSG("<%s> is obsolete in HTML5.\n", Tags[ni].name);
+ BUG_MSG("<%s> is obsolete in HTML5.", Tags[ni].name);
break;
}
}
@@ -3940,7 +3942,7 @@ static void Html_process_tag(DilloHtml *html, char *tag, int tagsize)
/* TODO: this is only raising a warning, take some defined action.
* Note: apache uses IMG inside PRE (we could use its "alt"). */
if ((html->InFlags & IN_PRE) && Html_tag_pre_excludes(ni))
- BUG_MSG("<pre> is not allowed to contain <%s>\n", Tags[ni].name);
+ BUG_MSG("<pre> is not allowed to contain <%s>", Tags[ni].name);
/* Make sure these elements don't nest each other */
if (html->InFlags & (IN_BUTTON | IN_SELECT | IN_TEXTAREA))
@@ -4268,7 +4270,7 @@ static int Html_write_raw(DilloHtml *html, char *buf, int bufsize, int Eof)
if (buf[offset] == ch || !buf[offset]) {
buf_index = offset;
} else {
- BUG_MSG("attribute lacks closing quote\n");
+ BUG_MSG("attribute lacks closing quote");
break;
}
}
@@ -4276,7 +4278,7 @@ static int Html_write_raw(DilloHtml *html, char *buf, int bufsize, int Eof)
/* unterminated tag detected */
p = dStrndup(buf+token_start+1,
strcspn(buf+token_start+1, " <\n\r\t"));
- BUG_MSG("<%s> element lacks its closing '>'\n", p);
+ BUG_MSG("<%s> element lacks its closing '>'", p);
dFree(p);
--buf_index;
break;
diff --git a/src/table.cc b/src/table.cc
index 29b5fbc9..e5871b7f 100644
--- a/src/table.cc
+++ b/src/table.cc
@@ -49,13 +49,13 @@ void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize)
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "cellspacing"))) {
cellspacing = strtol (attrbuf, NULL, 10);
if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f)
- BUG_MSG("<table> cellspacing attribute is obsolete.\n");
+ BUG_MSG("<table> cellspacing attribute is obsolete.");
}
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "cellpadding"))) {
cellpadding = strtol (attrbuf, NULL, 10);
if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f)
- BUG_MSG("<table> cellpadding attribute is obsolete.\n");
+ BUG_MSG("<table> cellpadding attribute is obsolete.");
}
if (border != -1) {
@@ -89,7 +89,7 @@ void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize)
CSS_TYPE_LENGTH_PERCENTAGE,
a_Html_parse_length (html, attrbuf));
if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f)
- BUG_MSG("<table> width attribute is obsolete.\n");
+ BUG_MSG("<table> width attribute is obsolete.");
}
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "align"))) {
@@ -103,7 +103,7 @@ void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize)
html->styleEngine->setNonCssHint (CSS_PROPERTY_TEXT_ALIGN,
CSS_TYPE_ENUM, TEXT_ALIGN_CENTER);
if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f)
- BUG_MSG("<table> align attribute is obsolete.\n");
+ BUG_MSG("<table> align attribute is obsolete.");
}
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "bgcolor"))) {
@@ -112,7 +112,7 @@ void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize)
html->styleEngine->setNonCssHint (CSS_PROPERTY_BACKGROUND_COLOR,
CSS_TYPE_COLOR, bgcolor);
if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f)
- BUG_MSG("<table> bgcolor attribute is obsolete.\n");
+ BUG_MSG("<table> bgcolor attribute is obsolete.");
}
html->style (); // evaluate now, so we can build non-css hints for the cells
@@ -193,7 +193,7 @@ void Html_tag_open_tr(DilloHtml *html, const char *tag, int tagsize)
html->styleEngine->setNonCssHint (CSS_PROPERTY_BACKGROUND_COLOR,
CSS_TYPE_COLOR, bgcolor);
if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f)
- BUG_MSG("<tr> bgcolor attribute is obsolete.\n");
+ BUG_MSG("<tr> bgcolor attribute is obsolete.");
}
if (a_Html_get_attr (html, tag, tagsize, "align")) {
@@ -380,7 +380,7 @@ static void Html_tag_open_table_cell(DilloHtml *html,
}
if (a_Html_get_attr(html, tag, tagsize, "nowrap")) {
if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f)
- BUG_MSG("<t%c> nowrap attribute is obsolete.\n",
+ BUG_MSG("<t%c> nowrap attribute is obsolete.",
(tagsize >=3 && (D_ASCII_TOLOWER(tag[2]) == 'd')) ? 'd' : 'h');
html->styleEngine->setNonCssHint(CSS_PROPERTY_WHITE_SPACE,
CSS_TYPE_ENUM, WHITE_SPACE_NOWRAP);
@@ -393,7 +393,7 @@ static void Html_tag_open_table_cell(DilloHtml *html,
CSS_TYPE_LENGTH_PERCENTAGE,
a_Html_parse_length (html, attrbuf));
if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f)
- BUG_MSG("<t%c> width attribute is obsolete.\n",
+ BUG_MSG("<t%c> width attribute is obsolete.",
(tagsize >=3 && (D_ASCII_TOLOWER(tag[2]) == 'd')) ? 'd' : 'h');
}
@@ -405,7 +405,7 @@ static void Html_tag_open_table_cell(DilloHtml *html,
html->styleEngine->setNonCssHint (CSS_PROPERTY_BACKGROUND_COLOR,
CSS_TYPE_COLOR, bgcolor);
if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f)
- BUG_MSG("<t%c> bgcolor attribute is obsolete.\n",
+ BUG_MSG("<t%c> bgcolor attribute is obsolete.",
(tagsize >=3 && (D_ASCII_TOLOWER(tag[2]) == 'd')) ? 'd' : 'h');
}
@@ -424,12 +424,12 @@ static void Html_tag_content_table_cell(DilloHtml *html,
switch (S_TOP(html)->table_mode) {
case DILLO_HTML_TABLE_MODE_NONE:
- BUG_MSG("<t%c> outside <table>\n",
+ BUG_MSG("<t%c> outside <table>",
(tagsize >=3 && (D_ASCII_TOLOWER(tag[2]) == 'd')) ? 'd' : 'h');
return;
case DILLO_HTML_TABLE_MODE_TOP:
- BUG_MSG("<t%c> outside <tr>\n",
+ BUG_MSG("<t%c> outside <tr>",
(tagsize >=3 && (D_ASCII_TOLOWER(tag[2]) == 'd')) ? 'd' : 'h');
/* a_Dw_table_add_cell takes care that dillo does not crash. */
/* continues */