Skip to content

Commit

Permalink
fix warnings with VS2019, W4, c++20 (#230)
Browse files Browse the repository at this point in the history
* fix warnings with VS2019, W4, c++20

* update single include

Co-authored-by: Berscheid <[email protected]>
Co-authored-by: pantor <[email protected]>
  • Loading branch information
3 people authored Jun 20, 2022
1 parent 72f9012 commit 17a59c0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions include/inja/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class Parser {
}
}

std::string parse_filename(const Token& tok) const {
std::string parse_filename() const {
if (tok.kind != Token::Kind::String) {
throw_parser_error("expected string, got '" + tok.describe() + "'");
}
Expand Down Expand Up @@ -512,7 +512,7 @@ class Parser {
} else if (tok.text == static_cast<decltype(tok.text)>("include")) {
get_next_token();

std::string template_name = parse_filename(tok);
std::string template_name = parse_filename();
add_to_template_storage(path, template_name);

current_block->nodes.emplace_back(std::make_shared<IncludeStatementNode>(template_name, tok.text.data() - tmpl.content.c_str()));
Expand All @@ -521,7 +521,7 @@ class Parser {
} else if (tok.text == static_cast<decltype(tok.text)>("extends")) {
get_next_token();

std::string template_name = parse_filename(tok);
std::string template_name = parse_filename();
add_to_template_storage(path, template_name);

current_block->nodes.emplace_back(std::make_shared<ExtendsStatementNode>(template_name, tok.text.data() - tmpl.content.c_str()));
Expand Down
4 changes: 2 additions & 2 deletions include/inja/renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ class Renderer : public NodeVisitor {
} break;
case Op::Lower: {
auto result = get_arguments<1>(node)[0]->get<json::string_t>();
std::transform(result.begin(), result.end(), result.begin(), ::tolower);
std::transform(result.begin(), result.end(), result.begin(), [](char c) { return static_cast<char>(::tolower(c)); });
make_result(std::move(result));
} break;
case Op::Max: {
Expand Down Expand Up @@ -391,7 +391,7 @@ class Renderer : public NodeVisitor {
} break;
case Op::Upper: {
auto result = get_arguments<1>(node)[0]->get<json::string_t>();
std::transform(result.begin(), result.end(), result.begin(), ::toupper);
std::transform(result.begin(), result.end(), result.begin(), [](char c) { return static_cast<char>(::toupper(c)); });
make_result(std::move(result));
} break;
case Op::IsBoolean: {
Expand Down
10 changes: 5 additions & 5 deletions single_include/inja/inja.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1536,7 +1536,7 @@ class Parser {
}
}

std::string parse_filename(const Token& tok) const {
std::string parse_filename() const {
if (tok.kind != Token::Kind::String) {
throw_parser_error("expected string, got '" + tok.describe() + "'");
}
Expand Down Expand Up @@ -1926,7 +1926,7 @@ class Parser {
} else if (tok.text == static_cast<decltype(tok.text)>("include")) {
get_next_token();

std::string template_name = parse_filename(tok);
std::string template_name = parse_filename();
add_to_template_storage(path, template_name);

current_block->nodes.emplace_back(std::make_shared<IncludeStatementNode>(template_name, tok.text.data() - tmpl.content.c_str()));
Expand All @@ -1935,7 +1935,7 @@ class Parser {
} else if (tok.text == static_cast<decltype(tok.text)>("extends")) {
get_next_token();

std::string template_name = parse_filename(tok);
std::string template_name = parse_filename();
add_to_template_storage(path, template_name);

current_block->nodes.emplace_back(std::make_shared<ExtendsStatementNode>(template_name, tok.text.data() - tmpl.content.c_str()));
Expand Down Expand Up @@ -2428,7 +2428,7 @@ class Renderer : public NodeVisitor {
} break;
case Op::Lower: {
auto result = get_arguments<1>(node)[0]->get<json::string_t>();
std::transform(result.begin(), result.end(), result.begin(), ::tolower);
std::transform(result.begin(), result.end(), result.begin(), [](char c) { return static_cast<char>(::tolower(c)); });
make_result(std::move(result));
} break;
case Op::Max: {
Expand Down Expand Up @@ -2467,7 +2467,7 @@ class Renderer : public NodeVisitor {
} break;
case Op::Upper: {
auto result = get_arguments<1>(node)[0]->get<json::string_t>();
std::transform(result.begin(), result.end(), result.begin(), ::toupper);
std::transform(result.begin(), result.end(), result.begin(), [](char c) { return static_cast<char>(::toupper(c)); });
make_result(std::move(result));
} break;
case Op::IsBoolean: {
Expand Down

0 comments on commit 17a59c0

Please sign in to comment.