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: Ie911ad2eb8b84374d57cff07c775ff4c5cbf000f
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>
GitOrigin-RevId: 8804387c75b5ea6b2ac7ef978104972996c721d1
1 file changed
tree: b0a2667f1b3739f405305c52a0957c988bc25486
  1. build/
  2. client/
  3. compat/
  4. doc/
  5. handler/
  6. infra/
  7. minidump/
  8. snapshot/
  9. test/
  10. third_party/
  11. tools/
  12. util/
  13. .clang-format
  14. .gitattributes
  15. .gitignore
  16. .gn
  17. .style.yapf
  18. .vpython
  19. AUTHORS
  20. BUILD.gn
  21. codereview.settings
  22. CONTRIBUTORS
  23. crashpad.gyp
  24. DEPS
  25. LICENSE
  26. navbar.md
  27. package.h
  28. README.md
README.md

Crashpad

Crashpad is a crash-reporting system.

Documentation

Source Code

Crashpad’s source code is hosted in a Git repository at https://chromium.googlesource.com/crashpad/crashpad.

Other Links