diff --git a/src/xercesc/dom/impl/DOMWriterImpl.cpp b/src/xercesc/dom/impl/DOMWriterImpl.cpp
index 675bba7238683ba12c410921f92f7aba1e86099c..ffef991b5ee3afe3f5f977996f74a1a57695ddc1 100644
--- a/src/xercesc/dom/impl/DOMWriterImpl.cpp
+++ b/src/xercesc/dom/impl/DOMWriterImpl.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 2002 The Apache Software Foundation.  All rights
+ * Copyright (c) 2002-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -57,6 +57,9 @@
 /*
  * $Id$
  * $Log$
+ * Revision 1.48  2004/01/13 16:34:20  cargilld
+ * Misc memory management changes.
+ *
  * Revision 1.47  2003/12/17 00:18:33  cargilld
  * Update to memory management so that the static memory manager (one used to call Initialize) is only for static data.
  *
@@ -540,8 +543,22 @@ void DOMWriterImpl::setFeature(const XMLCh* const featName
     if (!canSetFeature(featureId, state))
     {
         XMLCh  tmpbuf[256];
+        unsigned int strLen = XMLString::stringLen(gFeature) +
+                              XMLString::stringLen(featName) +
+                              XMLString::stringLen(gCantSet) +
+                              XMLString::stringLen(gFalse);
+
         XMLString::copyString(tmpbuf, gFeature);
-        XMLString::catString(tmpbuf, featName);
+        if (strLen < 256)
+        {
+            XMLString::catString(tmpbuf, featName);
+        }
+        else
+        {
+            // truncate the featurename to fit into the 256 buffer
+            XMLString::copyNString(tmpbuf+XMLString::stringLen(gFeature),
+                                   featName, 200);
+        }
         XMLString::catString(tmpbuf, gCantSet);
         XMLString::catString(tmpbuf, state? gTrue : gFalse);
         throw DOMException(DOMException::NOT_SUPPORTED_ERR, tmpbuf);
diff --git a/src/xercesc/internal/XMLGrammarPoolImpl.cpp b/src/xercesc/internal/XMLGrammarPoolImpl.cpp
index 42dc377c4519a548c2cc6624a3f8c842182edc96..13863b97da94d60a11de6f5b5aae2ac0b1cf36d8 100644
--- a/src/xercesc/internal/XMLGrammarPoolImpl.cpp
+++ b/src/xercesc/internal/XMLGrammarPoolImpl.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.17  2004/01/13 16:34:20  cargilld
+ * Misc memory management changes.
+ *
  * Revision 1.16  2003/12/17 00:18:34  cargilld
  * Update to memory management so that the static memory manager (one used to call Initialize) is only for static data.
  *
@@ -425,9 +428,9 @@ void XMLGrammarPoolImpl::deserializeGrammars(BinInputStream* const binIn)
             (Revision != gXercesRevision)   ||
             (SerializationLevel != (unsigned int) XERCES_GRAMMAR_SERIALIZATION_LEVEL))
         {
-            XMLCh     MajVerChar[4];
-            XMLCh     MinVerChar[4];
-            XMLCh     RevisionChar[4];
+            XMLCh     MajVerChar[5];
+            XMLCh     MinVerChar[5];
+            XMLCh     RevisionChar[5];
             XMLString::binToText(MajVer,   MajVerChar,   4, 10, memMgr);
             XMLString::binToText(MinVer,   MinVerChar,   4, 10, memMgr);
             XMLString::binToText(Revision, RevisionChar, 4, 10, memMgr);
diff --git a/src/xercesc/internal/XProtoType.cpp b/src/xercesc/internal/XProtoType.cpp
index 1ac92940a989b1edb4dfacd82e1e5df3acc9dc7b..6c515dd8e3cfe659bb910fa85361ce3926b304a4 100644
--- a/src/xercesc/internal/XProtoType.cpp
+++ b/src/xercesc/internal/XProtoType.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 2003 The Apache Software Foundation.  All rights
+ * Copyright (c) 2003-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -57,6 +57,9 @@
 /*
  * $Id$
  * $Log$
+ * Revision 1.4  2004/01/13 16:34:20  cargilld
+ * Misc memory management changes.
+ *
  * Revision 1.3  2003/12/24 15:24:13  cargilld
  * More updates to memory management so that the static memory manager.
  *
@@ -114,8 +117,8 @@ void XProtoType::load(XSerializeEngine& serEng
 
 	if (classNameLen != inNameLen)
     {
-        XMLCh value1[16];
-        XMLCh value2[16];
+        XMLCh value1[17];
+        XMLCh value2[17];
         XMLString::binToText(inNameLen,    value1, 16, 10, manager);
         XMLString::binToText(classNameLen, value2, 16, 10, manager);
 
diff --git a/src/xercesc/internal/XSerializeEngine.cpp b/src/xercesc/internal/XSerializeEngine.cpp
index 5b022f4c149ecc3e9d80ef70c77bf6cb738bdcd4..194eae16915086c362f0030f5a36959e480167cc 100644
--- a/src/xercesc/internal/XSerializeEngine.cpp
+++ b/src/xercesc/internal/XSerializeEngine.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 2003 The Apache Software Foundation.  All rights
+ * Copyright (c) 2003-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -57,6 +57,9 @@
 /*
  * $Id$
  * $Log$
+ * Revision 1.12  2004/01/13 16:34:20  cargilld
+ * Misc memory management changes.
+ *
  * Revision 1.11  2004/01/12 16:27:41  neilg
  * remove use of static buffers
  *
@@ -119,7 +122,7 @@ static const XSerializeEngine::XSerializedObjectId_t fgMaxObjectCount = 0x3FFFFF
 #define TEST_THROW_ARG1(condition, data, err_msg) \
 if (condition) \
 { \
-    XMLCh value1[16]; \
+    XMLCh value1[17]; \
     XMLString::binToText(data, value1, 16, 10, fMemoryManager); \
     ThrowXMLwithMemMgr1(XSerializationException \
             , err_msg  \
@@ -130,8 +133,8 @@ if (condition) \
 #define TEST_THROW_ARG2(condition, data1, data2, err_msg) \
 if (condition) \
 { \
-    XMLCh value1[16]; \
-    XMLCh value2[16]; \
+    XMLCh value1[17]; \
+    XMLCh value2[17]; \
     XMLString::binToText(data1, value1, 16, 10, fMemoryManager); \
     XMLString::binToText(data2, value2, 16, 10, fMemoryManager); \
     ThrowXMLwithMemMgr2(XSerializationException \
diff --git a/src/xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.cpp b/src/xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.cpp
index c7681da9d3faffcb894ed57ee398a78590fe6df2..7fc68c5d93b09220cdceb51aa209f54915c6ebe3 100644
--- a/src/xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.cpp
+++ b/src/xercesc/util/NetAccessors/Socket/UnixHTTPURLInputStream.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.14  2004/01/13 16:34:21  cargilld
+ * Misc memory management changes.
+ *
  * Revision 1.13  2003/12/24 15:24:13  cargilld
  * More updates to memory management so that the static memory manager.
  *
@@ -283,7 +286,7 @@ UnixHTTPURLInputStream::UnixHTTPURLInputStream(const XMLURL& urlSource)
     //  Convert port number integer to unicode so we can transcode it to ASCII
     //
 
-    XMLString::binToText((unsigned int) portNumber, portBuffer, bufSize, 10);
+    XMLString::binToText((unsigned int) portNumber, portBuffer, bufSize, 10, fMemoryManager);
     transSize = XMLString::stringLen(portBuffer)+1;
     char*               portAsASCII = (char*) fMemoryManager->allocate
     (
diff --git a/src/xercesc/util/Platforms/AIX/AIXPlatformUtils.cpp b/src/xercesc/util/Platforms/AIX/AIXPlatformUtils.cpp
index bbb1d83354a5760fbf6b4b406186d06db8f1f3b7..ebfd4d981316abb0257c6eeae73f98e452867c42 100644
--- a/src/xercesc/util/Platforms/AIX/AIXPlatformUtils.cpp
+++ b/src/xercesc/util/Platforms/AIX/AIXPlatformUtils.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -369,7 +369,7 @@ bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck
 
 XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
 {
-    char  dirBuf[PATH_MAX + 1];
+    char  dirBuf[PATH_MAX + 2];
     char  *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
 
     if (!curDir)
diff --git a/src/xercesc/util/Platforms/BeOS/BeOSPlatformUtils.cpp b/src/xercesc/util/Platforms/BeOS/BeOSPlatformUtils.cpp
index b6ba450703ffc53598a62fa24615b2677e85faac..1f6b4448b4a9c88397e86221c14f8c9abf21bca6 100644
--- a/src/xercesc/util/Platforms/BeOS/BeOSPlatformUtils.cpp
+++ b/src/xercesc/util/Platforms/BeOS/BeOSPlatformUtils.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 2002 The Apache Software Foundation.  All rights
+ * Copyright (c) 2002-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.13  2004/01/13 16:34:21  cargilld
+ * Misc memory management changes.
+ *
  * Revision 1.12  2004/01/06 17:31:20  neilg
  * fix static initialization problems, bug 28517; thanks to Reid Spencer
  *
@@ -447,7 +450,7 @@ bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck
 
 XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
 {
-    char  dirBuf[PATH_MAX + 1];
+    char  dirBuf[PATH_MAX + 2];
     char  *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
 
     if (!curDir)
diff --git a/src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp b/src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp
index 477c8e9792d5f88d809a4abc2b64aa1cdf13e458..10aaa513578878f9a0eee44961715527e3a3a753 100644
--- a/src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp
+++ b/src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 2001 The Apache Software Foundation.  All rights
+ * Copyright (c) 2001-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.21  2004/01/13 16:34:21  cargilld
+ * Misc memory management changes.
+ *
  * Revision 1.20  2004/01/06 17:31:20  neilg
  * fix static initialization problems, bug 28517; thanks to Reid Spencer
  *
@@ -490,7 +493,7 @@ bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck
 
 XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
 {
-    char  dirBuf[PATH_MAX + 1];
+    char  dirBuf[PATH_MAX + 2];
     char  *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
 
     if (!curDir)
diff --git a/src/xercesc/util/Platforms/HPUX/HPPlatformUtils.cpp b/src/xercesc/util/Platforms/HPUX/HPPlatformUtils.cpp
index e2932732e3d9d1576e9f0df5362abb9a27bf890d..4463ac9d85d58a9f9db8021bf186f738f46de5d6 100644
--- a/src/xercesc/util/Platforms/HPUX/HPPlatformUtils.cpp
+++ b/src/xercesc/util/Platforms/HPUX/HPPlatformUtils.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.19  2004/01/13 16:34:21  cargilld
+ * Misc memory management changes.
+ *
  * Revision 1.18  2004/01/06 17:31:20  neilg
  * fix static initialization problems, bug 28517; thanks to Reid Spencer
  *
@@ -528,7 +531,7 @@ bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck
 
 XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
 {
-    char  dirBuf[PATH_MAX + 1];
+    char  dirBuf[PATH_MAX + 2];
     char  *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
 
     if (!curDir)
diff --git a/src/xercesc/util/Platforms/IRIX/IRIXPlatformUtils.cpp b/src/xercesc/util/Platforms/IRIX/IRIXPlatformUtils.cpp
index af63c9c576d211d1143f16c09728b436a91a0dab..a215c9bec300f066807f7c26ce935193a52ddd27 100644
--- a/src/xercesc/util/Platforms/IRIX/IRIXPlatformUtils.cpp
+++ b/src/xercesc/util/Platforms/IRIX/IRIXPlatformUtils.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.19  2004/01/13 16:34:21  cargilld
+ * Misc memory management changes.
+ *
  * Revision 1.18  2004/01/06 17:31:20  neilg
  * fix static initialization problems, bug 28517; thanks to Reid Spencer
  *
@@ -503,7 +506,7 @@ bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck
 
 XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
 {
-    char  dirBuf[PATH_MAX + 1];
+    char  dirBuf[PATH_MAX + 2];
     char  *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
 
     if (!curDir)
diff --git a/src/xercesc/util/Platforms/Linux/LinuxPlatformUtils.cpp b/src/xercesc/util/Platforms/Linux/LinuxPlatformUtils.cpp
index 0ac570184228af1fa8e542df1b9c82a4be27bc04..98f49cc04c749d930f26b3a4723c8fc07394e6e3 100644
--- a/src/xercesc/util/Platforms/Linux/LinuxPlatformUtils.cpp
+++ b/src/xercesc/util/Platforms/Linux/LinuxPlatformUtils.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.22  2004/01/13 16:34:21  cargilld
+ * Misc memory management changes.
+ *
  * Revision 1.21  2004/01/06 17:31:20  neilg
  * fix static initialization problems, bug 28517; thanks to Reid Spencer
  *
@@ -543,7 +546,7 @@ bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck
 
 XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
 {
-    char  dirBuf[PATH_MAX + 1];
+    char  dirBuf[PATH_MAX + 2];
     char  *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
 
     if (!curDir)
diff --git a/src/xercesc/util/Platforms/NetBSD/NetBSDPlatformUtils.cpp b/src/xercesc/util/Platforms/NetBSD/NetBSDPlatformUtils.cpp
index e5a4b81c28f2b05d16eb85b75dfcdaccded186ff..838d6ef2521da901f98daf8af38ecc99d376d089 100644
--- a/src/xercesc/util/Platforms/NetBSD/NetBSDPlatformUtils.cpp
+++ b/src/xercesc/util/Platforms/NetBSD/NetBSDPlatformUtils.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  * 
- * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
@@ -480,7 +480,7 @@ bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck
 
 XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
 {
-    char  dirBuf[PATH_MAX + 1];
+    char  dirBuf[PATH_MAX + 2];
     char  *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
 
     if (!curDir)
diff --git a/src/xercesc/util/Platforms/OS390/OS390PlatformUtils.cpp b/src/xercesc/util/Platforms/OS390/OS390PlatformUtils.cpp
index f14b4d0a72ad0e276ff88d6a40f8d965343b734b..7b2e215009262b8fa30055234e5ffb2d96220bc8 100644
--- a/src/xercesc/util/Platforms/OS390/OS390PlatformUtils.cpp
+++ b/src/xercesc/util/Platforms/OS390/OS390PlatformUtils.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -883,7 +883,7 @@ XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath,
     pathobj.setPath(newSrc);
 
     // Use a local buffer that is big enough for the largest legal path
-    char *absPath = (char*) manager->allocate((_POSIX_PATH_MAX) * sizeof(char));//new char[_POSIX_PATH_MAX];
+    char *absPath = (char*) manager->allocate((_POSIX_PATH_MAX+1) * sizeof(char));//new char[_POSIX_PATH_MAX];
     ArrayJanitor<char> janText2(absPath, manager);
 
     if ( (pathobj.getPathType() == PATH390_HFS) || (pathobj.getPathType() == PATH390_OTHER) ) {
diff --git a/src/xercesc/util/Platforms/OS400/OS400PlatformUtils.cpp b/src/xercesc/util/Platforms/OS400/OS400PlatformUtils.cpp
index c723fabd57a9ad36c49ecc0958812de727a90f73..50da0e6b0fcef33a7bac5523b446f2f284910d25 100644
--- a/src/xercesc/util/Platforms/OS400/OS400PlatformUtils.cpp
+++ b/src/xercesc/util/Platforms/OS400/OS400PlatformUtils.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -453,7 +453,7 @@ bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck
 
 XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
 {
-    char  dirBuf[PATH_MAX + 1];
+    char  dirBuf[PATH_MAX + 2];
     char  *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
 
     if (!curDir)
diff --git a/src/xercesc/util/Platforms/OpenServer/OpenServerPlatformUtils.cpp b/src/xercesc/util/Platforms/OpenServer/OpenServerPlatformUtils.cpp
index 3bc883bb6e8a46f5b896ed53389a70f6bccaa1ed..83da5ff102f694ee8221ddec5a6c48a12042170f 100644
--- a/src/xercesc/util/Platforms/OpenServer/OpenServerPlatformUtils.cpp
+++ b/src/xercesc/util/Platforms/OpenServer/OpenServerPlatformUtils.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.14  2004/01/13 16:34:21  cargilld
+ * Misc memory management changes.
+ *
  * Revision 1.13  2003/12/24 15:24:14  cargilld
  * More updates to memory management so that the static memory manager.
  *
@@ -430,7 +433,7 @@ bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck
 
 XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
 {
-    char  dirBuf[PATH_MAX + 1];
+    char  dirBuf[PATH_MAX + 2];
     char  *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
 
     if (!curDir)
diff --git a/src/xercesc/util/Platforms/QNX/QNXPlatformUtils.cpp b/src/xercesc/util/Platforms/QNX/QNXPlatformUtils.cpp
index ba47e786b6bdd10bbfcfb8ef009e8109cf747457..b0ae1920c9bf7f7e3831758b6d074555964de942 100644
--- a/src/xercesc/util/Platforms/QNX/QNXPlatformUtils.cpp
+++ b/src/xercesc/util/Platforms/QNX/QNXPlatformUtils.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 2003 The Apache Software Foundation.  All rights
+ * Copyright (c) 2003-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -260,7 +260,7 @@ bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck
 
 XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
 {
-    char  dirBuf[PATH_MAX + 1];
+    char  dirBuf[PATH_MAX + 2];
     char  *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
 
     if (!curDir)
diff --git a/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp b/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp
index 39f9cc9320af4256c24d7afca9f89dcdb1bc58f6..f6afa26c1a7974a08190aa739fd443c42e0b3b4d 100644
--- a/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp
+++ b/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -395,7 +395,7 @@ bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck
 
 XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
 {
-    char  dirBuf[PATH_MAX + 1];
+    char  dirBuf[PATH_MAX + 2];
     char  *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
 
     if (!curDir)
diff --git a/src/xercesc/util/Platforms/Tru64/Tru64PlatformUtils.cpp b/src/xercesc/util/Platforms/Tru64/Tru64PlatformUtils.cpp
index 8cfd0bc8c88246a2d2b091f046c7c0c879d0873e..10e94f2ccac0db88703e0226fa9cc7419f040d4c 100644
--- a/src/xercesc/util/Platforms/Tru64/Tru64PlatformUtils.cpp
+++ b/src/xercesc/util/Platforms/Tru64/Tru64PlatformUtils.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -392,7 +392,7 @@ bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck
 
 XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
 {
-    char  dirBuf[PATH_MAX + 1];
+    char  dirBuf[PATH_MAX + 2];
     char  *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
 
     if (!curDir)
diff --git a/src/xercesc/util/Platforms/UnixWare/UnixWarePlatformUtils.cpp b/src/xercesc/util/Platforms/UnixWare/UnixWarePlatformUtils.cpp
index e0fc2e846a892a8fa5eb1805317ae0c90bb3f8c0..e7a4647106de955b0a5e72ae4e5ae5ad6c379c6a 100644
--- a/src/xercesc/util/Platforms/UnixWare/UnixWarePlatformUtils.cpp
+++ b/src/xercesc/util/Platforms/UnixWare/UnixWarePlatformUtils.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.16  2004/01/13 16:34:22  cargilld
+ * Misc memory management changes.
+ *
  * Revision 1.15  2003/12/24 15:24:14  cargilld
  * More updates to memory management so that the static memory manager.
  *
@@ -478,7 +481,7 @@ bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck
 
 XMLCh* XMLPlatformUtils::getCurrentDirectory(MemoryManager* const manager)
 {
-    char  dirBuf[PATH_MAX + 1];
+    char  dirBuf[PATH_MAX + 2];
     char  *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
 
     if (!curDir)
diff --git a/src/xercesc/util/Transcoders/Cygwin/CygwinTransService.cpp b/src/xercesc/util/Transcoders/Cygwin/CygwinTransService.cpp
index 28e8b314e48b67ca6f44e4962765afecd8050200..adb44eb3e8e8144cc47a1bed00a0b6a654aa53d4 100644
--- a/src/xercesc/util/Transcoders/Cygwin/CygwinTransService.cpp
+++ b/src/xercesc/util/Transcoders/Cygwin/CygwinTransService.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 2002 The Apache Software Foundation.  All rights
+ * Copyright (c) 2002-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.11  2004/01/13 16:34:22  cargilld
+ * Misc memory management changes.
+ *
  * Revision 1.10  2003/12/24 15:24:15  cargilld
  * More updates to memory management so that the static memory manager.
  *
@@ -831,8 +834,8 @@ CygwinTranscoder::transcodeFrom(  const XMLByte* const      srcData
         {
             if (toEat == 1)
             {
-                XMLCh tmpBuf[16];
-                XMLString::binToText((unsigned int)(*inPtr), tmpBuf, 16, 16);
+                XMLCh tmpBuf[17];
+                XMLString::binToText((unsigned int)(*inPtr), tmpBuf, 16, 16, getMemoryManager());
                 ThrowXMLwithMemMgr2
                 (
                     TranscodingException
@@ -913,8 +916,8 @@ CygwinTranscoder::transcodeTo(const  XMLCh* const   srcData
         //
         if (usedDef && (options == UnRep_Throw))
         {
-            XMLCh tmpBuf[16];
-            XMLString::binToText((unsigned int)*srcPtr, tmpBuf, 16, 16);
+            XMLCh tmpBuf[17];
+            XMLString::binToText((unsigned int)*srcPtr, tmpBuf, 16, 16, getMemoryManager());
             ThrowXMLwithMemMgr2
             (
                 TranscodingException
diff --git a/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp b/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp
index 37cd17cbe72aee7c14fb20f3a3ce0c115f281b73..91da8e198d65475e2c36aaca36305bc934f3537a 100644
--- a/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp
+++ b/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -502,8 +502,8 @@ ICUTranscoder::transcodeFrom(const  XMLByte* const          srcData
 
         if (fFixed)
         {
-            XMLCh tmpBuf[16];
-            XMLString::binToText((unsigned int)(*startTarget), tmpBuf, 16, 16);
+            XMLCh tmpBuf[17];
+            XMLString::binToText((unsigned int)(*startTarget), tmpBuf, 16, 16, getMemoryManager());
             ThrowXMLwithMemMgr2
             (
                 TranscodingException
@@ -663,8 +663,8 @@ ICUTranscoder::transcodeTo( const   XMLCh* const    srcData
 
     if (!res)
     {
-        XMLCh tmpBuf[16];
-        XMLString::binToText((unsigned int)*startSrc, tmpBuf, 16, 16);
+        XMLCh tmpBuf[17];
+        XMLString::binToText((unsigned int)*startSrc, tmpBuf, 16, 16, getMemoryManager());
         ThrowXMLwithMemMgr2
         (
             TranscodingException
diff --git a/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.cpp b/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.cpp
index e5955b697603240e02150f2e0777e3d33b81281b..f33cd8ac50223aa17541e90c1e91f2b6e0b78450 100644
--- a/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.cpp
+++ b/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -428,8 +428,8 @@ Iconv400Transcoder::transcodeFrom(const  XMLByte* const          srcData
 
         if (fFixed)
         {
-            XMLCh tmpBuf[16];
-            XMLString::binToText((unsigned int)(*startTarget), tmpBuf, 16, 16);
+            XMLCh tmpBuf[17];
+            XMLString::binToText((unsigned int)(*startTarget), tmpBuf, 16, 16, getMemoryManager());
             ThrowXMLwithMemMgr2
             (
                 TranscodingException
@@ -566,8 +566,8 @@ Iconv400Transcoder::transcodeTo( const   XMLCh* const    srcData
 
     if (err)   /*@01A*/
     {
-        XMLCh tmpBuf[16];
-        XMLString::binToText((unsigned int)*startSrc, tmpBuf, 16, 16);
+        XMLCh tmpBuf[17];
+        XMLString::binToText((unsigned int)*startSrc, tmpBuf, 16, 16, getMemoryManager());
         ThrowXMLwithMemMgr2
         (
             TranscodingException
diff --git a/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp b/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp
index 73a80cb41ad621095bc00f826f6c73998ffa3a84..03536b1d2e609d47e109ceb77478c6e01e28368e 100644
--- a/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp
+++ b/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -761,7 +761,7 @@ MacOSTranscoder::transcodeTo(const  XMLCh* const    srcData
     {
     	if (status == kTECUnmappableElementErr && options == UnRep_Throw)
     	{
-    		XMLCh tmpBuf[16];
+    		XMLCh tmpBuf[17];
             XMLString::binToText((unsigned int)&srcData[totalCharsConsumed], tmpBuf, 16, 16);
             ThrowXML2
             (
diff --git a/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp b/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp
index 6479badb4d11d1bdfc0e26152f002adcc6cee193..497268dc1b746b0644e2896d4e64b357cf9e4e2b 100644
--- a/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp
+++ b/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp
@@ -668,7 +668,7 @@ Win32Transcoder::transcodeFrom( const   XMLByte* const      srcData
         {
             if (toEat == 1)
             {
-                XMLCh tmpBuf[16];
+                XMLCh tmpBuf[17];
                 XMLString::binToText((unsigned int)(*inPtr), tmpBuf, 16, 16, getMemoryManager());
                 ThrowXMLwithMemMgr2
                 (
@@ -750,7 +750,7 @@ Win32Transcoder::transcodeTo(const  XMLCh* const    srcData
         //
         if (usedDef && (options == UnRep_Throw))
         {
-            XMLCh tmpBuf[16];
+            XMLCh tmpBuf[17];
             XMLString::binToText((unsigned int)*srcPtr, tmpBuf, 16, 16, getMemoryManager());
             ThrowXMLwithMemMgr2
             (
diff --git a/src/xercesc/util/XML256TableTranscoder.cpp b/src/xercesc/util/XML256TableTranscoder.cpp
index fa1df436d6132caa4973ae8cf34c1f9ff7c6a10c..2a3c1b5746d92f03e9dd3afb38a297952c77aea4 100644
--- a/src/xercesc/util/XML256TableTranscoder.cpp
+++ b/src/xercesc/util/XML256TableTranscoder.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -173,7 +173,7 @@ XML256TableTranscoder::transcodeTo( const   XMLCh* const    srcData
         //
         if (options == UnRep_Throw)
         {
-            XMLCh tmpBuf[16];
+            XMLCh tmpBuf[17];
             XMLString::binToText((unsigned int)*srcPtr, tmpBuf, 16, 16, getMemoryManager());
             ThrowXMLwithMemMgr2
             (
diff --git a/src/xercesc/util/XML88591Transcoder.cpp b/src/xercesc/util/XML88591Transcoder.cpp
index b73e287108a8674b09856c58569e0d7081bfe9f4..5350e482724d8dc6336c13c79e67f9ad774279d9 100644
--- a/src/xercesc/util/XML88591Transcoder.cpp
+++ b/src/xercesc/util/XML88591Transcoder.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -164,7 +164,7 @@ XML88591Transcoder::transcodeTo(const   XMLCh* const    srcData
         //
         if (options == UnRep_Throw)
         {
-            XMLCh tmpBuf[16];
+            XMLCh tmpBuf[17];
             XMLString::binToText((unsigned int)*srcPtr, tmpBuf, 16, 16, getMemoryManager());
             ThrowXMLwithMemMgr2
             (
diff --git a/src/xercesc/util/XMLASCIITranscoder.cpp b/src/xercesc/util/XMLASCIITranscoder.cpp
index 86b371ad91aee7055cc36f33fe14578f638297c6..8af2b7e1f7fc9440097aade2188fffd376968ef2 100644
--- a/src/xercesc/util/XMLASCIITranscoder.cpp
+++ b/src/xercesc/util/XMLASCIITranscoder.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -129,7 +129,7 @@ XMLASCIITranscoder::transcodeFrom(  const   XMLByte* const       srcData
         if (countDone > 32)
             break;
 
-        XMLCh tmpBuf[16];
+        XMLCh tmpBuf[17];
         XMLString::binToText((unsigned int)*srcPtr, tmpBuf, 16, 16, getMemoryManager());
         ThrowXMLwithMemMgr2
         (
@@ -188,7 +188,7 @@ XMLASCIITranscoder::transcodeTo(const   XMLCh* const    srcData
         //
         if (options == UnRep_Throw)
         {
-            XMLCh tmpBuf[16];
+            XMLCh tmpBuf[17];
             XMLString::binToText((unsigned int)*srcPtr, tmpBuf, 16, 16, getMemoryManager());
             ThrowXMLwithMemMgr2
             (
diff --git a/src/xercesc/util/XMLDateTime.cpp b/src/xercesc/util/XMLDateTime.cpp
index 910812d92b907de0fe6d74e3ca5a5be10a9c5f92..c9694344be76a034375d4654a2ee5277e7e1791a 100644
--- a/src/xercesc/util/XMLDateTime.cpp
+++ b/src/xercesc/util/XMLDateTime.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 2001 The Apache Software Foundation.  All rights
+ * Copyright (c) 2001-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -57,6 +57,9 @@
 /*
  * $Id$
  * $Log$
+ * Revision 1.22  2004/01/13 16:34:20  cargilld
+ * Misc memory management changes.
+ *
  * Revision 1.21  2004/01/03 00:03:18  peiyongz
  * parseContent
  *
@@ -140,6 +143,7 @@
 //  Includes
 // ---------------------------------------------------------------------------
 #include <stdlib.h>
+#include <assert.h>
 #include <xercesc/util/XMLDateTime.hpp>
 #include <xercesc/util/XMLString.hpp>
 #include <xercesc/util/XMLUni.hpp>
@@ -1624,7 +1628,8 @@ XMLCh* XMLDateTime::getTimeCanonicalRepresentation(MemoryManager* const memMgr)
 void XMLDateTime::fillString(XMLCh*& ptr, valueIndex ind, int expLen) const
 {
     XMLCh strBuffer[16];
-    XMLString::binToText(fValue[ind], strBuffer, expLen, 10);
+    assert(expLen < 16);
+    XMLString::binToText(fValue[ind], strBuffer, expLen, 10, fMemoryManager);
     int   actualLen = XMLString::stringLen(strBuffer);
     int   i;
     //append leading zeros
@@ -1644,7 +1649,7 @@ int XMLDateTime::fillYearString(XMLCh*& ptr, valueIndex ind) const
 {
     XMLCh strBuffer[16];
     // let's hope we get no years of 15 digits...
-    XMLString::binToText(fValue[ind], strBuffer, 15, 10);
+    XMLString::binToText(fValue[ind], strBuffer, 15, 10, fMemoryManager);
     int   actualLen = XMLString::stringLen(strBuffer);
     // don't forget that years can be negative...
     int negativeYear = 0;
diff --git a/src/xercesc/util/XMLString.cpp b/src/xercesc/util/XMLString.cpp
index 4134ec04042162a5e1ecda725e9b8553231b4cc1..7b22f0bb9d48a419d942e13a2e12a5ea28b644ec 100644
--- a/src/xercesc/util/XMLString.cpp
+++ b/src/xercesc/util/XMLString.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -136,8 +136,18 @@ void XMLString::binToText(  const   unsigned long   toFormat
     //  having to check for overflow in the inner loops, and we have to flip
     //  the resulting XMLString anyway.
     //
-    char tmpBuf[128];
-
+    char   tmpBuffer[128];
+    char*  tmpBuf;
+    char*  bigBuf = 0;
+    if (maxChars < 128)
+    {
+        tmpBuf = tmpBuffer;
+    }
+    else
+    {
+        bigBuf = (char*) manager->allocate((maxChars+1)* sizeof(char));
+        tmpBuf = bigBuf;
+    } 
     //
     //  For each radix, do the optimal thing. For bin and hex, we can special
     //  case them and do shift and mask oriented stuff. For oct and decimal
@@ -172,14 +182,20 @@ void XMLString::binToText(  const   unsigned long   toFormat
             tmpVal /= radix;
         }
     }
-     else
+    else
     {
+        if (bigBuf)
+            manager->deallocate(bigBuf);
         ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Str_UnknownRadix, manager);
     }
 
     // See if have enough room in the caller's buffer
     if (tmpIndex > maxChars)
+    {
+        if (bigBuf)
+            manager->deallocate(bigBuf);
         ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Str_TargetBufTooSmall, manager);
+    }
 
     // Reverse the tmp buffer into the caller's buffer
     unsigned int outIndex = 0;
@@ -188,6 +204,8 @@ void XMLString::binToText(  const   unsigned long   toFormat
 
     // And cap off the caller's buffer
     toFill[outIndex] = char(0);
+    if (bigBuf)
+        manager->deallocate(bigBuf);
 }
 
 void XMLString::binToText(  const   unsigned int    toFormat
@@ -799,7 +817,18 @@ void XMLString::binToText(  const   unsigned long   toFormat
     //  having to check for overflow in the inner loops, and we have to flip
     //  the resulting sring anyway.
     //
-    XMLCh tmpBuf[128];
+    XMLCh   tmpBuffer[128];
+    XMLCh*  tmpBuf;
+    XMLCh*  bigBuf = 0;
+    if (maxChars < 128)
+    {
+        tmpBuf = tmpBuffer;
+    }
+    else
+    {
+        bigBuf = (XMLCh*) manager->allocate((maxChars+1)* sizeof(XMLCh));
+        tmpBuf = bigBuf;
+    }
 
     //
     //  For each radix, do the optimal thing. For bin and hex, we can special
@@ -837,12 +866,18 @@ void XMLString::binToText(  const   unsigned long   toFormat
     }
      else
     {
+        if (bigBuf)
+            manager->deallocate(bigBuf);
         ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::Str_UnknownRadix, manager);
     }
 
     // See if have enough room in the caller's buffer
     if (tmpIndex > maxChars)
+    {
+        if (bigBuf)
+            manager->deallocate(bigBuf);    
         ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::Str_TargetBufTooSmall, manager);
+    }
 
     // Reverse the tmp buffer into the caller's buffer
     unsigned int outIndex = 0;
@@ -851,6 +886,9 @@ void XMLString::binToText(  const   unsigned long   toFormat
 
     // And cap off the caller's buffer
     toFill[outIndex] = chNull;
+
+    if (bigBuf)
+        manager->deallocate(bigBuf);
 }
 
 void XMLString::binToText(  const   unsigned int    toFormat
diff --git a/src/xercesc/util/XMLURL.cpp b/src/xercesc/util/XMLURL.cpp
index eb5465a9fb4ba4ec02250def67b60914bfd7fee4..f7319650b5f5e25bd6582fbfb56ea92408742907 100644
--- a/src/xercesc/util/XMLURL.cpp
+++ b/src/xercesc/util/XMLURL.cpp
@@ -769,7 +769,7 @@ void XMLURL::buildFullText()
         {
             *outPtr++ = chColon;
 
-            XMLCh tmpBuf[16];
+            XMLCh tmpBuf[17];
             XMLString::binToText(fPortNum, tmpBuf, 16, 10, fMemoryManager);
             XMLString::copyString(outPtr, tmpBuf);
             outPtr += XMLString::stringLen(tmpBuf);
diff --git a/src/xercesc/util/XMLUTF8Transcoder.cpp b/src/xercesc/util/XMLUTF8Transcoder.cpp
index c8c78aedd299309202190613bb67633ddb670b11..2a00ecce970e2cb5132b545e52722060de58cd0f 100644
--- a/src/xercesc/util/XMLUTF8Transcoder.cpp
+++ b/src/xercesc/util/XMLUTF8Transcoder.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -381,7 +381,7 @@ XMLUTF8Transcoder::transcodeTo( const   XMLCh* const    srcData
             // If the options say to throw, then throw
             if (options == UnRep_Throw)
             {
-                XMLCh tmpBuf[16];
+                XMLCh tmpBuf[17];
                 XMLString::binToText(curVal, tmpBuf, 16, 16, getMemoryManager());
                 ThrowXMLwithMemMgr2
                 (
diff --git a/src/xercesc/util/XMLUri.cpp b/src/xercesc/util/XMLUri.cpp
index f088a97a7043767d2ab64519b17562ad4e5b4cd4..cd0eb4a12e17612cd292f5b70d353dba700690e0 100644
--- a/src/xercesc/util/XMLUri.cpp
+++ b/src/xercesc/util/XMLUri.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
+ * Copyright (c) 2001-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -2030,7 +2030,7 @@ void XMLUri::buildFullText()
             {
                 *outPtr++ = chColon;
 
-                XMLCh tmpBuf[16];
+                XMLCh tmpBuf[17];
                 XMLString::binToText(fPort, tmpBuf, 16, 10, fMemoryManager);
                 XMLString::copyString(outPtr, tmpBuf);
                 outPtr += XMLString::stringLen(tmpBuf);
diff --git a/src/xercesc/util/regx/RegularExpression.cpp b/src/xercesc/util/regx/RegularExpression.cpp
index d18d29ee3c757a4162339cec713d9e04b5e72fc9..da157984826db7b5bda933599e171042d10543fb 100644
--- a/src/xercesc/util/regx/RegularExpression.cpp
+++ b/src/xercesc/util/regx/RegularExpression.cpp
@@ -1,7 +1,7 @@
 /*
  * The Apache Software License, Version 1.1
  *
- * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
+ * Copyright (c) 2001-2004 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.21  2004/01/13 16:34:22  cargilld
+ * Misc memory management changes.
+ *
  * Revision 1.20  2004/01/06 18:12:31  peiyongz
  * using ctor/setPattern to avoid exception thrown from ctor
  *
@@ -1441,7 +1444,7 @@ Op* RegularExpression::compile(const Token* const token, Op* const next,
 	case Token::T_BACKREFERENCE:
 	case Token::T_EMPTY:
 		ret = compileSingle(token, next, tokenType);
-		break;
+                break;
 	case Token::T_CONCAT:
 		ret = compileConcat(token, next, reverse);
 		break;