Skip to content

Commit 478e1ad

Browse files
author
Hima Bindu Meda
committed
8370632: Additional libxslt 1.1.43 fixes
Reviewed-by: kcr, jbhaskar
1 parent a4e4142 commit 478e1ad

File tree

3 files changed

+201
-132
lines changed

3 files changed

+201
-132
lines changed

modules/javafx.web/src/main/native/Source/ThirdParty/libxslt/src/libxslt/transform.c

Lines changed: 45 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -518,19 +518,20 @@ xsltTransformCacheFree(xsltTransformCachePtr cache)
518518
/*
519519
* Free tree fragments.
520520
*/
521-
if (cache->RVT) {
522-
xmlDocPtr tmp, cur = cache->RVT;
521+
if (cache->rvtList) {
522+
xsltRVTListPtr tmp, cur = cache->rvtList;
523523
while (cur) {
524524
tmp = cur;
525-
cur = (xmlDocPtr) cur->next;
526-
if (tmp->_private != NULL) {
525+
cur = cur->next;
526+
if (tmp->RVT->_private != NULL) {
527527
/*
528-
* Tree the document info.
528+
* Free the document info.
529529
*/
530-
xsltFreeDocumentKeys((xsltDocumentPtr) tmp->_private);
531-
xmlFree(tmp->_private);
530+
xsltFreeDocumentKeys((xsltDocumentPtr) tmp->RVT->_private);
531+
xmlFree(tmp->RVT->_private);
532532
}
533-
xmlFreeDoc(tmp);
533+
xmlFreeDoc(tmp->RVT);
534+
xmlFree(tmp);
534535
}
535536
}
536537
/*
@@ -2263,38 +2264,36 @@ xsltLocalVariablePush(xsltTransformContextPtr ctxt,
22632264
* are preserved; all other fragments are freed/cached.
22642265
*/
22652266
static void
2266-
xsltReleaseLocalRVTs(xsltTransformContextPtr ctxt, xmlDocPtr base)
2267+
xsltReleaseLocalRVTs(xsltTransformContextPtr ctxt, xsltRVTListPtr base)
22672268
{
2268-
xmlDocPtr cur = ctxt->localRVT, tmp;
2269+
xsltRVTListPtr cur = ctxt->localRVTList, tmp;
22692270

22702271
if (cur == base)
22712272
return;
2272-
if (cur->prev != NULL)
2273-
xsltTransformError(ctxt, NULL, NULL, "localRVT not head of list\n");
22742273

2275-
/* Reset localRVT early because some RVTs might be registered again. */
2276-
ctxt->localRVT = base;
2277-
if (base != NULL)
2278-
base->prev = NULL;
2274+
/* Reset localRVTList early because some RVTs might be registered again. */
2275+
ctxt->localRVTList = base;
22792276

22802277
do {
22812278
tmp = cur;
2282-
cur = (xmlDocPtr) cur->next;
2283-
if (tmp->compression == XSLT_RVT_LOCAL) {
2284-
xsltReleaseRVT(ctxt, tmp);
2285-
} else if (tmp->compression == XSLT_RVT_GLOBAL) {
2286-
xsltRegisterPersistRVT(ctxt, tmp);
2287-
} else if (tmp->compression == XSLT_RVT_FUNC_RESULT) {
2279+
cur = cur->next;
2280+
if (tmp->RVT->compression == XSLT_RVT_LOCAL) {
2281+
xsltReleaseRVTList(ctxt, tmp);
2282+
} else if (tmp->RVT->compression == XSLT_RVT_GLOBAL) {
2283+
xsltRegisterPersistRVT(ctxt, tmp->RVT);
2284+
xmlFree(tmp);
2285+
} else if (tmp->RVT->compression == XSLT_RVT_FUNC_RESULT) {
22882286
/*
22892287
* This will either register the RVT again or move it to the
22902288
* context variable.
22912289
*/
2292-
xsltRegisterLocalRVT(ctxt, tmp);
2293-
tmp->compression = XSLT_RVT_FUNC_RESULT;
2290+
xsltRegisterLocalRVT(ctxt, tmp->RVT);
2291+
tmp->RVT->compression = XSLT_RVT_FUNC_RESULT;
2292+
xmlFree(tmp);
22942293
} else {
22952294
xmlGenericError(xmlGenericErrorContext,
2296-
"xsltReleaseLocalRVTs: Unexpected RVT flag %p\n",
2297-
tmp->psvi);
2295+
"xsltReleaseLocalRVTs: Unexpected RVT flag %d\n",
2296+
tmp->RVT->compression);
22982297
}
22992298
} while (cur != base);
23002299
}
@@ -2322,7 +2321,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt,
23222321
xmlNodePtr oldInsert, oldInst, oldCurInst, oldContextNode;
23232322
xmlNodePtr cur, insert, copy = NULL;
23242323
int level = 0, oldVarsNr;
2325-
xmlDocPtr oldLocalFragmentTop;
2324+
xsltRVTListPtr oldLocalFragmentTop;
23262325

23272326
#ifdef XSLT_REFACTORED
23282327
xsltStylePreCompPtr info;
@@ -2368,7 +2367,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt,
23682367
}
23692368
ctxt->depth++;
23702369

2371-
oldLocalFragmentTop = ctxt->localRVT;
2370+
oldLocalFragmentTop = ctxt->localRVTList;
23722371
oldInsert = insert = ctxt->insert;
23732372
oldInst = oldCurInst = ctxt->inst;
23742373
oldContextNode = ctxt->node;
@@ -2602,8 +2601,8 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt,
26022601
/*
26032602
* Cleanup temporary tree fragments.
26042603
*/
2605-
if (oldLocalFragmentTop != ctxt->localRVT)
2606-
xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop);
2604+
if (oldLocalFragmentTop != ctxt->localRVTList)
2605+
xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop);
26072606

26082607
ctxt->insert = oldInsert;
26092608
} else if (info->type == XSLT_FUNC_VARIABLE) {
@@ -2697,8 +2696,8 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt,
26972696
/*
26982697
* Cleanup temporary tree fragments.
26992698
*/
2700-
if (oldLocalFragmentTop != ctxt->localRVT)
2701-
xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop);
2699+
if (oldLocalFragmentTop != ctxt->localRVTList)
2700+
xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop);
27022701

27032702
ctxt->insert = oldInsert;
27042703
}
@@ -2763,7 +2762,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt,
27632762
/*
27642763
* Cleanup temporary tree fragments.
27652764
*/
2766-
if (oldLocalFragmentTop != ctxt->localRVT)
2765+
if (oldLocalFragmentTop != ctxt->localRVTList)
27672766
xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop);
27682767

27692768
ctxt->insert = oldInsert;
@@ -2893,7 +2892,7 @@ xsltApplySequenceConstructor(xsltTransformContextPtr ctxt,
28932892
/*
28942893
* Cleanup temporary tree fragments.
28952894
*/
2896-
if (oldLocalFragmentTop != ctxt->localRVT)
2895+
if (oldLocalFragmentTop != ctxt->localRVTList)
28972896
xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop);
28982897

28992898
ctxt->insert = oldInsert;
@@ -3072,7 +3071,7 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt,
30723071
int oldVarsBase = 0;
30733072
xmlNodePtr cur;
30743073
xsltStackElemPtr tmpParam = NULL;
3075-
xmlDocPtr oldUserFragmentTop;
3074+
xsltRVTListPtr oldUserFragmentTop;
30763075
#ifdef WITH_PROFILER
30773076
long start = 0;
30783077
#endif
@@ -3120,8 +3119,8 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt,
31203119
return;
31213120
}
31223121

3123-
oldUserFragmentTop = ctxt->tmpRVT;
3124-
ctxt->tmpRVT = NULL;
3122+
oldUserFragmentTop = ctxt->tmpRVTList;
3123+
ctxt->tmpRVTList = NULL;
31253124

31263125
/*
31273126
* Initiate a distinct scope of local params/variables.
@@ -3232,16 +3231,16 @@ xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt,
32323231
* user code should now use xsltRegisterLocalRVT() instead
32333232
* of the obsolete xsltRegisterTmpRVT().
32343233
*/
3235-
if (ctxt->tmpRVT) {
3236-
xmlDocPtr curdoc = ctxt->tmpRVT, tmp;
3234+
if (ctxt->tmpRVTList) {
3235+
xsltRVTListPtr curRVTList = ctxt->tmpRVTList, tmp;
32373236

3238-
while (curdoc != NULL) {
3239-
tmp = curdoc;
3240-
curdoc = (xmlDocPtr) curdoc->next;
3241-
xsltReleaseRVT(ctxt, tmp);
3237+
while (curRVTList != NULL) {
3238+
tmp = curRVTList;
3239+
curRVTList = curRVTList->next;
3240+
xsltReleaseRVTList(ctxt, tmp);
32423241
}
32433242
}
3244-
ctxt->tmpRVT = oldUserFragmentTop;
3243+
ctxt->tmpRVTList = oldUserFragmentTop;
32453244

32463245
/*
32473246
* Pop the xsl:template declaration from the stack.
@@ -5319,15 +5318,15 @@ xsltIf(xsltTransformContextPtr ctxt, xmlNodePtr contextNode,
53195318

53205319
#ifdef XSLT_FAST_IF
53215320
{
5322-
xmlDocPtr oldLocalFragmentTop = ctxt->localRVT;
5321+
xsltRVTListPtr oldLocalFragmentTop = ctxt->localRVTList;
53235322

53245323
res = xsltPreCompEvalToBoolean(ctxt, contextNode, comp);
53255324

53265325
/*
53275326
* Cleanup fragments created during evaluation of the
53285327
* "select" expression.
53295328
*/
5330-
if (oldLocalFragmentTop != ctxt->localRVT)
5329+
if (oldLocalFragmentTop != ctxt->localRVTList)
53315330
xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop);
53325331
}
53335332

0 commit comments

Comments
 (0)