← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/threads into lp:zorba

 

Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/threads into lp:zorba.

Commit message:
Adding Xereces mutex for multi-thread safety

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/threads/+merge/187178

Adding Xereces mutex for multi-thread safety
-- 
https://code.launchpad.net/~zorba-coders/zorba/threads/+merge/187178
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/system/globalenv.cpp'
--- src/system/globalenv.cpp	2013-09-19 16:47:08 +0000
+++ src/system/globalenv.cpp	2013-09-24 09:51:29 +0000
@@ -96,7 +96,7 @@
 
   ZORBA_FATAL(store != NULL, "Must provide store during zorba initialization");
 
-  m_globalEnv->m_store = store;
+  m_globalEnv->theStore = store;
 
   m_globalEnv->theRootTypeManager = new RootTypeManager;
   RCHelper::addReference(m_globalEnv->theRootTypeManager);
@@ -169,7 +169,7 @@
 
   AnnotationInternal::destroyBuiltIn();
 
-  m_globalEnv->m_store = NULL;
+  m_globalEnv->theStore = NULL;
 
   // we shutdown icu
   // again it is important to mention this in the documentation
@@ -206,7 +206,7 @@
 ********************************************************************************/
 GlobalEnvironment::GlobalEnvironment()
   :
-  m_store(0), 
+  theStore(0), 
   theRootTypeManager(NULL),
   theRootStaticContext(0),
   m_compilerSubSys(0)
@@ -310,19 +310,19 @@
 
 store::Store& GlobalEnvironment::getStore()
 {
-  return *m_store;
+  return *theStore;
 }
 
 
 store::ItemFactory* GlobalEnvironment::getItemFactory()
 {
-  return m_store->getItemFactory();
+  return theStore->getItemFactory();
 }
 
 
 store::IteratorFactory* GlobalEnvironment::getIteratorFactory()
 {
-  return m_store->getIteratorFactory();
+  return theStore->getIteratorFactory();
 }
 
 

=== modified file 'src/system/globalenv.h'
--- src/system/globalenv.h	2013-09-17 21:12:49 +0000
+++ src/system/globalenv.h	2013-09-24 09:51:29 +0000
@@ -61,7 +61,7 @@
   static GlobalEnvironment        * m_globalEnv;
 
 private:
-  store::Store                    * m_store;
+  store::Store                    * theStore;
 
   RootTypeManager                 * theRootTypeManager;
 

=== modified file 'src/types/casting.cpp'
--- src/types/casting.cpp	2013-09-17 21:12:49 +0000
+++ src/types/casting.cpp	2013-09-24 09:51:29 +0000
@@ -2657,7 +2657,8 @@
 
   if (!targetType->isAtomicOne())
   {
-    if ( throw_on_error ) {
+    if ( throw_on_error )
+    {
       RAISE_ERROR(err::XPST0051, loc,
       ERROR_PARAMS(ZED(XPST0051_Atomic_2), targetType));
     }
@@ -2700,9 +2701,11 @@
   {
     CastFunc castFunc = theCastMatrix[theMapping[sourceTypeCode]]
                                       [theMapping[targetTypeCode]];
-    if (castFunc == 0) {
+    if (castFunc == 0)
+    {
       if ( throw_on_error )
         throwXPTY0004Exception(errInfo);
+
       return false;
     }
 
@@ -3202,7 +3205,7 @@
     TypeManager* tm)
 {
 #ifndef ZORBA_NO_XMLSCHEMA
-  if (targetType->type_kind() == XQType::USER_DEFINED_KIND )
+  if (targetType->type_kind() == XQType::USER_DEFINED_KIND)
   {
     const UserDefinedXQType* udt = static_cast<const UserDefinedXQType*>(targetType);
     if (!udt->isComplex())
@@ -3254,20 +3257,19 @@
 ********************************************************************************/
 bool GenericCast::isCastable(
     const zstring& str,
-    const XQType* aTargetType,
+    const XQType* targetType,
     TypeManager* tm)
 {
 #ifndef ZORBA_NO_XMLSCHEMA
-  if (aTargetType->type_kind() == XQType::USER_DEFINED_KIND )
+  if (targetType->type_kind() == XQType::USER_DEFINED_KIND )
   {
-    const UserDefinedXQType* udt = static_cast<const UserDefinedXQType*>(aTargetType);
+    const UserDefinedXQType* udt = static_cast<const UserDefinedXQType*>(targetType);
     if (!udt->isComplex())
     {
       tm->initializeSchema();
 
       return tm->getSchema()->
-             isCastableUserSimpleTypes(str,
-                                       udt->getBaseType().getp());
+             isCastableUserSimpleTypes(str, udt->getBaseType().getp());
     }
   }
 #endif // ZORBA_NO_XMLSCHEMA
@@ -3276,8 +3278,9 @@
 
   xqtref_t lSourceType = rtm.STRING_TYPE_ONE;
 
-  TypeConstants::castable_t lIsCastable = TypeOps::castability(*lSourceType,
-                                                               *aTargetType);
+  TypeConstants::castable_t lIsCastable =
+  TypeOps::castability(*lSourceType, *targetType);
+
   switch(lIsCastable)
   {
   case TypeConstants::NOT_CASTABLE:
@@ -3292,7 +3295,7 @@
     {
       store::Item_t dummy;
       zstring copyStr = str;
-      return castStringToAtomic(dummy, copyStr, aTargetType, tm, NULL, QueryLoc::null, false);
+      return castStringToAtomic(dummy, copyStr, targetType, tm, NULL, QueryLoc::null, false);
     }
     catch (ZorbaException const&)
     {

=== modified file 'src/types/root_typemanager.h'
--- src/types/root_typemanager.h	2013-06-15 02:57:08 +0000
+++ src/types/root_typemanager.h	2013-09-24 09:51:29 +0000
@@ -18,9 +18,11 @@
 #define ZORBA_ROOT_TYPEMANAGER_H
 
 #include <assert.h>
+
 #include "types/typeconstants.h"
 #include "types/typeimpl.h"
 #include "types/typemanagerimpl.h"
+
 #include "zorbautils/hashmap.h"
 
 namespace zorba {
@@ -40,6 +42,8 @@
   friend class AtomicXQType;
 
 public:
+  SYNC_CODE(Mutex theXercesMutex;)
+
   /**
    * Pre-allocated XQType object for the "none" type.
    */
@@ -320,6 +324,8 @@
 public:
   ~RootTypeManager();
 
+  SYNC_CODE(Mutex* getXercesMutex() { return &theXercesMultex; })
+
 private:
   RootTypeManager();
 };

=== modified file 'src/types/schema/schema.cpp'
--- src/types/schema/schema.cpp	2013-09-19 16:47:08 +0000
+++ src/types/schema/schema.cpp	2013-09-24 09:51:29 +0000
@@ -301,10 +301,12 @@
   }
 
   StaticContextEntityResolver(
-    const XMLCh* const aLogicalURI,
-    static_context * aSctx,
-    internal::StreamResource* aStreamResource)
-    : theLogicalURI(aLogicalURI), theSctx(aSctx)
+      const XMLCh* const aLogicalURI,
+      static_context * aSctx,
+      internal::StreamResource* aStreamResource)
+    :
+    theLogicalURI(aLogicalURI),
+    theSctx(aSctx)
   {
     // Take memory ownership of the istream
     theStream = aStreamResource->getStream();
@@ -345,10 +347,15 @@
   ZORBA_ASSERT(tm != &GENV_TYPESYSTEM);
 
 #ifndef ZORBA_NO_XMLSCHEMA
-  theGrammarPool = new XMLGrammarPoolImpl(XMLPlatformUtils::fgMemoryManager);
-  // QQQ should be zstring
+  {
+    SYNC_CODE(AutoMutex(GENV_TYPESYSTEM.getXercesMutex());)
+
+   theGrammarPool = new XMLGrammarPoolImpl(XMLPlatformUtils::fgMemoryManager);
+  }
+
   theUdTypesCache = 
   new HashMap<zstring, xqtref_t, HashMapZStringCmp>(64, false);
+
 #endif
 }
 
@@ -359,7 +366,10 @@
 Schema::Schema(::zorba::serialization::Archiver& ar)
 {
 #ifndef ZORBA_NO_XMLSCHEMA
+  SYNC_CODE(AutoMutex(GENV_TYPESYSTEM.getXercesMutex());)
+
   theGrammarPool = new XMLGrammarPoolImpl(XMLPlatformUtils::fgMemoryManager);
+
   theHasXSD = false;
 #endif
 }
@@ -371,12 +381,105 @@
 Schema::~Schema()
 {
 #ifndef ZORBA_NO_XMLSCHEMA
-  delete theGrammarPool;
+  {
+    SYNC_CODE(AutoMutex(GENV_TYPESYSTEM.getXercesMutex());)
+
+    delete theGrammarPool;
+  }
+
   delete theUdTypesCache;
 #endif
 }
 
 
+/*******************************************************************************
+
+*******************************************************************************/
+void Schema::serialize(::zorba::serialization::Archiver& ar)
+{
+  SERIALIZE_TYPEMANAGER(TypeManager, theTypeManager);
+
+#ifndef ZORBA_NO_XMLSCHEMA
+   ar & theUdTypesCache;
+
+   SYNC_CODE(AutoMutex(GENV_TYPESYSTEM.getXercesMutex());)
+
+   bool is_grammar_NULL = (theGrammarPool == NULL);
+
+   ar.set_is_temp_field(true);
+
+   ar & is_grammar_NULL;
+
+   csize size_of_size_t = sizeof(size_t);
+
+   union
+   {
+     unsigned long lvalue;
+     unsigned char cvalue[4];
+   } le_be_value;
+
+   le_be_value.lvalue = 0x11223344;
+
+   if (ar.is_serializing_out())
+   {
+     ar & size_of_size_t;
+     ar & le_be_value.cvalue[0];
+
+     if (!is_grammar_NULL)
+     {
+       BinMemOutputStream binmemoutputstream;
+       zstring binstr;
+
+       try
+       {
+         theGrammarPool->serializeGrammars(&binmemoutputstream);
+         binstr.assign((char*)binmemoutputstream.getRawBuffer(),
+                        static_cast<zstring::size_type>(binmemoutputstream.getSize()) );
+       }
+       catch (...)
+       {
+       }
+
+       ar & binstr;
+     }
+   }
+   else
+   {
+     csize size_of_size_t2;
+     unsigned char le_be_value_first_char;
+
+     ar & size_of_size_t2;
+     ar & le_be_value_first_char;
+
+     if (size_of_size_t2 != size_of_size_t ||
+         le_be_value_first_char != le_be_value.cvalue[0])
+     {
+       throw ZORBA_EXCEPTION(zerr::ZCSE0015_INCOMPATIBLE_BETWEEN_32_AND_64_BITS_OR_LE_AND_BE);
+     }
+
+     if (!is_grammar_NULL)
+     {
+       zstring binstr;
+
+       ar & binstr;
+
+       if (!binstr.empty())
+       {
+         BinMemInputStream binmeminputstream((XMLByte*)binstr.c_str(), binstr.size());
+         theGrammarPool->deserializeGrammars(&binmeminputstream);
+       }
+     }
+     else
+     {
+       theGrammarPool = NULL;
+     }
+   }
+
+   ar.set_is_temp_field(false);
+#endif
+}
+
+
 
 /*******************************************************************************
   Prints out info about the current schema grammar
@@ -405,6 +508,8 @@
 
   TRACE("url=" << xsdURL << " loc=" << loc);
 
+  SYNC_CODE(AutoMutex(GENV_TYPESYSTEM.getXercesMutex());)
+
   try
   {
     SAX2XMLReader* reader =
@@ -458,19 +563,12 @@
   }
   catch (const OutOfMemoryException&)
   {
-    throw XQUERY_EXCEPTION(
-      zerr::ZXQP0014_OUT_OF_MEMORY,
-      ERROR_PARAMS( xsdURL ),
-      ERROR_LOC( loc )
-    );
+    RAISE_ERROR(zerr::ZXQP0014_OUT_OF_MEMORY, loc, ERROR_PARAMS(xsdURL));
   }
   catch (const XMLException& e)
   {
-    throw XQUERY_EXCEPTION(
-      zerr::ZXQP0033_SCHEMA_XML_ERROR,
-      ERROR_PARAMS( xsdURL, e.getMessage() ),
-      ERROR_LOC( loc )
-    );
+    RAISE_ERROR(zerr::ZXQP0033_SCHEMA_XML_ERROR, loc,
+    ERROR_PARAMS(xsdURL, e.getMessage()));
   }
   catch (const ZorbaException&)
   {
@@ -478,11 +576,7 @@
   }
   catch (...)
   {
-    throw XQUERY_EXCEPTION(
-      zerr::ZXQP0035_SCHEMA_UNEXPECTED_ERROR,
-      ERROR_PARAMS( xsdURL ),
-      ERROR_LOC( loc )
-    );
+    RAISE_ERROR(zerr::ZXQP0035_SCHEMA_UNEXPECTED_ERROR, loc, ERROR_PARAMS(xsdURL));
   }
 
 #ifdef DO_PRINT_SCHEMA_INFO
@@ -503,6 +597,8 @@
     bool& nillable,
     const QueryLoc& loc)
 {
+  SYNC_CODE(AutoMutex(GENV_TYPESYSTEM.getXercesMutex());)
+
   XSElementDeclaration* decl = getDeclForElement(qname);
 
   if (!decl)
@@ -541,6 +637,8 @@
   TRACE("qn:" << qname->getLocalName() << " @ " <<
         qname->getNamespace() );
 
+  SYNC_CODE(AutoMutex(GENV_TYPESYSTEM.getXercesMutex());)
+
   XSElementDeclaration* decl = getDeclForElement(qname);
 
   if (!raiseErrors && !decl)
@@ -574,6 +672,8 @@
     store::Item_t& typeName,
     const QueryLoc& loc)
 {
+  SYNC_CODE(AutoMutex(GENV_TYPESYSTEM.getXercesMutex());)
+
   XSTypeDefinition* typeDef = getTypeDefForAttribute(qname);
 
   if (!typeDef)
@@ -602,6 +702,8 @@
     const bool raiseErrors,
     const QueryLoc& loc)
 {
+  SYNC_CODE(AutoMutex(GENV_TYPESYSTEM.getXercesMutex());)
+
   XSTypeDefinition* typeDef = getTypeDefForAttribute(qname);
 
   if (!raiseErrors && !typeDef)
@@ -632,6 +734,8 @@
         << qname->getLocalName() << "@"
         << qname->getNamespace());
 
+  SYNC_CODE(AutoMutex(GENV_TYPESYSTEM.getXercesMutex());)
+
   if (theGrammarPool == NULL)
     return NULL;
 
@@ -703,6 +807,8 @@
 
   result = NULL;
 
+  SYNC_CODE(AutoMutex(GENV_TYPESYSTEM.getXercesMutex());)
+
   if (theGrammarPool == NULL)
     return;
 
@@ -1310,7 +1416,8 @@
   }
 
   XSNamedMap<XSObject> * attrDefs =
-      model->getComponents(XSConstants::ATTRIBUTE_DECLARATION);
+  model->getComponents(XSConstants::ATTRIBUTE_DECLARATION);
+
   for( uint i = 0; i<attrDefs->getLength(); i++)
   {
     XSAttributeDeclaration* attrDecl =
@@ -1321,7 +1428,8 @@
   }
 
   XSNamedMap<XSObject> * attrGroupDefs =
-      model->getComponents(XSConstants::ATTRIBUTE_GROUP_DEFINITION);
+  model->getComponents(XSConstants::ATTRIBUTE_GROUP_DEFINITION);
+
   for( uint i = 0; i<attrGroupDefs->getLength(); i++)
   {
     XSAttributeGroupDefinition* attrGroupDef =
@@ -1339,7 +1447,8 @@
   }
 
   XSNamedMap<XSObject> * modelGroupDefs =
-      model->getComponents(XSConstants::MODEL_GROUP_DEFINITION);
+  model->getComponents(XSConstants::MODEL_GROUP_DEFINITION);
+  
   for( uint i = 0; i<modelGroupDefs->getLength(); i++)
   {
     XSModelGroupDefinition* modelGroupDef =
@@ -1606,7 +1715,7 @@
   }
 
   const UserDefinedXQType* udXQType =
-    static_cast<const UserDefinedXQType*>(aTargetType.getp());
+  static_cast<const UserDefinedXQType*>(aTargetType.getp());
 
   ZORBA_ASSERT(udXQType->isAtomicAny() || udXQType->isList() || udXQType->isUnion());
 
@@ -1621,7 +1730,9 @@
                                      loc, isCasting);
 
     if ( !hasResult )
+    {
       return false;
+    }
     else
     {
       //resultList.push_back(atomicResult);
@@ -1765,11 +1876,15 @@
     else
     {
       if ( isCasting )
+      {
         RAISE_ERROR(err::FORG0001, loc,
-          ERROR_PARAMS(ZED(FORG0001_NoTypeInCtx_2), targetType->toSchemaString()));
+        ERROR_PARAMS(ZED(FORG0001_NoTypeInCtx_2), targetType->toSchemaString()));
+      }
       else
+      {
         RAISE_ERROR(err::XQDY0027, loc,
-          ERROR_PARAMS(ZED(XQDY0027_NoTypeInCtx_2), targetType->toSchemaString()));
+        ERROR_PARAMS(ZED(XQDY0027_NoTypeInCtx_2), targetType->toSchemaString()));
+      }
     }
   }
   catch (XMLException& idve)
@@ -1882,11 +1997,15 @@
   if (atomicTextValues.empty())
   {
     if ( isCasting )
+    {
       RAISE_ERROR(err::FORG0001, loc,
-        ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, udt->toSchemaString()));
+      ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, udt->toSchemaString()));
+    }
     else
+    {
       RAISE_ERROR(err::XQDY0027, loc,
-        ERROR_PARAMS(ZED(XQDY0027_InvalidValue), textValue, udt->toSchemaString()));
+      ERROR_PARAMS(ZED(XQDY0027_InvalidValue), textValue, udt->toSchemaString()));
+    }
   }
 
   for (csize i = 0; i < atomicTextValues.size() ; ++i)
@@ -1927,11 +2046,11 @@
   {
     try
     {
-      if (isCastableUserSimpleTypes(textValue, unionItemTypes[i]))
-      {
+      //if (isCastableUserSimpleTypes(textValue, unionItemTypes[i]))
+      //{
         return parseUserSimpleTypes(textValue, unionItemTypes[i], resultList,
                                     loc, isCasting);
-      }
+        //}
     }
     catch(ZorbaException const&)
     {
@@ -1939,12 +2058,15 @@
   }
 
   if ( isCasting )
+  {
     RAISE_ERROR(err::FORG0001, loc,
-      ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, udt->toSchemaString()));
+    ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, udt->toSchemaString()));
+  }
   else
+  {
     RAISE_ERROR(err::XQDY0027, loc,
-      ERROR_PARAMS(ZED(XQDY0027_InvalidValue), textValue, udt->toSchemaString()));
-
+    ERROR_PARAMS(ZED(XQDY0027_InvalidValue), textValue, udt->toSchemaString()));
+  }
 }
 
 
@@ -1960,18 +2082,17 @@
     // must be a built in type
     store::Item_t atomicResult;
     
-    return GenericCast::instance()->isCastable(textValue, aTargetType, theTypeManager);
+    return GenericCast::isCastable(textValue, aTargetType, theTypeManager);
     //todo add nsCtx
   }
 
   ZORBA_ASSERT( aTargetType->type_kind() == XQType::USER_DEFINED_KIND );
 
   const UserDefinedXQType* udXQType =
-    static_cast<const UserDefinedXQType*>(aTargetType.getp());
+  static_cast<const UserDefinedXQType*>(aTargetType.getp());
 
   ZORBA_ASSERT(udXQType->isAtomicAny() || udXQType->isList() || udXQType->isUnion());
 
-
   switch ( udXQType->getUDTKind() )
   {
   case XQType::ATOMIC_UDT:
@@ -2018,6 +2139,7 @@
 
   const UserDefinedXQType* udt =
   static_cast<const UserDefinedXQType*>(targetType.getp());
+
   assert(udt->isList());
 
   bool hasResult = true;
@@ -2049,112 +2171,28 @@
     const zstring& textValue,
     const xqtref_t& aTargetType)
 {
-    //cout << "isCastableUserUnionTypes: '" << textValue << "' to " <<
-    //  aTargetType->toString() << endl; cout.flush();
-
-    ZORBA_ASSERT( aTargetType->type_kind() == XQType::USER_DEFINED_KIND );
-
-    const UserDefinedXQType* udXQType =
-      static_cast<const UserDefinedXQType*>(aTargetType.getp());
-    ZORBA_ASSERT( udXQType->isUnion() );
-
-
-    std::vector<xqtref_t> unionItemTypes = udXQType->getUnionItemTypes();
-
-    for ( unsigned int i = 0; i<unionItemTypes.size(); i++)
-    {
-      if ( isCastableUserSimpleTypes(textValue, unionItemTypes[i]))
-        return true;
-    }
-
-    return false;
-}
-
-
-/*******************************************************************************
-
-*******************************************************************************/
-void Schema::serialize(::zorba::serialization::Archiver& ar)
-{
-  SERIALIZE_TYPEMANAGER(TypeManager, theTypeManager);
-
-#ifndef ZORBA_NO_XMLSCHEMA
-   ar & theUdTypesCache;
-
-   bool is_grammar_NULL = (theGrammarPool == NULL);
-
-   ar.set_is_temp_field(true);
-
-   ar & is_grammar_NULL;
-
-   csize size_of_size_t = sizeof(size_t);
-
-   union
-   {
-     unsigned long lvalue;
-     unsigned char cvalue[4];
-   } le_be_value;
-
-   le_be_value.lvalue = 0x11223344;
-
-   if (ar.is_serializing_out())
-   {
-     ar & size_of_size_t;
-     ar & le_be_value.cvalue[0];
-
-     if (!is_grammar_NULL)
-     {
-       BinMemOutputStream binmemoutputstream;
-       zstring binstr;
-
-       try
-       {
-         theGrammarPool->serializeGrammars(&binmemoutputstream);
-         binstr.assign((char*)binmemoutputstream.getRawBuffer(),
-                        static_cast<zstring::size_type>(binmemoutputstream.getSize()) );
-       }
-       catch (...)
-       {
-       }
-
-       ar & binstr;
-     }
-   }
-   else
-   {
-     csize size_of_size_t2;
-     unsigned char le_be_value_first_char;
-
-     ar & size_of_size_t2;
-     ar & le_be_value_first_char;
-
-     if (size_of_size_t2 != size_of_size_t ||
-         le_be_value_first_char != le_be_value.cvalue[0])
-     {
-       throw ZORBA_EXCEPTION(zerr::ZCSE0015_INCOMPATIBLE_BETWEEN_32_AND_64_BITS_OR_LE_AND_BE);
-     }
-
-     if (!is_grammar_NULL)
-     {
-       zstring binstr;
-
-       ar & binstr;
-
-       if (!binstr.empty())
-       {
-         BinMemInputStream binmeminputstream((XMLByte*)binstr.c_str(), binstr.size());
-         theGrammarPool->deserializeGrammars(&binmeminputstream);
-       }
-     }
-     else
-     {
-       theGrammarPool = NULL;
-     }
-   }
-
-   ar.set_is_temp_field(false);
-#endif
-}
+  //cout << "isCastableUserUnionTypes: '" << textValue << "' to " <<
+  //  aTargetType->toString() << endl; cout.flush();
+
+  ZORBA_ASSERT(aTargetType->type_kind() == XQType::USER_DEFINED_KIND);
+
+  const UserDefinedXQType* udXQType =
+  static_cast<const UserDefinedXQType*>(aTargetType.getp());
+  
+  ZORBA_ASSERT(udXQType->isUnion());
+
+  std::vector<xqtref_t> unionItemTypes = udXQType->getUnionItemTypes();
+
+  for (csize i = 0; i < unionItemTypes.size(); ++i)
+  {
+    if ( isCastableUserSimpleTypes(textValue, unionItemTypes[i]))
+      return true;
+  }
+  
+  return false;
+}
+
+
 
 } // namespace zorba
 /* vim:set et sw=2 ts=2: */

=== modified file 'src/types/schema/schema.h'
--- src/types/schema/schema.h	2013-09-19 16:36:16 +0000
+++ src/types/schema/schema.h	2013-09-24 09:51:29 +0000
@@ -73,6 +73,7 @@
   bool                                       theHasXSD;
 #ifndef ZORBA_NO_XMLSCHEMA
   XERCES_CPP_NAMESPACE::XMLGrammarPool     * theGrammarPool;
+
   UdTypesCache                             * theUdTypesCache;
 #endif // ZORBA_NO_XMLSCHEMA
 
@@ -98,97 +99,82 @@
   }
 
   void registerXSD(
-        const char* xsdURL,
-        static_context* sctx,
-        internal::StreamResource* streamResource,
-        const QueryLoc& loc);
-
-  void getSubstitutionHeadForElement(
-        const store::Item* qname,
-        store::Item_t& result);
+      const char* xsdURL,
+      static_context* sctx,
+      internal::StreamResource* streamResource,
+      const QueryLoc& loc);
 
   void getInfoFromGlobalElementDecl(
-        const store::Item* qname,
-        store::Item_t& typeName,
-        bool& nillable,
-        const QueryLoc& loc);
+      const store::Item* qname,
+      store::Item_t& typeName,
+      bool& nillable,
+      const QueryLoc& loc);
 
   xqtref_t createXQTypeFromGlobalElementDecl(
-        const TypeManager* typeManager,
-        const store::Item* qname,
-        const bool raiseErrors,
-        bool& nillable,
-        const QueryLoc& loc);
+      const TypeManager* typeManager,
+      const store::Item* qname,
+      const bool raiseErrors,
+      bool& nillable,
+      const QueryLoc& loc);
 
   void getInfoFromGlobalAttributeDecl(
-        const store::Item* qname,
-        store::Item_t& typeName,
-        const QueryLoc& loc);
+      const store::Item* qname,
+      store::Item_t& typeName,
+      const QueryLoc& loc);
 
   xqtref_t createXQTypeFromGlobalAttributeDecl(
-        const TypeManager* typeManager,
-        const store::Item* qname,
-        const bool riseErrors,
-        const QueryLoc& loc);
+      const TypeManager* typeManager,
+      const store::Item* qname,
+      const bool riseErrors,
+      const QueryLoc& loc);
 
   xqtref_t createXQTypeFromTypeName(
-        const TypeManager* manager,
-        const store::Item* qname);
+      const TypeManager* manager,
+      const store::Item* qname);
+
+  void getSubstitutionHeadForElement(
+      const store::Item* qname,
+      store::Item_t& result);
 
 #endif // ZORBA_NO_XMLSCHEMA
 
-    // user defined simple types, i.e. Atomic, List or Union Types
+  // user defined simple types, i.e. Atomic, List or Union Types
   bool parseUserSimpleTypes(
-        zstring& textValue,
-        const xqtref_t& aTargetType,
-        std::vector<store::Item_t>& resultList,
-        const QueryLoc& loc,
-        bool isCasting);
+      zstring& textValue,
+      const xqtref_t& aTargetType,
+      std::vector<store::Item_t>& resultList,
+      const QueryLoc& loc,
+      bool isCasting);
 
-    // user defined atomic types
+  // user defined atomic types
   bool parseUserAtomicTypes(
-        zstring& textValue,
-        const xqtref_t& aTargetType,
-        store::Item_t& result,
-        const namespace_context* aNCtx, // the namespace context is needed for parsing the xs:NOTATION items
-        const QueryLoc& loc,
-        bool isCasting);
+      zstring& textValue,
+      const xqtref_t& aTargetType,
+      store::Item_t& result,
+      const namespace_context* aNCtx, // the namespace context is needed for parsing the xs:NOTATION items
+      const QueryLoc& loc,
+      bool isCasting);
 
-    // user defined list types
+  // user defined list types
   bool parseUserListTypes(
-        const zstring& textValue,
-        const xqtref_t& aTargetType,
-        std::vector<store::Item_t>& resultList,
-        const QueryLoc& loc,
-        bool isCasting);
+      const zstring& textValue,
+      const xqtref_t& aTargetType,
+      std::vector<store::Item_t>& resultList,
+      const QueryLoc& loc,
+      bool isCasting);
 
-    // user defined union types
+  // user defined union types
   bool parseUserUnionTypes(
-        zstring& textValue,
-        const xqtref_t& aTargetType,
-        std::vector<store::Item_t>& resultList,
-        const QueryLoc& loc,
-        bool isCasting);
+      zstring& textValue,
+      const xqtref_t& aTargetType,
+      std::vector<store::Item_t>& resultList,
+      const QueryLoc& loc,
+      bool isCasting);
 
-    // user defined simple types, i.e. Atomic, List or Union Types
+  // user defined simple types, i.e. Atomic, List or Union Types
   bool isCastableUserSimpleTypes(
-        const zstring& textValue,
-        const xqtref_t& aTargetType);
-
-    // user defined atomic types
-  bool isCastableUserAtomicTypes(
-        const zstring& textValue,
-        const xqtref_t& aTargetType);
-
-    // user defined list types
-  bool isCastableUserListTypes(
-        const zstring& textValue,
-        const xqtref_t& aTargetType);
-
-    // user defined union types
-  bool isCastableUserUnionTypes(
-        const zstring& textValue,
-        const xqtref_t& aTargetType);
+      const zstring& textValue,
+      const xqtref_t& aTargetType);
 
 private:
 
@@ -200,29 +186,42 @@
       const store::Item* qname);
 
   xqtref_t createXQTypeFromTypeDefinition(
-        const TypeManager* typeManager,
-        XERCES_CPP_NAMESPACE::XSTypeDefinition* xsTypeDef);
+      const TypeManager* typeManager,
+      XERCES_CPP_NAMESPACE::XSTypeDefinition* xsTypeDef);
 
   xqtref_t createXQTypeFromTypeDefForBuiltinTypes(
-        const TypeManager* typeManager,
-        zstring& strUri, const XMLCh* local);
+      const TypeManager* typeManager,
+      zstring& strUri,
+      const XMLCh* local);
 
   void checkForAnonymousTypes(const TypeManager* typeManager);
 
   void checkForAnonymousTypesInType(
-        const TypeManager* typeManager,
-        XERCES_CPP_NAMESPACE::XSTypeDefinition* typeDef);
+      const TypeManager* typeManager,
+      XERCES_CPP_NAMESPACE::XSTypeDefinition* typeDef);
 
   void checkForAnonymousTypesInParticle(
-        const TypeManager* typeManager,
-        XERCES_CPP_NAMESPACE::XSParticle *xsParticle);
+      const TypeManager* typeManager,
+      XERCES_CPP_NAMESPACE::XSParticle *xsParticle);
 
   void addAnonymousTypeToCache(
-        const TypeManager* typeManager,
-        XERCES_CPP_NAMESPACE::XSTypeDefinition* typeDef);
+      const TypeManager* typeManager,
+      XERCES_CPP_NAMESPACE::XSTypeDefinition* typeDef);
 
   void addTypeToCache(xqtref_t itemXQType);
 #endif // ZORBA_NO_XMLSCHEMA
+
+  bool isCastableUserAtomicTypes(
+      const zstring& textValue,
+      const xqtref_t& targetType);
+
+  bool isCastableUserListTypes(
+      const zstring& textValue,
+      const xqtref_t& targetType);
+
+  bool isCastableUserUnionTypes(
+      const zstring& textValue,
+      const xqtref_t& targetType);
 };
 
 } // namespace zorba

=== modified file 'src/zorbautils/mutex.h'
--- src/zorbautils/mutex.h	2013-02-07 17:24:36 +0000
+++ src/zorbautils/mutex.h	2013-09-24 09:51:29 +0000
@@ -64,7 +64,7 @@
 /*******************************************************************************
 
 ********************************************************************************/
-class ZORBA_DLL_PUBLIC AutoMutex
+class AutoMutex
 {
 private:
   Mutex * theMutex;


Follow ups