Merging whitespace changes/renames/cleanup from TX_WALKER_BRANCH to ease merging, no functional changes. Bug 151002. r=sicking.

This commit is contained in:
peter%propagandism.org 2003-11-04 10:13:23 +00:00
Родитель cb4426e692
Коммит f914dff416
14 изменённых файлов: 72 добавлений и 61 удалений

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

@ -37,7 +37,7 @@
* ***** END LICENSE BLOCK ***** */
#include "txExpandedNameMap.h"
#include "string.h"
#include <string.h>
const int kTxExpandedNameMapAllocSize = 16;

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

@ -300,7 +300,8 @@ MBool XMLUtils::getXMLSpacePreserve(Node* aNode)
}
parent = parent->getParentNode();
}
return MB_FALSE;
return PR_FALSE;
}
// macros for inclusion of char range headers

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

@ -89,6 +89,7 @@ txParseDocumentFromURI(const nsAString& aHref, const nsAString& aReferrer,
rv = NS_NewChannel(getter_AddRefs(channel), documentURI, nsnull,
loadGroup);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIHttpChannel> http = do_QueryInterface(channel);
if (http) {
nsCOMPtr<nsIURI> refUri;
@ -102,9 +103,11 @@ txParseDocumentFromURI(const nsAString& aHref, const nsAString& aReferrer,
}
nsCOMPtr<nsISyncLoadDOMService> loader =
do_GetService("@mozilla.org/content/syncload-dom-service;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = loader->LoadDocumentAsXML(channel, loaderUri, getter_AddRefs(theDocument));
if (NS_FAILED(rv) || !theDocument) {
aErrMsg.Append(NS_LITERAL_STRING("Document load of ") +
@ -116,6 +119,7 @@ txParseDocumentFromURI(const nsAString& aHref, const nsAString& aReferrer,
if (!*aResult) {
return NS_ERROR_FAILURE;
}
return NS_OK;
#else
istream* xslInput = URIUtils::getInputStream(aHref, aErrMsg);

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

@ -29,9 +29,9 @@
#include "ExprResult.h"
#include "FunctionLib.h"
#include "nsReadableUtils.h"
#include "txAtoms.h"
#include "txIXPathContext.h"
#include "nsReadableUtils.h"
#include "txStringUtils.h"
/**

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

@ -278,12 +278,13 @@ StringFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult)
if (!requireParams(3, 3, aContext))
return NS_ERROR_XPATH_BAD_ARGUMENT_COUNT;
nsAutoString src;
evaluateToString((Expr*)iter.next(), aContext, src);
nsRefPtr<StringResult> strRes;
rv = aContext->recycler()->getStringResult(getter_AddRefs(strRes));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString src;
evaluateToString((Expr*)iter.next(), aContext, src);
strRes->mValue.SetCapacity(src.Length());
nsAutoString oldChars, newChars;
evaluateToString((Expr*)iter.next(), aContext, oldChars);

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

@ -200,7 +200,7 @@ void nsXPathExpression::EvalContextImpl::receiveError(const nsAString& aMsg,
Node* nsXPathExpression::EvalContextImpl::getContextNode()
{
return mNode;
return mContextNode;
}
PRUint32 nsXPathExpression::EvalContextImpl::size()

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

@ -71,7 +71,9 @@ private:
{
public:
EvalContextImpl(Node* aContextNode, txResultRecycler* aRecycler)
: mNode(aContextNode), mLastError(NS_OK), mRecycler(aRecycler)
: mContextNode(aContextNode),
mLastError(NS_OK),
mRecycler(aRecycler)
{
}
@ -85,8 +87,9 @@ private:
}
TX_DECL_EVAL_CONTEXT;
private:
Node* mNode;
Node* mContextNode;
nsresult mLastError;
nsRefPtr<txResultRecycler> mRecycler;
};

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

@ -30,7 +30,7 @@
*
*/
#include "NodeSet.h"
#include "txNodeSet.h"
#include "dom.h"
#include "XMLDOMUtils.h"
#include <string.h>
@ -45,7 +45,7 @@ static const int kTxNodeSetGrowFactor = 2;
/*
* Creates a new empty NodeSet
*/
NodeSet::NodeSet(txResultRecycler* aRecycler)
txNodeSet::txNodeSet(txResultRecycler* aRecycler)
: txAExprResult(aRecycler),
mElements(0),
mBufferSize(0),
@ -56,13 +56,13 @@ NodeSet::NodeSet(txResultRecycler* aRecycler)
/*
* Creates a new NodeSet containing the supplied Node
*/
NodeSet::NodeSet(Node* aNode, txResultRecycler* aRecycler)
txNodeSet::txNodeSet(Node* aNode, txResultRecycler* aRecycler)
: txAExprResult(aRecycler),
mElements(new Node*[1]),
mBufferSize(1),
mElementCount(1)
{
NS_ASSERTION(aNode, "missing node to NodeSet::NodeSet");
NS_ASSERTION(aNode, "missing node to txNodeSet::txNodeSet");
if (!mElements) {
NS_ASSERTION(0, "out of memory");
mBufferSize = 0;
@ -77,7 +77,7 @@ NodeSet::NodeSet(Node* aNode, txResultRecycler* aRecycler)
* Creates a new NodeSet, copying the Node references from the source
* NodeSet
*/
NodeSet::NodeSet(const NodeSet& aSource, txResultRecycler* aRecycler)
txNodeSet::txNodeSet(const txNodeSet& aSource, txResultRecycler* aRecycler)
: txAExprResult(aRecycler),
mElements(0),
mBufferSize(0),
@ -92,9 +92,9 @@ NodeSet::NodeSet(const NodeSet& aSource, txResultRecycler* aRecycler)
* @param aNode the Node to add to the NodeSet
* @return errorcode.
*/
nsresult NodeSet::add(Node* aNode)
nsresult txNodeSet::add(Node* aNode)
{
NS_ASSERTION(aNode, "missing node to NodeSet::add");
NS_ASSERTION(aNode, "missing node to txNodeSet::add");
if (!aNode)
return NS_ERROR_NULL_POINTER;
@ -154,9 +154,9 @@ nsresult NodeSet::add(Node* aNode)
* We might therefor end up with some blanks in the bigining of the resulting
* nodeset, which we simply fix by moving all the nodes one step down.
*/
nsresult NodeSet::add(const NodeSet* aNodes)
nsresult txNodeSet::add(const txNodeSet* aNodes)
{
NS_ASSERTION(aNodes, "missing nodeset to NodeSet::add");
NS_ASSERTION(aNodes, "missing nodeset to txNodeSet::add");
if (!aNodes)
return NS_ERROR_NULL_POINTER;
@ -269,9 +269,9 @@ nsresult NodeSet::add(const NodeSet* aNodes)
* @param aNode the Node to append to the NodeSet
* @return true on success. false on failure.
*/
nsresult NodeSet::append(Node* aNode)
nsresult txNodeSet::append(Node* aNode)
{
NS_ASSERTION(aNode, "missing node to NodeSet::append");
NS_ASSERTION(aNode, "missing node to txNodeSet::append");
if (!aNode)
return NS_ERROR_NULL_POINTER;
@ -288,9 +288,9 @@ nsresult NodeSet::append(Node* aNode)
* @param aNodes the NodeSet to append to the NodeSet
* @return true on success. false on failure.
*/
nsresult NodeSet::append(const NodeSet* aNodes)
nsresult txNodeSet::append(const txNodeSet* aNodes)
{
NS_ASSERTION(aNodes, "missing nodeset to NodeSet::append");
NS_ASSERTION(aNodes, "missing nodeset to txNodeSet::append");
if (!aNodes)
return NS_ERROR_NULL_POINTER;
@ -308,7 +308,7 @@ nsresult NodeSet::append(const NodeSet* aNodes)
/*
* Reverse the order of the nodes.
*/
void NodeSet::reverse()
void txNodeSet::reverse()
{
int i;
for (i = 0; i < mElementCount / 2; ++i) {
@ -325,7 +325,7 @@ void NodeSet::reverse()
* @param aNode the Node to get the index for
* @return index of specified node or -1 if the node does not exist
*/
int NodeSet::indexOf(Node* aNode) const
int txNodeSet::indexOf(Node* aNode) const
{
// XXX this doesn't fully work since attribute-nodes are broken
// and can't be pointer-compared. However it's the best we can
@ -343,10 +343,10 @@ int NodeSet::indexOf(Node* aNode) const
* @param aIndex the position of the Node to return
* @return Node at specified position
*/
Node* NodeSet::get(int aIndex) const
Node* txNodeSet::get(int aIndex) const
{
NS_ASSERTION(aIndex >= 0 && aIndex < mElementCount,
"invalid index in NodeSet::get");
"invalid index in txNodeSet::get");
if (aIndex < 0 || aIndex >= mElementCount)
return 0;
@ -357,7 +357,7 @@ Node* NodeSet::get(int aIndex) const
* Returns the type of ExprResult represented
* @return the type of ExprResult represented
*/
short NodeSet::getResultType()
short txNodeSet::getResultType()
{
return txAExprResult::NODESET;
}
@ -366,7 +366,7 @@ short NodeSet::getResultType()
* Converts this ExprResult to a Boolean (MBool) value
* @return the Boolean value
*/
MBool NodeSet::booleanValue()
MBool txNodeSet::booleanValue()
{
return mElementCount > 0;
}
@ -375,7 +375,7 @@ MBool NodeSet::booleanValue()
* Converts this ExprResult to a Number (double) value
* @return the Number value
*/
double NodeSet::numberValue()
double txNodeSet::numberValue()
{
nsAutoString str;
stringValue(str);
@ -386,14 +386,14 @@ double NodeSet::numberValue()
* Creates a String representation of this ExprResult
* @param aStr the destination string to append the String representation to.
*/
void NodeSet::stringValue(nsAString& aStr)
void txNodeSet::stringValue(nsAString& aStr)
{
if (mElementCount > 0)
XMLDOMUtils::getNodeValue(get(0), aStr);
}
nsAString*
NodeSet::stringValuePointer()
txNodeSet::stringValuePointer()
{
return nsnull;
}
@ -405,7 +405,7 @@ NodeSet::stringValuePointer()
* @param aSize requested number of elements
* @return true if allocation succeded, false on out of memory
*/
MBool NodeSet::ensureSize(int aSize)
MBool txNodeSet::ensureSize(int aSize)
{
if (aSize <= mBufferSize)
return MB_TRUE;
@ -445,12 +445,12 @@ MBool NodeSet::ensureSize(int aSize)
* always >= aFirst and <= aLast + 1. This value is always
* set, even if aNode already exists in the NodeSet
*/
int NodeSet::findPosition(Node* aNode, int aFirst,
int txNodeSet::findPosition(Node* aNode, int aFirst,
int aLast, MBool& aNonDup) const
{
NS_ASSERTION(aNode, "missing node in NodeSet::findPosition");
NS_ASSERTION(aNode, "missing node in txNodeSet::findPosition");
NS_ASSERTION(aFirst <= aLast+1 && aLast < mElementCount,
"bad position in NodeSet::findPosition");
"bad position in txNodeSet::findPosition");
if (aLast - aFirst <= 1) {
// If we search 2 nodes or less there is no point in further divides

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

@ -39,33 +39,33 @@
class Node;
class NodeSet : public txAExprResult
class txNodeSet : public txAExprResult
{
public:
NodeSet(); // Not to be implemented
txNodeSet(); // Not to be implemented
/*
* Creates a new empty NodeSet
*/
NodeSet(txResultRecycler* aRecycler);
txNodeSet(txResultRecycler* aRecycler);
/*
* Creates a new NodeSet containing the supplied node
*/
NodeSet(Node* aNode, txResultRecycler* aRecycler);
txNodeSet(Node* aNode, txResultRecycler* aRecycler);
/*
* Creates a new NodeSet, copying the Node references from the source
* NodeSet
*/
NodeSet(const NodeSet& aSource, txResultRecycler* aRecycler);
txNodeSet(const txNodeSet& aSource, txResultRecycler* aRecycler);
/*
* Destructor for NodeSet, will not delete referenced Nodes
*/
virtual ~NodeSet()
virtual ~txNodeSet()
{
delete [] mElements;
}
@ -85,7 +85,7 @@ public:
* @param aNodes the NodeSet to add, must be in document order.
* @return errorcode.
*/
nsresult add(const NodeSet* aNodes);
nsresult add(const txNodeSet* aNodes);
/*
* Append API
@ -109,7 +109,7 @@ public:
* @param aNodes the NodeSet to append to the NodeSet
* @return errorcode.
*/
nsresult append(const NodeSet* aNodes);
nsresult append(const txNodeSet* aNodes);
/*
* Reverse the order of the nodes.

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

@ -45,7 +45,8 @@ class txSingleNodeContext : public txIEvalContext
{
public:
txSingleNodeContext(Node* aContextNode, txIMatchContext* aContext)
: mNode(aContextNode), mInner(aContext)
: mNode(aContextNode),
mInner(aContext)
{
NS_ASSERTION(aContextNode, "context node must be given");
NS_ASSERTION(aContext, "txIMatchContext must be given");

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

@ -75,8 +75,6 @@ ElementAvailableFunctionCall::evaluate(txIEvalContext* aContext,
return NS_ERROR_XPATH_BAD_ARGUMENT_COUNT;
}
txListIterator iter(&params);
Expr* param = (Expr*) iter.next();

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

@ -38,10 +38,10 @@
* ***** END LICENSE BLOCK ***** */
#include "txIXPathContext.h"
#include "ExprResult.h"
#include "txAtoms.h"
#include "XMLUtils.h"
#include "XSLTFunctions.h"
#include "ExprResult.h"
#include "txNamespaceMap.h"
/*

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

@ -191,11 +191,10 @@ txStylesheet::findTemplate(Node* aNode,
}
#ifdef PR_LOGGING
nsAutoString mode;
nsAutoString mode, nodeName;
if (aMode.mLocalName) {
aMode.mLocalName->ToString(mode);
}
nsAutoString nodeName;
aNode->getNodeName(nodeName);
if (matchTemplate) {
nsAutoString matchAttr;
@ -218,18 +217,22 @@ txStylesheet::findTemplate(Node* aNode,
switch(aNode->getNodeType()) {
case Node::ELEMENT_NODE :
case Node::DOCUMENT_NODE :
{
matchTemplate = mContainerTemplate;
break;
}
case Node::ATTRIBUTE_NODE :
case Node::TEXT_NODE :
case Node::CDATA_SECTION_NODE :
{
matchTemplate = mCharactersTemplate;
break;
}
default:
{
matchTemplate = mEmptyTemplate;
break;
}
}
}
@ -277,7 +280,7 @@ txStylesheet::isStripSpaceAllowed(Node* aNode, txIMatchContext* aContext)
{
PRInt32 frameCount = mStripSpaceTests.Count();
if (!aNode || frameCount == 0) {
return MB_FALSE;
return PR_FALSE;
}
switch (aNode->getNodeType()) {
@ -306,7 +309,8 @@ txStylesheet::isStripSpaceAllowed(Node* aNode, txIMatchContext* aContext)
return isStripSpaceAllowed(aNode->getParentNode(), aContext);
}
}
return MB_FALSE;
return PR_FALSE;
}
nsresult

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

@ -272,6 +272,7 @@ txXSLTNumber::getValueList(Expr* aValueExpr, txPattern* aCountPattern,
Node* node = currNode;
PRInt32 value = 0;
MBool matchedFrom = MB_FALSE;
while (node) {
if (aFromPattern && node != currNode &&
aFromPattern->matches(node, aContext)) {
@ -314,7 +315,7 @@ txXSLTNumber::getCounters(Expr* aGroupSize, Expr* aGroupSeparator,
{
aHead.Truncate();
aTail.Truncate();
nsresult rv = NS_OK;
nsAutoString groupSeparator;
@ -323,7 +324,7 @@ txXSLTNumber::getCounters(Expr* aGroupSize, Expr* aGroupSeparator,
nsRefPtr<txAExprResult> exprRes;
rv = aGroupSize->evaluate(aContext, getter_AddRefs(exprRes));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString sizeStr;
exprRes->stringValue(sizeStr);
@ -332,7 +333,7 @@ txXSLTNumber::getCounters(Expr* aGroupSize, Expr* aGroupSeparator,
if ((double)groupSize != size) {
groupSize = 0;
}
rv = aGroupSeparator->evaluate(aContext, getter_AddRefs(exprRes));
NS_ENSURE_SUCCESS(rv, rv);
@ -344,27 +345,27 @@ txXSLTNumber::getCounters(Expr* aGroupSize, Expr* aGroupSeparator,
nsRefPtr<txAExprResult> formatRes;
rv = aFormat->evaluate(aContext, getter_AddRefs(formatRes));
NS_ENSURE_SUCCESS(rv, rv);
formatRes->stringValue(format);
}
PRUint32 formatLen = format.Length();
PRUint32 formatPos = 0;
PRUnichar ch = 0;
// start with header
while (formatPos < formatLen &&
!isAlphaNumeric(ch = format.CharAt(formatPos))) {
aHead.Append(ch);
++formatPos;
}
// If there are no formatting tokens we need to create a default one.
if (formatPos == formatLen) {
txFormattedCounter* defaultCounter;
rv = txFormattedCounter::getCounterFor(NS_LITERAL_STRING("1"), groupSize,
groupSeparator, defaultCounter);
NS_ENSURE_SUCCESS(rv, rv);
defaultCounter->mSeparator = NS_LITERAL_STRING(".");
rv = aCounters.add(defaultCounter);
if (NS_FAILED(rv)) {
@ -453,7 +454,6 @@ txXSLTNumber::getSiblingCount(Node* aNode, txPattern* aCountPattern,
return value;
}
Node*
txXSLTNumber::getPrevInDocumentOrder(Node* aNode)
{
@ -469,7 +469,6 @@ txXSLTNumber::getPrevInDocumentOrder(Node* aNode)
return aNode->getXPathParent();
}
#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; \