You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by kn...@apache.org on 2003/05/15 20:37:50 UTC
cvs commit: xml-xerces/c/src/xercesc/util/Platforms/Win32 Win32PlatformUtils.cpp
knoaman 2003/05/15 11:37:50
Modified: c/src/xercesc/util/Platforms/AIX AIXPlatformUtils.cpp
c/src/xercesc/util/Platforms/BeOS BeOSPlatformUtils.cpp
c/src/xercesc/util/Platforms/FreeBSD
FreeBSDPlatformUtils.cpp
c/src/xercesc/util/Platforms/HPUX HPPlatformUtils.cpp
c/src/xercesc/util/Platforms/IRIX IRIXPlatformUtils.cpp
c/src/xercesc/util/Platforms/Linux LinuxPlatformUtils.cpp
c/src/xercesc/util/Platforms/MacOS MacAbstractFile.hpp
MacOSPlatformUtils.cpp
c/src/xercesc/util/Platforms/OS2 OS2PlatformUtils.cpp
c/src/xercesc/util/Platforms/OS390 FileHandleImpl.hpp
OS390PlatformUtils.cpp
c/src/xercesc/util/Platforms/OS400 OS400PlatformUtils.cpp
c/src/xercesc/util/Platforms/OpenServer
OpenServerPlatformUtils.cpp
c/src/xercesc/util/Platforms/QNX QNXPlatformUtils.cpp
c/src/xercesc/util/Platforms/Solaris
SolarisPlatformUtils.cpp
c/src/xercesc/util/Platforms/Tandem TandemPlatformUtils.cpp
c/src/xercesc/util/Platforms/Tru64 Tru64PlatformUtils.cpp
c/src/xercesc/util/Platforms/UnixWare
UnixWarePlatformUtils.cpp
c/src/xercesc/util/Platforms/Win32 Win32PlatformUtils.cpp
Log:
Partial implementation of the configurable memory manager.
Revision Changes Path
1.15 +12 -11 xml-xerces/c/src/xercesc/util/Platforms/AIX/AIXPlatformUtils.cpp
Index: AIXPlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/AIX/AIXPlatformUtils.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- AIXPlatformUtils.cpp 25 Apr 2003 17:18:39 -0000 1.14
+++ AIXPlatformUtils.cpp 15 May 2003 18:37:47 -0000 1.15
@@ -220,8 +220,8 @@
FileHandle XMLPlatformUtils::openFile(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fMemoryManager);
FileHandle retVal = (FILE*)fopen( tmpFileName , "rb" );
if (retVal == NULL)
@@ -240,8 +240,8 @@
FileHandle XMLPlatformUtils::openFileToWrite(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
return fopen( tmpFileName , "wb" );
}
@@ -310,7 +310,8 @@
// ---------------------------------------------------------------------------
// XMLPlatformUtils: File system methods
// ---------------------------------------------------------------------------
-XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath)
+XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
+ MemoryManager* const manager)
{
//
@@ -318,8 +319,8 @@
// so we know that its not some pathological freaky path. It comes in
// in native format, and goes out as Unicode always
//
- char* newSrc = XMLString::transcode(srcPath);
- ArrayJanitor<char> janText(newSrc);
+ char* newSrc = XMLString::transcode(srcPath, fgMemoryManager);
+ ArrayJanitor<char> janText(newSrc, fgMemoryManager);
// Use a local buffer that is big enough for the largest legal path
char absPath[PATH_MAX + 1];
@@ -331,7 +332,7 @@
ThrowXML(XMLPlatformUtilsException,
XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(absPath);
+ return XMLString::transcode(absPath, manager);
}
bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck)
@@ -352,7 +353,7 @@
return true;
}
-XMLCh* XMLPlatformUtils::getCurrentDirectory()
+XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
{
char dirBuf[PATH_MAX + 1];
char *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
@@ -363,7 +364,7 @@
XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(curDir);
+ return XMLString::transcode(curDir, manager);
}
inline bool XMLPlatformUtils::isAnySlash(XMLCh c)
1.7 +14 -10 xml-xerces/c/src/xercesc/util/Platforms/BeOS/BeOSPlatformUtils.cpp
Index: BeOSPlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/BeOS/BeOSPlatformUtils.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- BeOSPlatformUtils.cpp 25 Apr 2003 17:18:53 -0000 1.6
+++ BeOSPlatformUtils.cpp 15 May 2003 18:37:47 -0000 1.7
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.7 2003/05/15 18:37:47 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.6 2003/04/25 17:18:53 peiyongz
* throw exception if getcwd() fails
*
@@ -271,8 +274,8 @@
FileHandle XMLPlatformUtils::openFile(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
FileHandle retVal = (FILE*)fopen( tmpFileName , "rb" );
if (retVal == NULL)
@@ -291,8 +294,8 @@
FileHandle XMLPlatformUtils::openFileToWrite(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
return fopen( tmpFileName , "wb" );
}
@@ -369,7 +372,8 @@
// ---------------------------------------------------------------------------
// XMLPlatformUtils: File system methods
// ---------------------------------------------------------------------------
-XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath)
+XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
+ MemoryManager* const manager)
{
//
@@ -377,8 +381,8 @@
// so we know that its not some pathological freaky path. It comes in
// in native format, and goes out as Unicode always
//
- char* newSrc = XMLString::transcode(srcPath);
- ArrayJanitor<char> janText(newSrc);
+ char* newSrc = XMLString::transcode(srcPath, fgMemoryManager);
+ ArrayJanitor<char> janText(newSrc, fgMemoryManager);
// Use a local buffer that is big enough for the largest legal path
char absPath[PATH_MAX + 1];
@@ -389,7 +393,7 @@
{
ThrowXML(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(absPath);
+ return XMLString::transcode(absPath, manager);
}
bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck)
@@ -410,7 +414,7 @@
return true;
}
-XMLCh* XMLPlatformUtils::getCurrentDirectory()
+XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
{
char dirBuf[PATH_MAX + 1];
char *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
@@ -421,7 +425,7 @@
XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(curDir);
+ return XMLString::transcode(curDir, manager);
}
inline bool XMLPlatformUtils::isAnySlash(XMLCh c)
1.13 +14 -10 xml-xerces/c/src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp
Index: FreeBSDPlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- FreeBSDPlatformUtils.cpp 25 Apr 2003 17:19:10 -0000 1.12
+++ FreeBSDPlatformUtils.cpp 15 May 2003 18:37:47 -0000 1.13
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.13 2003/05/15 18:37:47 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.12 2003/04/25 17:19:10 peiyongz
* throw exception if getcwd() fails
*
@@ -293,8 +296,8 @@
if (fileName == NULL)
ThrowXML(XMLPlatformUtilsException,
XMLExcepts::CPtr_PointerIsZero);
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
FileHandle retVal = (FileHandle)fopen( tmpFileName , "r+" );
return retVal;
}
@@ -313,8 +316,8 @@
if (fileName == NULL)
ThrowXML(XMLPlatformUtilsException,
XMLExcepts::CPtr_PointerIsZero);
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
return fopen( tmpFileName , "w" );
}
@@ -405,7 +408,8 @@
// ---------------------------------------------------------------------------
// XMLPlatformUtils: File system methods
// ---------------------------------------------------------------------------
-XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath)
+XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
+ MemoryManager* const manager)
{
//
@@ -413,8 +417,8 @@
// so we know that its not some pathological freaky path. It comes in
// in native format, and goes out as Unicode always
//
- char* newSrc = XMLString::transcode(srcPath);
- ArrayJanitor<char> janText(newSrc);
+ char* newSrc = XMLString::transcode(srcPath, fgMemoryManager);
+ ArrayJanitor<char> janText(newSrc, fgMemoryManager);
// Use a local buffer that is big enough for the largest legal path
char absPath[PATH_MAX + 1];
@@ -425,7 +429,7 @@
{
ThrowXML(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(absPath);
+ return XMLString::transcode(absPath, manager);
}
bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck)
@@ -446,7 +450,7 @@
return true;
}
-XMLCh* XMLPlatformUtils::getCurrentDirectory()
+XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
{
char dirBuf[PATH_MAX + 1];
char *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
@@ -457,7 +461,7 @@
XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(curDir);
+ return XMLString::transcode(curDir, manager);
}
inline bool XMLPlatformUtils::isAnySlash(XMLCh c)
1.13 +14 -10 xml-xerces/c/src/xercesc/util/Platforms/HPUX/HPPlatformUtils.cpp
Index: HPPlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/HPUX/HPPlatformUtils.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- HPPlatformUtils.cpp 25 Apr 2003 17:19:26 -0000 1.12
+++ HPPlatformUtils.cpp 15 May 2003 18:37:48 -0000 1.13
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.13 2003/05/15 18:37:48 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.12 2003/04/25 17:19:26 peiyongz
* throw exception if getcwd() fails
*
@@ -362,16 +365,16 @@
FileHandle XMLPlatformUtils::openFile(const XMLCh* const fileName)
{
- char* tmpFileName = XMLString::transcode(fileName);
+ char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
FileHandle retVal = (FILE*) fopen(tmpFileName , "rb");
- delete [] tmpFileName;
+ fgMemoryManager->deallocate(tmpFileName);//delete [] tmpFileName;
return retVal;
}
FileHandle XMLPlatformUtils::openFileToWrite(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
return fopen( tmpFileName , "wb" );
}
@@ -449,7 +452,8 @@
// ---------------------------------------------------------------------------
// XMLPlatformUtils: File system methods
// ---------------------------------------------------------------------------
-XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath)
+XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
+ MemoryManager* const manager)
{
@@ -458,8 +462,8 @@
// so we know that its not some pathological freaky path. It comes in
// in native format, and goes out as Unicode always
//
- char* newSrc = XMLString::transcode(srcPath);
- ArrayJanitor<char> janText(newSrc);
+ char* newSrc = XMLString::transcode(srcPath, fgMemoryManager);
+ ArrayJanitor<char> janText(newSrc, fgMemoryManager);
// Use a local buffer that is big enough for the largest legal path
char absPath[PATH_MAX + 1];
@@ -470,7 +474,7 @@
{
ThrowXML(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(absPath);
+ return XMLString::transcode(absPath, manager);
}
@@ -492,7 +496,7 @@
return true;
}
-XMLCh* XMLPlatformUtils::getCurrentDirectory()
+XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
{
char dirBuf[PATH_MAX + 1];
char *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
@@ -503,7 +507,7 @@
XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(curDir);
+ return XMLString::transcode(curDir, manager);
}
inline bool XMLPlatformUtils::isAnySlash(XMLCh c)
1.12 +14 -10 xml-xerces/c/src/xercesc/util/Platforms/IRIX/IRIXPlatformUtils.cpp
Index: IRIXPlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/IRIX/IRIXPlatformUtils.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- IRIXPlatformUtils.cpp 25 Apr 2003 17:19:40 -0000 1.11
+++ IRIXPlatformUtils.cpp 15 May 2003 18:37:48 -0000 1.12
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.12 2003/05/15 18:37:48 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.11 2003/04/25 17:19:40 peiyongz
* throw exception if getcwd() fails
*
@@ -316,8 +319,8 @@
FileHandle XMLPlatformUtils::openFile(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
FileHandle retVal = (FILE*)fopen( tmpFileName , "rb" );
if (retVal == NULL)
@@ -338,8 +341,8 @@
FileHandle XMLPlatformUtils::openFileToWrite(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
return fopen( tmpFileName , "wb" );
}
@@ -422,7 +425,8 @@
// ---------------------------------------------------------------------------
// XMLPlatformUtils: File system methods
// ---------------------------------------------------------------------------
-XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath)
+XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
+ MemoryManager* const manager)
{
//
@@ -430,8 +434,8 @@
// so we know that its not some pathological freaky path. It comes in
// in native format, and goes out as Unicode always
//
- char* newSrc = XMLString::transcode(srcPath);
- ArrayJanitor<char> janText(newSrc);
+ char* newSrc = XMLString::transcode(srcPath, fgMemoryManager);
+ ArrayJanitor<char> janText(newSrc, fgMemoryManager);
// Use a local buffer that is big enough for the largest legal path
char absPath[PATH_MAX + 1];
@@ -442,7 +446,7 @@
{
ThrowXML(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(absPath);
+ return XMLString::transcode(absPath, manager);
}
bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck)
@@ -463,7 +467,7 @@
return true;
}
-XMLCh* XMLPlatformUtils::getCurrentDirectory()
+XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
{
char dirBuf[PATH_MAX + 1];
char *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
@@ -474,7 +478,7 @@
XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(curDir);
+ return XMLString::transcode(curDir, manager);
}
inline bool XMLPlatformUtils::isAnySlash(XMLCh c)
1.16 +14 -10 xml-xerces/c/src/xercesc/util/Platforms/Linux/LinuxPlatformUtils.cpp
Index: LinuxPlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/Linux/LinuxPlatformUtils.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- LinuxPlatformUtils.cpp 25 Apr 2003 17:19:53 -0000 1.15
+++ LinuxPlatformUtils.cpp 15 May 2003 18:37:48 -0000 1.16
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.16 2003/05/15 18:37:48 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.15 2003/04/25 17:19:53 peiyongz
* throw exception if getcwd() fails
*
@@ -367,8 +370,8 @@
FileHandle XMLPlatformUtils::openFile(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
FileHandle retVal = (FILE*)fopen( tmpFileName , "rb" );
if (retVal == NULL)
@@ -387,8 +390,8 @@
FileHandle XMLPlatformUtils::openFileToWrite(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
return fopen( tmpFileName , "wb" );
}
@@ -465,7 +468,8 @@
// ---------------------------------------------------------------------------
// XMLPlatformUtils: File system methods
// ---------------------------------------------------------------------------
-XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath)
+XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
+ MemoryManager* const manager)
{
//
@@ -473,8 +477,8 @@
// so we know that its not some pathological freaky path. It comes in
// in native format, and goes out as Unicode always
//
- char* newSrc = XMLString::transcode(srcPath);
- ArrayJanitor<char> janText(newSrc);
+ char* newSrc = XMLString::transcode(srcPath, fgMemoryManager);
+ ArrayJanitor<char> janText(newSrc, fgMemoryManager);
// Use a local buffer that is big enough for the largest legal path
char absPath[PATH_MAX + 1];
@@ -485,7 +489,7 @@
{
ThrowXML(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(absPath);
+ return XMLString::transcode(absPath, manager);
}
bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck)
@@ -506,7 +510,7 @@
return true;
}
-XMLCh* XMLPlatformUtils::getCurrentDirectory()
+XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
{
char dirBuf[PATH_MAX + 1];
char *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
@@ -517,7 +521,7 @@
XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(curDir);
+ return XMLString::transcode(curDir, manager);
}
inline bool XMLPlatformUtils::isAnySlash(XMLCh c)
1.2 +3 -3 xml-xerces/c/src/xercesc/util/Platforms/MacOS/MacAbstractFile.hpp
Index: MacAbstractFile.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/MacOS/MacAbstractFile.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MacAbstractFile.hpp 23 Feb 2003 04:41:26 -0000 1.1
+++ MacAbstractFile.hpp 15 May 2003 18:37:48 -0000 1.2
@@ -60,12 +60,12 @@
#pragma once
-#include <xercesc/util/XercesDefs.hpp>
+#include <xercesc/util/XMemory.hpp>
XERCES_CPP_NAMESPACE_BEGIN
// Abstract class for files. This could be used to allow multiple file paradigms.
-class XMLMacAbstractFile
+class XMLMacAbstractFile : public XMemory
{
public:
XMLMacAbstractFile() {}
1.17 +39 -19 xml-xerces/c/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.cpp
Index: MacOSPlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/MacOS/MacOSPlatformUtils.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- MacOSPlatformUtils.cpp 27 Apr 2003 17:28:43 -0000 1.16
+++ MacOSPlatformUtils.cpp 15 May 2003 18:37:48 -0000 1.17
@@ -128,7 +128,8 @@
XMLCh* XMLCreateFullPathFromFSRef_X(const FSRef& startingRef);
XMLCh* XMLCreateFullPathFromFSRef_Classic(const FSRef& startingRef);
-XMLCh* XMLCreateFullPathFromFSSpec_Classic(const FSSpec& startingSpec);
+XMLCh* XMLCreateFullPathFromFSSpec_Classic(const FSSpec& startingSpec,
+ MemoryManager* const manager);
bool XMLParsePathToFSRef_X(const XMLCh* const pathName, FSRef& ref);
bool XMLParsePathToFSRef_Classic(const XMLCh* const pathName, FSRef& ref);
bool XMLParsePathToFSSpec_Classic(const XMLCh* const pathName, FSSpec& spec);
@@ -304,7 +305,8 @@
// XMLPlatformUtils: File system methods
// ---------------------------------------------------------------------------
XMLCh*
-XMLPlatformUtils::getFullPath(const XMLCh* const srcPath)
+XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
+ MemoryManager* const manager)
{
XMLCh* path = NULL;
@@ -312,13 +314,13 @@
{
FSRef ref;
if (!XMLParsePathToFSRef(srcPath, ref) || (path = XMLCreateFullPathFromFSRef(ref)) == NULL)
- path = XMLString::replicate(srcPath);
+ path = XMLString::replicate(srcPath, manager);
}
else
{
FSSpec spec;
- if (!XMLParsePathToFSSpec(srcPath, spec) || (path = XMLCreateFullPathFromFSSpec(spec)) == NULL)
- path = XMLString::replicate(srcPath);
+ if (!XMLParsePathToFSSpec(srcPath, spec) || (path = XMLCreateFullPathFromFSSpec(spec, manager)) == NULL)
+ path = XMLString::replicate(srcPath, manager);
}
return path;
@@ -332,13 +334,13 @@
}
-XMLCh* XMLPlatformUtils::getCurrentDirectory()
+XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
{
// Get a newly allocated path to the current directory
FSSpec spec;
XMLCh* path =
(noErr == FSMakeFSSpec(0, 0, NULL, &spec))
- ? XMLCreateFullPathFromFSSpec(spec)
+ ? XMLCreateFullPathFromFSSpec(spec, manager)
: NULL;
if (!path)
@@ -998,8 +1000,8 @@
// Manually parse the path using FSSpec APIs.
// Transcode the path into ascii
- const char* p = XMLString::transcode(pathName);
- ArrayJanitor<const char> janPath(p);
+ const char* p = XMLString::transcode(pathName, fgMemoryManager);
+ ArrayJanitor<const char> janPath(p, fgMemoryManager);
const char* pEnd;
std::size_t segLen;
@@ -1201,7 +1203,7 @@
uniBuf[pathLen++] = 0;
// Transcode into a dynamically allocated buffer of XMLChs
- ArrayJanitor<XMLCh> result(new XMLCh[pathLen]);
+ ArrayJanitor<XMLCh> result((XMLCh*) fgMemoryManager->allocate(pathLen * sizeof(XMLCh))/*new XMLCh[pathLen]*/, fgMemoryManager);
if (result.get() != NULL)
CopyUniCharsToXMLChs(uniBuf, result.get(), pathLen, pathLen);
@@ -1245,7 +1247,11 @@
// name plus separator, dump it to the dynamic result buffer.
if (bufPos < (std::size_t)name.length + 1)
{
- ArrayJanitor<XMLCh> temp(new XMLCh[bufCnt + resultLen]);
+ ArrayJanitor<XMLCh> temp
+ (
+ (XMLCh*) fgMemoryManager->allocate((bufCnt + resultLen) * sizeof(XMLCh));//new XMLCh[bufCnt + resultLen]
+ , fgMemoryManager
+ );
// Copy in the static buffer
std::memcpy(temp.get(), &buf[bufPos], bufCnt * sizeof(XMLCh));
@@ -1273,7 +1279,11 @@
while (err == noErr && catalogInfo.parentDirID != fsRtParID);
// Composite existing buffer + any previous result buffer
- ArrayJanitor<XMLCh> final(new XMLCh[bufCnt + resultLen]);
+ ArrayJanitor<XMLCh> final
+ (
+ (XMLCh*) fgMemoryManager->allocate((bufCnt + resultLen) * sizeof(XMLCh))//new XMLCh[bufCnt + resultLen]
+ , fgMemoryManager
+ );
// Copy in the static buffer
std::memcpy(final.get(), &buf[bufPos], bufCnt * sizeof(XMLCh));
@@ -1287,7 +1297,8 @@
XMLCh*
-XMLCreateFullPathFromFSSpec(const FSSpec& startingSpec)
+XMLCreateFullPathFromFSSpec(const FSSpec& startingSpec,
+ MemoryManager* const manager)
{
XMLCh* result = NULL;
@@ -1310,7 +1321,7 @@
else
{
// Create using FSSpecs only
- result = XMLCreateFullPathFromFSSpec_Classic(startingSpec);
+ result = XMLCreateFullPathFromFSSpec_Classic(startingSpec, manager);
}
return result;
@@ -1318,7 +1329,8 @@
XMLCh*
-XMLCreateFullPathFromFSSpec_Classic(const FSSpec& startingSpec)
+XMLCreateFullPathFromFSSpec_Classic(const FSSpec& startingSpec,
+ MemoryManager* const manager)
{
// Manually create the path using FSSpec APIs.
OSStatus err = noErr;
@@ -1352,7 +1364,11 @@
// name plus separator, dump it to the dynamic result buffer.
if (bufPos < nameLen + 1)
{
- ArrayJanitor<char> temp(new char[bufCnt + resultLen]);
+ ArrayJanitor<char> temp
+ (
+ (char*) fgMemoryManager->allocate((bufCnt + resultLen) * sizeof(char))//new char[bufCnt + resultLen]
+ , fgMemoryManager
+ );
// Copy in the static buffer
std::memcpy(temp.get(), &buf[bufPos], bufCnt);
@@ -1384,7 +1400,11 @@
while (err == noErr && spec.parID != fsRtParID);
// Composite existing buffer with any previous result buffer
- ArrayJanitor<char> final(new char[bufCnt + resultLen]);
+ ArrayJanitor<char> final
+ (
+ (char*) fgMemoryManager->allocate((bufCnt + resultLen) * sizeof(char))//new char[bufCnt + resultLen]
+ , fgMemoryManager
+ );
// Copy in the static buffer
std::memcpy(final.get(), &buf[bufPos], bufCnt);
@@ -1394,7 +1414,7 @@
std::memcpy(final.get() + bufCnt, result.get(), resultLen);
// Cleanup and transcode to unicode
- return XMLString::transcode(final.get());
+ return XMLString::transcode(final.get(), manager);
}
1.6 +10 -9 xml-xerces/c/src/xercesc/util/Platforms/OS2/OS2PlatformUtils.cpp
Index: OS2PlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/OS2/OS2PlatformUtils.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- OS2PlatformUtils.cpp 28 Apr 2003 22:03:28 -0000 1.5
+++ OS2PlatformUtils.cpp 15 May 2003 18:37:48 -0000 1.6
@@ -148,8 +148,8 @@
FileHandle XMLPlatformUtils::openFile(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
FileHandle retVal = (FILE*)fopen( tmpFileName , "rb" );
if (retVal == NULL)
@@ -188,16 +188,17 @@
// -----------------------------------------------------------------------
// File system methods
// -----------------------------------------------------------------------
-XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath)
+XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
+ MemoryManager* const manager)
{
// Transcode the incoming string
- char* tmpSrcPath = XMLString::transcode(srcPath);
- ArrayJanitor<char> janSrcPath(tmpSrcPath);
+ char* tmpSrcPath = XMLString::transcode(srcPath, fgMemoryManager);
+ ArrayJanitor<char> janSrcPath(tmpSrcPath, fgMemoryManager);
char tmpPath[CCHMAXPATH];
_fullpath(tmpPath, tmpSrcPath, CCHMAXPATH);
- return XMLString::transcode(tmpPath);
+ return XMLString::transcode(tmpPath, manager);
}
bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck)
@@ -232,7 +233,7 @@
return true;
}
-XMLCh* XMLPlatformUtils::getCurrentDirectory()
+XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
{
/***
@@ -242,7 +243,7 @@
***/
XMLCh curDir[]={ chPeriod, chForwardSlash, chNull};
- return getFullPath(curDir);
+ return getFullPath(curDir, manager);
}
inline bool XMLPlatformUtils::isAnySlash(XMLCh c)
1.2 +3 -3 xml-xerces/c/src/xercesc/util/Platforms/OS390/FileHandleImpl.hpp
Index: FileHandleImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/OS390/FileHandleImpl.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FileHandleImpl.hpp 22 Nov 2002 14:57:32 -0000 1.1
+++ FileHandleImpl.hpp 15 May 2003 18:37:48 -0000 1.2
@@ -61,11 +61,11 @@
#ifndef FILEHANDLEIMPL_HPP
#define FILEHANDLEIMPL_HPP
-#include <xercesc/util/XercesDefs.hpp>
+#include <xercesc/util/XMemory.hpp>
XERCES_CPP_NAMESPACE_BEGIN
-class FileHandleImpl
+class FileHandleImpl : public XMemory
{
private:
FILE* Handle; // handle from fopen
1.10 +36 -26 xml-xerces/c/src/xercesc/util/Platforms/OS390/OS390PlatformUtils.cpp
Index: OS390PlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/OS390/OS390PlatformUtils.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- OS390PlatformUtils.cpp 24 Apr 2003 02:56:44 -0000 1.9
+++ OS390PlatformUtils.cpp 15 May 2003 18:37:48 -0000 1.10
@@ -301,8 +301,8 @@
optionBufferSize += (strlen(pathobj.getfopenParms()) + 1);
}
- char* optionBuffer = new char[optionBufferSize];
- ArrayJanitor<char> janText((char*)optionBuffer);
+ char* optionBuffer = (char*) fgMemoryManager->allocate(optionBufferSize * sizeof(char));//new char[optionBufferSize];
+ ArrayJanitor<char> janText((char*)optionBuffer, fgMemoryManager);
strcpy(optionBuffer,"rb");
// Build the options buffer
@@ -360,8 +360,11 @@
// path/path2/filename.ext => //path.path2.ext(filename)
// path/path2/filename => //path.path2.filename
- char* datasetName = new char[ strlen(tmpFileName) + 5 ];
- ArrayJanitor<char> janText1((char*)datasetName);
+ char* datasetName = (char*) fgMemoryManager->allocate
+ (
+ (strlen(tmpFileName) + 5) * sizeof(char)
+ );//new char[ strlen(tmpFileName) + 5 ];
+ ArrayJanitor<char> janText1((char*)datasetName, fgMemoryManager);
char *datasetPos = datasetName, *tmpPos = tmpFileName;
// We are in EBCDIC mode here
@@ -499,8 +502,8 @@
if (pathobj.getfopenParms())
optionBufferSize += (strlen(pathobj.getfopenParms()) + 1);
- char* optionBuffer = new char[optionBufferSize];
- ArrayJanitor<char> janText((char*)optionBuffer);
+ char* optionBuffer = (char*) fgMemoryManager->allocate((optionBufferSize) * sizeof(char));//new char[optionBufferSize];
+ ArrayJanitor<char> janText((char*)optionBuffer, fgMemoryManager);
strcpy(optionBuffer,"wb");
// Build the options buffer
@@ -638,8 +641,8 @@
FileHandle XMLPlatformUtils::openFile(const XMLCh* const fileName)
{
- char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
return openRead(tmpFileName);
}
@@ -647,8 +650,11 @@
FileHandle XMLPlatformUtils::openFile(const char* const fileName)
{
- char* tmpFileName = new char[strlen(fileName) + 1];
- ArrayJanitor<char> janText((char*)tmpFileName);
+ char* tmpFileName = (char*) fgMemoryManager->allocate
+ (
+ (strlen(fileName) + 1) * sizeof(char)
+ );//new char[strlen(fileName) + 1];
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
strcpy(tmpFileName,fileName);
return openRead(tmpFileName);
@@ -657,8 +663,8 @@
FileHandle XMLPlatformUtils::openFileToWrite(const XMLCh* const fileName)
{
- char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
return openWrite(tmpFileName);
}
@@ -666,8 +672,11 @@
FileHandle XMLPlatformUtils::openFileToWrite(const char* const fileName)
{
- char* tmpFileName = new char[strlen(fileName) + 1];
- ArrayJanitor<char> janText((char*)tmpFileName);
+ char* tmpFileName = (char*) fgMemoryManager->allocate
+ (
+ (strlen(fileName) + 1) * sizeof(char)
+ );//new char[strlen(fileName) + 1];
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
strcpy(tmpFileName,fileName);
return openWrite(tmpFileName);
@@ -833,7 +842,8 @@
// ---------------------------------------------------------------------------
// XMLPlatformUtils: File system methods
// ---------------------------------------------------------------------------
-XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath)
+XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
+ MemoryManager* const manager)
{
//
@@ -841,16 +851,16 @@
// so we know that its not some pathological freaky path. It comes in
// in native format, and goes out as Unicode always
//
- char* newSrc = XMLString::transcode(srcPath);
- ArrayJanitor<char> janText(newSrc);
+ char* newSrc = XMLString::transcode(srcPath, fgMemoryManager);
+ ArrayJanitor<char> janText(newSrc, fgMemoryManager);
Path390 pathobj;
pathobj.setPath(newSrc);
char* retPath = 0;
// Use a local buffer that is big enough for the largest legal path
- char *absPath = new char[_POSIX_PATH_MAX];
- ArrayJanitor<char> janText2(absPath);
+ char *absPath = (char*) fgMemoryManager->allocate((_POSIX_PATH_MAX) * sizeof(char));//new char[_POSIX_PATH_MAX];
+ ArrayJanitor<char> janText2(absPath, fgMemoryManager);
if ( (pathobj.getPathType() == PATH390_HFS) || (pathobj.getPathType() == PATH390_OTHER) ) {
//get the absolute path
@@ -858,9 +868,9 @@
if (!retPath) {
ThrowXML(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(absPath);
+ return XMLString::transcode(absPath, manager);
}
- return XMLString::transcode(newSrc);
+ return XMLString::transcode(newSrc, manager);
}
bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck)
@@ -893,8 +903,8 @@
return false;
}
- char* tmpFileName = XMLString::transcode(toCheck);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ char* tmpFileName = XMLString::transcode(toCheck, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
Path390 pathobj;
pathobj.setPath(tmpFileName);
@@ -903,7 +913,7 @@
}
-XMLCh* XMLPlatformUtils::getCurrentDirectory()
+XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
{
/***
@@ -913,7 +923,7 @@
***/
XMLCh curDir[]={ chPeriod, chForwardSlash, chNull};
- return getFullPath(curDir);
+ return getFullPath(curDir, manager);
}
inline bool XMLPlatformUtils::isAnySlash(XMLCh c)
1.11 +13 -12 xml-xerces/c/src/xercesc/util/Platforms/OS400/OS400PlatformUtils.cpp
Index: OS400PlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/OS400/OS400PlatformUtils.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- OS400PlatformUtils.cpp 1 May 2003 21:12:40 -0000 1.10
+++ OS400PlatformUtils.cpp 15 May 2003 18:37:49 -0000 1.11
@@ -249,8 +249,8 @@
#include <qusec.h>
FileHandle XMLPlatformUtils::openFile(const XMLCh* const fileName)
{ char errno_id[7];
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
errno = 0;
FileHandle retVal = (FILE*)fopen( tmpFileName , "rb" );
@@ -281,8 +281,8 @@
FileHandle XMLPlatformUtils::openFileToWrite(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
return openFileToWrite(tmpFileName);
}
@@ -393,7 +393,8 @@
-XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath)
+XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
+ MemoryManager* const manager)
{
//
@@ -401,8 +402,8 @@
// so we know that its not some pathological freaky path. It comes in
// in native format, and goes out as Unicode always
//
- char* newSrc = XMLString::transcode(srcPath);
- ArrayJanitor<char> janText(newSrc);
+ char* newSrc = XMLString::transcode(srcPath, fgMemoryManager);
+ ArrayJanitor<char> janText(newSrc, fgMemoryManager);
// Use a local buffer that is big enough for the largest legal path
char absPath[PATH_MAX + 1];
//get the absolute path
@@ -412,7 +413,7 @@
{
ThrowXML(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(absPath);
+ return XMLString::transcode(absPath, manager);
}
@@ -434,7 +435,7 @@
return true;
}
-XMLCh* XMLPlatformUtils::getCurrentDirectory()
+XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
{
char dirBuf[PATH_MAX + 1];
char *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
@@ -445,7 +446,7 @@
XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(curDir);
+ return XMLString::transcode(curDir, manager);
}
inline bool XMLPlatformUtils::isAnySlash(XMLCh c)
@@ -577,7 +578,7 @@
}
}
-class RecursiveMutex
+class RecursiveMutex : public XMemory
{
public:
pthread_mutex_t mutex;
1.8 +20 -13 xml-xerces/c/src/xercesc/util/Platforms/OpenServer/OpenServerPlatformUtils.cpp
Index: OpenServerPlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/OpenServer/OpenServerPlatformUtils.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- OpenServerPlatformUtils.cpp 25 Apr 2003 17:20:11 -0000 1.7
+++ OpenServerPlatformUtils.cpp 15 May 2003 18:37:49 -0000 1.8
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.8 2003/05/15 18:37:49 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.7 2003/04/25 17:20:11 peiyongz
* throw exception if getcwd() fails
*
@@ -246,8 +249,8 @@
FileHandle XMLPlatformUtils::openFile(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
FileHandle retVal = (FILE*)fopen(tmpFileName , "rb");
if (retVal == NULL)
@@ -268,8 +271,8 @@
FileHandle XMLPlatformUtils::openFileToWrite(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
return fopen( tmpFileName , "wb" );
}
@@ -343,21 +346,25 @@
// ---------------------------------------------------------------------------
// XMLPlatformUtils: File system methods
// ---------------------------------------------------------------------------
-XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath)
+XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
+ MemoryManager* const manager)
{
//
// NOTE: The path provided has always already been opened successfully,
// so we know that its not some pathological freaky path. It comes in
// in native format, and goes out as Unicode always
//
- char* newSrc = XMLString::transcode(srcPath);
- ArrayJanitor<char> janText(newSrc);
+ char* newSrc = XMLString::transcode(srcPath, fgMemoryManager);
+ ArrayJanitor<char> janText(newSrc, fgMemoryManager);
// Use a local buffer that is big enough for the largest legal path
// Without the *3 we get exceptions with gcc on OpenServer 5.0.5/6 when
// relative paths are passed in
- char *absPath = new char[pathconf(newSrc, _PC_PATH_MAX)*3];
- ArrayJanitor<char> janText2(absPath);
+ char *absPath = (char*) fgMemoryManager->allocate
+ (
+ (pathconf(newSrc, _PC_PATH_MAX)*3) * sizeof(char)
+ );//new char[pathconf(newSrc, _PC_PATH_MAX)*3];
+ ArrayJanitor<char> janText2(absPath, fgMemoryManager);
// Get the absolute path
char* retPath = realpath(newSrc, absPath);
@@ -366,7 +373,7 @@
ThrowXML(XMLPlatformUtilsException,
XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(absPath);
+ return XMLString::transcode(absPath, manager);
}
bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck)
@@ -387,7 +394,7 @@
return true;
}
-XMLCh* XMLPlatformUtils::getCurrentDirectory()
+XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
{
char dirBuf[PATH_MAX + 1];
char *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
@@ -398,7 +405,7 @@
XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(curDir);
+ return XMLString::transcode(curDir, manager);
}
inline bool XMLPlatformUtils::isAnySlash(XMLCh c)
@@ -448,7 +455,7 @@
// -----------------------------------------------------------------------
// Mutex- and atomic operation methods
// -----------------------------------------------------------------------
-class RecursiveMutex
+class RecursiveMutex : public XMemory
{
public:
pthread_mutex_t mutex;
1.5 +12 -11 xml-xerces/c/src/xercesc/util/Platforms/QNX/QNXPlatformUtils.cpp
Index: QNXPlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/QNX/QNXPlatformUtils.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- QNXPlatformUtils.cpp 25 Apr 2003 17:20:45 -0000 1.4
+++ QNXPlatformUtils.cpp 15 May 2003 18:37:49 -0000 1.5
@@ -157,8 +157,8 @@
FileHandle XMLPlatformUtils::openFile(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
return openFile( tmpFileName );
}
@@ -169,8 +169,8 @@
FileHandle XMLPlatformUtils::openFileToWrite(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
return openFileToWrite(tmpFileName);
}
@@ -218,15 +218,16 @@
// ---------------------------------------------------------------------------
// XMLPlatformUtils: File system methods
// ---------------------------------------------------------------------------
-XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath)
+XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
+ MemoryManager* const manager)
{
//
// NOTE: THe path provided has always already been opened successfully,
// so we know that its not some pathological freaky path. It comes in
// in native format, and goes out as Unicode always
//
- char* newSrc = XMLString::transcode(srcPath);
- ArrayJanitor<char> janText(newSrc);
+ char* newSrc = XMLString::transcode(srcPath, fgMemoryManager);
+ ArrayJanitor<char> janText(newSrc, fgMemoryManager);
char absPath[PATH_MAX + 1];
char* retPath = realpath(newSrc, &absPath[0]);
@@ -235,7 +236,7 @@
ThrowXML(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(absPath);
+ return XMLString::transcode(absPath, manager);
}
@@ -246,7 +247,7 @@
return true;
}
-XMLCh* XMLPlatformUtils::getCurrentDirectory()
+XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
{
char dirBuf[PATH_MAX + 1];
char *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
@@ -257,7 +258,7 @@
XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(curDir);
+ return XMLString::transcode(curDir, manager);
}
inline bool XMLPlatformUtils::isAnySlash(XMLCh c)
1.14 +12 -11 xml-xerces/c/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp
Index: SolarisPlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- SolarisPlatformUtils.cpp 25 Apr 2003 17:21:01 -0000 1.13
+++ SolarisPlatformUtils.cpp 15 May 2003 18:37:49 -0000 1.14
@@ -248,8 +248,8 @@
FileHandle XMLPlatformUtils::openFile(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
FileHandle retVal = (FILE*)fopen( tmpFileName , "rb" );
if (retVal == NULL)
@@ -259,8 +259,8 @@
FileHandle XMLPlatformUtils::openFileToWrite(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
return fopen( tmpFileName , "wb" );
}
@@ -333,15 +333,16 @@
// ---------------------------------------------------------------------------
// XMLPlatformUtils: File system methods
// ---------------------------------------------------------------------------
-XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath)
+XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
+ MemoryManager* const manager)
{
//
// NOTE: THe path provided has always already been opened successfully,
// so we know that its not some pathological freaky path. It comes in
// in native format, and goes out as Unicode always
//
- char* newSrc = XMLString::transcode(srcPath);
- ArrayJanitor<char> janText(newSrc);
+ char* newSrc = XMLString::transcode(srcPath, fgMemoryManager);
+ ArrayJanitor<char> janText(newSrc, fgMemoryManager);
// Use a local buffer that is big enough for the largest legal path
char absPath[PATH_MAX + 1];
@@ -352,7 +353,7 @@
{
ThrowXML(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(absPath);
+ return XMLString::transcode(absPath, manager);
}
bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck)
@@ -373,7 +374,7 @@
return true;
}
-XMLCh* XMLPlatformUtils::getCurrentDirectory()
+XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
{
char dirBuf[PATH_MAX + 1];
char *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
@@ -384,7 +385,7 @@
XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(curDir);
+ return XMLString::transcode(curDir, manager);
}
inline bool XMLPlatformUtils::isAnySlash(XMLCh c)
1.9 +14 -6 xml-xerces/c/src/xercesc/util/Platforms/Tandem/TandemPlatformUtils.cpp
Index: TandemPlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/Tandem/TandemPlatformUtils.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- TandemPlatformUtils.cpp 24 Apr 2003 02:58:31 -0000 1.8
+++ TandemPlatformUtils.cpp 15 May 2003 18:37:49 -0000 1.9
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.9 2003/05/15 18:37:49 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.8 2003/04/24 02:58:31 peiyongz
* Logical Path Resolution
*
@@ -207,7 +210,8 @@
FileHandle XMLPlatformUtils::openFile(const unsigned short* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> tmpFileNameJan((char*)tmpFileName , fgMemoryManager);
FileHandle retVal = (FILE*)fopen( tmpFileName , "rb" );
if (retVal == NULL)
@@ -242,7 +246,8 @@
// ---------------------------------------------------------------------------
// XMLPlatformUtils: File system methods
// ---------------------------------------------------------------------------
-XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath)
+XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
+ MemoryManager* const manager)
{
//
@@ -250,7 +255,7 @@
// so we know that its not some pathological freaky path. It comes in
// in native format, and goes out as Unicode always
//
- char* newSrc = XMLString::transcode(srcPath);
+ char* newSrc = XMLString::transcode(srcPath, fgMemoryManager);
// Use a local buffer that is big enough for the largest legal path
char* tmpPath = dirname((char*)newSrc);
@@ -259,12 +264,15 @@
throw XMLPlatformUtilsException("XMLPlatformUtils::resetFile - Could not get the base path name");
}
- char* newXMLString = new char [strlen(tmpPath) +1];
- ArrayJanitor<char> newJanitor(newXMLString);
+ char* newXMLString = (char*) fgMemoryManager->allocate
+ (
+ (strlen(tmpPath) +1) * sizeof(char)
+ );//new char [strlen(tmpPath) +1];
+ ArrayJanitor<char> newJanitor(newXMLString, fgMemoryManager);
strcpy(newXMLString, tmpPath);
strcat(newXMLString , "/");
// Return a copy of the path, in Unicode format
- return XMLString::transcode(newXMLString);
+ return XMLString::transcode(newXMLString, manager);
}
bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck)
1.10 +12 -11 xml-xerces/c/src/xercesc/util/Platforms/Tru64/Tru64PlatformUtils.cpp
Index: Tru64PlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/Tru64/Tru64PlatformUtils.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Tru64PlatformUtils.cpp 25 Apr 2003 17:21:16 -0000 1.9
+++ Tru64PlatformUtils.cpp 15 May 2003 18:37:49 -0000 1.10
@@ -248,8 +248,8 @@
FileHandle XMLPlatformUtils::openFile(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
FileHandle retVal = (FILE*)fopen( tmpFileName , "rb" );
if (retVal == NULL)
@@ -259,8 +259,8 @@
FileHandle XMLPlatformUtils::openFileToWrite(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
return fopen( tmpFileName , "wb" );
}
@@ -332,15 +332,16 @@
// ---------------------------------------------------------------------------
// XMLPlatformUtils: File system methods
// ---------------------------------------------------------------------------
-XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath)
+XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
+ MemoryManager* const manager)
{
//
// NOTE: THe path provided has always already been opened successfully,
// so we know that its not some pathological freaky path. It comes in
// in native format, and goes out as Unicode always
//
- char* newSrc = XMLString::transcode(srcPath);
- ArrayJanitor<char> janText(newSrc);
+ char* newSrc = XMLString::transcode(srcPath, fgMemoryManager);
+ ArrayJanitor<char> janText(newSrc, fgMemoryManager);
// Use a local buffer that is big enough for the largest legal path
char absPath[PATH_MAX + 1];
@@ -352,7 +353,7 @@
ThrowXML(XMLPlatformUtilsException,
XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(absPath);
+ return XMLString::transcode(absPath, manager);
}
bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck)
@@ -373,7 +374,7 @@
return true;
}
-XMLCh* XMLPlatformUtils::getCurrentDirectory()
+XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
{
char dirBuf[PATH_MAX + 1];
char *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
@@ -384,7 +385,7 @@
XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(curDir);
+ return XMLString::transcode(curDir, manager);
}
inline bool XMLPlatformUtils::isAnySlash(XMLCh c)
1.10 +15 -11 xml-xerces/c/src/xercesc/util/Platforms/UnixWare/UnixWarePlatformUtils.cpp
Index: UnixWarePlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/UnixWare/UnixWarePlatformUtils.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- UnixWarePlatformUtils.cpp 25 Apr 2003 17:21:31 -0000 1.9
+++ UnixWarePlatformUtils.cpp 15 May 2003 18:37:49 -0000 1.10
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.10 2003/05/15 18:37:49 knoaman
+ * Partial implementation of the configurable memory manager.
+ *
* Revision 1.9 2003/04/25 17:21:31 peiyongz
* throw exception if getcwd() fails
*
@@ -299,8 +302,8 @@
FileHandle XMLPlatformUtils::openFile(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
FileHandle retVal = (FILE*)fopen( tmpFileName , "rb" );
if (retVal == NULL)
@@ -319,8 +322,8 @@
FileHandle XMLPlatformUtils::openFileToWrite(const XMLCh* const fileName)
{
- const char* tmpFileName = XMLString::transcode(fileName);
- ArrayJanitor<char> janText((char*)tmpFileName);
+ const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
+ ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
return fopen( tmpFileName , "wb" );
}
@@ -397,15 +400,16 @@
// ---------------------------------------------------------------------------
// XMLPlatformUtils: File system methods
// ---------------------------------------------------------------------------
-XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath)
+XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
+ MemoryManager* const manager)
{
//
// NOTE: The path provided has always already been opened successfully,
// so we know that its not some pathological freaky path. It comes in
// in native format, and goes out as Unicode always
//
- char* newSrc = XMLString::transcode(srcPath);
- ArrayJanitor<char> janText(newSrc);
+ char* newSrc = XMLString::transcode(srcPath, fgMemoryManager);
+ ArrayJanitor<char> janText(newSrc, fgMemoryManager);
// Use a local buffer that is big enough for the largest legal path
char absPath[PATH_MAX + 1];
@@ -417,7 +421,7 @@
ThrowXML(XMLPlatformUtilsException,
XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(absPath);
+ return XMLString::transcode(absPath, manager);
}
bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck)
@@ -438,7 +442,7 @@
return true;
}
-XMLCh* XMLPlatformUtils::getCurrentDirectory()
+XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
{
char dirBuf[PATH_MAX + 1];
char *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
@@ -449,7 +453,7 @@
XMLExcepts::File_CouldNotGetBasePathName);
}
- return XMLString::transcode(curDir);
+ return XMLString::transcode(curDir, manager);
}
inline bool XMLPlatformUtils::isAnySlash(XMLCh c)
@@ -496,7 +500,7 @@
panic( PanicHandler::Panic_SystemInit );
}
-class RecursiveMutex
+class RecursiveMutex : public XMemory
{
public:
pthread_mutex_t mutex;
1.20 +18 -17 xml-xerces/c/src/xercesc/util/Platforms/Win32/Win32PlatformUtils.cpp
Index: Win32PlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Platforms/Win32/Win32PlatformUtils.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- Win32PlatformUtils.cpp 24 Apr 2003 22:16:16 -0000 1.19
+++ Win32PlatformUtils.cpp 15 May 2003 18:37:49 -0000 1.20
@@ -292,7 +292,7 @@
//
if (*srcPtr)
{
- tmpUName = XMLString::replicate(nameToOpen);
+ tmpUName = XMLString::replicate(nameToOpen, fgMemoryManager);
XMLCh* tmpPtr = tmpUName;
while (*tmpPtr)
@@ -324,7 +324,7 @@
// We are Win 95 / 98. Take the Unicode file name back to (char *)
// so that we can open it.
//
- char* tmpName = XMLString::transcode(nameToOpen);
+ char* tmpName = XMLString::transcode(nameToOpen, fgMemoryManager);
retVal = ::CreateFileA
(
tmpName
@@ -335,11 +335,11 @@
, FILE_FLAG_SEQUENTIAL_SCAN
, 0
);
- delete [] tmpName;
+ fgMemoryManager->deallocate(tmpName);//delete [] tmpName;
}
if (tmpUName)
- delete [] tmpUName;
+ fgMemoryManager->deallocate(tmpUName);//delete [] tmpUName;
if (retVal == INVALID_HANDLE_VALUE)
return 0;
@@ -408,7 +408,7 @@
//
if (*srcPtr)
{
- tmpUName = XMLString::replicate(fileName);
+ tmpUName = XMLString::replicate(fileName, fgMemoryManager);
XMLCh* tmpPtr = tmpUName;
while (*tmpPtr)
@@ -440,7 +440,7 @@
// We are Win 95 / 98. Take the Unicode file name back to (char *)
// so that we can open it.
//
- char* tmpName = XMLString::transcode(nameToOpen);
+ char* tmpName = XMLString::transcode(nameToOpen, fgMemoryManager);
retVal = ::CreateFileA
(
tmpName
@@ -451,11 +451,11 @@
, FILE_ATTRIBUTE_NORMAL
, 0
);
- delete [] tmpName;
+ fgMemoryManager->deallocate(tmpName);//delete [] tmpName;
}
if (tmpUName)
- delete [] tmpUName;
+ fgMemoryManager->deallocate(tmpUName);//delete [] tmpUName;
if (retVal == INVALID_HANDLE_VALUE)
return 0;
@@ -554,7 +554,8 @@
// ---------------------------------------------------------------------------
// XMLPlatformUtils: File system methods
// ---------------------------------------------------------------------------
-XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath)
+XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
+ MemoryManager* const manager)
{
//
// If we are on NT, then use wide character APIs, else use ASCII APIs.
@@ -572,13 +573,13 @@
return 0;
// Return a copy of the path
- return XMLString::replicate(tmpPath);
+ return XMLString::replicate(tmpPath, manager);
}
else
{
// Transcode the incoming string
- char* tmpSrcPath = XMLString::transcode(srcPath);
- ArrayJanitor<char> janSrcPath(tmpSrcPath);
+ char* tmpSrcPath = XMLString::transcode(srcPath, fgMemoryManager);
+ ArrayJanitor<char> janSrcPath(tmpSrcPath, fgMemoryManager);
// Use a local buffer that is big enough for the largest legal path
const unsigned int bufSize = 511;
@@ -589,7 +590,7 @@
return 0;
// Return a transcoded copy of the path
- return XMLString::transcode(tmpPath);
+ return XMLString::transcode(tmpPath, manager);
}
}
@@ -625,7 +626,7 @@
return true;
}
-XMLCh* XMLPlatformUtils::getCurrentDirectory()
+XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
{
//
// If we are on NT, then use wide character APIs, else use ASCII APIs.
@@ -642,7 +643,7 @@
return 0;
// Return a copy of the path
- return XMLString::replicate(tmpPath);
+ return XMLString::replicate(tmpPath, manager);
}
else
{
@@ -655,7 +656,7 @@
return 0;
// Return a transcoded copy of the path
- return XMLString::transcode(tmpPath);
+ return XMLString::transcode(tmpPath, manager);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org