Bug 530373. Use NS_MIN/NS_MAX instead of PR_MIN/PR_MAX in DOM code. r=bzbarsky

This commit is contained in:
Jae-Seong Lee-Russo 2010-02-22 14:41:19 -05:00
parent fb7cd7fdfd
commit 7a1e8ddc0f
10 changed files with 18 additions and 18 deletions

View File

@ -1048,7 +1048,7 @@ nsAttrValue::ParseSpecialIntValue(const nsAString& aString,
return PR_FALSE;
}
PRInt32 val = PR_MAX(originalVal, 0);
PRInt32 val = NS_MAX(originalVal, 0);
// % (percent)
// XXX RFindChar means that 5%x will be parsed!
@ -1082,8 +1082,8 @@ nsAttrValue::ParseIntWithBounds(const nsAString& aString,
return PR_FALSE;
}
PRInt32 val = PR_MAX(originalVal, aMin);
val = PR_MIN(val, aMax);
PRInt32 val = NS_MAX(originalVal, aMin);
val = NS_MIN(val, aMax);
strict = strict && (originalVal == val);
SetIntValueAndType(val, eInteger, strict ? nsnull : &aString);

View File

@ -1527,7 +1527,7 @@ nsContentUtils::GetCommonAncestor(nsINode* aNode1,
PRUint32 pos2 = parents2.Length();
nsINode* parent = nsnull;
PRUint32 len;
for (len = PR_MIN(pos1, pos2); len > 0; --len) {
for (len = NS_MIN(pos1, pos2); len > 0; --len) {
nsINode* child1 = parents1.ElementAt(--pos1);
nsINode* child2 = parents2.ElementAt(--pos2);
if (child1 != child2) {
@ -1627,7 +1627,7 @@ nsContentUtils::ComparePosition(nsINode* aNode1,
// Find where the parent chain differs and check indices in the parent.
nsINode* parent = top1;
PRUint32 len;
for (len = PR_MIN(pos1, pos2); len > 0; --len) {
for (len = NS_MIN(pos1, pos2); len > 0; --len) {
nsINode* child1 = parents1.ElementAt(--pos1);
nsINode* child2 = parents2.ElementAt(--pos2);
if (child1 != child2) {
@ -1690,7 +1690,7 @@ nsContentUtils::ComparePoints(nsINode* aParent1, PRInt32 aOffset1,
// Find where the parent chains differ
nsINode* parent = parents1.ElementAt(pos1);
PRUint32 len;
for (len = PR_MIN(pos1, pos2); len > 0; --len) {
for (len = NS_MIN(pos1, pos2); len > 0; --len) {
nsINode* child1 = parents1.ElementAt(--pos1);
nsINode* child2 = parents2.ElementAt(--pos2);
if (child1 != child2) {
@ -4278,7 +4278,7 @@ nsContentUtils::GetLocalizedEllipsis()
static PRUnichar sBuf[4] = { 0, 0, 0, 0 };
if (!sBuf[0]) {
nsAutoString tmp(GetLocalizedStringPref("intl.ellipsis"));
PRUint32 len = PR_MIN(tmp.Length(), NS_ARRAY_LENGTH(sBuf) - 1);
PRUint32 len = NS_MIN(tmp.Length(), NS_ARRAY_LENGTH(sBuf) - 1);
CopyUnicodeTo(tmp, 0, sBuf, len);
if (!sBuf[0])
sBuf[0] = PRUnichar(0x2026);

View File

@ -6477,7 +6477,7 @@ nsDocument::FlushPendingNotifications(mozFlushType aType)
if (mParentDocument && IsSafeToFlush()) {
mozFlushType parentType = aType;
if (aType >= Flush_Style)
parentType = PR_MAX(Flush_Layout, aType);
parentType = NS_MAX(Flush_Layout, aType);
mParentDocument->FlushPendingNotifications(parentType);
}

View File

@ -464,7 +464,7 @@ nsSyncLoadService::PushSyncStreamToListener(nsIInputStream* aIn,
if (NS_FAILED(rv)) {
chunkSize = 4096;
}
chunkSize = PR_MIN(PR_UINT16_MAX, chunkSize);
chunkSize = NS_MIN(PRInt32(PR_UINT16_MAX), chunkSize);
rv = NS_NewBufferedInputStream(getter_AddRefs(bufferedStream), aIn,
chunkSize);

View File

@ -349,7 +349,7 @@ nsACProxyListener::AddResultToCache(nsIRequest *aRequest)
}
age = age * 10 + (*iter - '0');
// Cap at 24 hours. This also avoids overflow
age = PR_MIN(age, 86400);
age = NS_MIN(age, 86400U);
++iter;
}

View File

@ -840,7 +840,7 @@ WebGLContext::DrawElements(GLenum mode, GLuint count, GLenum type, GLuint offset
// XXX cache results for this count,offset pair!
for (PRUint32 i = 0; i < count; ++i)
maxindex = PR_MAX(maxindex, *ubuf++);
maxindex = NS_MAX(maxindex, *ubuf++);
gl->fUnmapBuffer(LOCAL_GL_ELEMENT_ARRAY_BUFFER);

View File

@ -873,7 +873,7 @@ static void AdjustRangeForSelection(nsIContent* aRoot,
brContent = node->GetChildAt(--offset - 1);
}
*aNode = node;
*aOffset = PR_MAX(offset, 0);
*aOffset = NS_MAX(offset, 0);
}
nsresult

View File

@ -3344,7 +3344,7 @@ nsEventStateManager::SetCursor(PRInt32 aCursor, imgIContainer* aContainer,
aContainer->GetWidth(&imgWidth);
aContainer->GetHeight(&imgHeight);
// XXX PR_MAX(NS_lround(x), 0)?
// XXX NS_MAX(NS_lround(x), 0)?
hotspotX = aHotspotX > 0.0f
? PRUint32(aHotspotX + 0.5f) : PRUint32(0);
if (hotspotX >= PRUint32(imgWidth))

View File

@ -769,10 +769,10 @@ NS_IMETHODIMP nsHTMLMediaElement::SetCurrentTime(float aCurrentTime)
}
// Clamp the time to [0, duration] as required by the spec
float clampedTime = PR_MAX(0, aCurrentTime);
float clampedTime = NS_MAX(0.0f, aCurrentTime);
float duration = mDecoder->GetDuration();
if (duration >= 0) {
clampedTime = PR_MIN(clampedTime, duration);
clampedTime = NS_MIN(clampedTime, duration);
}
mPlayingBeforeSeek = IsPotentiallyPlaying();

View File

@ -140,7 +140,7 @@ protected:
nsresult ScrollImageTo(PRInt32 aX, PRInt32 aY, PRBool restoreImage);
float GetRatio() {
return PR_MIN((float)mVisibleWidth / mImageWidth,
return NS_MIN((float)mVisibleWidth / mImageWidth,
(float)mVisibleHeight / mImageHeight);
}
@ -473,8 +473,8 @@ nsImageDocument::ShrinkToFit()
// Keep image content alive while changing the attributes.
nsCOMPtr<nsIContent> imageContent = mImageContent;
nsCOMPtr<nsIDOMHTMLImageElement> image = do_QueryInterface(mImageContent);
image->SetWidth(PR_MAX(1, NSToCoordFloor(GetRatio() * mImageWidth)));
image->SetHeight(PR_MAX(1, NSToCoordFloor(GetRatio() * mImageHeight)));
image->SetWidth(NS_MAX(1, NSToCoordFloor(GetRatio() * mImageWidth)));
image->SetHeight(NS_MAX(1, NSToCoordFloor(GetRatio() * mImageHeight)));
// The view might have been scrolled when zooming in, scroll back to the
// origin now that we're showing a shrunk-to-window version.