Bug 1577236 - clang-10: Fix -Wimplicit-int-float-conversion warnings in various dirs r=glandium
authorSylvestre Ledru <sledru@mozilla.com>
Fri, 30 Aug 2019 09:11:19 +0000
changeset 554594 6eb3bfbbad0888b343bce4ea3f696c7b979c3f45
parent 554593 c9a04ff4a68a1848cce52923b2c9244f438ab541
child 554595 127fb176c0238abd4df5e721e843e5ad4bf7e7ff
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1577236
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1577236 - clang-10: Fix -Wimplicit-int-float-conversion warnings in various dirs r=glandium Depends on D43784 Differential Revision: https://phabricator.services.mozilla.com/D43785
mozglue/misc/TimeStamp_posix.cpp
xpcom/tests/gtest/TestThreadPool.cpp
--- a/mozglue/misc/TimeStamp_posix.cpp
+++ b/mozglue/misc/TimeStamp_posix.cpp
@@ -136,17 +136,17 @@ double BaseTimeDurationPlatformUtils::To
   // and chop off insignificant digits
   valueSigDigs = sResolutionSigDigs * (valueSigDigs / sResolutionSigDigs);
   return double(valueSigDigs) / kNsPerSecd;
 }
 
 int64_t BaseTimeDurationPlatformUtils::TicksFromMilliseconds(
     double aMilliseconds) {
   double result = aMilliseconds * kNsPerMsd;
-  if (result > INT64_MAX) {
+  if (result > double(INT64_MAX)) {
     return INT64_MAX;
   }
   if (result < INT64_MIN) {
     return INT64_MIN;
   }
 
   return result;
 }
--- a/xpcom/tests/gtest/TestThreadPool.cpp
+++ b/xpcom/tests/gtest/TestThreadPool.cpp
@@ -23,17 +23,17 @@ class Task final : public nsIRunnable {
  public:
   NS_DECL_THREADSAFE_ISUPPORTS
 
   Task(int i, Atomic<int>& aCounter) : mIndex(i), mCounter(aCounter) {}
 
   NS_IMETHOD Run() override {
     printf("###(%d) running from thread: %p\n", mIndex,
            (void*)PR_GetCurrentThread());
-    int r = (int)((float)rand() * 200 / RAND_MAX);
+    int r = (int)((float)rand() * 200 / float(RAND_MAX));
     PR_Sleep(PR_MillisecondsToInterval(r));
     printf("###(%d) exiting from thread: %p\n", mIndex,
            (void*)PR_GetCurrentThread());
     ++mCounter;
     return NS_OK;
   }
 
  private: