mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 701666 - Removing TxObject define and Double typedef from xslt. r=Ms2ger
This commit is contained in:
parent
d4fc966448
commit
a190fc9cc6
@ -106,10 +106,4 @@ public:
|
||||
static double toDouble(const nsAString& aStr);
|
||||
};
|
||||
|
||||
// XXX These should go away eventually.
|
||||
#define TxObject txObject
|
||||
typedef txDouble Double;
|
||||
|
||||
// XXX
|
||||
|
||||
#endif
|
||||
|
@ -50,20 +50,20 @@
|
||||
*/
|
||||
|
||||
//-- Initialize Double related constants
|
||||
const dpun Double::NaN = DOUBLE_NaN;
|
||||
const dpun txDouble::NaN = DOUBLE_NaN;
|
||||
#ifdef IS_BIG_ENDIAN
|
||||
const dpun Double::POSITIVE_INFINITY = {{DOUBLE_HI32_EXPMASK, 0}};
|
||||
const dpun Double::NEGATIVE_INFINITY = {{DOUBLE_HI32_EXPMASK | DOUBLE_HI32_SIGNBIT, 0}};
|
||||
const dpun txDouble::POSITIVE_INFINITY = {{DOUBLE_HI32_EXPMASK, 0}};
|
||||
const dpun txDouble::NEGATIVE_INFINITY = {{DOUBLE_HI32_EXPMASK | DOUBLE_HI32_SIGNBIT, 0}};
|
||||
#else
|
||||
const dpun Double::POSITIVE_INFINITY = {{0, DOUBLE_HI32_EXPMASK}};
|
||||
const dpun Double::NEGATIVE_INFINITY = {{0, DOUBLE_HI32_EXPMASK | DOUBLE_HI32_SIGNBIT}};
|
||||
const dpun txDouble::POSITIVE_INFINITY = {{0, DOUBLE_HI32_EXPMASK}};
|
||||
const dpun txDouble::NEGATIVE_INFINITY = {{0, DOUBLE_HI32_EXPMASK | DOUBLE_HI32_SIGNBIT}};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Determines whether the given double represents positive or negative
|
||||
* inifinity
|
||||
*/
|
||||
bool Double::isInfinite(double aDbl)
|
||||
bool txDouble::isInfinite(double aDbl)
|
||||
{
|
||||
return ((DOUBLE_HI32(aDbl) & ~DOUBLE_HI32_SIGNBIT) == DOUBLE_HI32_EXPMASK &&
|
||||
!DOUBLE_LO32(aDbl));
|
||||
@ -72,7 +72,7 @@ bool Double::isInfinite(double aDbl)
|
||||
/*
|
||||
* Determines whether the given double is NaN
|
||||
*/
|
||||
bool Double::isNaN(double aDbl)
|
||||
bool txDouble::isNaN(double aDbl)
|
||||
{
|
||||
return DOUBLE_IS_NaN(aDbl);
|
||||
}
|
||||
@ -80,7 +80,7 @@ bool Double::isNaN(double aDbl)
|
||||
/*
|
||||
* Determines whether the given double is negative
|
||||
*/
|
||||
bool Double::isNeg(double aDbl)
|
||||
bool txDouble::isNeg(double aDbl)
|
||||
{
|
||||
return (DOUBLE_HI32(aDbl) & DOUBLE_HI32_SIGNBIT) != 0;
|
||||
}
|
||||
@ -170,7 +170,7 @@ public:
|
||||
{
|
||||
if (mState == eIllegal || mBuffer.IsEmpty() ||
|
||||
(mBuffer.Length() == 1 && mBuffer[0] == '.')) {
|
||||
return Double::NaN;
|
||||
return txDouble::NaN;
|
||||
}
|
||||
return mSign*PR_strtod(mBuffer.get(), 0);
|
||||
}
|
||||
@ -189,7 +189,7 @@ private:
|
||||
} mSign;
|
||||
};
|
||||
|
||||
double Double::toDouble(const nsAString& aSrc)
|
||||
double txDouble::toDouble(const nsAString& aSrc)
|
||||
{
|
||||
txStringToDouble sink;
|
||||
nsAString::const_iterator fromBegin, fromEnd;
|
||||
@ -202,7 +202,7 @@ double Double::toDouble(const nsAString& aSrc)
|
||||
* The result into the destination String.
|
||||
* @return the given dest string
|
||||
*/
|
||||
void Double::toString(double aValue, nsAString& aDest)
|
||||
void txDouble::toString(double aValue, nsAString& aDest)
|
||||
{
|
||||
|
||||
// check for special cases
|
||||
|
@ -46,7 +46,7 @@ class txListIterator;
|
||||
/**
|
||||
* Represents an ordered list of Object pointers. Modeled after a Java 2 List.
|
||||
**/
|
||||
class txList : public TxObject {
|
||||
class txList : public txObject {
|
||||
|
||||
friend class txListIterator;
|
||||
|
||||
|
@ -82,7 +82,7 @@ class ProcessingInstruction;
|
||||
// Abstract Class defining the interface for a Node. See NodeDefinition below
|
||||
// for the actual implementation of the WC3 node.
|
||||
//
|
||||
class Node : public TxObject
|
||||
class Node : public txObject
|
||||
{
|
||||
public:
|
||||
//Node type constants
|
||||
|
@ -396,8 +396,8 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// check for NaN or +/-Inf
|
||||
if (Double::isNaN(start) ||
|
||||
Double::isInfinite(start) ||
|
||||
if (txDouble::isNaN(start) ||
|
||||
txDouble::isInfinite(start) ||
|
||||
start >= src.Length() + 0.5) {
|
||||
aContext->recycler()->getEmptyStringResult(aResult);
|
||||
|
||||
@ -412,7 +412,7 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
end += start;
|
||||
if (Double::isNaN(end) || end < 0) {
|
||||
if (txDouble::isNaN(end) || end < 0) {
|
||||
aContext->recycler()->getEmptyStringResult(aResult);
|
||||
|
||||
return NS_OK;
|
||||
@ -546,7 +546,7 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
||||
nsAutoString resultStr;
|
||||
txXPathNodeUtils::appendNodeValue(aContext->getContextNode(),
|
||||
resultStr);
|
||||
res = Double::toDouble(resultStr);
|
||||
res = txDouble::toDouble(resultStr);
|
||||
}
|
||||
return aContext->recycler()->getNumberResult(res, aResult);
|
||||
}
|
||||
@ -556,8 +556,8 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
||||
rv = evaluateToNumber(mParams[0], aContext, &dbl);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!Double::isNaN(dbl) && !Double::isInfinite(dbl)) {
|
||||
if (Double::isNeg(dbl) && dbl >= -0.5) {
|
||||
if (!txDouble::isNaN(dbl) && !txDouble::isInfinite(dbl)) {
|
||||
if (txDouble::isNeg(dbl) && dbl >= -0.5) {
|
||||
dbl *= 0;
|
||||
}
|
||||
else {
|
||||
@ -573,9 +573,9 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
||||
rv = evaluateToNumber(mParams[0], aContext, &dbl);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!Double::isNaN(dbl) &&
|
||||
!Double::isInfinite(dbl) &&
|
||||
!(dbl == 0 && Double::isNeg(dbl))) {
|
||||
if (!txDouble::isNaN(dbl) &&
|
||||
!txDouble::isInfinite(dbl) &&
|
||||
!(dbl == 0 && txDouble::isNeg(dbl))) {
|
||||
dbl = floor(dbl);
|
||||
}
|
||||
|
||||
@ -587,8 +587,8 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
||||
rv = evaluateToNumber(mParams[0], aContext, &dbl);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!Double::isNaN(dbl) && !Double::isInfinite(dbl)) {
|
||||
if (Double::isNeg(dbl) && dbl > -1) {
|
||||
if (!txDouble::isNaN(dbl) && !txDouble::isInfinite(dbl)) {
|
||||
if (txDouble::isNeg(dbl) && dbl > -1) {
|
||||
dbl *= 0;
|
||||
}
|
||||
else {
|
||||
@ -610,7 +610,7 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
||||
for (i = 0; i < nodes->size(); ++i) {
|
||||
nsAutoString resultStr;
|
||||
txXPathNodeUtils::appendNodeValue(nodes->get(i), resultStr);
|
||||
res += Double::toDouble(resultStr);
|
||||
res += txDouble::toDouble(resultStr);
|
||||
}
|
||||
return aContext->recycler()->getNumberResult(res, aResult);
|
||||
}
|
||||
|
@ -419,7 +419,7 @@ txExprParser::createFilterOrStep(txExprLexer& lexer, txIParseContext* aContext,
|
||||
break;
|
||||
case Token::NUMBER:
|
||||
{
|
||||
expr = new txLiteralExpr(Double::toDouble(tok->Value()));
|
||||
expr = new txLiteralExpr(txDouble::toDouble(tok->Value()));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -103,7 +103,7 @@ txLiteralExpr::toString(nsAString& aStr)
|
||||
}
|
||||
case txAExprResult::NUMBER:
|
||||
{
|
||||
Double::toString(mValue->numberValue(), aStr);
|
||||
txDouble::toString(mValue->numberValue(), aStr);
|
||||
return;
|
||||
}
|
||||
case txAExprResult::STRING:
|
||||
|
@ -501,7 +501,7 @@ txNodeSet::numberValue()
|
||||
nsAutoString str;
|
||||
stringValue(str);
|
||||
|
||||
return Double::toDouble(str);
|
||||
return txDouble::toDouble(str);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -86,7 +86,7 @@ txNodeSetAdaptor::ItemAsNumber(PRUint32 aIndex, double *aResult)
|
||||
nsAutoString result;
|
||||
txXPathNodeUtils::appendNodeValue(NodeSet()->get(aIndex), result);
|
||||
|
||||
*aResult = Double::toDouble(result);
|
||||
*aResult = txDouble::toDouble(result);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -70,16 +70,16 @@ txNumberExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
||||
if (rightDbl == 0) {
|
||||
#if defined(XP_WIN)
|
||||
/* XXX MSVC miscompiles such that (NaN == 0) */
|
||||
if (Double::isNaN(rightDbl))
|
||||
result = Double::NaN;
|
||||
if (txDouble::isNaN(rightDbl))
|
||||
result = txDouble::NaN;
|
||||
else
|
||||
#endif
|
||||
if (leftDbl == 0 || Double::isNaN(leftDbl))
|
||||
result = Double::NaN;
|
||||
else if (Double::isNeg(leftDbl) ^ Double::isNeg(rightDbl))
|
||||
result = Double::NEGATIVE_INFINITY;
|
||||
if (leftDbl == 0 || txDouble::isNaN(leftDbl))
|
||||
result = txDouble::NaN;
|
||||
else if (txDouble::isNeg(leftDbl) ^ txDouble::isNeg(rightDbl))
|
||||
result = txDouble::NEGATIVE_INFINITY;
|
||||
else
|
||||
result = Double::POSITIVE_INFINITY;
|
||||
result = txDouble::POSITIVE_INFINITY;
|
||||
}
|
||||
else
|
||||
result = leftDbl / rightDbl;
|
||||
@ -87,12 +87,12 @@ txNumberExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
|
||||
|
||||
case MODULUS:
|
||||
if (rightDbl == 0) {
|
||||
result = Double::NaN;
|
||||
result = txDouble::NaN;
|
||||
}
|
||||
else {
|
||||
#if defined(XP_WIN)
|
||||
/* Workaround MS fmod bug where 42 % (1/0) => NaN, not 42. */
|
||||
if (!Double::isInfinite(leftDbl) && Double::isInfinite(rightDbl))
|
||||
if (!txDouble::isInfinite(leftDbl) && txDouble::isInfinite(rightDbl))
|
||||
result = leftDbl;
|
||||
else
|
||||
#endif
|
||||
|
@ -67,7 +67,7 @@ short NumberResult::getResultType() {
|
||||
void
|
||||
NumberResult::stringValue(nsString& aResult)
|
||||
{
|
||||
Double::toString(value, aResult);
|
||||
txDouble::toString(value, aResult);
|
||||
}
|
||||
|
||||
const nsString*
|
||||
@ -80,7 +80,7 @@ bool NumberResult::booleanValue() {
|
||||
// OG+
|
||||
// As per the XPath spec, the boolean value of a number is true if and only if
|
||||
// it is neither positive 0 nor negative 0 nor NaN
|
||||
return (bool)(value != 0.0 && !Double::isNaN(value));
|
||||
return (bool)(value != 0.0 && !txDouble::isNaN(value));
|
||||
// OG-
|
||||
} //-- booleanValue
|
||||
|
||||
|
@ -84,6 +84,6 @@ bool StringResult::booleanValue() {
|
||||
} //-- booleanValue
|
||||
|
||||
double StringResult::numberValue() {
|
||||
return Double::toDouble(mValue);
|
||||
return txDouble::toDouble(mValue);
|
||||
} //-- numberValue
|
||||
|
||||
|
@ -58,7 +58,7 @@ double
|
||||
txUnionNodeTest::getDefaultPriority()
|
||||
{
|
||||
NS_ERROR("Don't call getDefaultPriority on txUnionPattern");
|
||||
return Double::NaN;
|
||||
return txDouble::NaN;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -611,7 +611,7 @@ txEXSLTFunctionCall::evaluate(txIEvalContext *aContext,
|
||||
|
||||
if (nodes->isEmpty()) {
|
||||
return aContext->recycler()->
|
||||
getNumberResult(Double::NaN, aResult);
|
||||
getNumberResult(txDouble::NaN, aResult);
|
||||
}
|
||||
|
||||
bool findMax = mType == MAX;
|
||||
@ -622,9 +622,9 @@ txEXSLTFunctionCall::evaluate(txIEvalContext *aContext,
|
||||
for (i = 0; i < len; ++i) {
|
||||
nsAutoString str;
|
||||
txXPathNodeUtils::appendNodeValue(nodes->get(i), str);
|
||||
double val = Double::toDouble(str);
|
||||
if (Double::isNaN(val)) {
|
||||
res = Double::NaN;
|
||||
double val = txDouble::toDouble(str);
|
||||
if (txDouble::isNaN(val)) {
|
||||
res = txDouble::NaN;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -661,8 +661,8 @@ txEXSLTFunctionCall::evaluate(txIEvalContext *aContext,
|
||||
nsAutoString str;
|
||||
const txXPathNode& node = nodes->get(i);
|
||||
txXPathNodeUtils::appendNodeValue(node, str);
|
||||
double val = Double::toDouble(str);
|
||||
if (Double::isNaN(val)) {
|
||||
double val = txDouble::toDouble(str);
|
||||
if (txDouble::isNaN(val)) {
|
||||
resultSet->clear();
|
||||
break;
|
||||
}
|
||||
|
@ -112,16 +112,16 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext,
|
||||
}
|
||||
|
||||
// Special cases
|
||||
if (Double::isNaN(value)) {
|
||||
if (txDouble::isNaN(value)) {
|
||||
return aContext->recycler()->getStringResult(format->mNaN, aResult);
|
||||
}
|
||||
|
||||
if (value == Double::POSITIVE_INFINITY) {
|
||||
if (value == txDouble::POSITIVE_INFINITY) {
|
||||
return aContext->recycler()->getStringResult(format->mInfinity,
|
||||
aResult);
|
||||
}
|
||||
|
||||
if (value == Double::NEGATIVE_INFINITY) {
|
||||
if (value == txDouble::NEGATIVE_INFINITY) {
|
||||
nsAutoString res;
|
||||
res.Append(format->mMinusSign);
|
||||
res.Append(format->mInfinity);
|
||||
@ -143,7 +143,7 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext,
|
||||
|
||||
// Get right subexpression
|
||||
inQuote = false;
|
||||
if (Double::isNeg(value)) {
|
||||
if (txDouble::isNeg(value)) {
|
||||
while (pos < formatLen &&
|
||||
(inQuote ||
|
||||
formatStr.CharAt(pos) != format->mPatternSeparator)) {
|
||||
|
@ -51,7 +51,7 @@
|
||||
class nsIAtom;
|
||||
class txExecutionState;
|
||||
|
||||
class txInstruction : public TxObject
|
||||
class txInstruction : public txObject
|
||||
{
|
||||
public:
|
||||
txInstruction()
|
||||
|
@ -180,8 +180,8 @@ txNodeSorter::sortNodeSet(txNodeSet* aNodes, txExecutionState* aEs,
|
||||
PRUint32 len = static_cast<PRUint32>(aNodes->size());
|
||||
|
||||
// Limit resource use to something sane.
|
||||
PRUint32 itemSize = sizeof(PRUint32) + mNKeys * sizeof(TxObject*);
|
||||
if (mNKeys > (PR_UINT32_MAX - sizeof(PRUint32)) / sizeof(TxObject*) ||
|
||||
PRUint32 itemSize = sizeof(PRUint32) + mNKeys * sizeof(txObject*);
|
||||
if (mNKeys > (PR_UINT32_MAX - sizeof(PRUint32)) / sizeof(txObject*) ||
|
||||
len >= PR_UINT32_MAX / itemSize) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
@ -190,13 +190,13 @@ txNodeSorter::sortNodeSet(txNodeSet* aNodes, txExecutionState* aEs,
|
||||
NS_ENSURE_TRUE(mem, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
PRUint32* indexes = static_cast<PRUint32*>(mem);
|
||||
TxObject** sortValues = reinterpret_cast<TxObject**>(indexes + len);
|
||||
txObject** sortValues = reinterpret_cast<txObject**>(indexes + len);
|
||||
|
||||
PRUint32 i;
|
||||
for (i = 0; i < len; ++i) {
|
||||
indexes[i] = i;
|
||||
}
|
||||
memset(sortValues, 0, len * mNKeys * sizeof(TxObject*));
|
||||
memset(sortValues, 0, len * mNKeys * sizeof(txObject*));
|
||||
|
||||
// Sort the indexarray
|
||||
SortData sortData;
|
||||
@ -248,9 +248,9 @@ txNodeSorter::compareNodes(const void* aIndexA, const void* aIndexB,
|
||||
txListIterator iter(&sortData->mNodeSorter->mSortKeys);
|
||||
PRUint32 indexA = *static_cast<const PRUint32*>(aIndexA);
|
||||
PRUint32 indexB = *static_cast<const PRUint32*>(aIndexB);
|
||||
TxObject** sortValuesA = sortData->mSortValues +
|
||||
txObject** sortValuesA = sortData->mSortValues +
|
||||
indexA * sortData->mNodeSorter->mNKeys;
|
||||
TxObject** sortValuesB = sortData->mSortValues +
|
||||
txObject** sortValuesB = sortData->mSortValues +
|
||||
indexB * sortData->mNodeSorter->mNKeys;
|
||||
|
||||
unsigned int i;
|
||||
@ -280,7 +280,7 @@ txNodeSorter::compareNodes(const void* aIndexA, const void* aIndexB,
|
||||
|
||||
//static
|
||||
bool
|
||||
txNodeSorter::calcSortValue(TxObject*& aSortValue, SortKey* aKey,
|
||||
txNodeSorter::calcSortValue(txObject*& aSortValue, SortKey* aKey,
|
||||
SortData* aSortData, PRUint32 aNodeIndex)
|
||||
{
|
||||
aSortData->mContext->setPosition(aNodeIndex + 1); // position is 1-based
|
||||
|
@ -46,7 +46,7 @@
|
||||
class Expr;
|
||||
class txExecutionState;
|
||||
class txNodeSet;
|
||||
class TxObject;
|
||||
class txObject;
|
||||
class txXPathResultComparator;
|
||||
class txIEvalContext;
|
||||
class txNodeSetContext;
|
||||
@ -72,7 +72,7 @@ private:
|
||||
{
|
||||
txNodeSorter* mNodeSorter;
|
||||
txNodeSetContext* mContext;
|
||||
TxObject** mSortValues;
|
||||
txObject** mSortValues;
|
||||
nsresult mRv;
|
||||
};
|
||||
struct SortKey
|
||||
@ -83,8 +83,8 @@ private:
|
||||
|
||||
static int compareNodes(const void* aIndexA, const void* aIndexB,
|
||||
void* aSortData);
|
||||
static bool calcSortValue(TxObject*& aSortValue, SortKey* aKey,
|
||||
SortData* aSortData, PRUint32 aNodeIndex);
|
||||
static bool calcSortValue(txObject*& aSortValue, SortKey* aKey,
|
||||
SortData* aSortData, PRUint32 aNodeIndex);
|
||||
txList mSortKeys;
|
||||
unsigned int mNKeys;
|
||||
};
|
||||
|
@ -77,7 +77,7 @@ double txResultTreeFragment::numberValue()
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Double::toDouble(mBuffer->mStringValue);
|
||||
return txDouble::toDouble(mBuffer->mStringValue);
|
||||
}
|
||||
|
||||
nsresult txResultTreeFragment::flushToHandler(txAXMLEventHandler* aHandler)
|
||||
|
@ -442,9 +442,9 @@ txStylesheet::addTemplate(txTemplateItem* aTemplate,
|
||||
PRUint32 unionPos = 1; // only used when unionPattern is set
|
||||
while (simple) {
|
||||
double priority = aTemplate->mPrio;
|
||||
if (Double::isNaN(priority)) {
|
||||
if (txDouble::isNaN(priority)) {
|
||||
priority = simple->getDefaultPriority();
|
||||
NS_ASSERTION(!Double::isNaN(priority),
|
||||
NS_ASSERTION(!txDouble::isNaN(priority),
|
||||
"simple pattern without default priority");
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ public:
|
||||
ImportFrame* mFirstNotImported;
|
||||
};
|
||||
|
||||
class GlobalVariable : public TxObject {
|
||||
class GlobalVariable : public txObject {
|
||||
public:
|
||||
GlobalVariable(nsAutoPtr<Expr> aExpr,
|
||||
nsAutoPtr<txInstruction> aFirstInstruction,
|
||||
|
@ -303,7 +303,7 @@ getNumberAttr(txStylesheetAttr* aAttributes,
|
||||
txStylesheetCompilerState& aState,
|
||||
double& aNumber)
|
||||
{
|
||||
aNumber = Double::NaN;
|
||||
aNumber = txDouble::NaN;
|
||||
txStylesheetAttr* attr = nsnull;
|
||||
nsresult rv = getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None,
|
||||
aName, aRequired, &attr);
|
||||
@ -311,8 +311,8 @@ getNumberAttr(txStylesheetAttr* aAttributes,
|
||||
return rv;
|
||||
}
|
||||
|
||||
aNumber = Double::toDouble(attr->mValue);
|
||||
if (Double::isNaN(aNumber) && (aRequired || !aState.fcp())) {
|
||||
aNumber = txDouble::toDouble(attr->mValue);
|
||||
if (txDouble::isNaN(aNumber) && (aRequired || !aState.fcp())) {
|
||||
// XXX ErrorReport: number parse failure
|
||||
return NS_ERROR_XSLT_PARSE_FAILURE;
|
||||
}
|
||||
@ -552,7 +552,7 @@ txFnStartLREStylesheet(PRInt32 aNamespaceID,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
txExpandedName nullExpr;
|
||||
double prio = Double::NaN;
|
||||
double prio = txDouble::NaN;
|
||||
|
||||
nsAutoPtr<txPattern> match(new txRootPattern());
|
||||
NS_ENSURE_TRUE(match, NS_ERROR_OUT_OF_MEMORY);
|
||||
@ -1145,7 +1145,7 @@ txFnStartTemplate(PRInt32 aNamespaceID,
|
||||
aState, mode);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
double prio = Double::NaN;
|
||||
double prio = txDouble::NaN;
|
||||
rv = getNumberAttr(aAttributes, aAttrCount, nsGkAtoms::priority,
|
||||
false, aState, prio);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -688,15 +688,15 @@ txStylesheetCompilerState::popChooseGotoList()
|
||||
}
|
||||
|
||||
nsresult
|
||||
txStylesheetCompilerState::pushObject(TxObject* aObject)
|
||||
txStylesheetCompilerState::pushObject(txObject* aObject)
|
||||
{
|
||||
return mObjectStack.push(aObject);
|
||||
}
|
||||
|
||||
TxObject*
|
||||
txObject*
|
||||
txStylesheetCompilerState::popObject()
|
||||
{
|
||||
return static_cast<TxObject*>(mObjectStack.pop());
|
||||
return static_cast<txObject*>(mObjectStack.pop());
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -60,7 +60,7 @@ class txPushNewContext;
|
||||
class txStylesheetCompiler;
|
||||
class txInScopeVariable;
|
||||
|
||||
class txElementContext : public TxObject
|
||||
class txElementContext : public txObject
|
||||
{
|
||||
public:
|
||||
txElementContext(const nsAString& aBaseURI);
|
||||
@ -122,8 +122,8 @@ public:
|
||||
void popSorter();
|
||||
nsresult pushChooseGotoList();
|
||||
void popChooseGotoList();
|
||||
nsresult pushObject(TxObject* aObject);
|
||||
TxObject* popObject();
|
||||
nsresult pushObject(txObject* aObject);
|
||||
txObject* popObject();
|
||||
nsresult pushPtr(void* aPtr);
|
||||
void* popPtr();
|
||||
|
||||
|
@ -129,7 +129,7 @@ txResultStringComparator::createSortableValue(Expr *aExpr,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
int txResultStringComparator::compareValues(TxObject* aVal1, TxObject* aVal2)
|
||||
int txResultStringComparator::compareValues(txObject* aVal1, txObject* aVal2)
|
||||
{
|
||||
StringValue* strval1 = (StringValue*)aVal1;
|
||||
StringValue* strval2 = (StringValue*)aVal2;
|
||||
@ -223,7 +223,7 @@ txResultNumberComparator::txResultNumberComparator(bool aAscending)
|
||||
nsresult
|
||||
txResultNumberComparator::createSortableValue(Expr *aExpr,
|
||||
txIEvalContext *aContext,
|
||||
TxObject *&aResult)
|
||||
txObject *&aResult)
|
||||
{
|
||||
nsAutoPtr<NumberValue> numval(new NumberValue);
|
||||
if (!numval) {
|
||||
@ -241,15 +241,15 @@ txResultNumberComparator::createSortableValue(Expr *aExpr,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
int txResultNumberComparator::compareValues(TxObject* aVal1, TxObject* aVal2)
|
||||
int txResultNumberComparator::compareValues(txObject* aVal1, txObject* aVal2)
|
||||
{
|
||||
double dval1 = ((NumberValue*)aVal1)->mVal;
|
||||
double dval2 = ((NumberValue*)aVal2)->mVal;
|
||||
|
||||
if (Double::isNaN(dval1))
|
||||
return Double::isNaN(dval2) ? 0 : -mAscending;
|
||||
if (txDouble::isNaN(dval1))
|
||||
return txDouble::isNaN(dval2) ? 0 : -mAscending;
|
||||
|
||||
if (Double::isNaN(dval2))
|
||||
if (txDouble::isNaN(dval2))
|
||||
return mAscending;
|
||||
|
||||
if (dval1 == dval2)
|
||||
|
@ -62,13 +62,13 @@ public:
|
||||
* Compares two XPath results. Returns -1 if val1 < val2,
|
||||
* 1 if val1 > val2 and 0 if val1 == val2.
|
||||
*/
|
||||
virtual int compareValues(TxObject* val1, TxObject* val2) = 0;
|
||||
virtual int compareValues(txObject* val1, txObject* val2) = 0;
|
||||
|
||||
/*
|
||||
* Create a sortable value.
|
||||
*/
|
||||
virtual nsresult createSortableValue(Expr *aExpr, txIEvalContext *aContext,
|
||||
TxObject *&aResult) = 0;
|
||||
txObject *&aResult) = 0;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -80,9 +80,9 @@ public:
|
||||
txResultStringComparator(bool aAscending, bool aUpperFirst,
|
||||
const nsAFlatString& aLanguage);
|
||||
|
||||
int compareValues(TxObject* aVal1, TxObject* aVal2);
|
||||
int compareValues(txObject* aVal1, txObject* aVal2);
|
||||
nsresult createSortableValue(Expr *aExpr, txIEvalContext *aContext,
|
||||
TxObject *&aResult);
|
||||
txObject *&aResult);
|
||||
private:
|
||||
nsCOMPtr<nsICollation> mCollation;
|
||||
nsresult init(const nsAFlatString& aLanguage);
|
||||
@ -92,7 +92,7 @@ private:
|
||||
PRUint32* aLength);
|
||||
int mSorting;
|
||||
|
||||
class StringValue : public TxObject
|
||||
class StringValue : public txObject
|
||||
{
|
||||
public:
|
||||
StringValue();
|
||||
@ -112,14 +112,14 @@ class txResultNumberComparator : public txXPathResultComparator
|
||||
public:
|
||||
txResultNumberComparator(bool aAscending);
|
||||
|
||||
int compareValues(TxObject* aVal1, TxObject* aVal2);
|
||||
int compareValues(txObject* aVal1, txObject* aVal2);
|
||||
nsresult createSortableValue(Expr *aExpr, txIEvalContext *aContext,
|
||||
TxObject *&aResult);
|
||||
txObject *&aResult);
|
||||
|
||||
private:
|
||||
int mAscending;
|
||||
|
||||
class NumberValue : public TxObject
|
||||
class NumberValue : public txObject
|
||||
{
|
||||
public:
|
||||
double mVal;
|
||||
|
@ -122,9 +122,9 @@ txXSLTNumber::getValueList(Expr* aValueExpr, txPattern* aCountPattern,
|
||||
|
||||
double value = result->numberValue();
|
||||
|
||||
if (Double::isInfinite(value) || Double::isNaN(value) ||
|
||||
if (txDouble::isInfinite(value) || txDouble::isNaN(value) ||
|
||||
value < 0.5) {
|
||||
Double::toString(value, aValueString);
|
||||
txDouble::toString(value, aValueString);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -318,7 +318,7 @@ txXSLTNumber::getCounters(Expr* aGroupSize, Expr* aGroupSeparator,
|
||||
rv = aGroupSize->evaluateToString(aContext, sizeStr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
double size = Double::toDouble(sizeStr);
|
||||
double size = txDouble::toDouble(sizeStr);
|
||||
groupSize = (PRInt32)size;
|
||||
if ((double)groupSize != size) {
|
||||
groupSize = 0;
|
||||
|
@ -54,7 +54,7 @@
|
||||
double txUnionPattern::getDefaultPriority()
|
||||
{
|
||||
NS_ERROR("Don't call getDefaultPriority on txUnionPattern");
|
||||
return Double::NaN;
|
||||
return txDouble::NaN;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user