Bug 699041 - Remove MBool / MB_TRUE / MB_FALSE; f=Ms2ger r=sicking

This commit is contained in:
Abhishek Singh 2011-11-10 20:26:13 +01:00
Родитель c1c959b6f4
Коммит 5d272b3723
43 изменённых файлов: 167 добавлений и 170 удалений

Просмотреть файл

@ -109,10 +109,7 @@ public:
// XXX These should go away eventually.
#define TxObject txObject
typedef txDouble Double;
typedef bool MBool;
#define MB_TRUE true
#define MB_FALSE false
// XXX
#endif

Просмотреть файл

@ -63,7 +63,7 @@ const dpun Double::NEGATIVE_INFINITY = {{0, DOUBLE_HI32_EXPMASK | DOUBLE_HI32_SI
* Determines whether the given double represents positive or negative
* inifinity
*/
MBool Double::isInfinite(double aDbl)
bool Double::isInfinite(double aDbl)
{
return ((DOUBLE_HI32(aDbl) & ~DOUBLE_HI32_SIGNBIT) == DOUBLE_HI32_EXPMASK &&
!DOUBLE_LO32(aDbl));
@ -72,7 +72,7 @@ MBool Double::isInfinite(double aDbl)
/*
* Determines whether the given double is NaN
*/
MBool Double::isNaN(double aDbl)
bool Double::isNaN(double aDbl)
{
return DOUBLE_IS_NaN(aDbl);
}
@ -80,7 +80,7 @@ MBool Double::isNaN(double aDbl)
/*
* Determines whether the given double is negative
*/
MBool Double::isNeg(double aDbl)
bool Double::isNeg(double aDbl)
{
return (DOUBLE_HI32(aDbl) & DOUBLE_HI32_SIGNBIT) != 0;
}

Просмотреть файл

@ -95,7 +95,7 @@ protected:
{
}
MBool next()
bool next()
{
return ++mCurrentPos < mMap.mItems.Length();
}

Просмотреть файл

@ -243,7 +243,7 @@ void txList::clear()
txListIterator::txListIterator(txList* list) {
this->list = list;
currentItem = 0;
atEndOfList = MB_FALSE;
atEndOfList = false;
} //-- txListIterator
/**
@ -276,11 +276,11 @@ nsresult txListIterator::addBefore(void* objPtr)
/**
* Returns true if a successful call to the next() method can be made
* @return MB_TRUE if a successful call to the next() method can be made,
* otherwise MB_FALSE
* @return true if a successful call to the next() method can be made,
* otherwise false
**/
MBool txListIterator::hasNext() {
MBool hasNext = MB_FALSE;
bool txListIterator::hasNext() {
bool hasNext = false;
if (currentItem)
hasNext = (currentItem->nextItem != 0);
else if (!atEndOfList)
@ -291,11 +291,11 @@ MBool txListIterator::hasNext() {
/**
* Returns true if a successful call to the previous() method can be made
* @return MB_TRUE if a successful call to the previous() method can be made,
* otherwise MB_FALSE
* @return true if a successful call to the previous() method can be made,
* otherwise false
**/
MBool txListIterator::hasPrevious() {
MBool hasPrevious = MB_FALSE;
bool txListIterator::hasPrevious() {
bool hasPrevious = false;
if (currentItem)
hasPrevious = (currentItem->prevItem != 0);
else if (atEndOfList)
@ -318,7 +318,7 @@ void* txListIterator::next() {
if (currentItem)
obj = currentItem->objPtr;
else
atEndOfList = MB_TRUE;
atEndOfList = true;
return obj;
} //-- next
@ -338,7 +338,7 @@ void* txListIterator::previous() {
if (currentItem)
obj = currentItem->objPtr;
atEndOfList = MB_FALSE;
atEndOfList = false;
return obj;
} //-- previous
@ -379,7 +379,7 @@ void* txListIterator::advance(int i) {
for (; currentItem && i < 0; i++)
currentItem = currentItem->prevItem;
atEndOfList = MB_FALSE;
atEndOfList = false;
}
if (currentItem)
@ -409,7 +409,7 @@ void* txListIterator::remove() {
* Resets the current location within the txList to the beginning of the txList
**/
void txListIterator::reset() {
atEndOfList = MB_FALSE;
atEndOfList = false;
currentItem = 0;
} //-- reset
@ -417,6 +417,6 @@ void txListIterator::reset() {
* Move the iterator to right after the last element
**/
void txListIterator::resetToEnd() {
atEndOfList = MB_TRUE;
atEndOfList = true;
currentItem = 0;
} //-- moveToEnd

Просмотреть файл

@ -161,17 +161,17 @@ public:
/**
* Returns true if a successful call to the next() method can be made
* @return MB_TRUE if a successful call to the next() method can be made,
* otherwise MB_FALSE
* @return true if a successful call to the next() method can be made,
* otherwise false
**/
MBool hasNext();
bool hasNext();
/**
* Returns true if a successful call to the previous() method can be made
* @return MB_TRUE if a successful call to the previous() method can be made,
* otherwise MB_FALSE
* @return true if a successful call to the previous() method can be made,
* otherwise false
**/
MBool hasPrevious();
bool hasPrevious();
/**
* Returns the next Object pointer from the list
@ -218,7 +218,7 @@ private:
txList* list;
//-- we've moved off the end of the list
MBool atEndOfList;
bool atEndOfList;
};
typedef txList List;

Просмотреть файл

@ -116,7 +116,7 @@ class Node : public TxObject
//Node manipulation functions
virtual Node* appendChild(Node* newChild) = 0;
virtual MBool hasChildNodes() const = 0;
virtual bool hasChildNodes() const = 0;
//From DOM3 26-Jan-2001 WD
virtual nsresult getBaseURI(nsAString& aURI) = 0;
@ -125,7 +125,7 @@ class Node : public TxObject
virtual nsresult getNamespaceURI(nsAString& aNSURI) = 0;
//txXPathNode functions
virtual MBool getLocalName(nsIAtom** aLocalName) = 0;
virtual bool getLocalName(nsIAtom** aLocalName) = 0;
virtual PRInt32 getNamespaceID() = 0;
virtual Node* getXPathParent() = 0;
virtual PRInt32 compareDocumentPosition(Node* aOther) = 0;
@ -156,7 +156,7 @@ class NodeDefinition : public Node
//Child node manipulation functions
virtual Node* appendChild(Node* newChild);
MBool hasChildNodes() const;
bool hasChildNodes() const;
//From DOM3 26-Jan-2001 WD
virtual nsresult getBaseURI(nsAString& aURI);
@ -165,7 +165,7 @@ class NodeDefinition : public Node
nsresult getNamespaceURI(nsAString& aNSURI);
//txXPathNode functions
virtual MBool getLocalName(nsIAtom** aLocalName);
virtual bool getLocalName(nsIAtom** aLocalName);
virtual PRInt32 getNamespaceID();
virtual Node* getXPathParent();
virtual PRInt32 compareDocumentPosition(Node* aOther);
@ -299,10 +299,10 @@ class Element : public NodeDefinition
//txXPathNode functions override
nsresult getNodeName(nsAString& aName) const;
MBool getLocalName(nsIAtom** aLocalName);
bool getLocalName(nsIAtom** aLocalName);
PRInt32 getNamespaceID();
MBool getAttr(nsIAtom* aLocalName, PRInt32 aNSID, nsAString& aValue);
MBool hasAttr(nsIAtom* aLocalName, PRInt32 aNSID);
bool getAttr(nsIAtom* aLocalName, PRInt32 aNSID, nsAString& aValue);
bool hasAttr(nsIAtom* aLocalName, PRInt32 aNSID);
// ID getter
bool getIDValue(nsAString& aValue);
@ -337,7 +337,7 @@ class Attr : public NodeDefinition
//txXPathNode functions override
nsresult getNodeName(nsAString& aName) const;
MBool getLocalName(nsIAtom** aLocalName);
bool getLocalName(nsIAtom** aLocalName);
PRInt32 getNamespaceID();
Node* getXPathParent();
bool equals(nsIAtom *aLocalName, PRInt32 aNamespaceID)
@ -373,7 +373,7 @@ class ProcessingInstruction : public NodeDefinition
{
public:
//txXPathNode functions override
MBool getLocalName(nsIAtom** aLocalName);
bool getLocalName(nsIAtom** aLocalName);
private:
friend class Document;
@ -415,15 +415,15 @@ public:
return NS_OK;
}
static MBool init()
static bool init()
{
NS_ASSERTION(!mNamespaces,
"called without matching shutdown()");
if (mNamespaces)
return MB_TRUE;
return true;
mNamespaces = new nsStringArray();
if (!mNamespaces)
return MB_FALSE;
return false;
/*
* Hardwiring some Namespace IDs.
* no Namespace is 0
@ -435,10 +435,10 @@ public:
!mNamespaces->AppendString(NS_LITERAL_STRING("http://www.w3.org/1999/XSL/Transform"))) {
delete mNamespaces;
mNamespaces = 0;
return MB_FALSE;
return false;
}
return MB_TRUE;
return true;
}
static void shutdown()

Просмотреть файл

@ -51,7 +51,7 @@
nsresult
txExpandedName::init(const nsAString& aQName, txNamespaceMap* aResolver,
MBool aUseDefault)
bool aUseDefault)
{
const nsAFlatString& qName = PromiseFlatString(aQName);
const PRUnichar* colon;
@ -230,7 +230,7 @@ void XMLUtils::normalizePIValue(nsAString& piValue)
}
//static
MBool XMLUtils::getXMLSpacePreserve(const txXPathNode& aNode)
bool XMLUtils::getXMLSpacePreserve(const txXPathNode& aNode)
{
nsAutoString value;
txXPathTreeWalker walker(aNode);

Просмотреть файл

@ -75,7 +75,7 @@ public:
}
nsresult init(const nsAString& aQName, txNamespaceMap* aResolver,
MBool aUseDefault);
bool aUseDefault);
void reset()
{
@ -95,13 +95,13 @@ public:
return *this;
}
MBool operator == (const txExpandedName& rhs) const
bool operator == (const txExpandedName& rhs) const
{
return ((mLocalName == rhs.mLocalName) &&
(mNamespaceID == rhs.mNamespaceID));
}
MBool operator != (const txExpandedName& rhs) const
bool operator != (const txExpandedName& rhs) const
{
return ((mLocalName != rhs.mLocalName) ||
(mNamespaceID != rhs.mNamespaceID));
@ -124,7 +124,7 @@ public:
/*
* Returns true if the given character is whitespace.
*/
static MBool isWhitespace(const PRUnichar& aChar)
static bool isWhitespace(const PRUnichar& aChar)
{
return (aChar <= ' ' &&
(aChar == ' ' || aChar == '\r' ||
@ -173,7 +173,7 @@ public:
* Walks up the document tree and returns true if the closest xml:space
* attribute is "preserve"
*/
static MBool getXMLSpacePreserve(const txXPathNode& aNode);
static bool getXMLSpacePreserve(const txXPathNode& aNode);
};
#endif

Просмотреть файл

@ -196,9 +196,9 @@ nsXPathExpression::EvalContextImpl::getVariable(PRInt32 aNamespace,
return NS_ERROR_INVALID_ARG;
}
MBool nsXPathExpression::EvalContextImpl::isStripSpaceAllowed(const txXPathNode& aNode)
bool nsXPathExpression::EvalContextImpl::isStripSpaceAllowed(const txXPathNode& aNode)
{
return MB_FALSE;
return false;
}
void* nsXPathExpression::EvalContextImpl::getPrivateContext()

Просмотреть файл

@ -43,8 +43,8 @@
#include "txExprResult.h"
/**
* Creates a new BooleanResult with the value of the given MBool parameter
* @param boolean the MBool to use for initialization of this BooleanResult's value
* Creates a new BooleanResult with the value of the given bool parameter
* @param boolean the bool to use for initialization of this BooleanResult's value
**/
BooleanResult::BooleanResult(bool boolean)
: txAExprResult(nsnull)
@ -80,7 +80,7 @@ BooleanResult::stringValuePointer()
return nsnull;
}
MBool BooleanResult::booleanValue() {
bool BooleanResult::booleanValue() {
return this->value;
} //-- toBoolean

Просмотреть файл

@ -303,23 +303,23 @@ txCoreFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
rv = aContext->recycler()->getStringResult(getter_AddRefs(strRes));
NS_ENSURE_SUCCESS(rv, rv);
MBool addSpace = MB_FALSE;
MBool first = MB_TRUE;
bool addSpace = false;
bool first = true;
strRes->mValue.SetCapacity(resultStr.Length());
PRUnichar c;
PRUint32 src;
for (src = 0; src < resultStr.Length(); src++) {
c = resultStr.CharAt(src);
if (XMLUtils::isWhitespace(c)) {
addSpace = MB_TRUE;
addSpace = true;
}
else {
if (addSpace && !first)
strRes->mValue.Append(PRUnichar(' '));
strRes->mValue.Append(c);
addSpace = MB_FALSE;
first = MB_FALSE;
addSpace = false;
first = false;
}
}
*aResult = strRes;

Просмотреть файл

@ -302,7 +302,7 @@ txExprParser::createExpr(txExprLexer& lexer, txIParseContext* aContext,
*aResult = nsnull;
nsresult rv = NS_OK;
MBool done = MB_FALSE;
bool done = false;
nsAutoPtr<Expr> expr;

Просмотреть файл

@ -122,7 +122,7 @@ protected:
static nsresult resolveQName(const nsAString& aQName, nsIAtom** aPrefix,
txIParseContext* aContext,
nsIAtom** aLocalName, PRInt32& aNamespace,
bool aIsNameTest = MB_FALSE);
bool aIsNameTest = false);
/**
* Using the given lexer, parses the tokens if they represent a

Просмотреть файл

@ -104,10 +104,10 @@ public:
virtual const nsString* stringValuePointer() = 0;
/**
* Converts this ExprResult to a Boolean (MBool) value
* Converts this ExprResult to a Boolean (bool) value
* @return the Boolean value
**/
virtual MBool booleanValue() = 0;
virtual bool booleanValue() = 0;
/**
* Converts this ExprResult to a Number (double) value
@ -131,12 +131,12 @@ private:
class BooleanResult : public txAExprResult {
public:
BooleanResult(MBool aValue);
BooleanResult(bool aValue);
TX_DECL_EXPRRESULT
private:
MBool value;
bool value;
};
class NumberResult : public txAExprResult {

Просмотреть файл

@ -63,7 +63,7 @@ nsresult txForwardContext::getVariable(PRInt32 aNamespace, nsIAtom* aLName,
return mInner->getVariable(aNamespace, aLName, aResult);
}
MBool txForwardContext::isStripSpaceAllowed(const txXPathNode& aNode)
bool txForwardContext::isStripSpaceAllowed(const txXPathNode& aNode)
{
NS_ASSERTION(mInner, "mInner is null!!!");
return mInner->isStripSpaceAllowed(aNode);

Просмотреть файл

@ -113,7 +113,7 @@ public:
* Is whitespace stripping allowed for the given node?
* See http://www.w3.org/TR/xslt#strip
*/
virtual MBool isStripSpaceAllowed(const txXPathNode& aNode) = 0;
virtual bool isStripSpaceAllowed(const txXPathNode& aNode) = 0;
/**
* Returns a pointer to the private context
@ -131,7 +131,7 @@ public:
#define TX_DECL_MATCH_CONTEXT \
nsresult getVariable(PRInt32 aNamespace, nsIAtom* aLName, \
txAExprResult*& aResult); \
MBool isStripSpaceAllowed(const txXPathNode& aNode); \
bool isStripSpaceAllowed(const txXPathNode& aNode); \
void* getPrivateContext(); \
txResultRecycler* recycler(); \
void receiveError(const nsAString& aMsg, nsresult aRes)

Просмотреть файл

@ -69,18 +69,18 @@ bool txNameTest::matches(const txXPathNode& aNode, txIMatchContext* aContext)
// Totally wild?
if (mLocalName == nsGkAtoms::_asterix && !mPrefix)
return MB_TRUE;
return true;
// Compare namespaces
if (mNamespace != txXPathNodeUtils::getNamespaceID(aNode)
&& !(mNamespace == kNameSpaceID_None &&
txXPathNodeUtils::isHTMLElementInHTMLDocument(aNode))
)
return MB_FALSE;
return false;
// Name wild?
if (mLocalName == nsGkAtoms::_asterix)
return MB_TRUE;
return true;
// Compare local-names
return txXPathNodeUtils::localNameEquals(aNode, mLocalName);

Просмотреть файл

@ -62,7 +62,7 @@ nsresult txNodeSetContext::getVariable(PRInt32 aNamespace, nsIAtom* aLName,
return mInner->getVariable(aNamespace, aLName, aResult);
}
MBool txNodeSetContext::isStripSpaceAllowed(const txXPathNode& aNode)
bool txNodeSetContext::isStripSpaceAllowed(const txXPathNode& aNode)
{
NS_ASSERTION(mInner, "mInner is null!!!");
return mInner->isStripSpaceAllowed(aNode);

Просмотреть файл

@ -52,7 +52,7 @@ public:
}
// Iteration over the given NodeSet
MBool hasNext()
bool hasNext()
{
return mPosition < size();
}

Просмотреть файл

@ -76,11 +76,11 @@ NumberResult::stringValuePointer()
return nsnull;
}
MBool NumberResult::booleanValue() {
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 (MBool)(value != 0.0 && !Double::isNaN(value));
return (bool)(value != 0.0 && !Double::isNaN(value));
// OG-
} //-- booleanValue

Просмотреть файл

@ -193,7 +193,7 @@ PathExpr::evalDescendants(Expr* aStep, const txXPathNode& aNode,
resNodes->addAndTransfer(newSet);
MBool filterWS = aContext->isStripSpaceAllowed(aNode);
bool filterWS = aContext->isStripSpaceAllowed(aNode);
txXPathTreeWalker walker(aNode);
if (!walker.moveToFirstChild()) {

Просмотреть файл

@ -59,7 +59,7 @@ public:
return mInner->getVariable(aNamespace, aLName, aResult);
}
MBool isStripSpaceAllowed(const txXPathNode& aNode)
bool isStripSpaceAllowed(const txXPathNode& aNode)
{
NS_ASSERTION(mInner, "mInner is null!!!");
return mInner->isStripSpaceAllowed(aNode);

Просмотреть файл

@ -79,7 +79,7 @@ StringResult::stringValuePointer()
return &mValue;
}
MBool StringResult::booleanValue() {
bool StringResult::booleanValue() {
return !mValue.IsEmpty();
} //-- booleanValue

Просмотреть файл

@ -121,7 +121,7 @@ DocumentFunctionCall::evaluate(txIEvalContext* aContext,
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString baseURI;
MBool baseURISet = MB_FALSE;
bool baseURISet = false;
if (mParams.Length() == 2) {
// We have 2 arguments, get baseURI from the first node
@ -134,7 +134,7 @@ DocumentFunctionCall::evaluate(txIEvalContext* aContext,
// Make this true, even if nodeSet2 is empty. For relative URLs,
// we'll fail to load the document with an empty base URI, and for
// absolute URLs, the base URI doesn't matter
baseURISet = MB_TRUE;
baseURISet = true;
if (!nodeSet2->isEmpty()) {
txXPathNodeUtils::getBaseURI(nodeSet2->get(0), baseURI);

Просмотреть файл

@ -96,7 +96,7 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext,
rv = mParams[2]->evaluateToString(aContext, formatQName);
NS_ENSURE_SUCCESS(rv, rv);
rv = formatName.init(formatQName, mMappings, MB_FALSE);
rv = formatName.init(formatQName, mMappings, false);
NS_ENSURE_SUCCESS(rv, rv);
}
@ -139,10 +139,10 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext,
PRUint32 pos = 0;
PRUint32 formatLen = formatStr.Length();
MBool inQuote;
bool inQuote;
// Get right subexpression
inQuote = MB_FALSE;
inQuote = false;
if (Double::isNeg(value)) {
while (pos < formatLen &&
(inQuote ||
@ -162,7 +162,7 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext,
// Parse the format string
FormatParseState pState = Prefix;
inQuote = MB_FALSE;
inQuote = false;
PRUnichar c = 0;
while (pos < formatLen && pState != Finished) {
@ -327,8 +327,8 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext,
(intDigits-1)/groupSize); // group separators
PRInt32 i = bufIntDigits + maxFractionSize - 1;
MBool carry = (i+1 < buflen) && (buf[i+1] >= '5');
MBool hasFraction = MB_FALSE;
bool carry = (i+1 < buflen) && (buf[i+1] >= '5');
bool hasFraction = false;
PRUint32 resPos = res.Length()-1;
@ -348,7 +348,7 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext,
}
if (hasFraction || digit != 0 || i < bufIntDigits+minFractionSize) {
hasFraction = MB_TRUE;
hasFraction = true;
res.SetCharAt((PRUnichar)(digit + format->mZeroDigit),
resPos--);
}
@ -448,7 +448,7 @@ txDecimalFormat::txDecimalFormat() : mInfinity(NS_LITERAL_STRING("Infinity")),
mPatternSeparator = ';';
}
MBool txDecimalFormat::isEqual(txDecimalFormat* other)
bool txDecimalFormat::isEqual(txDecimalFormat* other)
{
return mDecimalSeparator == other->mDecimalSeparator &&
mGroupingSeparator == other->mGroupingSeparator &&

Просмотреть файл

@ -78,14 +78,14 @@ txNodeSorter::addSortElement(Expr* aSelectExpr, Expr* aLangExpr,
key->mExpr = aSelectExpr;
// Order
MBool ascending = MB_TRUE;
bool ascending = true;
if (aOrderExpr) {
nsAutoString attrValue;
rv = aOrderExpr->evaluateToString(aContext, attrValue);
NS_ENSURE_SUCCESS(rv, rv);
if (TX_StringEqualsAtom(attrValue, nsGkAtoms::descending)) {
ascending = MB_FALSE;
ascending = false;
}
else if (!TX_StringEqualsAtom(attrValue, nsGkAtoms::ascending)) {
// XXX ErrorReport: unknown value for order attribute
@ -112,7 +112,7 @@ txNodeSorter::addSortElement(Expr* aSelectExpr, Expr* aLangExpr,
}
// Case-order
MBool upperFirst = false;
bool upperFirst = false;
if (aCaseOrderExpr) {
nsAutoString attrValue;

Просмотреть файл

@ -139,21 +139,21 @@ nsresult txPatternParser::createLocPathPattern(txExprLexer& aLexer,
{
nsresult rv = NS_OK;
MBool isChild = MB_TRUE;
MBool isAbsolute = MB_FALSE;
bool isChild = true;
bool isAbsolute = false;
txPattern* stepPattern = 0;
txLocPathPattern* pathPattern = 0;
Token::Type type = aLexer.peek()->mType;
switch (type) {
case Token::ANCESTOR_OP:
isChild = MB_FALSE;
isAbsolute = MB_TRUE;
isChild = false;
isAbsolute = true;
aLexer.nextToken();
break;
case Token::PARENT_OP:
aLexer.nextToken();
isAbsolute = MB_TRUE;
isAbsolute = true;
if (aLexer.peek()->mType == Token::END ||
aLexer.peek()->mType == Token::UNION_OP) {
aPattern = new txRootPattern();
@ -299,11 +299,11 @@ nsresult txPatternParser::createStepPattern(txExprLexer& aLexer,
txPattern*& aPattern)
{
nsresult rv = NS_OK;
MBool isAttr = MB_FALSE;
bool isAttr = false;
Token* tok = aLexer.peek();
if (tok->mType == Token::AXIS_IDENTIFIER) {
if (TX_StringEqualsAtom(tok->Value(), nsGkAtoms::attribute)) {
isAttr = MB_TRUE;
isAttr = true;
}
else if (!TX_StringEqualsAtom(tok->Value(), nsGkAtoms::child)) {
// all done already for CHILD_AXIS, for all others
@ -314,7 +314,7 @@ nsresult txPatternParser::createStepPattern(txExprLexer& aLexer,
}
else if (tok->mType == Token::AT_SIGN) {
aLexer.nextToken();
isAttr = MB_TRUE;
isAttr = true;
}
tok = aLexer.nextToken();

Просмотреть файл

@ -192,17 +192,17 @@ private:
class txStripSpaceTest {
public:
txStripSpaceTest(nsIAtom* aPrefix, nsIAtom* aLocalName, PRInt32 aNSID,
MBool stripSpace)
bool stripSpace)
: mNameTest(aPrefix, aLocalName, aNSID, txXPathNodeType::ELEMENT_NODE),
mStrips(stripSpace)
{
}
MBool matches(const txXPathNode& aNode, txIMatchContext* aContext) {
bool matches(const txXPathNode& aNode, txIMatchContext* aContext) {
return mNameTest.matches(aNode, aContext);
}
MBool stripsSpace() {
bool stripsSpace() {
return mStrips;
}
@ -212,7 +212,7 @@ public:
protected:
txNameTest mNameTest;
MBool mStrips;
bool mStrips;
};
/**

Просмотреть файл

@ -1367,7 +1367,7 @@ txFnText(const nsAString& aStr, txStylesheetCompilerState& aState)
{
TX_RETURN_IF_WHITESPACE(aStr, aState);
nsAutoPtr<txInstruction> instr(new txText(aStr, MB_FALSE));
nsAutoPtr<txInstruction> instr(new txText(aStr, false));
NS_ENSURE_TRUE(instr, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = aState.addInstruction(instr);
@ -2413,7 +2413,7 @@ txFnStartText(PRInt32 aNamespaceID,
static nsresult
txFnEndText(txStylesheetCompilerState& aState)
{
aState.mDOE = MB_FALSE;
aState.mDOE = false;
aState.popHandlerTable();
return NS_OK;
}
@ -3044,7 +3044,7 @@ txHandlerTable::find(PRInt32 aNamespaceID, nsIAtom* aLocalName)
gTx##_name##Handler = nsnull
// static
MBool
bool
txHandlerTable::init()
{
nsresult rv = NS_OK;
@ -3066,7 +3066,7 @@ txHandlerTable::init()
INIT_HANDLER_WITH_ELEMENT_HANDLERS(AttributeSet);
INIT_HANDLER_WITH_ELEMENT_HANDLERS(Fallback);
return MB_TRUE;
return true;
}
// static

Просмотреть файл

@ -75,7 +75,7 @@ public:
const HandleTextFn mTextHandler;
const txElementHandler* const mLREHandler;
static MBool init();
static bool init();
static void shutdown();
private:

Просмотреть файл

@ -227,10 +227,10 @@ txStylesheetCompiler::startElementInternal(PRInt32 aNamespaceID,
NS_ENSURE_SUCCESS(rv, rv);
if (TX_StringEqualsAtom(attr->mValue, nsGkAtoms::preserve)) {
mElementContext->mPreserveWhitespace = MB_TRUE;
mElementContext->mPreserveWhitespace = true;
}
else if (TX_StringEqualsAtom(attr->mValue, nsGkAtoms::_default)) {
mElementContext->mPreserveWhitespace = MB_FALSE;
mElementContext->mPreserveWhitespace = false;
}
else {
return NS_ERROR_XSLT_PARSE_FAILURE;
@ -291,20 +291,20 @@ txStylesheetCompiler::startElementInternal(PRInt32 aNamespaceID,
NS_ENSURE_SUCCESS(rv, rv);
if (attr->mValue.EqualsLiteral("1.0")) {
mElementContext->mForwardsCompatibleParsing = MB_FALSE;
mElementContext->mForwardsCompatibleParsing = false;
}
else {
mElementContext->mForwardsCompatibleParsing = MB_TRUE;
mElementContext->mForwardsCompatibleParsing = true;
}
}
}
// Find the right elementhandler and execute it
MBool isInstruction = MB_FALSE;
bool isInstruction = false;
PRInt32 count = mElementContext->mInstructionNamespaces.Length();
for (i = 0; i < count; ++i) {
if (mElementContext->mInstructionNamespaces[i] == aNamespaceID) {
isInstruction = MB_TRUE;
isInstruction = true;
break;
}
}

Просмотреть файл

@ -39,7 +39,7 @@
#include "txTextHandler.h"
#include "nsAString.h"
txTextHandler::txTextHandler(MBool aOnlyText) : mLevel(0),
txTextHandler::txTextHandler(bool aOnlyText) : mLevel(0),
mOnlyText(aOnlyText)
{
}

Просмотреть файл

@ -45,7 +45,7 @@
class txTextHandler : public txAXMLEventHandler
{
public:
txTextHandler(MBool aOnlyText);
txTextHandler(bool aOnlyText);
TX_DECL_TXAXMLEVENTHANDLER
@ -53,7 +53,7 @@ public:
private:
PRUint32 mLevel;
MBool mOnlyText;
bool mOnlyText;
};
#endif

Просмотреть файл

@ -50,8 +50,8 @@
#define kAscending (1<<0)
#define kUpperFirst (1<<1)
txResultStringComparator::txResultStringComparator(MBool aAscending,
MBool aUpperFirst,
txResultStringComparator::txResultStringComparator(bool aAscending,
bool aUpperFirst,
const nsAFlatString& aLanguage)
{
mSorting = 0;
@ -215,7 +215,7 @@ txResultStringComparator::StringValue::~StringValue()
delete (nsString*)mCaseKey;
}
txResultNumberComparator::txResultNumberComparator(MBool aAscending)
txResultNumberComparator::txResultNumberComparator(bool aAscending)
{
mAscending = aAscending ? 1 : -1;
}

Просмотреть файл

@ -77,7 +77,7 @@ public:
class txResultStringComparator : public txXPathResultComparator
{
public:
txResultStringComparator(MBool aAscending, MBool aUpperFirst,
txResultStringComparator(bool aAscending, bool aUpperFirst,
const nsAFlatString& aLanguage);
int compareValues(TxObject* aVal1, TxObject* aVal2);
@ -110,7 +110,7 @@ private:
class txResultNumberComparator : public txXPathResultComparator
{
public:
txResultNumberComparator(MBool aAscending);
txResultNumberComparator(bool aAscending);
int compareValues(TxObject* aVal1, TxObject* aVal2);
nsresult createSortableValue(Expr *aExpr, txIEvalContext *aContext,

Просмотреть файл

@ -127,7 +127,7 @@ public:
* default values
*/
txDecimalFormat();
MBool isEqual(txDecimalFormat* other);
bool isEqual(txDecimalFormat* other);
PRUnichar mDecimalSeparator;
PRUnichar mGroupingSeparator;

Просмотреть файл

@ -76,7 +76,7 @@ nsresult txXSLTNumber::createNumber(Expr* aValueExpr, txPattern* aCountPattern,
// Create resulting string
aResult = head;
MBool first = MB_TRUE;
bool first = true;
txListIterator valueIter(&values);
txListIterator counterIter(&counters);
valueIter.resetToEnd();
@ -92,7 +92,7 @@ nsresult txXSLTNumber::createNumber(Expr* aValueExpr, txPattern* aCountPattern,
}
counter->appendNumber(value, aResult);
first = MB_FALSE;
first = false;
}
aResult.Append(tail);
@ -136,13 +136,13 @@ txXSLTNumber::getValueList(Expr* aValueExpr, txPattern* aCountPattern,
// Otherwise use count/from/level
txPattern* countPattern = aCountPattern;
MBool ownsCountPattern = MB_FALSE;
bool ownsCountPattern = false;
const txXPathNode& currNode = aContext->getContextNode();
// Parse count- and from-attributes
if (!aCountPattern) {
ownsCountPattern = MB_TRUE;
ownsCountPattern = true;
txNodeTest* nodeTest;
PRUint16 nodeType = txXPathNodeUtils::getNodeType(currNode);
switch (nodeType) {
@ -191,7 +191,7 @@ txXSLTNumber::getValueList(Expr* aValueExpr, txPattern* aCountPattern,
}
NS_ENSURE_TRUE(nodeTest, NS_ERROR_OUT_OF_MEMORY);
countPattern = new txStepPattern(nodeTest, MB_FALSE);
countPattern = new txStepPattern(nodeTest, false);
if (!countPattern) {
// XXX error reporting
delete nodeTest;
@ -239,12 +239,12 @@ txXSLTNumber::getValueList(Expr* aValueExpr, txPattern* aCountPattern,
else if (aLevel == eLevelMultiple) {
// find all ancestor-or-selfs that matches count until...
txXPathTreeWalker walker(currNode);
MBool matchedFrom = MB_FALSE;
bool matchedFrom = false;
do {
if (aFromPattern && !walker.isOnNode(currNode) &&
aFromPattern->matches(walker.getCurrentPosition(), aContext)) {
//... we find one that matches from
matchedFrom = MB_TRUE;
matchedFrom = true;
break;
}
@ -264,13 +264,13 @@ txXSLTNumber::getValueList(Expr* aValueExpr, txPattern* aCountPattern,
// level = "any"
else if (aLevel == eLevelAny) {
PRInt32 value = 0;
MBool matchedFrom = MB_FALSE;
bool matchedFrom = false;
txXPathTreeWalker walker(currNode);
do {
if (aFromPattern && !walker.isOnNode(currNode) &&
aFromPattern->matches(walker.getCurrentPosition(), aContext)) {
matchedFrom = MB_TRUE;
matchedFrom = true;
break;
}
@ -450,12 +450,12 @@ txXSLTNumber::getPrevInDocumentOrder(txXPathTreeWalker& aWalker)
return aWalker.moveToParent();
}
#define TX_CHAR_RANGE(ch, a, b) if (ch < a) return MB_FALSE; \
if (ch <= b) return MB_TRUE
#define TX_MATCH_CHAR(ch, a) if (ch < a) return MB_FALSE; \
if (ch == a) return MB_TRUE
#define TX_CHAR_RANGE(ch, a, b) if (ch < a) return false; \
if (ch <= b) return true
#define TX_MATCH_CHAR(ch, a) if (ch < a) return false; \
if (ch == a) return true
MBool txXSLTNumber::isAlphaNumeric(PRUnichar ch)
bool txXSLTNumber::isAlphaNumeric(PRUnichar ch)
{
TX_CHAR_RANGE(ch, 0x0030, 0x0039);
TX_CHAR_RANGE(ch, 0x0041, 0x005A);
@ -747,5 +747,5 @@ MBool txXSLTNumber::isAlphaNumeric(PRUnichar ch)
TX_CHAR_RANGE(ch, 0xFFC2, 0xFFC7);
TX_CHAR_RANGE(ch, 0xFFCA, 0xFFCF);
TX_CHAR_RANGE(ch, 0xFFD2, 0xFFD7);
return MB_FALSE;
return false;
}

Просмотреть файл

@ -85,7 +85,7 @@ private:
static bool getPrevInDocumentOrder(txXPathTreeWalker& aWalker);
static MBool isAlphaNumeric(PRUnichar ch);
static bool isAlphaNumeric(PRUnichar ch);
};
class txFormattedCounter {

Просмотреть файл

@ -71,7 +71,7 @@ private:
class txRomanCounter : public txFormattedCounter {
public:
txRomanCounter(MBool aUpper) : mTableOffset(aUpper ? 30 : 0)
txRomanCounter(bool aUpper) : mTableOffset(aUpper ? 30 : 0)
{
}

Просмотреть файл

@ -63,15 +63,15 @@ double txUnionPattern::getDefaultPriority()
* This should be called on the simple patterns for xsl:template,
* but is fine for xsl:key and xsl:number
*/
MBool txUnionPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext)
bool txUnionPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext)
{
PRUint32 i, len = mLocPathPatterns.Length();
for (i = 0; i < len; ++i) {
if (mLocPathPatterns[i]->matches(aNode, aContext)) {
return MB_TRUE;
return true;
}
}
return MB_FALSE;
return false;
}
txPattern::Type
@ -134,7 +134,7 @@ nsresult txLocPathPattern::addStep(txPattern* aPattern, bool isChild)
return NS_OK;
}
MBool txLocPathPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext)
bool txLocPathPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext)
{
NS_ASSERTION(mSteps.Length() > 1, "Internal error");
@ -153,17 +153,17 @@ MBool txLocPathPattern::matches(const txXPathNode& aNode, txIMatchContext* aCont
PRUint32 pos = mSteps.Length();
Step* step = &mSteps[--pos];
if (!step->pattern->matches(aNode, aContext))
return MB_FALSE;
return false;
txXPathTreeWalker walker(aNode);
bool hasParent = walker.moveToParent();
while (step->isChild) {
if (!pos)
return MB_TRUE; // all steps matched
return true; // all steps matched
step = &mSteps[--pos];
if (!hasParent || !step->pattern->matches(walker.getCurrentPosition(), aContext))
return MB_FALSE; // no more ancestors or no match
return false; // no more ancestors or no match
hasParent = walker.moveToParent();
}
@ -174,7 +174,7 @@ MBool txLocPathPattern::matches(const txXPathNode& aNode, txIMatchContext* aCont
while (pos) {
if (!hasParent)
return MB_FALSE; // There are more steps in the current block
return false; // There are more steps in the current block
// than ancestors of the tested node
step = &mSteps[--pos];
@ -195,7 +195,7 @@ MBool txLocPathPattern::matches(const txXPathNode& aNode, txIMatchContext* aCont
}
}
return MB_TRUE;
return true;
} // txLocPathPattern::matches
double txLocPathPattern::getDefaultPriority()
@ -249,7 +249,7 @@ txLocPathPattern::toString(nsAString& aDest)
* a txPattern matching the document node, or '/'
*/
MBool txRootPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext)
bool txRootPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext)
{
return txXPathNodeUtils::isRoot(aNode);
}
@ -295,7 +295,7 @@ txIdPattern::txIdPattern(const nsSubstring& aString)
}
}
MBool txIdPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext)
bool txIdPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext)
{
if (!txXPathNodeUtils::isElement(aNode)) {
return false;
@ -351,7 +351,7 @@ txIdPattern::toString(nsAString& aDest)
* argument.
*/
MBool txKeyPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext)
bool txKeyPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext)
{
txExecutionState* es = (txExecutionState*)aContext->getPrivateContext();
nsAutoPtr<txXPathNode> contextDoc(txXPathNodeUtils::getOwnerDocument(aNode));
@ -404,21 +404,21 @@ txKeyPattern::toString(nsAString& aDest)
* a txPattern to hold the NodeTest and the Predicates of a StepPattern
*/
MBool txStepPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext)
bool txStepPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext)
{
NS_ASSERTION(mNodeTest, "Internal error");
if (!mNodeTest->matches(aNode, aContext))
return MB_FALSE;
return false;
txXPathTreeWalker walker(aNode);
if ((!mIsAttr &&
txXPathNodeUtils::isAttribute(walker.getCurrentPosition())) ||
!walker.moveToParent()) {
return MB_FALSE;
return false;
}
if (isEmpty()) {
return MB_TRUE;
return true;
}
/*
@ -431,7 +431,7 @@ MBool txStepPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext
* if the result is a number, check the context position,
* otherwise convert to bool
* if result is true, copy node to newNodes
* if aNode is not member of newNodes, return MB_FALSE
* if aNode is not member of newNodes, return false
* nodes = newNodes
*
* For the last Predicate, evaluate Predicate with aNode as
@ -442,7 +442,7 @@ MBool txStepPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext
// Create the context node set for evaluating the predicates
nsRefPtr<txNodeSet> nodes;
nsresult rv = aContext->recycler()->getNodeSet(getter_AddRefs(nodes));
NS_ENSURE_SUCCESS(rv, MB_FALSE);
NS_ENSURE_SUCCESS(rv, false);
bool hasNext = mIsAttr ? walker.moveToFirstAttribute() :
walker.moveToFirstChild();
@ -457,12 +457,12 @@ MBool txStepPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext
Expr* predicate = mPredicates[0];
nsRefPtr<txNodeSet> newNodes;
rv = aContext->recycler()->getNodeSet(getter_AddRefs(newNodes));
NS_ENSURE_SUCCESS(rv, MB_FALSE);
NS_ENSURE_SUCCESS(rv, false);
PRUint32 i, predLen = mPredicates.Length();
for (i = 1; i < predLen; ++i) {
newNodes->clear();
MBool contextIsInPredicate = MB_FALSE;
bool contextIsInPredicate = false;
txNodeSetContext predContext(nodes, aContext);
while (predContext.hasNext()) {
predContext.next();
@ -477,7 +477,7 @@ MBool txStepPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext
exprResult->numberValue()) {
const txXPathNode& tmp = predContext.getContextNode();
if (tmp == aNode)
contextIsInPredicate = MB_TRUE;
contextIsInPredicate = true;
newNodes->append(tmp);
}
break;
@ -485,7 +485,7 @@ MBool txStepPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext
if (exprResult->booleanValue()) {
const txXPathNode& tmp = predContext.getContextNode();
if (tmp == aNode)
contextIsInPredicate = MB_TRUE;
contextIsInPredicate = true;
newNodes->append(tmp);
}
break;
@ -495,7 +495,7 @@ MBool txStepPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext
nodes->clear();
nodes->append(*newNodes);
if (!contextIsInPredicate) {
return MB_FALSE;
return false;
}
predicate = mPredicates[i];
}

Просмотреть файл

@ -59,7 +59,7 @@ public:
/*
* Determines whether this Pattern matches the given node.
*/
virtual MBool matches(const txXPathNode& aNode,
virtual bool matches(const txXPathNode& aNode,
txIMatchContext* aContext) = 0;
/*
@ -119,7 +119,7 @@ public:
};
#define TX_DECL_PATTERN_BASE \
MBool matches(const txXPathNode& aNode, txIMatchContext* aContext); \
bool matches(const txXPathNode& aNode, txIMatchContext* aContext); \
double getDefaultPriority(); \
virtual Expr* getSubExprAt(PRUint32 aPos); \
virtual void setSubExprAt(PRUint32 aPos, Expr* aExpr); \

Просмотреть файл

@ -48,19 +48,19 @@
TX_LG_IMPL
/* static */
MBool
bool
txXSLTProcessor::init()
{
TX_LG_CREATE;
if (!txHandlerTable::init())
return MB_FALSE;
return false;
extern bool TX_InitEXSLTFunction();
if (!TX_InitEXSLTFunction())
return MB_FALSE;
return false;
return MB_TRUE;
return true;
}
/* static */

Просмотреть файл

@ -48,7 +48,7 @@ public:
* Initialisation and shutdown routines. Initilizes and cleansup all
* dependant classes
*/
static MBool init();
static bool init();
static void shutdown();