From 3f071a2aac38e7e1637acdd145d317235d91302e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christof=20Kr=C3=BCger?= Date: Mon, 27 Jan 2020 22:52:43 +0100 Subject: [PATCH] Fix warnings (VS2017 x64). (#133) * Fix warnings (VS2017 x64). * Update single_include/inja.hpp. --- include/inja/parser.hpp | 6 +++--- include/inja/renderer.hpp | 2 +- include/inja/utils.hpp | 2 +- single_include/inja/inja.hpp | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/inja/parser.hpp b/include/inja/parser.hpp index bbddd30..4de9879 100644 --- a/include/inja/parser.hpp +++ b/include/inja/parser.hpp @@ -297,7 +297,7 @@ class Parser { } // update all previous unconditional jumps to here - for (unsigned int i: if_data.uncond_jumps) { + for (size_t i: if_data.uncond_jumps) { tmpl.bytecodes[i].args = tmpl.bytecodes.size(); } @@ -530,7 +530,7 @@ class Parser { const ParserStatic& m_static; struct IfData { - using jump_t = unsigned int; + using jump_t = size_t; jump_t prev_cond_jump; std::vector uncond_jumps; @@ -541,7 +541,7 @@ class Parser { }; std::vector m_if_stack; - std::vector m_loop_stack; + std::vector m_loop_stack; void get_next_token() { if (m_have_peek_tok) { diff --git a/include/inja/renderer.hpp b/include/inja/renderer.hpp index 5b8747d..de1830d 100644 --- a/include/inja/renderer.hpp +++ b/include/inja/renderer.hpp @@ -224,7 +224,7 @@ class Renderer { case Bytecode::Op::Length: { const json& val = *get_args(bc)[0]; - int result; + size_t result; if (val.is_string()) { result = val.get_ref().length(); } else { diff --git a/include/inja/utils.hpp b/include/inja/utils.hpp index d1ac141..7a3b2a8 100644 --- a/include/inja/utils.hpp +++ b/include/inja/utils.hpp @@ -23,7 +23,7 @@ inline std::ifstream open_file_or_throw(const std::string& path) { file.exceptions(std::ifstream::failbit | std::ifstream::badbit); try { file.open(path); - } catch(const std::ios_base::failure& e) { + } catch(const std::ios_base::failure& /*e*/) { inja_throw("file_error", "failed accessing file at '" + path + "'"); } return file; diff --git a/single_include/inja/inja.hpp b/single_include/inja/inja.hpp index 6cd3bf5..0da6be5 100644 --- a/single_include/inja/inja.hpp +++ b/single_include/inja/inja.hpp @@ -1945,7 +1945,7 @@ inline std::ifstream open_file_or_throw(const std::string& path) { file.exceptions(std::ifstream::failbit | std::ifstream::badbit); try { file.open(path); - } catch(const std::ios_base::failure& e) { + } catch(const std::ios_base::failure& /*e*/) { inja_throw("file_error", "failed accessing file at '" + path + "'"); } return file; @@ -2589,7 +2589,7 @@ class Parser { } // update all previous unconditional jumps to here - for (unsigned int i: if_data.uncond_jumps) { + for (size_t i: if_data.uncond_jumps) { tmpl.bytecodes[i].args = tmpl.bytecodes.size(); } @@ -2822,7 +2822,7 @@ class Parser { const ParserStatic& m_static; struct IfData { - using jump_t = unsigned int; + using jump_t = size_t; jump_t prev_cond_jump; std::vector uncond_jumps; @@ -2833,7 +2833,7 @@ class Parser { }; std::vector m_if_stack; - std::vector m_loop_stack; + std::vector m_loop_stack; void get_next_token() { if (m_have_peek_tok) { @@ -3142,7 +3142,7 @@ class Renderer { case Bytecode::Op::Length: { const json& val = *get_args(bc)[0]; - int result; + size_t result; if (val.is_string()) { result = val.get_ref().length(); } else {