diff --git a/xpcom/build/FileLocation.cpp b/xpcom/build/FileLocation.cpp index 91399e54a6be..37c9d3aaa3b4 100644 --- a/xpcom/build/FileLocation.cpp +++ b/xpcom/build/FileLocation.cpp @@ -145,7 +145,7 @@ FileLocation::Data::Copy(char *buf, uint32_t len) { if (mFd) { for (uint32_t totalRead = 0; totalRead < len; ) { - int32_t read = PR_Read(mFd, buf + totalRead, NS_MIN(len - totalRead, uint32_t(INT32_MAX))); + int32_t read = PR_Read(mFd, buf + totalRead, XPCOM_MIN(len - totalRead, uint32_t(INT32_MAX))); if (read < 0) return NS_ErrorAccordingToNSPR(); totalRead += read; diff --git a/xpcom/ds/StringBuilder.h b/xpcom/ds/StringBuilder.h index 5d0b7a9c7961..d50348b2e519 100644 --- a/xpcom/ds/StringBuilder.h +++ b/xpcom/ds/StringBuilder.h @@ -63,7 +63,7 @@ public: size_t EnsureCapacity(size_t capacity) { if (capacity > mCapacity) { // make sure we at least double in size - mCapacity = NS_MAX(capacity, mCapacity*2); + mCapacity = XPCOM_MAX(capacity, mCapacity*2); mBuffer = static_cast(realloc(mBuffer, mCapacity)); mCapacity = moz_malloc_usable_size(mBuffer); } diff --git a/xpcom/ds/nsExpirationTracker.h b/xpcom/ds/nsExpirationTracker.h index 2926559812b3..5f82de90ab42 100644 --- a/xpcom/ds/nsExpirationTracker.h +++ b/xpcom/ds/nsExpirationTracker.h @@ -181,7 +181,7 @@ template class nsExpirationTracker { for (;;) { // Objects could have been removed so index could be outside // the array - index = NS_MIN(index, generation.Length()); + index = XPCOM_MIN(index, generation.Length()); if (index == 0) break; --index; diff --git a/xpcom/glue/nsQuickSort.cpp b/xpcom/glue/nsQuickSort.cpp index bcb1093139e7..bb55107f71da 100644 --- a/xpcom/glue/nsQuickSort.cpp +++ b/xpcom/glue/nsQuickSort.cpp @@ -164,9 +164,9 @@ loop: SWAPINIT(a, es); } pn = (char *)a + n * es; - r = NS_MIN(pa - (char *)a, pb - pa); + r = XPCOM_MIN(pa - (char *)a, pb - pa); vecswap(a, pb - r, r); - r = NS_MIN(pd - pc, pn - pd - es); + r = XPCOM_MIN(pd - pc, pn - pd - es); vecswap(pb, pn - r, r); if ((r = pb - pa) > (int)es) NS_QuickSort(a, r / es, es, cmp, data); diff --git a/xpcom/glue/nsTArray-inl.h b/xpcom/glue/nsTArray-inl.h index 205893ea58e0..d0caa80d26e9 100644 --- a/xpcom/glue/nsTArray-inl.h +++ b/xpcom/glue/nsTArray-inl.h @@ -353,8 +353,8 @@ nsTArray_base::SwapArrayElements(nsTArray_base& other, other.UsesAutoArrayBuffer(), "One of the arrays should be using its auto buffer."); - size_type smallerLength = NS_MIN(Length(), other.Length()); - size_type largerLength = NS_MAX(Length(), other.Length()); + size_type smallerLength = XPCOM_MIN(Length(), other.Length()); + size_type largerLength = XPCOM_MAX(Length(), other.Length()); void *smallerElements, *largerElements; if (Length() <= other.Length()) { smallerElements = Hdr() + 1; diff --git a/xpcom/glue/nsVersionComparator.cpp b/xpcom/glue/nsVersionComparator.cpp index 5c711850d577..e183a21b7ddd 100644 --- a/xpcom/glue/nsVersionComparator.cpp +++ b/xpcom/glue/nsVersionComparator.cpp @@ -258,7 +258,7 @@ CompareVP(VersionPartW &v1, VersionPartW &v2) if (r) return r; - r = wcsncmp(v1.strB, v2.strB, NS_MIN(v1.strBlen,v2.strBlen)); + r = wcsncmp(v1.strB, v2.strB, XPCOM_MIN(v1.strBlen,v2.strBlen)); if (r) return r; diff --git a/xpcom/glue/nsVoidArray.cpp b/xpcom/glue/nsVoidArray.cpp index 3c2342be0d85..9010e7e1a745 100644 --- a/xpcom/glue/nsVoidArray.cpp +++ b/xpcom/glue/nsVoidArray.cpp @@ -233,7 +233,7 @@ bool nsVoidArray::GrowArrayBy(int32_t aGrowBy) // Also, limit the increase in size to about a VM page or two. if (GetArraySize() >= kMaxGrowArrayBy) { - newCapacity = GetArraySize() + NS_MAX(kMaxGrowArrayBy,aGrowBy); + newCapacity = GetArraySize() + XPCOM_MAX(kMaxGrowArrayBy,aGrowBy); newSize = SIZEOF_IMPL(newCapacity); } else diff --git a/xpcom/glue/pldhash.cpp b/xpcom/glue/pldhash.cpp index 9664ec283430..db161c81e3c4 100644 --- a/xpcom/glue/pldhash.cpp +++ b/xpcom/glue/pldhash.cpp @@ -273,7 +273,7 @@ PL_DHashTableSetAlphaBounds(PLDHashTable *table, "PL_DHASH_MIN_SIZE - (maxAlpha * PL_DHASH_MIN_SIZE) >= 1"); if (PL_DHASH_MIN_SIZE - (maxAlpha * PL_DHASH_MIN_SIZE) < 1) { maxAlpha = (float) - (PL_DHASH_MIN_SIZE - NS_MAX(PL_DHASH_MIN_SIZE / 256, 1)) + (PL_DHASH_MIN_SIZE - XPCOM_MAX(PL_DHASH_MIN_SIZE / 256, 1)) / PL_DHASH_MIN_SIZE; } @@ -286,7 +286,7 @@ PL_DHashTableSetAlphaBounds(PLDHashTable *table, "minAlpha < maxAlpha / 2"); if (minAlpha >= maxAlpha / 2) { size = PL_DHASH_TABLE_SIZE(table); - minAlpha = (size * maxAlpha - NS_MAX(size / 256, 1u)) / (2 * size); + minAlpha = (size * maxAlpha - XPCOM_MAX(size / 256, 1u)) / (2 * size); } table->maxAlphaFrac = (uint8_t)(maxAlpha * 256); diff --git a/xpcom/io/nsMultiplexInputStream.cpp b/xpcom/io/nsMultiplexInputStream.cpp index 2c77f1aeeae0..03accc863bdc 100644 --- a/xpcom/io/nsMultiplexInputStream.cpp +++ b/xpcom/io/nsMultiplexInputStream.cpp @@ -403,7 +403,7 @@ nsMultiplexInputStream::Seek(int32_t aWhence, int64_t aOffset) rv = mStreams[i]->Available(&avail); NS_ENSURE_SUCCESS(rv, rv); - int64_t newPos = NS_MIN(remaining, streamPos + (int64_t)avail); + int64_t newPos = XPCOM_MIN(remaining, streamPos + (int64_t)avail); rv = stream->Seek(NS_SEEK_SET, newPos); NS_ENSURE_SUCCESS(rv, rv); @@ -434,7 +434,7 @@ nsMultiplexInputStream::Seek(int32_t aWhence, int64_t aOffset) rv = mStreams[i]->Available(&avail); NS_ENSURE_SUCCESS(rv, rv); - int64_t seek = NS_MIN((int64_t)avail, remaining); + int64_t seek = XPCOM_MIN((int64_t)avail, remaining); rv = stream->Seek(NS_SEEK_CUR, seek); NS_ENSURE_SUCCESS(rv, rv); @@ -458,7 +458,7 @@ nsMultiplexInputStream::Seek(int32_t aWhence, int64_t aOffset) rv = stream->Tell(&pos); NS_ENSURE_SUCCESS(rv, rv); - int64_t seek = NS_MIN(pos, remaining); + int64_t seek = XPCOM_MIN(pos, remaining); rv = stream->Seek(NS_SEEK_CUR, -seek); NS_ENSURE_SUCCESS(rv, rv); @@ -529,7 +529,7 @@ nsMultiplexInputStream::Seek(int32_t aWhence, int64_t aOffset) rv = stream->Tell(&avail); NS_ENSURE_SUCCESS(rv, rv); - int64_t newPos = streamPos + NS_MIN(avail, std::abs(remaining)); + int64_t newPos = streamPos + XPCOM_MIN(avail, std::abs(remaining)); rv = stream->Seek(NS_SEEK_END, -newPos); NS_ENSURE_SUCCESS(rv, rv); diff --git a/xpcom/io/nsPipe3.cpp b/xpcom/io/nsPipe3.cpp index 16be243bd366..8b75f20488ec 100644 --- a/xpcom/io/nsPipe3.cpp +++ b/xpcom/io/nsPipe3.cpp @@ -935,7 +935,7 @@ nsPipeInputStream::Search(const char *forString, len2 = limit2 - cursor2; // check if the string is straddling the next buffer segment - uint32_t lim = NS_MIN(strLen, len2 + 1); + uint32_t lim = XPCOM_MIN(strLen, len2 + 1); for (i = 0; i < lim; ++i) { uint32_t strPart1Len = strLen - i - 1; uint32_t strPart2Len = strLen - strPart1Len; diff --git a/xpcom/io/nsScriptableInputStream.cpp b/xpcom/io/nsScriptableInputStream.cpp index 820a103814d9..36f43ea5e9b0 100644 --- a/xpcom/io/nsScriptableInputStream.cpp +++ b/xpcom/io/nsScriptableInputStream.cpp @@ -41,7 +41,7 @@ nsScriptableInputStream::Read(uint32_t aCount, char **_retval) { if (NS_FAILED(rv)) return rv; // bug716556 - Ensure count+1 doesn't overflow - uint32_t count = NS_MIN((uint32_t)NS_MIN(count64, aCount), UINT32_MAX - 1); + uint32_t count = XPCOM_MIN((uint32_t)XPCOM_MIN(count64, aCount), UINT32_MAX - 1); buffer = (char*)nsMemory::Alloc(count+1); // make room for '\0' if (!buffer) return NS_ERROR_OUT_OF_MEMORY; diff --git a/xpcom/io/nsStorageStream.cpp b/xpcom/io/nsStorageStream.cpp index 6ab7e067f71a..107e292c98ec 100644 --- a/xpcom/io/nsStorageStream.cpp +++ b/xpcom/io/nsStorageStream.cpp @@ -180,7 +180,7 @@ nsStorageStream::Write(const char *aBuffer, uint32_t aCount, uint32_t *aNumWritt this, mWriteCursor, mSegmentEnd)); } - count = NS_MIN(availableInSegment, remaining); + count = XPCOM_MIN(availableInSegment, remaining); memcpy(mWriteCursor, readCursor, count); remaining -= count; readCursor += count; @@ -418,12 +418,12 @@ nsStorageInputStream::ReadSegments(nsWriteSegmentFun writer, void * closure, uin mSegmentNum++; mReadCursor = 0; - mSegmentEnd = NS_MIN(mSegmentSize, available); + mSegmentEnd = XPCOM_MIN(mSegmentSize, available); availableInSegment = mSegmentEnd; } const char *cur = mStorageStream->mSegmentedBuffer->GetSegment(mSegmentNum); - count = NS_MIN(availableInSegment, remainingCapacity); + count = XPCOM_MIN(availableInSegment, remainingCapacity); rv = writer(this, closure, cur + mReadCursor, aCount - remainingCapacity, count, &bytesConsumed); if (NS_FAILED(rv) || (bytesConsumed == 0)) @@ -513,7 +513,7 @@ nsStorageInputStream::Seek(uint32_t aPosition) mSegmentNum = SegNum(aPosition); mReadCursor = SegOffset(aPosition); uint32_t available = length - aPosition; - mSegmentEnd = mReadCursor + NS_MIN(mSegmentSize - mReadCursor, available); + mSegmentEnd = mReadCursor + XPCOM_MIN(mSegmentSize - mReadCursor, available); mLogicalCursor = aPosition; return NS_OK; } diff --git a/xpcom/io/nsStreamUtils.cpp b/xpcom/io/nsStreamUtils.cpp index 36c10301b2ff..d66084ee3ac5 100644 --- a/xpcom/io/nsStreamUtils.cpp +++ b/xpcom/io/nsStreamUtils.cpp @@ -629,7 +629,7 @@ NS_ConsumeStream(nsIInputStream *stream, uint32_t maxCount, nsACString &result) if (avail64 == 0) break; - uint32_t avail = (uint32_t)NS_MIN(avail64, maxCount); + uint32_t avail = (uint32_t)XPCOM_MIN(avail64, maxCount); // resize result buffer uint32_t length = result.Length(); diff --git a/xpcom/io/nsUnicharInputStream.cpp b/xpcom/io/nsUnicharInputStream.cpp index 7e021a7492d0..3fc048fc8892 100644 --- a/xpcom/io/nsUnicharInputStream.cpp +++ b/xpcom/io/nsUnicharInputStream.cpp @@ -69,7 +69,7 @@ StringUnicharInputStream::ReadSegments(nsWriteUnicharSegmentFun aWriter, uint32_t totalBytesWritten = 0; nsresult rv; - aCount = NS_MIN(mString.Length() - mPos, aCount); + aCount = XPCOM_MIN(mString.Length() - mPos, aCount); nsAString::const_iterator iter; mString.BeginReading(iter); diff --git a/xpcom/string/public/nsAlgorithm.h b/xpcom/string/public/nsAlgorithm.h index fa50194ac57f..932ab6923505 100644 --- a/xpcom/string/public/nsAlgorithm.h +++ b/xpcom/string/public/nsAlgorithm.h @@ -28,7 +28,7 @@ NS_ROUNDUP( const T& a, const T& b ) template inline const T& -NS_MIN( const T& a, const T& b ) +XPCOM_MIN( const T& a, const T& b ) { return b < a ? b : a; } @@ -37,7 +37,7 @@ NS_MIN( const T& a, const T& b ) template inline const T& -NS_MAX( const T& a, const T& b ) +XPCOM_MAX( const T& a, const T& b ) { return a > b ? a : b; } @@ -61,7 +61,7 @@ const T& clamped( const T& a, const T& min, const T& max ) { NS_ABORT_IF_FALSE(max >= min, "clamped(): max must be greater than or equal to min"); - return NS_MIN(NS_MAX(a, min), max); + return XPCOM_MIN(XPCOM_MAX(a, min), max); } } diff --git a/xpcom/string/public/nsString.h b/xpcom/string/public/nsString.h index ae27f9dec89d..ed92dffbb982 100644 --- a/xpcom/string/public/nsString.h +++ b/xpcom/string/public/nsString.h @@ -188,12 +188,12 @@ typedef nsAutoString nsVoidableString; inline int32_t MinInt(int32_t x, int32_t y) { - return NS_MIN(x, y); + return XPCOM_MIN(x, y); } inline int32_t MaxInt(int32_t x, int32_t y) { - return NS_MAX(x, y); + return XPCOM_MAX(x, y); } /** diff --git a/xpcom/string/public/nsStringIterator.h b/xpcom/string/public/nsStringIterator.h index a6a0887e3e15..c38368d3a242 100644 --- a/xpcom/string/public/nsStringIterator.h +++ b/xpcom/string/public/nsStringIterator.h @@ -134,7 +134,7 @@ class nsReadingIterator { if (n > 0) { - difference_type step = NS_MIN(n, size_forward()); + difference_type step = XPCOM_MIN(n, size_forward()); NS_ASSERTION(step>0, "can't advance a reading iterator beyond the end of a string"); @@ -142,7 +142,7 @@ class nsReadingIterator } else if (n < 0) { - difference_type step = NS_MAX(n, -size_backward()); + difference_type step = XPCOM_MAX(n, -size_backward()); NS_ASSERTION(step<0, "can't advance (backward) a reading iterator beyond the end of a string"); @@ -268,7 +268,7 @@ class nsWritingIterator { if (n > 0) { - difference_type step = NS_MIN(n, size_forward()); + difference_type step = XPCOM_MIN(n, size_forward()); NS_ASSERTION(step>0, "can't advance a writing iterator beyond the end of a string"); @@ -276,7 +276,7 @@ class nsWritingIterator } else if (n < 0) { - difference_type step = NS_MAX(n, -size_backward()); + difference_type step = XPCOM_MAX(n, -size_backward()); NS_ASSERTION(step<0, "can't advance (backward) a writing iterator beyond the end of a string"); diff --git a/xpcom/string/public/nsTString.h b/xpcom/string/public/nsTString.h index c00ec14dde93..fab25309687c 100644 --- a/xpcom/string/public/nsTString.h +++ b/xpcom/string/public/nsTString.h @@ -286,7 +286,7 @@ class nsTString_CharT : public nsTSubstring_CharT size_type Right( self_type& aResult, size_type aCount ) const { - aCount = NS_MIN(mLength, aCount); + aCount = XPCOM_MIN(mLength, aCount); return Mid(aResult, mLength - aCount, aCount); } diff --git a/xpcom/string/public/nsTSubstring.h b/xpcom/string/public/nsTSubstring.h index 9197898f33ee..b119ea72ac9b 100644 --- a/xpcom/string/public/nsTSubstring.h +++ b/xpcom/string/public/nsTSubstring.h @@ -710,7 +710,7 @@ class nsTSubstring_CharT bool ReplacePrep(index_type cutStart, size_type cutLength, size_type newLength) NS_WARN_UNUSED_RESULT { - cutLength = NS_MIN(cutLength, mLength - cutStart); + cutLength = XPCOM_MIN(cutLength, mLength - cutStart); uint32_t newTotalLen = mLength - cutLength + newLength; if (cutStart == mLength && Capacity() > newTotalLen) { mFlags &= ~F_VOIDED; diff --git a/xpcom/string/src/nsReadableUtils.cpp b/xpcom/string/src/nsReadableUtils.cpp index b2d093999e7e..76885f10d0de 100644 --- a/xpcom/string/src/nsReadableUtils.cpp +++ b/xpcom/string/src/nsReadableUtils.cpp @@ -578,7 +578,7 @@ class CopyToUpperCase uint32_t write( const char* aSource, uint32_t aSourceLength ) { - uint32_t len = NS_MIN(uint32_t(mIter.size_forward()), aSourceLength); + uint32_t len = XPCOM_MIN(uint32_t(mIter.size_forward()), aSourceLength); char* cp = mIter.get(); const char* end = aSource + len; while (aSource != end) { @@ -657,7 +657,7 @@ class CopyToLowerCase uint32_t write( const char* aSource, uint32_t aSourceLength ) { - uint32_t len = NS_MIN(uint32_t(mIter.size_forward()), aSourceLength); + uint32_t len = XPCOM_MIN(uint32_t(mIter.size_forward()), aSourceLength); char* cp = mIter.get(); const char* end = aSource + len; while (aSource != end) { diff --git a/xpcom/string/src/nsStringObsolete.cpp b/xpcom/string/src/nsStringObsolete.cpp index 2ab2c61a2a7f..cb6d2e5c232d 100644 --- a/xpcom/string/src/nsStringObsolete.cpp +++ b/xpcom/string/src/nsStringObsolete.cpp @@ -925,7 +925,7 @@ nsCString::Compare( const char* aString, bool aIgnoreCase, int32_t aCount ) cons { uint32_t strLen = char_traits::length(aString); - int32_t maxCount = int32_t(NS_MIN(mLength, strLen)); + int32_t maxCount = int32_t(XPCOM_MIN(mLength, strLen)); int32_t compareCount; if (aCount < 0 || aCount > maxCount) @@ -954,7 +954,7 @@ nsString::EqualsIgnoreCase( const char* aString, int32_t aCount ) const { uint32_t strLen = nsCharTraits::length(aString); - int32_t maxCount = int32_t(NS_MIN(mLength, strLen)); + int32_t maxCount = int32_t(XPCOM_MIN(mLength, strLen)); int32_t compareCount; if (aCount < 0 || aCount > maxCount) diff --git a/xpcom/string/src/nsTDependentSubstring.cpp b/xpcom/string/src/nsTDependentSubstring.cpp index d8622cff2ae7..d31156fd7661 100644 --- a/xpcom/string/src/nsTDependentSubstring.cpp +++ b/xpcom/string/src/nsTDependentSubstring.cpp @@ -16,7 +16,7 @@ nsTDependentSubstring_CharT::Rebind( const substring_type& str, uint32_t startPo startPos = strLength; mData = const_cast(str.Data()) + startPos; - mLength = NS_MIN(length, strLength - startPos); + mLength = XPCOM_MIN(length, strLength - startPos); SetDataFlags(F_NONE); } diff --git a/xpcom/string/src/nsTStringComparator.cpp b/xpcom/string/src/nsTStringComparator.cpp index 561df689663f..1a69a30fe00c 100644 --- a/xpcom/string/src/nsTStringComparator.cpp +++ b/xpcom/string/src/nsTStringComparator.cpp @@ -18,7 +18,7 @@ Compare( const nsTSubstring_CharT::base_string_type& lhs, const nsTSubstring_Cha size_type lLength = leftIter.size_forward(); size_type rLength = rightIter.size_forward(); - size_type lengthToCompare = NS_MIN(lLength, rLength); + size_type lengthToCompare = XPCOM_MIN(lLength, rLength); int result; if ( (result = comp(leftIter.get(), rightIter.get(), lengthToCompare, lengthToCompare)) == 0 ) diff --git a/xpcom/string/src/nsTSubstring.cpp b/xpcom/string/src/nsTSubstring.cpp index a90d84070ff6..ed99cf2cc3ea 100644 --- a/xpcom/string/src/nsTSubstring.cpp +++ b/xpcom/string/src/nsTSubstring.cpp @@ -75,9 +75,9 @@ nsTSubstring_CharT::MutatePrep( size_type capacity, char_type** oldData, uint32_ size_type temp = curCapacity; while (temp < capacity) temp <<= 1; - NS_ASSERTION(NS_MIN(temp, kMaxCapacity) >= capacity, + NS_ASSERTION(XPCOM_MIN(temp, kMaxCapacity) >= capacity, "should have hit the early return at the top"); - capacity = NS_MIN(temp, kMaxCapacity); + capacity = XPCOM_MIN(temp, kMaxCapacity); } // @@ -451,7 +451,7 @@ nsTSubstring_CharT::Adopt( char_type* data, size_type length ) void nsTSubstring_CharT::Replace( index_type cutStart, size_type cutLength, char_type c ) { - cutStart = NS_MIN(cutStart, Length()); + cutStart = XPCOM_MIN(cutStart, Length()); if (ReplacePrep(cutStart, cutLength, 1)) mData[cutStart] = c; @@ -479,7 +479,7 @@ nsTSubstring_CharT::Replace( index_type cutStart, size_type cutLength, const cha } } - cutStart = NS_MIN(cutStart, Length()); + cutStart = XPCOM_MIN(cutStart, Length()); if (ReplacePrep(cutStart, cutLength, length) && length > 0) char_traits::copy(mData + cutStart, data, length); @@ -502,7 +502,7 @@ nsTSubstring_CharT::ReplaceASCII( index_type cutStart, size_type cutLength, cons } #endif - cutStart = NS_MIN(cutStart, Length()); + cutStart = XPCOM_MIN(cutStart, Length()); if (ReplacePrep(cutStart, cutLength, length) && length > 0) char_traits::copyASCII(mData + cutStart, data, length); @@ -520,7 +520,7 @@ nsTSubstring_CharT::Replace( index_type cutStart, size_type cutLength, const sub size_type length = tuple.Length(); - cutStart = NS_MIN(cutStart, Length()); + cutStart = XPCOM_MIN(cutStart, Length()); if (ReplacePrep(cutStart, cutLength, length) && length > 0) tuple.WriteTo(mData + cutStart, length); @@ -554,7 +554,7 @@ nsTSubstring_CharT::SetCapacity( size_type capacity, const fallible_t& ) return false; // out-of-memory // compute new string length - size_type newLen = NS_MIN(mLength, capacity); + size_type newLen = XPCOM_MIN(mLength, capacity); if (oldData) { diff --git a/xpcom/string/src/nsUTF8UtilsSSE2.cpp b/xpcom/string/src/nsUTF8UtilsSSE2.cpp index a10fc5c37ec4..9f698102d1bf 100644 --- a/xpcom/string/src/nsUTF8UtilsSSE2.cpp +++ b/xpcom/string/src/nsUTF8UtilsSSE2.cpp @@ -16,7 +16,7 @@ LossyConvertEncoding16to8::write_sse2(const PRUnichar* aSource, // Align source to a 16-byte boundary. uint32_t i = 0; uint32_t alignLen = - NS_MIN(aSourceLength, uint32_t(-NS_PTR_TO_INT32(aSource) & 0xf) / sizeof(PRUnichar)); + XPCOM_MIN(aSourceLength, uint32_t(-NS_PTR_TO_INT32(aSource) & 0xf) / sizeof(PRUnichar)); for (; i < alignLen; i++) { dest[i] = static_cast(aSource[i]); } @@ -69,7 +69,7 @@ LossyConvertEncoding8to16::write_sse2(const char* aSource, // to wait for a load to complete, but you can keep on moving after issuing a // store. uint32_t i = 0; - uint32_t alignLen = NS_MIN(aSourceLength, uint32_t(-NS_PTR_TO_INT32(aSource) & 0xf)); + uint32_t alignLen = XPCOM_MIN(aSourceLength, uint32_t(-NS_PTR_TO_INT32(aSource) & 0xf)); for (; i < alignLen; i++) { dest[i] = static_cast(aSource[i]); } diff --git a/xpcom/tests/TestPipes.cpp b/xpcom/tests/TestPipes.cpp index 92576509ab23..fe3cc89c2f35 100644 --- a/xpcom/tests/TestPipes.cpp +++ b/xpcom/tests/TestPipes.cpp @@ -282,7 +282,7 @@ TestShortWrites(nsIInputStream* in, nsIOutputStream* out) char* buf = PR_smprintf("%d %s", i, kTestPattern); uint32_t len = strlen(buf); len = len * rand() / RAND_MAX; - len = NS_MAX(1, len); + len = XPCOM_MAX(1, len); rv = WriteAll(out, buf, len, &writeCount); if (NS_FAILED(rv)) return rv; NS_ASSERTION(writeCount == len, "didn't write enough"); @@ -391,7 +391,7 @@ TestChainedPipes() char* buf = PR_smprintf("%d %s", i, kTestPattern); uint32_t len = strlen(buf); len = len * rand() / RAND_MAX; - len = NS_MAX(1, len); + len = XPCOM_MAX(1, len); rv = WriteAll(out1, buf, len, &writeCount); if (NS_FAILED(rv)) return rv; NS_ASSERTION(writeCount == len, "didn't write enough");