Bug 1632613 - Part 4b: Swap out nsAutoPtr type for UniquePtr. r=peterv

This is essentially:
```
find dom/xslt -type f -n '*.h' | xargs sed -i -e 's/nsAutoPtr</mozilla::UniquePtr</g'
find dom/xslt -type f -n '*.cpp' | xargs sed -i -e 's/nsAutoPtr</UniquePtr</g'
```

Differential Revision: https://phabricator.services.mozilla.com/D72435
This commit is contained in:
Eric Rahm 2020-04-27 09:18:33 +00:00
Родитель e9c8e1d720
Коммит c284b3bba6
34 изменённых файлов: 305 добавлений и 295 удалений

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

@ -125,7 +125,7 @@ class txOwningExpandedNameMap : public txExpandedNameMap_base {
}
nsresult set(const txExpandedName& aKey, E* aValue) {
nsAutoPtr<E> oldValue;
mozilla::UniquePtr<E> oldValue;
return setItem(aKey, (void*)aValue, getter_Transfers(oldValue));
}

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

@ -88,7 +88,7 @@ XPathExpression* XPathEvaluator::CreateExpression(const nsAString& aExpression,
mRecycler = new txResultRecycler;
}
nsAutoPtr<Expr> expression;
UniquePtr<Expr> expression;
aRv = txExprParser::createExpr(PromiseFlatString(aExpression), aContext,
getter_Transfers(expression));
if (aRv.Failed()) {
@ -118,7 +118,7 @@ already_AddRefed<XPathResult> XPathEvaluator::Evaluate(
JSContext* aCx, const nsAString& aExpression, nsINode& aContextNode,
XPathNSResolver* aResolver, uint16_t aType, JS::Handle<JSObject*> aResult,
ErrorResult& rv) {
nsAutoPtr<XPathExpression> expression(
UniquePtr<XPathExpression> expression(
CreateExpression(aExpression, aResolver, rv));
if (rv.Failed()) {
return nullptr;

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

@ -44,7 +44,7 @@ class EvalContextImpl : public txIEvalContext {
RefPtr<txResultRecycler> mRecycler;
};
XPathExpression::XPathExpression(nsAutoPtr<Expr>&& aExpression,
XPathExpression::XPathExpression(UniquePtr<Expr>&& aExpression,
txResultRecycler* aRecycler,
Document* aDocument)
: mExpression(std::move(aExpression)),
@ -122,7 +122,7 @@ already_AddRefed<XPathResult> XPathExpression::EvaluateWithContext(
return nullptr;
}
nsAutoPtr<txXPathNode> contextNode(
UniquePtr<txXPathNode> contextNode(
txXPathNativeNode::createXPathNode(&aContextNode));
if (!contextNode) {
aRv.Throw(NS_ERROR_FAILURE);

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

@ -29,8 +29,8 @@ class XPathResult;
*/
class XPathExpression final : public NonRefcountedDOMObject {
public:
XPathExpression(nsAutoPtr<Expr>&& aExpression, txResultRecycler* aRecycler,
Document* aDocument);
XPathExpression(mozilla::UniquePtr<Expr>&& aExpression,
txResultRecycler* aRecycler, Document* aDocument);
~XPathExpression();
bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto,
@ -58,7 +58,7 @@ class XPathExpression final : public NonRefcountedDOMObject {
uint16_t aType, XPathResult* aInResult, ErrorResult& aRv);
private:
nsAutoPtr<Expr> mExpression;
mozilla::UniquePtr<Expr> mExpression;
RefPtr<txResultRecycler> mRecycler;
nsWeakPtr mDocument;
bool mCheckDocument;

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

@ -242,7 +242,7 @@ nsresult XPathResult::GetExprResult(txAExprResult** aExprResult) {
uint32_t i, count = mResultNodes.Count();
for (i = 0; i < count; ++i) {
nsAutoPtr<txXPathNode> node(
UniquePtr<txXPathNode> node(
txXPathNativeNode::createXPathNode(mResultNodes[i]));
if (!node) {
return NS_ERROR_OUT_OF_MEMORY;

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

@ -432,8 +432,8 @@ class txPredicatedNodeTest : public txNodeTest {
TX_DECL_NODE_TEST
private:
nsAutoPtr<txNodeTest> mNodeTest;
nsAutoPtr<Expr> mPredicate;
mozilla::UniquePtr<txNodeTest> mNodeTest;
mozilla::UniquePtr<Expr> mPredicate;
};
/**
@ -557,7 +557,7 @@ class LocationStep : public Expr, public PredicateList {
txIMatchContext* aContext,
txNodeSet* aNodes);
nsAutoPtr<txNodeTest> mNodeTest;
mozilla::UniquePtr<txNodeTest> mNodeTest;
LocationStepType mAxisIdentifier;
};
@ -572,7 +572,7 @@ class FilterExpr : public Expr, public PredicateList {
TX_DECL_EXPR
private:
nsAutoPtr<Expr> expr;
mozilla::UniquePtr<Expr> expr;
}; //-- FilterExpr
@ -600,7 +600,7 @@ class UnaryExpr : public Expr {
TX_DECL_EXPR
private:
nsAutoPtr<Expr> expr;
mozilla::UniquePtr<Expr> expr;
}; //-- UnaryExpr
/**
@ -618,7 +618,7 @@ class BooleanExpr : public Expr {
TX_DECL_EXPR
private:
nsAutoPtr<Expr> leftExpr, rightExpr;
mozilla::UniquePtr<Expr> leftExpr, rightExpr;
short op;
}; //-- BooleanExpr
@ -640,7 +640,7 @@ class txNumberExpr : public Expr {
TX_DECL_EXPR
private:
nsAutoPtr<Expr> mLeftExpr, mRightExpr;
mozilla::UniquePtr<Expr> mLeftExpr, mRightExpr;
eOp mOp;
}; //-- MultiplicativeExpr
@ -674,8 +674,8 @@ class RelationalExpr : public Expr {
bool compareResults(txIEvalContext* aContext, txAExprResult* aLeft,
txAExprResult* aRight);
nsAutoPtr<Expr> mLeftExpr;
nsAutoPtr<Expr> mRightExpr;
mozilla::UniquePtr<Expr> mLeftExpr;
mozilla::UniquePtr<Expr> mRightExpr;
RelationalExprType mOp;
};
@ -736,7 +736,7 @@ class PathExpr : public Expr {
private:
class PathExprItem {
public:
nsAutoPtr<Expr> expr;
mozilla::UniquePtr<Expr> expr;
PathOperator pathOp;
};

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

@ -31,7 +31,7 @@ nsresult txExprParser::createAVT(const nsAString& aAttrValue,
txIParseContext* aContext, Expr** aResult) {
*aResult = nullptr;
nsresult rv = NS_OK;
nsAutoPtr<Expr> expr;
UniquePtr<Expr> expr;
FunctionCall* concat = nullptr;
nsAutoString literalString;
@ -45,7 +45,7 @@ nsresult txExprParser::createAVT(const nsAString& aAttrValue,
// Every iteration through this loop parses either a literal section
// or an expression
start = iter;
nsAutoPtr<Expr> newExpr;
UniquePtr<Expr> newExpr;
if (!inExpr) {
// Parse literal section
literalString.Truncate();
@ -152,7 +152,7 @@ nsresult txExprParser::createExprInternal(const nsAString& aExpression,
aContext->SetErrorOffset(lexer.mPosition - start + aSubStringPos);
return rv;
}
nsAutoPtr<Expr> expr;
UniquePtr<Expr> expr;
rv = createExpr(lexer, aContext, getter_Transfers(expr));
if (NS_SUCCEEDED(rv) && lexer.peek()->mType != Token::END) {
rv = NS_ERROR_XPATH_BINARY_EXPECTED;
@ -182,8 +182,8 @@ nsresult txExprParser::createExprInternal(const nsAString& aExpression,
/**
* Creates a binary Expr for the given operator
*/
nsresult txExprParser::createBinaryExpr(nsAutoPtr<Expr>& left,
nsAutoPtr<Expr>& right, Token* op,
nsresult txExprParser::createBinaryExpr(UniquePtr<Expr>& left,
UniquePtr<Expr>& right, Token* op,
Expr** aResult) {
NS_ASSERTION(op, "internal error");
*aResult = nullptr;
@ -262,7 +262,7 @@ nsresult txExprParser::createExpr(txExprLexer& lexer, txIParseContext* aContext,
nsresult rv = NS_OK;
bool done = false;
nsAutoPtr<Expr> expr;
UniquePtr<Expr> expr;
txStack exprs;
txStack ops;
@ -299,8 +299,8 @@ nsresult txExprParser::createExpr(txExprLexer& lexer, txIParseContext* aContext,
while (!exprs.isEmpty() &&
tokPrecedence <= precedence(static_cast<Token*>(ops.peek()))) {
// can't use expr as argument due to order of evaluation
nsAutoPtr<Expr> left(static_cast<Expr*>(exprs.pop()));
nsAutoPtr<Expr> right(std::move(expr));
UniquePtr<Expr> left(static_cast<Expr*>(exprs.pop()));
UniquePtr<Expr> right(std::move(expr));
rv = createBinaryExpr(left, right, static_cast<Token*>(ops.pop()),
getter_Transfers(expr));
if (NS_FAILED(rv)) {
@ -316,8 +316,8 @@ nsresult txExprParser::createExpr(txExprLexer& lexer, txIParseContext* aContext,
}
while (NS_SUCCEEDED(rv) && !exprs.isEmpty()) {
nsAutoPtr<Expr> left(static_cast<Expr*>(exprs.pop()));
nsAutoPtr<Expr> right(std::move(expr));
UniquePtr<Expr> left(static_cast<Expr*>(exprs.pop()));
UniquePtr<Expr> right(std::move(expr));
rv = createBinaryExpr(left, right, static_cast<Token*>(ops.pop()),
getter_Transfers(expr));
}
@ -339,7 +339,7 @@ nsresult txExprParser::createFilterOrStep(txExprLexer& lexer,
nsresult rv = NS_OK;
Token* tok = lexer.peek();
nsAutoPtr<Expr> expr;
UniquePtr<Expr> expr;
switch (tok->mType) {
case Token::FUNCTION_NAME_AND_PAREN:
rv = createFunctionCall(lexer, aContext, getter_Transfers(expr));
@ -380,7 +380,7 @@ nsresult txExprParser::createFilterOrStep(txExprLexer& lexer,
}
if (lexer.peek()->mType == Token::L_BRACKET) {
nsAutoPtr<FilterExpr> filterExpr(new FilterExpr(expr.get()));
UniquePtr<FilterExpr> filterExpr(new FilterExpr(expr.get()));
expr.forget();
@ -399,7 +399,7 @@ nsresult txExprParser::createFunctionCall(txExprLexer& lexer,
Expr** aResult) {
*aResult = nullptr;
nsAutoPtr<FunctionCall> fnCall;
UniquePtr<FunctionCall> fnCall;
Token* tok = lexer.nextToken();
NS_ASSERTION(tok->mType == Token::FUNCTION_NAME_AND_PAREN,
@ -454,7 +454,7 @@ nsresult txExprParser::createLocationStep(txExprLexer& lexer,
//-- child axis is default
LocationStep::LocationStepType axisIdentifier = LocationStep::CHILD_AXIS;
nsAutoPtr<txNodeTest> nodeTest;
UniquePtr<txNodeTest> nodeTest;
//-- get Axis Identifier or AbbreviatedStep, if present
Token* tok = lexer.peek();
@ -540,7 +540,7 @@ nsresult txExprParser::createLocationStep(txExprLexer& lexer,
}
}
nsAutoPtr<LocationStep> lstep(
UniquePtr<LocationStep> lstep(
new LocationStep(nodeTest.get(), axisIdentifier));
nodeTest.forget();
@ -560,7 +560,7 @@ nsresult txExprParser::createLocationStep(txExprLexer& lexer,
nsresult txExprParser::createNodeTypeTest(txExprLexer& lexer,
txNodeTest** aTest) {
*aTest = 0;
nsAutoPtr<txNodeTypeTest> nodeTest;
UniquePtr<txNodeTypeTest> nodeTest;
Token* nodeTok = lexer.peek();
@ -610,7 +610,7 @@ nsresult txExprParser::createPathExpr(txExprLexer& lexer,
Expr** aResult) {
*aResult = nullptr;
nsAutoPtr<Expr> expr;
UniquePtr<Expr> expr;
Token* tok = lexer.peek();
@ -644,7 +644,7 @@ nsresult txExprParser::createPathExpr(txExprLexer& lexer,
}
// We have a PathExpr containing several steps
nsAutoPtr<PathExpr> pathExpr(new PathExpr());
UniquePtr<PathExpr> pathExpr(new PathExpr());
rv = pathExpr->addExpr(expr.get(), PathExpr::RELATIVE_OP);
NS_ENSURE_SUCCESS(rv, rv);
@ -688,7 +688,7 @@ nsresult txExprParser::createUnionExpr(txExprLexer& lexer,
Expr** aResult) {
*aResult = nullptr;
nsAutoPtr<Expr> expr;
UniquePtr<Expr> expr;
nsresult rv = createPathExpr(lexer, aContext, getter_Transfers(expr));
NS_ENSURE_SUCCESS(rv, rv);
@ -697,7 +697,7 @@ nsresult txExprParser::createUnionExpr(txExprLexer& lexer,
return NS_OK;
}
nsAutoPtr<UnionExpr> unionExpr(new UnionExpr());
UniquePtr<UnionExpr> unionExpr(new UnionExpr());
rv = unionExpr->addExpr(expr.get());
NS_ENSURE_SUCCESS(rv, rv);
@ -741,7 +741,7 @@ bool txExprParser::isLocationStepToken(Token* aToken) {
nsresult txExprParser::parsePredicates(PredicateList* aPredicateList,
txExprLexer& lexer,
txIParseContext* aContext) {
nsAutoPtr<Expr> expr;
UniquePtr<Expr> expr;
nsresult rv = NS_OK;
while (lexer.peek()->mType == Token::L_BRACKET) {
//-- eat Token
@ -779,7 +779,7 @@ nsresult txExprParser::parseParameters(FunctionCall* aFnCall,
return NS_OK;
}
nsAutoPtr<Expr> expr;
UniquePtr<Expr> expr;
nsresult rv = NS_OK;
while (1) {
rv = createExpr(lexer, aContext, getter_Transfers(expr));

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

@ -47,8 +47,8 @@ class txExprParser {
* Using nsAutoPtr& to optimize passing the ownership to the
* created binary expression objects.
*/
static nsresult createBinaryExpr(nsAutoPtr<Expr>& left,
nsAutoPtr<Expr>& right, Token* op,
static nsresult createBinaryExpr(mozilla::UniquePtr<Expr>& left,
mozilla::UniquePtr<Expr>& right, Token* op,
Expr** aResult);
static nsresult createExpr(txExprLexer& lexer, txIParseContext* aContext,
Expr** aResult);

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

@ -218,7 +218,7 @@ nsresult txXPathOptimizer::optimizeUnion(Expr* aInExpr, Expr** aOutExpr) {
// Create a txUnionNodeTest if needed
if (!unionTest) {
nsAutoPtr<txNodeTest> owner(unionTest = new txUnionNodeTest);
UniquePtr<txNodeTest> owner(unionTest = new txUnionNodeTest);
rv = unionTest->addNodeTest(currentStep->getNodeTest());
NS_ENSURE_SUCCESS(rv, rv);

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

@ -38,7 +38,7 @@ class txBufferingHandler : public txAXMLEventHandler {
TX_DECL_TXAXMLEVENTHANDLER
protected:
nsAutoPtr<txResultBuffer> mBuffer;
mozilla::UniquePtr<txResultBuffer> mBuffer;
bool mCanAddAttribute;
};

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

@ -122,7 +122,7 @@ static nsresult createAndAddToResult(nsAtom* aName, const nsAString& aValue,
rv = aResultHolder->AppendChildTo(elem, false);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txXPathNode> xpathNode(
UniquePtr<txXPathNode> xpathNode(
txXPathNativeNode::createXPathNode(elem, true));
NS_ENSURE_TRUE(xpathNode, NS_ERROR_OUT_OF_MEMORY);
@ -258,7 +258,7 @@ nsresult txEXSLTFunctionCall::evaluate(txIEvalContext* aContext,
nsAutoString value;
exprResult->stringValue(value);
nsAutoPtr<txXPathNode> node;
UniquePtr<txXPathNode> node;
rv = createTextNode(aContext, value, getter_Transfers(node));
NS_ENSURE_SUCCESS(rv, rv);
@ -685,7 +685,7 @@ nsresult txEXSLTRegExFunctionCall::evaluate(txIEvalContext* aContext,
rv = aContext->recycler()->getNodeSet(getter_AddRefs(resultSet));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txXPathNode> node;
UniquePtr<txXPathNode> node;
for (nsIContent* result = docFrag->GetFirstChild(); result;
result = result->GetNextSibling()) {
node = txXPathNativeNode::createXPathNode(result, true);

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

@ -239,7 +239,7 @@ nsresult txExecutionState::getVariable(int32_t aNamespace, nsAtom* aLName,
return rv;
}
} else {
nsAutoPtr<txRtfHandler> rtfHandler(new txRtfHandler);
UniquePtr<txRtfHandler> rtfHandler(new txRtfHandler);
rv = pushResultHandler(rtfHandler.get());
if (NS_FAILED(rv)) {

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

@ -44,7 +44,7 @@ class txLoadedDocumentEntry : public nsStringHashKey {
return NS_FAILED(mLoadResult);
}
nsAutoPtr<txXPathNode> mDocument;
mozilla::UniquePtr<txXPathNode> mDocument;
nsresult mLoadResult;
};
@ -56,7 +56,7 @@ class txLoadedDocumentsHash : public nsTHashtable<txLoadedDocumentEntry> {
private:
friend class txExecutionState;
nsAutoPtr<txXPathNode> mSourceDocument;
mozilla::UniquePtr<txXPathNode> mSourceDocument;
};
class txExecutionState : public txIMatchContext {
@ -125,7 +125,7 @@ class txExecutionState : public txIMatchContext {
txAXMLEventHandler* mOutputHandler;
txAXMLEventHandler* mResultHandler;
nsAutoPtr<txAXMLEventHandler> mObsoleteHandler;
mozilla::UniquePtr<txAXMLEventHandler> mObsoleteHandler;
txAOutputHandlerFactory* mOutputHandlerFactory;
RefPtr<txParameterMap> mTemplateParams;

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

@ -89,14 +89,14 @@ nsresult txApplyTemplates::execute(txExecutionState& aEs) {
return aEs.runTemplate(templ);
}
txAttribute::txAttribute(nsAutoPtr<Expr>&& aName, nsAutoPtr<Expr>&& aNamespace,
txAttribute::txAttribute(UniquePtr<Expr>&& aName, UniquePtr<Expr>&& aNamespace,
txNamespaceMap* aMappings)
: mName(std::move(aName)),
mNamespace(std::move(aNamespace)),
mMappings(aMappings) {}
nsresult txAttribute::execute(txExecutionState& aEs) {
nsAutoPtr<txTextHandler> handler(
UniquePtr<txTextHandler> handler(
static_cast<txTextHandler*>(aEs.popResultHandler()));
nsAutoString name;
@ -167,7 +167,7 @@ nsresult txCheckParam::execute(txExecutionState& aEs) {
return NS_OK;
}
txConditionalGoto::txConditionalGoto(nsAutoPtr<Expr>&& aCondition,
txConditionalGoto::txConditionalGoto(UniquePtr<Expr>&& aCondition,
txInstruction* aTarget)
: mCondition(std::move(aCondition)), mTarget(aTarget) {}
@ -184,7 +184,7 @@ nsresult txConditionalGoto::execute(txExecutionState& aEs) {
}
nsresult txComment::execute(txExecutionState& aEs) {
nsAutoPtr<txTextHandler> handler(
UniquePtr<txTextHandler> handler(
static_cast<txTextHandler*>(aEs.popResultHandler()));
uint32_t length = handler->mValue.Length();
int32_t pos = 0;
@ -321,7 +321,7 @@ nsresult txCopy::execute(txExecutionState& aEs) {
return NS_OK;
}
txCopyOf::txCopyOf(nsAutoPtr<Expr>&& aSelect) : mSelect(std::move(aSelect)) {}
txCopyOf::txCopyOf(UniquePtr<Expr>&& aSelect) : mSelect(std::move(aSelect)) {}
nsresult txCopyOf::execute(txExecutionState& aEs) {
RefPtr<txAExprResult> exprRes;
@ -413,7 +413,7 @@ nsresult txLoopNodeSet::execute(txExecutionState& aEs) {
}
txLREAttribute::txLREAttribute(int32_t aNamespaceID, nsAtom* aLocalName,
nsAtom* aPrefix, nsAutoPtr<Expr>&& aValue)
nsAtom* aPrefix, UniquePtr<Expr>&& aValue)
: mNamespaceID(aNamespaceID),
mLocalName(aLocalName),
mPrefix(aPrefix),
@ -443,7 +443,7 @@ nsresult txLREAttribute::execute(txExecutionState& aEs) {
txMessage::txMessage(bool aTerminate) : mTerminate(aTerminate) {}
nsresult txMessage::execute(txExecutionState& aEs) {
nsAutoPtr<txTextHandler> handler(
UniquePtr<txTextHandler> handler(
static_cast<txTextHandler*>(aEs.popResultHandler()));
nsCOMPtr<nsIConsoleService> consoleSvc =
@ -458,10 +458,10 @@ nsresult txMessage::execute(txExecutionState& aEs) {
}
txNumber::txNumber(txXSLTNumber::LevelType aLevel,
nsAutoPtr<txPattern>&& aCount, nsAutoPtr<txPattern>&& aFrom,
nsAutoPtr<Expr>&& aValue, nsAutoPtr<Expr>&& aFormat,
nsAutoPtr<Expr>&& aGroupingSeparator,
nsAutoPtr<Expr>&& aGroupingSize)
UniquePtr<txPattern>&& aCount, UniquePtr<txPattern>&& aFrom,
UniquePtr<Expr>&& aValue, UniquePtr<Expr>&& aFormat,
UniquePtr<Expr>&& aGroupingSeparator,
UniquePtr<Expr>&& aGroupingSize)
: mLevel(aLevel),
mCount(std::move(aCount)),
mFrom(std::move(aFrom)),
@ -486,11 +486,11 @@ nsresult txPopParams::execute(txExecutionState& aEs) {
return NS_OK;
}
txProcessingInstruction::txProcessingInstruction(nsAutoPtr<Expr>&& aName)
txProcessingInstruction::txProcessingInstruction(UniquePtr<Expr>&& aName)
: mName(std::move(aName)) {}
nsresult txProcessingInstruction::execute(txExecutionState& aEs) {
nsAutoPtr<txTextHandler> handler(
UniquePtr<txTextHandler> handler(
static_cast<txTextHandler*>(aEs.popResultHandler()));
XMLUtils::normalizePIValue(handler->mValue);
@ -509,7 +509,7 @@ nsresult txProcessingInstruction::execute(txExecutionState& aEs) {
return aEs.mResultHandler->processingInstruction(name, handler->mValue);
}
txPushNewContext::txPushNewContext(nsAutoPtr<Expr>&& aSelect)
txPushNewContext::txPushNewContext(UniquePtr<Expr>&& aSelect)
: mSelect(std::move(aSelect)), mBailTarget(nullptr) {}
txPushNewContext::~txPushNewContext() = default;
@ -561,11 +561,11 @@ nsresult txPushNewContext::execute(txExecutionState& aEs) {
return NS_OK;
}
nsresult txPushNewContext::addSort(nsAutoPtr<Expr>&& aSelectExpr,
nsAutoPtr<Expr>&& aLangExpr,
nsAutoPtr<Expr>&& aDataTypeExpr,
nsAutoPtr<Expr>&& aOrderExpr,
nsAutoPtr<Expr>&& aCaseOrderExpr) {
nsresult txPushNewContext::addSort(UniquePtr<Expr>&& aSelectExpr,
UniquePtr<Expr>&& aLangExpr,
UniquePtr<Expr>&& aDataTypeExpr,
UniquePtr<Expr>&& aOrderExpr,
UniquePtr<Expr>&& aCaseOrderExpr) {
if (SortKey* key = mSortKeys.AppendElement()) {
// workaround for not triggering the Copy Constructor
key->mSelectExpr = std::move(aSelectExpr);
@ -629,7 +629,7 @@ nsresult txReturn::execute(txExecutionState& aEs) {
return NS_OK;
}
txSetParam::txSetParam(const txExpandedName& aName, nsAutoPtr<Expr>&& aValue)
txSetParam::txSetParam(const txExpandedName& aName, UniquePtr<Expr>&& aValue)
: mName(aName), mValue(std::move(aValue)) {}
nsresult txSetParam::execute(txExecutionState& aEs) {
@ -643,7 +643,7 @@ nsresult txSetParam::execute(txExecutionState& aEs) {
rv = mValue->evaluate(aEs.getEvalContext(), getter_AddRefs(exprRes));
NS_ENSURE_SUCCESS(rv, rv);
} else {
nsAutoPtr<txRtfHandler> rtfHandler(
UniquePtr<txRtfHandler> rtfHandler(
static_cast<txRtfHandler*>(aEs.popResultHandler()));
rv = rtfHandler->getAsRTF(getter_AddRefs(exprRes));
NS_ENSURE_SUCCESS(rv, rv);
@ -656,7 +656,7 @@ nsresult txSetParam::execute(txExecutionState& aEs) {
}
txSetVariable::txSetVariable(const txExpandedName& aName,
nsAutoPtr<Expr>&& aValue)
UniquePtr<Expr>&& aValue)
: mName(aName), mValue(std::move(aValue)) {}
nsresult txSetVariable::execute(txExecutionState& aEs) {
@ -666,7 +666,7 @@ nsresult txSetVariable::execute(txExecutionState& aEs) {
rv = mValue->evaluate(aEs.getEvalContext(), getter_AddRefs(exprRes));
NS_ENSURE_SUCCESS(rv, rv);
} else {
nsAutoPtr<txRtfHandler> rtfHandler(
UniquePtr<txRtfHandler> rtfHandler(
static_cast<txRtfHandler*>(aEs.popResultHandler()));
rv = rtfHandler->getAsRTF(getter_AddRefs(exprRes));
NS_ENSURE_SUCCESS(rv, rv);
@ -675,8 +675,8 @@ nsresult txSetVariable::execute(txExecutionState& aEs) {
return aEs.bindVariable(mName, exprRes);
}
txStartElement::txStartElement(nsAutoPtr<Expr>&& aName,
nsAutoPtr<Expr>&& aNamespace,
txStartElement::txStartElement(UniquePtr<Expr>&& aName,
UniquePtr<Expr>&& aNamespace,
txNamespaceMap* aMappings)
: mName(std::move(aName)),
mNamespace(std::move(aNamespace)),
@ -761,7 +761,7 @@ nsresult txText::execute(txExecutionState& aEs) {
return aEs.mResultHandler->characters(mStr, mDOE);
}
txValueOf::txValueOf(nsAutoPtr<Expr>&& aExpr, bool aDOE)
txValueOf::txValueOf(UniquePtr<Expr>&& aExpr, bool aDOE)
: mExpr(std::move(aExpr)), mDOE(aDOE) {}
nsresult txValueOf::execute(txExecutionState& aEs) {

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

@ -27,7 +27,7 @@ class txInstruction : public txObject {
virtual nsresult execute(txExecutionState& aEs) = 0;
nsAutoPtr<txInstruction> mNext;
mozilla::UniquePtr<txInstruction> mNext;
};
#define TX_DECL_TXINSTRUCTION \
@ -59,13 +59,13 @@ class txApplyTemplates : public txInstruction {
class txAttribute : public txInstruction {
public:
txAttribute(nsAutoPtr<Expr>&& aName, nsAutoPtr<Expr>&& aNamespace,
txNamespaceMap* aMappings);
txAttribute(mozilla::UniquePtr<Expr>&& aName,
mozilla::UniquePtr<Expr>&& aNamespace, txNamespaceMap* aMappings);
TX_DECL_TXINSTRUCTION
nsAutoPtr<Expr> mName;
nsAutoPtr<Expr> mNamespace;
mozilla::UniquePtr<Expr> mName;
mozilla::UniquePtr<Expr> mNamespace;
RefPtr<txNamespaceMap> mMappings;
};
@ -90,11 +90,12 @@ class txCheckParam : public txInstruction {
class txConditionalGoto : public txInstruction {
public:
txConditionalGoto(nsAutoPtr<Expr>&& aCondition, txInstruction* aTarget);
txConditionalGoto(mozilla::UniquePtr<Expr>&& aCondition,
txInstruction* aTarget);
TX_DECL_TXINSTRUCTION
nsAutoPtr<Expr> mCondition;
mozilla::UniquePtr<Expr> mCondition;
txInstruction* mTarget;
};
@ -119,11 +120,11 @@ class txCopy : public txCopyBase {
class txCopyOf : public txCopyBase {
public:
explicit txCopyOf(nsAutoPtr<Expr>&& aSelect);
explicit txCopyOf(mozilla::UniquePtr<Expr>&& aSelect);
TX_DECL_TXINSTRUCTION
nsAutoPtr<Expr> mSelect;
mozilla::UniquePtr<Expr> mSelect;
};
class txEndElement : public txInstruction {
@ -166,7 +167,7 @@ class txLoopNodeSet : public txInstruction {
class txLREAttribute : public txInstruction {
public:
txLREAttribute(int32_t aNamespaceID, nsAtom* aLocalName, nsAtom* aPrefix,
nsAutoPtr<Expr>&& aValue);
mozilla::UniquePtr<Expr>&& aValue);
TX_DECL_TXINSTRUCTION
@ -174,7 +175,7 @@ class txLREAttribute : public txInstruction {
RefPtr<nsAtom> mLocalName;
RefPtr<nsAtom> mLowercaseLocalName;
RefPtr<nsAtom> mPrefix;
nsAutoPtr<Expr> mValue;
mozilla::UniquePtr<Expr> mValue;
};
class txMessage : public txInstruction {
@ -188,20 +189,23 @@ class txMessage : public txInstruction {
class txNumber : public txInstruction {
public:
txNumber(txXSLTNumber::LevelType aLevel, nsAutoPtr<txPattern>&& aCount,
nsAutoPtr<txPattern>&& aFrom, nsAutoPtr<Expr>&& aValue,
nsAutoPtr<Expr>&& aFormat, nsAutoPtr<Expr>&& aGroupingSeparator,
nsAutoPtr<Expr>&& aGroupingSize);
txNumber(txXSLTNumber::LevelType aLevel,
mozilla::UniquePtr<txPattern>&& aCount,
mozilla::UniquePtr<txPattern>&& aFrom,
mozilla::UniquePtr<Expr>&& aValue,
mozilla::UniquePtr<Expr>&& aFormat,
mozilla::UniquePtr<Expr>&& aGroupingSeparator,
mozilla::UniquePtr<Expr>&& aGroupingSize);
TX_DECL_TXINSTRUCTION
txXSLTNumber::LevelType mLevel;
nsAutoPtr<txPattern> mCount;
nsAutoPtr<txPattern> mFrom;
nsAutoPtr<Expr> mValue;
nsAutoPtr<Expr> mFormat;
nsAutoPtr<Expr> mGroupingSeparator;
nsAutoPtr<Expr> mGroupingSize;
mozilla::UniquePtr<txPattern> mCount;
mozilla::UniquePtr<txPattern> mFrom;
mozilla::UniquePtr<Expr> mValue;
mozilla::UniquePtr<Expr> mFormat;
mozilla::UniquePtr<Expr> mGroupingSeparator;
mozilla::UniquePtr<Expr> mGroupingSize;
};
class txPopParams : public txInstruction {
@ -211,35 +215,36 @@ class txPopParams : public txInstruction {
class txProcessingInstruction : public txInstruction {
public:
explicit txProcessingInstruction(nsAutoPtr<Expr>&& aName);
explicit txProcessingInstruction(mozilla::UniquePtr<Expr>&& aName);
TX_DECL_TXINSTRUCTION
nsAutoPtr<Expr> mName;
mozilla::UniquePtr<Expr> mName;
};
class txPushNewContext : public txInstruction {
public:
explicit txPushNewContext(nsAutoPtr<Expr>&& aSelect);
explicit txPushNewContext(mozilla::UniquePtr<Expr>&& aSelect);
~txPushNewContext();
TX_DECL_TXINSTRUCTION
nsresult addSort(nsAutoPtr<Expr>&& aSelectExpr, nsAutoPtr<Expr>&& aLangExpr,
nsAutoPtr<Expr>&& aDataTypeExpr,
nsAutoPtr<Expr>&& aOrderExpr,
nsAutoPtr<Expr>&& aCaseOrderExpr);
nsresult addSort(mozilla::UniquePtr<Expr>&& aSelectExpr,
mozilla::UniquePtr<Expr>&& aLangExpr,
mozilla::UniquePtr<Expr>&& aDataTypeExpr,
mozilla::UniquePtr<Expr>&& aOrderExpr,
mozilla::UniquePtr<Expr>&& aCaseOrderExpr);
struct SortKey {
nsAutoPtr<Expr> mSelectExpr;
nsAutoPtr<Expr> mLangExpr;
nsAutoPtr<Expr> mDataTypeExpr;
nsAutoPtr<Expr> mOrderExpr;
nsAutoPtr<Expr> mCaseOrderExpr;
mozilla::UniquePtr<Expr> mSelectExpr;
mozilla::UniquePtr<Expr> mLangExpr;
mozilla::UniquePtr<Expr> mDataTypeExpr;
mozilla::UniquePtr<Expr> mOrderExpr;
mozilla::UniquePtr<Expr> mCaseOrderExpr;
};
nsTArray<SortKey> mSortKeys;
nsAutoPtr<Expr> mSelect;
mozilla::UniquePtr<Expr> mSelect;
txInstruction* mBailTarget;
};
@ -283,33 +288,34 @@ class txReturn : public txInstruction {
class txSetParam : public txInstruction {
public:
txSetParam(const txExpandedName& aName, nsAutoPtr<Expr>&& aValue);
txSetParam(const txExpandedName& aName, mozilla::UniquePtr<Expr>&& aValue);
TX_DECL_TXINSTRUCTION
txExpandedName mName;
nsAutoPtr<Expr> mValue;
mozilla::UniquePtr<Expr> mValue;
};
class txSetVariable : public txInstruction {
public:
txSetVariable(const txExpandedName& aName, nsAutoPtr<Expr>&& aValue);
txSetVariable(const txExpandedName& aName, mozilla::UniquePtr<Expr>&& aValue);
TX_DECL_TXINSTRUCTION
txExpandedName mName;
nsAutoPtr<Expr> mValue;
mozilla::UniquePtr<Expr> mValue;
};
class txStartElement : public txInstruction {
public:
txStartElement(nsAutoPtr<Expr>&& aName, nsAutoPtr<Expr>&& aNamespace,
txStartElement(mozilla::UniquePtr<Expr>&& aName,
mozilla::UniquePtr<Expr>&& aNamespace,
txNamespaceMap* aMappings);
TX_DECL_TXINSTRUCTION
nsAutoPtr<Expr> mName;
nsAutoPtr<Expr> mNamespace;
mozilla::UniquePtr<Expr> mName;
mozilla::UniquePtr<Expr> mNamespace;
RefPtr<txNamespaceMap> mMappings;
};
@ -337,11 +343,11 @@ class txText : public txInstruction {
class txValueOf : public txInstruction {
public:
txValueOf(nsAutoPtr<Expr>&& aExpr, bool aDOE);
txValueOf(mozilla::UniquePtr<Expr>&& aExpr, bool aDOE);
TX_DECL_TXINSTRUCTION
nsAutoPtr<Expr> mExpr;
mozilla::UniquePtr<Expr> mExpr;
bool mDOE;
};

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

@ -102,7 +102,8 @@ class txXSLKey {
* @param aUse use-expression
* @return false if an error occurred, true otherwise
*/
bool addKey(nsAutoPtr<txPattern>&& aMatch, nsAutoPtr<Expr>&& aUse);
bool addKey(mozilla::UniquePtr<txPattern>&& aMatch,
mozilla::UniquePtr<Expr>&& aUse);
/**
* Indexes a subtree and adds it to the hash of key values
@ -141,8 +142,8 @@ class txXSLKey {
* represents one match/use pair
*/
struct Key {
nsAutoPtr<txPattern> matchPattern;
nsAutoPtr<Expr> useExpr;
mozilla::UniquePtr<txPattern> matchPattern;
mozilla::UniquePtr<Expr> useExpr;
};
/**

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

@ -220,7 +220,7 @@ nsresult txKeyHash::init() {
* @param aUse use-expression
* @return false if an error occurred, true otherwise
*/
bool txXSLKey::addKey(nsAutoPtr<txPattern>&& aMatch, nsAutoPtr<Expr>&& aUse) {
bool txXSLKey::addKey(UniquePtr<txPattern>&& aMatch, UniquePtr<Expr>&& aUse) {
if (!aMatch || !aUse) return false;
Key* key = mKeys.AppendElement();

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

@ -77,7 +77,7 @@ nsresult txToDocHandlerFactory::createHandlerWith(
}
case eHTMLOutput: {
nsAutoPtr<txMozillaXMLOutput> handler(
UniquePtr<txMozillaXMLOutput> handler(
new txMozillaXMLOutput(aFormat, mObserver));
nsresult rv = handler->createResultDocument(
@ -90,7 +90,7 @@ nsresult txToDocHandlerFactory::createHandlerWith(
}
case eTextOutput: {
nsAutoPtr<txMozillaTextOutput> handler(
UniquePtr<txMozillaTextOutput> handler(
new txMozillaTextOutput(mObserver));
nsresult rv =
@ -120,7 +120,7 @@ nsresult txToDocHandlerFactory::createHandlerWith(
case eXMLOutput:
case eHTMLOutput: {
nsAutoPtr<txMozillaXMLOutput> handler(
UniquePtr<txMozillaXMLOutput> handler(
new txMozillaXMLOutput(aFormat, mObserver));
nsresult rv = handler->createResultDocument(aName, aNsID, mSourceDocument,
@ -133,7 +133,7 @@ nsresult txToDocHandlerFactory::createHandlerWith(
}
case eTextOutput: {
nsAutoPtr<txMozillaTextOutput> handler(
UniquePtr<txMozillaTextOutput> handler(
new txMozillaTextOutput(mObserver));
nsresult rv =
@ -394,7 +394,7 @@ txMozillaXSLTProcessor::AddXSLTParam(const nsString& aName,
RefPtr<txAExprResult> value;
if (!aSelect.IsVoid()) {
// Set up context
nsAutoPtr<txXPathNode> contextNode(
UniquePtr<txXPathNode> contextNode(
txXPathNativeNode::createXPathNode(aContext));
NS_ENSURE_TRUE(contextNode, NS_ERROR_OUT_OF_MEMORY);
@ -406,7 +406,7 @@ txMozillaXSLTProcessor::AddXSLTParam(const nsString& aName,
mRecycler);
// Parse
nsAutoPtr<Expr> expr;
UniquePtr<Expr> expr;
rv = txExprParser::createExpr(aSelect, &paramContext,
getter_Transfers(expr));
NS_ENSURE_SUCCESS(rv, rv);
@ -540,7 +540,7 @@ already_AddRefed<Document> txMozillaXSLTProcessor::TransformToDocument(
nsresult txMozillaXSLTProcessor::TransformToDoc(Document** aResult,
bool aCreateDataDocument) {
nsAutoPtr<txXPathNode> sourceNode(
UniquePtr<txXPathNode> sourceNode(
txXPathNativeNode::createXPathNode(mSource));
if (!sourceNode) {
return NS_ERROR_OUT_OF_MEMORY;
@ -607,7 +607,7 @@ already_AddRefed<DocumentFragment> txMozillaXSLTProcessor::TransformToFragment(
return nullptr;
}
nsAutoPtr<txXPathNode> sourceNode(
UniquePtr<txXPathNode> sourceNode(
txXPathNativeNode::createXPathNode(&aSource));
if (!sourceNode) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
@ -1208,7 +1208,7 @@ nsresult txVariable::Convert(nsIVariant* aValue, txAExprResult** aResult) {
nsCOMPtr<nsINode> node = do_QueryInterface(supports);
if (node) {
nsAutoPtr<txXPathNode> xpathNode(
UniquePtr<txXPathNode> xpathNode(
txXPathNativeNode::createXPathNode(node));
if (!xpathNode) {
return NS_ERROR_FAILURE;
@ -1240,7 +1240,7 @@ nsresult txVariable::Convert(nsIVariant* aValue, txAExprResult** aResult) {
uint32_t i;
for (i = 0; i < length; ++i) {
nsAutoPtr<txXPathNode> xpathNode(
UniquePtr<txXPathNode> xpathNode(
txXPathNativeNode::createXPathNode(nodeList->Item(i)));
if (!xpathNode) {
return NS_ERROR_FAILURE;
@ -1301,7 +1301,7 @@ nsresult txVariable::Convert(nsIVariant* aValue, txAExprResult** aResult) {
nsCOMPtr<nsINode> node = do_QueryInterface(supports);
NS_ASSERTION(node, "Huh, we checked this in SetParameter?");
nsAutoPtr<txXPathNode> xpathNode(
UniquePtr<txXPathNode> xpathNode(
txXPathNativeNode::createXPathNode(node));
if (!xpathNode) {
while (i < count) {

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

@ -37,7 +37,7 @@ nsresult txNodeSorter::addSortElement(Expr* aSelectExpr, Expr* aLangExpr,
Expr* aDataTypeExpr, Expr* aOrderExpr,
Expr* aCaseOrderExpr,
txIEvalContext* aContext) {
nsAutoPtr<SortKey> key(new SortKey);
UniquePtr<SortKey> key(new SortKey);
nsresult rv = NS_OK;
// Select

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

@ -21,7 +21,7 @@ nsresult txPatternParser::createPattern(const nsString& aPattern,
// XXX error report parsing error
return rv;
}
nsAutoPtr<txPattern> pattern;
UniquePtr<txPattern> pattern;
rv = createUnionPattern(lexer, aContext, *getter_Transfers(pattern));
if (NS_FAILED(rv)) {
// XXX error report parsing error
@ -277,7 +277,7 @@ nsresult txPatternParser::createStepPattern(txExprLexer& aLexer,
NS_ENSURE_SUCCESS(rv, rv);
}
nsAutoPtr<txStepPattern> step(new txStepPattern(nodeTest, isAttr));
UniquePtr<txStepPattern> step(new txStepPattern(nodeTest, isAttr));
rv = parsePredicates(step.get(), aLexer, aContext);
NS_ENSURE_SUCCESS(rv, rv);

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

@ -7,7 +7,7 @@
#include <utility>
txResultTreeFragment::txResultTreeFragment(nsAutoPtr<txResultBuffer>&& aBuffer)
txResultTreeFragment::txResultTreeFragment(UniquePtr<txResultBuffer>&& aBuffer)
: txAExprResult(nullptr), mBuffer(std::move(aBuffer)) {}
short txResultTreeFragment::getResultType() { return RESULT_TREE_FRAGMENT; }

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

@ -13,7 +13,7 @@
class txResultTreeFragment : public txAExprResult {
public:
explicit txResultTreeFragment(nsAutoPtr<txResultBuffer>&& aBuffer);
explicit txResultTreeFragment(mozilla::UniquePtr<txResultBuffer>&& aBuffer);
TX_DECL_EXPRRESULT
@ -27,8 +27,8 @@ class txResultTreeFragment : public txAExprResult {
const txXPathNode* getNode() const { return mNode.get(); }
private:
nsAutoPtr<txResultBuffer> mBuffer;
nsAutoPtr<const txXPathNode> mNode;
mozilla::UniquePtr<txResultBuffer> mBuffer;
mozilla::UniquePtr<const txXPathNode> mNode;
};
class txRtfHandler : public txBufferingHandler {

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

@ -28,8 +28,8 @@ nsresult txStylesheet::init() {
// element/root template
mContainerTemplate = new txPushParams;
nsAutoPtr<txNodeTest> nt(new txNodeTypeTest(txNodeTypeTest::NODE_TYPE));
nsAutoPtr<Expr> nodeExpr(
UniquePtr<txNodeTest> nt(new txNodeTypeTest(txNodeTypeTest::NODE_TYPE));
UniquePtr<Expr> nodeExpr(
new LocationStep(nt.get(), LocationStep::CHILD_AXIS));
nt.forget();
@ -314,7 +314,7 @@ nsresult txStylesheet::doneCompiling() {
}
if (!mDecimalFormats.get(txExpandedName())) {
nsAutoPtr<txDecimalFormat> format(new txDecimalFormat);
UniquePtr<txDecimalFormat> format(new txDecimalFormat);
rv = mDecimalFormats.add(txExpandedName(), format.get());
NS_ENSURE_SUCCESS(rv, rv);
@ -350,7 +350,7 @@ nsresult txStylesheet::addTemplate(txTemplateItem* aTemplate,
aImportFrame->mMatchableTemplates.get(aTemplate->mMode);
if (!templates) {
nsAutoPtr<nsTArray<MatchableTemplate> > newList(
UniquePtr<nsTArray<MatchableTemplate> > newList(
new nsTArray<MatchableTemplate>);
nsresult rv =
aImportFrame->mMatchableTemplates.set(aTemplate->mMode, newList.get());
@ -361,8 +361,8 @@ nsresult txStylesheet::addTemplate(txTemplateItem* aTemplate,
// Add the simple patterns to the list of matchable templates, according
// to default priority
nsAutoPtr<txPattern> simple = std::move(aTemplate->mMatch);
nsAutoPtr<txPattern> unionPattern;
UniquePtr<txPattern> simple = std::move(aTemplate->mMatch);
UniquePtr<txPattern> unionPattern;
if (simple->getType() == txPattern::UNION_PATTERN) {
unionPattern = std::move(simple);
simple = unionPattern->getSubPatternAt(0);
@ -489,7 +489,7 @@ nsresult txStylesheet::addGlobalVariable(txVariableItem* aVariable) {
if (mGlobalVariables.get(aVariable->mName)) {
return NS_OK;
}
nsAutoPtr<GlobalVariable> var(new GlobalVariable(
UniquePtr<GlobalVariable> var(new GlobalVariable(
std::move(aVariable->mValue), std::move(aVariable->mFirstInstruction),
aVariable->mIsParam));
nsresult rv = mGlobalVariables.add(aVariable->mName, var.get());
@ -501,8 +501,8 @@ nsresult txStylesheet::addGlobalVariable(txVariableItem* aVariable) {
}
nsresult txStylesheet::addKey(const txExpandedName& aName,
nsAutoPtr<txPattern> aMatch,
nsAutoPtr<Expr> aUse) {
UniquePtr<txPattern> aMatch,
UniquePtr<Expr> aUse) {
nsresult rv = NS_OK;
txXSLKey* xslKey = mKeys.get(aName);
@ -521,7 +521,7 @@ nsresult txStylesheet::addKey(const txExpandedName& aName,
}
nsresult txStylesheet::addDecimalFormat(const txExpandedName& aName,
nsAutoPtr<txDecimalFormat>&& aFormat) {
UniquePtr<txDecimalFormat>&& aFormat) {
txDecimalFormat* existing = mDecimalFormats.get(aName);
if (existing) {
NS_ENSURE_TRUE(existing->isEqual(aFormat.get()),
@ -545,8 +545,8 @@ txStylesheet::ImportFrame::~ImportFrame() {
}
}
txStylesheet::GlobalVariable::GlobalVariable(nsAutoPtr<Expr>&& aExpr,
nsAutoPtr<txInstruction>&& aInstr,
txStylesheet::GlobalVariable::GlobalVariable(UniquePtr<Expr>&& aExpr,
UniquePtr<txInstruction>&& aInstr,
bool aIsParam)
: mExpr(std::move(aExpr)),
mFirstInstruction(std::move(aInstr)),

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

@ -54,18 +54,19 @@ class txStylesheet final {
/**
* Add a key to the stylesheet
*/
nsresult addKey(const txExpandedName& aName, nsAutoPtr<txPattern> aMatch,
nsAutoPtr<Expr> aUse);
nsresult addKey(const txExpandedName& aName,
mozilla::UniquePtr<txPattern> aMatch,
mozilla::UniquePtr<Expr> aUse);
/**
* Add a decimal-format to the stylesheet
*/
nsresult addDecimalFormat(const txExpandedName& aName,
nsAutoPtr<txDecimalFormat>&& aFormat);
mozilla::UniquePtr<txDecimalFormat>&& aFormat);
struct MatchableTemplate {
txInstruction* mFirstInstruction;
nsAutoPtr<txPattern> mMatch;
mozilla::UniquePtr<txPattern> mMatch;
double mPriority;
};
@ -89,11 +90,12 @@ class txStylesheet final {
class GlobalVariable : public txObject {
public:
GlobalVariable(nsAutoPtr<Expr>&& aExpr,
nsAutoPtr<txInstruction>&& aFirstInstruction, bool aIsParam);
GlobalVariable(mozilla::UniquePtr<Expr>&& aExpr,
mozilla::UniquePtr<txInstruction>&& aFirstInstruction,
bool aIsParam);
nsAutoPtr<Expr> mExpr;
nsAutoPtr<txInstruction> mFirstInstruction;
mozilla::UniquePtr<Expr> mExpr;
mozilla::UniquePtr<txInstruction> mFirstInstruction;
bool mIsParam;
};
@ -137,12 +139,12 @@ class txStylesheet final {
txOwningExpandedNameMap<txXSLKey> mKeys;
// Array of all txStripSpaceTests, sorted in acending order
nsTArray<nsAutoPtr<txStripSpaceTest> > mStripSpaceTests;
nsTArray<mozilla::UniquePtr<txStripSpaceTest> > mStripSpaceTests;
// Default templates
nsAutoPtr<txInstruction> mContainerTemplate;
nsAutoPtr<txInstruction> mCharactersTemplate;
nsAutoPtr<txInstruction> mEmptyTemplate;
mozilla::UniquePtr<txInstruction> mContainerTemplate;
mozilla::UniquePtr<txInstruction> mCharactersTemplate;
mozilla::UniquePtr<txInstruction> mEmptyTemplate;
};
/**

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

@ -95,7 +95,7 @@ static nsresult parseUseAttrSets(txStylesheetAttr* aAttributes,
rv = name.init(tok.nextToken(), aState.mElementContext->mMappings, false);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(new txInsertAttrSet(name));
UniquePtr<txInstruction> instr(new txInsertAttrSet(name));
aState.addInstruction(std::move(instr));
}
return NS_OK;
@ -140,7 +140,7 @@ static nsresult getQNameAttr(txStylesheetAttr* aAttributes, int32_t aAttrCount,
static nsresult getExprAttr(txStylesheetAttr* aAttributes, int32_t aAttrCount,
nsAtom* aName, bool aRequired,
txStylesheetCompilerState& aState,
nsAutoPtr<Expr>& aExpr) {
UniquePtr<Expr>& aExpr) {
aExpr = nullptr;
txStylesheetAttr* attr = nullptr;
nsresult rv = getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None, aName,
@ -170,7 +170,7 @@ static nsresult getExprAttr(txStylesheetAttr* aAttributes, int32_t aAttrCount,
static nsresult getAVTAttr(txStylesheetAttr* aAttributes, int32_t aAttrCount,
nsAtom* aName, bool aRequired,
txStylesheetCompilerState& aState,
nsAutoPtr<Expr>& aAVT) {
UniquePtr<Expr>& aAVT) {
aAVT = nullptr;
txStylesheetAttr* attr = nullptr;
nsresult rv = getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None, aName,
@ -201,7 +201,7 @@ static nsresult getPatternAttr(txStylesheetAttr* aAttributes,
int32_t aAttrCount, nsAtom* aName,
bool aRequired,
txStylesheetCompilerState& aState,
nsAutoPtr<txPattern>& aPattern) {
UniquePtr<txPattern>& aPattern) {
aPattern = nullptr;
txStylesheetAttr* attr = nullptr;
nsresult rv = getStyleAttr(aAttributes, aAttrCount, kNameSpaceID_None, aName,
@ -425,8 +425,8 @@ static nsresult txFnStartLREStylesheet(int32_t aNamespaceID, nsAtom* aLocalName,
txExpandedName nullExpr;
double prio = UnspecifiedNaN<double>();
nsAutoPtr<txPattern> match(new txRootPattern());
nsAutoPtr<txTemplateItem> templ(
UniquePtr<txPattern> match(new txRootPattern());
UniquePtr<txTemplateItem> templ(
new txTemplateItem(std::move(match), nullExpr, nullExpr, prio));
aState.openInstructionContainer(templ.get());
aState.addToplevelItem(templ.get());
@ -446,7 +446,7 @@ static nsresult txFnEndLREStylesheet(txStylesheetCompilerState& aState) {
aState.popHandlerTable();
nsAutoPtr<txInstruction> instr(new txReturn());
UniquePtr<txInstruction> instr(new txReturn());
aState.addInstruction(std::move(instr));
aState.closeInstructionContainer();
@ -512,7 +512,7 @@ static nsresult txFnStartAttributeSet(int32_t aNamespaceID, nsAtom* aLocalName,
name);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txAttributeSetItem> attrSet(new txAttributeSetItem(name));
UniquePtr<txAttributeSetItem> attrSet(new txAttributeSetItem(name));
aState.openInstructionContainer(attrSet.get());
aState.addToplevelItem(attrSet.get());
@ -528,7 +528,7 @@ static nsresult txFnStartAttributeSet(int32_t aNamespaceID, nsAtom* aLocalName,
static nsresult txFnEndAttributeSet(txStylesheetCompilerState& aState) {
aState.popHandlerTable();
nsAutoPtr<txInstruction> instr(new txReturn());
UniquePtr<txInstruction> instr(new txReturn());
aState.addInstruction(std::move(instr));
aState.closeInstructionContainer();
@ -548,7 +548,7 @@ static nsresult txFnStartDecimalFormat(int32_t aNamespaceID, nsAtom* aLocalName,
name);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txDecimalFormat> format(new txDecimalFormat);
UniquePtr<txDecimalFormat> format(new txDecimalFormat);
rv = getCharAttr(aAttributes, aAttrCount, nsGkAtoms::decimalSeparator, false,
aState, format->mDecimalSeparator);
NS_ENSURE_SUCCESS(rv, rv);
@ -615,7 +615,7 @@ static nsresult txFnStartImport(int32_t aNamespaceID, nsAtom* aLocalName,
nsAtom* aPrefix, txStylesheetAttr* aAttributes,
int32_t aAttrCount,
txStylesheetCompilerState& aState) {
nsAutoPtr<txImportItem> import(new txImportItem);
UniquePtr<txImportItem> import(new txImportItem);
import->mFrame = new txStylesheet::ImportFrame;
aState.addToplevelItem(import.get());
@ -677,12 +677,12 @@ static nsresult txFnStartKey(int32_t aNamespaceID, nsAtom* aLocalName,
aState.mDisAllowed = txIParseContext::KEY_FUNCTION;
nsAutoPtr<txPattern> match;
UniquePtr<txPattern> match;
rv = getPatternAttr(aAttributes, aAttrCount, nsGkAtoms::match, true, aState,
match);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<Expr> use;
UniquePtr<Expr> use;
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::use, true, aState, use);
NS_ENSURE_SUCCESS(rv, rv);
@ -733,7 +733,7 @@ static nsresult txFnStartOutput(int32_t aNamespaceID, nsAtom* aLocalName,
txStylesheetCompilerState& aState) {
nsresult rv = NS_OK;
nsAutoPtr<txOutputItem> item(new txOutputItem);
UniquePtr<txOutputItem> item(new txOutputItem);
txExpandedName methodExpName;
rv = getQNameAttr(aAttributes, aAttrCount, nsGkAtoms::method, false, aState,
@ -793,7 +793,7 @@ static nsresult txFnStartOutput(int32_t aNamespaceID, nsAtom* aLocalName,
if (attr) {
nsWhitespaceTokenizer tokens(attr->mValue);
while (tokens.hasMoreTokens()) {
nsAutoPtr<txExpandedName> qname(new txExpandedName());
UniquePtr<txExpandedName> qname(new txExpandedName());
rv = qname->init(tokens.nextToken(), aState.mElementContext->mMappings,
false);
NS_ENSURE_SUCCESS(rv, rv);
@ -836,7 +836,7 @@ static nsresult txFnStartStripSpace(int32_t aNamespaceID, nsAtom* aLocalName,
bool strip = aLocalName == nsGkAtoms::stripSpace;
nsAutoPtr<txStripSpaceItem> stripItem(new txStripSpaceItem);
UniquePtr<txStripSpaceItem> stripItem(new txStripSpaceItem);
nsWhitespaceTokenizer tokenizer(attr->mValue);
while (tokenizer.hasMoreTokens()) {
const nsAString& name = tokenizer.nextToken();
@ -875,7 +875,7 @@ static nsresult txFnStartStripSpace(int32_t aNamespaceID, nsAtom* aLocalName,
ns = aState.mElementContext->mMappings->lookupNamespace(prefix);
NS_ENSURE_TRUE(ns != kNameSpaceID_Unknown, NS_ERROR_FAILURE);
}
nsAutoPtr<txStripSpaceTest> sst(
UniquePtr<txStripSpaceTest> sst(
new txStripSpaceTest(prefix, localName, ns, strip));
rv = stripItem->addStripSpaceTest(sst.get());
NS_ENSURE_SUCCESS(rv, rv);
@ -916,12 +916,12 @@ static nsresult txFnStartTemplate(int32_t aNamespaceID, nsAtom* aLocalName,
aState, prio);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txPattern> match;
UniquePtr<txPattern> match;
rv = getPatternAttr(aAttributes, aAttrCount, nsGkAtoms::match, name.isNull(),
aState, match);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txTemplateItem> templ(
UniquePtr<txTemplateItem> templ(
new txTemplateItem(std::move(match), name, mode, prio));
aState.openInstructionContainer(templ.get());
aState.addToplevelItem(templ.forget());
@ -932,7 +932,7 @@ static nsresult txFnStartTemplate(int32_t aNamespaceID, nsAtom* aLocalName,
static nsresult txFnEndTemplate(txStylesheetCompilerState& aState) {
aState.popHandlerTable();
nsAutoPtr<txInstruction> instr(new txReturn());
UniquePtr<txInstruction> instr(new txReturn());
aState.addInstruction(std::move(instr));
aState.closeInstructionContainer();
@ -952,12 +952,12 @@ static nsresult txFnStartTopVariable(int32_t aNamespaceID, nsAtom* aLocalName,
name);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<Expr> select;
UniquePtr<Expr> select;
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, false, aState,
select);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txVariableItem> var(new txVariableItem(
UniquePtr<txVariableItem> var(new txVariableItem(
name, std::move(select), aLocalName == nsGkAtoms::param));
aState.openInstructionContainer(var.get());
rv = aState.pushPtr(var.get(), aState.eVariableItem);
@ -989,7 +989,7 @@ static nsresult txFnEndTopVariable(txStylesheetCompilerState& aState) {
var->mValue = new txLiteralExpr(EmptyString());
} else if (!var->mValue) {
// If we don't have a select-expression there mush be children.
nsAutoPtr<txInstruction> instr(new txReturn());
UniquePtr<txInstruction> instr(new txReturn());
aState.addInstruction(std::move(instr));
}
@ -1036,7 +1036,7 @@ static nsresult txFnStartLRE(int32_t aNamespaceID, nsAtom* aLocalName,
txStylesheetCompilerState& aState) {
nsresult rv = NS_OK;
nsAutoPtr<txInstruction> instr(
UniquePtr<txInstruction> instr(
new txStartLREElement(aNamespaceID, aLocalName, aPrefix));
aState.addInstruction(std::move(instr));
@ -1059,7 +1059,7 @@ static nsresult txFnStartLRE(int32_t aNamespaceID, nsAtom* aLocalName,
continue;
}
nsAutoPtr<Expr> avt;
UniquePtr<Expr> avt;
rv = txExprParser::createAVT(attr->mValue, &aState, getter_Transfers(avt));
NS_ENSURE_SUCCESS(rv, rv);
@ -1072,7 +1072,7 @@ static nsresult txFnStartLRE(int32_t aNamespaceID, nsAtom* aLocalName,
}
static nsresult txFnEndLRE(txStylesheetCompilerState& aState) {
nsAutoPtr<txInstruction> instr(new txEndElement);
UniquePtr<txInstruction> instr(new txEndElement);
aState.addInstruction(std::move(instr));
return NS_OK;
@ -1087,7 +1087,7 @@ static nsresult txFnText(const nsAString& aStr,
txStylesheetCompilerState& aState) {
TX_RETURN_IF_WHITESPACE(aStr, aState);
nsAutoPtr<txInstruction> instr(new txText(aStr, false));
UniquePtr<txInstruction> instr(new txText(aStr, false));
aState.addInstruction(std::move(instr));
return NS_OK;
@ -1104,7 +1104,7 @@ static nsresult txFnStartApplyImports(int32_t aNamespaceID, nsAtom* aLocalName,
txStylesheetAttr* aAttributes,
int32_t aAttrCount,
txStylesheetCompilerState& aState) {
nsAutoPtr<txInstruction> instr(new txApplyImportsStart);
UniquePtr<txInstruction> instr(new txApplyImportsStart);
aState.addInstruction(std::move(instr));
instr = new txApplyImportsEnd;
@ -1136,7 +1136,7 @@ static nsresult txFnStartApplyTemplates(int32_t aNamespaceID,
txStylesheetCompilerState& aState) {
nsresult rv = NS_OK;
nsAutoPtr<txInstruction> instr(new txPushParams);
UniquePtr<txInstruction> instr(new txPushParams);
aState.addInstruction(std::move(instr));
txExpandedName mode;
@ -1150,17 +1150,17 @@ static nsresult txFnStartApplyTemplates(int32_t aNamespaceID,
instr.forget();
nsAutoPtr<Expr> select;
UniquePtr<Expr> select;
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, false, aState,
select);
NS_ENSURE_SUCCESS(rv, rv);
if (!select) {
nsAutoPtr<txNodeTest> nt(new txNodeTypeTest(txNodeTypeTest::NODE_TYPE));
UniquePtr<txNodeTest> nt(new txNodeTypeTest(txNodeTypeTest::NODE_TYPE));
select = new LocationStep(nt.forget(), LocationStep::CHILD_AXIS);
}
nsAutoPtr<txPushNewContext> pushcontext(
UniquePtr<txPushNewContext> pushcontext(
new txPushNewContext(std::move(select)));
rv = aState.pushSorter(pushcontext.get());
NS_ENSURE_SUCCESS(rv, rv);
@ -1178,13 +1178,13 @@ static nsresult txFnEndApplyTemplates(txStylesheetCompilerState& aState) {
txPushNewContext* pushcontext =
static_cast<txPushNewContext*>(aState.popObject());
nsAutoPtr<txInstruction> instr(pushcontext); // txPushNewContext
UniquePtr<txInstruction> instr(pushcontext); // txPushNewContext
aState.addInstruction(std::move(instr));
aState.popSorter();
instr = static_cast<txInstruction*>(aState.popObject()); // txApplyTemplates
nsAutoPtr<txLoopNodeSet> loop(new txLoopNodeSet(instr.get()));
UniquePtr<txLoopNodeSet> loop(new txLoopNodeSet(instr.get()));
aState.addInstruction(std::move(instr));
instr = loop.forget();
@ -1211,14 +1211,14 @@ static nsresult txFnStartAttribute(int32_t aNamespaceID, nsAtom* aLocalName,
txStylesheetCompilerState& aState) {
nsresult rv = NS_OK;
nsAutoPtr<txInstruction> instr(new txPushStringHandler(true));
UniquePtr<txInstruction> instr(new txPushStringHandler(true));
aState.addInstruction(std::move(instr));
nsAutoPtr<Expr> name;
UniquePtr<Expr> name;
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::name, true, aState, name);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<Expr> nspace;
UniquePtr<Expr> nspace;
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::_namespace, false, aState,
nspace);
NS_ENSURE_SUCCESS(rv, rv);
@ -1237,7 +1237,7 @@ static nsresult txFnStartAttribute(int32_t aNamespaceID, nsAtom* aLocalName,
static nsresult txFnEndAttribute(txStylesheetCompilerState& aState) {
aState.popHandlerTable();
nsAutoPtr<txInstruction> instr(
UniquePtr<txInstruction> instr(
static_cast<txInstruction*>(aState.popObject()));
aState.addInstruction(std::move(instr));
@ -1259,7 +1259,7 @@ static nsresult txFnStartCallTemplate(int32_t aNamespaceID, nsAtom* aLocalName,
txStylesheetCompilerState& aState) {
nsresult rv = NS_OK;
nsAutoPtr<txInstruction> instr(new txPushParams);
UniquePtr<txInstruction> instr(new txPushParams);
aState.addInstruction(std::move(instr));
txExpandedName name;
@ -1280,7 +1280,7 @@ static nsresult txFnEndCallTemplate(txStylesheetCompilerState& aState) {
aState.popHandlerTable();
// txCallTemplate
nsAutoPtr<txInstruction> instr(
UniquePtr<txInstruction> instr(
static_cast<txInstruction*>(aState.popObject()));
aState.addInstruction(std::move(instr));
@ -1340,14 +1340,14 @@ static nsresult txFnStartComment(int32_t aNamespaceID, nsAtom* aLocalName,
nsAtom* aPrefix, txStylesheetAttr* aAttributes,
int32_t aAttrCount,
txStylesheetCompilerState& aState) {
nsAutoPtr<txInstruction> instr(new txPushStringHandler(true));
UniquePtr<txInstruction> instr(new txPushStringHandler(true));
aState.addInstruction(std::move(instr));
return NS_OK;
}
static nsresult txFnEndComment(txStylesheetCompilerState& aState) {
nsAutoPtr<txInstruction> instr(new txComment);
UniquePtr<txInstruction> instr(new txComment);
aState.addInstruction(std::move(instr));
return NS_OK;
@ -1366,11 +1366,11 @@ static nsresult txFnStartCopy(int32_t aNamespaceID, nsAtom* aLocalName,
nsAtom* aPrefix, txStylesheetAttr* aAttributes,
int32_t aAttrCount,
txStylesheetCompilerState& aState) {
nsAutoPtr<txCopy> copy(new txCopy);
UniquePtr<txCopy> copy(new txCopy);
nsresult rv = aState.pushPtr(copy.get(), aState.eCopy);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(copy.forget());
UniquePtr<txInstruction> instr(copy.forget());
aState.addInstruction(std::move(instr));
rv = parseUseAttrSets(aAttributes, aAttrCount, false, aState);
@ -1380,7 +1380,7 @@ static nsresult txFnStartCopy(int32_t aNamespaceID, nsAtom* aLocalName,
}
static nsresult txFnEndCopy(txStylesheetCompilerState& aState) {
nsAutoPtr<txInstruction> instr(new txEndElement);
UniquePtr<txInstruction> instr(new txEndElement);
aState.addInstruction(std::move(instr));
txCopy* copy = static_cast<txCopy*>(aState.popPtr(aState.eCopy));
@ -1401,12 +1401,12 @@ static nsresult txFnStartCopyOf(int32_t aNamespaceID, nsAtom* aLocalName,
txStylesheetCompilerState& aState) {
nsresult rv = NS_OK;
nsAutoPtr<Expr> select;
UniquePtr<Expr> select;
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, true, aState,
select);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(new txCopyOf(std::move(select)));
UniquePtr<txInstruction> instr(new txCopyOf(std::move(select)));
aState.addInstruction(std::move(instr));
return aState.pushHandlerTable(gTxIgnoreHandler);
@ -1431,16 +1431,16 @@ static nsresult txFnStartElement(int32_t aNamespaceID, nsAtom* aLocalName,
txStylesheetCompilerState& aState) {
nsresult rv = NS_OK;
nsAutoPtr<Expr> name;
UniquePtr<Expr> name;
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::name, true, aState, name);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<Expr> nspace;
UniquePtr<Expr> nspace;
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::_namespace, false, aState,
nspace);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(new txStartElement(
UniquePtr<txInstruction> instr(new txStartElement(
std::move(name), std::move(nspace), aState.mElementContext->mMappings));
aState.addInstruction(std::move(instr));
@ -1451,7 +1451,7 @@ static nsresult txFnStartElement(int32_t aNamespaceID, nsAtom* aLocalName,
}
static nsresult txFnEndElement(txStylesheetCompilerState& aState) {
nsAutoPtr<txInstruction> instr(new txEndElement);
UniquePtr<txInstruction> instr(new txEndElement);
aState.addInstruction(std::move(instr));
return NS_OK;
@ -1495,12 +1495,12 @@ static nsresult txFnStartForEach(int32_t aNamespaceID, nsAtom* aLocalName,
txStylesheetCompilerState& aState) {
nsresult rv = NS_OK;
nsAutoPtr<Expr> select;
UniquePtr<Expr> select;
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, true, aState,
select);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txPushNewContext> pushcontext(
UniquePtr<txPushNewContext> pushcontext(
new txPushNewContext(std::move(select)));
rv = aState.pushPtr(pushcontext.get(), aState.ePushNewContext);
NS_ENSURE_SUCCESS(rv, rv);
@ -1508,7 +1508,7 @@ static nsresult txFnStartForEach(int32_t aNamespaceID, nsAtom* aLocalName,
rv = aState.pushSorter(pushcontext.get());
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(pushcontext.forget());
UniquePtr<txInstruction> instr(pushcontext.forget());
aState.addInstruction(std::move(instr));
instr = new txPushNullTemplateRule;
@ -1527,7 +1527,7 @@ static nsresult txFnEndForEach(txStylesheetCompilerState& aState) {
txInstruction* pnullrule =
static_cast<txInstruction*>(aState.popPtr(aState.ePushNullTemplateRule));
nsAutoPtr<txInstruction> instr(new txLoopNodeSet(pnullrule));
UniquePtr<txInstruction> instr(new txLoopNodeSet(pnullrule));
aState.addInstruction(std::move(instr));
aState.popSorter();
@ -1569,17 +1569,17 @@ static nsresult txFnStartIf(int32_t aNamespaceID, nsAtom* aLocalName,
txStylesheetCompilerState& aState) {
nsresult rv = NS_OK;
nsAutoPtr<Expr> test;
UniquePtr<Expr> test;
rv =
getExprAttr(aAttributes, aAttrCount, nsGkAtoms::test, true, aState, test);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txConditionalGoto> condGoto(
UniquePtr<txConditionalGoto> condGoto(
new txConditionalGoto(std::move(test), nullptr));
rv = aState.pushPtr(condGoto.get(), aState.eConditionalGoto);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(condGoto.forget());
UniquePtr<txInstruction> instr(condGoto.forget());
aState.addInstruction(std::move(instr));
return NS_OK;
@ -1602,7 +1602,7 @@ static nsresult txFnStartMessage(int32_t aNamespaceID, nsAtom* aLocalName,
nsAtom* aPrefix, txStylesheetAttr* aAttributes,
int32_t aAttrCount,
txStylesheetCompilerState& aState) {
nsAutoPtr<txInstruction> instr(new txPushStringHandler(false));
UniquePtr<txInstruction> instr(new txPushStringHandler(false));
aState.addInstruction(std::move(instr));
txThreeState term;
@ -1620,7 +1620,7 @@ static nsresult txFnStartMessage(int32_t aNamespaceID, nsAtom* aLocalName,
}
static nsresult txFnEndMessage(txStylesheetCompilerState& aState) {
nsAutoPtr<txInstruction> instr(
UniquePtr<txInstruction> instr(
static_cast<txInstruction*>(aState.popObject()));
aState.addInstruction(std::move(instr));
@ -1652,47 +1652,47 @@ static nsresult txFnStartNumber(int32_t aNamespaceID, nsAtom* aLocalName,
return NS_ERROR_XSLT_PARSE_FAILURE;
}
nsAutoPtr<txPattern> count;
UniquePtr<txPattern> count;
rv = getPatternAttr(aAttributes, aAttrCount, nsGkAtoms::count, false, aState,
count);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txPattern> from;
UniquePtr<txPattern> from;
rv = getPatternAttr(aAttributes, aAttrCount, nsGkAtoms::from, false, aState,
from);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<Expr> value;
UniquePtr<Expr> value;
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::value, false, aState,
value);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<Expr> format;
UniquePtr<Expr> format;
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::format, false, aState,
format);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<Expr> lang;
UniquePtr<Expr> lang;
rv =
getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::lang, false, aState, lang);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<Expr> letterValue;
UniquePtr<Expr> letterValue;
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::letterValue, false,
aState, letterValue);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<Expr> groupingSeparator;
UniquePtr<Expr> groupingSeparator;
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::groupingSeparator, false,
aState, groupingSeparator);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<Expr> groupingSize;
UniquePtr<Expr> groupingSize;
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::groupingSize, false,
aState, groupingSize);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(
UniquePtr<txInstruction> instr(
new txNumber(level, std::move(count), std::move(from), std::move(value),
std::move(format), std::move(groupingSeparator),
std::move(groupingSize)));
@ -1747,21 +1747,21 @@ static nsresult txFnStartParam(int32_t aNamespaceID, nsAtom* aLocalName,
name);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txCheckParam> checkParam(new txCheckParam(name));
UniquePtr<txCheckParam> checkParam(new txCheckParam(name));
NS_ENSURE_SUCCESS(rv, rv);
rv = aState.pushPtr(checkParam.get(), aState.eCheckParam);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(checkParam.forget());
UniquePtr<txInstruction> instr(checkParam.forget());
aState.addInstruction(std::move(instr));
nsAutoPtr<Expr> select;
UniquePtr<Expr> select;
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, false, aState,
select);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txSetVariable> var(new txSetVariable(name, std::move(select)));
UniquePtr<txSetVariable> var(new txSetVariable(name, std::move(select)));
if (var->mValue) {
// XXX should be gTxErrorHandler?
rv = aState.pushHandlerTable(gTxIgnoreHandler);
@ -1780,7 +1780,7 @@ static nsresult txFnStartParam(int32_t aNamespaceID, nsAtom* aLocalName,
}
static nsresult txFnEndParam(txStylesheetCompilerState& aState) {
nsAutoPtr<txSetVariable> var(static_cast<txSetVariable*>(aState.popObject()));
UniquePtr<txSetVariable> var(static_cast<txSetVariable*>(aState.popObject()));
txHandlerTable* prev = aState.mHandlerTable;
aState.popHandlerTable();
@ -1793,7 +1793,7 @@ static nsresult txFnEndParam(txStylesheetCompilerState& aState) {
nsresult rv = aState.addVariable(var->mName);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(var.forget());
UniquePtr<txInstruction> instr(var.forget());
aState.addInstruction(std::move(instr));
txCheckParam* checkParam =
@ -1814,10 +1814,10 @@ static nsresult txFnStartPI(int32_t aNamespaceID, nsAtom* aLocalName,
nsAtom* aPrefix, txStylesheetAttr* aAttributes,
int32_t aAttrCount,
txStylesheetCompilerState& aState) {
nsAutoPtr<txInstruction> instr(new txPushStringHandler(true));
UniquePtr<txInstruction> instr(new txPushStringHandler(true));
aState.addInstruction(std::move(instr));
nsAutoPtr<Expr> name;
UniquePtr<Expr> name;
nsresult rv =
getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::name, true, aState, name);
NS_ENSURE_SUCCESS(rv, rv);
@ -1832,7 +1832,7 @@ static nsresult txFnStartPI(int32_t aNamespaceID, nsAtom* aLocalName,
}
static nsresult txFnEndPI(txStylesheetCompilerState& aState) {
nsAutoPtr<txInstruction> instr(
UniquePtr<txInstruction> instr(
static_cast<txInstruction*>(aState.popObject()));
aState.addInstruction(std::move(instr));
@ -1850,32 +1850,32 @@ static nsresult txFnStartSort(int32_t aNamespaceID, nsAtom* aLocalName,
txStylesheetCompilerState& aState) {
nsresult rv = NS_OK;
nsAutoPtr<Expr> select;
UniquePtr<Expr> select;
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, false, aState,
select);
NS_ENSURE_SUCCESS(rv, rv);
if (!select) {
nsAutoPtr<txNodeTest> nt(new txNodeTypeTest(txNodeTypeTest::NODE_TYPE));
UniquePtr<txNodeTest> nt(new txNodeTypeTest(txNodeTypeTest::NODE_TYPE));
select = new LocationStep(nt.forget(), LocationStep::SELF_AXIS);
}
nsAutoPtr<Expr> lang;
UniquePtr<Expr> lang;
rv =
getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::lang, false, aState, lang);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<Expr> dataType;
UniquePtr<Expr> dataType;
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::dataType, false, aState,
dataType);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<Expr> order;
UniquePtr<Expr> order;
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::order, false, aState,
order);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<Expr> caseOrder;
UniquePtr<Expr> caseOrder;
rv = getAVTAttr(aAttributes, aAttrCount, nsGkAtoms::caseOrder, false, aState,
caseOrder);
NS_ENSURE_SUCCESS(rv, rv);
@ -1924,7 +1924,7 @@ static nsresult txFnEndText(txStylesheetCompilerState& aState) {
static nsresult txFnTextText(const nsAString& aStr,
txStylesheetCompilerState& aState) {
nsAutoPtr<txInstruction> instr(new txText(aStr, aState.mDOE));
UniquePtr<txInstruction> instr(new txText(aStr, aState.mDOE));
aState.addInstruction(std::move(instr));
return NS_OK;
@ -1946,12 +1946,12 @@ static nsresult txFnStartValueOf(int32_t aNamespaceID, nsAtom* aLocalName,
false, aState, doe);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<Expr> select;
UniquePtr<Expr> select;
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, true, aState,
select);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(
UniquePtr<txInstruction> instr(
new txValueOf(std::move(select), doe == eTrue));
aState.addInstruction(std::move(instr));
@ -1982,12 +1982,12 @@ static nsresult txFnStartVariable(int32_t aNamespaceID, nsAtom* aLocalName,
name);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<Expr> select;
UniquePtr<Expr> select;
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, false, aState,
select);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txSetVariable> var(new txSetVariable(name, std::move(select)));
UniquePtr<txSetVariable> var(new txSetVariable(name, std::move(select)));
if (var->mValue) {
// XXX should be gTxErrorHandler?
rv = aState.pushHandlerTable(gTxIgnoreHandler);
@ -2006,7 +2006,7 @@ static nsresult txFnStartVariable(int32_t aNamespaceID, nsAtom* aLocalName,
}
static nsresult txFnEndVariable(txStylesheetCompilerState& aState) {
nsAutoPtr<txSetVariable> var(static_cast<txSetVariable*>(aState.popObject()));
UniquePtr<txSetVariable> var(static_cast<txSetVariable*>(aState.popObject()));
txHandlerTable* prev = aState.mHandlerTable;
aState.popHandlerTable();
@ -2020,7 +2020,7 @@ static nsresult txFnEndVariable(txStylesheetCompilerState& aState) {
nsresult rv = aState.addVariable(var->mName);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(var.forget());
UniquePtr<txInstruction> instr(var.forget());
aState.addInstruction(std::move(instr));
return NS_OK;
@ -2031,7 +2031,7 @@ static nsresult txFnStartElementStartRTF(int32_t aNamespaceID,
txStylesheetAttr* aAttributes,
int32_t aAttrCount,
txStylesheetCompilerState& aState) {
nsAutoPtr<txInstruction> instr(new txPushRTFHandler);
UniquePtr<txInstruction> instr(new txPushRTFHandler);
aState.addInstruction(std::move(instr));
aState.mHandlerTable = gTxTemplateHandler;
@ -2043,7 +2043,7 @@ static nsresult txFnTextStartRTF(const nsAString& aStr,
txStylesheetCompilerState& aState) {
TX_RETURN_IF_WHITESPACE(aStr, aState);
nsAutoPtr<txInstruction> instr(new txPushRTFHandler);
UniquePtr<txInstruction> instr(new txPushRTFHandler);
aState.addInstruction(std::move(instr));
aState.mHandlerTable = gTxTemplateHandler;
@ -2062,17 +2062,17 @@ static nsresult txFnStartWhen(int32_t aNamespaceID, nsAtom* aLocalName,
txStylesheetCompilerState& aState) {
nsresult rv = NS_OK;
nsAutoPtr<Expr> test;
UniquePtr<Expr> test;
rv =
getExprAttr(aAttributes, aAttrCount, nsGkAtoms::test, true, aState, test);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txConditionalGoto> condGoto(
UniquePtr<txConditionalGoto> condGoto(
new txConditionalGoto(std::move(test), nullptr));
rv = aState.pushPtr(condGoto.get(), aState.eConditionalGoto);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txInstruction> instr(condGoto.forget());
UniquePtr<txInstruction> instr(condGoto.forget());
aState.addInstruction(std::move(instr));
return aState.pushHandlerTable(gTxTemplateHandler);
@ -2080,10 +2080,10 @@ static nsresult txFnStartWhen(int32_t aNamespaceID, nsAtom* aLocalName,
static nsresult txFnEndWhen(txStylesheetCompilerState& aState) {
aState.popHandlerTable();
nsAutoPtr<txGoTo> gotoinstr(new txGoTo(nullptr));
UniquePtr<txGoTo> gotoinstr(new txGoTo(nullptr));
aState.mChooseGotoList->add(gotoinstr.get());
nsAutoPtr<txInstruction> instr(gotoinstr.forget());
UniquePtr<txInstruction> instr(gotoinstr.forget());
aState.addInstruction(std::move(instr));
txConditionalGoto* condGoto =
@ -2113,12 +2113,12 @@ static nsresult txFnStartWithParam(int32_t aNamespaceID, nsAtom* aLocalName,
name);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<Expr> select;
UniquePtr<Expr> select;
rv = getExprAttr(aAttributes, aAttrCount, nsGkAtoms::select, false, aState,
select);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<txSetParam> var(new txSetParam(name, std::move(select)));
UniquePtr<txSetParam> var(new txSetParam(name, std::move(select)));
if (var->mValue) {
// XXX should be gTxErrorHandler?
rv = aState.pushHandlerTable(gTxIgnoreHandler);
@ -2137,7 +2137,7 @@ static nsresult txFnStartWithParam(int32_t aNamespaceID, nsAtom* aLocalName,
}
static nsresult txFnEndWithParam(txStylesheetCompilerState& aState) {
nsAutoPtr<txSetParam> var(static_cast<txSetParam*>(aState.popObject()));
UniquePtr<txSetParam> var(static_cast<txSetParam*>(aState.popObject()));
txHandlerTable* prev = aState.mHandlerTable;
aState.popHandlerTable();
@ -2147,7 +2147,7 @@ static nsresult txFnEndWithParam(txStylesheetCompilerState& aState) {
var->mValue = new txLiteralExpr(EmptyString());
}
nsAutoPtr<txInstruction> instr(var.forget());
UniquePtr<txInstruction> instr(var.forget());
aState.addInstruction(std::move(instr));
return NS_OK;
@ -2181,7 +2181,7 @@ static nsresult txFnEndUnknownInstruction(txStylesheetCompilerState& aState) {
aState.popHandlerTable();
if (aState.mSearchingForFallback) {
nsAutoPtr<txInstruction> instr(new txErrorInstruction());
UniquePtr<txInstruction> instr(new txErrorInstruction());
aState.addInstruction(std::move(instr));
}

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

@ -295,7 +295,7 @@ nsresult txStylesheetCompiler::endElement() {
for (i = mInScopeVariables.Length() - 1; i >= 0; --i) {
txInScopeVariable* var = mInScopeVariables[i];
if (!--(var->mLevel)) {
nsAutoPtr<txInstruction> instr(new txRemoveVariable(var->mName));
UniquePtr<txInstruction> instr(new txRemoveVariable(var->mName));
addInstruction(std::move(instr));
mInScopeVariables.RemoveElementAt(i);
@ -417,7 +417,7 @@ nsresult txStylesheetCompiler::ensureNewElementContext() {
return NS_OK;
}
nsAutoPtr<txElementContext> context(new txElementContext(*mElementContext));
UniquePtr<txElementContext> context(new txElementContext(*mElementContext));
nsresult rv = pushObject(mElementContext.get());
NS_ENSURE_SUCCESS(rv, rv);
@ -629,7 +629,7 @@ void txStylesheetCompilerState::closeInstructionContainer() {
}
void txStylesheetCompilerState::addInstruction(
nsAutoPtr<txInstruction>&& aInstruction) {
UniquePtr<txInstruction>&& aInstruction) {
MOZ_ASSERT(mNextInstrPtr, "adding instruction outside container");
txInstruction* newInstr = aInstruction.get();
@ -654,7 +654,7 @@ nsresult txStylesheetCompilerState::loadIncludedStylesheet(
}
NS_ENSURE_TRUE(mObserver, NS_ERROR_NOT_IMPLEMENTED);
nsAutoPtr<txToplevelItem> item(new txDummyItem);
UniquePtr<txToplevelItem> item(new txDummyItem);
NS_ENSURE_TRUE(item, NS_ERROR_OUT_OF_MEMORY);
mToplevelIterator.addBefore(item.forget());
@ -837,7 +837,7 @@ extern bool TX_XSLTFunctionAvailable(nsAtom* aName, int32_t aNameSpaceID) {
new txStylesheetCompiler(EmptyString(), ReferrerPolicy::_empty, nullptr);
NS_ENSURE_TRUE(compiler, false);
nsAutoPtr<FunctionCall> fnCall;
UniquePtr<FunctionCall> fnCall;
return NS_SUCCEEDED(
findFunction(aName, aNameSpaceID, compiler, getter_Transfers(fnCall)));

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

@ -102,7 +102,7 @@ class txStylesheetCompilerState : public txIParseContext {
void addToplevelItem(txToplevelItem* aItem);
nsresult openInstructionContainer(txInstructionContainer* aContainer);
void closeInstructionContainer();
void addInstruction(nsAutoPtr<txInstruction>&& aInstruction);
void addInstruction(mozilla::UniquePtr<txInstruction>&& aInstruction);
nsresult loadIncludedStylesheet(const nsAString& aURI);
nsresult loadImportedStylesheet(const nsAString& aURI,
txStylesheet::ImportFrame* aFrame);
@ -134,9 +134,9 @@ class txStylesheetCompilerState : public txIParseContext {
RefPtr<txStylesheet> mStylesheet;
txHandlerTable* mHandlerTable;
nsAutoPtr<txElementContext> mElementContext;
mozilla::UniquePtr<txElementContext> mElementContext;
txPushNewContext* mSorter;
nsAutoPtr<txList> mChooseGotoList;
mozilla::UniquePtr<txList> mChooseGotoList;
bool mDOE;
bool mSearchingForFallback;
uint16_t mDisAllowed;

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

@ -35,7 +35,7 @@ nsresult txStripSpaceItem::addStripSpaceTest(
TX_IMPL_GETTYPE(txTemplateItem, txToplevelItem::templ)
txTemplateItem::txTemplateItem(nsAutoPtr<txPattern>&& aMatch,
txTemplateItem::txTemplateItem(UniquePtr<txPattern>&& aMatch,
const txExpandedName& aName,
const txExpandedName& aMode, double aPrio)
: mMatch(std::move(aMatch)), mName(aName), mMode(aMode), mPrio(aPrio) {}
@ -43,5 +43,5 @@ txTemplateItem::txTemplateItem(nsAutoPtr<txPattern>&& aMatch,
TX_IMPL_GETTYPE(txVariableItem, txToplevelItem::variable)
txVariableItem::txVariableItem(const txExpandedName& aName,
nsAutoPtr<Expr>&& aValue, bool aIsParam)
UniquePtr<Expr>&& aValue, bool aIsParam)
: mName(aName), mValue(std::move(aValue)), mIsParam(aIsParam) {}

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

@ -40,7 +40,7 @@ class txToplevelItem {
class txInstructionContainer : public txToplevelItem {
public:
nsAutoPtr<txInstruction> mFirstInstruction;
mozilla::UniquePtr<txInstruction> mFirstInstruction;
};
// xsl:attribute-set
@ -58,7 +58,7 @@ class txImportItem : public txToplevelItem {
public:
TX_DECL_TOPLEVELITEM
nsAutoPtr<txStylesheet::ImportFrame> mFrame;
mozilla::UniquePtr<txStylesheet::ImportFrame> mFrame;
};
// xsl:output
@ -90,12 +90,13 @@ class txStripSpaceItem : public txToplevelItem {
// xsl:template
class txTemplateItem : public txInstructionContainer {
public:
txTemplateItem(nsAutoPtr<txPattern>&& aMatch, const txExpandedName& aName,
const txExpandedName& aMode, double aPrio);
txTemplateItem(mozilla::UniquePtr<txPattern>&& aMatch,
const txExpandedName& aName, const txExpandedName& aMode,
double aPrio);
TX_DECL_TOPLEVELITEM
nsAutoPtr<txPattern> mMatch;
mozilla::UniquePtr<txPattern> mMatch;
txExpandedName mName;
txExpandedName mMode;
double mPrio;
@ -104,13 +105,13 @@ class txTemplateItem : public txInstructionContainer {
// xsl:variable at top level
class txVariableItem : public txInstructionContainer {
public:
txVariableItem(const txExpandedName& aName, nsAutoPtr<Expr>&& aValue,
txVariableItem(const txExpandedName& aName, mozilla::UniquePtr<Expr>&& aValue,
bool aIsParam);
TX_DECL_TOPLEVELITEM
txExpandedName mName;
nsAutoPtr<Expr> mValue;
mozilla::UniquePtr<Expr> mValue;
bool mIsParam;
};

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

@ -152,7 +152,7 @@ nsresult txUnknownHandler::createHandlerAndFlush(bool aHTMLRoot,
format.mMethod = aHTMLRoot ? eHTMLOutput : eXMLOutput;
}
nsAutoPtr<txAXMLEventHandler> handler;
UniquePtr<txAXMLEventHandler> handler;
nsresult rv = mEs->mOutputHandlerFactory->createHandlerWith(
&format, aName, aNsID, getter_Transfers(handler));
NS_ENSURE_SUCCESS(rv, rv);
@ -169,6 +169,6 @@ nsresult txUnknownHandler::createHandlerAndFlush(bool aHTMLRoot,
// Let go of out buffer as soon as we're done flushing it, we're not going
// to need it anymore from this point on (all hooks get forwarded to
// mEs->mResultHandler.
nsAutoPtr<txResultBuffer> buffer(std::move(mBuffer));
UniquePtr<txResultBuffer> buffer(std::move(mBuffer));
return buffer->flushToHandler(mEs->mResultHandler);
}

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

@ -48,7 +48,7 @@ nsresult txResultStringComparator::init(const nsString& aLanguage) {
nsresult txResultStringComparator::createSortableValue(Expr* aExpr,
txIEvalContext* aContext,
txObject*& aResult) {
nsAutoPtr<StringValue> val(new StringValue);
UniquePtr<StringValue> val(new StringValue);
if (!val) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -147,7 +147,7 @@ txResultNumberComparator::txResultNumberComparator(bool aAscending) {
nsresult txResultNumberComparator::createSortableValue(Expr* aExpr,
txIEvalContext* aContext,
txObject*& aResult) {
nsAutoPtr<NumberValue> numval(new NumberValue);
UniquePtr<NumberValue> numval(new NumberValue);
if (!numval) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -103,7 +103,7 @@ nsresult txXSLTNumber::getValueList(Expr* aValueExpr, txPattern* aCountPattern,
// Otherwise use count/from/level
txPattern* countPattern = aCountPattern;
nsAutoPtr<txPattern> newCountPattern;
UniquePtr<txPattern> newCountPattern;
const txXPathNode& currNode = aContext->getContextNode();
// Parse count- and from-attributes

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

@ -330,7 +330,7 @@ void txIdPattern::toString(nsAString& aDest) {
nsresult txKeyPattern::matches(const txXPathNode& aNode,
txIMatchContext* aContext, bool& aMatched) {
txExecutionState* es = (txExecutionState*)aContext->getPrivateContext();
nsAutoPtr<txXPathNode> contextDoc(txXPathNodeUtils::getOwnerDocument(aNode));
UniquePtr<txXPathNode> contextDoc(txXPathNodeUtils::getOwnerDocument(aNode));
NS_ENSURE_TRUE(contextDoc, NS_ERROR_FAILURE);
RefPtr<txNodeSet> nodes;

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

@ -125,7 +125,7 @@ class txLocPathPattern : public txPattern {
private:
class Step {
public:
nsAutoPtr<txPattern> pattern;
mozilla::UniquePtr<txPattern> pattern;
bool isChild;
};
@ -196,7 +196,7 @@ class txStepPattern : public txPattern, public PredicateList {
}
private:
nsAutoPtr<txNodeTest> mNodeTest;
mozilla::UniquePtr<txNodeTest> mNodeTest;
bool mIsAttr;
};