mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 14:06:33 +00:00
Fix -Wc++11-narrowing in crashpad.
timeval's first member's type is __kernel_old_time_t on at least Windows; this is a 32-bit type as opposed to time_t, which is a 64-bit type. As a result, casting directly to time_t results in a truncation, triggering the warning. It's not possible to cast directly to __kernel_old_time_t, since that type is not exposed here. Instead, cast to the underlying type, long, which should work correctly on all platforms. This has Year 2038 problems (which is why time_t is switching to 64-bit), which I suspect would be best fixed by a larger change like moving away from using timeval anywhere (?). I'm not really certain what all would be involved in trying to make this whole pipeline Y2038-safe, so I haven't attempted to tackle this. Bug: chromium:1216696 Change-Id: Ia335a488175b1d8e851c94b56705530bb4e421af Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2949650 Commit-Queue: Peter Kasting <pkasting@chromium.org> Commit-Queue: Mark Mentovai <mark@chromium.org> Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
21313fad9a
commit
8804387c75
@ -774,12 +774,12 @@ TEST(MinidumpMiscInfoWriter, InitializeFromSnapshot) {
|
||||
debug_build_string_utf16.c_str(),
|
||||
base::size(expect_misc_info.DbgBldStr));
|
||||
|
||||
const timeval kStartTime =
|
||||
{ static_cast<time_t>(expect_misc_info.ProcessCreateTime), 0 };
|
||||
const timeval kUserCPUTime =
|
||||
{ static_cast<time_t>(expect_misc_info.ProcessUserTime), 0 };
|
||||
const timeval kSystemCPUTime =
|
||||
{ static_cast<time_t>(expect_misc_info.ProcessKernelTime), 0 };
|
||||
const timeval kStartTime = {
|
||||
static_cast<long>(expect_misc_info.ProcessCreateTime), 0};
|
||||
const timeval kUserCPUTime = {
|
||||
static_cast<long>(expect_misc_info.ProcessUserTime), 0};
|
||||
const timeval kSystemCPUTime = {
|
||||
static_cast<long>(expect_misc_info.ProcessKernelTime), 0};
|
||||
|
||||
TestProcessSnapshot process_snapshot;
|
||||
process_snapshot.SetProcessID(expect_misc_info.ProcessId);
|
||||
|
Loading…
x
Reference in New Issue
Block a user