gbranden pushed a commit to branch master
in repository groff.
commit 5b4e24db8982bfb12f8b5346b8dc4d9739b76d9b
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Jun 5 15:17:32 2026 -0500
[grohtml]: Improve type-correctness.
`html` is an object of type `simple_output` which contains a
`word_list`, which contains a list of `word`s, each of which store its
contents in a `char *`, _not_ objects of groff's `string` class.
* src/devices/grohtml/post-html.cpp (html_printer::write_html_anchor)
(html_printer::write_xhtml_anchor)
(html_printer::write_header): Populate `html` object with `contents()`
of `header.header_buffer` object.
(html_printer::do_heading): Catenate `header.header_buffer` with
`g->text_string`, not a groff `string` constructed therefrom.
---
ChangeLog | 14 ++++++++++++++
src/devices/grohtml/post-html.cpp | 14 +++++++-------
2 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 96b6bfb05..7c9feae6c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2026-06-06 G. Branden Robinson <[email protected]>
+
+ * src/devices/grohtml/post-html.cpp: Improve type-correctness.
+ `html` is an object of type `simple_output` which contains a
+ `word_list`, which contains a list of `word`s, each of which
+ store its contents in a `char *`, _not_ objects of groff's
+ `string` class.
+ (html_printer::write_html_anchor)
+ (html_printer::write_xhtml_anchor)
+ (html_printer::write_header): Populate `html` object with
+ `contents()` of `header.header_buffer` object.
+ (html_printer::do_heading): Catenate `header.header_buffer` with
+ `g->text_string`, not a groff `string` constructed therefrom.
+
2026-06-04 G. Branden Robinson <[email protected]>
* src/devices/grohtml/post-html.cpp (page::add_encode): Add null
diff --git a/src/devices/grohtml/post-html.cpp
b/src/devices/grohtml/post-html.cpp
index 309aa68db..5cb5aa149 100644
--- a/src/devices/grohtml/post-html.cpp
+++ b/src/devices/grohtml/post-html.cpp
@@ -2768,7 +2768,7 @@ void html_printer::write_html_anchor (text_glob *h)
buffer += '\0';
html.put_string(buffer.contents());
} else
- html.put_string(header.header_buffer);
+ html.put_string(header.header_buffer.contents());
html.put_string("\"></a>").nl();
}
}
@@ -2791,7 +2791,7 @@ void html_printer::write_xhtml_anchor (text_glob *h)
buffer += '\0';
html.put_string(buffer.contents());
} else
- html.put_string(header.header_buffer);
+ html.put_string(header.header_buffer.contents());
html.put_string("\"");
}
}
@@ -2819,7 +2819,7 @@ void html_printer::write_header (void)
a = new text_glob();
a->text_glob_html(&st,
header.headings
- .add_string(header.header_buffer),
+ .add_string(header.header_buffer.contents()),
header.header_buffer.length(),
header.no_of_headings, header.header_level,
header.no_of_headings, header.header_level);
@@ -2841,14 +2841,14 @@ void html_printer::write_header (void)
// <Hn></Hn>
if (header.header_level<4) {
html.put_string("<b><font size=\"+1\">");
- html.put_string(header.header_buffer);
+ html.put_string(header.header_buffer.contents());
html.put_string("</font>").nl();
write_html_anchor(a);
html.put_string("</b>").nl();
}
else {
html.put_string("<b>");
- html.put_string(header.header_buffer).nl();
+ html.put_string(header.header_buffer.contents()).nl();
write_html_anchor(a);
html.put_string("</b>").nl();
}
@@ -2859,7 +2859,7 @@ void html_printer::write_header (void)
html.put_number(header.header_level);
write_xhtml_anchor(a);
html.put_string(">");
- html.put_string(header.header_buffer).nl();
+ html.put_string(header.header_buffer.contents()).nl();
write_html_anchor(a);
html.put_string("</h");
html.put_number(header.header_level);
@@ -2957,7 +2957,7 @@ void html_printer::do_heading (char *arg)
header.header_buffer += " ";
horiz = g->maxh;
- header.header_buffer += string(g->text_string, g->text_length);
+ header.header_buffer += g->text_string;
}
page_contents->glyphs.move_right();
g = page_contents->glyphs.get_data();
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit