diff --git a/src/main.cpp b/src/main.cpp index 20a8233..81d2524 100644 --- a/src/main.cpp +++ b/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'; }}; diff --git a/src/output.cpp b/src/output.cpp index dadb3f6..fd6e4f9 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -169,17 +169,18 @@ void html_all(const std::vector> &matches_all, if (!opts.no_fn_epub) { cout << format(R"( {1:s})", - count, translate("File path (in EPUB file)")) + count, + translate("File path (in EPUB file)").str().c_str()) << '\n'; } cout << format(R"( {1:s})", count, - translate("Last headline")) + translate("Last headline").str().c_str()) << '\n' << format(R"( {1:s})", count, - translate("Page number")) + translate("Page number").str().c_str()) << '\n' << format(R"( {1:s})", count, - translate("Match")) + translate("Match").str().c_str()) << "\n \n"; for (const auto &match : matches) diff --git a/src/zip.cpp b/src/zip.cpp index bb9e778..e52e556 100644 --- a/src/zip.cpp +++ b/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())}; } }