You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by db...@apache.org on 2005/06/03 23:49:24 UTC
svn commit: r179897 - in /xerces/c/trunk/src/xercesc/internal:
DGXMLScanner.cpp IGXMLScanner.cpp
Author: dbertoni
Date: Fri Jun 3 14:49:23 2005
New Revision: 179897
URL: http://svn.apache.org/viewcvs?rev=179897&view=rev
Log:
Fixes for Jira issue XERCESC-1348.
Modified:
xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp
xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp
Modified: xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp?rev=179897&r1=179896&r2=179897&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp Fri Jun 3 14:49:23 2005
@@ -809,12 +809,15 @@
//
// Only do this if we are not reusing the validator! If we are reusing,
// then look it up instead. It has to exist!
- DTDElementDecl* rootDecl = new (fGrammarPoolMemoryManager) DTDElementDecl
+ MemoryManager* const rootDeclMgr =
+ fUseCachedGrammar ? fMemoryManager : fGrammarPoolMemoryManager;
+
+ DTDElementDecl* rootDecl = new (rootDeclMgr) DTDElementDecl
(
bbRootName.getRawBuffer()
, fEmptyNamespaceId
, DTDElementDecl::Any
- , fGrammarPoolMemoryManager
+ , rootDeclMgr
);
Janitor<DTDElementDecl> rootDeclJanitor(rootDecl);
@@ -1001,27 +1004,6 @@
fDocTypeHandler->startExtSubset();
fDocTypeHandler->endExtSubset();
}
- // we *cannot* identify the root element on
- // cached grammars; else we risk breaking multithreaded
- // applications. - NG
- /*******
- rootDecl = (DTDElementDecl*) fGrammar->getElemDecl(fEmptyNamespaceId, 0, bbRootName.getRawBuffer(), Grammar::TOP_LEVEL_SCOPE);
-
- if (rootDecl)
- ((DTDGrammar*)fGrammar)->setRootElemId(rootDecl->getId());
- else {
- rootDecl = new (fGrammarPoolMemoryManager) DTDElementDecl
- (
- bbRootName.getRawBuffer()
- , fEmptyNamespaceId
- , DTDElementDecl::Any
- , fGrammarPoolMemoryManager
- );
- rootDecl->setCreateReason(DTDElementDecl::AsRootElem);
- rootDecl->setExternalElemDeclaration(true);
- ((DTDGrammar*)fGrammar)->setRootElemId(fGrammar->putElemDecl(rootDecl));
- }
- *********/
return;
}
@@ -1078,7 +1060,7 @@
// with an external entity. Put a janitor on it to insure it gets
// cleaned up. The reader manager does not adopt them.
const XMLCh gDTDStr[] = { chLatin_D, chLatin_T, chLatin_D , chNull };
- DTDEntityDecl* declDTD = new (fGrammarPoolMemoryManager) DTDEntityDecl(gDTDStr, false, fGrammarPoolMemoryManager);
+ DTDEntityDecl* declDTD = new (fMemoryManager) DTDEntityDecl(gDTDStr, false, fMemoryManager);
declDTD->setSystemId(sysId);
Janitor<DTDEntityDecl> janDecl(declDTD);
@@ -1850,7 +1832,7 @@
// with an external entity. Put a janitor on it to insure it gets
// cleaned up. The reader manager does not adopt them.
const XMLCh gDTDStr[] = { chLatin_D, chLatin_T, chLatin_D , chNull };
- DTDEntityDecl* declDTD = new (fGrammarPoolMemoryManager) DTDEntityDecl(gDTDStr, false, fGrammarPoolMemoryManager);
+ DTDEntityDecl* declDTD = new (fMemoryManager) DTDEntityDecl(gDTDStr, false, fMemoryManager);
declDTD->setSystemId(src.getSystemId());
Janitor<DTDEntityDecl> janDecl(declDTD);
Modified: xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp
URL: http://svn.apache.org/viewcvs/xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp?rev=179897&r1=179896&r2=179897&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp Fri Jun 3 14:49:23 2005
@@ -1273,12 +1273,15 @@
//
// Only do this if we are not reusing the validator! If we are reusing,
// then look it up instead. It has to exist!
- DTDElementDecl* rootDecl = new (fGrammarPoolMemoryManager) DTDElementDecl
+ MemoryManager* const rootDeclMgr =
+ fUseCachedGrammar ? fMemoryManager : fGrammarPoolMemoryManager;
+
+ DTDElementDecl* rootDecl = new (rootDeclMgr) DTDElementDecl
(
bbRootName.getRawBuffer()
, fEmptyNamespaceId
, DTDElementDecl::Any
- , fGrammarPoolMemoryManager
+ , rootDeclMgr
);
Janitor<DTDElementDecl> rootDeclJanitor(rootDecl);
@@ -1465,25 +1468,6 @@
fDocTypeHandler->startExtSubset();
fDocTypeHandler->endExtSubset();
}
- // should not be modifying cached grammars!
- /********
- rootDecl = (DTDElementDecl*) fGrammar->getElemDecl(fEmptyNamespaceId, 0, bbRootName.getRawBuffer(), Grammar::TOP_LEVEL_SCOPE);
-
- if (rootDecl)
- ((DTDGrammar*)fGrammar)->setRootElemId(rootDecl->getId());
- else {
- rootDecl = new (fGrammarPoolMemoryManager) DTDElementDecl
- (
- bbRootName.getRawBuffer()
- , fEmptyNamespaceId
- , DTDElementDecl::Any
- , fGrammarPoolMemoryManager
- );
- rootDecl->setCreateReason(DTDElementDecl::AsRootElem);
- rootDecl->setExternalElemDeclaration(true);
- ((DTDGrammar*)fGrammar)->setRootElemId(fGrammar->putElemDecl(rootDecl));
- }
- ********/
return;
}
@@ -1540,7 +1524,7 @@
// with an external entity. Put a janitor on it to insure it gets
// cleaned up. The reader manager does not adopt them.
const XMLCh gDTDStr[] = { chLatin_D, chLatin_T, chLatin_D , chNull };
- DTDEntityDecl* declDTD = new (fGrammarPoolMemoryManager) DTDEntityDecl(gDTDStr, false, fGrammarPoolMemoryManager);
+ DTDEntityDecl* declDTD = new (fMemoryManager) DTDEntityDecl(gDTDStr, false, fMemoryManager);
declDTD->setSystemId(sysId);
Janitor<DTDEntityDecl> janDecl(declDTD);
@@ -3141,7 +3125,7 @@
// with an external entity. Put a janitor on it to insure it gets
// cleaned up. The reader manager does not adopt them.
const XMLCh gDTDStr[] = { chLatin_D, chLatin_T, chLatin_D , chNull };
- DTDEntityDecl* declDTD = new (fGrammarPoolMemoryManager) DTDEntityDecl(gDTDStr, false, fGrammarPoolMemoryManager);
+ DTDEntityDecl* declDTD = new (fMemoryManager) DTDEntityDecl(gDTDStr, false, fMemoryManager);
declDTD->setSystemId(src.getSystemId());
Janitor<DTDEntityDecl> janDecl(declDTD);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org