You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by bo...@apache.org on 2008/03/10 15:10:21 UTC

svn commit: r635560 [3/5] - in /xerces/c/trunk: Projects/MacOS/Xcode/XercesLib/XercesLib.xcode/ Projects/Win32/BCB6/Xerces-all/XercesLib/ Projects/Win32/BCC.551/Xerces-all/XercesLib/ Projects/Win32/VC6/xerces-all/XercesLib/ Projects/Win32/VC7.1/xerces-...

Modified: xerces/c/trunk/src/xercesc/util/EncodingValidator.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/EncodingValidator.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/EncodingValidator.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/EncodingValidator.cpp Mon Mar 10 07:10:09 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,57 +24,22 @@
 // ---------------------------------------------------------------------------
 #include <xercesc/util/EncodingValidator.hpp>
 #include <xercesc/internal/IANAEncodings.hpp>
-#include <xercesc/util/PlatformUtils.hpp>
-#include <xercesc/util/XMLRegisterCleanup.hpp>
 #include <xercesc/util/XMLInitializer.hpp>
 
 XERCES_CPP_NAMESPACE_BEGIN
 
-// ---------------------------------------------------------------------------
-//  Local static data
-// ---------------------------------------------------------------------------
-static XMLMutex* sEncValMutex = 0;
-static XMLRegisterCleanup encValRegistryCleanup;
-static XMLRegisterCleanup instanceCleanup;
-
-// ---------------------------------------------------------------------------
-//  Local, static functions
-// ---------------------------------------------------------------------------
-static void reinitEncValMutex()
-{
-    delete sEncValMutex;
-    sEncValMutex = 0;
-}
-
-static XMLMutex& getEncValMutex()
-{
-    if (!sEncValMutex)
-    {
-        XMLMutexLock lock(XMLPlatformUtils::fgAtomicMutex);
-
-        // If we got here first, then register it and set the registered flag
-        if (!sEncValMutex)
-        {
-            sEncValMutex = new XMLMutex(XMLPlatformUtils::fgMemoryManager);
-            encValRegistryCleanup.registerCleanup(reinitEncValMutex);
-        }
-    }
-    return *sEncValMutex;
-}
+EncodingValidator* EncodingValidator::fInstance = 0;
 
 void XMLInitializer::initializeEncodingValidator()
 {
     EncodingValidator::fInstance = new EncodingValidator();
-    if (EncodingValidator::fInstance) {
-        instanceCleanup.registerCleanup(EncodingValidator::reinitInstance);
-    }
 }
 
-// ---------------------------------------------------------------------------
-//  Static member data initialization
-// ---------------------------------------------------------------------------
-EncodingValidator* EncodingValidator::fInstance = 0;
-
+void XMLInitializer::terminateEncodingValidator()
+{
+    delete EncodingValidator::fInstance;
+    EncodingValidator::fInstance = 0;
+}
 
 // ---------------------------------------------------------------------------
 //  EncodingValidator: Constructors and Destructor
@@ -121,27 +86,7 @@
 // ---------------------------------------------------------------------------
 EncodingValidator* EncodingValidator::instance()
 {
-    if (!fInstance)
-    {
-        XMLMutexLock lock(&getEncValMutex());
-
-        if (!fInstance)
-        { 
-            fInstance = new EncodingValidator();
-            instanceCleanup.registerCleanup(EncodingValidator::reinitInstance);
-        }
-    }
-
-    return (fInstance);
-}
-
-// -----------------------------------------------------------------------
-//  Notification that lazy data has been deleted
-// -----------------------------------------------------------------------
-void EncodingValidator::reinitInstance() {
-
-	delete fInstance;
-	fInstance = 0;
+    return fInstance;
 }
 
 XERCES_CPP_NAMESPACE_END

Modified: xerces/c/trunk/src/xercesc/util/EncodingValidator.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/EncodingValidator.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/EncodingValidator.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/EncodingValidator.hpp Mon Mar 10 07:10:09 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -45,12 +45,7 @@
     // -----------------------------------------------------------------------
     //  Instance methods
     // -----------------------------------------------------------------------
-	static EncodingValidator* instance();
-
-	// -----------------------------------------------------------------------
-    //  Notification that lazy data has been deleted
-    // -----------------------------------------------------------------------
-	static void reinitInstance();
+    static EncodingValidator* instance();
 
 private:
     // -----------------------------------------------------------------------

Modified: xerces/c/trunk/src/xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/NetAccessors/WinSock/BinHTTPURLInputStream.cpp Mon Mar 10 07:10:09 2008
@@ -279,13 +279,16 @@
       : fSocketHandle(0)
       , fBytesProcessed(0)
 {
-    if(!fInitialized)
+    // Check if we need to load the winsock library. While locking the
+    // mutex every time may be somewhat slow, we don't care in this
+    // particular case since the next operation will most likely be
+    // the network access which is a lot slower.
+    //
     {
         XMLMutexLock lock(XMLPlatformUtils::fgAtomicMutex);
+
         if (!fInitialized)
-        {
-            Initialize(urlSource.getMemoryManager());
-        }
+          Initialize(urlSource.getMemoryManager());
     }
 
     fMemoryManager = urlSource.getMemoryManager();

Modified: xerces/c/trunk/src/xercesc/util/PlatformUtils.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/PlatformUtils.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/PlatformUtils.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/PlatformUtils.cpp Mon Mar 10 07:10:09 2008
@@ -46,7 +46,6 @@
 #include <xercesc/internal/XMLReader.hpp>
 #include <xercesc/util/RuntimeException.hpp>
 #include <xercesc/util/OutOfMemoryException.hpp>
-#include <xercesc/util/XMLRegisterCleanup.hpp>
 #include <xercesc/util/DefaultPanicHandler.hpp>
 #include <xercesc/util/XMLInitializer.hpp>
 #include <xercesc/internal/MemoryManagerImpl.hpp>
@@ -132,21 +131,6 @@
 static XMLMutex*                gSyncMutex = 0;
 static long                     gInitFlag = 0;
 
-// ---------------------------------------------------------------------------
-//  Global data
-//
-//	gXMLCleanupList
-//		This is a list of cleanup functions to be called on
-//		XMLPlatformUtils::Terminate.  Their function is to reset static
-//		data in classes that use it.
-//
-//	gXMLCleanupListMutex
-//		This is a mutex that will be used to synchronise access to the global
-//		static data cleanup list
-// ---------------------------------------------------------------------------
-XMLRegisterCleanup*	gXMLCleanupList = 0;
-XMLMutex*           gXMLCleanupListMutex = 0;
-
 
 // ---------------------------------------------------------------------------
 //  XMLPlatformUtils: Static Data Members
@@ -174,8 +158,7 @@
 void XMLPlatformUtils::Initialize(const char*          const locale
                                 , const char*          const nlsHome
                                 ,       PanicHandler*  const panicHandler
-                                ,       MemoryManager* const memoryManager
-                                ,       bool                 toInitStatics)
+                                ,       MemoryManager* const memoryManager)
 {
     //
     //  Effects of overflow:
@@ -245,8 +228,7 @@
     // Create the local sync mutex
     gSyncMutex = new XMLMutex(fgMemoryManager);
 
-	// Create the mutex for the static data cleanup list
-    gXMLCleanupListMutex = new XMLMutex(fgMemoryManager);
+    // Create the global "atomic operations" mutex.
     fgAtomicMutex = new XMLMutex(fgMemoryManager);
 
     //
@@ -260,6 +242,8 @@
     //
     //  If we cannot make one, then we call panic to end the process.
     //
+    XMLInitializer::initializeTransService(); // TransService static data.
+
     fgTransService = makeTransService();
 
     if (!fgTransService)
@@ -294,9 +278,9 @@
     XMLMsgLoader::setLocale(locale);
     XMLMsgLoader::setNLSHome(nlsHome);
 
-    if (toInitStatics) {
-        XMLInitializer::InitializeAllStaticData();
-    }
+    // Initialize static data.
+    //
+    XMLInitializer::initializeStaticData();
 }
 
 
@@ -316,6 +300,10 @@
     if (gInitFlag > 0)
 	return;
 
+    // Terminate static data.
+    //
+    XMLInitializer::terminateStaticData();
+
     // Delete any net accessor that got installed
     delete fgNetAccessor;
     fgNetAccessor = 0;
@@ -331,20 +319,11 @@
     delete fgTransService;
     fgTransService = 0;
 
+    XMLInitializer::terminateTransService(); // TransService static data.
+
     // Clean up mutexes
     delete gSyncMutex;		gSyncMutex = 0;
     delete fgAtomicMutex;	fgAtomicMutex = 0;
-
-    // Clean up statically allocated, lazily cleaned data in each class
-    // that has registered for it.
-    // Note that calling doCleanup() also unregisters the cleanup
-    // function, so that we are chewing the list down to nothing here
-    while (gXMLCleanupList)
-        gXMLCleanupList->doCleanup();
-
-    // Clean up the mutex for accessing gXMLCleanupList
-    delete gXMLCleanupListMutex;
-    gXMLCleanupListMutex = 0;
 
     // Clean up our mgrs
     delete fgFileMgr;		fgFileMgr = 0;

Modified: xerces/c/trunk/src/xercesc/util/PlatformUtils.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/PlatformUtils.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/PlatformUtils.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/PlatformUtils.hpp Mon Mar 10 07:10:09 2008
@@ -172,8 +172,7 @@
     static void Initialize(const char*          const locale = XMLUni::fgXercescDefaultLocale
                          , const char*          const nlsHome = 0
                          ,       PanicHandler*  const panicHandler = 0
-                         ,       MemoryManager* const memoryManager = 0
-                         ,       bool                 toInitStatics = false);
+                         ,       MemoryManager* const memoryManager = 0);
 
     /** Perform per-process parser termination
       *

Modified: xerces/c/trunk/src/xercesc/util/TransService.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/TransService.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/TransService.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/TransService.cpp Mon Mar 10 07:10:09 2008
@@ -34,11 +34,10 @@
 #include <xercesc/util/XMLWin1252Transcoder.hpp>
 #include <xercesc/util/XMLUniDefs.hpp>
 #include <xercesc/util/XMLUni.hpp>
-#include <xercesc/util/Mutexes.hpp>
 #include <xercesc/util/EncodingValidator.hpp>
-#include <xercesc/util/XMLRegisterCleanup.hpp>
 #include <xercesc/util/PlatformUtils.hpp>
 #include <xercesc/util/TransENameMap.hpp>
+#include <xercesc/util/XMLInitializer.hpp>
 
 XERCES_CPP_NAMESPACE_BEGIN
 
@@ -53,20 +52,21 @@
 static bool gStrictIANAEncoding = false;
 RefHashTableOf<ENameMap>* XMLTransService::gMappings = 0;
 RefVectorOf<ENameMap> * XMLTransService::gMappingsRecognizer = 0;
-static XMLRegisterCleanup mappingsCleanup;
-static XMLRegisterCleanup mappingsRecognizerCleanup;
 
-// -----------------------------------------------------------------------
-//  Notification that lazy data has been deleted
-// -----------------------------------------------------------------------
-void XMLTransService::reinitMappings() {
-    delete gMappings;    // The contents of the gMappings hash table are owned by
-    gMappings = 0;       //   the it, and so will be deleted by gMapping's destructor.
+void XMLInitializer::initializeTransService()
+{
+    XMLTransService::gMappings = new RefHashTableOf<ENameMap>(103);
+    XMLTransService::gMappingsRecognizer = new RefVectorOf<ENameMap>(
+      XMLRecognizer::Encodings_Count);
 }
 
-void XMLTransService::reinitMappingsRecognizer() {
+void XMLInitializer::terminateTransService()
+{
     delete XMLTransService::gMappingsRecognizer;
-    gMappingsRecognizer = 0;
+    XMLTransService::gMappingsRecognizer = 0;
+
+    delete XMLTransService::gMappings;
+    XMLTransService::gMappings = 0;
 }
 
 // ---------------------------------------------------------------------------
@@ -74,29 +74,6 @@
 // ---------------------------------------------------------------------------
 XMLTransService::XMLTransService()
 {
-    if (!gMappings)
-    {
-        XMLMutexLock lock(XMLPlatformUtils::fgAtomicMutex);
-
-        if (!gMappings)
-        {
-          gMappings = new RefHashTableOf<ENameMap>(103);
-          mappingsCleanup.registerCleanup(reinitMappings);
-        }
-    }
-
-    if (!gMappingsRecognizer)
-    {
-        XMLMutexLock lock(XMLPlatformUtils::fgAtomicMutex);
-
-        if (!gMappingsRecognizer)
-        {
-          gMappingsRecognizer = new RefVectorOf<ENameMap>(
-            XMLRecognizer::Encodings_Count);
-
-          mappingsRecognizerCleanup.registerCleanup(reinitMappingsRecognizer);
-        }
-    }
 }
 
 XMLTransService::~XMLTransService()

Modified: xerces/c/trunk/src/xercesc/util/TransService.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/TransService.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/TransService.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/TransService.hpp Mon Mar 10 07:10:09 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -125,19 +125,19 @@
 
     virtual bool supportsSrcOfs() const = 0;
 
-    virtual void upperCase(XMLCh* const toUpperCase) const = 0;
-    virtual void lowerCase(XMLCh* const toLowerCase) const = 0;
+    virtual void upperCase(XMLCh* const toUpperCase) = 0;
+    virtual void lowerCase(XMLCh* const toLowerCase) = 0;
 
-	// -----------------------------------------------------------------------
+    // -----------------------------------------------------------------------
     //	Allow users to add their own encodings to the intrinsinc mapping
-	//	table
-	//	Usage:
-	//		XMLTransService::addEncoding (
-	//			gMyEncodingNameString
+    //	table
+    //	Usage:
+    //		XMLTransService::addEncoding (
+    //			gMyEncodingNameString
     //			, new ENameMapFor<MyTransClassType>(gMyEncodingNameString)
-	//		);
+    //		);
     // -----------------------------------------------------------------------
-	static void addEncoding(const XMLCh* const encoding, ENameMap* const ownMapping);
+    static void addEncoding(const XMLCh* const encoding, ENameMap* const ownMapping);
 
 
 protected :
@@ -194,9 +194,8 @@
     // -----------------------------------------------------------------------
     void strictIANAEncoding(const bool newState);
     bool isStrictIANAEncoding();
-    static void reinitMappings();
-    static void reinitMappingsRecognizer();
 
+    friend class XMLInitializer;
 };
 
 /**
@@ -300,7 +299,7 @@
     virtual bool canTranscodeTo
     (
         const   unsigned int    toCheck
-    )   const = 0;
+    ) = 0;
 
     //@}
 

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp Mon Mar 10 07:10:09 2008
@@ -347,12 +347,12 @@
 
 
 
-void ICUTransService::upperCase(XMLCh* const toUpperCase) const
+void ICUTransService::upperCase(XMLCh* const toUpperCase)
 {
     doCaseConvert(toUpperCase, u_toupper);
 }
 
-void ICUTransService::lowerCase(XMLCh* const toLowerCase) const
+void ICUTransService::lowerCase(XMLCh* const toLowerCase)
 {
     doCaseConvert(toLowerCase, u_tolower);
 }
@@ -693,7 +693,7 @@
 }
 
 
-bool ICUTranscoder::canTranscodeTo(const unsigned int toCheck) const
+bool ICUTranscoder::canTranscodeTo(const unsigned int toCheck)
 {
     //
     //  If the passed value is really a surrogate embedded together, then

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/ICU/ICUTransService.hpp Mon Mar 10 07:10:09 2008
@@ -62,8 +62,8 @@
 
     virtual bool supportsSrcOfs() const;
 
-    virtual void upperCase(XMLCh* const toUpperCase) const;
-    virtual void lowerCase(XMLCh* const toLowerCase) const;
+    virtual void upperCase(XMLCh* const toUpperCase);
+    virtual void lowerCase(XMLCh* const toLowerCase);
 
 
 protected :
@@ -131,7 +131,7 @@
     virtual bool canTranscodeTo
     (
         const   unsigned int    toCheck
-    )   const;
+    );
 
 
 

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Iconv/IconvTransService.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Iconv/IconvTransService.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Iconv/IconvTransService.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Iconv/IconvTransService.cpp Mon Mar 10 07:10:09 2008
@@ -195,7 +195,7 @@
 }
 
 
-void IconvTransService::upperCase(XMLCh* const toUpperCase) const
+void IconvTransService::upperCase(XMLCh* const toUpperCase)
 {
     XMLCh* outPtr = toUpperCase;
     while (*outPtr)
@@ -206,7 +206,7 @@
 }
 
 
-void IconvTransService::lowerCase(XMLCh* const toLowerCase) const
+void IconvTransService::lowerCase(XMLCh* const toLowerCase)
 {
     XMLCh* outPtr = toLowerCase;
     while (*outPtr)

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Iconv/IconvTransService.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Iconv/IconvTransService.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Iconv/IconvTransService.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Iconv/IconvTransService.hpp Mon Mar 10 07:10:09 2008
@@ -58,8 +58,8 @@
 
     virtual bool supportsSrcOfs() const;
 
-    virtual void upperCase(XMLCh* const toUpperCase) const;
-    virtual void lowerCase(XMLCh* const toLowerCase) const;
+    virtual void upperCase(XMLCh* const toUpperCase);
+    virtual void lowerCase(XMLCh* const toLowerCase);
 
 protected :
     // -----------------------------------------------------------------------

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Iconv390/Iconv390TransService.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Iconv390/Iconv390TransService.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Iconv390/Iconv390TransService.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Iconv390/Iconv390TransService.cpp Mon Mar 10 07:10:09 2008
@@ -278,7 +278,7 @@
     return 0;
 }
 
-void Iconv390TransService::upperCase(XMLCh* const toUpperCase) const
+void Iconv390TransService::upperCase(XMLCh* const toUpperCase)
 {
     XMLCh* outPtr = toUpperCase;
     while (*outPtr != 0) {
@@ -288,7 +288,7 @@
     }
 }
 
-void Iconv390TransService::lowerCase(XMLCh* const toLowerCase) const
+void Iconv390TransService::lowerCase(XMLCh* const toLowerCase)
 {
     XMLCh* outPtr = toLowerCase;
     while (*outPtr != 0) {

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Iconv390/Iconv390TransService.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Iconv390/Iconv390TransService.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Iconv390/Iconv390TransService.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Iconv390/Iconv390TransService.hpp Mon Mar 10 07:10:09 2008
@@ -70,8 +70,8 @@
 
     virtual bool supportsSrcOfs() const;
 
-    virtual void upperCase(XMLCh* const toUpperCase) const;
-    virtual void lowerCase(XMLCh* const toLowerCase) const;
+    virtual void upperCase(XMLCh* const toUpperCase);
+    virtual void lowerCase(XMLCh* const toLowerCase);
 
 protected :
     // -----------------------------------------------------------------------

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.cpp Mon Mar 10 07:10:09 2008
@@ -191,7 +191,7 @@
     return true;
 }
 
-void Iconv400TransService::upperCase(XMLCh* const toUpperCase) const
+void Iconv400TransService::upperCase(XMLCh* const toUpperCase)
 {
     XMLCh* outPtr = toUpperCase;
     while (*outPtr)
@@ -201,7 +201,7 @@
     }
 }
 
-void Iconv400TransService::lowerCase(XMLCh* const toLowerCase) const
+void Iconv400TransService::lowerCase(XMLCh* const toLowerCase)
 {
     XMLCh* outPtr = toLowerCase;
     while (*outPtr)
@@ -532,7 +532,7 @@
 }
 
 
-bool Iconv400Transcoder::canTranscodeTo(const unsigned int toCheck) const
+bool Iconv400Transcoder::canTranscodeTo(const unsigned int toCheck)
 {
     //
     //  If the passed value is really a surrogate embedded together, then

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Iconv400/Iconv400TransService.hpp Mon Mar 10 07:10:09 2008
@@ -72,8 +72,8 @@
 
     virtual bool supportsSrcOfs() const;
 
-    virtual void upperCase(XMLCh* const toUpperCase) const;
-    virtual void lowerCase(XMLCh* const toLowerCase) const;
+    virtual void upperCase(XMLCh* const toUpperCase);
+    virtual void lowerCase(XMLCh* const toLowerCase);
 
 
 protected :
@@ -147,7 +147,7 @@
     virtual bool canTranscodeTo
     (
         const   unsigned int	toCheck
-    )   const;
+    );
 
 
 

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/IconvFBSD/IconvFBSDTransService.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/IconvFBSD/IconvFBSDTransService.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/IconvFBSD/IconvFBSDTransService.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/IconvFBSD/IconvFBSDTransService.cpp Mon Mar 10 07:10:09 2008
@@ -788,7 +788,7 @@
 #endif /* !XML_USE_LIBICONV */
 }
 
-void IconvFBSDTransService::upperCase(XMLCh* const toUpperCase) const
+void IconvFBSDTransService::upperCase(XMLCh* const toUpperCase)
 {
     XMLCh* outPtr = toUpperCase;
     while (*outPtr)
@@ -802,7 +802,7 @@
     }
 }
 
-void IconvFBSDTransService::lowerCase(XMLCh* const toLowerCase) const
+void IconvFBSDTransService::lowerCase(XMLCh* const toLowerCase)
 {
     XMLCh* outPtr = toLowerCase;
     while (*outPtr)
@@ -1483,7 +1483,7 @@
 bool        IconvFBSDTranscoder::canTranscodeTo
 (
     const unsigned int toCheck
-)   const
+)
 {
     //
     //  If the passed value is really a surrogate embedded together, then

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/IconvFBSD/IconvFBSDTransService.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/IconvFBSD/IconvFBSDTransService.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/IconvFBSD/IconvFBSDTransService.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/IconvFBSD/IconvFBSDTransService.hpp Mon Mar 10 07:10:09 2008
@@ -186,8 +186,8 @@
 
     virtual bool supportsSrcOfs() const;
 
-    virtual void upperCase(XMLCh* const toUpperCase) const;
-    virtual void lowerCase(XMLCh* const toUpperCase) const;
+    virtual void upperCase(XMLCh* const toUpperCase);
+    virtual void lowerCase(XMLCh* const toUpperCase);
 
 protected :
     // -----------------------------------------------------------------------
@@ -272,7 +272,7 @@
     virtual bool canTranscodeTo
     (
         const   unsigned int	toCheck
-    )   const;
+    );
 
 private :
     // -----------------------------------------------------------------------

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp Mon Mar 10 07:10:09 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,16 +40,8 @@
 #include <xercesc/util/Janitor.hpp>
 #include "IconvGNUTransService.hpp"
 
-#include <xercesc/util/Mutexes.hpp>
-#include <xercesc/util/XMLRegisterCleanup.hpp>
-
 XERCES_CPP_NAMESPACE_BEGIN
 
-// Iconv() access syncronization point
-static XMLMutex    *gIconvMutex = NULL;
-static XMLRegisterCleanup IconvGNUMutexCleanup;
-#  define ICONV_LOCK    XMLMutexLock lockConverter(gIconvMutex);
-
 // ---------------------------------------------------------------------------
 // Description of encoding schemas, supported by iconv()
 // ---------------------------------------------------------------------------
@@ -231,7 +223,7 @@
 }
 
 // Return uppercase equivalent for XMLCh
-XMLCh    IconvGNUWrapper::toUpper (const XMLCh ch) const
+XMLCh IconvGNUWrapper::toUpper (const XMLCh ch)
 {
     if (ch <= 0x7F)
         return toupper(ch);
@@ -245,7 +237,6 @@
     char    *pTmpArr = tmpArr;
     size_t    bLen = 2;
 
-    ICONV_LOCK;
     if (::iconv (fCDTo, &ptr, &len, &pTmpArr, &bLen) == (size_t) -1)
         return 0;
     tmpArr[1] = toupper (*((unsigned char *)tmpArr));
@@ -261,7 +252,7 @@
 }
 
 // Return lowercase equivalent for XMLCh
-XMLCh    IconvGNUWrapper::toLower (const XMLCh ch) const
+XMLCh IconvGNUWrapper::toLower (const XMLCh ch)
 {
     if (ch <= 0x7F)
         return tolower(ch);
@@ -275,7 +266,6 @@
     char    *pTmpArr = tmpArr;
     size_t    bLen = 2;
 
-    ICONV_LOCK;
     if (::iconv (fCDTo, &ptr, &len, &pTmpArr, &bLen) == (size_t) -1)
         return 0;
     tmpArr[1] = tolower (*((unsigned char*)tmpArr));
@@ -370,9 +360,8 @@
 size_t    IconvGNUWrapper::iconvFrom ( const char    *fromPtr,
                  size_t        *fromLen,
                  char        **toPtr,
-                 size_t        toLen ) const
+                 size_t        toLen )
 {
-    ICONV_LOCK;
     char ** tmpPtr = (char**)&fromPtr;
     return ::iconv (fCDFrom, tmpPtr, fromLen, toPtr, &toLen);
 }
@@ -380,9 +369,8 @@
 size_t    IconvGNUWrapper::iconvTo ( const char    *fromPtr,
                    size_t        *fromLen,
                    char        **toPtr,
-                   size_t        toLen ) const
+                   size_t        toLen )
 {
-    ICONV_LOCK;
     char ** tmpPtr = (char**)&fromPtr;
     return ::iconv (fCDTo, tmpPtr, fromLen, toPtr, &toLen);
 }
@@ -392,23 +380,9 @@
 //  IconvGNUTransService: Constructors and Destructor
 // ---------------------------------------------------------------------------
 
-void reinitIconvGNUMutex()
-{
-    delete gIconvMutex;
-    gIconvMutex = 0;
-}
-
 IconvGNUTransService::IconvGNUTransService()
     : IconvGNUWrapper(), fUnicodeCP(0)
 {
-    // Create global lock object
-    if (gIconvMutex == NULL) {
-        gIconvMutex = new XMLMutex;
-        if (gIconvMutex == NULL)
-            XMLPlatformUtils::panic (PanicHandler::Panic_NoTransService);
-        IconvGNUMutexCleanup.registerCleanup(reinitIconvGNUMutex);
-    }
-
     // Try to obtain local (host) characterset from the setlocale
     // and through the environment. Do not call setlocale(LC_*, "")!
     // Using an empty string instead of NULL, will modify the libc
@@ -441,10 +415,11 @@
     // Select the native unicode characters encoding schema
     const IconvGNUEncoding    *eptr;
     // first - try to use the schema with character size, equil to XMLCh
-    for (eptr = gIconvGNUEncodings; eptr->fSchema; eptr++) {
+    for (eptr = gIconvGNUEncodings; eptr->fSchema; eptr++)
+    {
         if (eptr->fUChSize != sizeof(XMLCh))
             continue;
-        ICONV_LOCK;
+
         // try to create conversion descriptor
         iconv_t    cd_to = iconv_open(fLocalCP, eptr->fSchema);
         if (cd_to == (iconv_t)-1)
@@ -454,6 +429,7 @@
             iconv_close (cd_to);
             continue;
         }
+
         // got it
         setUChSize(eptr->fUChSize);
         setUBO(eptr->fUBO);
@@ -464,9 +440,9 @@
     }
     if (fUnicodeCP == NULL)
         // try to use any known schema
-        for (eptr = gIconvGNUEncodings; eptr->fSchema; eptr++) {
+        for (eptr = gIconvGNUEncodings; eptr->fSchema; eptr++)
+        {
             // try to create conversion descriptor
-            ICONV_LOCK;
             iconv_t    cd_to = iconv_open(fLocalCP, eptr->fSchema);
             if (cd_to == (iconv_t)-1)
                 continue;
@@ -475,6 +451,7 @@
                 iconv_close (cd_to);
                 continue;
             }
+
             // got it
             setUChSize(eptr->fUChSize);
             setUBO(eptr->fUBO);
@@ -509,6 +486,8 @@
     const XMLCh* cptr1 = comp1;
     const XMLCh* cptr2 = comp2;
 
+    XMLMutexLock lockConverter(&fMutex);
+
     XMLCh    c1 = toUpper(*cptr1);
     XMLCh    c2 = toUpper(*cptr2);
     while ( (*cptr1 != 0) && (*cptr2 != 0) ) {
@@ -530,6 +509,8 @@
     const XMLCh* cptr1 = comp1;
     const XMLCh* cptr2 = comp2;
 
+    XMLMutexLock lockConverter(&fMutex);
+
     while (true && maxChars)
     {
         XMLCh    c1 = toUpper(*cptr1);
@@ -592,7 +573,6 @@
     iconv_t    cd_from, cd_to;
 
     {
-        ICONV_LOCK;
         cd_from = iconv_open (fUnicodeCP, encLocal);
         if (cd_from == (iconv_t)-1) {
             resValue = XMLTransService::SupportFilesNotFound;
@@ -614,7 +594,7 @@
     return newTranscoder;
 }
 
-void IconvGNUTransService::upperCase(XMLCh* const toUpperCase) const
+void IconvGNUTransService::upperCase(XMLCh* const toUpperCase)
 {
     XMLCh* outPtr = toUpperCase;
     while (*outPtr)
@@ -624,9 +604,12 @@
     }
 }
 
-void IconvGNUTransService::lowerCase(XMLCh* const toLowerCase) const
+void IconvGNUTransService::lowerCase(XMLCh* const toLowerCase)
 {
     XMLCh* outPtr = toLowerCase;
+
+    XMLMutexLock lockConverter(&fMutex);
+
     while (*outPtr)
     {
         *outPtr = toLower(*outPtr);
@@ -643,13 +626,15 @@
     if (!srcText)
         return 0;
 
-    size_t      len, srcLen;
+    size_t len, srcLen;
     len = srcLen = strlen(srcText);
     if (len == 0)
         return 0;
 
-    char    tmpWideArr[gTempBuffArraySize];
-    size_t    totalLen = 0;
+    char tmpWideArr[gTempBuffArraySize];
+    size_t totalLen = 0;
+
+    XMLMutexLock lockConverter(&fMutex);
 
     for (;;) {
         char        *pTmpArr = tmpWideArr;
@@ -697,6 +682,8 @@
     size_t    totalLen = 0;
     char    *srcEnd = wBuf + wLent * uChSize();
 
+    XMLMutexLock lockConverter(&fMutex);
+
     for (;;) {
         char        *pTmpArr = tmpBuff;
         const char    *ptr = srcEnd - len;
@@ -754,8 +741,14 @@
         wideCharBuf = (char *) toTranscode;
 
     // perform conversion
-    char    *ptr = retVal;
-    size_t    rc = iconvTo(wideCharBuf, &len, &ptr, neededLen);
+    char* ptr = retVal;
+    size_t rc;
+
+    {
+      XMLMutexLock lockConverter(&fMutex);
+      rc = iconvTo(wideCharBuf, &len, &ptr, neededLen);
+    }
+
     if (rc == (size_t)-1) {
         return 0;
     }
@@ -804,7 +797,13 @@
 
     // Ok, go ahead and try the transcoding. If it fails, then ...
     char    *ptr = toFill;
-    size_t    rc = iconvTo(wideCharBuf, &len, &ptr, maxBytes);
+    size_t rc;
+
+    {
+      XMLMutexLock lockConverter(&fMutex);
+      rc = iconvTo(wideCharBuf, &len, &ptr, maxBytes);
+    }
+
     if (rc == (size_t)-1) {
         return false;
     }
@@ -854,7 +853,13 @@
 
     size_t    flen = strlen(toTranscode);
     char    *ptr = wideCharBuf;
-    size_t    rc = iconvFrom(toTranscode, &flen, &ptr, len);
+    size_t rc;
+
+    {
+      XMLMutexLock lockConverter(&fMutex);
+      rc = iconvFrom(toTranscode, &flen, &ptr, len);
+    }
+
     if (rc == (size_t) -1) {
         return NULL;
     }
@@ -906,7 +911,13 @@
 
     size_t    flen = strlen(toTranscode); // wLent;
     char    *ptr = wideCharBuf;
-    size_t    rc = iconvFrom(toTranscode, &flen, &ptr, len);
+    size_t rc;
+
+    {
+      XMLMutexLock lockConverter(&fMutex);
+      rc = iconvFrom(toTranscode, &flen, &ptr, len);
+    }
+
     if (rc == (size_t)-1) {
         return false;
     }
@@ -956,7 +967,6 @@
 
 IconvGNUTranscoder::~IconvGNUTranscoder()
 {
-    ICONV_LOCK;
     if (cdTo() != (iconv_t)-1) {
         iconv_close (cdTo());
         setCDTo ((iconv_t)-1);
@@ -1005,6 +1015,9 @@
     size_t    prevSrcLen = srcLen;
     unsigned int toReturn = 0;
     bytesEaten = 0;
+
+    XMLMutexLock lockConverter(&fMutex);
+
     for (size_t cnt = 0; cnt < maxChars && srcLen; cnt++) {
         size_t    rc = iconvFrom(startSrc, &srcLen, &orgTarget, uChSize());
         if (rc == (size_t)-1) {
@@ -1050,9 +1063,16 @@
     } else
         startSrc = (char *) srcData;
 
-    char*    startTarget = (char *) toFill;
-    size_t    srcLen = len;
-    size_t    rc = iconvTo (startSrc, &srcLen, &startTarget, maxBytes);
+    char* startTarget = (char *) toFill;
+    size_t srcLen = len;
+
+    size_t rc;
+
+    {
+      XMLMutexLock lockConverter(&fMutex);
+      rc = iconvTo (startSrc, &srcLen, &startTarget, maxBytes);
+    }
+
     if (rc == (size_t)-1 && errno != E2BIG) {
         ThrowXMLwithMemMgr(TranscodingException, XMLExcepts::Trans_BadSrcSeq, getMemoryManager());
     }
@@ -1060,10 +1080,10 @@
     return startTarget - (char *)toFill;
 }
 
-bool        IconvGNUTranscoder::canTranscodeTo
+bool IconvGNUTranscoder::canTranscodeTo
 (
     const unsigned int toCheck
-)   const
+)
 {
     //
     //  If the passed value is really a surrogate embedded together, then
@@ -1083,7 +1103,9 @@
     char    tmpBuf[64];
     char*    pTmpBuf = tmpBuf;
 
-    size_t    rc = iconvTo( srcBuf, &len, &pTmpBuf, 64);
+    XMLMutexLock lockConverter(&fMutex);
+    size_t rc = iconvTo( srcBuf, &len, &pTmpBuf, 64);
+
     return (rc != (size_t)-1) && (len == 0);
 }
 

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.hpp Mon Mar 10 07:10:09 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,6 +23,7 @@
 #define XERCESC_INCLUDE_GUARD_ICONVGNUTRANSSERVICE_HPP
 
 #include <xercesc/util/TransService.hpp>
+#include <xercesc/util/Mutexes.hpp>
 
 #include <iconv.h>
 
@@ -53,12 +54,6 @@
     // Convert XMLCh into "native unicode" character
     void	xmlChToMbc (XMLCh xch, char *mbc) const;
 
-    // Return uppercase equivalent for XMLCh
-    XMLCh 	toUpper (const XMLCh ch) const;
-
-    // Return uppercase equivalent for XMLCh
-    XMLCh 	toLower (const XMLCh ch) const;
-
     // Fill array of XMLCh characters with data, supplyed in the array
     // of "native unicode" characters.
     XMLCh*	mbsToXML (
@@ -77,6 +72,23 @@
       size_t		cnt
     ) const;
 
+    // Private data accessors
+    inline iconv_t	cdTo () const { return fCDTo; }
+    inline iconv_t	cdFrom () const { return fCDFrom; }
+    inline size_t	uChSize () const { return fUChSize; }
+    inline unsigned int	UBO () const { return fUBO; }
+
+protected:
+    // The following four functions should called with the fMutex
+    // locked.
+    //
+
+    // Return uppercase equivalent for XMLCh
+    XMLCh 	toUpper (const XMLCh ch);
+
+    // Return uppercase equivalent for XMLCh
+    XMLCh 	toLower (const XMLCh ch);
+
     // Wrapper aroung the iconv() for transcoding from the local charset
     size_t	iconvFrom
     (
@@ -84,7 +96,7 @@
       size_t		*fromLen,
       char		**toPtr,
       size_t		toLen
-    ) const;
+    );
 
     // Wrapper aroung the iconv() for transcoding to the local charset
     size_t	iconvTo
@@ -93,13 +105,7 @@
       size_t		*fromLen,
       char		**toPtr,
       size_t		toLen
-    ) const;
-
-    // Private data accessors
-    inline iconv_t	cdTo () const { return fCDTo; }
-    inline iconv_t	cdFrom () const { return fCDFrom; }
-    inline size_t	uChSize () const { return fUChSize; }
-    inline unsigned int	UBO () const { return fUBO; }
+    );
 
 protected:
 
@@ -135,6 +141,9 @@
     unsigned int fUBO;
     iconv_t	fCDTo;
     iconv_t	fCDFrom;
+
+protected:
+    XMLMutex    fMutex;
 };
 
 
@@ -175,8 +184,8 @@
 
     virtual bool supportsSrcOfs() const;
 
-    virtual void upperCase(XMLCh* const toUpperCase) const;
-    virtual void lowerCase(XMLCh* const toUpperCase) const;
+    virtual void upperCase(XMLCh* const toUpperCase);
+    virtual void lowerCase(XMLCh* const toUpperCase);
 
 protected :
     // -----------------------------------------------------------------------
@@ -258,7 +267,7 @@
     virtual bool canTranscodeTo
     (
         const   unsigned int	toCheck
-    )   const;
+    );
 
 private :
     // -----------------------------------------------------------------------

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.cpp Mon Mar 10 07:10:09 2008
@@ -291,7 +291,7 @@
 }
 
 
-void MacOSUnicodeConverter::upperCase(XMLCh* const toUpperCase) const
+void MacOSUnicodeConverter::upperCase(XMLCh* const toUpperCase)
 {
 #if TARGET_API_MAC_CARBON
 
@@ -320,7 +320,7 @@
 }
 
 
-void MacOSUnicodeConverter::lowerCase(XMLCh* const toLowerCase) const
+void MacOSUnicodeConverter::lowerCase(XMLCh* const toLowerCase)
 {
 #if TARGET_API_MAC_CARBON
 
@@ -587,7 +587,7 @@
 
 
 bool
-MacOSTranscoder::canTranscodeTo(const unsigned int toCheck) const
+MacOSTranscoder::canTranscodeTo(const unsigned int toCheck)
 {
 	//
     //  If the passed value is really a surrogate embedded together, then

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/MacOSUnicodeConverter/MacOSUnicodeConverter.hpp Mon Mar 10 07:10:09 2008
@@ -72,8 +72,8 @@
 
     virtual bool supportsSrcOfs() const;
 
-    virtual void upperCase(XMLCh* const toUpperCase) const;
-    virtual void lowerCase(XMLCh* const toLowerCase) const;
+    virtual void upperCase(XMLCh* const toUpperCase);
+    virtual void lowerCase(XMLCh* const toLowerCase);
 
 protected :
     // -----------------------------------------------------------------------
@@ -181,7 +181,7 @@
     virtual bool canTranscodeTo
     (
         const   unsigned int    toCheck
-    )   const;
+    );
 
 
 

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.cpp Mon Mar 10 07:10:09 2008
@@ -377,7 +377,7 @@
       return false;
 }
 
-void Uniconv390TransService::upperCase(XMLCh* const toUpperCase) const
+void Uniconv390TransService::upperCase(XMLCh* const toUpperCase)
 {
 
 //char localname1[500];
@@ -416,7 +416,7 @@
    }
 }
 
-void Uniconv390TransService::lowerCase(XMLCh* const toLowerCase) const
+void Uniconv390TransService::lowerCase(XMLCh* const toLowerCase)
 {
 //char localname1[500];
 //XMLString::transcode(toLowerCase,localname1,400);
@@ -1211,7 +1211,7 @@
 }
 
 
-bool Uniconv390Transcoder::canTranscodeTo(const unsigned int toCheck) const
+bool Uniconv390Transcoder::canTranscodeTo(const unsigned int toCheck)
 {
    int retCode;
 DBGPRINTF1("Uniconv390Transcoder::canTranscodeTo\n");

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/Uniconv390TransService.hpp Mon Mar 10 07:10:09 2008
@@ -73,8 +73,8 @@
 
     virtual bool supportsSrcOfs() const;
 
-    virtual void upperCase(XMLCh* const toUpperCase) const;
-    virtual void lowerCase(XMLCh* const toLowerCase) const;
+    virtual void upperCase(XMLCh* const toUpperCase);
+    virtual void lowerCase(XMLCh* const toLowerCase);
 
 protected :
     // -----------------------------------------------------------------------
@@ -145,7 +145,7 @@
     virtual bool canTranscodeTo
     (
         const   unsigned int    toCheck
-    )   const;
+    );
 
 
 

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XML256TableTranscoder390.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XML256TableTranscoder390.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XML256TableTranscoder390.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XML256TableTranscoder390.cpp Mon Mar 10 07:10:09 2008
@@ -151,7 +151,7 @@
 }
 
 
-bool XML256TableTranscoder390::canTranscodeTo(const unsigned int toCheck) const
+bool XML256TableTranscoder390::canTranscodeTo(const unsigned int toCheck)
 {
     return (xlatOneTo(toCheck) != 0);
 }

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XML256TableTranscoder390.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XML256TableTranscoder390.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XML256TableTranscoder390.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XML256TableTranscoder390.hpp Mon Mar 10 07:10:09 2008
@@ -67,7 +67,7 @@
     virtual bool canTranscodeTo
     (
         const   unsigned int    toCheck
-    )   const;
+    );
 
 
 protected :

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XML88591Transcoder390.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XML88591Transcoder390.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XML88591Transcoder390.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XML88591Transcoder390.cpp Mon Mar 10 07:10:09 2008
@@ -190,7 +190,7 @@
 }
 
 
-bool XML88591Transcoder390::canTranscodeTo(const unsigned int toCheck) const
+bool XML88591Transcoder390::canTranscodeTo(const unsigned int toCheck)
 {
     return (toCheck < 256);
 }

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XML88591Transcoder390.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XML88591Transcoder390.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XML88591Transcoder390.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XML88591Transcoder390.hpp Mon Mar 10 07:10:09 2008
@@ -77,7 +77,7 @@
     virtual bool canTranscodeTo
     (
         const   unsigned int    toCheck
-    )   const;
+    );
 
 
 private :

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XMLASCIITranscoder390.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XMLASCIITranscoder390.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XMLASCIITranscoder390.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XMLASCIITranscoder390.cpp Mon Mar 10 07:10:09 2008
@@ -210,7 +210,7 @@
 }
 
 
-bool XMLASCIITranscoder390::canTranscodeTo(const unsigned int toCheck) const
+bool XMLASCIITranscoder390::canTranscodeTo(const unsigned int toCheck)
 {
     return (toCheck < 0x80);
 }

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XMLASCIITranscoder390.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XMLASCIITranscoder390.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XMLASCIITranscoder390.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XMLASCIITranscoder390.hpp Mon Mar 10 07:10:09 2008
@@ -77,7 +77,7 @@
     virtual bool canTranscodeTo
     (
         const   unsigned int    toCheck
-    )   const;
+    );
 
 
 private :

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XMLUTF8Transcoder390.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XMLUTF8Transcoder390.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XMLUTF8Transcoder390.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XMLUTF8Transcoder390.cpp Mon Mar 10 07:10:09 2008
@@ -617,7 +617,7 @@
 }
 
 
-bool XMLUTF8Transcoder390::canTranscodeTo(const unsigned int toCheck) const
+bool XMLUTF8Transcoder390::canTranscodeTo(const unsigned int toCheck)
 {
     // We can represent anything in the Unicode (with surrogates) range
     return (toCheck <= 0x10FFFF);

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XMLUTF8Transcoder390.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XMLUTF8Transcoder390.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XMLUTF8Transcoder390.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Uniconv390/XMLUTF8Transcoder390.hpp Mon Mar 10 07:10:09 2008
@@ -78,7 +78,7 @@
     virtual bool canTranscodeTo
     (
         const   unsigned int    toCheck
-    )   const;
+    );
 
 
 private :

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.cpp Mon Mar 10 07:10:09 2008
@@ -528,12 +528,12 @@
 }
 
 
-void Win32TransService::upperCase(XMLCh* const toUpperCase) const
+void Win32TransService::upperCase(XMLCh* const toUpperCase)
 {
     wcsupr(toUpperCase);
 }
 
-void Win32TransService::lowerCase(XMLCh* const toLowerCase) const
+void Win32TransService::lowerCase(XMLCh* const toLowerCase)
 {
     wcslwr(toLowerCase);
 }
@@ -784,7 +784,7 @@
 }
 
 
-bool Win32Transcoder::canTranscodeTo(const unsigned int toCheck) const
+bool Win32Transcoder::canTranscodeTo(const unsigned int toCheck)
 {
     //
     //  If the passed value is really a surrogate embedded together, then

Modified: xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/Transcoders/Win32/Win32TransService.hpp Mon Mar 10 07:10:09 2008
@@ -69,8 +69,8 @@
 
     virtual bool supportsSrcOfs() const;
 
-    virtual void upperCase(XMLCh* const toUpperCase) const;
-    virtual void lowerCase(XMLCh* const toLowerCase) const;
+    virtual void upperCase(XMLCh* const toUpperCase);
+    virtual void lowerCase(XMLCh* const toLowerCase);
 
 
 protected :
@@ -164,7 +164,7 @@
     virtual bool canTranscodeTo
     (
         const   unsigned int    toCheck
-    )   const;
+    );
 
 
 private :

Modified: xerces/c/trunk/src/xercesc/util/XML256TableTranscoder.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XML256TableTranscoder.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XML256TableTranscoder.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/XML256TableTranscoder.cpp Mon Mar 10 07:10:09 2008
@@ -149,7 +149,7 @@
 }
 
 
-bool XML256TableTranscoder::canTranscodeTo(const unsigned int toCheck) const
+bool XML256TableTranscoder::canTranscodeTo(const unsigned int toCheck)
 {
     return (xlatOneTo(toCheck) != 0);
 }

Modified: xerces/c/trunk/src/xercesc/util/XML256TableTranscoder.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XML256TableTranscoder.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XML256TableTranscoder.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/XML256TableTranscoder.hpp Mon Mar 10 07:10:09 2008
@@ -67,7 +67,7 @@
     virtual bool canTranscodeTo
     (
         const   unsigned int    toCheck
-    )   const;
+    );
 
 
 protected :

Modified: xerces/c/trunk/src/xercesc/util/XML88591Transcoder.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XML88591Transcoder.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XML88591Transcoder.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/XML88591Transcoder.cpp Mon Mar 10 07:10:09 2008
@@ -138,7 +138,7 @@
 }
 
 
-bool XML88591Transcoder::canTranscodeTo(const unsigned int toCheck) const
+bool XML88591Transcoder::canTranscodeTo(const unsigned int toCheck)
 {
     return (toCheck < 256);
 }

Modified: xerces/c/trunk/src/xercesc/util/XML88591Transcoder.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XML88591Transcoder.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XML88591Transcoder.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/XML88591Transcoder.hpp Mon Mar 10 07:10:09 2008
@@ -77,7 +77,7 @@
     virtual bool canTranscodeTo
     (
         const   unsigned int    toCheck
-    )   const;
+    );
 
 
 private :

Modified: xerces/c/trunk/src/xercesc/util/XMLASCIITranscoder.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLASCIITranscoder.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLASCIITranscoder.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLASCIITranscoder.cpp Mon Mar 10 07:10:09 2008
@@ -164,7 +164,7 @@
 }
 
 
-bool XMLASCIITranscoder::canTranscodeTo(const unsigned int toCheck) const
+bool XMLASCIITranscoder::canTranscodeTo(const unsigned int toCheck)
 {
     return (toCheck < 0x80);
 }

Modified: xerces/c/trunk/src/xercesc/util/XMLASCIITranscoder.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLASCIITranscoder.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLASCIITranscoder.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLASCIITranscoder.hpp Mon Mar 10 07:10:09 2008
@@ -77,7 +77,7 @@
     virtual bool canTranscodeTo
     (
         const   unsigned int    toCheck
-    )   const;
+    );
 
 
 private :

Modified: xerces/c/trunk/src/xercesc/util/XMLChTranscoder.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLChTranscoder.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLChTranscoder.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLChTranscoder.cpp Mon Mar 10 07:10:09 2008
@@ -108,7 +108,7 @@
 }
 
 
-bool XMLChTranscoder::canTranscodeTo(const unsigned int) const
+bool XMLChTranscoder::canTranscodeTo(const unsigned int)
 {
     // We can handle anything
     return true;

Modified: xerces/c/trunk/src/xercesc/util/XMLChTranscoder.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLChTranscoder.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLChTranscoder.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLChTranscoder.hpp Mon Mar 10 07:10:09 2008
@@ -74,7 +74,7 @@
     virtual bool canTranscodeTo
     (
         const   unsigned int    toCheck
-    )   const;
+    );
 
 
 private :

Modified: xerces/c/trunk/src/xercesc/util/XMLException.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLException.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLException.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLException.cpp Mon Mar 10 07:10:09 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,10 +24,8 @@
 //  Includes
 // ---------------------------------------------------------------------------
 #include <xercesc/util/XMLException.hpp>
-#include <xercesc/util/Mutexes.hpp>
 #include <xercesc/util/PlatformUtils.hpp>
 #include <xercesc/util/XMLMsgLoader.hpp>
-#include <xercesc/util/XMLRegisterCleanup.hpp>
 #include <xercesc/util/XMLString.hpp>
 #include <xercesc/util/XMLUniDefs.hpp>
 #include <xercesc/util/XMLInitializer.hpp>
@@ -35,77 +33,29 @@
 
 XERCES_CPP_NAMESPACE_BEGIN
 
-// ---------------------------------------------------------------------------
-//  Local, static data
-// ---------------------------------------------------------------------------
 static XMLMsgLoader* sMsgLoader = 0;
-static XMLRegisterCleanup msgLoaderCleanup;
-static bool sScannerMutexRegistered = false;
-static XMLMutex* sMsgMutex = 0;
-static XMLRegisterCleanup msgMutexCleanup;
-
-// ---------------------------------------------------------------------------
-//  Local, static functions
-// ---------------------------------------------------------------------------
 
-//
-//  We need to fault in this mutex. But, since its used for synchronization
-//  itself, we have to do this the low level way using a compare and swap.
-//
-static XMLMutex& gMsgMutex()
+void XMLInitializer::initializeXMLException()
 {
-    if (!sScannerMutexRegistered)
-    {
-        XMLMutexLock lockInit(XMLPlatformUtils::fgAtomicMutex);
+    sMsgLoader = XMLPlatformUtils::loadMsgSet(XMLUni::fgExceptDomain);
 
-        if (!sScannerMutexRegistered)
-        {
-            sMsgMutex = new XMLMutex(XMLPlatformUtils::fgMemoryManager);
-            msgMutexCleanup.registerCleanup(XMLException::reinitMsgMutex);
-            sScannerMutexRegistered = true;
-        }
-    }
+    if (!sMsgLoader)
+      XMLPlatformUtils::panic(PanicHandler::Panic_CantLoadMsgDomain);
+}
 
-    return *sMsgMutex;
+void XMLInitializer::terminateXMLException()
+{
+    delete sMsgLoader;
+    sMsgLoader = 0;
 }
 
 //
-//  This method is a lazy evaluator for the message loader for exception
-//  messages.
 //
 static XMLMsgLoader& gGetMsgLoader()
 {
-    if (!sMsgLoader)
-    {
-        // Lock the message loader mutex and load the text
-	    XMLMutexLock lockInit(&gMsgMutex());
-
-        // Fault it in on first request
-        if (!sMsgLoader)
-        {
-            sMsgLoader = XMLPlatformUtils::loadMsgSet(XMLUni::fgExceptDomain);
-            if (!sMsgLoader)
-                XMLPlatformUtils::panic(PanicHandler::Panic_CantLoadMsgDomain);
-
-            //
-            // Register this XMLMsgLoader for cleanup at Termination.
-            //
-            msgLoaderCleanup.registerCleanup(XMLException::reinitMsgLoader);
-        }
-    }
-
-    // We got it, so return it
     return *sMsgLoader;
 }
 
-void XMLInitializer::initializeExceptionMsgLoader()
-{
-    sMsgLoader = XMLPlatformUtils::loadMsgSet(XMLUni::fgExceptDomain);
-    if (sMsgLoader) {
-        msgLoaderCleanup.registerCleanup(XMLException::reinitMsgLoader);
-    }
-}
-
 // ---------------------------------------------------------------------------
 //  XMLException: Virtual destructor
 // ---------------------------------------------------------------------------
@@ -163,7 +113,7 @@
     , fSrcFile(0)
     , fSrcLine(toCopy.fSrcLine)
     , fMsg(XMLString::replicate(toCopy.fMsg, toCopy.fMemoryManager))
-    , fMemoryManager(toCopy.fMemoryManager)        
+    , fMemoryManager(toCopy.fMemoryManager)
 {
     if (toCopy.fSrcFile) {
         fSrcFile = XMLString::replicate
@@ -295,25 +245,6 @@
 
     // We got the text so replicate it into the message member
     fMsg = XMLString::replicate(errText, fMemoryManager);
-}
-
-// -----------------------------------------------------------------------
-//  Reinitialise the message mutex
-// -----------------------------------------------------------------------
-void XMLException::reinitMsgMutex()
-{
-    delete sMsgMutex;
-    sMsgMutex = 0;
-    sScannerMutexRegistered = false;
-}
-
-// -----------------------------------------------------------------------
-//  Reinitialise the message loader
-// -----------------------------------------------------------------------
-void XMLException::reinitMsgLoader()
-{
-    delete sMsgLoader;
-    sMsgLoader = 0;
 }
 
 XERCES_CPP_NAMESPACE_END

Modified: xerces/c/trunk/src/xercesc/util/XMLException.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLException.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLException.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLException.hpp Mon Mar 10 07:10:09 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -82,13 +82,6 @@
     XMLException(const char* const srcFile, const unsigned int srcLine, MemoryManager* const memoryManager = 0);
     XMLException(const XMLException& toCopy);
     XMLException& operator=(const XMLException& toAssign);
-
-    // -----------------------------------------------------------------------
-    //  Notification that lazy data has been deleted
-    // -----------------------------------------------------------------------
-	static void reinitMsgMutex();
-
-	static void reinitMsgLoader();
 
 protected :
     // -----------------------------------------------------------------------

Modified: xerces/c/trunk/src/xercesc/util/XMLInitializer.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLInitializer.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLInitializer.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLInitializer.cpp Mon Mar 10 07:10:09 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,30 +31,91 @@
 // ---------------------------------------------------------------------------
 //  XMLInitializer: Initialization methods
 // ---------------------------------------------------------------------------
-void XMLInitializer::InitializeAllStaticData()
+void XMLInitializer::initializeStaticData()
 {
-    try {
-        initializeMsgLoader4DOM();
+    try
+    {
+        // Note that in some cases the order of initialization can be
+        // important.
+        //
+
+        // Core
+        //
+        initializeEncodingValidator();
+        initializeXMLException();
+        initializeXMLScanner();
+        initializeXMLValidator();
+
+        // Regex
+        //
         initializeRangeTokenMap();
         initializeRegularExpression();
-        initializeDOMImplementationImpl();
+
+        // DTD
+        //
+        initializeDTDGrammar();
+
+        // Schema
+        //
+        initializeXSDErrorReporter();
+        initializeDatatypeValidatorFactory();
+        initializeGeneralAttributeCheck();
+        initializeXSValue();
+        initializeComplexTypeInfo();
+
+        // DOM
+        //
         initializeDOMImplementationRegistry();
-        initializeEmptyNodeList();
-        initializeDOMNormalizerMsgLoader();
-        initializeValidatorMsgLoader();
-        initializeXSValueStatics();
-        initializeScannerMsgLoader();
-        initializeEncodingValidator();
-        initializeExceptionMsgLoader();
-        initializeDVFactory();
-        initializeGeneralAttrCheckMap();
-        initializeXSDErrReporterMsgLoader();
-        initializeDTDGrammarDfltEntities();
-        initializeAnyType();
+        initializeDOMImplementationImpl();
+        initializeDOMDocumentTypeImpl();
+        initializeDOMNodeListImpl();
+        initializeDOMNormalizer();
     }
     catch(...) {
         XMLPlatformUtils::panic(PanicHandler::Panic_AllStaticInitErr);
     }
+}
+
+
+void XMLInitializer::terminateStaticData()
+{
+    // Terminate in the reverse order of initialization. There shouldn't
+    // be any exceptions and if there are, we can't do anything about them
+    // since we are no longer initialized (think of it as throwing from
+    // a destructor).
+    //
+
+    // DOM
+    //
+    terminateDOMNormalizer();
+    terminateDOMNodeListImpl();
+    terminateDOMDocumentTypeImpl();
+    terminateDOMImplementationImpl();
+    terminateDOMImplementationRegistry();
+
+    // Schema
+    //
+    terminateComplexTypeInfo();
+    terminateXSValue();
+    terminateGeneralAttributeCheck();
+    terminateDatatypeValidatorFactory();
+    terminateXSDErrorReporter();
+
+    // DTD
+    //
+    terminateDTDGrammar();
+
+    // Regex
+    //
+    terminateRegularExpression();
+    terminateRangeTokenMap();
+
+    // Core
+    //
+    terminateXMLValidator();
+    terminateXMLScanner();
+    terminateXMLException();
+    terminateEncodingValidator();
 }
 
 

Modified: xerces/c/trunk/src/xercesc/util/XMLInitializer.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLInitializer.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLInitializer.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLInitializer.hpp Mon Mar 10 07:10:09 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,46 +40,106 @@
     /** @name Initialization methods */
     //@{
 
-    /** Perform per-class initialization of static data
+    /** Perform per-class allocationa and initialization of static data
       *
-      * Initialization <b>must</b> be called in XMLPlatformUtils::Initialize.
+      * These functions should be called from XMLPlatformUtils::Initialize.
       */
-    static void InitializeAllStaticData();
+    static void initializeTransService();
+    static void initializeStaticData();
+
+    /** Perform per-class release of static data
+      *
+      * These functions should be called from XMLPlatformUtils::Terminate.
+      */
+    static void terminateStaticData();
+    static void terminateTransService();
 
     //@}
 
     friend class XMLPlatformUtils;
 
 private :
-    // -----------------------------------------------------------------------
-    //  Unimplemented constructors and operators
-    // -----------------------------------------------------------------------
     XMLInitializer();
     XMLInitializer(const XMLInitializer& toCopy);
     XMLInitializer& operator=(const XMLInitializer&);
 
-    /** @name Private static initialization methods */
-    //@{
+private:
+    // Note: The name of each function should be in the form
+    // initialize<class-name>.
+    //
+
+    //
+    // Initialize
+    //
 
-    static void initializeMsgLoader4DOM();
-    static void initializeDOMImplementationImpl();
-    static void initializeDOMImplementationRegistry();
-    static void initializeEmptyNodeList();
-    static void initializeDOMNormalizerMsgLoader();
-    static void initializeValidatorMsgLoader();
-    static void initializeXSValueStatics();
-    static void initializeScannerMsgLoader();
+    // Core
+    //
     static void initializeEncodingValidator();
-    static void initializeExceptionMsgLoader();
-    static void initializeDVFactory();
-    static void initializeGeneralAttrCheckMap();
-    static void initializeXSDErrReporterMsgLoader();
-    static void initializeDTDGrammarDfltEntities();
+    static void initializeXMLException();
+    static void initializeXMLScanner();
+    static void initializeXMLValidator();
+
+    // Regex
+    //
     static void initializeRangeTokenMap();
     static void initializeRegularExpression();
-    static void initializeAnyType();
 
-    //@}
+    // DTD
+    //
+    static void initializeDTDGrammar();
+
+    // Schema
+    //
+    static void initializeXSDErrorReporter();
+    static void initializeDatatypeValidatorFactory();
+    static void initializeGeneralAttributeCheck();
+    static void initializeXSValue();
+    static void initializeComplexTypeInfo();
+
+    // DOM
+    //
+    static void initializeDOMImplementationRegistry();
+    static void initializeDOMImplementationImpl();
+    static void initializeDOMDocumentTypeImpl();
+    static void initializeDOMNodeListImpl();
+    static void initializeDOMNormalizer();
+
+
+    //
+    // Terminate
+    //
+
+    // Core
+    //
+    static void terminateEncodingValidator();
+    static void terminateXMLException();
+    static void terminateXMLScanner();
+    static void terminateXMLValidator();
+
+    // Regex
+    //
+    static void terminateRangeTokenMap();
+    static void terminateRegularExpression();
+
+    // DTD
+    //
+    static void terminateDTDGrammar();
+
+    // Schema
+    //
+    static void terminateXSDErrorReporter();
+    static void terminateDatatypeValidatorFactory();
+    static void terminateGeneralAttributeCheck();
+    static void terminateXSValue();
+    static void terminateComplexTypeInfo();
+
+    // DOM
+    //
+    static void terminateDOMImplementationRegistry();
+    static void terminateDOMImplementationImpl();
+    static void terminateDOMDocumentTypeImpl();
+    static void terminateDOMNodeListImpl();
+    static void terminateDOMNormalizer();
 };
 
 

Modified: xerces/c/trunk/src/xercesc/util/XMLUCS4Transcoder.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLUCS4Transcoder.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLUCS4Transcoder.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLUCS4Transcoder.cpp Mon Mar 10 07:10:09 2008
@@ -231,7 +231,7 @@
 }
 
 
-bool XMLUCS4Transcoder::canTranscodeTo(const unsigned int) const
+bool XMLUCS4Transcoder::canTranscodeTo(const unsigned int)
 {
     // We can handle anything
     return true;

Modified: xerces/c/trunk/src/xercesc/util/XMLUCS4Transcoder.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLUCS4Transcoder.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLUCS4Transcoder.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLUCS4Transcoder.hpp Mon Mar 10 07:10:09 2008
@@ -78,7 +78,7 @@
     virtual bool canTranscodeTo
     (
         const   unsigned int    toCheck
-    )   const;
+    );
 
 
 private :

Modified: xerces/c/trunk/src/xercesc/util/XMLUTF16Transcoder.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLUTF16Transcoder.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLUTF16Transcoder.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLUTF16Transcoder.cpp Mon Mar 10 07:10:09 2008
@@ -187,7 +187,7 @@
 }
 
 
-bool XMLUTF16Transcoder::canTranscodeTo(const unsigned int) const
+bool XMLUTF16Transcoder::canTranscodeTo(const unsigned int)
 {
     // We can handle anything
     return true;

Modified: xerces/c/trunk/src/xercesc/util/XMLUTF16Transcoder.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLUTF16Transcoder.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLUTF16Transcoder.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLUTF16Transcoder.hpp Mon Mar 10 07:10:09 2008
@@ -79,7 +79,7 @@
     virtual bool canTranscodeTo
     (
         const   unsigned int    toCheck
-    )   const;
+    );
 
 
 private :

Modified: xerces/c/trunk/src/xercesc/util/XMLUTF8Transcoder.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLUTF8Transcoder.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLUTF8Transcoder.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLUTF8Transcoder.cpp Mon Mar 10 07:10:09 2008
@@ -549,7 +549,7 @@
 }
 
 
-bool XMLUTF8Transcoder::canTranscodeTo(const unsigned int toCheck) const
+bool XMLUTF8Transcoder::canTranscodeTo(const unsigned int toCheck)
 {
     // We can represent anything in the Unicode (with surrogates) range
     return (toCheck <= 0x10FFFF);

Modified: xerces/c/trunk/src/xercesc/util/XMLUTF8Transcoder.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLUTF8Transcoder.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLUTF8Transcoder.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLUTF8Transcoder.hpp Mon Mar 10 07:10:09 2008
@@ -78,7 +78,7 @@
     virtual bool canTranscodeTo
     (
         const   unsigned int    toCheck
-    )   const;
+    );
 
 
 private :

Modified: xerces/c/trunk/src/xercesc/util/regx/RangeTokenMap.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/regx/RangeTokenMap.cpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/regx/RangeTokenMap.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/regx/RangeTokenMap.cpp Mon Mar 10 07:10:09 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,58 +32,27 @@
 #include <xercesc/util/regx/BlockRangeFactory.hpp>
 #include <xercesc/util/PlatformUtils.hpp>
 #include <xercesc/util/XMLExceptMsgs.hpp>
-#include <xercesc/util/XMLRegisterCleanup.hpp>
 #include <xercesc/util/StringPool.hpp>
 #include <xercesc/util/XMLInitializer.hpp>
 #include <xercesc/util/OutOfMemoryException.hpp>
 
 XERCES_CPP_NAMESPACE_BEGIN
 
-// ---------------------------------------------------------------------------
-//  Local static data
-// ---------------------------------------------------------------------------
-static XMLMutex* sRangeTokMapMutex = 0;
-static XMLRegisterCleanup rangeTokMapRegistryCleanup;
-static XMLRegisterCleanup rangeTokMapInstanceCleanup;
-
-// ---------------------------------------------------------------------------
-//  Local, static functions
-// ---------------------------------------------------------------------------
-static void reinitRangeTokMapMutex()
-{
-    delete sRangeTokMapMutex;
-    sRangeTokMapMutex = 0;
-}
+RangeTokenMap* RangeTokenMap::fInstance = 0;
 
-static XMLMutex& getRangeTokMapMutex()
+void XMLInitializer::initializeRangeTokenMap()
 {
-    if (!sRangeTokMapMutex)
-    {
-        XMLMutexLock lock(XMLPlatformUtils::fgAtomicMutex);
+    RangeTokenMap::fInstance = new RangeTokenMap(
+      XMLPlatformUtils::fgMemoryManager);
 
-        // If we got here first, then register it and set the registered flag
-        if (!sRangeTokMapMutex)
-        {
-            sRangeTokMapMutex = new XMLMutex(XMLPlatformUtils::fgMemoryManager);
-            rangeTokMapRegistryCleanup.registerCleanup(reinitRangeTokMapMutex);
-        }
-    }
-    return *sRangeTokMapMutex;
+    if (RangeTokenMap::fInstance)
+      RangeTokenMap::fInstance->buildTokenRanges();
 }
 
-// ---------------------------------------------------------------------------
-//  Static member data initialization
-// ---------------------------------------------------------------------------
-RangeTokenMap* RangeTokenMap::fInstance = 0;
-
-void XMLInitializer::initializeRangeTokenMap()
+void XMLInitializer::terminateRangeTokenMap()
 {
-    RangeTokenMap::fInstance = new RangeTokenMap(XMLPlatformUtils::fgMemoryManager);
-    if (RangeTokenMap::fInstance)
-    {
-        rangeTokMapInstanceCleanup.registerCleanup(RangeTokenMap::reinitInstance);
-        RangeTokenMap::fInstance->buildTokenRanges();
-    }
+    delete RangeTokenMap::fInstance;
+    RangeTokenMap::fInstance = 0;
 }
 
 
@@ -292,18 +261,7 @@
 // ---------------------------------------------------------------------------
 RangeTokenMap* RangeTokenMap::instance()
 {
-    if (!fInstance)
-    {
-        XMLMutexLock lock(&getRangeTokMapMutex());
-
-        if (!fInstance)
-        {
-            fInstance = new RangeTokenMap(XMLPlatformUtils::fgMemoryManager);
-            rangeTokMapInstanceCleanup.registerCleanup(RangeTokenMap::reinitInstance);
-        }
-    }
-
-    return (fInstance);
+    return fInstance;
 }
 
 // ---------------------------------------------------------------------------
@@ -322,15 +280,6 @@
 
     delete fTokenFactory;
     fTokenFactory = 0;
-}
-
-// -----------------------------------------------------------------------
-//  Notification that lazy data has been deleted
-// -----------------------------------------------------------------------
-void RangeTokenMap::reinitInstance() {
-
-    delete fInstance;
-    fInstance = 0;
 }
 
 XERCES_CPP_NAMESPACE_END

Modified: xerces/c/trunk/src/xercesc/util/regx/RangeTokenMap.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/regx/RangeTokenMap.hpp?rev=635560&r1=635559&r2=635560&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/regx/RangeTokenMap.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/regx/RangeTokenMap.hpp Mon Mar 10 07:10:09 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -78,7 +78,7 @@
     //  Putter methods
     // -----------------------------------------------------------------------
     void addCategory(const XMLCh* const categoryName);
-	void addRangeMap(const XMLCh* const categoryName,
+    void addRangeMap(const XMLCh* const categoryName,
                      RangeFactory* const rangeFactory);
     void addKeywordMap(const XMLCh* const keyword,
                        const XMLCh* const categoryName);
@@ -91,18 +91,13 @@
     // -----------------------------------------------------------------------
     //  Setter methods
     // -----------------------------------------------------------------------
-	void setRangeToken(const XMLCh* const keyword, RangeToken* const tok,
+    void setRangeToken(const XMLCh* const keyword, RangeToken* const tok,
                        const bool complement = false);
 
     // -----------------------------------------------------------------------
     //  Getter methods
     // -----------------------------------------------------------------------
-	TokenFactory* getTokenFactory() const;
-
-	// -----------------------------------------------------------------------
-    //  Notification that lazy data has been deleted
-    // -----------------------------------------------------------------------
-	static void reinitInstance();
+    TokenFactory* getTokenFactory() const;
 
 protected:
     // -----------------------------------------------------------------------
@@ -118,7 +113,7 @@
      *  Gets a commonly used RangeToken from the token registry based on the
      *  range name - Called by TokenFactory.
      */
-	 RangeToken* getRange(const XMLCh* const name,
+     RangeToken* getRange(const XMLCh* const name,
                           const bool complement = false);
 
      RefHashTableOf<RangeTokenElemMap>* getTokenRegistry() const;
@@ -149,7 +144,7 @@
     //
     //  fTokenRegistry
     //      Contains a set of commonly used tokens
-	//
+    //
     //  fRangeMap
     //      Contains a map between a category name and a RangeFactory object.
     //
@@ -164,10 +159,10 @@
     //
     //  fMutex
     //      A mutex object for synchronization
-    // -----------------------------------------------------------------------	
+    // -----------------------------------------------------------------------
     RefHashTableOf<RangeTokenElemMap>* fTokenRegistry;
     RefHashTableOf<RangeFactory>*      fRangeMap;
-	XMLStringPool*                     fCategories;
+    XMLStringPool*                     fCategories;
     TokenFactory*                      fTokenFactory;
     XMLMutex                           fMutex;
     static RangeTokenMap*              fInstance;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org