gbranden pushed a commit to branch master in repository groff. commit 1c8c8f4fc76922cb87de735bc102064b12c8a039 Author: G. Branden Robinson <g.branden.robin...@gmail.com> AuthorDate: Wed Jul 30 19:32:40 2025 -0500
[pre-grohtml]: Fix off-by-1 errors in line counts. * src/preproc/html/pre-html.cpp (get_resolution, get_image_generator): Fix off-by-one errors in line counting. --- ChangeLog | 5 +++++ src/preproc/html/pre-html.cpp | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index e29776453..c08b9ae82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2025-07-30 G. Branden Robinson <g.branden.robin...@gmail.com> + + * src/preproc/html/pre-html.cpp (get_resolution) + (get_image_generator): Fix off-by-one errors in line counting. + 2025-07-30 G. Branden Robinson <g.branden.robin...@gmail.com> * doc/groff.texi.in (Debugging): Expand `ab`, `fl` discussion. diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp index f3d6e4780..04233842c 100644 --- a/src/preproc/html/pre-html.cpp +++ b/src/preproc/html/pre-html.cpp @@ -334,7 +334,7 @@ static unsigned int get_resolution(void) // XXX: We should break out of this loop if we hit a "charset" line. // "This line and everything following it in the file are ignored." // (groff_font(5)) - int lineno = 1; + int lineno = 0; while (get_line(f, pathp, lineno++)) (void) sscanf(linebuf, "res %u", &res); free(pathp); @@ -352,7 +352,7 @@ static char *get_image_generator(void) { char *pathp; FILE *f; - char *generator = 0; + char *generator = 0 /* nullptr */; const char keyword[] = "image_generator"; const size_t keyword_len = strlen(keyword); f = font_path.open_file(devhtml_desc, &pathp); @@ -361,7 +361,7 @@ static char *get_image_generator(void) // XXX: We should break out of this loop if we hit a "charset" line. // "This line and everything following it in the file are ignored." // (groff_font(5)) - int lineno = 1; + int lineno = 0; while (get_line(f, pathp, lineno++)) { char *cursor = linebuf; size_t limit = strlen(linebuf); _______________________________________________ groff-commit mailing list groff-commit@gnu.org https://lists.gnu.org/mailman/listinfo/groff-commit