зеркало из https://github.com/mozilla/pjs.git
Bug 661584 - Code cleanup, substitute more PR_(MAX|MIN|ABS|ROUNDUP) macro calls; r=roc,ted
This commit is contained in:
Родитель
7b59858617
Коммит
755df8b9a0
|
@ -165,7 +165,7 @@ Is8BitUnvectorized(const PRUnichar *str, const PRUnichar *end)
|
|||
|
||||
// Align ourselves to a word boundary.
|
||||
PRInt32 alignLen =
|
||||
PR_MIN(len, PRInt32(((-NS_PTR_TO_UINT32(str)) & alignMask) / sizeof(PRUnichar)));
|
||||
NS_MIN(len, PRInt32(((-NS_PTR_TO_INT32(str)) & alignMask) / sizeof(PRUnichar)));
|
||||
for (; i < alignLen; i++) {
|
||||
if (str[i] > 255)
|
||||
return PR_FALSE;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <emmintrin.h>
|
||||
#include "nscore.h"
|
||||
#include "nsAlgorithm.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace SSE2 {
|
||||
|
@ -35,7 +36,7 @@ Is8Bit(const PRUnichar *str, const PRUnichar *end)
|
|||
// Align ourselves to a 16-byte boundary, as required by _mm_load_si128
|
||||
// (i.e. MOVDQA).
|
||||
PRInt32 alignLen =
|
||||
PR_MIN(len, PRInt32(((-NS_PTR_TO_UINT32(str)) & 0xf) / sizeof(PRUnichar)));
|
||||
NS_MIN(len, PRInt32(((-NS_PTR_TO_INT32(str)) & 0xf) / sizeof(PRUnichar)));
|
||||
for (; i < alignLen; i++) {
|
||||
if (str[i] > 255)
|
||||
return PR_FALSE;
|
||||
|
|
|
@ -287,8 +287,8 @@ nsIDOMCanvasRenderingContext2D_CreateImageData(JSContext *cx, uintN argc, jsval
|
|||
int32 wi = JS_DoubleToInt32(width);
|
||||
int32 hi = JS_DoubleToInt32(height);
|
||||
|
||||
uint32 w = PR_ABS(wi);
|
||||
uint32 h = PR_ABS(hi);
|
||||
uint32 w = NS_ABS(wi);
|
||||
uint32 h = NS_ABS(hi);
|
||||
return CreateImageData(cx, w, h, NULL, 0, 0, vp);
|
||||
}
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ nsHTMLProgressElement::GetValue(double* aValue)
|
|||
double max;
|
||||
GetMax(&max);
|
||||
|
||||
*aValue = PR_MIN(*aValue, max);
|
||||
*aValue = NS_MIN(*aValue, max);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -329,7 +329,7 @@ static int VolumeScaleChanged(const char* aPref, void *aClosure) {
|
|||
gVolumeScale = 1.0;
|
||||
} else {
|
||||
NS_ConvertUTF16toUTF8 utf8(value);
|
||||
gVolumeScale = PR_MAX(0, PR_strtod(utf8.get(), nsnull));
|
||||
gVolumeScale = NS_MAX<double>(0, PR_strtod(utf8.get(), nsnull));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1535,7 +1535,7 @@ void nsBuiltinDecoderStateMachine::AdvanceFrame()
|
|||
|
||||
void nsBuiltinDecoderStateMachine::Wait(PRInt64 aUsecs) {
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
TimeStamp end = TimeStamp::Now() + UsecsToDuration(PR_MAX(USECS_PER_MS, aUsecs));
|
||||
TimeStamp end = TimeStamp::Now() + UsecsToDuration(NS_MAX<PRInt64>(USECS_PER_MS, aUsecs));
|
||||
TimeStamp now;
|
||||
while ((now = TimeStamp::Now()) < end &&
|
||||
mState != DECODER_STATE_SHUTDOWN &&
|
||||
|
|
|
@ -741,8 +741,8 @@ static PRInt32 GetMaxBlocks()
|
|||
// Cache size is in KB
|
||||
PRInt32 cacheSize = Preferences::GetInt("media.cache_size", 500*1024);
|
||||
PRInt64 maxBlocks = static_cast<PRInt64>(cacheSize)*1024/nsMediaCache::BLOCK_SIZE;
|
||||
maxBlocks = PR_MAX(maxBlocks, 1);
|
||||
return PRInt32(PR_MIN(maxBlocks, PR_INT32_MAX));
|
||||
maxBlocks = NS_MAX<PRInt64>(maxBlocks, 1);
|
||||
return PRInt32(NS_MIN<PRInt64>(maxBlocks, PR_INT32_MAX));
|
||||
}
|
||||
|
||||
PRInt32
|
||||
|
|
|
@ -381,7 +381,7 @@ nsWaveReader::ScanForwardUntil(PRUint32 aWantedChunk, PRUint32* aChunkSize)
|
|||
PR_STATIC_ASSERT(MAX_CHUNK_SIZE < UINT_MAX / sizeof(char));
|
||||
nsAutoArrayPtr<char> chunk(new char[MAX_CHUNK_SIZE]);
|
||||
while (chunkSize > 0) {
|
||||
PRUint32 size = PR_MIN(chunkSize, MAX_CHUNK_SIZE);
|
||||
PRUint32 size = NS_MIN(chunkSize, MAX_CHUNK_SIZE);
|
||||
if (!ReadAll(chunk.get(), size)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -545,8 +545,8 @@ nsWaveReader::GetDataLength()
|
|||
// the content length rather than the expected PCM data length.
|
||||
PRInt64 streamLength = mDecoder->GetCurrentStream()->GetLength();
|
||||
if (streamLength >= 0) {
|
||||
PRInt64 dataLength = PR_MAX(0, streamLength - mWavePCMOffset);
|
||||
length = PR_MIN(dataLength, length);
|
||||
PRInt64 dataLength = NS_MAX<PRInt64>(0, streamLength - mWavePCMOffset);
|
||||
length = NS_MIN(dataLength, length);
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
|
|
@ -656,7 +656,7 @@ nsSHEntry::AddChild(nsISHEntry * aChild, PRInt32 aOffset)
|
|||
// If there are dynamically added children before that, those must be
|
||||
// moved to be after aOffset.
|
||||
if (mChildren.Count() > 0) {
|
||||
PRInt32 start = PR_MIN(mChildren.Count() - 1, aOffset);
|
||||
PRInt32 start = NS_MIN(mChildren.Count() - 1, aOffset);
|
||||
PRInt32 dynEntryIndex = -1;
|
||||
nsISHEntry* dynEntry = nsnull;
|
||||
for (PRInt32 i = start; i >= 0; --i) {
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nptest_platform.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include <CoreServices/CoreServices.h>
|
||||
|
||||
using namespace std;
|
||||
|
@ -191,8 +192,8 @@ pluginDraw(InstanceData* instanceData, NPCocoaEvent* event)
|
|||
|
||||
// Initialize a rectangular path.
|
||||
CGMutablePathRef path = CGPathCreateMutable();
|
||||
CGRect bounds = CGRectMake(10.0, 10.0, PR_MAX(0.0, windowWidth - 20.0),
|
||||
PR_MAX(0.0, windowHeight - 20.0));
|
||||
CGRect bounds = CGRectMake(10.0, 10.0, NS_MAX(0.0, windowWidth - 20.0),
|
||||
NS_MAX(0.0, windowHeight - 20.0));
|
||||
CGPathAddRect(path, NULL, bounds);
|
||||
|
||||
// Initialize an attributed string.
|
||||
|
|
|
@ -481,7 +481,7 @@ nsGIOInputStream::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;
|
||||
|
|
|
@ -108,8 +108,8 @@ struct nsBoundingMetrics {
|
|||
else {
|
||||
if (ascent < bm.ascent) ascent = bm.ascent;
|
||||
if (descent < bm.descent) descent = bm.descent;
|
||||
leftBearing = PR_MIN(leftBearing, width + bm.leftBearing);
|
||||
rightBearing = PR_MAX(rightBearing, width + bm.rightBearing);
|
||||
leftBearing = NS_MIN(leftBearing, width + bm.leftBearing);
|
||||
rightBearing = NS_MAX(rightBearing, width + bm.rightBearing);
|
||||
}
|
||||
width += bm.width;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#ifndef NSCOORD_H
|
||||
#define NSCOORD_H
|
||||
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nscore.h"
|
||||
#include "nsMathUtils.h"
|
||||
#include <math.h>
|
||||
|
@ -142,8 +143,8 @@ inline nscoord _nscoordSaturatingMultiply(nscoord aCoord, float aScale,
|
|||
|
||||
float product = aCoord * aScale;
|
||||
if (requireNotNegative ? aCoord > 0 : (aCoord > 0) == (aScale > 0))
|
||||
return NSToCoordRoundWithClamp(PR_MIN(nscoord_MAX, product));
|
||||
return NSToCoordRoundWithClamp(PR_MAX(nscoord_MIN, product));
|
||||
return NSToCoordRoundWithClamp(NS_MIN<float>(nscoord_MAX, product));
|
||||
return NSToCoordRoundWithClamp(NS_MAX<float>(nscoord_MIN, product));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -218,13 +219,13 @@ NSCoordSaturatingAdd(nscoord a, nscoord b)
|
|||
"Doing nscoord addition with values > nscoord_MAX");
|
||||
NS_ASSERTION((PRInt64)a + (PRInt64)b > (PRInt64)nscoord_MIN,
|
||||
"nscoord addition will reach or pass nscoord_MIN");
|
||||
// This one's only a warning because the PR_MIN below means that
|
||||
// This one's only a warning because the NS_MIN below means that
|
||||
// we'll handle this case correctly.
|
||||
NS_WARN_IF_FALSE((PRInt64)a + (PRInt64)b < (PRInt64)nscoord_MAX,
|
||||
"nscoord addition capped to nscoord_MAX");
|
||||
|
||||
// Cap the result, just in case we're dealing with numbers near nscoord_MAX
|
||||
return PR_MIN(nscoord_MAX, a + b);
|
||||
return NS_MIN(nscoord_MAX, a + b);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -277,13 +278,13 @@ NSCoordSaturatingSubtract(nscoord a, nscoord b,
|
|||
"Doing nscoord subtraction with values > nscoord_MAX");
|
||||
NS_ASSERTION((PRInt64)a - (PRInt64)b > (PRInt64)nscoord_MIN,
|
||||
"nscoord subtraction will reach or pass nscoord_MIN");
|
||||
// This one's only a warning because the PR_MIN below means that
|
||||
// This one's only a warning because the NS_MIN below means that
|
||||
// we'll handle this case correctly.
|
||||
NS_WARN_IF_FALSE((PRInt64)a - (PRInt64)b < (PRInt64)nscoord_MAX,
|
||||
"nscoord subtraction capped to nscoord_MAX");
|
||||
|
||||
// Cap the result, in case we're dealing with numbers near nscoord_MAX
|
||||
return PR_MIN(nscoord_MAX, a - b);
|
||||
return NS_MIN(nscoord_MAX, a - b);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -381,7 +381,7 @@ nsDeviceContext::SetDPI()
|
|||
dpi = mWidget->GetDPI();
|
||||
|
||||
if (prefDPI < 0) {
|
||||
dpi = PR_MAX(96.0f, dpi);
|
||||
dpi = NS_MAX(96.0f, dpi);
|
||||
}
|
||||
} else {
|
||||
dpi = 96.0f;
|
||||
|
@ -406,7 +406,7 @@ nsDeviceContext::SetDPI()
|
|||
}
|
||||
|
||||
mAppUnitsPerDevNotScaledPixel =
|
||||
PR_MAX(1, NS_lround(AppUnitsPerCSSPixel() / devPixelsPerCSSPixel));
|
||||
NS_MAX(1, NS_lround(AppUnitsPerCSSPixel() / devPixelsPerCSSPixel));
|
||||
}
|
||||
|
||||
NS_ASSERTION(dpi != -1.0, "no dpi set");
|
||||
|
@ -836,5 +836,5 @@ void
|
|||
nsDeviceContext::UpdateScaledAppUnits()
|
||||
{
|
||||
mAppUnitsPerDevPixel =
|
||||
PR_MAX(1, NSToIntRound(float(mAppUnitsPerDevNotScaledPixel) / mPixelScale));
|
||||
NS_MAX(1, NSToIntRound(float(mAppUnitsPerDevNotScaledPixel) / mPixelScale));
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@ static gfxFloat ComputeMaxDescent(const gfxFont::Metrics& aMetrics,
|
|||
gfxFloat offset = NS_floor(-aFontGroup->GetUnderlineOffset() + 0.5);
|
||||
gfxFloat size = NS_round(aMetrics.underlineSize);
|
||||
gfxFloat minDescent = NS_floor(offset + size + 0.5);
|
||||
return PR_MAX(minDescent, aMetrics.maxDescent);
|
||||
return NS_MAX(minDescent, aMetrics.maxDescent);
|
||||
}
|
||||
|
||||
static gfxFloat ComputeMaxAscent(const gfxFont::Metrics& aMetrics)
|
||||
|
@ -279,7 +279,7 @@ nsFontMetrics::GetMaxStringLength()
|
|||
const gfxFont::Metrics& m = GetMetrics();
|
||||
const double x = 32767.0 / m.maxAdvance;
|
||||
PRInt32 len = (PRInt32)floor(x);
|
||||
return PR_MAX(1, len);
|
||||
return NS_MAX(1, len);
|
||||
}
|
||||
|
||||
nscoord
|
||||
|
|
|
@ -71,13 +71,13 @@ inline PRBool nsRegion::nsRectFast::Intersects (const nsRect& aRect) const
|
|||
|
||||
inline PRBool nsRegion::nsRectFast::IntersectRect (const nsRect& aRect1, const nsRect& aRect2)
|
||||
{
|
||||
const nscoord xmost = PR_MIN (aRect1.XMost (), aRect2.XMost ());
|
||||
x = PR_MAX (aRect1.x, aRect2.x);
|
||||
const nscoord xmost = NS_MIN (aRect1.XMost (), aRect2.XMost ());
|
||||
x = NS_MAX (aRect1.x, aRect2.x);
|
||||
width = xmost - x;
|
||||
if (width <= 0) return PR_FALSE;
|
||||
|
||||
const nscoord ymost = PR_MIN (aRect1.YMost (), aRect2.YMost ());
|
||||
y = PR_MAX (aRect1.y, aRect2.y);
|
||||
const nscoord ymost = NS_MIN (aRect1.YMost (), aRect2.YMost ());
|
||||
y = NS_MAX (aRect1.y, aRect2.y);
|
||||
height = ymost - y;
|
||||
if (height <= 0) return PR_FALSE;
|
||||
|
||||
|
@ -86,8 +86,8 @@ inline PRBool nsRegion::nsRectFast::IntersectRect (const nsRect& aRect1, const n
|
|||
|
||||
inline void nsRegion::nsRectFast::UnionRect (const nsRect& aRect1, const nsRect& aRect2)
|
||||
{
|
||||
const nscoord xmost = PR_MAX (aRect1.XMost (), aRect2.XMost ());
|
||||
const nscoord ymost = PR_MAX (aRect1.YMost (), aRect2.YMost ());
|
||||
const nscoord xmost = NS_MAX (aRect1.XMost (), aRect2.XMost ());
|
||||
const nscoord ymost = NS_MAX (aRect1.YMost (), aRect2.YMost ());
|
||||
x = PR_MIN (aRect1.x, aRect2.x);
|
||||
y = PR_MIN (aRect1.y, aRect2.y);
|
||||
width = xmost - x;
|
||||
|
|
|
@ -78,7 +78,7 @@ static PRInt32 FindSafeLength(const char *aString, PRUint32 aLength,
|
|||
PRUint32 aMaxChunkLength)
|
||||
{
|
||||
// Since it's ASCII, we don't need to worry about clusters or RTL
|
||||
return PR_MIN(aLength, aMaxChunkLength);
|
||||
return NS_MIN(aLength, aMaxChunkLength);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -481,7 +481,7 @@ nsRenderingContext::GetMaxChunkLength()
|
|||
{
|
||||
if (!mFontMetrics)
|
||||
return 1;
|
||||
return PR_MIN(mFontMetrics->GetMaxStringLength(), MAX_GFX_TEXT_BUF_SIZE);
|
||||
return NS_MIN(mFontMetrics->GetMaxStringLength(), MAX_GFX_TEXT_BUF_SIZE);
|
||||
}
|
||||
|
||||
nscoord
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
|
||||
#include "prtypes.h"
|
||||
#include "gfxTypes.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxFontMissingGlyphs.h"
|
||||
#include "gfxUserFontSet.h"
|
||||
|
@ -1019,8 +1020,8 @@ gfxFontCache::DestroyFont(gfxFont *aFont)
|
|||
void
|
||||
gfxFont::RunMetrics::CombineWith(const RunMetrics& aOther, PRBool aOtherIsOnLeft)
|
||||
{
|
||||
mAscent = PR_MAX(mAscent, aOther.mAscent);
|
||||
mDescent = PR_MAX(mDescent, aOther.mDescent);
|
||||
mAscent = NS_MAX(mAscent, aOther.mAscent);
|
||||
mDescent = NS_MAX(mDescent, aOther.mDescent);
|
||||
if (aOtherIsOnLeft) {
|
||||
mBoundingBox =
|
||||
(mBoundingBox + gfxPoint(aOther.mAdvanceWidth, 0)).Union(aOther.mBoundingBox);
|
||||
|
@ -1261,8 +1262,8 @@ gfxFont::Draw(gfxTextRun *aTextRun, PRUint32 aStart, PRUint32 aEnd,
|
|||
static void
|
||||
UnionRange(gfxFloat aX, gfxFloat* aDestMin, gfxFloat* aDestMax)
|
||||
{
|
||||
*aDestMin = PR_MIN(*aDestMin, aX);
|
||||
*aDestMax = PR_MAX(*aDestMax, aX);
|
||||
*aDestMin = NS_MIN(*aDestMin, aX);
|
||||
*aDestMax = NS_MAX(*aDestMax, aX);
|
||||
}
|
||||
|
||||
// We get precise glyph extents if the textrun creator requested them, or
|
||||
|
@ -1681,8 +1682,8 @@ gfxFont::InitMetricsFromSfntTables(Metrics& aMetrics)
|
|||
PRUint16(os2->version) >= 2) {
|
||||
// version 2 and later includes the x-height field
|
||||
SET_SIGNED(xHeight, os2->sxHeight);
|
||||
// PR_ABS because of negative xHeight seen in Kokonor (Tibetan) font
|
||||
aMetrics.xHeight = PR_ABS(aMetrics.xHeight);
|
||||
// NS_ABS because of negative xHeight seen in Kokonor (Tibetan) font
|
||||
aMetrics.xHeight = NS_ABS(aMetrics.xHeight);
|
||||
}
|
||||
// this should always be present
|
||||
if (os2data.Length() >= offsetof(OS2Table, yStrikeoutPosition) +
|
||||
|
@ -1777,10 +1778,10 @@ gfxFont::SanitizeMetrics(gfxFont::Metrics *aMetrics, PRBool aIsBadUnderlineFont)
|
|||
aMetrics->subscriptOffset = aMetrics->xHeight;
|
||||
}
|
||||
|
||||
aMetrics->underlineSize = PR_MAX(1.0, aMetrics->underlineSize);
|
||||
aMetrics->strikeoutSize = PR_MAX(1.0, aMetrics->strikeoutSize);
|
||||
aMetrics->underlineSize = NS_MAX(1.0, aMetrics->underlineSize);
|
||||
aMetrics->strikeoutSize = NS_MAX(1.0, aMetrics->strikeoutSize);
|
||||
|
||||
aMetrics->underlineOffset = PR_MIN(aMetrics->underlineOffset, -1.0);
|
||||
aMetrics->underlineOffset = NS_MIN(aMetrics->underlineOffset, -1.0);
|
||||
|
||||
if (aMetrics->maxAscent < 1.0) {
|
||||
// We cannot draw strikeout line and overline in the ascent...
|
||||
|
@ -1802,13 +1803,13 @@ gfxFont::SanitizeMetrics(gfxFont::Metrics *aMetrics, PRBool aIsBadUnderlineFont)
|
|||
if (!mStyle.systemFont && aIsBadUnderlineFont) {
|
||||
// First, we need 2 pixels between baseline and underline at least. Because many CJK characters
|
||||
// put their glyphs on the baseline, so, 1 pixel is too close for CJK characters.
|
||||
aMetrics->underlineOffset = PR_MIN(aMetrics->underlineOffset, -2.0);
|
||||
aMetrics->underlineOffset = NS_MIN(aMetrics->underlineOffset, -2.0);
|
||||
|
||||
// Next, we put the underline to bottom of below of the descent space.
|
||||
if (aMetrics->internalLeading + aMetrics->externalLeading > aMetrics->underlineSize) {
|
||||
aMetrics->underlineOffset = PR_MIN(aMetrics->underlineOffset, -aMetrics->emDescent);
|
||||
aMetrics->underlineOffset = NS_MIN(aMetrics->underlineOffset, -aMetrics->emDescent);
|
||||
} else {
|
||||
aMetrics->underlineOffset = PR_MIN(aMetrics->underlineOffset,
|
||||
aMetrics->underlineOffset = NS_MIN(aMetrics->underlineOffset,
|
||||
aMetrics->underlineSize - aMetrics->emDescent);
|
||||
}
|
||||
}
|
||||
|
@ -1816,7 +1817,7 @@ gfxFont::SanitizeMetrics(gfxFont::Metrics *aMetrics, PRBool aIsBadUnderlineFont)
|
|||
// will stay within the boundary.
|
||||
else if (aMetrics->underlineSize - aMetrics->underlineOffset > aMetrics->maxDescent) {
|
||||
if (aMetrics->underlineSize > aMetrics->maxDescent)
|
||||
aMetrics->underlineSize = PR_MAX(aMetrics->maxDescent, 1.0);
|
||||
aMetrics->underlineSize = NS_MAX(aMetrics->maxDescent, 1.0);
|
||||
// The max underlineOffset is 1px (the min underlineSize is 1px, and min maxDescent is 0px.)
|
||||
aMetrics->underlineOffset = aMetrics->underlineSize - aMetrics->maxDescent;
|
||||
}
|
||||
|
@ -1827,11 +1828,11 @@ gfxFont::SanitizeMetrics(gfxFont::Metrics *aMetrics, PRBool aIsBadUnderlineFont)
|
|||
gfxFloat halfOfStrikeoutSize = NS_floor(aMetrics->strikeoutSize / 2.0 + 0.5);
|
||||
if (halfOfStrikeoutSize + aMetrics->strikeoutOffset > aMetrics->maxAscent) {
|
||||
if (aMetrics->strikeoutSize > aMetrics->maxAscent) {
|
||||
aMetrics->strikeoutSize = PR_MAX(aMetrics->maxAscent, 1.0);
|
||||
aMetrics->strikeoutSize = NS_MAX(aMetrics->maxAscent, 1.0);
|
||||
halfOfStrikeoutSize = NS_floor(aMetrics->strikeoutSize / 2.0 + 0.5);
|
||||
}
|
||||
gfxFloat ascent = NS_floor(aMetrics->maxAscent + 0.5);
|
||||
aMetrics->strikeoutOffset = PR_MAX(halfOfStrikeoutSize, ascent / 2.0);
|
||||
aMetrics->strikeoutOffset = NS_MAX(halfOfStrikeoutSize, ascent / 2.0);
|
||||
}
|
||||
|
||||
// If overline is larger than the ascent, the line should be resized.
|
||||
|
@ -2048,7 +2049,7 @@ gfxFontGroup::BuildFontList()
|
|||
if (font->GetFontEntry()->mIsBadUnderlineFont) {
|
||||
gfxFloat first = mFonts[0]->GetMetrics().underlineOffset;
|
||||
gfxFloat bad = font->GetMetrics().underlineOffset;
|
||||
mUnderlineOffset = PR_MIN(first, bad);
|
||||
mUnderlineOffset = NS_MIN(first, bad);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2997,10 +2998,10 @@ gfxTextRun::GlyphRunIterator::NextRun() {
|
|||
if (mGlyphRun->mCharacterOffset >= mEndOffset)
|
||||
return PR_FALSE;
|
||||
|
||||
mStringStart = PR_MAX(mStartOffset, mGlyphRun->mCharacterOffset);
|
||||
mStringStart = NS_MAX(mStartOffset, mGlyphRun->mCharacterOffset);
|
||||
PRUint32 last = mNextIndex + 1 < mTextRun->mGlyphRuns.Length()
|
||||
? mTextRun->mGlyphRuns[mNextIndex + 1].mCharacterOffset : mTextRun->mCharacterCount;
|
||||
mStringEnd = PR_MIN(mEndOffset, last);
|
||||
mStringEnd = NS_MIN(mEndOffset, last);
|
||||
|
||||
++mNextIndex;
|
||||
return PR_TRUE;
|
||||
|
@ -3025,7 +3026,7 @@ AccountStorageForTextRun(gfxTextRun *aTextRun, PRInt32 aSign)
|
|||
}
|
||||
bytes += sizeof(gfxTextRun);
|
||||
gTextRunStorage += bytes*aSign;
|
||||
gTextRunStorageHighWaterMark = PR_MAX(gTextRunStorageHighWaterMark, gTextRunStorage);
|
||||
gTextRunStorageHighWaterMark = NS_MAX(gTextRunStorageHighWaterMark, gTextRunStorage);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -3355,17 +3356,17 @@ ClipPartialLigature(gfxTextRun *aTextRun, gfxFloat *aLeft, gfxFloat *aRight,
|
|||
{
|
||||
if (aLigature->mClipBeforePart) {
|
||||
if (aTextRun->IsRightToLeft()) {
|
||||
*aRight = PR_MIN(*aRight, aXOrigin);
|
||||
*aRight = NS_MIN(*aRight, aXOrigin);
|
||||
} else {
|
||||
*aLeft = PR_MAX(*aLeft, aXOrigin);
|
||||
*aLeft = NS_MAX(*aLeft, aXOrigin);
|
||||
}
|
||||
}
|
||||
if (aLigature->mClipAfterPart) {
|
||||
gfxFloat endEdge = aXOrigin + aTextRun->GetDirection()*aLigature->mPartWidth;
|
||||
if (aTextRun->IsRightToLeft()) {
|
||||
*aLeft = PR_MAX(*aLeft, endEdge);
|
||||
*aLeft = NS_MAX(*aLeft, endEdge);
|
||||
} else {
|
||||
*aRight = PR_MIN(*aRight, endEdge);
|
||||
*aRight = NS_MIN(*aRight, endEdge);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3732,12 +3733,12 @@ gfxTextRun::BreakAndMeasureText(PRUint32 aStart, PRUint32 aMaxLength,
|
|||
PRBool aCanWordWrap,
|
||||
gfxBreakPriority *aBreakPriority)
|
||||
{
|
||||
aMaxLength = PR_MIN(aMaxLength, mCharacterCount - aStart);
|
||||
aMaxLength = NS_MIN(aMaxLength, mCharacterCount - aStart);
|
||||
|
||||
NS_ASSERTION(aStart + aMaxLength <= mCharacterCount, "Substring out of range");
|
||||
|
||||
PRUint32 bufferStart = aStart;
|
||||
PRUint32 bufferLength = PR_MIN(aMaxLength, MEASUREMENT_BUFFER_SIZE);
|
||||
PRUint32 bufferLength = NS_MIN<PRUint32>(aMaxLength, MEASUREMENT_BUFFER_SIZE);
|
||||
PropertyProvider::Spacing spacingBuffer[MEASUREMENT_BUFFER_SIZE];
|
||||
PRBool haveSpacing = aProvider && (mFlags & gfxTextRunFactory::TEXT_ENABLE_SPACING) != 0;
|
||||
if (haveSpacing) {
|
||||
|
@ -3776,7 +3777,7 @@ gfxTextRun::BreakAndMeasureText(PRUint32 aStart, PRUint32 aMaxLength,
|
|||
if (i >= bufferStart + bufferLength) {
|
||||
// Fetch more spacing and hyphenation data
|
||||
bufferStart = i;
|
||||
bufferLength = PR_MIN(aStart + aMaxLength, i + MEASUREMENT_BUFFER_SIZE) - i;
|
||||
bufferLength = NS_MIN(aStart + aMaxLength, i + MEASUREMENT_BUFFER_SIZE) - i;
|
||||
if (haveSpacing) {
|
||||
GetAdjustedSpacing(this, bufferStart, bufferStart + bufferLength, aProvider,
|
||||
spacingBuffer);
|
||||
|
@ -4137,7 +4138,7 @@ gfxTextRun::SetMissingGlyph(PRUint32 aIndex, PRUint32 aChar)
|
|||
// Setting advance width to zero will prevent drawing the hexbox
|
||||
details->mAdvance = 0;
|
||||
} else {
|
||||
gfxFloat width = PR_MAX(glyphRun->mFont->GetMetrics().aveCharWidth,
|
||||
gfxFloat width = NS_MAX(glyphRun->mFont->GetMetrics().aveCharWidth,
|
||||
gfxFontMissingGlyphs::GetDesiredMinWidth(aChar));
|
||||
details->mAdvance = PRUint32(width*GetAppUnitsPerDevUnit());
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#define GFX_FONT_H
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "gfxTypes.h"
|
||||
#include "nsString.h"
|
||||
#include "gfxPoint.h"
|
||||
|
@ -167,8 +168,8 @@ struct THEBES_API gfxFontStyle {
|
|||
// Not meant to be called when sizeAdjust = 0.
|
||||
gfxFloat GetAdjustedSize(gfxFloat aspect) const {
|
||||
NS_ASSERTION(sizeAdjust != 0.0, "Not meant to be called when sizeAdjust = 0");
|
||||
gfxFloat adjustedSize = PR_MAX(NS_round(size*(sizeAdjust/aspect)), 1.0);
|
||||
return PR_MIN(adjustedSize, FONT_MAX_SIZE);
|
||||
gfxFloat adjustedSize = NS_MAX(NS_round(size*(sizeAdjust/aspect)), 1.0);
|
||||
return NS_MIN(adjustedSize, FONT_MAX_SIZE);
|
||||
}
|
||||
|
||||
PLDHashNumber Hash() const {
|
||||
|
|
|
@ -821,7 +821,7 @@ gfxMacPlatformFontList::GetStandardFamilyName(const nsAString& aFontName, nsAStr
|
|||
// convert the name to a Pascal-style Str255 to try as Quickdraw name
|
||||
Str255 qdname;
|
||||
NS_ConvertUTF16toUTF8 utf8name(aFontName);
|
||||
qdname[0] = PR_MAX(255, strlen(utf8name.get()));
|
||||
qdname[0] = NS_MAX<size_t>(255, strlen(utf8name.get()));
|
||||
memcpy(&qdname[1], utf8name.get(), qdname[0]);
|
||||
|
||||
// look up the Quickdraw name
|
||||
|
|
|
@ -1125,8 +1125,8 @@ nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext,
|
|||
skipGfxRect = nsLayoutUtils::RectToGfxRect(paddingRect, twipsPerPixel);
|
||||
} else if (hasBorderRadius) {
|
||||
skipGfxRect.Deflate(gfxMargin(
|
||||
0, PR_MAX(borderRadii[C_TL].height, borderRadii[C_TR].height),
|
||||
0, PR_MAX(borderRadii[C_BL].height, borderRadii[C_BR].height)));
|
||||
0, NS_MAX(borderRadii[C_TL].height, borderRadii[C_TR].height),
|
||||
0, NS_MAX(borderRadii[C_BL].height, borderRadii[C_BR].height)));
|
||||
}
|
||||
|
||||
for (PRUint32 i = shadows->Length(); i > 0; --i) {
|
||||
|
@ -1362,8 +1362,8 @@ nsCSSRendering::PaintBoxShadowInner(nsPresContext* aPresContext,
|
|||
gfxRect skipGfxRect = nsLayoutUtils::RectToGfxRect(skipRect, twipsPerPixel);
|
||||
if (hasBorderRadius) {
|
||||
skipGfxRect.Deflate(
|
||||
gfxMargin(0, PR_MAX(clipRectRadii[C_TL].height, clipRectRadii[C_TR].height),
|
||||
0, PR_MAX(clipRectRadii[C_BL].height, clipRectRadii[C_BR].height)));
|
||||
gfxMargin(0, NS_MAX(clipRectRadii[C_TL].height, clipRectRadii[C_TR].height),
|
||||
0, NS_MAX(clipRectRadii[C_BL].height, clipRectRadii[C_BR].height)));
|
||||
}
|
||||
|
||||
// When there's a blur radius, gfxAlphaBoxBlur leaves the skiprect area
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
|
||||
/* a presentation of a document, part 2 */
|
||||
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIContent.h"
|
||||
|
@ -623,7 +624,7 @@ StackArena::Allocate(size_t aSize)
|
|||
|
||||
// make sure we are aligned. Beard said 8 was safer then 4.
|
||||
// Round size to multiple of 8
|
||||
aSize = PR_ROUNDUP(aSize, 8);
|
||||
aSize = NS_ROUNDUP<size_t>(aSize, 8);
|
||||
|
||||
// if the size makes the stack overflow. Grab another block for the stack
|
||||
if (mPos + aSize >= BLOCK_INCREMENT)
|
||||
|
|
|
@ -2199,8 +2199,8 @@ nsGfxScrollFrameInner::ScrollBy(nsIntPoint aDelta,
|
|||
nsPoint clampAmount = mDestination - newPos;
|
||||
float appUnitsPerDevPixel = mOuter->PresContext()->AppUnitsPerDevPixel();
|
||||
*aOverflow = nsIntPoint(
|
||||
NSAppUnitsToIntPixels(PR_ABS(clampAmount.x), appUnitsPerDevPixel),
|
||||
NSAppUnitsToIntPixels(PR_ABS(clampAmount.y), appUnitsPerDevPixel));
|
||||
NSAppUnitsToIntPixels(NS_ABS(clampAmount.x), appUnitsPerDevPixel),
|
||||
NSAppUnitsToIntPixels(NS_ABS(clampAmount.y), appUnitsPerDevPixel));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2802,7 +2802,7 @@ PropertyProvider::CalcTabWidths(PRUint32 aStart, PRUint32 aLength)
|
|||
|
||||
PRUint32 startOffset = mStart.GetSkippedOffset();
|
||||
PRUint32 tabsEnd = mTabWidths ?
|
||||
mTabWidths->mLimit : PR_MAX(mTabWidthsAnalyzedLimit, startOffset);
|
||||
mTabWidths->mLimit : NS_MAX(mTabWidthsAnalyzedLimit, startOffset);
|
||||
|
||||
if (tabsEnd < aStart + aLength) {
|
||||
NS_ASSERTION(mReflowing,
|
||||
|
@ -2847,7 +2847,7 @@ PropertyProvider::CalcTabWidths(PRUint32 aStart, PRUint32 aLength)
|
|||
if (!mTabWidths) {
|
||||
// Delete any stale property that may be left on the frame
|
||||
mFrame->Properties().Delete(TabWidthProperty());
|
||||
mTabWidthsAnalyzedLimit = PR_MAX(mTabWidthsAnalyzedLimit,
|
||||
mTabWidthsAnalyzedLimit = NS_MAX(mTabWidthsAnalyzedLimit,
|
||||
aStart + aLength);
|
||||
}
|
||||
}
|
||||
|
@ -5001,7 +5001,7 @@ nsTextFrame::PaintTextSelectionDecorations(gfxContext* aCtx,
|
|||
if (type == aSelectionType) {
|
||||
pt.x = (aFramePt.x + xOffset -
|
||||
(mTextRun->IsRightToLeft() ? advance : 0)) / app;
|
||||
gfxFloat width = PR_ABS(advance) / app;
|
||||
gfxFloat width = NS_ABS(advance) / app;
|
||||
DrawSelectionDecorations(aCtx, aSelectionType, this, aTextPaintStyle,
|
||||
selectedStyle,
|
||||
pt, width, mAscent / app, decorationMetrics);
|
||||
|
@ -6209,7 +6209,7 @@ nsTextFrame::AddInlineMinWidthForFlow(nsRenderingContext *aRenderingContext,
|
|||
(mTextRun->GetFlags() & gfxTextRunFactory::TEXT_ENABLE_HYPHEN_BREAKS) != 0));
|
||||
if (hyphenating) {
|
||||
gfxSkipCharsIterator tmp(iter);
|
||||
len = PR_MIN(GetContentOffset() + GetInFlowContentLength(),
|
||||
len = NS_MIN<PRInt32>(GetContentOffset() + GetInFlowContentLength(),
|
||||
tmp.ConvertSkippedToOriginal(flowEndInTextRun)) - iter.GetOriginalOffset();
|
||||
}
|
||||
PropertyProvider provider(mTextRun, textStyle, frag, this,
|
||||
|
|
|
@ -256,7 +256,7 @@ nsUnicharStreamLoader::WriteSegmentFun(nsIInputStream *,
|
|||
++consumed;
|
||||
// XXX this is needed to make sure we don't underrun our buffer;
|
||||
// bug 160784 again
|
||||
consumed = PR_MAX(consumed, 0);
|
||||
consumed = NS_MAX<PRUint32>(consumed, 0);
|
||||
self->mDecoder->Reset();
|
||||
}
|
||||
} while (consumed < aCount);
|
||||
|
|
|
@ -756,7 +756,7 @@ nsDiskCacheStreamIO::FlushBufferToFile()
|
|||
|
||||
PRInt64 dataSize = mBinding->mCacheEntry->PredictedDataSize();
|
||||
if (dataSize != -1)
|
||||
mozilla::fallocate(mFD, PR_MIN(dataSize, kPreallocateLimit));
|
||||
mozilla::fallocate(mFD, NS_MIN<PRInt64>(dataSize, kPreallocateLimit));
|
||||
}
|
||||
|
||||
// write buffer
|
||||
|
|
|
@ -1090,8 +1090,7 @@ nsHttpTransaction::HandleContent(char *buf,
|
|||
// NOT persistent, we simply accept everything in |buf|.
|
||||
if (mConnection->IsPersistent() || mPreserveStream) {
|
||||
PRInt64 remaining = mContentLength - mContentRead;
|
||||
PRInt64 count64 = count;
|
||||
*contentRead = PR_MIN(count64, remaining);
|
||||
*contentRead = PRUint32(NS_MIN<PRInt64>(count, remaining));
|
||||
*contentRemaining = count - *contentRead;
|
||||
}
|
||||
else {
|
||||
|
@ -1113,7 +1112,7 @@ nsHttpTransaction::HandleContent(char *buf,
|
|||
if (*contentRead) {
|
||||
// update count of content bytes read and report progress...
|
||||
mContentRead += *contentRead;
|
||||
/* when uncommenting, take care of 64-bit integers w/ PR_MAX...
|
||||
/* when uncommenting, take care of 64-bit integers w/ NS_MAX...
|
||||
if (mProgressSink)
|
||||
mProgressSink->OnProgress(nsnull, nsnull, mContentRead, NS_MAX(0, mContentLength));
|
||||
*/
|
||||
|
|
|
@ -64,7 +64,7 @@ MyListener::OnDataAvailable(nsIRequest *req, nsISupports *ctxt,
|
|||
PRUint32 bytesRead=0;
|
||||
|
||||
while (count) {
|
||||
PRUint32 amount = PR_MIN(count, sizeof(buf));
|
||||
PRUint32 amount = NS_MIN<PRUint32>(count, sizeof(buf));
|
||||
|
||||
rv = stream->Read(buf, amount, &bytesRead);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
|
|
@ -137,7 +137,7 @@ TestListener::OnDataAvailable(nsIRequest *req, nsISupports *ctx,
|
|||
PRUint32 nread = 0;
|
||||
|
||||
while (count) {
|
||||
PRUint32 amount = PR_MIN(count, sizeof(buf));
|
||||
PRUint32 amount = NS_MIN<PRUint32>(count, sizeof(buf));
|
||||
|
||||
rv = is->Read(buf, amount, &nread);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
|
|
@ -200,7 +200,7 @@ TestProvider::OnDataWritable(nsIRequest *request, nsISupports *context,
|
|||
return NS_BASE_STREAM_CLOSED;
|
||||
|
||||
PRUint32 writeCount, amount;
|
||||
amount = PR_MIN(count, mDataLen - mOffset);
|
||||
amount = NS_MIN(count, mDataLen - mOffset);
|
||||
nsresult rv = output->Write(mData + mOffset, amount, &writeCount);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
printf("wrote %u bytes\n", writeCount);
|
||||
|
|
|
@ -205,7 +205,7 @@ MyListener::OnDataAvailable(nsIRequest *req, nsISupports *ctxt,
|
|||
rv = stream->ReadSegments(streamParse, &offset, count, &bytesRead);
|
||||
} else {
|
||||
while (count) {
|
||||
PRUint32 amount = PR_MIN(count, sizeof(buf));
|
||||
PRUint32 amount = NS_MIN<PRUint32>(count, sizeof(buf));
|
||||
rv = stream->Read(buf, amount, &bytesRead);
|
||||
count -= bytesRead;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ MyListener::OnDataAvailable(nsIRequest *req, nsISupports *ctx,
|
|||
char buf[4096];
|
||||
PRUint32 n, bytesRead;
|
||||
while (count) {
|
||||
n = PR_MIN(count, sizeof(buf));
|
||||
n = NS_MIN<PRUint32>(count, sizeof(buf));
|
||||
rv = stream->Read(buf, n, &bytesRead);
|
||||
if (NS_FAILED(rv))
|
||||
break;
|
||||
|
|
|
@ -517,7 +517,7 @@ InputTestConsumer::OnDataAvailable(nsIRequest *request,
|
|||
URLLoadInfo* info = (URLLoadInfo*)context;
|
||||
|
||||
while (aLength) {
|
||||
size = PR_MIN(aLength, sizeof(buf));
|
||||
size = NS_MIN<PRUint32>(aLength, sizeof(buf));
|
||||
|
||||
rv = aIStream->Read(buf, size, &amt);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
|
|
@ -98,7 +98,7 @@ public:
|
|||
nsresult rv;
|
||||
|
||||
while (count) {
|
||||
PRUint32 n, amt = PR_MIN(count, sizeof(buf));
|
||||
PRUint32 n, amt = NS_MIN<PRUint32>(count, sizeof(buf));
|
||||
|
||||
rv = stream->Read(buf, amt, &n);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
|
|
@ -96,7 +96,7 @@ public:
|
|||
nsresult rv;
|
||||
|
||||
while (count) {
|
||||
PRUint32 n, amt = PR_MIN(count, sizeof(buf));
|
||||
PRUint32 n, amt = NS_MIN<PRUint32>(count, sizeof(buf));
|
||||
|
||||
rv = stream->Read(buf, amt, &n);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
|
|
@ -175,7 +175,7 @@ TestListener::OnDataAvailable( nsIChannel *aChannel,
|
|||
unsigned int bytesRead;
|
||||
// Read a buffer full or the number remaining (whichever is smaller).
|
||||
rv = aStream->Read( buffer,
|
||||
PR_MIN( sizeof( buffer ), bytesRemaining ),
|
||||
NS_MIN( sizeof( buffer ), bytesRemaining ),
|
||||
&bytesRead );
|
||||
if ( NS_SUCCEEDED( rv ) ) {
|
||||
// Write the bytes just read to the output file.
|
||||
|
|
|
@ -105,7 +105,7 @@ InputTestConsumer::OnDataAvailable(nsIRequest *request,
|
|||
nsresult rv;
|
||||
|
||||
while (aLength) {
|
||||
size = PR_MIN(aLength, sizeof(buf));
|
||||
size = NS_MIN<PRUint32>(aLength, sizeof(buf));
|
||||
rv = aIStream->Read(buf, size, &amt);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ASSERTION((NS_BASE_STREAM_WOULD_BLOCK != rv),
|
||||
|
|
|
@ -56,8 +56,9 @@ CPPSRCS = ssltunnel.cpp
|
|||
LOCAL_INCLUDES += $(NSPR_CFLAGS) $(NSS_CFLAGS)
|
||||
|
||||
LIBS = \
|
||||
$(NSPR_LIBS) \
|
||||
$(NSS_LIBS) \
|
||||
$(NULL)
|
||||
$(NSPR_LIBS) \
|
||||
$(NSS_LIBS) \
|
||||
$(MOZALLOC_LIB) \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include "prnetdb.h"
|
||||
#include "prtpool.h"
|
||||
#include "prtypes.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nss.h"
|
||||
#include "pk11func.h"
|
||||
#include "key.h"
|
||||
|
@ -231,8 +232,8 @@ struct relayBuffer
|
|||
}
|
||||
|
||||
bool empty() { return bufferhead == buffertail; }
|
||||
size_t free() { return bufferend - buffertail; }
|
||||
size_t margin() { return free() + BUF_MARGIN; }
|
||||
size_t areafree() { return bufferend - buffertail; }
|
||||
size_t margin() { return areafree() + BUF_MARGIN; }
|
||||
size_t present() { return buffertail - bufferhead; }
|
||||
};
|
||||
|
||||
|
@ -693,17 +694,17 @@ void HandleConnection(void* data)
|
|||
continue;
|
||||
} // PR_POLL_EXCEPT, PR_POLL_ERR, PR_POLL_HUP handling
|
||||
|
||||
if (out_flags & PR_POLL_READ && !buffers[s].free())
|
||||
if (out_flags & PR_POLL_READ && !buffers[s].areafree())
|
||||
{
|
||||
LOG_DEBUG((" no place in read buffer but got read flag, dropping it now!"));
|
||||
in_flags &= ~PR_POLL_READ;
|
||||
}
|
||||
|
||||
if (out_flags & PR_POLL_READ && buffers[s].free())
|
||||
if (out_flags & PR_POLL_READ && buffers[s].areafree())
|
||||
{
|
||||
LOG_DEBUG((" :reading"));
|
||||
PRInt32 bytesRead = PR_Recv(sockets[s].fd, buffers[s].buffertail,
|
||||
buffers[s].free(), 0, PR_INTERVAL_NO_TIMEOUT);
|
||||
buffers[s].areafree(), 0, PR_INTERVAL_NO_TIMEOUT);
|
||||
|
||||
if (bytesRead == 0)
|
||||
{
|
||||
|
@ -788,7 +789,7 @@ void HandleConnection(void* data)
|
|||
break;
|
||||
} // end of CONNECT handling
|
||||
|
||||
if (!buffers[s].free())
|
||||
if (!buffers[s].areafree())
|
||||
{
|
||||
// Do not poll for read when the buffer is full
|
||||
LOG_DEBUG((" no place in our read buffer, stop reading"));
|
||||
|
@ -1283,8 +1284,8 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
// create a thread pool to handle connections
|
||||
threads = PR_CreateThreadPool(PR_MAX(INITIAL_THREADS, servers.size()*2),
|
||||
PR_MAX(MAX_THREADS, servers.size()*2),
|
||||
threads = PR_CreateThreadPool(NS_MAX<PRInt32>(INITIAL_THREADS, servers.size()*2),
|
||||
NS_MAX<PRInt32>(MAX_THREADS, servers.size()*2),
|
||||
DEFAULT_STACKSIZE);
|
||||
if (!threads) {
|
||||
LOG_ERROR(("Failed to create thread pool\n"));
|
||||
|
|
|
@ -67,7 +67,7 @@ GfxInfo::Init()
|
|||
if (CGLQueryRendererInfo(0xffffffff, &renderer, &rendererCount) != kCGLNoError)
|
||||
return rv;
|
||||
|
||||
rendererCount = (GLint) PR_MIN(rendererCount, (GLint) NS_ARRAY_LENGTH(mRendererIDs));
|
||||
rendererCount = (GLint) NS_MIN(rendererCount, (GLint) NS_ARRAY_LENGTH(mRendererIDs));
|
||||
for (GLint i = 0; i < rendererCount; i++) {
|
||||
GLint prop = 0;
|
||||
|
||||
|
|
|
@ -728,7 +728,7 @@ nsNativeThemeCocoa::DrawCheckboxOrRadio(CGContextRef cgContext, PRBool inCheckbo
|
|||
[cell setControlTint:(FrameIsInActiveWindow(aFrame) ? [NSColor currentControlTint] : NSClearControlTint)];
|
||||
|
||||
// Ensure that the control is square.
|
||||
float length = PR_MIN(inBoxRect.size.width, inBoxRect.size.height);
|
||||
float length = NS_MIN(inBoxRect.size.width, inBoxRect.size.height);
|
||||
HIRect drawRect = CGRectMake(inBoxRect.origin.x + (int)((inBoxRect.size.width - length) / 2.0f),
|
||||
inBoxRect.origin.y + (int)((inBoxRect.size.height - length) / 2.0f),
|
||||
length, length);
|
||||
|
@ -2741,5 +2741,5 @@ nsNativeThemeCocoa::GetProgressMaxValue(nsIFrame* aFrame)
|
|||
}
|
||||
}
|
||||
|
||||
return (double)PR_MAX(CheckIntAttr(aFrame, nsWidgetAtoms::max, 100), 1);
|
||||
return (double)NS_MAX(CheckIntAttr(aFrame, nsWidgetAtoms::max, 100), 1);
|
||||
}
|
||||
|
|
|
@ -309,8 +309,8 @@ UpdateOffScreenBuffers(int aDepth, QSize aSize, QWidget* aWidget = nsnull)
|
|||
return true;
|
||||
}
|
||||
|
||||
gBufferMaxSize.width = PR_MAX(gBufferMaxSize.width, size.width);
|
||||
gBufferMaxSize.height = PR_MAX(gBufferMaxSize.height, size.height);
|
||||
gBufferMaxSize.width = NS_MAX(gBufferMaxSize.width, size.width);
|
||||
gBufferMaxSize.height = NS_MAX(gBufferMaxSize.height, size.height);
|
||||
|
||||
// Check if system depth has related gfxImage format
|
||||
gfxASurface::gfxImageFormat format =
|
||||
|
|
|
@ -1201,7 +1201,7 @@ nsIMM32Handler::HandleComposition(nsWindow* aWindow,
|
|||
PRUint32 maxlen = compANSIStr.Length();
|
||||
mClauseArray[0] = 0; // first value must be 0
|
||||
for (PRInt32 i = 1; i < clauseArrayLength; i++) {
|
||||
PRUint32 len = PR_MIN(mClauseArray[i], maxlen);
|
||||
PRUint32 len = NS_MIN(mClauseArray[i], maxlen);
|
||||
mClauseArray[i] = ::MultiByteToWideChar(GetKeyboardCodePage(),
|
||||
MB_PRECOMPOSED,
|
||||
(LPCSTR)compANSIStr.get(),
|
||||
|
@ -1212,7 +1212,7 @@ nsIMM32Handler::HandleComposition(nsWindow* aWindow,
|
|||
}
|
||||
// compClauseArrayLength may be negative. I.e., ImmGetCompositionStringW
|
||||
// may return an error code.
|
||||
mClauseArray.SetLength(PR_MAX(0, clauseArrayLength));
|
||||
mClauseArray.SetLength(NS_MAX<long>(0, clauseArrayLength));
|
||||
|
||||
PR_LOG(gIMM32Log, PR_LOG_ALWAYS,
|
||||
("IMM32: HandleComposition, GCS_COMPCLAUSE, mClauseLength=%ld\n",
|
||||
|
@ -1238,7 +1238,7 @@ nsIMM32Handler::HandleComposition(nsWindow* aWindow,
|
|||
|
||||
// attrStrLen may be negative. I.e., ImmGetCompositionStringW may return an
|
||||
// error code.
|
||||
mAttributeArray.SetLength(PR_MAX(0, attrArrayLength));
|
||||
mAttributeArray.SetLength(NS_MAX<long>(0, attrArrayLength));
|
||||
|
||||
PR_LOG(gIMM32Log, PR_LOG_ALWAYS,
|
||||
("IMM32: HandleComposition, GCS_COMPATTR, mAttributeLength=%ld\n",
|
||||
|
|
|
@ -2527,7 +2527,7 @@ void nsWindow::UpdateOpaqueRegion(const nsIntRegion &aOpaqueRegion)
|
|||
if (mCustomNonClient) {
|
||||
// The minimum glass height must be the caption buttons height,
|
||||
// otherwise the buttons are drawn incorrectly.
|
||||
largest.y = PR_MAX(largest.y,
|
||||
largest.y = NS_MAX<PRUint32>(largest.y,
|
||||
nsUXThemeData::sCommandButtons[CMDBUTTONIDX_BUTTONBOX].cy);
|
||||
}
|
||||
margins.cyTopHeight = largest.y;
|
||||
|
@ -3370,7 +3370,7 @@ nsWindow::OverrideSystemMouseScrollSpeed(PRInt32 aOriginalDelta,
|
|||
// on the document of SystemParametersInfo in MSDN.
|
||||
const PRUint32 kSystemDefaultScrollingSpeed = 3;
|
||||
|
||||
PRInt32 absOriginDelta = PR_ABS(aOriginalDelta);
|
||||
PRInt32 absOriginDelta = NS_ABS(aOriginalDelta);
|
||||
|
||||
// Compute the simple overridden speed.
|
||||
PRInt32 absComputedOverriddenDelta;
|
||||
|
@ -3428,7 +3428,7 @@ nsWindow::OverrideSystemMouseScrollSpeed(PRInt32 aOriginalDelta,
|
|||
}
|
||||
|
||||
absComputedOverriddenDelta =
|
||||
PR_MIN(absComputedOverriddenDelta, absDeltaLimit);
|
||||
NS_MIN(absComputedOverriddenDelta, absDeltaLimit);
|
||||
|
||||
aOverriddenDelta = (aOriginalDelta > 0) ? absComputedOverriddenDelta :
|
||||
-absComputedOverriddenDelta;
|
||||
|
@ -6937,8 +6937,8 @@ LRESULT nsWindow::OnKeyDown(const MSG &aMsg,
|
|||
}
|
||||
|
||||
if (numOfUniChars > 0 || numOfShiftedChars > 0 || numOfUnshiftedChars > 0) {
|
||||
PRUint32 num = PR_MAX(numOfUniChars,
|
||||
PR_MAX(numOfShiftedChars, numOfUnshiftedChars));
|
||||
PRUint32 num = NS_MAX(numOfUniChars,
|
||||
NS_MAX(numOfShiftedChars, numOfUnshiftedChars));
|
||||
PRUint32 skipUniChars = num - numOfUniChars;
|
||||
PRUint32 skipShiftedChars = num - numOfShiftedChars;
|
||||
PRUint32 skipUnshiftedChars = num - numOfUnshiftedChars;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "nscore.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include <emmintrin.h>
|
||||
#include <nsUTF8Utils.h>
|
||||
|
||||
|
@ -11,7 +12,7 @@ LossyConvertEncoding16to8::write_sse2(const PRUnichar* aSource,
|
|||
// Align source to a 16-byte boundary.
|
||||
PRUint32 i = 0;
|
||||
PRUint32 alignLen =
|
||||
PR_MIN(aSourceLength, (-NS_PTR_TO_UINT32(aSource) & 0xf) / sizeof(PRUnichar));
|
||||
NS_MIN<PRUint32>(aSourceLength, PRUint32(-NS_PTR_TO_INT32(aSource) & 0xf) / sizeof(PRUnichar));
|
||||
for (; i < alignLen; i++) {
|
||||
dest[i] = static_cast<unsigned char>(aSource[i]);
|
||||
}
|
||||
|
@ -64,7 +65,7 @@ LossyConvertEncoding8to16::write_sse2(const char* aSource,
|
|||
// to wait for a load to complete, but you can keep on moving after issuing a
|
||||
// store.
|
||||
PRUint32 i = 0;
|
||||
PRUint32 alignLen = PR_MIN(aSourceLength, (-NS_PTR_TO_UINT32(aSource) & 0xf));
|
||||
PRUint32 alignLen = NS_MIN(aSourceLength, PRUint32(-NS_PTR_TO_INT32(aSource) & 0xf));
|
||||
for (; i < alignLen; i++) {
|
||||
dest[i] = static_cast<unsigned char>(aSource[i]);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче