Fixing liblangutil conversion warnings

This commit is contained in:
Djordje Mijovic 2020-06-05 14:30:57 +02:00
parent 18a196c21d
commit 731b2efc97
2 changed files with 3 additions and 3 deletions

View File

@ -107,7 +107,7 @@ tuple<int, int> CharStream::translatePositionToLineColumn(int _position) const
using size_type = string::size_type; using size_type = string::size_type;
using diff_type = string::difference_type; using diff_type = string::difference_type;
size_type searchPosition = min<size_type>(m_source.size(), size_type(_position)); size_type searchPosition = min<size_type>(m_source.size(), size_type(_position));
int lineNumber = count(m_source.begin(), m_source.begin() + diff_type(searchPosition), '\n'); int lineNumber = static_cast<int>(count(m_source.begin(), m_source.begin() + diff_type(searchPosition), '\n'));
size_type lineStart; size_type lineStart;
if (searchPosition == 0) if (searchPosition == 0)
lineStart = 0; lineStart = 0;

View File

@ -179,7 +179,7 @@ bool Scanner::scanHexByte(char& o_scannedByte)
rollback(i); rollback(i);
return false; return false;
} }
x = x * 16 + d; x = static_cast<char>(x * 16 + d);
advance(); advance();
} }
o_scannedByte = x; o_scannedByte = x;
@ -197,7 +197,7 @@ std::optional<unsigned> Scanner::scanUnicode()
rollback(i); rollback(i);
return {}; return {};
} }
x = x * 16 + static_cast<size_t>(d); x = x * 16 + static_cast<unsigned>(d);
advance(); advance();
} }
return x; return x;