Fix compiler warnings (#1081)
* Fix narrowing conversion warning. The `static_cast` does not change the behavior of the programm only explictly stating that the behavior is intended. This change is needed as some compiler settings will treat this warning as an error. * Do not redeclare `result` variable in insertFormattedString as it shadows variable in outer scope. This fixes a compiler warning for shadowing variables declared in an outer scope. This change does not change the behaviour of the programm as the shadowd variable is not reused after the inner scope ends. Also the new version should represent the intention of the code better. This change is needed as some compiler settings will treat this warning as an error.
This commit is contained in:
parent
e4ec2c36c5
commit
953000e3fb
|
@ -107,10 +107,10 @@ class DROGON_EXPORT HttpViewData
|
|||
}
|
||||
|
||||
va_copy(backup_ap, ap);
|
||||
auto result = vsnprintf((char *)strBuffer.data(),
|
||||
strBuffer.size(),
|
||||
format,
|
||||
backup_ap);
|
||||
result = vsnprintf((char *)strBuffer.data(),
|
||||
strBuffer.size(),
|
||||
format,
|
||||
backup_ap);
|
||||
va_end(backup_ap);
|
||||
|
||||
if ((result >= 0) &&
|
||||
|
|
|
@ -395,7 +395,9 @@ inline bool fromString<bool>(const std::string &p) noexcept(false)
|
|||
return false;
|
||||
}
|
||||
std::string l{p};
|
||||
std::transform(p.begin(), p.end(), l.begin(), tolower);
|
||||
std::transform(p.begin(), p.end(), l.begin(), [](unsigned char ch) {
|
||||
return static_cast<unsigned char>(tolower(ch));
|
||||
});
|
||||
if (l == "true")
|
||||
{
|
||||
return true;
|
||||
|
|
|
@ -225,7 +225,7 @@ inline int8_t Field::as<int8_t>() const
|
|||
{
|
||||
if (isNull())
|
||||
return 0;
|
||||
return atoi(result_.getValue(row_, column_));
|
||||
return static_cast<int8_t>(atoi(result_.getValue(row_, column_)));
|
||||
}
|
||||
|
||||
template <>
|
||||
|
|
Loading…
Reference in New Issue