Bug 786533 - Sprinkle a few -DNOMINMAX and fix uses of std::min with mixed 32/64-bit types. r=ehsan
This commit is contained in:
Родитель
b71c4474af
Коммит
4b538a3513
|
@ -59,6 +59,7 @@ EXPORTS = \
|
|||
$(NULL)
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
OS_CXXFLAGS += -DNOMINMAX
|
||||
ifndef GNU_CC
|
||||
|
||||
CPPSRCS += \
|
||||
|
|
|
@ -78,6 +78,7 @@ DEFINES += -D_IMPL_NS_MSG_BASE
|
|||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
DEFINES += -DZLIB_DLL
|
||||
OS_CXXFLAGS += -DNOMINMAX
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -367,7 +367,7 @@ char * nsMsgLineStreamBuffer::ReadNextLine(nsIInputStream * aInputStream, uint32
|
|||
NS_ASSERTION(m_startPos == 0, "m_startPos should be 0 .....\n");
|
||||
}
|
||||
|
||||
uint32_t numBytesToCopy = std::min(numFreeBytesInBuffer - 1 /* leave one for a null terminator */, numBytesInStream);
|
||||
uint32_t numBytesToCopy = std::min(uint64_t(numFreeBytesInBuffer - 1) /* leave one for a null terminator */, numBytesInStream);
|
||||
if (numBytesToCopy > 0)
|
||||
{
|
||||
// read the data into the end of our data buffer
|
||||
|
|
|
@ -1083,7 +1083,7 @@ public:
|
|||
|
||||
if (avail)
|
||||
{
|
||||
rv = aOutStream->WriteFrom(mInStream, std::min(avail, 4096), &bytesWritten);
|
||||
rv = aOutStream->WriteFrom(mInStream, std::min(avail, uint64_t(4096)), &bytesWritten);
|
||||
// if were full at the time, the input stream may be backed up and we need to read any remains from the last ODA call
|
||||
// before we'll get more ODA calls
|
||||
if (protInst->mSuspendedRead)
|
||||
|
@ -1408,7 +1408,7 @@ nsresult nsMsgAsyncWriteProtocol::UnblockPostReader()
|
|||
uint64_t avail = 0;
|
||||
mPostDataStream->Available(&avail);
|
||||
|
||||
m_outputStream->WriteFrom(mPostDataStream, std::min(avail, mSuspendedReadBytes), &amountWritten);
|
||||
m_outputStream->WriteFrom(mPostDataStream, std::min(avail, uint64_t(mSuspendedReadBytes)), &amountWritten);
|
||||
// hmm sometimes my mSuspendedReadBytes is getting out of whack...so for now, reset it
|
||||
// if necessary.
|
||||
if (mSuspendedReadBytes > avail)
|
||||
|
|
|
@ -46,6 +46,10 @@ CPPSRCS = \
|
|||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
OS_CXXFLAGS += -DNOMINMAX
|
||||
endif
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ CPPSRCS = \
|
|||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
CPPSRCS += nsEudoraWin32.cpp
|
||||
OS_CXXFLAGS += -DNOMINMAX
|
||||
endif
|
||||
|
||||
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||
|
|
|
@ -203,7 +203,7 @@ nsresult nsEudoraWin32::ScanMailDir(nsIFile *pFolder, nsISupportsArray *pArray,
|
|||
inputStream->Close();
|
||||
return rv;
|
||||
}
|
||||
uint32_t bytesLeft = std::min(PR_UINT32_MAX - 1, bytesLeft64);
|
||||
uint32_t bytesLeft = std::min(uint64_t(PR_UINT32_MAX - 1), bytesLeft64);
|
||||
pContents = (char *) PR_Malloc(bytesLeft + 1);
|
||||
if (!pContents)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
|
|
@ -32,4 +32,8 @@ CPPSRCS = \
|
|||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
OS_CXXFLAGS += -DNOMINMAX
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -134,7 +134,7 @@ nsresult nsTextAddress::ImportAddresses(bool *pAbort, const PRUnichar *pName, ns
|
|||
// considering that lineStream won't give us how many bytes
|
||||
// are actually left.
|
||||
bytesLeft -= line.Length();
|
||||
*pProgress = std::min(totalBytes - bytesLeft, PR_UINT32_MAX);
|
||||
*pProgress = std::min(totalBytes - bytesLeft, uint64_t(PR_UINT32_MAX));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -493,7 +493,7 @@ nsMimeBaseEmitter::WriteHelper(const char *buf, uint32_t count, uint32_t *countW
|
|||
rv = mInputStream->Available(&avail);
|
||||
if (NS_SUCCEEDED(rv) && avail) {
|
||||
mOutListener->OnDataAvailable(mChannel, mURL, mInputStream, 0,
|
||||
std::min(avail, PR_UINT32_MAX));
|
||||
std::min(avail, uint64_t(PR_UINT32_MAX)));
|
||||
|
||||
// try writing again...
|
||||
rv = mOutStream->Write(buf, count, countWritten);
|
||||
|
@ -1060,7 +1060,7 @@ nsMimeBaseEmitter::Complete()
|
|||
if (bytesInStream)
|
||||
{
|
||||
nsCOMPtr<nsIRequest> request = do_QueryInterface(mChannel);
|
||||
mOutListener->OnDataAvailable(request, mURL, mInputStream, 0, std::min(bytesInStream, PR_UINT32_MAX));
|
||||
mOutListener->OnDataAvailable(request, mURL, mInputStream, 0, std::min(bytesInStream, uint64_t(PR_UINT32_MAX)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,10 @@ CPPSRCS = \
|
|||
nsNewsDownloader.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
OS_CXXFLAGS += -DNOMINMAX
|
||||
endif
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
|
|
|
@ -2118,7 +2118,7 @@ nsresult nsNNTPProtocol::DisplayArticle(nsIInputStream * inputStream, uint32_t l
|
|||
uint64_t inlength = 0;
|
||||
mDisplayInputStream->Available(&inlength);
|
||||
if (inlength > 0) // broadcast our batched up ODA changes
|
||||
m_channelListener->OnDataAvailable(this, m_channelContext, mDisplayInputStream, 0, std::min(inlength, PR_UINT32_MAX));
|
||||
m_channelListener->OnDataAvailable(this, m_channelContext, mDisplayInputStream, 0, std::min(inlength, uint64_t(PR_UINT32_MAX)));
|
||||
SetFlag(NNTP_PAUSE_FOR_READ);
|
||||
PR_Free(line);
|
||||
return rv;
|
||||
|
@ -2137,7 +2137,7 @@ nsresult nsNNTPProtocol::DisplayArticle(nsIInputStream * inputStream, uint32_t l
|
|||
uint64_t inlength = 0;
|
||||
mDisplayInputStream->Available(&inlength);
|
||||
if (inlength > 0) // broadcast our batched up ODA changes
|
||||
m_channelListener->OnDataAvailable(this, m_channelContext, mDisplayInputStream, 0, std::min(inlength, PR_UINT32_MAX));
|
||||
m_channelListener->OnDataAvailable(this, m_channelContext, mDisplayInputStream, 0, std::min(inlength, uint64_t(PR_UINT32_MAX)));
|
||||
PR_Free(line);
|
||||
return rv;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче