diff --git a/netwerk/base/src/DashboardTypes.h b/netwerk/base/src/DashboardTypes.h index 5d534943926..4e3de2ee558 100644 --- a/netwerk/base/src/DashboardTypes.h +++ b/netwerk/base/src/DashboardTypes.h @@ -2,8 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef nsDashboardTypes__ -#define nsDashboardTypes__ +#ifndef mozilla_net_DashboardTypes_h_ +#define mozilla_net_DashboardTypes_h_ namespace mozilla { namespace net { @@ -22,7 +22,7 @@ struct DNSCacheEntries { nsCString hostname; nsTArray hostaddr; - int8_t family; + uint16_t family; int64_t expiration; }; @@ -45,4 +45,4 @@ struct HttpRetParams } } -#endif // nsDashboardTypes__ +#endif // mozilla_net_DashboardTypes_h_ diff --git a/netwerk/base/src/Makefile.in b/netwerk/base/src/Makefile.in index e409aacf5eb..71ae73c4927 100644 --- a/netwerk/base/src/Makefile.in +++ b/netwerk/base/src/Makefile.in @@ -14,9 +14,7 @@ include $(DEPTH)/config/autoconf.mk MODULE = necko LIBRARY_NAME = neckobase_s LIBXUL_LIBRARY = 1 -ifndef _MSC_VER FAIL_ON_WARNINGS := 1 -endif # !_MSC_VER EXPORTS = \ nsMIMEInputStream.h \ diff --git a/netwerk/base/src/nsSocketTransport2.cpp b/netwerk/base/src/nsSocketTransport2.cpp index 7dd872ad19c..dfa52298e17 100644 --- a/netwerk/base/src/nsSocketTransport2.cpp +++ b/netwerk/base/src/nsSocketTransport2.cpp @@ -8,6 +8,7 @@ #endif #include "nsSocketTransport2.h" +#include "base/compiler_specific.h" #include "nsAtomicRefcnt.h" #include "nsIOService.h" #include "nsStreamUtils.h" @@ -696,8 +697,8 @@ nsSocketTransport::nsSocketTransport() , mFD(nullptr) , mFDref(0) , mFDconnected(false) - , mInput(this) - , mOutput(this) + , ALLOW_THIS_IN_INITIALIZER_LIST(mInput(this)) + , ALLOW_THIS_IN_INITIALIZER_LIST(mOutput(this)) , mQoSBits(0x00) { SOCKET_LOG(("creating nsSocketTransport @%x\n", this)); diff --git a/netwerk/base/src/nsSocketTransportService2.cpp b/netwerk/base/src/nsSocketTransportService2.cpp index 0c9c3669bd3..348d82258d8 100644 --- a/netwerk/base/src/nsSocketTransportService2.cpp +++ b/netwerk/base/src/nsSocketTransportService2.cpp @@ -630,7 +630,7 @@ nsSocketTransportService::Run() threadInt->SetObserver(this); // make sure the pseudo random number generator is seeded on this thread - srand(PR_Now()); + srand(static_cast(PR_Now())); for (;;) { bool pendingEvents = false; diff --git a/netwerk/base/src/nsStandardURL.cpp b/netwerk/base/src/nsStandardURL.cpp index 5d682681c8b..438e6f1af95 100644 --- a/netwerk/base/src/nsStandardURL.cpp +++ b/netwerk/base/src/nsStandardURL.cpp @@ -1530,7 +1530,7 @@ nsStandardURL::SetPort(int32_t port) // need to remove the port number from the URL spec uint32_t start = mHost.mPos + mHost.mLen; - uint32_t lengthToCut = mPath.mPos - start; + int32_t lengthToCut = mPath.mPos - start; mSpec.Cut(start, lengthToCut); mAuthority.mLen -= lengthToCut; ShiftFromPath(-lengthToCut); diff --git a/netwerk/base/src/nsStreamTransportService.cpp b/netwerk/base/src/nsStreamTransportService.cpp index 4c43318ba2a..817aed84b74 100644 --- a/netwerk/base/src/nsStreamTransportService.cpp +++ b/netwerk/base/src/nsStreamTransportService.cpp @@ -186,14 +186,14 @@ nsInputStreamTransport::Read(char *buf, uint32_t count, uint32_t *result) } // limit amount read - uint32_t max = mLimit - mOffset; + uint64_t max = mLimit - mOffset; if (max == 0) { *result = 0; return NS_OK; } - + if (count > max) - count = max; + count = static_cast(max); nsresult rv = mSource->Read(buf, count, result); @@ -386,14 +386,14 @@ nsOutputStreamTransport::Write(const char *buf, uint32_t count, uint32_t *result } // limit amount written - uint32_t max = mLimit - mOffset; + uint64_t max = mLimit - mOffset; if (max == 0) { *result = 0; return NS_OK; } - + if (count > max) - count = max; + count = static_cast(max); nsresult rv = mSink->Write(buf, count, result); diff --git a/netwerk/build/Makefile.in b/netwerk/build/Makefile.in index ffe29b4f78a..d277c901892 100644 --- a/netwerk/build/Makefile.in +++ b/netwerk/build/Makefile.in @@ -17,9 +17,7 @@ IS_COMPONENT = 1 MODULE_NAME = necko GRE_MODULE = 1 LIBXUL_LIBRARY = 1 -ifndef _MSC_VER FAIL_ON_WARNINGS := 1 -endif # !_MSC_VER CPPSRCS = nsNetModule.cpp EXPORTS = nsNetCID.h diff --git a/netwerk/cache/Makefile.in b/netwerk/cache/Makefile.in index 3457b40eef1..94ff3d8848f 100644 --- a/netwerk/cache/Makefile.in +++ b/netwerk/cache/Makefile.in @@ -15,9 +15,7 @@ LIBRARY_NAME = nkcache_s LIBXUL_LIBRARY = 1 XPIDL_MODULE = necko_cache GRE_MODULE = 1 -ifndef _MSC_VER FAIL_ON_WARNINGS := 1 -endif # !_MSC_VER FORCE_STATIC_LIB = 1 diff --git a/netwerk/cache/nsCacheService.cpp b/netwerk/cache/nsCacheService.cpp index 20d6ec8dd71..83032eda8dc 100644 --- a/netwerk/cache/nsCacheService.cpp +++ b/netwerk/cache/nsCacheService.cpp @@ -575,17 +575,17 @@ SmartCacheSize(const uint32_t availKB, bool shouldUseOldMaxSmartSize) // .5% of space above 25 GB if (avail10MBs > 2500) { - sz10MBs += (avail10MBs - 2500)*.005; + sz10MBs += static_cast((avail10MBs - 2500)*.005); avail10MBs = 2500; } // 1% of space between 7GB -> 25 GB if (avail10MBs > 700) { - sz10MBs += (avail10MBs - 700)*.01; + sz10MBs += static_cast((avail10MBs - 700)*.01); avail10MBs = 700; } // 5% of space between 500 MB -> 7 GB if (avail10MBs > 50) { - sz10MBs += (avail10MBs - 50)*.05; + sz10MBs += static_cast((avail10MBs - 50)*.05); avail10MBs = 50; } @@ -595,10 +595,10 @@ SmartCacheSize(const uint32_t availKB, bool shouldUseOldMaxSmartSize) // percentage of available space and a smaller minimum. // 20% of space up to 500 MB (10 MB min) - sz10MBs += std::max(1, avail10MBs * .2); + sz10MBs += std::max(1, static_cast(avail10MBs * .2)); #else // 40% of space up to 500 MB (50 MB min) - sz10MBs += std::max(5, avail10MBs * .4); + sz10MBs += std::max(5, static_cast(avail10MBs * .4)); #endif return std::min(maxSize, sz10MBs * 10 * 1024); @@ -634,7 +634,8 @@ nsCacheProfilePrefObserver::GetSmartCacheSize(const nsAString& cachePath, if (NS_FAILED(rv)) return DEFAULT_CACHE_SIZE; - return SmartCacheSize((bytesAvailable / 1024) + currentSize, + return SmartCacheSize(static_cast((bytesAvailable / 1024) + + currentSize), shouldUseOldMaxSmartSize); } diff --git a/netwerk/cache/nsDeleteDir.cpp b/netwerk/cache/nsDeleteDir.cpp index b4ef844e1f8..248cce07fc0 100644 --- a/netwerk/cache/nsDeleteDir.cpp +++ b/netwerk/cache/nsDeleteDir.cpp @@ -224,7 +224,7 @@ nsDeleteDir::DeleteDir(nsIFile *dirIn, bool moveToTrash, uint32_t delay) return rv; // Append random number to the trash directory and check if it exists. - srand(PR_Now()); + srand(static_cast(PR_Now())); nsAutoCString leaf; for (int32_t i = 0; i < 10; i++) { leaf = origLeaf; diff --git a/netwerk/cookie/Makefile.in b/netwerk/cookie/Makefile.in index c3f1151b99e..452f2b0fd92 100644 --- a/netwerk/cookie/Makefile.in +++ b/netwerk/cookie/Makefile.in @@ -15,9 +15,7 @@ include $(DEPTH)/config/autoconf.mk MODULE = necko XPIDL_MODULE = necko_cookie GRE_MODULE = 1 -ifndef _MSC_VER FAIL_ON_WARNINGS := 1 -endif # !_MSC_VER SDK_XPIDLSRCS = \ nsICookie.idl \ diff --git a/netwerk/cookie/nsCookieService.cpp b/netwerk/cookie/nsCookieService.cpp index 7cc2f3b7cf4..093886b17b9 100644 --- a/netwerk/cookie/nsCookieService.cpp +++ b/netwerk/cookie/nsCookieService.cpp @@ -85,7 +85,7 @@ static const char kOldCookieFileName[] = "cookies.txt"; #define LIMIT(x, low, high, default) ((x) >= (low) && (x) <= (high) ? (x) : (default)) #undef ADD_TEN_PERCENT -#define ADD_TEN_PERCENT(i) ((i) + (i)/10) +#define ADD_TEN_PERCENT(i) static_cast((i) + (i)/10) // default limits for the cookie list. these can be tuned by the // network.cookie.maxNumber and network.cookie.maxPerHost prefs respectively. diff --git a/netwerk/dns/Makefile.in b/netwerk/dns/Makefile.in index f535587a906..3ed37a0957a 100644 --- a/netwerk/dns/Makefile.in +++ b/netwerk/dns/Makefile.in @@ -15,9 +15,7 @@ LIBRARY_NAME = neckodns_s LIBXUL_LIBRARY = 1 XPIDL_MODULE = necko_dns GRE_MODULE = 1 -ifndef _MSC_VER FAIL_ON_WARNINGS := 1 -endif # !_MSC_VER XPIDLSRCS = \ nsIDNSListener.idl \ diff --git a/netwerk/protocol/http/Makefile.in b/netwerk/protocol/http/Makefile.in index 597966a8c0f..12532d18cda 100644 --- a/netwerk/protocol/http/Makefile.in +++ b/netwerk/protocol/http/Makefile.in @@ -16,9 +16,7 @@ LIBXUL_LIBRARY = 1 XPIDL_MODULE = necko_http GRE_MODULE = 1 FORCE_STATIC_LIB = 1 -ifndef _MSC_VER FAIL_ON_WARNINGS := 1 -endif # !_MSC_VER EXPORTS_NAMESPACES = mozilla/net diff --git a/netwerk/protocol/http/nsHttpAuthCache.cpp b/netwerk/protocol/http/nsHttpAuthCache.cpp index 0109f8238ed..0a384ce8022 100644 --- a/netwerk/protocol/http/nsHttpAuthCache.cpp +++ b/netwerk/protocol/http/nsHttpAuthCache.cpp @@ -3,9 +3,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include -#include "nsHttp.h" #include "nsHttpAuthCache.h" +#include +#include "base/compiler_specific.h" +#include "nsHttp.h" #include "nsString.h" #include "nsCRT.h" #include "prprf.h" @@ -50,7 +51,7 @@ StrEquivalent(const PRUnichar *a, const PRUnichar *b) nsHttpAuthCache::nsHttpAuthCache() : mDB(nullptr) - , mObserver(new AppDataClearObserver(this)) + , ALLOW_THIS_IN_INITIALIZER_LIST(mObserver(new AppDataClearObserver(this))) { nsCOMPtr obsSvc = mozilla::services::GetObserverService(); if (obsSvc) { diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp index f73d38c4f6b..b3017ecee12 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp @@ -2785,7 +2785,8 @@ nsHalfOpenSocket::OnOutputStreamReady(nsIAsyncOutputStream *out) gHttpHandler->ConnMgr()->mMaxRequestDelay, mSocketTransport, mStreamIn, mStreamOut, callbacks, - PR_MillisecondsToInterval(rtt.ToMilliseconds())); + PR_MillisecondsToInterval( + static_cast(rtt.ToMilliseconds()))); if (NS_SUCCEEDED(mSocketTransport->GetPeerAddr(&peeraddr))) mEnt->RecordIPFamilyPreference(peeraddr.raw.family); @@ -2801,7 +2802,8 @@ nsHalfOpenSocket::OnOutputStreamReady(nsIAsyncOutputStream *out) gHttpHandler->ConnMgr()->mMaxRequestDelay, mBackupTransport, mBackupStreamIn, mBackupStreamOut, callbacks, - PR_MillisecondsToInterval(rtt.ToMilliseconds())); + PR_MillisecondsToInterval( + static_cast(rtt.ToMilliseconds()))); if (NS_SUCCEEDED(mBackupTransport->GetPeerAddr(&peeraddr))) mEnt->RecordIPFamilyPreference(peeraddr.raw.family); diff --git a/netwerk/protocol/res/Makefile.in b/netwerk/protocol/res/Makefile.in index 19fbded3392..ff9ee09ecce 100644 --- a/netwerk/protocol/res/Makefile.in +++ b/netwerk/protocol/res/Makefile.in @@ -15,9 +15,7 @@ LIBRARY_NAME = nkres_s LIBXUL_LIBRARY = 1 XPIDL_MODULE = necko_res GRE_MODULE = 1 -ifndef _MSC_VER FAIL_ON_WARNINGS = 1 -endif # !_MSC_VER FORCE_STATIC_LIB = 1 diff --git a/netwerk/protocol/websocket/Makefile.in b/netwerk/protocol/websocket/Makefile.in index 39187fd71bb..42b90f532f0 100644 --- a/netwerk/protocol/websocket/Makefile.in +++ b/netwerk/protocol/websocket/Makefile.in @@ -15,9 +15,7 @@ LIBXUL_LIBRARY = 1 XPIDL_MODULE = necko_websocket GRE_MODULE = 1 FORCE_STATIC_LIB = 1 -ifndef _MSC_VER FAIL_ON_WARNINGS = 1 -endif # !_MSC_VER EXPORTS_NAMESPACES = mozilla/net diff --git a/netwerk/protocol/websocket/WebSocketChannel.cpp b/netwerk/protocol/websocket/WebSocketChannel.cpp index f6b55c156b1..2a1deb9369a 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.cpp +++ b/netwerk/protocol/websocket/WebSocketChannel.cpp @@ -125,7 +125,8 @@ public: mLastFailure = TimeStamp::Now(); // We use a truncated exponential backoff as suggested by RFC 6455, // but multiply by 1.5 instead of 2 to be more gradual. - mNextDelay = std::min(kWSReconnectMaxDelay, mNextDelay * 1.5); + mNextDelay = static_cast( + std::min(kWSReconnectMaxDelay, mNextDelay * 1.5)); LOG(("WebSocket: FailedAgain: host=%s, port=%d: incremented delay to %lu", mAddress.get(), mPort, mNextDelay)); } @@ -1179,26 +1180,26 @@ WebSocketChannel::ProcessInput(uint8_t *buffer, uint32_t count) uint32_t totalAvail = avail; while (avail >= 2) { - int64_t payloadLength = mFramePtr[1] & 0x7F; - uint8_t finBit = mFramePtr[0] & kFinalFragBit; - uint8_t rsvBits = mFramePtr[0] & 0x70; - uint8_t maskBit = mFramePtr[1] & kMaskBit; - uint8_t opcode = mFramePtr[0] & 0x0F; + int64_t payloadLength64 = mFramePtr[1] & 0x7F; + uint8_t finBit = mFramePtr[0] & kFinalFragBit; + uint8_t rsvBits = mFramePtr[0] & 0x70; + uint8_t maskBit = mFramePtr[1] & kMaskBit; + uint8_t opcode = mFramePtr[0] & 0x0F; uint32_t framingLength = 2; if (maskBit) framingLength += 4; - if (payloadLength < 126) { + if (payloadLength64 < 126) { if (avail < framingLength) break; - } else if (payloadLength == 126) { + } else if (payloadLength64 == 126) { // 16 bit length field framingLength += 2; if (avail < framingLength) break; - payloadLength = mFramePtr[2] << 8 | mFramePtr[3]; + payloadLength64 = mFramePtr[2] << 8 | mFramePtr[3]; } else { // 64 bit length framingLength += 8; @@ -1215,18 +1216,19 @@ WebSocketChannel::ProcessInput(uint8_t *buffer, uint32_t count) // copy this in case it is unaligned uint64_t tempLen; memcpy(&tempLen, mFramePtr + 2, 8); - payloadLength = PR_ntohll(tempLen); + payloadLength64 = PR_ntohll(tempLen); } payload = mFramePtr + framingLength; avail -= framingLength; LOG(("WebSocketChannel::ProcessInput: payload %lld avail %lu\n", - payloadLength, avail)); + payloadLength64, avail)); - if (payloadLength + mFragmentAccumulator > mMaxMessageSize) { + if (payloadLength64 + mFragmentAccumulator > mMaxMessageSize) { return NS_ERROR_FILE_TOO_BIG; } + uint32_t payloadLength = static_cast(payloadLength64); if (avail < payloadLength) break; @@ -1266,7 +1268,7 @@ WebSocketChannel::ProcessInput(uint8_t *buffer, uint32_t count) return NS_ERROR_ILLEGAL_VALUE; } - LOG(("WebSocketChannel:: Accumulating Fragment %lld\n", payloadLength)); + LOG(("WebSocketChannel:: Accumulating Fragment %ld\n", payloadLength)); if (opcode == kContinuation) { @@ -1358,7 +1360,7 @@ WebSocketChannel::ProcessInput(uint8_t *buffer, uint32_t count) memcpy(&mServerCloseCode, payload, 2); mServerCloseCode = PR_ntohs(mServerCloseCode); LOG(("WebSocketChannel:: close recvd code %u\n", mServerCloseCode)); - uint16_t msglen = payloadLength - 2; + uint16_t msglen = static_cast(payloadLength - 2); if (msglen > 0) { mServerCloseReason.SetLength(msglen); memcpy(mServerCloseReason.BeginWriting(), diff --git a/netwerk/protocol/websocket/WebSocketChannelChild.cpp b/netwerk/protocol/websocket/WebSocketChannelChild.cpp index ce3470e82f0..e2b8e4fdf79 100644 --- a/netwerk/protocol/websocket/WebSocketChannelChild.cpp +++ b/netwerk/protocol/websocket/WebSocketChannelChild.cpp @@ -5,6 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "WebSocketLog.h" +#include "base/compiler_specific.h" #include "mozilla/dom/TabChild.h" #include "mozilla/net/NeckoChild.h" #include "WebSocketChannelChild.h" @@ -48,7 +49,7 @@ NS_INTERFACE_MAP_BEGIN(WebSocketChannelChild) NS_INTERFACE_MAP_END WebSocketChannelChild::WebSocketChannelChild(bool aSecure) -: mEventQ(static_cast(this)) +: ALLOW_THIS_IN_INITIALIZER_LIST(mEventQ(static_cast(this))) , mIPCOpen(false) { LOG(("WebSocketChannelChild::WebSocketChannelChild() %p\n", this)); diff --git a/netwerk/protocol/wyciwyg/Makefile.in b/netwerk/protocol/wyciwyg/Makefile.in index 299989ced1e..2a9aafb19f6 100644 --- a/netwerk/protocol/wyciwyg/Makefile.in +++ b/netwerk/protocol/wyciwyg/Makefile.in @@ -15,9 +15,7 @@ LIBXUL_LIBRARY = 1 XPIDL_MODULE = necko_wyciwyg GRE_MODULE = 1 FORCE_STATIC_LIB = 1 -ifndef _MSC_VER FAIL_ON_WARNINGS = 1 -endif # !_MSC_VER EXPORTS_NAMESPACES = mozilla/net diff --git a/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp b/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp index dba8fecc4b1..d9dc8e87ea9 100644 --- a/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp +++ b/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp @@ -4,6 +4,8 @@ #include "nsWyciwyg.h" +#include "base/compiler_specific.h" + #include "mozilla/net/NeckoChild.h" #include "WyciwygChannelChild.h" #include "mozilla/dom/TabChild.h" @@ -39,7 +41,7 @@ WyciwygChannelChild::WyciwygChannelChild() , mState(WCC_NEW) , mIPCOpen(false) , mSentAppData(false) - , mEventQ(NS_ISUPPORTS_CAST(nsIWyciwygChannel*, this)) + , ALLOW_THIS_IN_INITIALIZER_LIST(mEventQ(NS_ISUPPORTS_CAST(nsIWyciwygChannel*, this))) { LOG(("Creating WyciwygChannelChild @%x\n", this)); } diff --git a/netwerk/streamconv/converters/Makefile.in b/netwerk/streamconv/converters/Makefile.in index 587b77c0085..a2f7330217f 100644 --- a/netwerk/streamconv/converters/Makefile.in +++ b/netwerk/streamconv/converters/Makefile.in @@ -13,9 +13,7 @@ include $(DEPTH)/config/autoconf.mk MODULE = necko LIBRARY_NAME = nkcnvts_s LIBXUL_LIBRARY = 1 -ifndef _MSC_VER FAIL_ON_WARNINGS := 1 -endif # !_MSC_VER CPPSRCS = \ diff --git a/netwerk/streamconv/converters/nsMultiMixedConv.cpp b/netwerk/streamconv/converters/nsMultiMixedConv.cpp index 9811c3fb12e..024c057ce04 100644 --- a/netwerk/streamconv/converters/nsMultiMixedConv.cpp +++ b/netwerk/streamconv/converters/nsMultiMixedConv.cpp @@ -883,7 +883,7 @@ nsMultiMixedConv::SendData(char *aBuffer, uint32_t aLen) { // make sure that we don't send more than the mContentLength // XXX why? perhaps the Content-Length header was actually wrong!! if ((uint64_t(aLen) + mTotalSent) > mContentLength) - aLen = mContentLength - mTotalSent; + aLen = static_cast(mContentLength - mTotalSent); if (aLen == 0) return NS_OK;