pass c strings to fmt (found some more)
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
d438e2292f
commit
c16265683f
19
src/main.cpp
19
src/main.cpp
@ -126,7 +126,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
LOG(log::sev::error)
|
||||
<< format(translate("Could not open {0:s}: {1:s}").str(),
|
||||
<< format(translate("Could not open {0:s}: {1:s}")
|
||||
.str()
|
||||
.c_str(),
|
||||
e.path1(), e.what());
|
||||
return_code = EXIT_FAILURE;
|
||||
}
|
||||
@ -176,8 +178,10 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
LOG(log::sev::error)
|
||||
<< std::strerror(errno) // FIXME: Not thread safe.
|
||||
<< format(translate(" (while opening {0:s})").str(),
|
||||
filepath);
|
||||
<< format(translate(" (while opening {0:s})")
|
||||
.str()
|
||||
.c_str(),
|
||||
filepath.c_str());
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
catch (const boost::regex_error &e)
|
||||
@ -233,10 +237,11 @@ int main(int argc, char *argv[])
|
||||
while (cancel.wait_for(std::chrono::seconds(opts.status_interval))
|
||||
!= std::future_status::ready)
|
||||
{
|
||||
std::cerr
|
||||
<< format(translate("{0:d} of {1:d} books searched.").str(),
|
||||
books_searched, input_files.size())
|
||||
<< '\n';
|
||||
std::cerr << format(translate("{0:d} of {1:d} books searched.")
|
||||
.str()
|
||||
.c_str(),
|
||||
books_searched, input_files.size())
|
||||
<< '\n';
|
||||
}
|
||||
std::cerr << translate("All books searched.") << '\n';
|
||||
}};
|
||||
|
@ -169,17 +169,18 @@ void html_all(const std::vector<std::vector<search::match>> &matches_all,
|
||||
if (!opts.no_fn_epub)
|
||||
{
|
||||
cout << format(R"( <th id="file_path_{0:d}">{1:s}</th>)",
|
||||
count, translate("File path (in EPUB file)"))
|
||||
count,
|
||||
translate("File path (in EPUB file)").str().c_str())
|
||||
<< '\n';
|
||||
}
|
||||
cout << format(R"( <th id="headline_{0:d}">{1:s}</th>)", count,
|
||||
translate("Last headline"))
|
||||
translate("Last headline").str().c_str())
|
||||
<< '\n'
|
||||
<< format(R"( <th id="page_{0:d}">{1:s}</th>)", count,
|
||||
translate("Page number"))
|
||||
translate("Page number").str().c_str())
|
||||
<< '\n'
|
||||
<< format(R"( <th id="match_{0:d}">{1:s}</th>)", count,
|
||||
translate("Match"))
|
||||
translate("Match").str().c_str())
|
||||
<< "\n </tr>\n";
|
||||
|
||||
for (const auto &match : matches)
|
||||
|
17
src/zip.cpp
17
src/zip.cpp
@ -84,7 +84,7 @@ std::string read_file(const fs::path &filepath, std::string_view entry_path)
|
||||
"Skipping in-EPUB file.\n")
|
||||
.str()
|
||||
.data(),
|
||||
filepath);
|
||||
filepath.c_str());
|
||||
continue;
|
||||
}
|
||||
if (std::strcmp(path, entry_path.data()) == 0)
|
||||
@ -99,9 +99,9 @@ std::string read_file(const fs::path &filepath, std::string_view entry_path)
|
||||
{
|
||||
close_file(zipfile, filepath);
|
||||
|
||||
throw exception{
|
||||
format(translate("Could not read {0:s} in {1:s}.").str(),
|
||||
entry_path, filepath.string())};
|
||||
throw exception{format(
|
||||
translate("Could not read {0:s} in {1:s}.").str().c_str(),
|
||||
entry_path, filepath.string())};
|
||||
}
|
||||
|
||||
close_file(zipfile, filepath);
|
||||
@ -115,7 +115,7 @@ std::string read_file(const fs::path &filepath, std::string_view entry_path)
|
||||
|
||||
if (entry_path == "META-INF/container.xml")
|
||||
{ // File is probably not an EPUB.
|
||||
exception e{format(translate("{0:s} not found in {1:s}.").str(),
|
||||
exception e{format(translate("{0:s} not found in {1:s}.").str().c_str(),
|
||||
entry_path, filepath.string())};
|
||||
e.code = 1;
|
||||
throw exception{e};
|
||||
@ -145,7 +145,7 @@ struct archive *open_file(const fs::path &filepath)
|
||||
{
|
||||
close_file(zipfile, filepath);
|
||||
|
||||
exception e{format(translate("Could not open {0:s}.").str(),
|
||||
exception e{format(translate("Could not open {0:s}.").str().c_str(),
|
||||
filepath.string())};
|
||||
e.code = 1;
|
||||
throw exception{e};
|
||||
@ -159,8 +159,9 @@ void close_file(struct archive *zipfile, const fs::path &filepath)
|
||||
auto result{archive_read_free(zipfile)};
|
||||
if (result != ARCHIVE_OK)
|
||||
{
|
||||
throw exception{format(translate("Could not close {0:s}.").str(),
|
||||
filepath.string())};
|
||||
throw exception{
|
||||
format(translate("Could not close {0:s}.").str().c_str(),
|
||||
filepath.string())};
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user