Fix MinidumpMiscInfoWriter test compilation with 32-bit time_t.

This produced errors such as:
minidump_misc_info_writer_test.cc:665:32: error: non-constant-expression
cannot be narrowed from type 'uint32_t' (aka 'unsigned int') to
'__darwin_time_t' (aka 'long') in initializer list [-Wc++11-narrowing]
  const timeval kStartTime = { expect_misc_info.ProcessCreateTime, 0 };
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
minidump_misc_info_writer_test.cc:665:32: note: override this message by
inserting an explicit cast
  const timeval kStartTime = { expect_misc_info.ProcessCreateTime, 0 };
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                               static_cast<__darwin_time_t>(     )

TEST=minidump_test MinidumpMiscInfoWriter.InitializeFromSnapshot
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/711603002
This commit is contained in:
Mark Mentovai 2014-11-07 10:02:21 -05:00
parent 1d440d36d6
commit 408262d58f

View File

@ -662,9 +662,12 @@ TEST(MinidumpMiscInfoWriter, InitializeFromSnapshot) {
debug_build_string_utf16.c_str(), debug_build_string_utf16.c_str(),
arraysize(expect_misc_info.DbgBldStr)); arraysize(expect_misc_info.DbgBldStr));
const timeval kStartTime = { expect_misc_info.ProcessCreateTime, 0 }; const timeval kStartTime =
const timeval kUserCPUTime = { expect_misc_info.ProcessUserTime, 0 }; { implicit_cast<time_t>(expect_misc_info.ProcessCreateTime), 0 };
const timeval kSystemCPUTime = { expect_misc_info.ProcessKernelTime, 0 }; const timeval kUserCPUTime =
{ implicit_cast<time_t>(expect_misc_info.ProcessUserTime), 0 };
const timeval kSystemCPUTime =
{ implicit_cast<time_t>(expect_misc_info.ProcessKernelTime), 0 };
TestProcessSnapshot process_snapshot; TestProcessSnapshot process_snapshot;
process_snapshot.SetProcessID(expect_misc_info.ProcessId); process_snapshot.SetProcessID(expect_misc_info.ProcessId);