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

Commit message:
removed call to create_value_type() in DynamicContextImpl::setVariable()

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/136641

removed call to create_value_type() in DynamicContextImpl::setVariable()
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/136641
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/api/dynamiccontextimpl.cpp'
--- src/api/dynamiccontextimpl.cpp	2012-10-22 17:08:12 +0000
+++ src/api/dynamiccontextimpl.cpp	2012-11-28 12:39:22 +0000
@@ -294,19 +294,19 @@
 
     // For string items, check that the value is a valid Unicode codepoint sequence
     const char* invalid_char;
-    TypeManager* tm = theStaticContext->get_typemanager();
-    RootTypeManager& rtm = GENV_TYPESYSTEM;
-
-    xqtref_t itemType = tm->create_value_type(value);
-
-    if (value->isStreamable() == false &&
-        TypeOps::is_equal(tm, *itemType, *rtm.STRING_TYPE_ONE, QueryLoc::null) &&
-        (invalid_char = utf8::validate(value->getStringValue().c_str())) != NULL)
+
+    if (value->isStreamable() == false && value->isAtomic())
     {
-      throw XQUERY_EXCEPTION(err::FOCH0001,
-      ERROR_PARAMS(zstring("#x") +
-      BUILD_STRING(std::uppercase << std::hex
-                   << (static_cast<unsigned int>(*invalid_char) & 0xFF)) ));
+      store::SchemaTypeCode itemTypeCode = value->getTypeCode();
+
+      if (TypeOps::is_subtype(itemTypeCode, store::XS_STRING) &&
+          (invalid_char = utf8::validate(value->getStringValue().c_str())) != NULL)
+      {
+        throw XQUERY_EXCEPTION(err::FOCH0001,
+        ERROR_PARAMS(zstring("#x") +
+        BUILD_STRING(std::uppercase << std::hex
+                     << (static_cast<unsigned int>(*invalid_char) & 0xFF)) ));
+      }
     }
 
     VarInfo* var = NULL;

=== modified file 'src/store/naive/pul_primitives.cpp'
--- src/store/naive/pul_primitives.cpp	2012-11-21 03:17:34 +0000
+++ src/store/naive/pul_primitives.cpp	2012-11-28 12:39:22 +0000
@@ -302,9 +302,9 @@
   UpdatePrimitive(pul, aLoc, target),
   theNumApplied(0)
 {
-  std::size_t numAttrs = attrs.size();
+  csize numAttrs = attrs.size();
   theNewAttrs.resize(numAttrs);
-  for (std::size_t i = 0; i < numAttrs; i++)
+  for (csize i = 0; i < numAttrs; i++)
   {
     theNewAttrs[i].transfer(attrs[i]);
   }

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to