mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 14:06:33 +00:00
win: Avoid warnings about conversion to smaller integer types
e.g. d:\src\crashpad\crashpad\util\numeric\in_range_cast.h(35) : warning C4244: 'return' : conversion from 'unsigned __int64' to 'uint32_t', possible loss of data d:\src\crashpad\crashpad\util\numeric\in_range_cast.h(35) : warning C4244: 'return' : conversion from '__int64' to 'int32_t', possible loss of data d:\src\crashpad\crashpad\util\numeric\in_range_cast_test.cc(54) : see reference to function template instantiation 'Destination crashpad::InRangeCast<int32_t,__int64>(Source,Destination)' being compiled with [ Destination=int32_t , Source=__int64 ] R=mark@chromium.org BUG=crashpad:1 Review URL: https://codereview.chromium.org/800073003
This commit is contained in:
parent
e8ab9afd82
commit
1a17e7e643
@ -32,11 +32,11 @@ namespace crashpad {
|
||||
template <typename Destination, typename Source>
|
||||
Destination InRangeCast(Source source, Destination default_value) {
|
||||
if (base::IsValueInRangeForNumericType<Destination>(source)) {
|
||||
return source;
|
||||
return static_cast<Destination>(source);
|
||||
}
|
||||
|
||||
LOG(WARNING) << "value " << source << " out of range";
|
||||
return default_value;
|
||||
return static_cast<Destination>(default_value);
|
||||
}
|
||||
|
||||
} // namespace crashpad
|
||||
|
Loading…
x
Reference in New Issue
Block a user