Bug 827032 - Enable FAIL_ON_WARNINGS on MSVC in netwerk/. r=jduell

This commit is contained in:
Masatoshi Kimura 2013-02-08 20:49:30 +09:00
parent 495d1799b6
commit 35136d8877
24 changed files with 54 additions and 64 deletions

View File

@ -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<nsCString> hostaddr;
int8_t family;
uint16_t family;
int64_t expiration;
};
@ -45,4 +45,4 @@ struct HttpRetParams
} }
#endif // nsDashboardTypes__
#endif // mozilla_net_DashboardTypes_h_

View File

@ -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 \

View File

@ -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));

View File

@ -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<unsigned>(PR_Now()));
for (;;) {
bool pendingEvents = false;

View File

@ -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);

View File

@ -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<uint32_t>(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<uint32_t>(max);
nsresult rv = mSink->Write(buf, count, result);

View File

@ -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

View File

@ -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

View File

@ -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<uint32_t>((avail10MBs - 2500)*.005);
avail10MBs = 2500;
}
// 1% of space between 7GB -> 25 GB
if (avail10MBs > 700) {
sz10MBs += (avail10MBs - 700)*.01;
sz10MBs += static_cast<uint32_t>((avail10MBs - 700)*.01);
avail10MBs = 700;
}
// 5% of space between 500 MB -> 7 GB
if (avail10MBs > 50) {
sz10MBs += (avail10MBs - 50)*.05;
sz10MBs += static_cast<uint32_t>((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<uint32_t>(1, avail10MBs * .2);
sz10MBs += std::max<uint32_t>(1, static_cast<uint32_t>(avail10MBs * .2));
#else
// 40% of space up to 500 MB (50 MB min)
sz10MBs += std::max<uint32_t>(5, avail10MBs * .4);
sz10MBs += std::max<uint32_t>(5, static_cast<uint32_t>(avail10MBs * .4));
#endif
return std::min<uint32_t>(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<uint32_t>((bytesAvailable / 1024) +
currentSize),
shouldUseOldMaxSmartSize);
}

View File

@ -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<unsigned>(PR_Now()));
nsAutoCString leaf;
for (int32_t i = 0; i < 10; i++) {
leaf = origLeaf;

View File

@ -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 \

View File

@ -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<uint32_t>((i) + (i)/10)
// default limits for the cookie list. these can be tuned by the
// network.cookie.maxNumber and network.cookie.maxPerHost prefs respectively.

View File

@ -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 \

View File

@ -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

View File

@ -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 <stdlib.h>
#include "nsHttp.h"
#include "nsHttpAuthCache.h"
#include <stdlib.h>
#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<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
if (obsSvc) {

View File

@ -2785,7 +2785,8 @@ nsHalfOpenSocket::OnOutputStreamReady(nsIAsyncOutputStream *out)
gHttpHandler->ConnMgr()->mMaxRequestDelay,
mSocketTransport, mStreamIn, mStreamOut,
callbacks,
PR_MillisecondsToInterval(rtt.ToMilliseconds()));
PR_MillisecondsToInterval(
static_cast<uint32_t>(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<uint32_t>(rtt.ToMilliseconds())));
if (NS_SUCCEEDED(mBackupTransport->GetPeerAddr(&peeraddr)))
mEnt->RecordIPFamilyPreference(peeraddr.raw.family);

View File

@ -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

View File

@ -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

View File

@ -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<double>(kWSReconnectMaxDelay, mNextDelay * 1.5);
mNextDelay = static_cast<uint32_t>(
std::min<double>(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<uint32_t>(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<uint16_t>(payloadLength - 2);
if (msglen > 0) {
mServerCloseReason.SetLength(msglen);
memcpy(mServerCloseReason.BeginWriting(),

View File

@ -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<nsIWebSocketChannel*>(this))
: ALLOW_THIS_IN_INITIALIZER_LIST(mEventQ(static_cast<nsIWebSocketChannel*>(this)))
, mIPCOpen(false)
{
LOG(("WebSocketChannelChild::WebSocketChannelChild() %p\n", this));

View File

@ -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

View File

@ -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));
}

View File

@ -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 = \

View File

@ -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<uint32_t>(mContentLength - mTotalSent);
if (aLen == 0)
return NS_OK;