Skip to content

Commit 3161aae

Browse files
committed
Remove some compiler warnings
1 parent 3b5f66b commit 3161aae

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

include/jinja2cpp/value.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class ReflectedList
6262
{
6363
}
6464

65-
bool GetSize() const
65+
size_t GetSize() const
6666
{
6767
return m_accessor()->GetSize();
6868
}

src/statements.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ void ForStatement::Render(OutStream& os, RenderContext& values)
3232
loopVar["first"] = Value(itemIdx == 0);
3333
loopVar["last"] = Value(itemIdx == itemsNum - 1);
3434
if (itemIdx != 0)
35-
loopVar["previtem"] = (*loopItems)[itemIdx - 1];
35+
loopVar["previtem"] = (*loopItems)[static_cast<size_t>(itemIdx - 1)];
3636
if (itemIdx != itemsNum - 1)
37-
loopVar["nextitem"] = (*loopItems)[itemIdx + 1];
37+
loopVar["nextitem"] = (*loopItems)[static_cast<size_t>(itemIdx + 1)];
3838
else
3939
loopVar.erase("nextitem");
4040

41-
auto& curValue = (*loopItems)[itemIdx];
41+
auto& curValue = (*loopItems)[static_cast<size_t>(itemIdx)];
4242
if (m_vars.size() > 1 && curValue.isMap())
4343
{
4444
for (auto& varName : m_vars)

src/template_parser.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ class TemplateParser : public LexerHelper
274274
{
275275
auto& match = *curMatch;
276276
int matchType = RM_Unknown;
277-
for (int idx = 1; idx < match.size(); ++ idx)
277+
for (int idx = 1; idx != match.size(); ++ idx)
278278
{
279279
if (match.length(idx) != 0)
280280
{
@@ -492,7 +492,7 @@ class TemplateParser : public LexerHelper
492492
return Token::Unknown;
493493

494494
auto& match = *matchBegin;
495-
for (int idx = 1; idx < match.size(); ++ idx)
495+
for (size_t idx = 1; idx != match.size(); ++ idx)
496496
{
497497
if (match.length(idx) != 0)
498498
{

0 commit comments

Comments
 (0)