Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1616)

Unified Diff: runtime/platform/thread_macos.cc

Issue 415513002: - Fix a lot of warnings generated by -Wshorten-64-to-32 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/run_vm_tests.cc ('k') | runtime/platform/utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/platform/thread_macos.cc
===================================================================
--- runtime/platform/thread_macos.cc (revision 38492)
+++ runtime/platform/thread_macos.cc (working copy)
@@ -297,10 +297,14 @@
} else {
struct timespec ts;
int64_t secs = micros / kMicrosecondsPerSecond;
+ if (secs > kMaxInt32) {
+ // Avoid truncation of overly large timeout values.
+ secs = kMaxInt32;
+ }
int64_t nanos =
(micros - (secs * kMicrosecondsPerSecond)) * kNanosecondsPerMicrosecond;
- ts.tv_sec = secs;
- ts.tv_nsec = nanos;
+ ts.tv_sec = static_cast<int32_t>(secs);
+ ts.tv_nsec = static_cast<long>(nanos); // NOLINT (long used in timespec).
int result = pthread_cond_timedwait_relative_np(data_.cond(),
data_.mutex(),
&ts);
« no previous file with comments | « runtime/bin/run_vm_tests.cc ('k') | runtime/platform/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698