mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-02 12:32:55 +00:00
Bug 645398 - Substitute PR_(MAX|MIN|ABS|ROUNDUP) macro calls; r=roc
This commit is contained in:
parent
90dd851282
commit
968bf5196a
@ -949,7 +949,7 @@ protected:
|
||||
FakeBlackStatus mFakeBlackStatus;
|
||||
|
||||
void EnsureMaxLevelWithCustomImagesAtLeast(size_t aMaxLevelWithCustomImages) {
|
||||
mMaxLevelWithCustomImages = PR_MAX(mMaxLevelWithCustomImages, aMaxLevelWithCustomImages);
|
||||
mMaxLevelWithCustomImages = NS_MAX(mMaxLevelWithCustomImages, aMaxLevelWithCustomImages);
|
||||
mImageInfos.EnsureLengthAtLeast((mMaxLevelWithCustomImages + 1) * mFacesCount);
|
||||
}
|
||||
|
||||
@ -979,8 +979,8 @@ protected:
|
||||
const ImageInfo& actual = ImageInfoAt(level, face);
|
||||
if (actual != expected)
|
||||
return PR_FALSE;
|
||||
expected.mWidth = PR_MAX(1, expected.mWidth >> 1);
|
||||
expected.mHeight = PR_MAX(1, expected.mHeight >> 1);
|
||||
expected.mWidth = NS_MAX(1, expected.mWidth >> 1);
|
||||
expected.mHeight = NS_MAX(1, expected.mHeight >> 1);
|
||||
|
||||
// if the current level has size 1x1, we can stop here: the spec doesn't seem to forbid the existence
|
||||
// of extra useless levels.
|
||||
@ -1091,7 +1091,7 @@ public:
|
||||
ImageInfo imageInfo = ImageInfoAt(0, 0);
|
||||
NS_ASSERTION(imageInfo.IsPowerOfTwo(), "this texture is NPOT, so how could GenerateMipmap() ever accept it?");
|
||||
|
||||
WebGLsizei size = PR_MAX(imageInfo.mWidth, imageInfo.mHeight);
|
||||
WebGLsizei size = NS_MAX(imageInfo.mWidth, imageInfo.mHeight);
|
||||
|
||||
// so, the size is a power of two, let's find its log in base 2.
|
||||
size_t maxLevel = 0;
|
||||
|
@ -744,13 +744,13 @@ WebGLContext::CopyTexSubImage2D_base(WebGLenum target,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
GLint actual_x = PR_MIN(framebufferWidth, PR_MAX(0, x));
|
||||
GLint actual_x_plus_width = PR_MIN(framebufferWidth, PR_MAX(0, x + width));
|
||||
GLint actual_x = NS_MIN(framebufferWidth, NS_MAX(0, x));
|
||||
GLint actual_x_plus_width = NS_MIN(framebufferWidth, NS_MAX(0, x + width));
|
||||
GLsizei actual_width = actual_x_plus_width - actual_x;
|
||||
GLint actual_xoffset = xoffset + actual_x - x;
|
||||
|
||||
GLint actual_y = PR_MIN(framebufferHeight, PR_MAX(0, y));
|
||||
GLint actual_y_plus_height = PR_MIN(framebufferHeight, PR_MAX(0, y + height));
|
||||
GLint actual_y = NS_MIN(framebufferHeight, NS_MAX(0, y));
|
||||
GLint actual_y_plus_height = NS_MIN(framebufferHeight, NS_MAX(0, y + height));
|
||||
GLsizei actual_height = actual_y_plus_height - actual_y;
|
||||
GLint actual_yoffset = yoffset + actual_y - y;
|
||||
|
||||
@ -2987,12 +2987,12 @@ WebGLContext::ReadPixels_base(WebGLint x, WebGLint y, WebGLsizei width, WebGLsiz
|
||||
}
|
||||
|
||||
// compute the parameters of the subrect we're actually going to call glReadPixels on
|
||||
GLint subrect_x = PR_MAX(x, 0);
|
||||
GLint subrect_end_x = PR_MIN(x+width, boundWidth);
|
||||
GLint subrect_x = NS_MAX(x, 0);
|
||||
GLint subrect_end_x = NS_MIN(x+width, boundWidth);
|
||||
GLsizei subrect_width = subrect_end_x - subrect_x;
|
||||
|
||||
GLint subrect_y = PR_MAX(y, 0);
|
||||
GLint subrect_end_y = PR_MIN(y+height, boundHeight);
|
||||
GLint subrect_y = NS_MAX(y, 0);
|
||||
GLint subrect_end_y = NS_MIN(y+height, boundHeight);
|
||||
GLsizei subrect_height = subrect_end_y - subrect_y;
|
||||
|
||||
if (subrect_width < 0 || subrect_height < 0 ||
|
||||
|
@ -538,7 +538,7 @@ WebGLContext::InitAndValidateGL()
|
||||
error = gl->fGetError();
|
||||
switch (error) {
|
||||
case LOCAL_GL_NO_ERROR:
|
||||
mGLMaxVaryingVectors = PR_MIN(maxVertexOutputComponents, minFragmentInputComponents) / 4;
|
||||
mGLMaxVaryingVectors = NS_MIN(maxVertexOutputComponents, minFragmentInputComponents) / 4;
|
||||
break;
|
||||
case LOCAL_GL_INVALID_ENUM:
|
||||
mGLMaxVaryingVectors = 16; // = 64/4, 64 is the min value for maxVertexOutputComponents in OpenGL 3.2 spec
|
||||
|
@ -770,7 +770,7 @@ nsMouseWheelTransaction::LimitToOnePageScroll(PRInt32 aScrollLines,
|
||||
nsSize pageAmount = sf->GetPageScrollAmount();
|
||||
nscoord pageScroll = aIsHorizontal ? pageAmount.width : pageAmount.height;
|
||||
|
||||
if (PR_ABS(aScrollLines) * lineScroll < pageScroll)
|
||||
if (NS_ABS(aScrollLines) * lineScroll < pageScroll)
|
||||
return aScrollLines;
|
||||
|
||||
nscoord maxLines = (pageScroll / lineScroll);
|
||||
@ -1272,7 +1272,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
if (!gPixelScrollDeltaX || !pixelHeight)
|
||||
break;
|
||||
|
||||
if (PR_ABS(gPixelScrollDeltaX) >= pixelHeight) {
|
||||
if (NS_ABS(gPixelScrollDeltaX) >= pixelHeight) {
|
||||
PRInt32 numLines = (PRInt32)ceil((float)gPixelScrollDeltaX/(float)pixelHeight);
|
||||
|
||||
gPixelScrollDeltaX -= numLines*pixelHeight;
|
||||
@ -1287,7 +1287,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
if (!gPixelScrollDeltaY || !pixelHeight)
|
||||
break;
|
||||
|
||||
if (PR_ABS(gPixelScrollDeltaY) >= pixelHeight) {
|
||||
if (NS_ABS(gPixelScrollDeltaY) >= pixelHeight) {
|
||||
PRInt32 numLines = (PRInt32)ceil((float)gPixelScrollDeltaY/(float)pixelHeight);
|
||||
|
||||
gPixelScrollDeltaY -= numLines*pixelHeight;
|
||||
@ -1990,8 +1990,8 @@ nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
||||
|
||||
// fire drag gesture if mouse has moved enough
|
||||
nsIntPoint pt = aEvent->refPoint + aEvent->widget->WidgetToScreenOffset();
|
||||
if (PR_ABS(pt.x - mGestureDownPoint.x) > pixelThresholdX ||
|
||||
PR_ABS(pt.y - mGestureDownPoint.y) > pixelThresholdY) {
|
||||
if (NS_ABS(pt.x - mGestureDownPoint.x) > pixelThresholdX ||
|
||||
NS_ABS(pt.y - mGestureDownPoint.y) > pixelThresholdY) {
|
||||
if (mClickHoldContextMenu) {
|
||||
// stop the click-hold before we fire off the drag gesture, in case
|
||||
// it takes a long time
|
||||
|
@ -254,7 +254,7 @@ VideoData* nsBuiltinDecoderReader::FindStartTime(PRInt64& aOutStartTime)
|
||||
}
|
||||
}
|
||||
|
||||
PRInt64 startTime = PR_MIN(videoStartTime, audioStartTime);
|
||||
PRInt64 startTime = NS_MIN(videoStartTime, audioStartTime);
|
||||
if (startTime != PR_INT64_MAX) {
|
||||
aOutStartTime = startTime;
|
||||
}
|
||||
|
@ -818,14 +818,14 @@ nsMediaCache::FindReusableBlock(TimeStamp aNow,
|
||||
{
|
||||
mReentrantMonitor.AssertCurrentThreadIn();
|
||||
|
||||
PRUint32 length = PR_MIN(PRUint32(aMaxSearchBlockIndex), mIndex.Length());
|
||||
PRUint32 length = NS_MIN(PRUint32(aMaxSearchBlockIndex), mIndex.Length());
|
||||
|
||||
if (aForStream && aForStreamBlock > 0 &&
|
||||
PRUint32(aForStreamBlock) <= aForStream->mBlocks.Length()) {
|
||||
PRInt32 prevCacheBlock = aForStream->mBlocks[aForStreamBlock - 1];
|
||||
if (prevCacheBlock >= 0) {
|
||||
PRUint32 freeBlockScanEnd =
|
||||
PR_MIN(length, prevCacheBlock + FREE_BLOCK_SCAN_LIMIT);
|
||||
NS_MIN(length, prevCacheBlock + FREE_BLOCK_SCAN_LIMIT);
|
||||
for (PRUint32 i = prevCacheBlock; i < freeBlockScanEnd; ++i) {
|
||||
if (IsBlockFree(i))
|
||||
return i;
|
||||
@ -1046,7 +1046,7 @@ nsMediaCache::PredictNextUse(TimeStamp aNow, PRInt32 aBlock)
|
||||
PRInt64 millisecondsAhead =
|
||||
bytesAhead*1000/bo->mStream->mPlaybackBytesPerSecond;
|
||||
prediction = TimeDuration::FromMilliseconds(
|
||||
PR_MIN(millisecondsAhead, PR_INT32_MAX));
|
||||
NS_MIN<PRInt64>(millisecondsAhead, PR_INT32_MAX));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -1074,7 +1074,7 @@ nsMediaCache::PredictNextUseForIncomingData(nsMediaCacheStream* aStream)
|
||||
return TimeDuration(0);
|
||||
PRInt64 millisecondsAhead = bytesAhead*1000/aStream->mPlaybackBytesPerSecond;
|
||||
return TimeDuration::FromMilliseconds(
|
||||
PR_MIN(millisecondsAhead, PR_INT32_MAX));
|
||||
NS_MIN<PRInt64>(millisecondsAhead, PR_INT32_MAX));
|
||||
}
|
||||
|
||||
enum StreamAction { NONE, SEEK, RESUME, SUSPEND };
|
||||
@ -1124,7 +1124,7 @@ nsMediaCache::Update()
|
||||
continue;
|
||||
}
|
||||
TimeDuration predictedUse = PredictNextUse(now, blockIndex);
|
||||
latestPredictedUseForOverflow = PR_MAX(latestPredictedUseForOverflow, predictedUse);
|
||||
latestPredictedUseForOverflow = NS_MAX(latestPredictedUseForOverflow, predictedUse);
|
||||
}
|
||||
|
||||
// Now try to move overflowing blocks to the main part of the cache.
|
||||
@ -1649,7 +1649,7 @@ nsMediaCache::NoteSeek(nsMediaCacheStream* aStream, PRInt64 aOldOffset)
|
||||
// be converted.
|
||||
PRInt32 blockIndex = aOldOffset/BLOCK_SIZE;
|
||||
PRInt32 endIndex =
|
||||
PR_MIN((aStream->mStreamOffset + BLOCK_SIZE - 1)/BLOCK_SIZE,
|
||||
NS_MIN<PRInt64>((aStream->mStreamOffset + BLOCK_SIZE - 1)/BLOCK_SIZE,
|
||||
aStream->mBlocks.Length());
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
while (blockIndex < endIndex) {
|
||||
@ -1669,7 +1669,7 @@ nsMediaCache::NoteSeek(nsMediaCacheStream* aStream, PRInt64 aOldOffset)
|
||||
PRInt32 blockIndex =
|
||||
(aStream->mStreamOffset + BLOCK_SIZE - 1)/BLOCK_SIZE;
|
||||
PRInt32 endIndex =
|
||||
PR_MIN((aOldOffset + BLOCK_SIZE - 1)/BLOCK_SIZE,
|
||||
NS_MIN<PRInt64>((aOldOffset + BLOCK_SIZE - 1)/BLOCK_SIZE,
|
||||
aStream->mBlocks.Length());
|
||||
while (blockIndex < endIndex) {
|
||||
PRInt32 cacheBlockIndex = aStream->mBlocks[endIndex - 1];
|
||||
@ -1713,7 +1713,7 @@ nsMediaCacheStream::NotifyDataStarted(PRInt64 aOffset)
|
||||
if (mStreamLength >= 0) {
|
||||
// If we started reading at a certain offset, then for sure
|
||||
// the stream is at least that long.
|
||||
mStreamLength = PR_MAX(mStreamLength, mChannelOffset);
|
||||
mStreamLength = NS_MAX(mStreamLength, mChannelOffset);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1768,7 +1768,7 @@ nsMediaCacheStream::NotifyDataReceived(PRInt64 aSize, const char* aData,
|
||||
while (size > 0) {
|
||||
PRUint32 blockIndex = mChannelOffset/BLOCK_SIZE;
|
||||
PRInt32 blockOffset = PRInt32(mChannelOffset - blockIndex*BLOCK_SIZE);
|
||||
PRInt32 chunkSize = PRInt32(PR_MIN(BLOCK_SIZE - blockOffset, size));
|
||||
PRInt32 chunkSize = NS_MIN<PRInt64>(BLOCK_SIZE - blockOffset, size);
|
||||
|
||||
// This gets set to something non-null if we have a whole block
|
||||
// of data to write to the cache
|
||||
@ -1809,7 +1809,7 @@ nsMediaCacheStream::NotifyDataReceived(PRInt64 aSize, const char* aData,
|
||||
while (nsMediaCacheStream* stream = iter.Next()) {
|
||||
if (stream->mStreamLength >= 0) {
|
||||
// The stream is at least as long as what we've read
|
||||
stream->mStreamLength = PR_MAX(stream->mStreamLength, mChannelOffset);
|
||||
stream->mStreamLength = NS_MAX(stream->mStreamLength, mChannelOffset);
|
||||
}
|
||||
stream->UpdatePrincipal(aPrincipal);
|
||||
stream->mClient->CacheClientNotifyDataReceived();
|
||||
@ -1975,9 +1975,9 @@ nsMediaCacheStream::GetCachedDataEndInternal(PRInt64 aOffset)
|
||||
if (mStreamLength >= 0) {
|
||||
// The last block in the cache may only be partially valid, so limit
|
||||
// the cached range to the stream length
|
||||
result = PR_MIN(result, mStreamLength);
|
||||
result = NS_MIN(result, mStreamLength);
|
||||
}
|
||||
return PR_MAX(result, aOffset);
|
||||
return NS_MAX(result, aOffset);
|
||||
}
|
||||
|
||||
PRInt64
|
||||
@ -2106,7 +2106,7 @@ nsMediaCacheStream::Read(char* aBuffer, PRUint32 aCount, PRUint32* aBytes)
|
||||
PRUint32 streamBlock = PRUint32(mStreamOffset/BLOCK_SIZE);
|
||||
PRUint32 offsetInStreamBlock =
|
||||
PRUint32(mStreamOffset - streamBlock*BLOCK_SIZE);
|
||||
PRInt32 size = PR_MIN(aCount - count, BLOCK_SIZE - offsetInStreamBlock);
|
||||
PRInt32 size = NS_MIN(aCount - count, BLOCK_SIZE - offsetInStreamBlock);
|
||||
|
||||
if (mStreamLength >= 0) {
|
||||
// Don't try to read beyond the end of the stream
|
||||
@ -2115,7 +2115,7 @@ nsMediaCacheStream::Read(char* aBuffer, PRUint32 aCount, PRUint32* aBytes)
|
||||
// Get out of here and return NS_OK
|
||||
break;
|
||||
}
|
||||
size = PR_MIN(size, PRInt32(bytesRemaining));
|
||||
size = NS_MIN(size, PRInt32(bytesRemaining));
|
||||
}
|
||||
|
||||
PRInt32 bytes;
|
||||
@ -2125,7 +2125,7 @@ nsMediaCacheStream::Read(char* aBuffer, PRUint32 aCount, PRUint32* aBytes)
|
||||
// We can just use the data in mPartialBlockBuffer. In fact we should
|
||||
// use it rather than waiting for the block to fill and land in
|
||||
// the cache.
|
||||
bytes = PR_MIN(size, mChannelOffset - mStreamOffset);
|
||||
bytes = NS_MIN<PRInt64>(size, mChannelOffset - mStreamOffset);
|
||||
memcpy(aBuffer + count,
|
||||
reinterpret_cast<char*>(mPartialBlockBuffer) + offsetInStreamBlock, bytes);
|
||||
if (mCurrentMode == MODE_METADATA) {
|
||||
@ -2192,7 +2192,7 @@ nsMediaCacheStream::ReadFromCache(char* aBuffer,
|
||||
PRUint32 streamBlock = PRUint32(streamOffset/BLOCK_SIZE);
|
||||
PRUint32 offsetInStreamBlock =
|
||||
PRUint32(streamOffset - streamBlock*BLOCK_SIZE);
|
||||
PRInt32 size = PR_MIN(aCount - count, BLOCK_SIZE - offsetInStreamBlock);
|
||||
PRInt32 size = NS_MIN<PRInt64>(aCount - count, BLOCK_SIZE - offsetInStreamBlock);
|
||||
|
||||
if (mStreamLength >= 0) {
|
||||
// Don't try to read beyond the end of the stream
|
||||
@ -2200,7 +2200,7 @@ nsMediaCacheStream::ReadFromCache(char* aBuffer,
|
||||
if (bytesRemaining <= 0) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
size = PR_MIN(size, PRInt32(bytesRemaining));
|
||||
size = NS_MIN(size, PRInt32(bytesRemaining));
|
||||
}
|
||||
|
||||
PRInt32 bytes;
|
||||
@ -2210,7 +2210,7 @@ nsMediaCacheStream::ReadFromCache(char* aBuffer,
|
||||
// We can just use the data in mPartialBlockBuffer. In fact we should
|
||||
// use it rather than waiting for the block to fill and land in
|
||||
// the cache.
|
||||
bytes = PR_MIN(size, mChannelOffset - streamOffset);
|
||||
bytes = NS_MIN<PRInt64>(size, mChannelOffset - streamOffset);
|
||||
memcpy(aBuffer + count,
|
||||
reinterpret_cast<char*>(mPartialBlockBuffer) + offsetInStreamBlock, bytes);
|
||||
} else {
|
||||
|
@ -938,7 +938,7 @@ public:
|
||||
{
|
||||
return (aOffset < mSize) ? aOffset : -1;
|
||||
}
|
||||
virtual PRInt64 GetCachedDataEnd(PRInt64 aOffset) { return PR_MAX(aOffset, mSize); }
|
||||
virtual PRInt64 GetCachedDataEnd(PRInt64 aOffset) { return NS_MAX(aOffset, mSize); }
|
||||
virtual PRBool IsDataCachedToEndOfStream(PRInt64 aOffset) { return PR_TRUE; }
|
||||
virtual PRBool IsSuspendedByCache() { return PR_FALSE; }
|
||||
virtual PRBool IsSuspended() { return PR_FALSE; }
|
||||
|
@ -579,7 +579,7 @@ nsSMILAnimationController::DoMilestoneSamples()
|
||||
// Because we're only performing this clamping at the last moment, the
|
||||
// animations will still all get sampled in the correct order and
|
||||
// dependencies will be appropriately resolved.
|
||||
sampleTime = PR_MAX(nextMilestone.mTime, sampleTime);
|
||||
sampleTime = NS_MAX(nextMilestone.mTime, sampleTime);
|
||||
|
||||
for (PRUint32 i = 0; i < length; ++i) {
|
||||
nsISMILAnimationElement* elem = params.mElements[i].get();
|
||||
@ -596,7 +596,7 @@ nsSMILAnimationController::DoMilestoneSamples()
|
||||
continue;
|
||||
|
||||
// Clamp the converted container time to non-negative values.
|
||||
nsSMILTime containerTime = PR_MAX(0, containerTimeValue.GetMillis());
|
||||
nsSMILTime containerTime = NS_MAX<nsSMILTime>(0, containerTimeValue.GetMillis());
|
||||
|
||||
if (nextMilestone.mIsEnd) {
|
||||
elem->TimedElement().SampleEndAt(containerTime);
|
||||
|
@ -149,7 +149,7 @@ nsSMILTimeContainer::SetCurrentTime(nsSMILTime aSeekTo)
|
||||
{
|
||||
// SVG 1.1 doesn't specify what to do for negative times so we adopt SVGT1.2's
|
||||
// behaviour of clamping negative times to 0.
|
||||
aSeekTo = PR_MAX(0, aSeekTo);
|
||||
aSeekTo = NS_MAX<nsSMILTime>(0, aSeekTo);
|
||||
|
||||
// The following behaviour is consistent with:
|
||||
// http://www.w3.org/2003/01/REC-SVG11-20030114-errata
|
||||
|
@ -261,7 +261,7 @@ void Double::toString(double aValue, nsAString& aDest)
|
||||
}
|
||||
}
|
||||
// mantissa
|
||||
int firstlen = PR_MIN(intDigits, endp - buf);
|
||||
int firstlen = NS_MIN<size_t>(intDigits, endp - buf);
|
||||
for (i = 0; i < firstlen; i++) {
|
||||
*dest = buf[i]; ++dest;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ public:
|
||||
|
||||
void write(const PRUnichar* aSource, PRUint32 aSourceLength)
|
||||
{
|
||||
PRUint32 len = PR_MIN(PRUint32(mIter.size_forward()), aSourceLength);
|
||||
PRUint32 len = NS_MIN(PRUint32(mIter.size_forward()), aSourceLength);
|
||||
PRUnichar* cp = mIter.get();
|
||||
const PRUnichar* end = aSource + len;
|
||||
while (aSource != end) {
|
||||
|
@ -712,7 +712,7 @@ txXPathNodeUtils::comparePosition(const txXPathNode& aNode,
|
||||
PRInt32 otherTotal = otherParents.Length() - 1;
|
||||
NS_ASSERTION(total != otherTotal, "Can't have same number of parents");
|
||||
|
||||
PRInt32 lastIndex = PR_MIN(total, otherTotal);
|
||||
PRInt32 lastIndex = NS_MIN(total, otherTotal);
|
||||
PRInt32 i;
|
||||
parent = nsnull;
|
||||
for (i = 0; i <= lastIndex; ++i) {
|
||||
|
@ -552,7 +552,7 @@ PRBool txNodeSet::ensureGrowSize(PRInt32 aSize)
|
||||
|
||||
// This isn't 100% safe. But until someone manages to make a 1gig nodeset
|
||||
// it should be ok.
|
||||
PRInt32 newLength = PR_MAX(oldLength, kTxNodeSetMinSize);
|
||||
PRInt32 newLength = NS_MAX(oldLength, kTxNodeSetMinSize);
|
||||
|
||||
while (newLength < ensureSize) {
|
||||
newLength *= kTxNodeSetGrowFactor;
|
||||
|
@ -684,7 +684,7 @@ txMozillaXMLOutput::createTxWrapper()
|
||||
// The new documentElement should go after the document type.
|
||||
// This is needed for cases when there is no existing
|
||||
// documentElement in the document.
|
||||
rootLocation = PR_MAX(rootLocation, j + 1);
|
||||
rootLocation = NS_MAX(rootLocation, j + 1);
|
||||
#endif
|
||||
++j;
|
||||
}
|
||||
|
@ -1039,7 +1039,7 @@ nsXULElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
|
||||
PRInt32 treeRows;
|
||||
listBox->GetRowCount(&treeRows);
|
||||
if (treeRows > 0) {
|
||||
newCurrentIndex = PR_MIN((treeRows - 1), newCurrentIndex);
|
||||
newCurrentIndex = NS_MIN((treeRows - 1), newCurrentIndex);
|
||||
nsCOMPtr<nsIDOMElement> newCurrentItem;
|
||||
listBox->GetItemAtIndex(newCurrentIndex, getter_AddRefs(newCurrentItem));
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> xulCurItem = do_QueryInterface(newCurrentItem);
|
||||
|
@ -315,7 +315,7 @@ nsMorkReader::ParseMap(const nsCSubstring &aLine, StringMap *aMap)
|
||||
}
|
||||
++idx;
|
||||
}
|
||||
PRUint32 tokenEnd = PR_MIN(idx, len);
|
||||
PRUint32 tokenEnd = NS_MIN(idx, len);
|
||||
++idx;
|
||||
|
||||
nsCString value;
|
||||
@ -463,7 +463,7 @@ nsMorkReader::ParseTable(const nsCSubstring &aLine, const IndexMap &aColumnMap)
|
||||
++idx;
|
||||
}
|
||||
|
||||
tokenEnd = PR_MIN(idx, len);
|
||||
tokenEnd = NS_MIN(idx, len);
|
||||
|
||||
nsCAutoString column;
|
||||
const nsCSubstring &colValue =
|
||||
@ -496,7 +496,7 @@ nsMorkReader::ParseTable(const nsCSubstring &aLine, const IndexMap &aColumnMap)
|
||||
}
|
||||
++idx;
|
||||
}
|
||||
tokenEnd = PR_MIN(idx, len);
|
||||
tokenEnd = NS_MIN(idx, len);
|
||||
++idx;
|
||||
|
||||
const nsCSubstring &value =
|
||||
|
@ -1003,7 +1003,7 @@ nsSHistory::EvictGlobalContentViewer()
|
||||
// This SHEntry has a ContentViewer, so check how far away it is from
|
||||
// the currently used SHEntry within this SHistory object
|
||||
if (viewer) {
|
||||
PRInt32 distance = PR_ABS(shist->mIndex - i);
|
||||
PRInt32 distance = NS_ABS(shist->mIndex - i);
|
||||
|
||||
#ifdef DEBUG_PAGE_CACHE
|
||||
printf("Has a cached content viewer: %s\n", spec.get());
|
||||
@ -1213,7 +1213,7 @@ PRBool IsSameTree(nsISHEntry* aEntry1, nsISHEntry* aEntry2)
|
||||
container1->GetChildCount(&count1);
|
||||
container2->GetChildCount(&count2);
|
||||
// We allow null entries in the end of the child list.
|
||||
PRInt32 count = PR_MAX(count1, count2);
|
||||
PRInt32 count = NS_MAX(count1, count2);
|
||||
for (PRInt32 i = 0; i < count; ++i) {
|
||||
nsCOMPtr<nsISHEntry> child1, child2;
|
||||
container1->GetChildAt(i, getter_AddRefs(child1));
|
||||
|
@ -627,7 +627,7 @@ IDBFactory::SetCurrentDatabase(IDBDatabase* aDatabase)
|
||||
PRUint32
|
||||
IDBFactory::GetIndexedDBQuota()
|
||||
{
|
||||
return PRUint32(PR_MAX(gIndexedDBQuota, 0));
|
||||
return PRUint32(NS_MAX(gIndexedDBQuota, 0));
|
||||
}
|
||||
|
||||
// static
|
||||
@ -983,9 +983,9 @@ OpenDatabaseHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
|
||||
nsAutoPtr<ObjectStoreInfo>& objectStoreInfo = mObjectStores[i];
|
||||
for (PRUint32 j = 0; j < objectStoreInfo->indexes.Length(); j++) {
|
||||
IndexInfo& indexInfo = objectStoreInfo->indexes[j];
|
||||
mLastIndexId = PR_MAX(indexInfo.id, mLastIndexId);
|
||||
mLastIndexId = NS_MAX(indexInfo.id, mLastIndexId);
|
||||
}
|
||||
mLastObjectStoreId = PR_MAX(objectStoreInfo->id, mLastObjectStoreId);
|
||||
mLastObjectStoreId = NS_MAX(objectStoreInfo->id, mLastObjectStoreId);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -400,7 +400,7 @@ TabParent::HandleQueryContentEvent(nsQueryContentEvent& aEvent)
|
||||
{
|
||||
case NS_QUERY_SELECTED_TEXT:
|
||||
{
|
||||
aEvent.mReply.mOffset = PR_MIN(mIMESelectionAnchor, mIMESelectionFocus);
|
||||
aEvent.mReply.mOffset = NS_MIN(mIMESelectionAnchor, mIMESelectionFocus);
|
||||
if (mIMESelectionAnchor == mIMESelectionFocus) {
|
||||
aEvent.mReply.mString.Truncate(0);
|
||||
} else {
|
||||
@ -446,7 +446,7 @@ bool
|
||||
TabParent::SendCompositionEvent(nsCompositionEvent& event)
|
||||
{
|
||||
mIMEComposing = event.message == NS_COMPOSITION_START;
|
||||
mIMECompositionStart = PR_MIN(mIMESelectionAnchor, mIMESelectionFocus);
|
||||
mIMECompositionStart = NS_MIN(mIMESelectionAnchor, mIMESelectionFocus);
|
||||
if (mIMECompositionEnding)
|
||||
return true;
|
||||
event.seqno = ++mIMESeqno;
|
||||
@ -471,7 +471,7 @@ TabParent::SendTextEvent(nsTextEvent& event)
|
||||
// We must be able to simulate the selection because
|
||||
// we might not receive selection updates in time
|
||||
if (!mIMEComposing) {
|
||||
mIMECompositionStart = PR_MIN(mIMESelectionAnchor, mIMESelectionFocus);
|
||||
mIMECompositionStart = NS_MIN(mIMESelectionAnchor, mIMESelectionFocus);
|
||||
}
|
||||
mIMESelectionAnchor = mIMESelectionFocus =
|
||||
mIMECompositionStart + event.theText.Length();
|
||||
|
@ -2023,7 +2023,7 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection,
|
||||
res = nsWSRunObject::PrepareToDeleteRange(mHTMLEditor, address_of(visNode), &so, address_of(visNode), &eo);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
nsCOMPtr<nsIDOMCharacterData> nodeAsText(do_QueryInterface(visNode));
|
||||
res = mHTMLEditor->DeleteText(nodeAsText, NS_MIN(so, eo), PR_ABS(eo - so));
|
||||
res = mHTMLEditor->DeleteText(nodeAsText, NS_MIN(so, eo), NS_ABS(eo - so));
|
||||
*aHandled = PR_TRUE;
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
res = InsertBRIfNeeded(aSelection);
|
||||
|
@ -927,8 +927,8 @@ nsHTMLEditor::MouseMove(nsIDOMEvent* aMouseEvent)
|
||||
look->GetMetric(nsILookAndFeel::eMetric_DragThresholdX, xThreshold);
|
||||
look->GetMetric(nsILookAndFeel::eMetric_DragThresholdY, yThreshold);
|
||||
|
||||
if (PR_ABS(clientX - mOriginalX ) * 2 >= xThreshold ||
|
||||
PR_ABS(clientY - mOriginalY ) * 2 >= yThreshold) {
|
||||
if (NS_ABS(clientX - mOriginalX ) * 2 >= xThreshold ||
|
||||
NS_ABS(clientY - mOriginalY ) * 2 >= yThreshold) {
|
||||
mGrabberClicked = PR_FALSE;
|
||||
StartMoving(nsnull);
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ nsGnomeVFSInputStream::DoRead(char *aBuf, PRUint32 aCount, PRUint32 *aCountRead)
|
||||
PRUint32 bufLen = mDirBuf.Length() - mDirBufCursor;
|
||||
if (bufLen)
|
||||
{
|
||||
PRUint32 n = PR_MIN(bufLen, aCount);
|
||||
PRUint32 n = NS_MIN(bufLen, aCount);
|
||||
memcpy(aBuf, mDirBuf.get() + mDirBufCursor, n);
|
||||
*aCountRead += n;
|
||||
aBuf += n;
|
||||
|
@ -137,7 +137,7 @@ nsAutoConfig::OnDataAvailable(nsIRequest *request,
|
||||
char buf[1024];
|
||||
|
||||
while (aLength) {
|
||||
size = PR_MIN(aLength, sizeof(buf));
|
||||
size = NS_MIN<size_t>(aLength, sizeof(buf));
|
||||
rv = aIStream->Read(buf, size, &amt);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -348,11 +348,11 @@ SpreadHorizontal(unsigned char* aInput,
|
||||
break;
|
||||
}
|
||||
|
||||
PRInt32 sMin = PR_MAX(x - aRadius, 0);
|
||||
PRInt32 sMax = PR_MIN(x + aRadius, aWidth - 1);
|
||||
PRInt32 sMin = NS_MAX(x - aRadius, 0);
|
||||
PRInt32 sMax = NS_MIN(x + aRadius, aWidth - 1);
|
||||
PRInt32 v = 0;
|
||||
for (PRInt32 s = sMin; s <= sMax; ++s) {
|
||||
v = PR_MAX(v, aInput[aStride * y + s]);
|
||||
v = NS_MAX<PRInt32>(v, aInput[aStride * y + s]);
|
||||
}
|
||||
aOutput[aStride * y + x] = v;
|
||||
}
|
||||
@ -393,11 +393,11 @@ SpreadVertical(unsigned char* aInput,
|
||||
break;
|
||||
}
|
||||
|
||||
PRInt32 sMin = PR_MAX(y - aRadius, 0);
|
||||
PRInt32 sMax = PR_MIN(y + aRadius, aRows - 1);
|
||||
PRInt32 sMin = NS_MAX(y - aRadius, 0);
|
||||
PRInt32 sMax = NS_MIN(y + aRadius, aRows - 1);
|
||||
PRInt32 v = 0;
|
||||
for (PRInt32 s = sMin; s <= sMax; ++s) {
|
||||
v = PR_MAX(v, aInput[aStride * s + x]);
|
||||
v = NS_MAX<PRInt32>(v, aInput[aStride * s + x]);
|
||||
}
|
||||
aOutput[aStride * y + x] = v;
|
||||
}
|
||||
|
@ -398,10 +398,10 @@ gfxContext::UserToDevice(const gfxRect& rect) const
|
||||
ymax = ymin;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
cairo_user_to_device(mCairo, &x[i], &y[i]);
|
||||
xmin = PR_MIN(xmin, x[i]);
|
||||
xmax = PR_MAX(xmax, x[i]);
|
||||
ymin = PR_MIN(ymin, y[i]);
|
||||
ymax = PR_MAX(ymax, y[i]);
|
||||
xmin = NS_MIN(xmin, x[i]);
|
||||
xmax = NS_MAX(xmax, x[i]);
|
||||
ymin = NS_MIN(ymin, y[i]);
|
||||
ymax = NS_MAX(ymax, y[i]);
|
||||
}
|
||||
|
||||
return gfxRect(xmin, ymin, xmax - xmin, ymax - ymin);
|
||||
|
@ -39,6 +39,7 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "prmem.h"
|
||||
#include "nsString.h"
|
||||
#include "nsBidiUtils.h"
|
||||
@ -378,7 +379,7 @@ gfxCoreTextShaper::SetGlyphsFromRun(gfxTextRun *aTextRun,
|
||||
// find the maximum glyph index covered by the clump so far
|
||||
for (PRInt32 i = charStart; i != charEnd; i += direction) {
|
||||
if (charToGlyph[i] != NO_GLYPH) {
|
||||
glyphEnd = PR_MAX(glyphEnd, charToGlyph[i] + 1); // update extent of glyph range
|
||||
glyphEnd = NS_MAX(glyphEnd, charToGlyph[i] + 1); // update extent of glyph range
|
||||
}
|
||||
}
|
||||
|
||||
@ -453,8 +454,8 @@ gfxCoreTextShaper::SetGlyphsFromRun(gfxTextRun *aTextRun,
|
||||
continue;
|
||||
}
|
||||
// Ensure we won't try to go beyond the valid length of the textRun's text
|
||||
baseCharIndex = PR_MAX(baseCharIndex, aRunStart);
|
||||
endCharIndex = PR_MIN(endCharIndex, aRunStart + aRunLength);
|
||||
baseCharIndex = NS_MAX(baseCharIndex, aRunStart);
|
||||
endCharIndex = NS_MIN(endCharIndex, aRunStart + aRunLength);
|
||||
|
||||
// Now we're ready to set the glyph info in the textRun; measure the glyph width
|
||||
// of the first (perhaps only) glyph, to see if it is "Simple"
|
||||
|
@ -99,7 +99,7 @@ public:
|
||||
mItalic = (aFont->GetStyle() == DWRITE_FONT_STYLE_ITALIC ||
|
||||
aFont->GetStyle() == DWRITE_FONT_STYLE_OBLIQUE);
|
||||
mStretch = FontStretchFromDWriteStretch(aFont->GetStretch());
|
||||
PRUint16 weight = PR_ROUNDUP(aFont->GetWeight() - 50, 100);
|
||||
PRUint16 weight = NS_ROUNDUP(aFont->GetWeight() - 50, 100);
|
||||
|
||||
weight = NS_MAX<PRUint16>(100, weight);
|
||||
weight = NS_MIN<PRUint16>(900, weight);
|
||||
|
@ -70,7 +70,7 @@ ScaleRoundDesignUnits(FT_Short aDesignMetric, FT_Fixed aScale)
|
||||
static void
|
||||
SnapLineToPixels(gfxFloat& aOffset, gfxFloat& aSize)
|
||||
{
|
||||
gfxFloat snappedSize = PR_MAX(NS_floor(aSize + 0.5), 1.0);
|
||||
gfxFloat snappedSize = NS_MAX(NS_floor(aSize + 0.5), 1.0);
|
||||
// Correct offset for change in size
|
||||
gfxFloat offset = aOffset - 0.5 * (aSize - snappedSize);
|
||||
// Snap offset
|
||||
@ -201,10 +201,10 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
|
||||
gfxFloat avgCharWidth =
|
||||
ScaleRoundDesignUnits(os2->xAvgCharWidth, ftMetrics.x_scale);
|
||||
aMetrics->aveCharWidth =
|
||||
PR_MAX(aMetrics->aveCharWidth, avgCharWidth);
|
||||
NS_MAX(aMetrics->aveCharWidth, avgCharWidth);
|
||||
}
|
||||
aMetrics->aveCharWidth =
|
||||
PR_MAX(aMetrics->aveCharWidth, aMetrics->zeroOrAveCharWidth);
|
||||
NS_MAX(aMetrics->aveCharWidth, aMetrics->zeroOrAveCharWidth);
|
||||
if (aMetrics->aveCharWidth == 0.0) {
|
||||
aMetrics->aveCharWidth = aMetrics->spaceWidth;
|
||||
}
|
||||
@ -213,7 +213,7 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
|
||||
}
|
||||
// Apparently hinting can mean that max_advance is not always accurate.
|
||||
aMetrics->maxAdvance =
|
||||
PR_MAX(aMetrics->maxAdvance, aMetrics->aveCharWidth);
|
||||
NS_MAX(aMetrics->maxAdvance, aMetrics->aveCharWidth);
|
||||
|
||||
// gfxFont::Metrics::underlineOffset is the position of the top of the
|
||||
// underline.
|
||||
@ -258,7 +258,7 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
|
||||
if (os2 && os2->ySuperscriptYOffset) {
|
||||
gfxFloat val = ScaleRoundDesignUnits(os2->ySuperscriptYOffset,
|
||||
ftMetrics.y_scale);
|
||||
aMetrics->superscriptOffset = PR_MAX(1.0, val);
|
||||
aMetrics->superscriptOffset = NS_MAX(1.0, val);
|
||||
} else {
|
||||
aMetrics->superscriptOffset = aMetrics->xHeight;
|
||||
}
|
||||
@ -268,7 +268,7 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
|
||||
ftMetrics.y_scale);
|
||||
// some fonts have the incorrect sign.
|
||||
val = fabs(val);
|
||||
aMetrics->subscriptOffset = PR_MAX(1.0, val);
|
||||
aMetrics->subscriptOffset = NS_MAX(1.0, val);
|
||||
} else {
|
||||
aMetrics->subscriptOffset = aMetrics->xHeight;
|
||||
}
|
||||
@ -290,7 +290,7 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
|
||||
|
||||
// Text input boxes currently don't work well with lineHeight
|
||||
// significantly less than maxHeight (with Verdana, for example).
|
||||
lineHeight = NS_floor(PR_MAX(lineHeight, aMetrics->maxHeight) + 0.5);
|
||||
lineHeight = NS_floor(NS_MAX(lineHeight, aMetrics->maxHeight) + 0.5);
|
||||
aMetrics->externalLeading =
|
||||
lineHeight - aMetrics->internalLeading - aMetrics->emHeight;
|
||||
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "gfxTypes.h"
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "prcpucfg.h"
|
||||
|
||||
#include "nsDataHashtable.h"
|
||||
@ -122,7 +123,7 @@ public:
|
||||
// first block, check bits
|
||||
if ((block = mBlocks[startBlock])) {
|
||||
start = aStart;
|
||||
end = PR_MIN(aEnd, ((startBlock+1) << BLOCK_INDEX_SHIFT) - 1);
|
||||
end = NS_MIN(aEnd, ((startBlock+1) << BLOCK_INDEX_SHIFT) - 1);
|
||||
for (i = start; i <= end; i++) {
|
||||
if ((block->mBits[(i>>3) & (BLOCK_SIZE - 1)]) & (1 << (i & 0x7)))
|
||||
return PR_TRUE;
|
||||
@ -210,7 +211,7 @@ public:
|
||||
}
|
||||
|
||||
const PRUint32 start = aStart > blockFirstBit ? aStart - blockFirstBit : 0;
|
||||
const PRUint32 end = PR_MIN(aEnd - blockFirstBit, BLOCK_SIZE_BITS - 1);
|
||||
const PRUint32 end = NS_MIN<PRUint32>(aEnd - blockFirstBit, BLOCK_SIZE_BITS - 1);
|
||||
|
||||
for (PRUint32 bit = start; bit <= end; ++bit) {
|
||||
block->mBits[bit>>3] |= 1 << (bit & 0x7);
|
||||
@ -254,7 +255,7 @@ public:
|
||||
}
|
||||
|
||||
const PRUint32 start = aStart > blockFirstBit ? aStart - blockFirstBit : 0;
|
||||
const PRUint32 end = PR_MIN(aEnd - blockFirstBit, BLOCK_SIZE_BITS - 1);
|
||||
const PRUint32 end = NS_MIN<PRUint32>(aEnd - blockFirstBit, BLOCK_SIZE_BITS - 1);
|
||||
|
||||
for (PRUint32 bit = start; bit <= end; ++bit) {
|
||||
block->mBits[bit>>3] &= ~(1 << (bit & 0x7));
|
||||
|
@ -374,7 +374,7 @@ gfxGDIFont::Initialize()
|
||||
mMetrics->maxAscent = metrics.tmAscent;
|
||||
mMetrics->maxDescent = metrics.tmDescent;
|
||||
mMetrics->maxAdvance = metrics.tmMaxCharWidth;
|
||||
mMetrics->aveCharWidth = PR_MAX(1, metrics.tmAveCharWidth);
|
||||
mMetrics->aveCharWidth = NS_MAX<gfxFloat>(1, metrics.tmAveCharWidth);
|
||||
// The font is monospace when TMPF_FIXED_PITCH is *not* set!
|
||||
// See http://msdn2.microsoft.com/en-us/library/ms534202(VS.85).aspx
|
||||
if (!(metrics.tmPitchAndFamily & TMPF_FIXED_PITCH)) {
|
||||
|
@ -434,7 +434,7 @@ GDIFontEntry::InitLogFont(const nsAString& aName,
|
||||
mLogFont.lfItalic = mItalic;
|
||||
mLogFont.lfWeight = mWeight;
|
||||
|
||||
int len = PR_MIN(aName.Length(), LF_FACESIZE - 1);
|
||||
int len = NS_MIN<int>(aName.Length(), LF_FACESIZE - 1);
|
||||
memcpy(&mLogFont.lfFaceName, nsPromiseFlatString(aName).get(), len * 2);
|
||||
mLogFont.lfFaceName[len] = '\0';
|
||||
}
|
||||
@ -468,7 +468,7 @@ GDIFontFamily::FamilyAddStylesProc(const ENUMLOGFONTEXW *lpelfe,
|
||||
GDIFontFamily *ff = reinterpret_cast<GDIFontFamily*>(data);
|
||||
|
||||
// Some fonts claim to support things > 900, but we don't so clamp the sizes
|
||||
logFont.lfWeight = PR_MAX(PR_MIN(logFont.lfWeight, 900), 100);
|
||||
logFont.lfWeight = NS_MAX<LONG>(NS_MIN<LONG>(logFont.lfWeight, 900), 100);
|
||||
|
||||
gfxWindowsFontType feType = GDIFontEntry::DetermineFontType(metrics, fontType);
|
||||
|
||||
@ -551,7 +551,7 @@ GDIFontFamily::FindStyleVariations()
|
||||
memset(&logFont, 0, sizeof(LOGFONTW));
|
||||
logFont.lfCharSet = DEFAULT_CHARSET;
|
||||
logFont.lfPitchAndFamily = 0;
|
||||
PRUint32 l = PR_MIN(mName.Length(), LF_FACESIZE - 1);
|
||||
PRUint32 l = NS_MIN<PRUint32>(mName.Length(), LF_FACESIZE - 1);
|
||||
memcpy(logFont.lfFaceName,
|
||||
nsPromiseFlatString(mName).get(),
|
||||
l * sizeof(PRUnichar));
|
||||
@ -820,7 +820,7 @@ public:
|
||||
|
||||
while (mCurrentChunk < mNumChunks && bytesLeft) {
|
||||
FontDataChunk& currentChunk = mDataChunks[mCurrentChunk];
|
||||
PRUint32 bytesToCopy = PR_MIN(bytesLeft,
|
||||
PRUint32 bytesToCopy = NS_MIN(bytesLeft,
|
||||
currentChunk.mLength - mChunkOffset);
|
||||
memcpy(out, currentChunk.mData + mChunkOffset, bytesToCopy);
|
||||
bytesLeft -= bytesToCopy;
|
||||
@ -888,7 +888,7 @@ gfxGDIFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
PRUint32 eotlen;
|
||||
|
||||
isEmbedded = PR_TRUE;
|
||||
PRUint32 nameLen = PR_MIN(uniqueName.Length(), LF_FACESIZE - 1);
|
||||
PRUint32 nameLen = NS_MIN<PRUint32>(uniqueName.Length(), LF_FACESIZE - 1);
|
||||
nsPromiseFlatString fontName(Substring(uniqueName, 0, nameLen));
|
||||
|
||||
FontDataOverlay overlayNameData = {0, 0, 0};
|
||||
|
@ -37,6 +37,7 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "prmem.h"
|
||||
#include "nsString.h"
|
||||
#include "nsBidiUtils.h"
|
||||
@ -335,7 +336,7 @@ GetKernValueFmt0(const void* aSubtable,
|
||||
if (aIsOverride) {
|
||||
aValue = PRInt16(lo->value);
|
||||
} else if (aIsMinimum) {
|
||||
aValue = PR_MAX(aValue, PRInt16(lo->value));
|
||||
aValue = NS_MAX(aValue, PRInt32(lo->value));
|
||||
} else {
|
||||
aValue += PRInt16(lo->value);
|
||||
}
|
||||
@ -1047,7 +1048,7 @@ gfxHarfBuzzShaper::SetGlyphsFromRun(gfxContext *aContext,
|
||||
// find the maximum glyph index covered by the clump so far
|
||||
for (PRInt32 i = charStart; i < charEnd; ++i) {
|
||||
if (charToGlyph[i] != NO_GLYPH) {
|
||||
glyphEnd = PR_MAX(glyphEnd, charToGlyph[i] + 1);
|
||||
glyphEnd = NS_MAX(glyphEnd, charToGlyph[i] + 1);
|
||||
// update extent of glyph range
|
||||
}
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ gfxImageSurface::CopyFrom(gfxImageSurface *other)
|
||||
if (other->mStride == mStride) {
|
||||
memcpy (mData, other->mData, mStride * mSize.height);
|
||||
} else {
|
||||
int lineSize = PR_MIN(other->mStride, mStride);
|
||||
int lineSize = NS_MIN(other->mStride, mStride);
|
||||
for (int i = 0; i < mSize.height; i++) {
|
||||
unsigned char *src = other->mData + other->mStride * i;
|
||||
unsigned char *dst = mData + mStride * i;
|
||||
|
@ -228,7 +228,7 @@ gfxMacFont::InitMetrics()
|
||||
return;
|
||||
}
|
||||
|
||||
mAdjustedSize = PR_MAX(mStyle.size, 1.0f);
|
||||
mAdjustedSize = NS_MAX(mStyle.size, 1.0);
|
||||
mFUnitsConvFactor = mAdjustedSize / upem;
|
||||
|
||||
// For CFF fonts, when scaling values read from CGFont* APIs, we need to
|
||||
|
@ -130,7 +130,7 @@ static void FillMetricsDefaults(gfxFont::Metrics *aMetrics)
|
||||
// line as close to the original position as possible.
|
||||
static void SnapLineToPixels(gfxFloat& aOffset, gfxFloat& aSize)
|
||||
{
|
||||
gfxFloat snappedSize = PR_MAX(NS_floor(aSize + 0.5), 1.0);
|
||||
gfxFloat snappedSize = NS_MAX(NS_floor(aSize + 0.5), 1.0);
|
||||
// Correct offset for change in size
|
||||
gfxFloat offset = aOffset - 0.5 * (aSize - snappedSize);
|
||||
// Snap offset
|
||||
@ -240,12 +240,12 @@ const gfxFont::Metrics& gfxOS2Font::GetMetrics()
|
||||
TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(face, ft_sfnt_os2);
|
||||
if (os2 && os2->version != 0xFFFF) { // should be there if not old Mac font
|
||||
// if we are here we can improve the avgCharWidth
|
||||
mMetrics->aveCharWidth = PR_MAX(mMetrics->aveCharWidth,
|
||||
mMetrics->aveCharWidth = NS_MAX(mMetrics->aveCharWidth,
|
||||
os2->xAvgCharWidth * xScale);
|
||||
|
||||
mMetrics->superscriptOffset = PR_MAX(os2->ySuperscriptYOffset * yScale, 1.0);
|
||||
mMetrics->superscriptOffset = NS_MAX(os2->ySuperscriptYOffset * yScale, 1.0);
|
||||
// some fonts have the incorrect sign (from gfxPangoFonts)
|
||||
mMetrics->subscriptOffset = PR_MAX(fabs(os2->ySubscriptYOffset * yScale),
|
||||
mMetrics->subscriptOffset = NS_MAX(fabs(os2->ySubscriptYOffset * yScale),
|
||||
1.0);
|
||||
mMetrics->strikeoutOffset = os2->yStrikeoutPosition * yScale;
|
||||
mMetrics->strikeoutSize = os2->yStrikeoutSize * yScale;
|
||||
@ -267,11 +267,11 @@ const gfxFont::Metrics& gfxOS2Font::GetMetrics()
|
||||
mMetrics->emDescent = -face->descender * yScale;
|
||||
mMetrics->maxHeight = face->height * yScale;
|
||||
// the max units determine frame heights, better be generous
|
||||
mMetrics->maxAscent = PR_MAX(face->bbox.yMax * yScale,
|
||||
mMetrics->maxAscent = NS_MAX(face->bbox.yMax * yScale,
|
||||
mMetrics->emAscent);
|
||||
mMetrics->maxDescent = PR_MAX(-face->bbox.yMin * yScale,
|
||||
mMetrics->maxDescent = NS_MAX(-face->bbox.yMin * yScale,
|
||||
mMetrics->emDescent);
|
||||
mMetrics->maxAdvance = PR_MAX(face->max_advance_width * xScale,
|
||||
mMetrics->maxAdvance = NS_MAX(face->max_advance_width * xScale,
|
||||
mMetrics->aveCharWidth);
|
||||
|
||||
// leadings are not available directly (only for WinFNTs);
|
||||
|
@ -38,6 +38,7 @@
|
||||
#ifndef GFX_RECT_H
|
||||
#define GFX_RECT_H
|
||||
|
||||
#include "nsAlgorithm.h"
|
||||
#include "gfxTypes.h"
|
||||
#include "gfxPoint.h"
|
||||
#include "gfxCore.h"
|
||||
|
@ -240,7 +240,7 @@ gfxSkipCharsBuilder::FlushRun()
|
||||
// Fill in buffer entries starting at mBufferLength, as many as necessary
|
||||
PRUint32 charCount = mRunCharCount;
|
||||
for (;;) {
|
||||
PRUint32 chars = PR_MIN(255, charCount);
|
||||
PRUint32 chars = NS_MIN<PRUint32>(255, charCount);
|
||||
if (!mBuffer.AppendElement(chars)) {
|
||||
mInErrorState = PR_TRUE;
|
||||
return;
|
||||
|
@ -248,7 +248,7 @@ nsConverterInputStream::Fill(nsresult * aErrorCode)
|
||||
++srcConsumed;
|
||||
// XXX this is needed to make sure we don't underrun our buffer;
|
||||
// bug 160784 again
|
||||
srcConsumed = PR_MAX(srcConsumed, 0);
|
||||
srcConsumed = NS_MAX<PRUint32>(srcConsumed, 0);
|
||||
mConverter->Reset();
|
||||
}
|
||||
NS_ASSERTION(srcConsumed <= mByteData->GetLength(),
|
||||
|
@ -35,6 +35,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nsUCSupport.h"
|
||||
#include "nsUTF8ToUnicode.h"
|
||||
#include "mozilla/SSE.h"
|
||||
@ -249,7 +250,7 @@ NS_IMETHODIMP nsUTF8ToUnicode::Convert(const char * aSrc,
|
||||
// When mState is zero we expect either a US-ASCII character or a
|
||||
// multi-octet sequence.
|
||||
if (0 == (0x80 & (*in))) {
|
||||
PRInt32 max_loops = PR_MIN(inend - in, outend - out);
|
||||
PRInt32 max_loops = NS_MIN(inend - in, outend - out);
|
||||
Convert_ascii_run(in, out, max_loops);
|
||||
--in; // match the rest of the cases
|
||||
mBytes = 1;
|
||||
|
@ -37,6 +37,7 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "pratom.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsUCSupport.h"
|
||||
#include "nsUnicodeDecodeHelper.h"
|
||||
@ -106,7 +107,7 @@ nsBufferDecoderSupport::~nsBufferDecoderSupport()
|
||||
|
||||
void nsBufferDecoderSupport::FillBuffer(const char ** aSrc, PRInt32 aSrcLength)
|
||||
{
|
||||
PRInt32 bcr = PR_MIN(mBufferCapacity - mBufferLength, aSrcLength);
|
||||
PRInt32 bcr = NS_MIN(mBufferCapacity - mBufferLength, aSrcLength);
|
||||
memcpy(mBuffer + mBufferLength, *aSrc, bcr);
|
||||
mBufferLength += bcr;
|
||||
(*aSrc) += bcr;
|
||||
|
@ -47,7 +47,7 @@
|
||||
// See http://www.w3.org/TR/AERT#color-contrast
|
||||
#define NS_SUFFICIENT_LUMINOSITY_DIFFERENCE 125000
|
||||
#define NS_LUMINOSITY_DIFFERENCE(a, b) \
|
||||
PR_ABS(NS_GetLuminosity(a) - NS_GetLuminosity(b))
|
||||
NS_ABS(NS_GetLuminosity(a) - NS_GetLuminosity(b))
|
||||
|
||||
// To determine colors based on the background brightness and border color
|
||||
void NS_GetSpecial3DColors(nscolor aResult[2],
|
||||
|
@ -1825,10 +1825,10 @@ ComputeRadialGradientLine(nsPresContext* aPresContext,
|
||||
|
||||
// Compute gradient shape: the x and y radii of an ellipse.
|
||||
double radiusX, radiusY;
|
||||
double leftDistance = PR_ABS(aLineStart->x);
|
||||
double rightDistance = PR_ABS(aBoxSize.width - aLineStart->x);
|
||||
double topDistance = PR_ABS(aLineStart->y);
|
||||
double bottomDistance = PR_ABS(aBoxSize.height - aLineStart->y);
|
||||
double leftDistance = NS_ABS(aLineStart->x);
|
||||
double rightDistance = NS_ABS(aBoxSize.width - aLineStart->x);
|
||||
double topDistance = NS_ABS(aLineStart->y);
|
||||
double bottomDistance = NS_ABS(aBoxSize.height - aLineStart->y);
|
||||
switch (aGradient->mSize) {
|
||||
case NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE:
|
||||
radiusX = NS_MIN(leftDistance, rightDistance);
|
||||
|
@ -888,7 +888,7 @@ IsSizeOK(nsPresContext* aPresContext, nscoord a, nscoord b, PRUint32 aHint)
|
||||
// or in sloppy markups without protective <mrow></mrow>
|
||||
PRBool isNormal =
|
||||
(aHint & NS_STRETCH_NORMAL)
|
||||
&& PRBool(float(PR_ABS(a - b))
|
||||
&& PRBool(float(NS_ABS(a - b))
|
||||
< (1.0f - NS_MATHML_DELIMITER_FACTOR) * float(b));
|
||||
// Nearer: True if 'a' is around max{ +/-10% of 'b' , 'b' - 5pt },
|
||||
// as documented in The TeXbook, Ch.17, p.152.
|
||||
@ -897,7 +897,7 @@ IsSizeOK(nsPresContext* aPresContext, nscoord a, nscoord b, PRUint32 aHint)
|
||||
if (aHint & (NS_STRETCH_NEARER | NS_STRETCH_LARGEOP)) {
|
||||
float c = NS_MAX(float(b) * NS_MATHML_DELIMITER_FACTOR,
|
||||
float(b) - nsPresContext::CSSPointsToAppUnits(NS_MATHML_DELIMITER_SHORTFALL_POINTS));
|
||||
isNearer = PRBool(float(PR_ABS(b - a)) <= (float(b) - c));
|
||||
isNearer = PRBool(float(NS_ABS(b - a)) <= (float(b) - c));
|
||||
}
|
||||
// Smaller: Mainly for transitory use, to compare two candidate
|
||||
// choices
|
||||
@ -924,7 +924,7 @@ IsSizeBetter(nscoord a, nscoord olda, nscoord b, PRUint32 aHint)
|
||||
return (a <= olda) ? (olda > b) : (a <= b);
|
||||
|
||||
// XXXkt prob want log scale here i.e. 1.5 is closer to 1 than 0.5
|
||||
return PR_ABS(a - b) < PR_ABS(olda - b);
|
||||
return NS_ABS(a - b) < NS_ABS(olda - b);
|
||||
}
|
||||
|
||||
// We want to place the glyphs even when they don't fit at their
|
||||
|
@ -282,7 +282,7 @@ nsStyleAnimation::ComputeDistance(nsCSSProperty aProperty,
|
||||
// just like eUnit_Integer.
|
||||
PRInt32 startInt = aStartValue.GetIntValue();
|
||||
PRInt32 endInt = aEndValue.GetIntValue();
|
||||
aDistance = PR_ABS(endInt - startInt);
|
||||
aDistance = NS_ABS(endInt - startInt);
|
||||
return PR_TRUE;
|
||||
}
|
||||
default:
|
||||
@ -293,13 +293,13 @@ nsStyleAnimation::ComputeDistance(nsCSSProperty aProperty,
|
||||
aStartValue.GetIntValue() == NS_STYLE_VISIBILITY_VISIBLE;
|
||||
PRInt32 endVal =
|
||||
aEndValue.GetIntValue() == NS_STYLE_VISIBILITY_VISIBLE;
|
||||
aDistance = PR_ABS(startVal - endVal);
|
||||
aDistance = NS_ABS(startVal - endVal);
|
||||
return PR_TRUE;
|
||||
}
|
||||
case eUnit_Integer: {
|
||||
PRInt32 startInt = aStartValue.GetIntValue();
|
||||
PRInt32 endInt = aEndValue.GetIntValue();
|
||||
aDistance = PR_ABS(endInt - startInt);
|
||||
aDistance = NS_ABS(endInt - startInt);
|
||||
return PR_TRUE;
|
||||
}
|
||||
case eUnit_Coord: {
|
||||
@ -1110,7 +1110,7 @@ DecomposeMatrix(const nsStyleTransformMatrix &aMatrix,
|
||||
XYshear /= scaleY;
|
||||
|
||||
// A*D - B*C should now be 1 or -1
|
||||
NS_ASSERTION(0.99 < PR_ABS(A*D - B*C) && PR_ABS(A*D - B*C) < 1.01,
|
||||
NS_ASSERTION(0.99 < NS_ABS(A*D - B*C) && NS_ABS(A*D - B*C) < 1.01,
|
||||
"determinant should now be 1 or -1");
|
||||
if (A * D < B * C) {
|
||||
A = -A;
|
||||
|
@ -6272,7 +6272,7 @@ BCPaintBorderIterator::SetDamageArea(nsRect aDirtyRect)
|
||||
if (!haveIntersect)
|
||||
return PR_FALSE;
|
||||
mDamageArea = nsRect(startColIndex, startRowIndex,
|
||||
1 + PR_ABS(PRInt32(endColIndex - startColIndex)),
|
||||
1 + NS_ABS(PRInt32(endColIndex - startColIndex)),
|
||||
1 + endRowIndex - startRowIndex);
|
||||
|
||||
Reset();
|
||||
@ -6611,7 +6611,7 @@ BCVerticalSeg::Start(BCPaintBorderIterator& aIter,
|
||||
aIter.mBCData->GetCorner(ownerSide, bevel) : 0;
|
||||
|
||||
PRBool topBevel = (aVerSegWidth > 0) ? bevel : PR_FALSE;
|
||||
BCPixelSize maxHorSegHeight = PR_MAX(aIter.mPrevHorSegHeight, aHorSegHeight);
|
||||
BCPixelSize maxHorSegHeight = NS_MAX(aIter.mPrevHorSegHeight, aHorSegHeight);
|
||||
nscoord offset = CalcVerCornerOffset(ownerSide, cornerSubWidth,
|
||||
maxHorSegHeight, PR_TRUE,
|
||||
topBevel);
|
||||
@ -6673,7 +6673,7 @@ BCVerticalSeg::GetBottomCorner(BCPaintBorderIterator& aIter,
|
||||
cornerSubWidth = aIter.mBCData->GetCorner(ownerSide, bevel);
|
||||
}
|
||||
mIsBottomBevel = (mWidth > 0) ? bevel : PR_FALSE;
|
||||
mBottomHorSegHeight = PR_MAX(aIter.mPrevHorSegHeight, aHorSegHeight);
|
||||
mBottomHorSegHeight = NS_MAX(aIter.mPrevHorSegHeight, aHorSegHeight);
|
||||
mBottomOffset = CalcVerCornerOffset(ownerSide, cornerSubWidth,
|
||||
mBottomHorSegHeight,
|
||||
PR_FALSE, mIsBottomBevel);
|
||||
@ -6815,7 +6815,7 @@ BCHorizontalSeg::Start(BCPaintBorderIterator& aIter,
|
||||
|
||||
PRBool leftBevel = (aHorSegHeight > 0) ? bevel : PR_FALSE;
|
||||
PRInt32 relColIndex = aIter.GetRelativeColIndex();
|
||||
nscoord maxVerSegWidth = PR_MAX(aIter.mVerInfo[relColIndex].mWidth,
|
||||
nscoord maxVerSegWidth = NS_MAX(aIter.mVerInfo[relColIndex].mWidth,
|
||||
aBottomVerSegWidth);
|
||||
nscoord offset = CalcHorCornerOffset(cornerOwnerSide, cornerSubWidth,
|
||||
maxVerSegWidth, PR_TRUE, leftBevel,
|
||||
@ -6855,7 +6855,7 @@ BCHorizontalSeg::GetRightCorner(BCPaintBorderIterator& aIter,
|
||||
|
||||
mIsRightBevel = (mWidth > 0) ? bevel : 0;
|
||||
PRInt32 relColIndex = aIter.GetRelativeColIndex();
|
||||
nscoord verWidth = PR_MAX(aIter.mVerInfo[relColIndex].mWidth, aLeftSegWidth);
|
||||
nscoord verWidth = NS_MAX(aIter.mVerInfo[relColIndex].mWidth, aLeftSegWidth);
|
||||
mEndOffset = CalcHorCornerOffset(ownerSide, cornerSubWidth, verWidth,
|
||||
PR_FALSE, mIsRightBevel, aIter.mTableIsLTR);
|
||||
mLength += mEndOffset;
|
||||
|
@ -1844,7 +1844,7 @@ nsTreeBodyFrame::RowCountChanged(PRInt32 aIndex, PRInt32 aCount)
|
||||
NS_ASSERTION(rowCount == mRowCount, "row count did not change by the amount suggested, check caller");
|
||||
#endif
|
||||
|
||||
PRInt32 count = PR_ABS(aCount);
|
||||
PRInt32 count = NS_ABS(aCount);
|
||||
PRInt32 last = GetLastVisibleRow();
|
||||
if (aIndex >= mTopRowIndex && aIndex <= last)
|
||||
InvalidateRange(aIndex, last);
|
||||
|
@ -424,7 +424,7 @@ nsBMPDecoder::WriteInternal(const char* aBuffer, PRUint32 aCount)
|
||||
// the second byte
|
||||
// Work around bitmaps that specify too many pixels
|
||||
mState = eRLEStateInitial;
|
||||
PRUint32 pixelsNeeded = PR_MIN((PRUint32)(mBIH.width - mCurPos), mStateData);
|
||||
PRUint32 pixelsNeeded = NS_MIN<PRUint32>(mBIH.width - mCurPos, mStateData);
|
||||
if (pixelsNeeded) {
|
||||
PRUint32* d = mImageData + PIXEL_OFFSET(mCurLine, mCurPos);
|
||||
mCurPos += pixelsNeeded;
|
||||
@ -504,7 +504,7 @@ nsBMPDecoder::WriteInternal(const char* aBuffer, PRUint32 aCount)
|
||||
byte = *aBuffer++;
|
||||
aCount--;
|
||||
mState = eRLEStateInitial;
|
||||
mCurLine -= PR_MIN(byte, mCurLine);
|
||||
mCurLine -= NS_MIN<PRInt32>(byte, mCurLine);
|
||||
break;
|
||||
|
||||
case eRLEStateAbsoluteMode: // Absolute Mode
|
||||
|
@ -627,7 +627,7 @@ nsGIFDecoder2::WriteInternal(const char *aBuffer, PRUint32 aCount)
|
||||
(mGIFStruct.bytes_in_hold) ? mGIFStruct.hold : nsnull;
|
||||
if (p) {
|
||||
// Add what we have sofar to the block
|
||||
PRUint32 l = PR_MIN(len, mGIFStruct.bytes_to_consume);
|
||||
PRUint32 l = NS_MIN(len, mGIFStruct.bytes_to_consume);
|
||||
memcpy(p+mGIFStruct.bytes_in_hold, buf, l);
|
||||
|
||||
if (l < mGIFStruct.bytes_to_consume) {
|
||||
|
@ -433,7 +433,7 @@ nsICODecoder::WriteInternal(const char* aBuffer, PRUint32 aCount)
|
||||
}
|
||||
|
||||
while (mCurLine > 0 && aCount > 0) {
|
||||
PRUint32 toCopy = PR_MIN(rowSize - mRowBytes, aCount);
|
||||
PRUint32 toCopy = NS_MIN(rowSize - mRowBytes, aCount);
|
||||
if (toCopy) {
|
||||
memcpy(mRow + mRowBytes, aBuffer, toCopy);
|
||||
aCount -= toCopy;
|
||||
|
@ -133,7 +133,7 @@ nsIconDecoder::WriteInternal(const char *aBuffer, PRUint32 aCount)
|
||||
case iconStateReadPixels:
|
||||
|
||||
// How many bytes are we reading?
|
||||
bytesToRead = PR_MIN(aCount, mPixBytesTotal - mPixBytesRead);
|
||||
bytesToRead = NS_MIN(aCount, mPixBytesTotal - mPixBytesRead);
|
||||
|
||||
// Copy the bytes
|
||||
memcpy(mImageData + mPixBytesRead, aBuffer, bytesToRead);
|
||||
|
@ -306,7 +306,7 @@ nsPNGDecoder::WriteInternal(const char *aBuffer, PRUint32 aCount)
|
||||
return;
|
||||
|
||||
// Read data into our header buffer
|
||||
PRUint32 bytesToRead = PR_MIN(aCount, BYTES_NEEDED_FOR_DIMENSIONS -
|
||||
PRUint32 bytesToRead = NS_MIN(aCount, BYTES_NEEDED_FOR_DIMENSIONS -
|
||||
mHeaderBytesRead);
|
||||
memcpy(mHeaderBuf + mHeaderBytesRead, aBuffer, bytesToRead);
|
||||
mHeaderBytesRead += bytesToRead;
|
||||
|
@ -1924,8 +1924,8 @@ RasterImage::DrawFrameTo(imgFrame *aSrc,
|
||||
|
||||
if (aSrc->GetIsPaletted()) {
|
||||
// Larger than the destination frame, clip it
|
||||
PRInt32 width = PR_MIN(aSrcRect.width, dstRect.width - aSrcRect.x);
|
||||
PRInt32 height = PR_MIN(aSrcRect.height, dstRect.height - aSrcRect.y);
|
||||
PRInt32 width = NS_MIN(aSrcRect.width, dstRect.width - aSrcRect.x);
|
||||
PRInt32 height = NS_MIN(aSrcRect.height, dstRect.height - aSrcRect.y);
|
||||
|
||||
// The clipped image must now fully fit within destination image frame
|
||||
NS_ASSERTION((aSrcRect.x >= 0) && (aSrcRect.y >= 0) &&
|
||||
@ -2577,7 +2577,7 @@ RasterImage::DecodeSomeData(PRUint32 aMaxBytes)
|
||||
|
||||
|
||||
// write the proper amount of data
|
||||
PRUint32 bytesToDecode = PR_MIN(aMaxBytes,
|
||||
PRUint32 bytesToDecode = NS_MIN(aMaxBytes,
|
||||
mSourceData.Length() - mBytesDecoded);
|
||||
nsresult rv = WriteToDecoder(mSourceData.Elements() + mBytesDecoded,
|
||||
bytesToDecode);
|
||||
|
@ -1123,7 +1123,7 @@ NS_IMETHODIMP imgRequest::OnDataAvailable(nsIRequest *aRequest, nsISupports *ctx
|
||||
// its source buffer
|
||||
if (len > 0) {
|
||||
PRUint32 sizeHint = (PRUint32) len;
|
||||
sizeHint = PR_MIN(sizeHint, 20000000); /* Bound by something reasonable */
|
||||
sizeHint = NS_MIN<PRUint32>(sizeHint, 20000000); /* Bound by something reasonable */
|
||||
RasterImage* rasterImage = static_cast<RasterImage*>(mImage.get());
|
||||
rasterImage->SetSourceSizeHint(sizeHint);
|
||||
}
|
||||
|
@ -475,7 +475,7 @@ nsresult PREF_GetCharPref(const char *pref_name, char * return_buffer, int * len
|
||||
*length = PL_strlen(stringVal) + 1;
|
||||
else
|
||||
{
|
||||
PL_strncpy(return_buffer, stringVal, PR_MIN((size_t)*length - 1, PL_strlen(stringVal) + 1));
|
||||
PL_strncpy(return_buffer, stringVal, NS_MIN<size_t>(*length - 1, PL_strlen(stringVal) + 1));
|
||||
return_buffer[*length - 1] = '\0';
|
||||
}
|
||||
rv = NS_OK;
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "mozilla/net/NeckoMessageUtils.h"
|
||||
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nsBufferedStreams.h"
|
||||
#include "nsStreamUtils.h"
|
||||
#include "nsCRT.h"
|
||||
@ -345,7 +346,7 @@ nsBufferedInputStream::ReadSegments(nsWriteSegmentFun writer, void *closure,
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
while (count > 0) {
|
||||
PRUint32 amt = PR_MIN(count, mFillPoint - mCursor);
|
||||
PRUint32 amt = NS_MIN(count, mFillPoint - mCursor);
|
||||
if (amt > 0) {
|
||||
PRUint32 read = 0;
|
||||
rv = writer(this, closure, mBuffer + mCursor, *result, amt, &read);
|
||||
@ -577,7 +578,7 @@ nsBufferedOutputStream::Write(const char *buf, PRUint32 count, PRUint32 *result)
|
||||
nsresult rv = NS_OK;
|
||||
PRUint32 written = 0;
|
||||
while (count > 0) {
|
||||
PRUint32 amt = PR_MIN(count, mBufferSize - mCursor);
|
||||
PRUint32 amt = NS_MIN(count, mBufferSize - mCursor);
|
||||
if (amt > 0) {
|
||||
memcpy(mBuffer + mCursor, buf + written, amt);
|
||||
written += amt;
|
||||
@ -668,7 +669,7 @@ nsBufferedOutputStream::WriteSegments(nsReadSegmentFun reader, void * closure, P
|
||||
*_retval = 0;
|
||||
nsresult rv;
|
||||
while (count > 0) {
|
||||
PRUint32 left = PR_MIN(count, mBufferSize - mCursor);
|
||||
PRUint32 left = NS_MIN(count, mBufferSize - mCursor);
|
||||
if (left == 0) {
|
||||
rv = Flush();
|
||||
if (NS_FAILED(rv))
|
||||
@ -685,7 +686,7 @@ nsBufferedOutputStream::WriteSegments(nsReadSegmentFun reader, void * closure, P
|
||||
mCursor += read;
|
||||
*_retval += read;
|
||||
count -= read;
|
||||
mFillPoint = PR_MAX(mFillPoint, mCursor);
|
||||
mFillPoint = NS_MAX(mFillPoint, mCursor);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -38,6 +38,7 @@
|
||||
#ifndef nsFileStreams_h__
|
||||
#define nsFileStreams_h__
|
||||
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nsIFileStreams.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIInputStream.h"
|
||||
@ -193,7 +194,7 @@ public:
|
||||
|
||||
private:
|
||||
PRUint32 TruncateSize(PRUint32 aSize) {
|
||||
return (PRUint32)PR_MIN(mLength - mPosition, (PRUint64)aSize);
|
||||
return (PRUint32)NS_MIN<PRUint64>(mLength - mPosition, aSize);
|
||||
}
|
||||
|
||||
PRUint64 mStart;
|
||||
|
@ -696,7 +696,7 @@ nsIncrementalDownload::OnDataAvailable(nsIRequest *request,
|
||||
{
|
||||
while (count) {
|
||||
PRUint32 space = mChunkSize - mChunkLen;
|
||||
PRUint32 n, len = PR_MIN(space, count);
|
||||
PRUint32 n, len = NS_MIN(space, count);
|
||||
|
||||
nsresult rv = input->Read(mChunk + mChunkLen, len, &n);
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -1950,7 +1950,7 @@ nsSocketTransport::SetTimeout(PRUint32 type, PRUint32 value)
|
||||
{
|
||||
NS_ENSURE_ARG_MAX(type, nsISocketTransport::TIMEOUT_READ_WRITE);
|
||||
// truncate overly large timeout values.
|
||||
mTimeouts[type] = (PRUint16) PR_MIN(value, PR_UINT16_MAX);
|
||||
mTimeouts[type] = (PRUint16) NS_MIN(value, PR_UINT16_MAX);
|
||||
PostEvent(MSG_TIMEOUT_CHANGED);
|
||||
return NS_OK;
|
||||
}
|
||||
@ -2082,7 +2082,7 @@ DumpBytesToFile(const char *path, const char *header, const char *buf, PRInt32 n
|
||||
while (n) {
|
||||
p = (const unsigned char *) buf;
|
||||
|
||||
PRInt32 i, row_max = PR_MIN(16, n);
|
||||
PRInt32 i, row_max = NS_MIN(16, n);
|
||||
|
||||
for (i = 0; i < row_max; ++i)
|
||||
fprintf(fp, "%02x ", *p++);
|
||||
|
@ -1040,7 +1040,7 @@ nsStandardURL::GetAsciiSpec(nsACString &result)
|
||||
}
|
||||
|
||||
// try to guess the capacity required for result...
|
||||
result.SetCapacity(mSpec.Length() + PR_MIN(32, mSpec.Length()/10));
|
||||
result.SetCapacity(mSpec.Length() + NS_MIN<PRUint32>(32, mSpec.Length()/10));
|
||||
|
||||
result = Substring(mSpec, 0, mScheme.mLen + 3);
|
||||
|
||||
|
@ -178,7 +178,7 @@ nsSyncStreamListener::Read(char *buf,
|
||||
if (NS_FAILED(Available(&avail)))
|
||||
return mStatus;
|
||||
|
||||
avail = PR_MIN(avail, bufLen);
|
||||
avail = NS_MIN(avail, bufLen);
|
||||
mStatus = mPipeIn->Read(buf, avail, result);
|
||||
return mStatus;
|
||||
}
|
||||
@ -198,7 +198,7 @@ nsSyncStreamListener::ReadSegments(nsWriteSegmentFun writer,
|
||||
if (NS_FAILED(Available(&avail)))
|
||||
return mStatus;
|
||||
|
||||
avail = PR_MIN(avail, count);
|
||||
avail = NS_MIN(avail, count);
|
||||
mStatus = mPipeIn->ReadSegments(writer, closure, avail, result);
|
||||
return mStatus;
|
||||
}
|
||||
|
14
netwerk/cache/nsCacheService.cpp
vendored
14
netwerk/cache/nsCacheService.cpp
vendored
@ -357,7 +357,7 @@ nsCacheProfilePrefObserver::Remove()
|
||||
void
|
||||
nsCacheProfilePrefObserver::SetDiskCacheCapacity(PRInt32 capacity)
|
||||
{
|
||||
mDiskCacheCapacity = PR_MAX(0, capacity);
|
||||
mDiskCacheCapacity = NS_MAX(0, capacity);
|
||||
}
|
||||
|
||||
|
||||
@ -418,7 +418,7 @@ nsCacheProfilePrefObserver::Observe(nsISupports * subject,
|
||||
rv = branch->GetIntPref(DISK_CACHE_CAPACITY_PREF, &capacity);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
mDiskCacheCapacity = PR_MAX(0, capacity);
|
||||
mDiskCacheCapacity = NS_MAX(0, capacity);
|
||||
nsCacheService::SetDiskCacheCapacity(mDiskCacheCapacity);
|
||||
|
||||
// Update the cache capacity when smart sizing is turned on/off
|
||||
@ -448,7 +448,7 @@ nsCacheProfilePrefObserver::Observe(nsISupports * subject,
|
||||
rv = branch->GetIntPref(DISK_CACHE_CAPACITY_PREF, &newCapacity);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
mDiskCacheCapacity = PR_MAX(0, newCapacity);
|
||||
mDiskCacheCapacity = NS_MAX(0, newCapacity);
|
||||
nsCacheService::SetDiskCacheCapacity(mDiskCacheCapacity);
|
||||
}
|
||||
#if 0
|
||||
@ -477,7 +477,7 @@ nsCacheProfilePrefObserver::Observe(nsISupports * subject,
|
||||
PRInt32 capacity = 0;
|
||||
rv = branch->GetIntPref(OFFLINE_CACHE_CAPACITY_PREF, &capacity);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mOfflineCacheCapacity = PR_MAX(0, capacity);
|
||||
mOfflineCacheCapacity = NS_MAX(0, capacity);
|
||||
nsCacheService::SetOfflineCacheCapacity(mOfflineCacheCapacity);
|
||||
#if 0
|
||||
} else if (!strcmp(OFFLINE_CACHE_DIR_PREF, data.get())) {
|
||||
@ -580,7 +580,7 @@ nsCacheProfilePrefObserver::GetSmartCacheSize(const nsAString& cachePath)
|
||||
|
||||
// 0 MB <= Available < 500 MB: Use between 50MB and 200MB
|
||||
if (kBytesAvail < DEFAULT_CACHE_SIZE * 2)
|
||||
return PR_MAX(MIN_CACHE_SIZE, kBytesAvail * 4 / 10);
|
||||
return NS_MAX<PRInt64>(MIN_CACHE_SIZE, kBytesAvail * 4 / 10);
|
||||
|
||||
// 500MB <= Available < 2.5 GB: Use 250MB
|
||||
if (kBytesAvail < static_cast<PRInt64>(DEFAULT_CACHE_SIZE) * 10)
|
||||
@ -654,7 +654,7 @@ nsCacheProfilePrefObserver::ReadPrefs(nsIPrefBranch* branch)
|
||||
|
||||
mDiskCacheCapacity = DISK_CACHE_CAPACITY;
|
||||
(void)branch->GetIntPref(DISK_CACHE_CAPACITY_PREF, &mDiskCacheCapacity);
|
||||
mDiskCacheCapacity = PR_MAX(0, mDiskCacheCapacity);
|
||||
mDiskCacheCapacity = NS_MAX(0, mDiskCacheCapacity);
|
||||
|
||||
(void) branch->GetComplexValue(DISK_CACHE_DIR_PREF, // ignore error
|
||||
NS_GET_IID(nsILocalFile),
|
||||
@ -750,7 +750,7 @@ nsCacheProfilePrefObserver::ReadPrefs(nsIPrefBranch* branch)
|
||||
mOfflineCacheCapacity = OFFLINE_CACHE_CAPACITY;
|
||||
(void)branch->GetIntPref(OFFLINE_CACHE_CAPACITY_PREF,
|
||||
&mOfflineCacheCapacity);
|
||||
mOfflineCacheCapacity = PR_MAX(0, mOfflineCacheCapacity);
|
||||
mOfflineCacheCapacity = NS_MAX(0, mOfflineCacheCapacity);
|
||||
|
||||
(void) branch->GetComplexValue(OFFLINE_CACHE_DIR_PREF, // ignore error
|
||||
NS_GET_IID(nsILocalFile),
|
||||
|
4
netwerk/cache/nsDiskCacheBlockFile.cpp
vendored
4
netwerk/cache/nsDiskCacheBlockFile.cpp
vendored
@ -393,9 +393,9 @@ nsDiskCacheBlockFile::Write(PRInt32 offset, const void *buf, PRInt32 amount)
|
||||
if (mFileSize)
|
||||
while(mFileSize < upTo)
|
||||
mFileSize *= 2;
|
||||
mFileSize = PR_MIN(maxPreallocate, PR_MAX(mFileSize, minPreallocate));
|
||||
mFileSize = NS_MIN(maxPreallocate, NS_MAX(mFileSize, minPreallocate));
|
||||
}
|
||||
mFileSize = PR_MIN(mFileSize, maxFileSize);
|
||||
mFileSize = NS_MIN(mFileSize, maxFileSize);
|
||||
// Appears to cause bug 617123? Disabled for now.
|
||||
//mozilla::fallocate(mFD, mFileSize);
|
||||
}
|
||||
|
2
netwerk/cache/nsDiskCacheMap.cpp
vendored
2
netwerk/cache/nsDiskCacheMap.cpp
vendored
@ -1139,7 +1139,7 @@ nsDiskCacheMap::NotifyCapacityChange(PRUint32 capacity)
|
||||
// Heuristic 2. we don't want more than 32MB reserved to store the record
|
||||
// map in memory.
|
||||
const PRInt32 RECORD_COUNT_LIMIT = 32 * 1024 * 1024 / sizeof(nsDiskCacheRecord);
|
||||
PRInt32 maxRecordCount = PR_MIN(PRInt32(capacity), RECORD_COUNT_LIMIT);
|
||||
PRInt32 maxRecordCount = NS_MIN(PRInt32(capacity), RECORD_COUNT_LIMIT);
|
||||
if (mMaxRecordCount < maxRecordCount) {
|
||||
// We can only grow
|
||||
mMaxRecordCount = maxRecordCount;
|
||||
|
4
netwerk/cache/nsMemoryCacheDevice.cpp
vendored
4
netwerk/cache/nsMemoryCacheDevice.cpp
vendored
@ -405,9 +405,9 @@ nsMemoryCacheDevice::EvictionList(nsCacheEntry * entry, PRInt32 deltaSize)
|
||||
// compute which eviction queue this entry should go into,
|
||||
// based on floor(log2(size/nref))
|
||||
PRInt32 size = deltaSize + (PRInt32)entry->Size();
|
||||
PRInt32 fetchCount = PR_MAX(1, entry->FetchCount());
|
||||
PRInt32 fetchCount = NS_MAX(1, entry->FetchCount());
|
||||
|
||||
return PR_MIN(PR_FloorLog2(size / fetchCount), kQueueCount - 1);
|
||||
return NS_MIN(PR_FloorLog2(size / fetchCount), kQueueCount - 1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,7 +65,7 @@ HexDump(PRUint32 *state, const char *buf, PRInt32 n, nsCString &result)
|
||||
|
||||
p = (const unsigned char *) buf;
|
||||
|
||||
PRInt32 i, row_max = PR_MIN(HEXDUMP_MAX_ROWS, n);
|
||||
PRInt32 i, row_max = NS_MIN(HEXDUMP_MAX_ROWS, n);
|
||||
|
||||
// print hex codes:
|
||||
for (i = 0; i < row_max; ++i) {
|
||||
@ -405,7 +405,7 @@ nsAboutCacheEntry::WriteCacheEntryDescription(nsIOutputStream *outputStream,
|
||||
PRUint32 hexDumpState = 0;
|
||||
char chunk[4096];
|
||||
while (dataSize) {
|
||||
PRUint32 count = PR_MIN(dataSize, sizeof(chunk));
|
||||
PRUint32 count = NS_MIN<PRUint32>(dataSize, sizeof(chunk));
|
||||
if (NS_FAILED(stream->Read(chunk, count, &n)) || n == 0)
|
||||
break;
|
||||
dataSize -= n;
|
||||
|
@ -118,7 +118,7 @@ nsFileCopyEvent::DoCopy()
|
||||
if (NS_FAILED(rv))
|
||||
break;
|
||||
|
||||
PRInt32 num = PR_MIN((PRInt32) len, chunk);
|
||||
PRInt32 num = NS_MIN((PRInt32) len, chunk);
|
||||
|
||||
PRUint32 result;
|
||||
rv = mSource->ReadSegments(NS_CopySegmentToStream, mDest, num, &result);
|
||||
|
@ -1025,7 +1025,7 @@ HttpBaseChannel::SetRedirectionLimit(PRUint32 value)
|
||||
{
|
||||
ENSURE_CALLED_BEFORE_ASYNC_OPEN();
|
||||
|
||||
mRedirectionLimit = PR_MIN(value, 0xff);
|
||||
mRedirectionLimit = NS_MIN<PRUint32>(value, 0xff);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ nsHttpChunkedDecoder::HandleChunkedContent(char *buf,
|
||||
|
||||
while (count) {
|
||||
if (mChunkRemaining) {
|
||||
PRUint32 amt = PR_MIN(mChunkRemaining, count);
|
||||
PRUint32 amt = NS_MIN(mChunkRemaining, count);
|
||||
|
||||
count -= amt;
|
||||
mChunkRemaining -= amt;
|
||||
|
@ -470,7 +470,7 @@ nsHttpConnectionMgr::PruneDeadConnectionsCB(nsHashKey *key, void *data, void *cl
|
||||
NS_RELEASE(conn);
|
||||
self->mNumIdleConns--;
|
||||
} else {
|
||||
timeToNextExpire = PR_MIN(timeToNextExpire, conn->TimeToLive());
|
||||
timeToNextExpire = NS_MIN(timeToNextExpire, conn->TimeToLive());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ nsHttpResponseHead::ComputeCurrentAge(PRUint32 now,
|
||||
|
||||
// Compute corrected received age
|
||||
if (NS_SUCCEEDED(GetAgeValue(&ageValue)))
|
||||
*result = PR_MAX(*result, ageValue);
|
||||
*result = NS_MAX(*result, ageValue);
|
||||
|
||||
NS_ASSERTION(now >= requestTime, "bogus request time");
|
||||
|
||||
|
@ -734,7 +734,7 @@ nsHttpTransaction::LocateHttpStart(char *buf, PRUint32 len,
|
||||
// mLineBuf can contain partial match from previous search
|
||||
if (!mLineBuf.IsEmpty()) {
|
||||
NS_ASSERTION(mLineBuf.Length() < HTTPHeaderLen, "ouch");
|
||||
PRInt32 checkChars = PR_MIN(len, HTTPHeaderLen - mLineBuf.Length());
|
||||
PRInt32 checkChars = NS_MIN(len, HTTPHeaderLen - mLineBuf.Length());
|
||||
if (PL_strncasecmp(buf, HTTPHeader + mLineBuf.Length(),
|
||||
checkChars) == 0) {
|
||||
mLineBuf.Append(buf, checkChars);
|
||||
@ -753,7 +753,7 @@ nsHttpTransaction::LocateHttpStart(char *buf, PRUint32 len,
|
||||
|
||||
PRBool firstByte = PR_TRUE;
|
||||
while (len > 0) {
|
||||
if (PL_strncasecmp(buf, HTTPHeader, PR_MIN(len, HTTPHeaderLen)) == 0) {
|
||||
if (PL_strncasecmp(buf, HTTPHeader, NS_MIN<PRUint32>(len, HTTPHeaderLen)) == 0) {
|
||||
if (len < HTTPHeaderLen) {
|
||||
// partial HTTPHeader sequence found
|
||||
// save partial match to mLineBuf
|
||||
@ -887,7 +887,7 @@ nsHttpTransaction::ParseHead(char *buf,
|
||||
if (!mConnection || !mConnection->LastTransactionExpectedNoContent()) {
|
||||
// tolerate only minor junk before the status line
|
||||
mHttpResponseMatched = PR_TRUE;
|
||||
char *p = LocateHttpStart(buf, PR_MIN(count, 11), PR_TRUE);
|
||||
char *p = LocateHttpStart(buf, NS_MIN<PRUint32>(count, 11), PR_TRUE);
|
||||
if (!p) {
|
||||
// Treat any 0.9 style response of a put as a failure.
|
||||
if (mRequestHead->Method() == nsHttp::Put)
|
||||
@ -1111,7 +1111,7 @@ nsHttpTransaction::HandleContent(char *buf,
|
||||
mContentRead += *contentRead;
|
||||
/* when uncommenting, take care of 64-bit integers w/ PR_MAX...
|
||||
if (mProgressSink)
|
||||
mProgressSink->OnProgress(nsnull, nsnull, mContentRead, PR_MAX(0, mContentLength));
|
||||
mProgressSink->OnProgress(nsnull, nsnull, mContentRead, NS_MAX(0, mContentLength));
|
||||
*/
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ nsBinHexDecoder::OnDataAvailable(nsIRequest* request,
|
||||
PRUint32 numBytesRead = 0;
|
||||
while (aCount > 0) // while we still have bytes to copy...
|
||||
{
|
||||
aStream->Read(mDataBuffer, PR_MIN(aCount, nsIOService::gDefaultSegmentSize - 1), &numBytesRead);
|
||||
aStream->Read(mDataBuffer, NS_MIN(aCount, nsIOService::gDefaultSegmentSize - 1), &numBytesRead);
|
||||
if (aCount >= numBytesRead)
|
||||
aCount -= numBytesRead; // subtract off the number of bytes we just read
|
||||
else
|
||||
|
@ -858,7 +858,7 @@ nsIndexedToHTML::OnIndexAvailable(nsIRequest *aRequest,
|
||||
descriptionAffix.Cut(0, descriptionAffix.Length() - 25);
|
||||
if (NS_IS_LOW_SURROGATE(descriptionAffix.First()))
|
||||
descriptionAffix.Cut(0, 1);
|
||||
description.Truncate(PR_MIN(71, description.Length() - 28));
|
||||
description.Truncate(NS_MIN<PRUint32>(71, description.Length() - 28));
|
||||
if (NS_IS_HIGH_SURROGATE(description.Last()))
|
||||
description.Truncate(description.Length() - 1);
|
||||
|
||||
|
@ -606,7 +606,7 @@ nsMultiMixedConv::OnDataAvailable(nsIRequest *request, nsISupports *context,
|
||||
// have enough info to start a part, go ahead and buffer
|
||||
// enough to collect a boundary token.
|
||||
if (!mPartChannel || !(cursor[bufLen-1] == nsCRT::LF) )
|
||||
bufAmt = PR_MIN(mTokenLen - 1, bufLen);
|
||||
bufAmt = NS_MIN(mTokenLen - 1, bufLen);
|
||||
}
|
||||
|
||||
if (bufAmt) {
|
||||
|
@ -200,8 +200,8 @@ nsTXTToHTMLConv::OnDataAvailable(nsIRequest* request, nsISupports *aContext,
|
||||
}
|
||||
|
||||
PRInt32 end = mBuffer.RFind(TOKEN_DELIMITERS, mBuffer.Length());
|
||||
mBuffer.Left(pushBuffer, PR_MAX(cursor, end));
|
||||
mBuffer.Cut(0, PR_MAX(cursor, end));
|
||||
mBuffer.Left(pushBuffer, NS_MAX(cursor, end));
|
||||
mBuffer.Cut(0, NS_MAX(cursor, end));
|
||||
cursor = 0;
|
||||
|
||||
if (!pushBuffer.IsEmpty()) {
|
||||
|
@ -1934,7 +1934,7 @@ NS_IMETHODIMP nsExternalAppHandler::OnDataAvailable(nsIRequest *request, nsISupp
|
||||
while (NS_SUCCEEDED(rv) && count > 0) // while we still have bytes to copy...
|
||||
{
|
||||
readError = PR_TRUE;
|
||||
rv = inStr->Read(mDataBuffer, PR_MIN(count, mBufferSize - 1), &numBytesRead);
|
||||
rv = inStr->Read(mDataBuffer, NS_MIN(count, mBufferSize - 1), &numBytesRead);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if (count >= numBytesRead)
|
||||
|
@ -1655,7 +1655,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
|
||||
selEvent.mOffset = PRUint32(ae->Count() >= 0 ?
|
||||
ae->Offset() :
|
||||
ae->Offset() + ae->Count());
|
||||
selEvent.mLength = PRUint32(PR_ABS(ae->Count()));
|
||||
selEvent.mLength = PRUint32(NS_ABS(ae->Count()));
|
||||
selEvent.mReversed = ae->Count() >= 0 ? PR_FALSE : PR_TRUE;
|
||||
|
||||
DispatchEvent(&selEvent);
|
||||
|
@ -126,7 +126,7 @@ delete_from_cursor_cb(GtkWidget *w, GtkDeleteType del_type,
|
||||
if (!cmd)
|
||||
return; // unsupported command
|
||||
|
||||
count = PR_ABS(count);
|
||||
count = NS_ABS(count);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
gCurrentCallback(cmd, gCurrentCallbackData);
|
||||
}
|
||||
@ -196,7 +196,7 @@ move_cursor_cb(GtkWidget *w, GtkMovementStep step, gint count,
|
||||
return; // unsupported command
|
||||
|
||||
|
||||
count = PR_ABS(count);
|
||||
count = NS_ABS(count);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
gCurrentCallback(cmd, gCurrentCallbackData);
|
||||
}
|
||||
|
@ -186,8 +186,8 @@ nsNativeThemeGTK::GetTabMarginPixels(nsIFrame* aFrame)
|
||||
IsBottomTab(aFrame) ? aFrame->GetUsedMargin().top
|
||||
: aFrame->GetUsedMargin().bottom;
|
||||
|
||||
return PR_MIN(MOZ_GTK_TAB_MARGIN_MASK,
|
||||
PR_MAX(0,
|
||||
return NS_MIN<gint>(MOZ_GTK_TAB_MARGIN_MASK,
|
||||
NS_MAX(0,
|
||||
aFrame->PresContext()->AppUnitsToDevPixels(-margin)));
|
||||
}
|
||||
|
||||
@ -1080,11 +1080,11 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
|
||||
|
||||
if (aWidgetType == NS_THEME_SCROLLBAR_THUMB_VERTICAL) {
|
||||
aResult->width = metrics.slider_width;
|
||||
aResult->height = PR_MIN(NSAppUnitsToIntPixels(rect.height, p2a),
|
||||
aResult->height = NS_MIN(NSAppUnitsToIntPixels(rect.height, p2a),
|
||||
metrics.min_slider_size);
|
||||
} else {
|
||||
aResult->height = metrics.slider_width;
|
||||
aResult->width = PR_MIN(NSAppUnitsToIntPixels(rect.width, p2a),
|
||||
aResult->width = NS_MIN(NSAppUnitsToIntPixels(rect.width, p2a),
|
||||
metrics.min_slider_size);
|
||||
}
|
||||
|
||||
|
@ -285,7 +285,7 @@ nsPrintSettingsGTK::GetStartPageRange(PRInt32 *aStartPageRange)
|
||||
// the lowest start page.
|
||||
PRInt32 start(lstRanges[0].start);
|
||||
for (gint ii = 1; ii < ctRanges; ii++) {
|
||||
start = PR_MIN(lstRanges[ii].start, start);
|
||||
start = NS_MIN(lstRanges[ii].start, start);
|
||||
}
|
||||
*aStartPageRange = start + 1;
|
||||
}
|
||||
@ -320,7 +320,7 @@ nsPrintSettingsGTK::GetEndPageRange(PRInt32 *aEndPageRange)
|
||||
} else {
|
||||
PRInt32 end(lstRanges[0].end);
|
||||
for (gint ii = 1; ii < ctRanges; ii++) {
|
||||
end = PR_MAX(lstRanges[ii].end, end);
|
||||
end = NS_MAX(lstRanges[ii].end, end);
|
||||
}
|
||||
*aEndPageRange = end + 1;
|
||||
}
|
||||
|
@ -4735,8 +4735,8 @@ nsWindow::ResizeTransparencyBitmap(PRInt32 aNewWidth, PRInt32 aNewHeight)
|
||||
memset(newBits, 255, newSize);
|
||||
|
||||
// Now copy the intersection of the old and new areas into the new mask
|
||||
PRInt32 copyWidth = PR_MIN(aNewWidth, mTransparencyBitmapWidth);
|
||||
PRInt32 copyHeight = PR_MIN(aNewHeight, mTransparencyBitmapHeight);
|
||||
PRInt32 copyWidth = NS_MIN(aNewWidth, mTransparencyBitmapWidth);
|
||||
PRInt32 copyHeight = NS_MIN(aNewHeight, mTransparencyBitmapHeight);
|
||||
PRInt32 oldRowBytes = (mTransparencyBitmapWidth+7)/8;
|
||||
PRInt32 newRowBytes = (aNewWidth+7)/8;
|
||||
PRInt32 copyBytes = (copyWidth+7)/8;
|
||||
@ -6539,8 +6539,8 @@ nsWindow::GetThebesSurface()
|
||||
gint width, height;
|
||||
gdk_drawable_get_size(d, &width, &height);
|
||||
// Owen Taylor says this is the right thing to do!
|
||||
width = PR_MIN(32767, width);
|
||||
height = PR_MIN(32767, height);
|
||||
width = NS_MIN(32767, width);
|
||||
height = NS_MIN(32767, height);
|
||||
gfxIntSize size(width, height);
|
||||
Visual* visual = GDK_VISUAL_XVISUAL(gdk_drawable_get_visual(d));
|
||||
|
||||
|
@ -76,7 +76,7 @@ nsIdleServiceOS2::PollIdleTime(PRUint32 *aIdleTime)
|
||||
|
||||
// we are only interested in activity in general, so take the minimum
|
||||
// of both timers
|
||||
*aIdleTime = PR_MIN(mouse, keyboard);
|
||||
*aIdleTime = NS_MIN(mouse, keyboard);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -35,10 +35,12 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsMemory.h"
|
||||
#include "KeyboardLayout.h"
|
||||
|
||||
#include "nsMemory.h"
|
||||
#include "nsToolkit.h"
|
||||
#include "nsQuickSort.h"
|
||||
#include "nsAlgorithm.h"
|
||||
|
||||
#include <winuser.h>
|
||||
|
||||
@ -329,7 +331,7 @@ KeyboardLayout::GetUniChars(PRUnichar* aUniChars,
|
||||
PRUint8* aShiftStates,
|
||||
PRUint32 aMaxChars) const
|
||||
{
|
||||
PRUint32 chars = PR_MIN(mNumOfChars, aMaxChars);
|
||||
PRUint32 chars = NS_MIN<PRUint32>(mNumOfChars, aMaxChars);
|
||||
|
||||
memcpy(aUniChars, mChars, chars * sizeof(PRUnichar));
|
||||
memcpy(aShiftStates, mShiftStates, chars);
|
||||
@ -351,7 +353,7 @@ KeyboardLayout::GetUniCharsWithShiftState(PRUint8 aVirtualKey,
|
||||
PRUnichar uniChars[5];
|
||||
PRUint32 numOfBaseChars =
|
||||
mVirtualKeys[key].GetUniChars(aShiftStates, uniChars, &finalShiftState);
|
||||
PRUint32 chars = PR_MIN(numOfBaseChars, aMaxChars);
|
||||
PRUint32 chars = NS_MIN(numOfBaseChars, aMaxChars);
|
||||
memcpy(aUniChars, uniChars, chars * sizeof(PRUnichar));
|
||||
return chars;
|
||||
}
|
||||
|
@ -1856,7 +1856,7 @@ nsIMM32Handler::GetCharacterRectOfSelectedTextAt(nsWindow* aWindow,
|
||||
useCaretRect = PR_FALSE;
|
||||
if (mCursorPosition != NO_IME_CARET) {
|
||||
PRUint32 cursorPosition =
|
||||
PR_MIN(PRUint32(mCursorPosition), mCompositionString.Length());
|
||||
NS_MIN<PRUint32>(mCursorPosition, mCompositionString.Length());
|
||||
offset -= cursorPosition;
|
||||
NS_ASSERTION(offset >= 0, "offset is negative!");
|
||||
}
|
||||
|
@ -209,8 +209,8 @@ static SIZE GetGutterSize(HANDLE theme, HDC hdc)
|
||||
SIZE itemSize;
|
||||
nsUXThemeData::getThemePartSize(theme, hdc, MENU_POPUPITEM, MPI_NORMAL, NULL, TS_TRUE, &itemSize);
|
||||
|
||||
int width = PR_MAX(itemSize.cx, checkboxBGSize.cx + gutterSize.cx);
|
||||
int height = PR_MAX(itemSize.cy, checkboxBGSize.cy);
|
||||
int width = NS_MAX(itemSize.cx, checkboxBGSize.cx + gutterSize.cx);
|
||||
int height = NS_MAX(itemSize.cy, checkboxBGSize.cy);
|
||||
SIZE ret;
|
||||
ret.cx = width;
|
||||
ret.cy = height;
|
||||
|
@ -769,9 +769,9 @@ nsTextStore::SendTextEventForCompositionString()
|
||||
if (mCompositionSelection.acpStart != mCompositionSelection.acpEnd &&
|
||||
textRanges.Length() == 1) {
|
||||
nsTextRange& range = textRanges[0];
|
||||
LONG start = PR_MIN(mCompositionSelection.acpStart,
|
||||
LONG start = NS_MIN(mCompositionSelection.acpStart,
|
||||
mCompositionSelection.acpEnd);
|
||||
LONG end = PR_MAX(mCompositionSelection.acpStart,
|
||||
LONG end = NS_MAX(mCompositionSelection.acpStart,
|
||||
mCompositionSelection.acpEnd);
|
||||
if ((LONG)range.mStartOffset == start - mCompositionStart &&
|
||||
(LONG)range.mEndOffset == end - mCompositionStart &&
|
||||
@ -783,7 +783,7 @@ nsTextStore::SendTextEventForCompositionString()
|
||||
}
|
||||
|
||||
// The caret position has to be collapsed.
|
||||
LONG caretPosition = PR_MAX(mCompositionSelection.acpStart,
|
||||
LONG caretPosition = NS_MAX(mCompositionSelection.acpStart,
|
||||
mCompositionSelection.acpEnd);
|
||||
caretPosition -= mCompositionStart;
|
||||
nsTextRange caretRange;
|
||||
@ -892,11 +892,11 @@ nsTextStore::GetText(LONG acpStart,
|
||||
// OnUpdateComposition. In this case the returned text would
|
||||
// be out of sync because we haven't sent NS_TEXT_TEXT in
|
||||
// OnUpdateComposition yet. Manually resync here.
|
||||
compOldEnd = PR_MIN(LONG(length) + acpStart,
|
||||
compOldEnd = NS_MIN(LONG(length) + acpStart,
|
||||
mCompositionLength + mCompositionStart);
|
||||
compNewEnd = PR_MIN(LONG(length) + acpStart,
|
||||
compNewEnd = NS_MIN(LONG(length) + acpStart,
|
||||
LONG(mCompositionString.Length()) + mCompositionStart);
|
||||
compNewStart = PR_MAX(acpStart, mCompositionStart);
|
||||
compNewStart = NS_MAX(acpStart, mCompositionStart);
|
||||
// Check if the range is affected
|
||||
if (compOldEnd > compNewStart || compNewEnd > compNewStart) {
|
||||
NS_ASSERTION(compOldEnd >= mCompositionStart &&
|
||||
@ -914,7 +914,7 @@ nsTextStore::GetText(LONG acpStart,
|
||||
if (compOldEnd > compNewStart || compNewEnd > compNewStart) {
|
||||
// Resync composition string
|
||||
const PRUnichar* compStrStart = mCompositionString.BeginReading() +
|
||||
PR_MAX(compNewStart - mCompositionStart, 0);
|
||||
NS_MAX<LONG>(compNewStart - mCompositionStart, 0);
|
||||
event.mReply.mString.Replace(compNewStart - acpStart,
|
||||
compOldEnd - mCompositionStart, compStrStart,
|
||||
compNewEnd - mCompositionStart);
|
||||
@ -922,7 +922,7 @@ nsTextStore::GetText(LONG acpStart,
|
||||
}
|
||||
NS_ENSURE_TRUE(-1 == acpEnd || event.mReply.mString.Length() == length,
|
||||
TS_E_INVALIDPOS);
|
||||
length = PR_MIN(length, event.mReply.mString.Length());
|
||||
length = NS_MIN(length, event.mReply.mString.Length());
|
||||
|
||||
if (pchPlain && cchPlainReq) {
|
||||
memcpy(pchPlain, event.mReply.mString.BeginReading(),
|
||||
@ -1453,9 +1453,9 @@ nsTextStore::OnTextChangeInternal(PRUint32 aStart,
|
||||
PRUint32 aNewEnd)
|
||||
{
|
||||
if (!mLock && mSink && 0 != (mSinkMask & TS_AS_TEXT_CHANGE)) {
|
||||
mTextChange.acpStart = PR_MIN(mTextChange.acpStart, LONG(aStart));
|
||||
mTextChange.acpOldEnd = PR_MAX(mTextChange.acpOldEnd, LONG(aOldEnd));
|
||||
mTextChange.acpNewEnd = PR_MAX(mTextChange.acpNewEnd, LONG(aNewEnd));
|
||||
mTextChange.acpStart = NS_MIN(mTextChange.acpStart, LONG(aStart));
|
||||
mTextChange.acpOldEnd = NS_MAX(mTextChange.acpOldEnd, LONG(aOldEnd));
|
||||
mTextChange.acpNewEnd = NS_MAX(mTextChange.acpNewEnd, LONG(aNewEnd));
|
||||
::PostMessageW(mWindow->GetWindowHandle(),
|
||||
WM_USER_TSF_TEXTCHANGE, 0, 0);
|
||||
}
|
||||
|
@ -594,9 +594,9 @@ nsBaseDragService::DrawDragForImage(nsPresContext* aPresContext,
|
||||
if (destSize.width > maxWidth || destSize.height > maxHeight) {
|
||||
float scale = 1.0;
|
||||
if (destSize.width > maxWidth)
|
||||
scale = PR_MIN(scale, float(maxWidth) / destSize.width);
|
||||
scale = NS_MIN(scale, float(maxWidth) / destSize.width);
|
||||
if (destSize.height > maxHeight)
|
||||
scale = PR_MIN(scale, float(maxHeight) / destSize.height);
|
||||
scale = NS_MIN(scale, float(maxHeight) / destSize.height);
|
||||
|
||||
destSize.width = NSToIntFloor(float(destSize.width) * scale);
|
||||
destSize.height = NSToIntFloor(float(destSize.height) * scale);
|
||||
|
@ -402,7 +402,7 @@ nsIdleService::CheckAwayState(bool aNoTimeReset)
|
||||
} else {
|
||||
// If it hasn't expired yet, then we should note the time when it should
|
||||
// expire.
|
||||
nextWaitTime = PR_MIN(nextWaitTime, curListener.reqIdleTime);
|
||||
nextWaitTime = NS_MIN(nextWaitTime, curListener.reqIdleTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -519,7 +519,7 @@ nsNativeTheme::QueueAnimatedContentForRefresh(nsIContent* aContent,
|
||||
"aMinimumFrameRate must be less than 1000!");
|
||||
|
||||
PRUint32 timeout = PRUint32(NS_floor(1000 / aMinimumFrameRate));
|
||||
timeout = PR_MIN(mAnimatedContentTimeout, timeout);
|
||||
timeout = NS_MIN(mAnimatedContentTimeout, timeout);
|
||||
|
||||
if (!mAnimatedContentTimer) {
|
||||
mAnimatedContentTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
|
||||
|
@ -40,6 +40,7 @@
|
||||
// code duplication.
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
|
@ -732,8 +732,8 @@ public: // ITfReadOnlyProperty
|
||||
if (targetStart > end || targetEnd < start)
|
||||
continue;
|
||||
// Otherwise, shrink to the target range.
|
||||
start = PR_MAX(targetStart, start);
|
||||
end = PR_MIN(targetEnd, end);
|
||||
start = NS_MAX(targetStart, start);
|
||||
end = NS_MIN(targetEnd, end);
|
||||
}
|
||||
nsRefPtr<TSFRangeImpl> range = new TSFRangeImpl(start, end - start);
|
||||
NS_ENSURE_TRUE(range, E_OUTOFMEMORY);
|
||||
@ -952,8 +952,8 @@ public: // ITfCompositionView
|
||||
LONG tmpStart, tmpEnd;
|
||||
HRESULT hr = GetRegularExtent(mAttrProp->mRanges[i], tmpStart, tmpEnd);
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
|
||||
start = PR_MIN(start, tmpStart);
|
||||
end = PR_MAX(end, tmpEnd);
|
||||
start = NS_MIN(start, tmpStart);
|
||||
end = NS_MAX(end, tmpEnd);
|
||||
}
|
||||
nsRefPtr<TSFRangeImpl> range = new TSFRangeImpl();
|
||||
NS_ENSURE_TRUE(range, E_OUTOFMEMORY);
|
||||
|
@ -203,7 +203,7 @@ template <class T, PRUint32 K> class nsExpirationTracker {
|
||||
for (;;) {
|
||||
// Objects could have been removed so index could be outside
|
||||
// the array
|
||||
index = PR_MIN(index, generation.Length());
|
||||
index = NS_MIN(index, generation.Length());
|
||||
if (index == 0)
|
||||
break;
|
||||
--index;
|
||||
|
@ -35,6 +35,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "prtypes.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nsQuickSort.h"
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
@ -164,9 +165,9 @@ loop: SWAPINIT(a, es);
|
||||
}
|
||||
|
||||
pn = (char *)a + n * es;
|
||||
r = PR_MIN(pa - (char *)a, pb - pa);
|
||||
r = NS_MIN(pa - (char *)a, pb - pa);
|
||||
vecswap(a, pb - r, r);
|
||||
r = PR_MIN(pd - pc, (int)(pn - pd - es));
|
||||
r = NS_MIN<size_t>(pd - pc, pn - pd - es);
|
||||
vecswap(pb, pn - r, r);
|
||||
if ((r = pb - pa) > (int)es)
|
||||
NS_QuickSort(a, r / es, es, cmp, data);
|
||||
|
@ -89,7 +89,7 @@ nsTArray_base<Alloc>::EnsureCapacity(size_type capacity, size_type elemSize) {
|
||||
// capacity. (Note that mCapacity is only 31 bits wide, so
|
||||
// multiplication promotes its type. We use |2u| instead of |2|
|
||||
// to make sure it's promoted to unsigned.)
|
||||
capacity = PR_MAX(capacity, mHdr->mCapacity * 2u);
|
||||
capacity = NS_MAX<size_type>(capacity, mHdr->mCapacity * 2U);
|
||||
|
||||
Header *header;
|
||||
if (UsesAutoArrayBuffer()) {
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nscore.h"
|
||||
#include "nsQuickSort.h"
|
||||
#include "nsDebug.h"
|
||||
|
@ -290,7 +290,7 @@ CompareVP(VersionPartW &v1, VersionPartW &v2)
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
r = wcsncmp(v1.strB, v2.strB, PR_MIN(v1.strBlen,v2.strBlen));
|
||||
r = wcsncmp(v1.strB, v2.strB, NS_MIN(v1.strBlen,v2.strBlen));
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
|
@ -282,7 +282,7 @@ PRBool nsVoidArray::GrowArrayBy(PRInt32 aGrowBy)
|
||||
// Also, limit the increase in size to about a VM page or two.
|
||||
if (GetArraySize() >= kMaxGrowArrayBy)
|
||||
{
|
||||
newCapacity = GetArraySize() + PR_MAX(kMaxGrowArrayBy,aGrowBy);
|
||||
newCapacity = GetArraySize() + NS_MAX(kMaxGrowArrayBy,aGrowBy);
|
||||
newSize = SIZEOF_IMPL(newCapacity);
|
||||
}
|
||||
else
|
||||
@ -951,7 +951,7 @@ CompareCString(const nsCString* aCString1, const nsCString* aCString2, void*)
|
||||
const char* s2;
|
||||
PRUint32 len1 = NS_CStringGetData(*aCString1, &s1);
|
||||
PRUint32 len2 = NS_CStringGetData(*aCString2, &s2);
|
||||
int r = memcmp(s1, s2, PR_MIN(len1, len2));
|
||||
int r = memcmp(s1, s2, NS_MIN(len1, len2));
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
|
||||
#include <string.h>
|
||||
#include "prtypes.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nscore.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsEnumeratorUtils.h"
|
||||
@ -566,7 +567,7 @@ nsFastLoadFileReader::Read(char* aBuffer, PRUint32 aCount, PRUint32 *aBytesRead)
|
||||
if (!mFileData)
|
||||
return NS_BASE_STREAM_CLOSED;
|
||||
|
||||
PRUint32 count = PR_MIN(mFileLen - mFilePos, aCount);
|
||||
PRUint32 count = NS_MIN(mFileLen - mFilePos, aCount);
|
||||
memcpy(aBuffer, mFileData+mFilePos, count);
|
||||
*aBytesRead = count;
|
||||
mFilePos += count;
|
||||
@ -595,7 +596,7 @@ nsFastLoadFileReader::ReadSegments(nsWriteSegmentFun aWriter, void* aClosure,
|
||||
if (!mFileData)
|
||||
return NS_BASE_STREAM_CLOSED;
|
||||
|
||||
PRUint32 count = PR_MIN(mFileLen - mFilePos, aCount);
|
||||
PRUint32 count = NS_MIN(mFileLen - mFilePos, aCount);
|
||||
|
||||
// Errors returned from the writer get ignored.
|
||||
aWriter(this, aClosure, (char*)(mFileData + mFilePos), 0,
|
||||
|
@ -45,6 +45,7 @@
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "pldhash.h"
|
||||
#include "nsAlgorithm.h"
|
||||
|
||||
#include "nsBinaryStream.h"
|
||||
#include "nsCOMPtr.h"
|
||||
@ -283,7 +284,7 @@ class nsFastLoadFileReader
|
||||
NS_IMETHOD ReadID(nsID *aResult);
|
||||
|
||||
void SeekTo(PRInt64 aOffset) {
|
||||
mFilePos = PR_MAX(0, PR_MIN(aOffset, mFileLen));
|
||||
mFilePos = NS_MAX<PRInt64>(0, NS_MIN<PRInt64>(aOffset, mFileLen));
|
||||
NS_ASSERTION(aOffset == mFilePos, "Attempt to seek out of bounds");
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "prlog.h"
|
||||
#include "nsIClassInfoImpl.h"
|
||||
#include "nsAtomicRefcnt.h"
|
||||
#include "nsAlgorithm.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -958,7 +959,7 @@ nsPipeInputStream::Search(const char *forString,
|
||||
len2 = limit2 - cursor2;
|
||||
|
||||
// check if the string is straddling the next buffer segment
|
||||
PRUint32 lim = PR_MIN(strLen, len2 + 1);
|
||||
PRUint32 lim = NS_MIN(strLen, len2 + 1);
|
||||
for (i = 0; i < lim; ++i) {
|
||||
PRUint32 strPart1Len = strLen - i - 1;
|
||||
PRUint32 strPart2Len = strLen - strPart1Len;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user