diff --git a/include/inja/parser.hpp b/include/inja/parser.hpp index c4f2a8a..26697b5 100644 --- a/include/inja/parser.hpp +++ b/include/inja/parser.hpp @@ -97,7 +97,7 @@ class Parser { if (config.search_included_templates_in_files) { // Build the relative path - template_name = path / original_name; + template_name = (path / original_name).string(); if (template_name.compare(0, 2, "./") == 0) { template_name.erase(0, 2); } diff --git a/include/inja/renderer.hpp b/include/inja/renderer.hpp index d3112ee..0f2de46 100644 --- a/include/inja/renderer.hpp +++ b/include/inja/renderer.hpp @@ -65,7 +65,7 @@ class Renderer : public NodeVisitor { static std::string htmlescape(const std::string& data) { std::string buffer; - buffer.reserve(1.1 * data.size()); + buffer.reserve((unsigned int)(1.1 * data.size())); for (size_t pos = 0; pos != data.size(); ++pos) { switch (data[pos]) { case '&': buffer.append("&"); break; diff --git a/single_include/inja/inja.hpp b/single_include/inja/inja.hpp index db1dee7..60e1351 100644 --- a/single_include/inja/inja.hpp +++ b/single_include/inja/inja.hpp @@ -1542,7 +1542,7 @@ class Parser { if (config.search_included_templates_in_files) { // Build the relative path - template_name = path / original_name; + template_name = (path / original_name).string(); if (template_name.compare(0, 2, "./") == 0) { template_name.erase(0, 2); } @@ -2172,7 +2172,7 @@ class Renderer : public NodeVisitor { static std::string htmlescape(const std::string& data) { std::string buffer; - buffer.reserve(1.1 * data.size()); + buffer.reserve((unsigned int)(1.1 * data.size())); for (size_t pos = 0; pos != data.size(); ++pos) { switch (data[pos]) { case '&': buffer.append("&"); break; diff --git a/test/test-renderer.cpp b/test/test-renderer.cpp index 36fadb4..d73e4cb 100644 --- a/test/test-renderer.cpp +++ b/test/test-renderer.cpp @@ -191,13 +191,13 @@ TEST_CASE("templates") { CHECK_THROWS_WITH(env.parse("{% include \"does-not-exist\" %}!"), "[inja.exception.file_error] failed accessing file at 'does-not-exist'"); env.set_search_included_templates_in_files(false); - env.set_include_callback([&env](const std::string&, const std::string&) { return env.parse("Hello {{ name }}"); }); + env.set_include_callback([&env](const std::filesystem::path&, const std::string&) { return env.parse("Hello {{ name }}"); }); const inja::Template t1 = env.parse("{% include \"greeting\" %}!"); CHECK(env.render(t1, data) == "Hello Peter!"); env.set_search_included_templates_in_files(true); - env.set_include_callback([&env](const std::string&, const std::string& name) { return env.parse("Bye " + name); }); + env.set_include_callback([&env](const std::filesystem::path&, const std::string& name) { return env.parse("Bye " + name); }); const inja::Template t2 = env.parse("{% include \"Jeff\" %}!"); CHECK(env.render(t2, data) == "Bye Jeff!");