Bug 1404147 Cast constants to the type they are compared to r?smaug draft
authorTom Ritter <tom@mozilla.com>
Thu, 28 Sep 2017 17:47:43 -0500
changeset 674379 0d3087b7b28ac0dd92d6b4b6da46fd4a43345a4d
parent 674378 e28f27008ea914312b21f79ae5d4f3d55efd6f66
child 674380 a57367f1e2b2326ae0cb9288377c9aeffefb3421
push id82814
push userbmo:tom@mozilla.com
push dateTue, 03 Oct 2017 17:51:18 +0000
reviewerssmaug
bugs1404147
milestone58.0a1
Bug 1404147 Cast constants to the type they are compared to r?smaug MozReview-Commit-ID: JQDZTBOALZm
js/xpconnect/src/XPCWrappedNative.cpp
netwerk/dns/GetAddrInfo.cpp
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -851,18 +851,18 @@ XPCWrappedNative::FlatJSObjectFinalized(
         cache->ClearWrapper(mFlatJSObject.unbarrieredGetPtr());
 
     mFlatJSObject = nullptr;
     mFlatJSObject.unsetFlags(FLAT_JS_OBJECT_VALID);
 
     MOZ_ASSERT(mIdentity, "bad pointer!");
 #ifdef XP_WIN
     // Try to detect free'd pointer
-    MOZ_ASSERT(*(int*)mIdentity.get() != 0xdddddddd, "bad pointer!");
-    MOZ_ASSERT(*(int*)mIdentity.get() != 0,          "bad pointer!");
+    MOZ_ASSERT(*(int*)mIdentity.get() != (int)0xdddddddd, "bad pointer!");
+    MOZ_ASSERT(*(int*)mIdentity.get() != (int)0,          "bad pointer!");
 #endif
 
     if (IsWrapperExpired()) {
         Destroy();
     }
 
     // Note that it's not safe to touch mNativeWrapper here since it's
     // likely that it has already been finalized.
--- a/netwerk/dns/GetAddrInfo.cpp
+++ b/netwerk/dns/GetAddrInfo.cpp
@@ -215,31 +215,31 @@ static MOZ_ALWAYS_INLINE nsresult
   if (!dnsapi) {
     LOG_WARNING("GetAddrInfo has been shutdown or has not been initialized.");
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   // In order to avoid using ANY records which are not always implemented as a
   // "Gimme what you have" request in hostname resolvers, we should send A
   // and/or AAAA requests, based on the address family requested.
-  unsigned int ttl = -1;
+  unsigned int ttl = (unsigned int)-1;
   if (aAddressFamily == PR_AF_UNSPEC || aAddressFamily == PR_AF_INET) {
     _GetMinTTLForRequestType_Windows(dnsapi, aHost, DNS_TYPE_A, &ttl);
   }
   if (aAddressFamily == PR_AF_UNSPEC || aAddressFamily == PR_AF_INET6) {
     _GetMinTTLForRequestType_Windows(dnsapi, aHost, DNS_TYPE_AAAA, &ttl);
   }
 
   {
     // dnsapi's destructor is not thread-safe, so we release explicitly here
     OffTheBooksMutexAutoLock lock(*gDnsapiInfoLock);
     dnsapi = nullptr;
   }
 
-  if (ttl == -1) {
+  if (ttl == (unsigned int)-1) {
     LOG("No useable TTL found.");
     return NS_ERROR_FAILURE;
   }
 
   *aResult = ttl;
   return NS_OK;
 }
 #endif