Bug 1404147 Cast constants to the type they are compared to draft
authorTom Ritter <tom@mozilla.com>
Thu, 28 Sep 2017 17:47:43 -0500
changeset 672666 3aa268a6766cda0f93d80a5b9f879d719ffd1b74
parent 672229 4e25429e951fddd27d3a2cf6f47ae6f91a52046c
child 672667 a6c6ca4f7e585d798a2e43d81a1134462ad73de8
push id82327
push userbmo:tom@mozilla.com
push dateFri, 29 Sep 2017 15:41:40 +0000
bugs1404147
milestone58.0a1
Bug 1404147 Cast constants to the type they are compared to 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