Mercurial > octave
changeset 22557:345c1c3ad908 stable
doc: Correctly get last entry from DOCSTRINGS file (bug #49224).
* help.cc (raw_help_from_docstrings_file): If eof is hit, seek the file pointer
back to the end of the data in the file. Compute the length of the last
DOCSTRING entry as the difference between the end of the file and the start of
the last entry. Reset the eof flag manually so that the while loop will exit.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 29 Sep 2016 15:44:54 -0700 |
parents | 30ab6e3b56b7 |
children | 1751d490dc2f |
files | libinterp/corefcn/help.cc |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/help.cc Thu Sep 29 11:26:59 2016 -0400 +++ b/libinterp/corefcn/help.cc Thu Sep 29 15:44:54 2016 -0700 @@ -421,7 +421,16 @@ file.ignore (std::numeric_limits<std::streamsize>::max(), 0x1d); // Position of end of help text. - std::streamoff len = file.tellg () - beg - 1; + std::streamoff len; + + if (! file.eof ()) + len = file.tellg () - beg - 1; + else + { + file.seekg (0, file.end); + len = file.tellg () - beg - 1; + file.setstate (file.eofbit); // reset eof flag + } help_txt_map[name] = txt_limits_type (beg, len); }