Reduce some false-positive warnings from GCC to warnings with -Werror

This also works around some of the same warnings. These are known bugs
in GCC 11+ and GCC 13.x.
This commit is contained in:
Tim Wojtulewicz 2025-06-05 15:36:38 -07:00
parent cd356ce45d
commit 57a3c733d1
6 changed files with 30 additions and 22 deletions

View file

@ -121,15 +121,15 @@ bool Ascii::OpenFile() {
fname = Info().source;
if ( fname.front() != '/' && ! path_prefix.empty() ) {
string path = path_prefix;
std::size_t last = path.find_last_not_of('/');
std::size_t last = path_prefix.find_last_not_of('/');
string path;
if ( last == string::npos ) // Nothing but slashes -- weird but ok...
path = "/";
else
path.erase(last + 1);
path = path_prefix.substr(0, last + 1);
fname = path + "/" + fname;
fname = util::fmt("%s/%s", path.c_str(), fname.c_str());
}
file.open(fname);