dbertoni 2005/04/22 13:52:41
Modified: c/Projects/Win32/VC6/AllInOne AllInOne.dsp
AllInOneWithICU.dsp
c/Projects/Win32/VC7/AllInOne AllInOne.vcproj
AllInOneWithICU.vcproj
c/Projects/Win32/VC7.1/AllInOne AllInOne.vcproj
AllInOneWithICU.vcproj
c/Tests/Conf conf.cpp
c/src/xalanc/Harness XalanFileUtility.cpp
XalanFileUtility.hpp
c/src/xalanc/PlatformSupport DOMStringHelper.cpp
DOMStringHelper.hpp DirectoryEnumerator.hpp
URISupport.cpp XalanMessageLoader.cpp
XalanMessageLoader.hpp XalanOutputStream.hpp
XalanTranscodingServices.cpp
c/src/xalanc/XSLT XSLTEngineImpl.cpp
XSLTProcessorEnvSupportDefault.cpp
c/src/xalanc/XalanTransformer XalanCAPI.cpp
XalanTransformer.cpp
c/src/xalanc/XercesParserLiaison XercesParserLiaison.cpp
Added: c/src/xalanc/Harness XalanDiagnosticMemoryManager.cpp
XalanDiagnosticMemoryManager.hpp
c/src/xalanc/PlatformSupport XalanMemoryManagerDefault.cpp
XalanMemoryManagerDefault.hpp
Log:
Patch for Jira issue XALANC-492.
Revision Changes Path
1.65 +16 -0 xml-xalan/c/Projects/Win32/VC6/AllInOne/AllInOne.dsp
Index: AllInOne.dsp
===================================================================
RCS file: /home/cvs/xml-xalan/c/Projects/Win32/VC6/AllInOne/AllInOne.dsp,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- AllInOne.dsp 22 Apr 2005 03:18:43 -0000 1.64
+++ AllInOne.dsp 22 Apr 2005 20:52:40 -0000 1.65
@@ -722,6 +722,14 @@
# End Source File
# Begin Source File
+SOURCE=..\..\..\..\src\xalanc\PlatformSupport\XalanMemoryManagerDefault.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xalanc\PlatformSupport\XalanMemoryManagerDefault.hpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\..\src\xalanc\PlatformSupport\XalanMessageLoader.cpp
# End Source File
# Begin Source File
@@ -3454,6 +3462,14 @@
# PROP Default_Filter ""
# Begin Source File
+SOURCE=..\..\..\..\src\xalanc\Harness\XalanDiagnosticMemoryManager.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xalanc\Harness\XalanDiagnosticMemoryManager.hpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\..\src\xalanc\Harness\XalanFileUtility.cpp
# End Source File
# Begin Source File
1.62 +16 -0
xml-xalan/c/Projects/Win32/VC6/AllInOne/AllInOneWithICU.dsp
Index: AllInOneWithICU.dsp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/Projects/Win32/VC6/AllInOne/AllInOneWithICU.dsp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- AllInOneWithICU.dsp 16 Nov 2004 01:18:05 -0000 1.61
+++ AllInOneWithICU.dsp 22 Apr 2005 20:52:40 -0000 1.62
@@ -727,6 +727,14 @@
# End Source File
# Begin Source File
+SOURCE=..\..\..\..\src\xalanc\PlatformSupport\XalanMemoryManagerDefault.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xalanc\PlatformSupport\XalanMemoryManagerDefault.hpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\..\src\xalanc\PlatformSupport\XalanMessageLoader.cpp
# End Source File
# Begin Source File
@@ -3523,6 +3531,14 @@
# PROP Default_Filter ""
# Begin Source File
+SOURCE=..\..\..\..\src\xalanc\Harness\XalanDiagnosticMemoryManager.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xalanc\Harness\XalanDiagnosticMemoryManager.hpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\..\src\xalanc\Harness\XalanFileUtility.cpp
# End Source File
# Begin Source File
1.12 +27 -15 xml-xalan/c/Projects/Win32/VC7/AllInOne/AllInOne.vcproj
Index: AllInOne.vcproj
===================================================================
RCS file: /home/cvs/xml-xalan/c/Projects/Win32/VC7/AllInOne/AllInOne.vcproj,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- AllInOne.vcproj 8 Nov 2004 21:58:52 -0000 1.11
+++ AllInOne.vcproj 22 Apr 2005 20:52:40 -0000 1.12
@@ -244,12 +244,24 @@
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemMgrAutoPtr.hpp">
</File>
<File
+
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemMgrAutoPtr.hpp">
+ </File>
+ <File
+
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemMgrHelper.hpp">
+ </File>
+ <File
+
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemMngArrayAllocate.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemMngArrayAllocate.hpp">
</File>
<File
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemoryManagement.hpp">
</File>
<File
+
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemoryManagement.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\src\xalanc\Include\XalanObjectCache.hpp">
</File>
<File
@@ -264,18 +276,6 @@
<File
RelativePath="..\..\..\..\src\xalanc\Include\XalanVersion.hpp">
</File>
- <File
-
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemMgrAutoPtr.hpp">
- </File>
- <File
-
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemMgrHelper.hpp">
- </File>
- <File
-
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemMngArrayAllocate.hpp">
- </File>
- <File
-
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemoryManagement.hpp">
- </File>
</Filter>
<Filter
Name="XalanDOM"
@@ -639,6 +639,15 @@
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanLocator.hpp">
</File>
<File
+
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanMemoryManagement.cpp">
+ </File>
+ <File
+
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanMemoryManagerDefault.cpp">
+ </File>
+ <File
+
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanMemoryManagerDefault.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanMessageLoader.cpp">
</File>
<File
@@ -722,9 +731,6 @@
<File
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanXMLChar.hpp">
</File>
- <File
-
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanMemoryManagement.cpp">
- </File>
</Filter>
<Filter
Name="DOMSupport"
@@ -2716,6 +2722,12 @@
Name="Harness"
Filter="">
<File
+
RelativePath="..\..\..\..\src\xalanc\Harness\XalanDiagnosticMemoryManager.cpp">
+ </File>
+ <File
+
RelativePath="..\..\..\..\src\xalanc\Harness\XalanDiagnosticMemoryManager.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\src\xalanc\Harness\XalanFileUtility.cpp">
</File>
<File
1.11 +27 -15
xml-xalan/c/Projects/Win32/VC7/AllInOne/AllInOneWithICU.vcproj
Index: AllInOneWithICU.vcproj
===================================================================
RCS file:
/home/cvs/xml-xalan/c/Projects/Win32/VC7/AllInOne/AllInOneWithICU.vcproj,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- AllInOneWithICU.vcproj 8 Nov 2004 21:58:52 -0000 1.10
+++ AllInOneWithICU.vcproj 22 Apr 2005 20:52:40 -0000 1.11
@@ -241,12 +241,24 @@
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemMgrAutoPtr.hpp">
</File>
<File
+
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemMgrAutoPtr.hpp">
+ </File>
+ <File
+
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemMgrHelper.hpp">
+ </File>
+ <File
+
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemMngArrayAllocate.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemMngArrayAllocate.hpp">
</File>
<File
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemoryManagement.hpp">
</File>
<File
+
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemoryManagement.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\src\xalanc\Include\XalanObjectCache.hpp">
</File>
<File
@@ -261,18 +273,6 @@
<File
RelativePath="..\..\..\..\src\xalanc\Include\XalanVersion.hpp">
</File>
- <File
-
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemMgrAutoPtr.hpp">
- </File>
- <File
-
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemMgrHelper.hpp">
- </File>
- <File
-
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemMngArrayAllocate.hpp">
- </File>
- <File
-
RelativePath="..\..\..\..\src\xalanc\Include\XalanMemoryManagement.hpp">
- </File>
</Filter>
<Filter
Name="XalanDOM"
@@ -642,6 +642,15 @@
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanLocator.hpp">
</File>
<File
+
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanMemoryManagement.cpp">
+ </File>
+ <File
+
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanMemoryManagerDefault.cpp">
+ </File>
+ <File
+
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanMemoryManagerDefault.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanMessageLoader.cpp">
</File>
<File
@@ -725,9 +734,6 @@
<File
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanXMLChar.hpp">
</File>
- <File
-
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanMemoryManagement.cpp">
- </File>
</Filter>
<Filter
Name="DOMSupport"
@@ -2768,6 +2774,12 @@
Name="Harness"
Filter="">
<File
+
RelativePath="..\..\..\..\src\xalanc\Harness\XalanDiagnosticMemoryManager.cpp">
+ </File>
+ <File
+
RelativePath="..\..\..\..\src\xalanc\Harness\XalanDiagnosticMemoryManager.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\src\xalanc\Harness\XalanFileUtility.cpp">
</File>
<File
1.11 +12 -0 xml-xalan/c/Projects/Win32/VC7.1/AllInOne/AllInOne.vcproj
Index: AllInOne.vcproj
===================================================================
RCS file:
/home/cvs/xml-xalan/c/Projects/Win32/VC7.1/AllInOne/AllInOne.vcproj,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- AllInOne.vcproj 11 Nov 2004 05:25:07 -0000 1.10
+++ AllInOne.vcproj 22 Apr 2005 20:52:40 -0000 1.11
@@ -652,6 +652,12 @@
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanMemoryManagement.cpp">
</File>
<File
+
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanMemoryManagerDefault.cpp">
+ </File>
+ <File
+
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanMemoryManagerDefault.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanMessageLoader.cpp">
</File>
<File
@@ -2732,6 +2738,12 @@
Name="Harness"
Filter="">
<File
+
RelativePath="..\..\..\..\src\xalanc\Harness\XalanDiagnosticMemoryManager.cpp">
+ </File>
+ <File
+
RelativePath="..\..\..\..\src\xalanc\Harness\XalanDiagnosticMemoryManager.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\src\xalanc\Harness\XalanFileUtility.cpp">
</File>
<File
1.11 +12 -0
xml-xalan/c/Projects/Win32/VC7.1/AllInOne/AllInOneWithICU.vcproj
Index: AllInOneWithICU.vcproj
===================================================================
RCS file:
/home/cvs/xml-xalan/c/Projects/Win32/VC7.1/AllInOne/AllInOneWithICU.vcproj,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- AllInOneWithICU.vcproj 11 Nov 2004 05:25:07 -0000 1.10
+++ AllInOneWithICU.vcproj 22 Apr 2005 20:52:40 -0000 1.11
@@ -652,6 +652,12 @@
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanMemoryManagement.cpp">
</File>
<File
+
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanMemoryManagerDefault.cpp">
+ </File>
+ <File
+
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanMemoryManagerDefault.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\src\xalanc\PlatformSupport\XalanMessageLoader.cpp">
</File>
<File
@@ -2781,6 +2787,12 @@
Name="Harness"
Filter="">
<File
+
RelativePath="..\..\..\..\src\xalanc\Harness\XalanDiagnosticMemoryManager.cpp">
+ </File>
+ <File
+
RelativePath="..\..\..\..\src\xalanc\Harness\XalanDiagnosticMemoryManager.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\src\xalanc\Harness\XalanFileUtility.cpp">
</File>
<File
1.42 +88 -48 xml-xalan/c/Tests/Conf/conf.cpp
Index: conf.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/Tests/Conf/conf.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- conf.cpp 10 Nov 2004 19:10:49 -0000 1.41
+++ conf.cpp 22 Apr 2005 20:52:40 -0000 1.42
@@ -35,27 +35,32 @@
-#include <xercesc/util/PlatformUtils.hpp>
+#include "xercesc/util/PlatformUtils.hpp"
-#include <xercesc/parsers/XercesDOMParser.hpp>
+#include "xercesc/parsers/XercesDOMParser.hpp"
-#include <xalanc/XercesParserLiaison/XercesParserLiaison.hpp>
-#include <xalanc/XercesParserLiaison/XercesDOMSupport.hpp>
+#include "xalanc/PlatformSupport/XalanMemoryManagerDefault.hpp"
-#include <xalanc/XalanTransformer/XalanTransformer.hpp>
-#include <xalanc/XalanTransformer/XercesDOMWrapperParsedSource.hpp>
+#include "xalanc/XercesParserLiaison/XercesParserLiaison.hpp"
+#include "xalanc/XercesParserLiaison/XercesDOMSupport.hpp"
+
+
+
+#include "xalanc/XalanTransformer/XalanTransformer.hpp"
+#include "xalanc/XalanTransformer/XercesDOMWrapperParsedSource.hpp"
// HARNESS HEADERS...
-#include "xalanc/Harness/XalanXMLFileReporter.hpp"
#include "xalanc/Harness/XalanFileUtility.hpp"
+#include "xalanc/Harness/XalanDiagnosticMemoryManager.hpp"
+#include "xalanc/Harness/XalanXMLFileReporter.hpp"
@@ -78,6 +83,10 @@
+XALAN_USING_XERCES(MemoryManager)
+
+
+
void
setHelp(XalanFileUtility& h)
{
@@ -109,13 +118,13 @@
inline bool
-checkForExclusion(const XalanDOMString& currentFile)
+checkForExclusion(
+ const XalanDOMString& currentFile,
+ MemoryManager& theMemoryManager)
{
- MemoryManagerType& mgr = XalanMemMgrs::getDefaultXercesMemMgr();
-
for (size_t i = 0; excludeStylesheets[i] != 0; ++i)
{
- if (equals(currentFile, XalanDOMString(excludeStylesheets[i],
mgr)))
+ if (currentFile == XalanDOMString(excludeStylesheets[i],
theMemoryManager))
{
return true;
}
@@ -133,12 +142,12 @@
const XSLTInputSource& xmlInput,
const XalanCompiledStylesheet* styleSheet,
const XSLTResultTarget& output,
- XalanXMLFileReporter& logFile,
- XalanFileUtility&
h)
+ XalanXMLFileReporter& logFile,
+ XalanFileUtility& h)
{
const XalanParsedSource* parsedSource = 0;
- MemoryManagerType& mgr = XalanMemMgrs::getDefaultXercesMemMgr();
+ MemoryManagerType& mgr = h.getMemoryManager();
int theResult = 0;
@@ -241,16 +250,15 @@
int
runTests(
- int argc,
- char* argv[])
+ int argc,
+ char* argv[],
+ MemoryManager& theMemoryManager)
{
int theResult = 0;
- MemoryManagerType& mgr = XalanMemMgrs::getDefaultXercesMemMgr();
-
try
{
- XalanFileUtility h(mgr);
+ XalanFileUtility h(theMemoryManager);
// Set the program help string, then get the command line
parameters.
//
@@ -258,16 +266,16 @@
if (h.getParams(argc, argv, "CONF-RESULTS") == true)
{
- XalanTransformer xalan;
+ XalanTransformer xalan(theMemoryManager);
// Get drive designation for final analysis and
generate Unique name for results log.
//
- XalanDOMString drive( mgr); // This
is used to get stylesheet for final analysis
+ XalanDOMString drive(theMemoryManager);
// This is used to get stylesheet for final analysis
h.getDrive(drive);
- const XalanDOMString resultFilePrefix("conf", mgr);
// This & UniqRunid used for log file name.
- XalanDOMString UniqRunid( mgr);
+ const XalanDOMString resultFilePrefix("conf",
theMemoryManager); // This & UniqRunid used for log file name.
+ XalanDOMString UniqRunid(theMemoryManager);
h.generateUniqRunid(UniqRunid);
- XalanDOMString resultsFile(drive, mgr);
+ XalanDOMString resultsFile(drive, theMemoryManager);
resultsFile += h.args.output;
resultsFile += resultFilePrefix;
resultsFile += UniqRunid;
@@ -275,9 +283,9 @@
// Open results log, and do some initialization of
result data.
//
- XalanXMLFileReporter logFile(mgr, resultsFile);
+ XalanXMLFileReporter logFile(theMemoryManager,
resultsFile);
logFile.logTestFileInit("Conformance Testing:");
- h.data.xmlFormat = XalanDOMString("NotSet", mgr);
+ h.data.xmlFormat = XalanDOMString("NotSet",
theMemoryManager);
// Get the list of Directories that are below conf and
iterate through them
//
@@ -287,7 +295,7 @@
typedef XalanFileUtility::FileNameVectorType
FileNameVectorType;
- FileNameVectorType dirs(mgr);
+ FileNameVectorType dirs(theMemoryManager);
h.getDirectoryNames(h.args.base, dirs);
int theResult = 0;
@@ -304,7 +312,7 @@
{
// Check that output directory is there.
//
- XalanDOMString theOutputDir(mgr);
+ XalanDOMString
theOutputDir(theMemoryManager);
theOutputDir = h.args.output;
theOutputDir += currentDir;
@@ -313,7 +321,7 @@
// Indicate that directory was
processed and get test files from the directory
//
foundDir = true;
- FileNameVectorType files(mgr);
+ FileNameVectorType
files(theMemoryManager);
h.getTestFileNames(h.args.base, currentDir, true, files);
// Log directory in results log and
process it's files.
@@ -322,21 +330,21 @@
for(FileNameVectorType::size_type i =
0; i < files.size(); i++)
{
- XalanXMLFileReporter::Hashtable
attrs(mgr);
+ XalanXMLFileReporter::Hashtable
attrs(theMemoryManager);
const XalanDOMString&
currentFile = files[i];
- if
(checkForExclusion(currentFile))
+ if
(checkForExclusion(currentFile, theMemoryManager))
continue;
h.data.testOrFile = currentFile;
- XalanDOMString theXSLFile(
h.args.base, mgr);
+ XalanDOMString theXSLFile(
h.args.base, theMemoryManager);
theXSLFile += currentDir;
theXSLFile += XalanFileUtility::s_pathSep;
theXSLFile += currentFile;
// Check and see if the .xml
file exists. If not skip this .xsl file and continue.
bool fileStatus = true;
- XalanDOMString
theXMLFile(mgr);
+ XalanDOMString
theXMLFile(theMemoryManager);
h.generateFileName(theXSLFile, "xml", theXMLFile,
&fileStatus);
if (!fileStatus)
continue;
@@ -345,23 +353,23 @@
h.data.xslFileURL = theXSLFile;
- XalanDOMString
theGoldFile(h.args.gold, mgr);
+ XalanDOMString
theGoldFile(h.args.gold, theMemoryManager);
theGoldFile += currentDir;
theGoldFile += XalanFileUtility::s_pathSep;
theGoldFile += currentFile;
h.generateFileName(theGoldFile, "out", theGoldFile);
- XalanDOMString outbase
(h.args.output, mgr);
+ XalanDOMString outbase
(h.args.output, theMemoryManager);
outbase += currentDir;
outbase += XalanFileUtility::s_pathSep;
outbase += currentFile;
- XalanDOMString
theOutputFile(mgr);
+ XalanDOMString
theOutputFile(theMemoryManager);
h.generateFileName(outbase, "out", theOutputFile);
- const XSLTInputSource
xslInputSource(theXSLFile, mgr);
- const XSLTInputSource
xmlInputSource(theXMLFile, mgr);
- const XSLTResultTarget
resultFile(theOutputFile, mgr);
+ const XSLTInputSource
xslInputSource(theXSLFile, theMemoryManager);
+ const XSLTInputSource
xmlInputSource(theXMLFile, theMemoryManager);
+ const XSLTResultTarget
resultFile(theOutputFile, theMemoryManager);
// Parsing(compile) the XSL
stylesheet and report the results..
//
@@ -371,11 +379,17 @@
{
// Report the failure
and be sure to increment fail count.
//
- cout << "Failed to
parse stylesheet for " << currentFile << endl;
+ CharVectorType theVector(theMemoryManager);
+
+ TranscodeToLocalCodePage(currentFile, theVector);
+
+ cout << "Failed to
parse stylesheet for "
+ << theVector
+ << endl;
h.data.fail += 1;
- XalanDOMString tmp("Failed to parse stylesheet.
", mgr);
- tmp += XalanDOMString(xalan.getLastError(), mgr);
-
logFile.logErrorResult(currentFile, mgr);
+ XalanDOMString tmp("Failed to parse stylesheet.
", theMemoryManager);
+ tmp += XalanDOMString(xalan.getLastError(),
theMemoryManager);
+
logFile.logErrorResult(currentFile, theMemoryManager);
continue;
}
@@ -407,7 +421,7 @@
//
if (!foundDir)
{
- CharVectorType vect(mgr);
+ CharVectorType vect(theMemoryManager);
TranscodeToLocalCodePage(h.args.sub, vect);
cout << "Specified test directory: \"" <<
c_str(vect) << "\" not found" << endl;
@@ -460,14 +474,30 @@
try
{
XALAN_USING_XERCES(XMLPlatformUtils)
+ XALAN_USING_XERCES(XMLUni)
+
+ XalanMemoryManagerDefault theGlobalMemoryManager;
+ XalanDiagnosticMemoryManager
theDiagnosticMemoryManager(theGlobalMemoryManager);
+ XalanMemoryManagerDefault theTestingMemoryManager;
// Call the static initializers for xerces and xalan, and
create a transformer
//
- XMLPlatformUtils::Initialize();
-
- XalanTransformer::initialize();
+ XMLPlatformUtils::Initialize(
+ XMLUni::fgXercescDefaultLocale,
+ 0,
+ 0,
+ &theDiagnosticMemoryManager,
+ true);
+
+ XalanTransformer::initialize(theDiagnosticMemoryManager);
+
+ theDiagnosticMemoryManager.lock();
+
+ {
+ theResult = runTests(argc, argv, theTestingMemoryManager);
+ }
- theResult = runTests(argc, argv);
+ theDiagnosticMemoryManager.unlock();
XalanTransformer::terminate();
@@ -475,6 +505,16 @@
XalanTransformer::ICUCleanUp();
}
+ catch(const XalanDiagnosticMemoryManager::LockException&)
+ {
+ cerr << "An attempt was made to allocate memory "
+ "from a locked XalanDiagnosticMemoryManager "
+ "instance!"
+ << endl
+ << endl;
+
+ theResult = -1;
+ }
catch(...)
{
cerr << "Initialization failed!" << endl << endl;
1.7 +9 -4 xml-xalan/c/src/xalanc/Harness/XalanFileUtility.cpp
Index: XalanFileUtility.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/Harness/XalanFileUtility.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XalanFileUtility.cpp 22 Apr 2005 01:31:50 -0000 1.6
+++ XalanFileUtility.cpp 22 Apr 2005 20:52:41 -0000 1.7
@@ -462,7 +462,9 @@
}
- DirectoryEnumeratorFunctor<FileNameVectorType, XalanDOMString>
theEnumerator;
+ DirectoryEnumeratorFunctor<
+ FileNameVectorType,
+ XalanDOMString> theEnumerator(m_memoryManager);
theEnumerator(searchSpecification, theFiles);
@@ -486,7 +488,10 @@
const XalanDOMString dirSpec(XALAN_STATIC_UCODE_STRING("*"),
m_memoryManager);
- DirectoryEnumeratorFunctor<FileNameVectorType, XalanDOMString,
DirectoryFilterPredicate> theEnumerator;
+ DirectoryEnumeratorFunctor<
+ FileNameVectorType,
+ XalanDOMString,
+ DirectoryFilterPredicate> theEnumerator(m_memoryManager);
theEnumerator(
XalanDOMString(
@@ -547,11 +552,11 @@
if ( !mkdir(c_str(theResult), DIR_MODE_BITS))
#endif
{
- cout << directory << " created." << endl;
+ cout << theResult1 << " created." << endl;
}
else
{
- cout << directory << " NOT created." << endl;
+ cout << theResult1 << " NOT created." << endl;
}
}
1.5 +12 -0 xml-xalan/c/src/xalanc/Harness/XalanFileUtility.hpp
Index: XalanFileUtility.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/Harness/XalanFileUtility.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XalanFileUtility.hpp 22 Apr 2005 01:31:50 -0000 1.4
+++ XalanFileUtility.hpp 22 Apr 2005 20:52:41 -0000 1.5
@@ -386,6 +386,18 @@
static const XalanDOMChar s_pathSep[];
+ const MemoryManager&
+ getMemoryManager() const
+ {
+ return m_memoryManager;
+ }
+
+ MemoryManager&
+ getMemoryManager()
+ {
+ return m_memoryManager;
+ }
+
private:
static const XalanDOMString s_emptyString;
1.1
xml-xalan/c/src/xalanc/Harness/XalanDiagnosticMemoryManager.cpp
Index: XalanDiagnosticMemoryManager.cpp
===================================================================
/*
* Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "XalanDiagnosticMemoryManager.hpp"
XALAN_CPP_NAMESPACE_BEGIN
XalanDiagnosticMemoryManager::XalanDiagnosticMemoryManager(
MemoryManager& theMemoryManager,
bool fAssertErrors) :
m_memoryManager(theMemoryManager),
m_assertErrors(fAssertErrors),
m_locked(false),
m_sequence(0),
m_highWaterMark(0),
m_currentAllocated(0),
m_allocations(theMemoryManager)
{
}
XalanDiagnosticMemoryManager::~XalanDiagnosticMemoryManager()
{
if (m_allocations.size() > 0)
{
// std::cerr << "Detected memory leaks. "
// << m_allocations.size()
// << " blocks are still allocated.";
}
}
void*
XalanDiagnosticMemoryManager::allocate(size_type size)
{
void* theResult = 0;
if (m_locked == true)
{
throw LockException();
}
else
{
theResult =
m_memoryManager.allocate(size);
assert(theResult != 0);
assert(m_allocations.find(theResult) == m_allocations.end());
m_currentAllocated += size;
if (m_currentAllocated > m_highWaterMark)
{
m_highWaterMark = m_currentAllocated;
}
m_allocations.insert(MapType::value_type(theResult, Data(size,
m_sequence++)));
}
return theResult;
}
void
XalanDiagnosticMemoryManager::deallocate(void* pointer)
{
if (m_locked == true)
{
throw LockException();
}
else
{
if (pointer != 0)
{
MapType::iterator i =
m_allocations.find(pointer);
if (i != m_allocations.end())
{
m_memoryManager.deallocate(pointer);
assert(m_currentAllocated >= i->second.m_size);
m_currentAllocated -= i->second.m_size;
m_allocations.erase(i);
}
else
{
//std::cerr << "Attempt to free unallocated pointer "
// << pointer
// << ".\n";
assert(!m_assertErrors);
}
}
}
}
XALAN_CPP_NAMESPACE_END
1.1
xml-xalan/c/src/xalanc/Harness/XalanDiagnosticMemoryManager.hpp
Index: XalanDiagnosticMemoryManager.hpp
===================================================================
/*
* Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(XALAN_DIAGNOSTICMEMORYMANAGER_HEADER_GUARD_1357924680)
#define XALAN_DIAGNOSTICMEMORYMANAGER_HEADER_GUARD_1357924680
#include "xalanc/Harness/XalanHarnessDefinitions.hpp"
#include <cstddef>
#include "xercesc/framework/MemoryManager.hpp"
#include "xalanc/Include/XalanMap.hpp"
XALAN_CPP_NAMESPACE_BEGIN
XALAN_USING_XERCES(MemoryManager)
class XALAN_HARNESS_EXPORT XalanDiagnosticMemoryManager : public MemoryManager
{
public:
#if defined(XALAN_STRICT_ANSI_HEADERS)
typedef std::size_t size_type;
#else
typedef size_t size_type;
#endif
class LockException
{
public:
LockException()
{
}
~LockException()
{
}
};
XalanDiagnosticMemoryManager(
MemoryManager& theMemoryManager,
bool fAssertErrors = false);
virtual
~XalanDiagnosticMemoryManager();
virtual void*
allocate(size_type size);
virtual void
deallocate(void* pointer);
bool
getAssertErrors() const
{
return m_assertErrors;
}
void
setAssertErrors(bool fAssertErrors)
{
m_assertErrors = fAssertErrors;
}
// Get the high-water mark (the highest amount
// that was allocated at any particular point).
size_type
getHighWaterMark() const
{
return m_highWaterMark;
}
// Get the number of bytes currently allocated.
size_type
getAllocated() const
{
return m_currentAllocated;
}
// Get the current number of outstanding allocations.
size_type
getAllocations() const
{
return m_allocations.size();
}
struct Data
{
Data() :
m_size(0),
m_sequence(0)
{
}
Data(
size_type theSize,
size_type theSequence) :
m_size(theSize),
m_sequence(theSequence)
{
}
size_type m_size;
size_type m_sequence;
};
typedef XalanMap<void*, Data> MapType;
typedef MapType::const_iterator const_iterator;
const_iterator
getAllocationsIterator() const
{
return m_allocations.begin();
}
void
lock()
{
m_locked = true;
}
void
unlock()
{
m_locked = false;
}
private:
XalanDiagnosticMemoryManager(const XalanDiagnosticMemoryManager&);
XalanDiagnosticMemoryManager&
operator=(const XalanDiagnosticMemoryManager&);
MemoryManager& m_memoryManager;
bool m_assertErrors;
bool m_locked;
size_type m_sequence;
size_type m_highWaterMark;
size_type m_currentAllocated;
MapType m_allocations;
};
XALAN_CPP_NAMESPACE_END
#endif // XALAN_DIAGNOSTICMEMORYMANAGER_HEADER_GUARD_1357924680
1.10 +3 -2
xml-xalan/c/src/xalanc/PlatformSupport/DOMStringHelper.cpp
Index: DOMStringHelper.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/PlatformSupport/DOMStringHelper.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- DOMStringHelper.cpp 12 Nov 2004 16:27:16 -0000 1.9
+++ DOMStringHelper.cpp 22 Apr 2005 20:52:41 -0000 1.10
@@ -367,9 +367,10 @@
XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(void)
OutputString(
ostream& theStream,
- const XalanDOMChar* theString)
+ const XalanDOMChar* theString,
+ MemoryManager& theMemoryManager)
{
- CharVectorType theVector(XalanMemMgrs::getDefaultXercesMemMgr());
+ CharVectorType theVector(theMemoryManager);
TranscodeToLocalCodePage(theString, theVector);
1.13 +74 -17
xml-xalan/c/src/xalanc/PlatformSupport/DOMStringHelper.hpp
Index: DOMStringHelper.hpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/PlatformSupport/DOMStringHelper.hpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- DOMStringHelper.hpp 12 Nov 2004 19:56:18 -0000 1.12
+++ DOMStringHelper.hpp 22 Apr 2005 20:52:41 -0000 1.13
@@ -36,6 +36,7 @@
#include <xalanc/Include/XalanVector.hpp>
#include <xalanc/Include/XalanMap.hpp>
+#include <xalanc/Include/XalanMemoryManagement.hpp>
#include <xalanc/Include/STLHelper.hpp>
@@ -54,6 +55,10 @@
+XALAN_USING_XERCES(MemoryManager)
+
+
+
class XalanOutputStream;
@@ -835,10 +840,13 @@
* Converts a wide string into a double value
*
* @param theString target string
+ * @param theMemoryManager The MemoryManager instance to use.
* @return double value of target string
*/
XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(double)
-WideStringToDouble(const XalanDOMChar* theString, MemoryManagerType&
theManager);
+WideStringToDouble(
+ const XalanDOMChar* theString,
+ MemoryManager& theMemoryManager);
@@ -888,13 +896,17 @@
* Converts a XalanDOMString into a double value
*
* @param theString target string
+ * @param theMemoryManager The MemoryManager instance to use.
* @return double value of target string
*/
inline double
-DOMStringToDouble(const XalanDOMString& theString,
- MemoryManagerType& theManager)
-{
- return WideStringToDouble(c_wstr(theString), theManager);
+DOMStringToDouble(
+ const XalanDOMString& theString,
+ MemoryManager& theMemoryManager)
+{
+ return WideStringToDouble(
+ c_wstr(theString),
+ theMemoryManager);
}
@@ -959,7 +971,8 @@
#else
std::ostream& theStream,
#endif
- const XalanDOMChar* theString);
+ const XalanDOMChar* theString,
+ MemoryManager& theMemoryManager);
@@ -977,7 +990,9 @@
{
if (isEmpty(theString) == false)
{
- OutputString(theStream, c_wstr(theString));
+ OutputString(
+ theStream,
+ c_wstr(theString));
}
}
@@ -988,6 +1003,7 @@
*
* @param theStream output stream
* @param theString target string
+ * @param theMemoryManager The MemoryManager instance to use.
* @see operator<<
*/
inline void
@@ -997,9 +1013,13 @@
#else
std::ostream& theStream,
#endif
- const XalanDOMString& theString)
+ const XalanDOMString& theString,
+ MemoryManager& theMemoryManager)
{
- OutputString(theStream, c_wstr(theString));
+ OutputString(
+ theStream,
+ c_wstr(theString),
+ theMemoryManager);
}
@@ -1016,7 +1036,9 @@
XalanOutputStream& theStream,
const CharVectorType& theString)
{
- OutputString(theStream, theString);
+ OutputString(
+ theStream,
+ theString);
return theStream;
}
@@ -1041,7 +1063,9 @@
#endif
const CharVectorType& theString)
{
- OutputString(theStream, theString);
+ OutputString(
+ theStream,
+ theString);
return theStream;
}
@@ -1060,8 +1084,9 @@
XalanOutputStream& theStream,
const XalanDOMChar* theString)
{
- OutputString(theStream,
- theString);
+ OutputString(
+ theStream,
+ theString);
return theStream;
}
@@ -1086,8 +1111,10 @@
#endif
const XalanDOMChar* theString)
{
- OutputString(theStream,
- theString);
+ OutputString(
+ theStream,
+ theString,
+ XalanMemMgrs::getDefault());
return theStream;
}
@@ -1132,8 +1159,38 @@
#endif
const XalanDOMString& theString)
{
- OutputString(theStream,
- theString);
+ OutputString(
+ theStream,
+ theString,
+ XalanMemMgrs::getDefault());
+
+ return theStream;
+}
+
+
+
+/**
+ * Outputs the target string to the specified stream
+ *
+ * @param theStream output stream
+ * @param theString target string
+ * @see OutputString
+ */
+#if defined(XALAN_NO_STD_NAMESPACE)
+inline ostream&
+operator<<(
+ ostream& theStream,
+#else
+inline std::ostream&
+operator<<(
+ std::ostream& theStream,
+#endif
+ XalanDOMString& theString)
+{
+ OutputString(
+ theStream,
+ theString,
+ theString.getMemoryManager());
return theStream;
}
1.17 +55 -44
xml-xalan/c/src/xalanc/PlatformSupport/DirectoryEnumerator.hpp
Index: DirectoryEnumerator.hpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/PlatformSupport/DirectoryEnumerator.hpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- DirectoryEnumerator.hpp 2 Mar 2005 17:30:56 -0000 1.16
+++ DirectoryEnumerator.hpp 22 Apr 2005 20:52:41 -0000 1.17
@@ -30,9 +30,6 @@
#include <dirent.h>
#include <sys/stat.h>
#include <errno.h>
-
-
-
#endif
@@ -41,9 +38,13 @@
#include <iterator>
-#include <xalanc/PlatformSupport/XalanFileOutputStream.hpp>
-#include <xalanc/PlatformSupport/DOMStringHelper.hpp>
-#include <xalanc/PlatformSupport/XalanUnicode.hpp>
+#include "xercesc/framework/MemoryManager.hpp"
+
+
+
+#include "xalanc/PlatformSupport/XalanFileOutputStream.hpp"
+#include "xalanc/PlatformSupport/DOMStringHelper.hpp"
+#include "xalanc/PlatformSupport/XalanUnicode.hpp"
@@ -51,6 +52,10 @@
+XALAN_USING_XERCES(MemoryManager)
+
+
+
#if defined(_MSC_VER)
struct FindFileStruct : public _wfinddata_t
@@ -145,17 +150,9 @@
{
struct stat stat_Info;
- int retCode = stat (d_name, &stat_Info);
+ const int retCode = stat(d_name, &stat_Info);
- if ( retCode == -1 )
- {
- XalanDOMString
theBuffer(XalanMemMgrs::getDefaultXercesMemMgr());
- typedef
XalanFileOutputStream::XalanFileOutputStreamOpenException
XalanStatDirectoryException;
- throw XalanStatDirectoryException(
XalanDOMString(d_name, XalanMemMgrs::getDefaultXercesMemMgr()), errno ,
theBuffer);
- }
-
- return S_ISDIR(stat_Info.st_mode);
-
+ return retCode == -1 ? false : S_ISDIR(stat_Info.st_mode);
}
bool
@@ -231,6 +228,7 @@
class StringConversionFunction>
void
EnumerateDirectory(
+ MemoryManager& theMemoryManager,
const StringType&
theFullSearchSpec,
OutputIteratorType
theOutputIterator,
FilterPredicateType
theFilterPredicate,
@@ -241,7 +239,6 @@
bool
fIncludeSelfAndParent = false)
#endif
{
- MemoryManagerType& theManager = XalanMemMgrs::getDefaultXercesMemMgr();
#if defined(_MSC_VER)
FindFileStruct theFindData;
@@ -253,8 +250,10 @@
#pragma warning(push)
#pragma warning(disable: 4244)
- theHandleType theSearchHandle =
_wfindfirst(const_cast<wchar_t*>(theConversionFunction(theFullSearchSpec)),
-
&theFindData);
+ theHandleType theSearchHandle =
+ _wfindfirst(
+ const_cast<wchar_t*>(theConversionFunction(theFullSearchSpec)),
+ &theFindData);
#pragma warning(pop)
if (theSearchHandle != -1)
@@ -267,7 +266,7 @@
if ((fIncludeSelfAndParent == true ||
theFindData.isSelfOrParent() == false) &&
theFilterPredicate(theFindData) == true)
{
- *theOutputIterator =
StringType(theFindData.getName(), theManager);
+ *theOutputIterator =
StringType(theFindData.getName(), theMemoryManager);
}
}
while(_wfindnext(theSearchHandle,
@@ -286,7 +285,7 @@
#else
- CharVectorType theTargetVector(theManager);
+ CharVectorType theTargetVector(theMemoryManager);
TranscodeToLocalCodePage(theFullSearchSpec, theTargetVector, false);
@@ -330,8 +329,8 @@
const char* const theSpec = c_str(theTargetVector);
assert(theSpec != 0);
- XalanDOMString theName(theManager);
- XalanDOMString theSuffix(theManager);
+ XalanDOMString theName(theMemoryManager);
+ XalanDOMString theSuffix(theMemoryManager);
if ( !target_Dir )
{
#if defined(XALAN_STRICT_ANSI_HEADERS)
@@ -361,18 +360,18 @@
{
if( target_Dir )
{
-
*theOutputIterator = StringType(theEntry->getName(), theManager);
+
*theOutputIterator = StringType(theEntry->getName(), theMemoryManager);
}
else
{
- XalanDOMString
Getname(theEntry->getName(), theManager);
+ XalanDOMString
Getname(theEntry->getName(), theMemoryManager);
int Check_1
= Getname.compare(theName);
- XalanDOMString
GetnameSuffix(theManager);
+ XalanDOMString
GetnameSuffix(theMemoryManager);
Getname.substr(GetnameSuffix, Getname.size()
-indexSuffix, indexSuffix);
int Check_2 =
GetnameSuffix.compare(theSuffix);
if ( Check_1 ==
1 && (!Check_2) )
{
-
*theOutputIterator = StringType(theEntry->getName(), theManager);
+
*theOutputIterator = StringType(theEntry->getName(), theMemoryManager);
}
}
}
@@ -406,6 +405,7 @@
class StringConversionFunction>
void
EnumerateDirectory(
+ MemoryManager& theMemoryManager,
const StringType& theDirectory,
const StringType& theSearchSpec,
OutputIteratorType
theOutputIterator,
@@ -417,13 +417,17 @@
bool
fIncludeSelfAndParent = false)
#endif
{
- MemoryManagerType& theManager = XalanMemMgrs::getDefaultXercesMemMgr();
-
- StringType theFullSearchSpec(theDirectory, theManager);
+ StringType theFullSearchSpec(theDirectory, theMemoryManager);
theFullSearchSpec += theSearchSpec;
- EnumerateDirectory(theFullSearchSpec, theOutputIterator,
theFilterPredicate, theConversionFunction, fIncludeSelfAndParent);
+ EnumerateDirectory(
+ theMemoryManager,
+ theFullSearchSpec,
+ theOutputIterator,
+ theFilterPredicate,
+ theConversionFunction,
+ fIncludeSelfAndParent);
}
@@ -471,8 +475,11 @@
typedef typename BaseClassType::argument_type argument_type;
explicit
- DirectoryEnumeratorFunctor(bool fIncludeSelfAndParent = false) :
- m_includeSelfAndParent(fIncludeSelfAndParent)
+ DirectoryEnumeratorFunctor(
+ MemoryManager& theMemoryManager,
+ bool fIncludeSelfAndParent = false) :
+ m_includeSelfAndParent(fIncludeSelfAndParent),
+ m_memoryManager(theMemoryManager)
{
}
@@ -484,11 +491,12 @@
XALAN_USING_STD(back_inserter)
EnumerateDirectory(
- theFullSearchSpec,
- XALAN_STD_QUALIFIER
back_inserter(theCollection),
- m_filterPredicate,
- m_conversionFunction,
- m_includeSelfAndParent);
+ m_memoryManager,
+ theFullSearchSpec,
+ XALAN_STD_QUALIFIER back_inserter(theCollection),
+ m_filterPredicate,
+ m_conversionFunction,
+ m_includeSelfAndParent);
}
result_type
@@ -510,12 +518,13 @@
CollectionType& theCollection) const
{
EnumerateDirectory(
- theDirectory,
- theSearchSpec,
- XALAN_STD_QUALIFIER
back_inserter(theCollection),
- m_filterPredicate,
- m_conversionFunction,
- m_includeSelfAndParent);
+ m_memoryManager,
+ theDirectory,
+ theSearchSpec,
+ XALAN_STD_QUALIFIER back_inserter(theCollection),
+ m_filterPredicate,
+ m_conversionFunction,
+ m_includeSelfAndParent);
}
result_type
@@ -540,6 +549,8 @@
StringConversionFunction m_conversionFunction;
const bool m_includeSelfAndParent;
+
+ MemoryManager& m_memoryManager;
};
#endif
1.11 +1 -1 xml-xalan/c/src/xalanc/PlatformSupport/URISupport.cpp
Index: URISupport.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/PlatformSupport/URISupport.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- URISupport.cpp 21 Apr 2005 20:54:06 -0000 1.10
+++ URISupport.cpp 22 Apr 2005 20:52:41 -0000 1.11
@@ -105,7 +105,7 @@
// $$$ ToDo: XMLURL::lookupByName() is supposed to be
static, but is not.
const XMLURLType::Protocols theProtocol =
-
XMLURLType().lookupByName(c_wstr(theProtocolString));
+ XMLURLType::lookupByName(c_wstr(theProtocolString));
if (theProtocol != XMLURLType::Unknown)
{
1.8 +168 -126
xml-xalan/c/src/xalanc/PlatformSupport/XalanMessageLoader.cpp
Index: XalanMessageLoader.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/PlatformSupport/XalanMessageLoader.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XalanMessageLoader.cpp 12 Nov 2004 21:54:56 -0000 1.7
+++ XalanMessageLoader.cpp 22 Apr 2005 20:52:41 -0000 1.8
@@ -45,7 +45,7 @@
#define MAX_MESSAGE_LEN 1024
-XalanMessageLoader* XalanMessageLoader::s_msgLoader = 0;
+XalanMessageLoader* XalanMessageLoader::s_msgLoader = 0;
static MemoryManagerType* s_initManager;
@@ -68,14 +68,14 @@
#error You must provide a message loader
#endif
- if (s_msgLoader == 0)
- {
+ if (s_msgLoader == 0)
+ {
s_initManager = &theManager;
s_msgLoader = LoaderCreatorType()(theManager);
- }
+ }
- assert(s_msgLoader != 0);
+ assert(s_msgLoader != 0);
}
@@ -90,196 +90,238 @@
LoaderDestructType()(*s_initManager, s_msgLoader);
- s_msgLoader = 0;
+ s_msgLoader = 0;
}
XalanDOMString&
XalanMessageLoader::getMessage(
- XalanMessages::Codes msgToLoad,
+ XalanMessages::Codes msgToLoad,
XalanDOMString& theResultMessage,
- const XalanDOMString& repText1 )
+ const XalanDOMString& repText1 )
{
- assert(s_msgLoader != 0);
+ assert(s_msgLoader != 0);
- XalanDOMChar sBuffer[MAX_MESSAGE_LEN];
+ XalanDOMChar sBuffer[MAX_MESSAGE_LEN];
- s_msgLoader->load(msgToLoad,
- sBuffer,
- MAX_MESSAGE_LEN,
- repText1.c_str());
+ s_msgLoader->load(
+ msgToLoad,
+ theResultMessage.getMemoryManager(),
+ sBuffer,
+ MAX_MESSAGE_LEN,
+ repText1.c_str());
theResultMessage.assign(sBuffer);
- return theResultMessage;
+ return theResultMessage;
}
+
XalanDOMString&
-XalanMessageLoader::getMessage(XalanMessages::Codes msgToLoad,
- XalanDOMString& theResultMessage,
- const XalanDOMString&
repText1,
- const XalanDOMString&
repText2)
+XalanMessageLoader::getMessage(
+ XalanMessages::Codes msgToLoad,
+ XalanDOMString& theResultMessage,
+ const XalanDOMString& repText1,
+ const XalanDOMString& repText2)
{
- assert(s_msgLoader != 0);
+ assert(s_msgLoader != 0);
- XalanDOMChar sBuffer[MAX_MESSAGE_LEN];
+ XalanDOMChar sBuffer[MAX_MESSAGE_LEN];
- s_msgLoader->load(msgToLoad,
- sBuffer,
- MAX_MESSAGE_LEN,
- repText1.c_str(),
- repText2.c_str());
+ s_msgLoader->load(
+ msgToLoad,
+ theResultMessage.getMemoryManager(),
+ sBuffer,
+ MAX_MESSAGE_LEN,
+ repText1.c_str(),
+ repText2.c_str());
theResultMessage.assign(sBuffer);
- return theResultMessage;
+ return theResultMessage;
}
-XalanDOMString&
-XalanMessageLoader::getMessage(XalanMessages::Codes msgToLoad,
- XalanDOMString& theResultMessage,
- const XalanDOMString& repText1 ,
- const XalanDOMString& repText2 ,
- const XalanDOMString& repText3)
-{
- assert(s_msgLoader != 0);
-
- XalanDOMChar sBuffer[MAX_MESSAGE_LEN];
- s_msgLoader->load(msgToLoad,
- sBuffer,
- MAX_MESSAGE_LEN,
- repText1.c_str(),
- repText2.c_str(),
- repText3.c_str());
+XalanDOMString&
+XalanMessageLoader::getMessage(
+ XalanMessages::Codes msgToLoad,
+ XalanDOMString& theResultMessage,
+ const XalanDOMString& repText1 ,
+ const XalanDOMString& repText2 ,
+ const XalanDOMString& repText3)
+{
+ assert(s_msgLoader != 0);
+
+ XalanDOMChar sBuffer[MAX_MESSAGE_LEN];
+
+ s_msgLoader->load(
+ msgToLoad,
+ theResultMessage.getMemoryManager(),
+ sBuffer,
+ MAX_MESSAGE_LEN,
+ repText1.c_str(),
+ repText2.c_str(),
+ repText3.c_str());
theResultMessage.assign(sBuffer);
- return theResultMessage;
+ return theResultMessage;
}
+
+
XalanDOMString&
-XalanMessageLoader::getMessage(XalanMessages::Codes msgToLoad,
- XalanDOMString& theResultMessage)
+XalanMessageLoader::getMessage(
+ XalanMessages::Codes msgToLoad,
+ XalanDOMString& theResultMessage)
{
- assert(s_msgLoader != 0);
+ assert(s_msgLoader != 0);
- XalanDOMChar sBuffer[MAX_MESSAGE_LEN];
+ XalanDOMChar sBuffer[MAX_MESSAGE_LEN];
- s_msgLoader->loadMsg(msgToLoad,
+ s_msgLoader->loadMsg(msgToLoad,
sBuffer,
- MAX_MESSAGE_LEN) ;
+ MAX_MESSAGE_LEN) ;
theResultMessage.assign(sBuffer);
- return theResultMessage;
+ return theResultMessage;
}
+
+
bool
-XalanMessageLoader::load(XalanMessages::Codes msgToLoad,
- XalanDOMChar*
toFill,
- unsigned int
maxChars,
- const XalanDOMChar*
repText1,
- const XalanDOMChar* repText2,
- const XalanDOMChar* repText3,
- const XalanDOMChar* repText4)
+XalanMessageLoader::load(
+ XalanMessages::Codes msgToLoad,
+ MemoryManager& theMemoryManager,
+ XalanDOMChar* toFill,
+ unsigned int maxChars,
+ const XalanDOMChar* repText1,
+ const XalanDOMChar* repText2,
+ const XalanDOMChar* repText3,
+ const XalanDOMChar* repText4)
{
// Call the other version to load up the message
if (!loadMsg(msgToLoad, toFill, maxChars))
return false;
- XALAN_USING_XERCES(XMLString)
+ XALAN_USING_XERCES(XMLString)
// And do the token replacement
- XMLString::replaceTokens(toFill, maxChars, repText1, repText2, repText3,
repText4);
+ XMLString::replaceTokens(
+ toFill,
+ maxChars,
+ repText1,
+ repText2,
+ repText3,
+ repText4,
+ &theMemoryManager);
return true;
}
-XalanDOMString&
-XalanMessageLoader::getMessage(XalanMessages::Codes msgToLoad,
- XalanDOMString& theResultMessage,
- const char*
repText1,
- const char*
repText2,
- const char*
repText3,
- const char*
repText4)
-{
-
- XalanDOMChar sBuffer[MAX_MESSAGE_LEN];
- s_msgLoader->load(msgToLoad,
- theResultMessage.getMemoryManager(),
- sBuffer,
- MAX_MESSAGE_LEN,
- repText1, repText2, repText3 ,
repText4) ;
+XalanDOMString&
+XalanMessageLoader::getMessage(
+ XalanMessages::Codes msgToLoad,
+ XalanDOMString& theResultMessage,
+ const char* repText1,
+ const char* repText2,
+ const char* repText3,
+ const char* repText4)
+{
+ XalanDOMChar sBuffer[MAX_MESSAGE_LEN];
+
+ s_msgLoader->load(
+ msgToLoad,
+ theResultMessage.getMemoryManager(),
+ sBuffer,
+ MAX_MESSAGE_LEN,
+ repText1,
+ repText2,
+ repText3,
+ repText4);
- return theResultMessage;
+ return theResultMessage;
}
XalanDOMString&
-XalanMessageLoader::getMessage(XalanMessages::Codes msgToLoad,
- XalanDOMString&
theResultMessage,
- const XalanDOMChar*
repText1,
- const XalanDOMChar*
repText2,
- const XalanDOMChar*
repText3,
- const XalanDOMChar*
repText4)
-{
-
- XalanDOMChar sBuffer[MAX_MESSAGE_LEN];
-
- s_msgLoader->load(msgToLoad,
- sBuffer,
- MAX_MESSAGE_LEN,
- repText1, repText2, repText3 ,
repText4) ;
+XalanMessageLoader::getMessage(
+ XalanMessages::Codes msgToLoad,
+ XalanDOMString& theResultMessage,
+ const XalanDOMChar* repText1,
+ const XalanDOMChar* repText2,
+ const XalanDOMChar* repText3,
+ const XalanDOMChar* repText4)
+{
+ XalanDOMChar sBuffer[MAX_MESSAGE_LEN];
+
+ s_msgLoader->load(
+ msgToLoad,
+ theResultMessage.getMemoryManager(),
+ sBuffer,
+ MAX_MESSAGE_LEN,
+ repText1,
+ repText2,
+ repText3,
+ repText4);
- return theResultMessage;
+ return theResultMessage;
}
bool
-XalanMessageLoader::load(XalanMessages::Codes msgToLoad,
- MemoryManagerType& theManager,
- XalanDOMChar*
toFill,
- unsigned int
maxChars,
- const char*
repText1,
- const char*
repText2,
- const char*
repText3,
- const char*
repText4)
-{
- XalanDOMString theFirstParam(theManager);
- if (repText1 != 0)
- {
- theFirstParam.assign(repText1);
- }
-
- XalanDOMString theSecParam(theManager);
- if (repText2 != 0)
- {
- theSecParam.assign(repText2);
- }
-
- XalanDOMString theThirdParam(theManager);
- if( repText3 != 0)
- {
- theThirdParam.assign(repText3);
- }
-
- XalanDOMString theForthParam(theManager);
- if (repText4 != 0)
- {
- theForthParam.assign(repText4);
- }
-
- return load(msgToLoad, toFill, maxChars, theFirstParam.c_str(),
theSecParam.c_str(),
- theThirdParam.c_str(),
theForthParam.c_str());
+XalanMessageLoader::load(
+ XalanMessages::Codes msgToLoad,
+ MemoryManagerType& theManager,
+ XalanDOMChar* toFill,
+ unsigned int maxChars,
+ const char* repText1,
+ const char* repText2,
+ const char* repText3,
+ const char* repText4)
+{
+ XalanDOMString theFirstParam(theManager);
+ if (repText1 != 0)
+ {
+ theFirstParam.assign(repText1);
+ }
+
+ XalanDOMString theSecParam(theManager);
+ if (repText2 != 0)
+ {
+ theSecParam.assign(repText2);
+ }
+
+ XalanDOMString theThirdParam(theManager);
+ if( repText3 != 0)
+ {
+ theThirdParam.assign(repText3);
+ }
+
+ XalanDOMString theForthParam(theManager);
+ if (repText4 != 0)
+ {
+ theForthParam.assign(repText4);
+ }
+
+ return load(
+ msgToLoad,
+ theManager,
+ toFill,
+ maxChars,
+ theFirstParam.c_str(),
+ theSecParam.c_str(),
+ theThirdParam.c_str(),
+ theForthParam.c_str());
}
1.8 +103 -89
xml-xalan/c/src/xalanc/PlatformSupport/XalanMessageLoader.hpp
Index: XalanMessageLoader.hpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/PlatformSupport/XalanMessageLoader.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XalanMessageLoader.hpp 12 Nov 2004 21:54:56 -0000 1.7
+++ XalanMessageLoader.hpp 22 Apr 2005 20:52:41 -0000 1.8
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -33,45 +33,50 @@
+XALAN_USING_XERCES(MemoryManager)
+
+
+
// class for calling fom outside of the module
class XALAN_PLATFORMSUPPORT_EXPORT XalanMessageLoader {
public:
- template <class Type>
- class XalanMessageLoaderCreateFunct
- {
- public:
- Type*
- operator()(MemoryManagerType& theManager)
- {
- XalanMemMgrAutoPtr<Type, false> theGuard( theManager ,
(Type*)theManager.allocate(sizeof(Type)));
-
- Type* theResult = theGuard.get();
+ template <class Type>
+ class XalanMessageLoaderCreateFunct
+ {
+ public:
+ Type*
+ operator()(MemoryManager& theManager)
+ {
+ XalanMemMgrAutoPtr<Type, false> theGuard( theManager ,
(Type*)theManager.allocate(sizeof(Type)));
- new (theResult) Type(theManager);
+ Type* theResult = theGuard.get();
- theGuard.release();
+ new (theResult) Type(theManager);
- return theResult;
- }
+ theGuard.release();
- };
+ return theResult;
+ }
+ };
- class XalanMessageLoaderDestructFunct
- {
- public:
- void
- operator()(MemoryManagerType& theManager, XalanMessageLoader* p)
- {
- assert ( p != 0);
-
- p->~XalanMessageLoader();
-
- theManager.deallocate(p);
- }
+ class XalanMessageLoaderDestructFunct
+ {
+ public:
+ void
+ operator()(
+ MemoryManager&
theManager,
+ XalanMessageLoader* p)
+ {
+ assert ( p != 0);
+
+ p->~XalanMessageLoader();
+
+ theManager.deallocate(p);
+ }
- };
+ };
virtual
~XalanMessageLoader();
@@ -81,77 +86,86 @@
}
static void
- initialize(MemoryManagerType& theManager);
+ initialize(MemoryManagerType& theManager);
static void
terminate();
static XalanDOMString&
- getMessage(XalanMessages::Codes msgToLoad,
- XalanDOMString& theResultMessage,
- const char* repText1 ,
- const char* repText2 = 0,
- const char* repText3 = 0,
- const char* repText4 = 0);
-
- static XalanDOMString&
- getMessage(XalanMessages::Codes msgToLoad,
- XalanDOMString& theResultMessage,
- const XalanDOMChar* repText1,
- const XalanDOMChar* repText2 = 0,
- const XalanDOMChar* repText3 = 0,
- const XalanDOMChar* repText4 = 0);
-
- static XalanDOMString&
- getMessage(XalanMessages::Codes msgToLoad,
- XalanDOMString& theResultMessage);
-
- static XalanDOMString&
- getMessage(XalanMessages::Codes msgToLoad,
- XalanDOMString& theResultMessage,
- const XalanDOMString& repText1 );
-
- static XalanDOMString&
- getMessage(XalanMessages::Codes msgToLoad,
- XalanDOMString& theResultMessage,
- const XalanDOMString& repText1,
- const XalanDOMString& repText2 );
-
- static XalanDOMString&
- getMessage(XalanMessages::Codes msgToLoad,
- XalanDOMString& theResultMessage,
- const XalanDOMString& repText1,
- const XalanDOMString& repText2,
- const XalanDOMString& repText3);
-
-
+ getMessage(
+ XalanMessages::Codes msgToLoad,
+ XalanDOMString&
theResultMessage,
+ const char* repText1 ,
+ const char* repText2 = 0,
+ const char* repText3 = 0,
+ const char* repText4 = 0);
+
+ static XalanDOMString&
+ getMessage(
+ XalanMessages::Codes msgToLoad,
+ XalanDOMString&
theResultMessage,
+ const XalanDOMChar* repText1,
+ const XalanDOMChar* repText2 = 0,
+ const XalanDOMChar* repText3 = 0,
+ const XalanDOMChar* repText4 = 0);
+
+ static XalanDOMString&
+ getMessage(
+ XalanMessages::Codes msgToLoad,
+ XalanDOMString&
theResultMessage);
+
+ static XalanDOMString&
+ getMessage(
+ XalanMessages::Codes msgToLoad,
+ XalanDOMString&
theResultMessage,
+ const XalanDOMString& repText1 );
+
+ static XalanDOMString&
+ getMessage(
+ XalanMessages::Codes msgToLoad,
+ XalanDOMString&
theResultMessage,
+ const XalanDOMString& repText1,
+ const XalanDOMString& repText2 );
+
+ static XalanDOMString&
+ getMessage(
+ XalanMessages::Codes msgToLoad,
+ XalanDOMString&
theResultMessage,
+ const XalanDOMString& repText1,
+ const XalanDOMString& repText2,
+ const XalanDOMString& repText3);
protected:
- virtual bool loadMsg
- (
- XalanMessages::Codes msgToLoad,
- XalanDOMChar* toFill,
- unsigned int maxChars) =0;
+
+ virtual bool
+ loadMsg(
+ XalanMessages::Codes msgToLoad,
+ XalanDOMChar* toFill,
+ unsigned int maxChars) = 0;
private:
- bool load(XalanMessages::Codes msgToLoad,
- XalanDOMChar* toFill,
- unsigned int maxChars,
- const XalanDOMChar* repText1 ,
- const XalanDOMChar* repText2 = 0,
- const XalanDOMChar* repText3 = 0,
- const XalanDOMChar* repText4 = 0
- );
+ bool
+ load(
+ XalanMessages::Codes msgToLoad,
+ MemoryManager&
theMemoryManager,
+ XalanDOMChar* toFill,
+ unsigned int maxChars,
+ const XalanDOMChar* repText1,
+ const XalanDOMChar* repText2 = 0,
+ const XalanDOMChar* repText3 = 0,
+ const XalanDOMChar* repText4 = 0);
- bool load(XalanMessages::Codes msgToLoad,
- MemoryManagerType& theManager,
- XalanDOMChar* toFill,
- unsigned int maxChars,
- const char* repText1 ,
- const char* repText2 = 0,
- const char* repText3 = 0,
- const char* repText4 = 0);
+ bool
+ load(
+ XalanMessages::Codes msgToLoad,
+ MemoryManagerType&
theManager,
+ XalanDOMChar* toFill,
+ unsigned int
maxChars,
+ const char*
repText1 ,
+ const char*
repText2 = 0,
+ const char*
repText3 = 0,
+ const char*
repText4 = 0);
XalanMessageLoader(const XalanMessageLoader&);
1.11 +5 -5
xml-xalan/c/src/xalanc/PlatformSupport/XalanOutputStream.hpp
Index: XalanOutputStream.hpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/PlatformSupport/XalanOutputStream.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XalanOutputStream.hpp 8 Nov 2004 18:11:05 -0000 1.10
+++ XalanOutputStream.hpp 22 Apr 2005 20:52:41 -0000 1.11
@@ -48,7 +48,7 @@
{
public :
- enum { eDefaultBufferSize = 512, eDefaultTranscoderBlockSize = 1024 };
+ enum { eDefaultBufferSize = 512u, eDefaultTranscoderBlockSize = 1024u };
typedef XalanVector<XalanDOMChar> BufferType;
typedef XalanVector<char>
TranscodeVectorType;
@@ -64,10 +64,10 @@
*/
explicit
XalanOutputStream(
- MemoryManagerType& theManager,
- size_type theBufferSize = eDefaultBufferSize,
- size_type theTranscoderBlockSize =
eDefaultTranscoderBlockSize,
- bool fThrowTranscodeException = true);
+ MemoryManagerType& theManager,
+ size_type theBufferSize =
eDefaultBufferSize,
+ size_type theTranscoderBlockSize =
eDefaultTranscoderBlockSize,
+ bool fThrowTranscodeException =
true);
virtual
~XalanOutputStream();
1.9 +2 -3
xml-xalan/c/src/xalanc/PlatformSupport/XalanTranscodingServices.cpp
Index: XalanTranscodingServices.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/PlatformSupport/XalanTranscodingServices.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XalanTranscodingServices.cpp 8 Nov 2004 18:11:05 -0000 1.8
+++ XalanTranscodingServices.cpp 22 Apr 2005 20:52:41 -0000 1.9
@@ -267,9 +267,8 @@
XMLPlatformUtils::fgTransService->makeNewTranscoderFor(
c_wstr(theEncodingName),
theCode,
-// A glitch in Xerces 2.3 omits the default parameter, so
-// we have to provide one.
-#if XERCES_VERSION_MAJOR == 2 && XERCES_VERSION_MINOR == 3
+
+#if _XERCES_VERSION >= 2030
theBlockSize,
&theManager);
#else
1.1
xml-xalan/c/src/xalanc/PlatformSupport/XalanMemoryManagerDefault.cpp
Index: XalanMemoryManagerDefault.cpp
===================================================================
/*
* Copyright 2003,2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "XalanMemoryManagerDefault.hpp"
#include "xercesc/util/OutOfMemoryException.hpp"
XALAN_CPP_NAMESPACE_BEGIN
XalanMemoryManagerDefault::XalanMemoryManagerDefault()
{
}
XalanMemoryManagerDefault::~XalanMemoryManagerDefault()
{
}
void*
XalanMemoryManagerDefault::allocate(size_t size)
{
XALAN_USING_XERCES(OutOfMemoryException)
void* thePointer;
try
{
thePointer = ::operator new(size);
}
catch(...)
{
throw OutOfMemoryException();
}
if (thePointer != 0)
{
return thePointer;
}
throw OutOfMemoryException();
}
void
XalanMemoryManagerDefault::deallocate(void* pointer)
{
::operator delete(pointer);
}
XALAN_CPP_NAMESPACE_END
1.1
xml-xalan/c/src/xalanc/PlatformSupport/XalanMemoryManagerDefault.hpp
Index: XalanMemoryManagerDefault.hpp
===================================================================
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(XALANMEMORYMANAGERDEFAULT_HEADER_GUARD_1357924680)
#define XALANMEMORYMANAGERDEFAULT_HEADER_GUARD_1357924680
// Base include file. Must be first.
#include <xalanc/PlatformSupport/PlatformSupportDefinitions.hpp>
#include <xercesc/framework/MemoryManager.hpp>
XALAN_CPP_NAMESPACE_BEGIN
XALAN_USING_XERCES(MemoryManager)
class XALAN_PLATFORMSUPPORT_EXPORT XalanMemoryManagerDefault : public
MemoryManager
{
public:
XalanMemoryManagerDefault();
virtual
~XalanMemoryManagerDefault();
virtual void*
allocate(size_t size);
virtual void
deallocate(void* pointer);
private:
// These are not implemented.
XalanMemoryManagerDefault(const XalanMemoryManagerDefault&);
XalanMemoryManagerDefault&
operator=(const XalanMemoryManagerDefault&);
};
XALAN_CPP_NAMESPACE_END
#endif // XALANMEMORYMANAGERDEFAULT_HEADER_GUARD_1357924680
1.28 +31 -21 xml-xalan/c/src/xalanc/XSLT/XSLTEngineImpl.cpp
Index: XSLTEngineImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/XSLTEngineImpl.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- XSLTEngineImpl.cpp 31 Jan 2005 15:38:23 -0000 1.27
+++ XSLTEngineImpl.cpp 22 Apr 2005 20:52:41 -0000 1.28
@@ -420,7 +420,9 @@
const XalanDOMString& xsldocURLString,
StylesheetConstructionContext& constructionContext)
{
- const XSLTInputSource input(c_wstr(xsldocURLString));
+ const XSLTInputSource input(
+ c_wstr(xsldocURLString),
+ constructionContext.getMemoryManager());
return processStylesheet(input, constructionContext);
}
@@ -643,7 +645,7 @@
if (theResolver == 0)
{
- const XSLTInputSource inputSource(c_wstr(urlString));
+ const XSLTInputSource inputSource(c_wstr(urlString),
m_parserLiaison.getMemoryManager());
doc = parseXML(inputSource, docHandler, docToRegister);
}
@@ -661,7 +663,7 @@
}
else
{
- const XSLTInputSource
inputSource(c_wstr(urlString));
+ const XSLTInputSource
inputSource(c_wstr(urlString), m_parserLiaison.getMemoryManager());
doc = parseXML(
inputSource,
@@ -687,14 +689,12 @@
DocumentHandlerType* docHandler,
XalanDocument* docToRegister)
{
- XalanDOMString theEmptyString(getMemoryManager());
-
if(0 != docHandler)
{
m_parserLiaison.parseXMLStream(
inputSource,
*docHandler,
- theEmptyString);
+ s_emptyString);
return docToRegister;
}
@@ -702,7 +702,7 @@
{
return m_parserLiaison.parseXMLStream(
inputSource,
- theEmptyString);
+ s_emptyString);
}
}
@@ -716,7 +716,10 @@
bool
isRoot,
StylesheetConstructionContext& constructionContext)
{
- Stylesheet* stylesheet = 0;
+ MemoryManager& theMemoryManager =
+ constructionContext.getMemoryManager();
+
+ Stylesheet* stylesheet = 0;
const CCGetAndReleaseCachedString theGuard(constructionContext);
XalanDOMString & stringHolder = theGuard.get();
@@ -790,9 +793,9 @@
ds.append("id(");
ds += fragID;
- ds +=
XalanDOMString(XALAN_STATIC_UCODE_STRING(")"),getMemoryManager());
+ ds += XalanDOMString(XALAN_STATIC_UCODE_STRING(")"),
theMemoryManager);
- ElementPrefixResolverProxy theProxy( nsNode,
m_xpathEnvSupport, m_domSupport, getMemoryManager());
+ ElementPrefixResolverProxy theProxy(nsNode,
m_xpathEnvSupport, m_domSupport, theMemoryManager);
XPathExecutionContextDefault
theExecutionContext(m_xpathEnvSupport,
m_domSupport,
@@ -804,7 +807,7 @@
const XObjectPtr xobj(evalXPathStr(ds,
theExecutionContext));
assert(xobj.null() == false);
- NodeRefList nl( xobj->nodeset(),
constructionContext.getMemoryManager());
+ NodeRefList nl( xobj->nodeset(), theMemoryManager);
if(nl.getLength() == 0)
{
@@ -874,12 +877,12 @@
stylesheet = constructionContext.create(
*const_cast<StylesheetRoot*>(m_stylesheetRoot), stringHolder);
#endif
- theGuard.reset(&(constructionContext.getMemoryManager()),
stylesheet);
+ theGuard.reset(&theMemoryManager, stylesheet);
}
StylesheetHandler stylesheetProcessor(*stylesheet,
constructionContext);
- FormatterTreeWalker tw(stylesheetProcessor,
getMemoryManager());
+ FormatterTreeWalker tw(stylesheetProcessor,
theMemoryManager);
stylesheetProcessor.startDocument();
@@ -975,13 +978,17 @@
}
else
{
+ stylesheet = Stylesheet::create(
+ theMemoryManager,
#if defined(XALAN_OLD_STYLE_CASTS)
- stylesheet = Stylesheet::create( getMemoryManager(),
*(StylesheetRoot*)m_stylesheetRoot, localXSLURLString, constructionContext);
+ *(StylesheetRoot*)m_stylesheetRoot,
#else
- stylesheet = Stylesheet::create( getMemoryManager(),
*const_cast<StylesheetRoot*>(m_stylesheetRoot), localXSLURLString,
constructionContext);
+ *const_cast<StylesheetRoot*>(m_stylesheetRoot),
#endif
+ localXSLURLString,
+ constructionContext);
- theGuard.reset(&(getMemoryManager()), stylesheet);
+ theGuard.reset(&theMemoryManager, stylesheet);
}
StylesheetHandler stylesheetProcessor(*stylesheet,
constructionContext);
@@ -990,11 +997,9 @@
URLAutoPtrType
xslURL(constructionContext.getURLFromString(localXSLURLString));
- XSLTInputSource inputSource(xslURL->getURLText());
-
- XalanDOMString theEmptyString( getMemoryManager());
+ XSLTInputSource inputSource(xslURL->getURLText(),
theMemoryManager);
- m_parserLiaison.parseXMLStream(inputSource,
stylesheetProcessor, theEmptyString);
+ m_parserLiaison.parseXMLStream(inputSource,
stylesheetProcessor, s_emptyString);
stylesheet->postConstruction(constructionContext);
@@ -1004,7 +1009,12 @@
{
const CCGetAndReleaseCachedString theGuard(constructionContext);
-
displayDuration(XalanMessageLoader::getMessage(XalanMessages::ParsingAndInitOf_1Param,
theGuard.get(),localXSLURLString),&localXSLURLString);
+ displayDuration(
+ XalanMessageLoader::getMessage(
+ XalanMessages::ParsingAndInitOf_1Param,
+ theGuard.get(),
+ localXSLURLString),
+ &localXSLURLString);
}
}
1.7 +3 -6
xml-xalan/c/src/xalanc/XSLT/XSLTProcessorEnvSupportDefault.cpp
Index: XSLTProcessorEnvSupportDefault.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/XSLT/XSLTProcessorEnvSupportDefault.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XSLTProcessorEnvSupportDefault.cpp 14 Nov 2004 21:13:08 -0000
1.6
+++ XSLTProcessorEnvSupportDefault.cpp 22 Apr 2005 20:52:41 -0000
1.7
@@ -142,7 +142,6 @@
const URLAutoPtrType xslURL =
URISupport::getURLFromString(urlString, base,
theManager);
- // $$$ ToDo: Explicit XalanDOMString constructor
const XalanDOMString urlText(xslURL->getURLText(),
theManager);
// First see if it's already been parsed...
@@ -161,11 +160,9 @@
if (theResolver == 0)
{
- const XSLTInputSource
inputSource(c_wstr(urlText));
+ const XSLTInputSource
inputSource(c_wstr(urlText), theManager);
-
-
- theDocument =
parserLiaison.parseXMLStream(inputSource, theEmptyString);
+ theDocument = parserLiaison.parseXMLStream(inputSource,
theEmptyString);
}
else
{
@@ -180,7 +177,7 @@
}
else
{
- const XSLTInputSource
inputSource(c_wstr(urlText));
+ const XSLTInputSource
inputSource(c_wstr(urlText), theManager);
theDocument =
parserLiaison.parseXMLStream(inputSource, theEmptyString);
}
1.6 +68 -27 xml-xalan/c/src/xalanc/XalanTransformer/XalanCAPI.cpp
Index: XalanCAPI.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanCAPI.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XalanCAPI.cpp 8 Nov 2004 19:20:04 -0000 1.5
+++ XalanCAPI.cpp 22 Apr 2005 20:52:41 -0000 1.6
@@ -43,10 +43,11 @@
XALAN_USING_XALAN(XalanParsedSource)
XALAN_USING_XALAN(XalanTransformer)
XALAN_USING_XERCES(XMLPlatformUtils)
-XALAN_USING_XALAN(MemoryManagerType)
+XALAN_USING_XERCES(MemoryManager)
XALAN_USING_XALAN(XalanMemMgrAutoPtr)
XALAN_USING_XALAN(XalanMemMgrs)
+XALAN_USING_XALAN(XSLTInputSource)
XALAN_USING_XALAN(XSLTResultTarget)
static bool fInitialized = false;
@@ -97,8 +98,10 @@
XALAN_TRANSFORMER_EXPORT_FUNCTION(XalanHandle)
CreateXalanTransformer()
{
- MemoryManagerType& theManager = XalanMemMgrs::getDefaultXercesMemMgr();
- // Create a XalanTransformer object.
+ MemoryManager& theManager =
+ XalanMemMgrs::getDefaultXercesMemMgr();
+
+ // Create a XalanTransformer object.
typedef XalanTransformer ThisType;
XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager ,
(ThisType*)theManager.allocate(sizeof(ThisType)));
@@ -183,14 +186,14 @@
if(theXSLFileName == 0)
{
return getTransformer(theXalanHandle)->transform(
- theXMLFileName,
+ XSLTInputSource(theXMLFileName,
XalanMemMgrs::getDefaultXercesMemMgr()),
XSLTResultTarget(theOutFileName,
XalanMemMgrs::getDefaultXercesMemMgr()));
}
else
{
return getTransformer(theXalanHandle)->transform(
- theXMLFileName,
- theXSLFileName,
+ XSLTInputSource(theXMLFileName,
XalanMemMgrs::getDefaultXercesMemMgr()),
+ XSLTInputSource(theXSLFileName,
XalanMemMgrs::getDefaultXercesMemMgr()),
XSLTResultTarget(theOutFileName,
XalanMemMgrs::getDefaultXercesMemMgr()));
}
}
@@ -226,18 +229,26 @@
ostrstream theOutputStream;
+ XalanTransformer* const theTransformer =
+ getTransformer(theXalanHandle);
+
+ MemoryManager& theMemoryManager =
+ theTransformer->getMemoryManager();
+
if(theXSLFileName == 0)
{
- status = getTransformer(theXalanHandle)->transform(
- theXMLFileName,
- XSLTResultTarget(theOutputStream,
XalanMemMgrs::getDefaultXercesMemMgr()));
+ status =
+ theTransformer->transform(
+ XSLTInputSource(theXMLFileName, theMemoryManager),
+ XSLTResultTarget(theOutputStream,
theMemoryManager));
}
else
{
- status = getTransformer(theXalanHandle)->transform(
- theXMLFileName,
- theXSLFileName,
- XSLTResultTarget(theOutputStream,
XalanMemMgrs::getDefaultXercesMemMgr()));
+ status =
+ theTransformer->transform(
+ XSLTInputSource(theXMLFileName, theMemoryManager),
+ XSLTInputSource(theXSLFileName, theMemoryManager),
+ XSLTResultTarget(theOutputStream,
theMemoryManager));
}
if (status == 0)
@@ -302,13 +313,19 @@
XalanOutputHandlerType theOutputHandler,
XalanFlushHandlerType theFlushHandler)
{
+ XalanTransformer* const theTransformer =
+ getTransformer(theXalanHandle);
+
+ MemoryManager& theMemoryManager =
+ theTransformer->getMemoryManager();
+
// Do the transformation...
- return getTransformer(theXalanHandle)->transform(
- theXMLFileName,
- theXSLFileName,
- theOutputHandle,
- theOutputHandler,
- theFlushHandler);
+ return theTransformer->transform(
+ XSLTInputSource(theXMLFileName, theMemoryManager),
+ XSLTInputSource(theXSLFileName, theMemoryManager),
+ theOutputHandle,
+ theOutputHandler,
+ theFlushHandler);
}
@@ -339,11 +356,17 @@
XalanHandle theXalanHandle,
XalanCSSHandle* theCSSHandle)
{
+ XalanTransformer* const theTransformer =
+ getTransformer(theXalanHandle);
+
+ MemoryManager& theMemoryManager =
+ theTransformer->getMemoryManager();
+
const XalanCompiledStylesheet* theCompiledStylesheet = 0;
const int theResult =
- getTransformer(theXalanHandle)->compileStylesheet(
- theXSLFileName,
+ theTransformer->compileStylesheet(
+ XSLTInputSource(theXSLFileName, theMemoryManager),
theCompiledStylesheet);
if (theResult == 0)
@@ -363,13 +386,19 @@
XalanHandle theXalanHandle,
XalanCSSHandle* theCSSHandle)
{
+ XalanTransformer* const theTransformer =
+ getTransformer(theXalanHandle);
+
+ MemoryManager& theMemoryManager =
+ theTransformer->getMemoryManager();
+
const XalanCompiledStylesheet* theCompiledStylesheet = 0;
istrstream theInputStream(theXSLStream, theXSLStreamLength);
const int theResult =
- getTransformer(theXalanHandle)->compileStylesheet(
- &theInputStream,
+ theTransformer->compileStylesheet(
+ XSLTInputSource(theInputStream, theMemoryManager),
theCompiledStylesheet);
if (theResult == 0)
@@ -398,11 +427,17 @@
XalanHandle theXalanHandle,
XalanPSHandle* thePSHandle)
{
+ XalanTransformer* const theTransformer =
+ getTransformer(theXalanHandle);
+
+ MemoryManager& theMemoryManager =
+ theTransformer->getMemoryManager();
+
const XalanParsedSource* theParsedSource = 0;
const int theResult =
- getTransformer(theXalanHandle)->parseSource(
- theXMLFileName,
+ theTransformer->parseSource(
+ XSLTInputSource(theXMLFileName, theMemoryManager),
theParsedSource);
if (theResult == 0)
@@ -422,13 +457,19 @@
XalanHandle theXalanHandle,
XalanPSHandle* thePSHandle)
{
+ XalanTransformer* const theTransformer =
+ getTransformer(theXalanHandle);
+
+ MemoryManager& theMemoryManager =
+ theTransformer->getMemoryManager();
+
const XalanParsedSource* theParsedSource = 0;
istrstream theInputStream(theXMLStream, theXMLStreamLength);
const int theResult =
- getTransformer(theXalanHandle)->parseSource(
- &theInputStream,
+ theTransformer->parseSource(
+ XSLTInputSource(theInputStream, theMemoryManager),
theParsedSource);
if (theResult == 0)
1.21 +2 -2
xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformer.cpp
Index: XalanTransformer.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformer.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- XalanTransformer.cpp 10 Nov 2004 19:09:12 -0000 1.20
+++ XalanTransformer.cpp 22 Apr 2005 20:52:41 -0000 1.21
@@ -197,7 +197,7 @@
{
// Initialize Xalan.
XalanMemMgrAutoPtr<XSLTInit, true>
initGuard(theManager, XSLTInit::create(theManager));
- XalanAutoPtr<XSLTInputSource> inputSourceGuard(new (&theManager)
XSLTInputSource);
+ XalanAutoPtr<XSLTInputSource> inputSourceGuard(new (&theManager)
XSLTInputSource(theManager));
EnsureFunctionsInstallation instalGuard(theManager);
instalGuard.install();
@@ -1256,7 +1256,7 @@
}
// Create an input source for the source document...
- XSLTInputSource
theDocumentInputSource(theSourceDocument);
+ XSLTInputSource
theDocumentInputSource(theSourceDocument, m_memoryManager);
// Set the system ID, so relative URIs are resolved properly...
theDocumentInputSource.setSystemId(c_wstr(theSourceURI));
1.14 +10 -8
xml-xalan/c/src/xalanc/XercesParserLiaison/XercesParserLiaison.cpp
Index: XercesParserLiaison.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/xalanc/XercesParserLiaison/XercesParserLiaison.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- XercesParserLiaison.cpp 18 Apr 2005 16:57:50 -0000 1.13
+++ XercesParserLiaison.cpp 22 Apr 2005 20:52:41 -0000 1.14
@@ -721,18 +721,16 @@
XercesParserLiaison::DOMParserType*
XercesParserLiaison::createDOMParser()
{
- DOMParserType* const theParser = new
DOMParserType(0,&(getMemoryManager()));
+ MemoryManagerType& theMemoryManager =
+ getMemoryManager();
+
+ DOMParserType* const theParser =
+ new (&theMemoryManager) DOMParserType(0, &theMemoryManager);
theParser->setExpandEntityReferences(true);
theParser->setDoNamespaces(m_doNamespaces);
theParser->setEntityResolver(m_entityResolver);
-#if XERCES_VERSION_MAJOR < 2
- // Xerces has a non-standard node type to represent the XML decl.
- // Why did they ever do this?
- theParser->setToCreateXMLDeclTypeNode(false);
-#endif
-
return theParser;
}
@@ -741,7 +739,11 @@
XercesParserLiaison::SAXParserType*
XercesParserLiaison::createSAXParser()
{
- SAXParserType* const theParser = new
SAXParserType(0,&(getMemoryManager()));
+ MemoryManagerType& theMemoryManager =
+ getMemoryManager();
+
+ SAXParserType* const theParser =
+ new (&theMemoryManager) SAXParserType(0, &theMemoryManager);
theParser->setDoValidation(false);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]