mirror of
https://github.com/zeux/pugixml.git
synced 2025-01-14 09:57:57 +08:00
Merge pull request #310 from amlucas/master
explicit casts for -Wconversions warnings in gcc
This commit is contained in:
commit
51d177e938
@ -9756,7 +9756,7 @@ PUGI__NS_BEGIN
|
||||
{
|
||||
xpath_context c(*it, i, size);
|
||||
|
||||
if (expr->eval_number(c, stack) == i)
|
||||
if (expr->eval_number(c, stack) == static_cast<double>(i))
|
||||
{
|
||||
*last++ = *it;
|
||||
|
||||
@ -9780,11 +9780,11 @@ PUGI__NS_BEGIN
|
||||
|
||||
double er = expr->eval_number(c, stack);
|
||||
|
||||
if (er >= 1.0 && er <= size)
|
||||
if (er >= 1.0 && er <= static_cast<double>(size))
|
||||
{
|
||||
size_t eri = static_cast<size_t>(er);
|
||||
|
||||
if (er == eri)
|
||||
if (er == static_cast<double>(eri))
|
||||
{
|
||||
xpath_node r = last[eri - 1];
|
||||
|
||||
@ -10742,7 +10742,7 @@ PUGI__NS_BEGIN
|
||||
double first = round_nearest(_right->eval_number(c, stack));
|
||||
|
||||
if (is_nan(first)) return xpath_string(); // NaN
|
||||
else if (first >= s_length + 1) return xpath_string();
|
||||
else if (first >= static_cast<double>(s_length + 1)) return xpath_string();
|
||||
|
||||
size_t pos = first < 1 ? 1 : static_cast<size_t>(first);
|
||||
assert(1 <= pos && pos <= s_length + 1);
|
||||
@ -10766,12 +10766,12 @@ PUGI__NS_BEGIN
|
||||
double last = first + round_nearest(_right->_next->eval_number(c, stack));
|
||||
|
||||
if (is_nan(first) || is_nan(last)) return xpath_string();
|
||||
else if (first >= s_length + 1) return xpath_string();
|
||||
else if (first >= static_cast<double>(s_length + 1)) return xpath_string();
|
||||
else if (first >= last) return xpath_string();
|
||||
else if (last < 1) return xpath_string();
|
||||
|
||||
size_t pos = first < 1 ? 1 : static_cast<size_t>(first);
|
||||
size_t end = last >= s_length + 1 ? s_length + 1 : static_cast<size_t>(last);
|
||||
size_t end = last >= static_cast<double>(s_length + 1) ? s_length + 1 : static_cast<size_t>(last);
|
||||
|
||||
assert(1 <= pos && pos <= end && end <= s_length + 1);
|
||||
const char_t* rbegin = s.c_str() + (pos - 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user