Nicolae Brinza has proposed merging lp:~zorba-coders/zorba/bug-1176038 into 
lp:zorba.

Commit message:
Fixed a bug in the parser that was revealed by bison 2.7 + #include clean-up

Requested reviews:
  Paul J. Lucas (paul-lucas)
  Nicolae Brinza (nbrinza)
Related bugs:
  Bug #1176038 in Zorba: "pointer being freed was not allocated"
  https://bugs.launchpad.net/zorba/+bug/1176038

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-1176038/+merge/162996

Fixed a bug in the parser that was revealed by bison 2.7 + #include clean-up
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-1176038/+merge/162996
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2013-05-08 03:22:27 +0000
+++ ChangeLog	2013-05-08 15:44:31 +0000
@@ -45,6 +45,7 @@
   * Extented index join  rule to general flwor expressions. 
 
 Bug Fixes/Other Changes:
+  * Fixed bug #1176038 (memory error in parser revealed by Bison 2.7)
   * Fixed bug #1102997 (Swapping referenced nodes)
   * Fixed bug #1169908 (Zorba hangs with invalid utf-8 input)
   * Fixed bug #1111487 (Swapping nodes that are in collections)

=== modified file 'src/api/dynamiccontextimpl.cpp'
--- src/api/dynamiccontextimpl.cpp	2013-05-08 03:19:57 +0000
+++ src/api/dynamiccontextimpl.cpp	2013-05-08 15:44:31 +0000
@@ -27,6 +27,7 @@
 #include "types/typemanager.h"
 #include "types/root_typemanager.h"
 #include "types/schema/validate.h"
+#include "zorbatypes/integer.h"
 
 #include "api/unmarshaller.h"
 #include "api/zorbaimpl.h"

=== modified file 'src/api/item.cpp'
--- src/api/item.cpp	2013-02-26 04:12:43 +0000
+++ src/api/item.cpp	2013-05-08 15:44:31 +0000
@@ -38,7 +38,9 @@
 #include "store/api/iterator.h"
 #include "store/api/collection.h"
 
-#include <zorbatypes/numconversions.h>
+#include "zorbatypes/floatimpl.h"
+#include "zorbatypes/integer.h"
+#include "zorbatypes/numconversions.h"
 
 namespace zorba {
 

=== modified file 'src/api/itemfactoryimpl.cpp'
--- src/api/itemfactoryimpl.cpp	2013-03-27 03:30:14 +0000
+++ src/api/itemfactoryimpl.cpp	2013-05-08 15:44:31 +0000
@@ -25,14 +25,17 @@
 
 #include "api/itemfactoryimpl.h"
 
-#include "zorbatypes/duration.h"
+#include "zorbatypes/decimal.h"
+#include "zorbatypes/floatimpl.h"
+#include "zorbatypes/integer.h"
+#include "zorbatypes/schema_types.h"
 
 #include "system/globalenv.h"
 
+#include "store/api/copymode.h"
+#include "store/api/item.h"
 #include "store/api/item_factory.h"
 #include "store/api/store.h"
-#include "store/api/copymode.h"
-#include "store/api/item.h"
 
 #include "api/unmarshaller.h"
 

=== modified file 'src/api/serialization/serializer.cpp'
--- src/api/serialization/serializer.cpp	2013-04-25 02:05:20 +0000
+++ src/api/serialization/serializer.cpp	2013-05-08 15:44:31 +0000
@@ -39,6 +39,7 @@
 
 #include "system/globalenv.h"
 #include "zorbamisc/ns_consts.h"
+#include "zorbatypes/integer.h"
 #include "zorbatypes/numconversions.h"
 
 #include "store/api/iterator.h"

=== modified file 'src/capi/csequence.cpp'
--- src/capi/csequence.cpp	2013-02-07 17:24:36 +0000
+++ src/capi/csequence.cpp	2013-05-08 15:44:31 +0000
@@ -18,16 +18,17 @@
 #include "capi/csequence.h"
 
 #include <cassert>
-#include <string.h>
+#include <cstring>
 
 #include <zorba/zorba.h>
 #include <zorba/diagnostic_list.h>
 #include <zorba/iterator.h>
 #include <zorba/store_consts.h>
-#include <zorbamisc/ns_consts.h>
-#include <zorbatypes/numconversions.h>
 
 #include "util/string_util.h"
+#include "zorbamisc/ns_consts.h"
+#include "zorbatypes/floatimpl.h"
+#include "zorbatypes/numconversions.h"
 
 #include "error.h"
 

=== modified file 'src/compiler/expression/expr.cpp'
--- src/compiler/expression/expr.cpp	2013-03-07 10:10:10 +0000
+++ src/compiler/expression/expr.cpp	2013-05-08 15:44:31 +0000
@@ -49,6 +49,9 @@
 
 #include "store/api/store.h"
 #include "store/api/item_factory.h"
+#include "zorbatypes/decimal.h"
+#include "zorbatypes/floatimpl.h"
+#include "zorbatypes/integer.h"
 
 
 namespace zorba

=== modified file 'src/compiler/expression/expr_manager.cpp'
--- src/compiler/expression/expr_manager.cpp	2013-04-16 20:06:08 +0000
+++ src/compiler/expression/expr_manager.cpp	2013-05-08 15:44:31 +0000
@@ -15,22 +15,24 @@
  */
 
 #include "stdafx.h"
+
+#include "zorbatypes/decimal.h"
+#include "zorbatypes/integer.h"
+
+#include "expr.h"
 #include "expr_manager.h"
-
-#include "mem_manager.h"
-
-#include "expr.h"
-#include "ftnode.h"
-#include "var_expr.h"
 #include "flwor_expr.h"
 #include "fo_expr.h"
 #include "ft_expr.h"
+#include "ftnode.h"
 #include "function_item_expr.h"
+#include "json_exprs.h"
+#include "mem_manager.h"
 #include "path_expr.h"
+#include "pragma.h"
 #include "script_exprs.h"
 #include "update_exprs.h"
-#include "json_exprs.h"
-#include "pragma.h"
+#include "var_expr.h"
 
 namespace zorba
 {

=== modified file 'src/compiler/parser/symbol_table.cpp'
--- src/compiler/parser/symbol_table.cpp	2013-03-25 19:47:18 +0000
+++ src/compiler/parser/symbol_table.cpp	2013-05-08 15:44:31 +0000
@@ -15,6 +15,9 @@
  */
 #include "stdafx.h"
 
+#include "zorbatypes/decimal.h"
+#include "zorbatypes/floatimpl.h"
+#include "zorbatypes/integer.h"
 #include "zorbatypes/numconversions.h"
 
 #include "compiler/parser/symbol_table.h"

=== modified file 'src/compiler/parsetree/parsenode_print_xml_visitor.cpp'
--- src/compiler/parsetree/parsenode_print_xml_visitor.cpp	2013-03-22 00:38:18 +0000
+++ src/compiler/parsetree/parsenode_print_xml_visitor.cpp	2013-05-08 15:44:31 +0000
@@ -16,9 +16,12 @@
 #include "stdafx.h"
 
 #include <ostream>
-#include "compiler/parsetree/parsenode_print_xml_visitor.h"
-#include "compiler/parsetree/parsenode_visitor.h"
+
 #include "types/typemanager.h"
+#include "zorbatypes/integer.h"
+
+#include "parsenode_print_xml_visitor.h"
+#include "parsenode_visitor.h"
 
 using namespace std;
 

=== modified file 'src/compiler/parsetree/parsenodes.cpp'
--- src/compiler/parsetree/parsenodes.cpp	2013-04-17 22:41:05 +0000
+++ src/compiler/parsetree/parsenodes.cpp	2013-05-08 15:44:31 +0000
@@ -29,6 +29,7 @@
 #include "compiler/parsetree/parsenodes.h"
 #include "compiler/parser/parse_constants.h"
 #include "compiler/parsetree/parsenode_visitor.h"
+#include "zorbatypes/integer.h"
 
 #include <iostream>
 #include <sstream>
@@ -3690,11 +3691,14 @@
 void DirAttributeList::push_back(rchandle<DirAttr> attr)
 {
   const QName* qname = attr->get_name();
+  
+  theAttributes.push_back(attr);
 
   if (qname->get_qname() == "xmlns" || qname->get_prefix() == "xmlns")
   {
     std::vector<rchandle<DirAttr> >::const_iterator ite = theAttributes.begin();
     std::vector<rchandle<DirAttr> >::const_iterator end = theAttributes.end();
+    end--; // the last element is the one we've just pushed
     for (; ite != end; ++ite)
     {
       if (*((*ite)->get_name()) == *(qname))
@@ -3703,9 +3707,7 @@
         ERROR_PARAMS(attr->get_name()->get_qname()));
       }
     }
-  }
-
-  theAttributes.push_back(attr);
+  }  
 }
 
 

=== modified file 'src/compiler/parsetree/parsenodes.h'
--- src/compiler/parsetree/parsenodes.h	2013-05-08 03:19:57 +0000
+++ src/compiler/parsetree/parsenodes.h	2013-05-08 15:44:31 +0000
@@ -32,6 +32,9 @@
 
 #include "store/api/item.h"
 
+#include "zorbatypes/decimal.h"
+#include "zorbatypes/integer.h"
+#include "zorbatypes/floatimpl.h"
 #include "zorbatypes/rchandle.h"
 #include "zorbatypes/schema_types.h"
 #include "zorbatypes/zstring.h"

=== modified file 'src/compiler/rewriter/rules/fold_rules.cpp'
--- src/compiler/rewriter/rules/fold_rules.cpp	2013-05-04 20:20:05 +0000
+++ src/compiler/rewriter/rules/fold_rules.cpp	2013-05-08 15:44:31 +0000
@@ -47,6 +47,8 @@
 #include "store/api/store.h"
 #include "store/api/item_factory.h"
 
+#include "zorbatypes/integer.h"
+
 #include <iterator>
 
 namespace zorba {

=== modified file 'src/functions/udf.cpp'
--- src/functions/udf.cpp	2013-04-24 01:35:58 +0000
+++ src/functions/udf.cpp	2013-05-08 15:44:31 +0000
@@ -36,6 +36,7 @@
 #include "diagnostics/assert.h"
 
 #include "types/typeops.h"
+#include "zorbatypes/integer.h"
 
 #include "zorbaserialization/serialize_template_types.h"
 #include "zorbaserialization/serialize_zorba_types.h"

=== modified file 'src/runtime/base/plan_iterator.cpp'
--- src/runtime/base/plan_iterator.cpp	2013-03-24 20:40:03 +0000
+++ src/runtime/base/plan_iterator.cpp	2013-05-08 15:44:31 +0000
@@ -15,18 +15,14 @@
  */
 #include "stdafx.h"
 
+#include "compiler/api/compilercb.h"
 #include "context/static_context.h"
-
-#include "compiler/api/compilercb.h"
-
 #include "runtime/base/plan_iterator.h"
-
 #include "runtime/util/flowctl_exception.h"
-
+#include "store/api/item_factory.h"
+#include "store/api/store.h"
 #include "system/globalenv.h"
-
-#include "store/api/store.h"
-#include "store/api/item_factory.h"
+#include "zorbatypes/integer.h"
 
 
 namespace zorba

=== modified file 'src/runtime/booleans/BooleanImpl.cpp'
--- src/runtime/booleans/BooleanImpl.cpp	2013-05-02 00:18:56 +0000
+++ src/runtime/booleans/BooleanImpl.cpp	2013-05-08 15:44:31 +0000
@@ -20,6 +20,7 @@
 
 #include "zorbatypes/collation_manager.h"
 #include "zorbatypes/datetime.h"
+#include "zorbatypes/integer.h"
 
 #include "system/globalenv.h"
 

=== modified file 'src/runtime/collections/collections_base.h'
--- src/runtime/collections/collections_base.h	2013-02-07 17:24:36 +0000
+++ src/runtime/collections/collections_base.h	2013-05-08 15:44:31 +0000
@@ -31,6 +31,7 @@
 #include "types/typeimpl.h"
 
 #include "diagnostics/util_macros.h"
+#include "zorbatypes/integer.h"
 
 
 namespace zorba {

=== modified file 'src/runtime/core/arithmetic_impl.cpp'
--- src/runtime/core/arithmetic_impl.cpp	2013-04-08 21:32:54 +0000
+++ src/runtime/core/arithmetic_impl.cpp	2013-05-08 15:44:31 +0000
@@ -21,6 +21,7 @@
 #include "diagnostics/util_macros.h"
 
 #include "zorbatypes/datetime.h"
+#include "zorbatypes/decimal.h"
 #include "zorbatypes/duration.h"
 
 #include "system/globalenv.h"

=== modified file 'src/runtime/core/var_iterators.h'
--- src/runtime/core/var_iterators.h	2013-05-08 08:01:05 +0000
+++ src/runtime/core/var_iterators.h	2013-05-08 15:44:31 +0000
@@ -23,7 +23,7 @@
 #include "runtime/base/unarybase.h"
 #include "runtime/base/narybase.h"
 
-#include "zorbatypes/schema_types.h"
+#include "zorbatypes/integer.h"
 
 
 namespace zorba

=== modified file 'src/runtime/durations_dates_times/durations_dates_times_impl.cpp'
--- src/runtime/durations_dates_times/durations_dates_times_impl.cpp	2013-02-07 17:24:36 +0000
+++ src/runtime/durations_dates_times/durations_dates_times_impl.cpp	2013-05-08 15:44:31 +0000
@@ -17,6 +17,8 @@
 
 #include "zorbatypes/datetime.h"
 #include "zorbatypes/duration.h"
+#include "zorbatypes/decimal.h"
+#include "zorbatypes/integer.h"
 #include "zorbatypes/numconversions.h"
 #include "zorbatypes/datetime/parse.h"
 

=== modified file 'src/runtime/full_text/ft_module_impl.cpp'
--- src/runtime/full_text/ft_module_impl.cpp	2013-04-16 22:12:03 +0000
+++ src/runtime/full_text/ft_module_impl.cpp	2013-05-08 15:44:31 +0000
@@ -46,6 +46,7 @@
 #include "types/typeops.h"
 #include "util/stl_util.h"
 #include "util/utf8_util.h"
+#include "zorbatypes/integer.h"
 #include "zorbatypes/URI.h"
 #include "zorbautils/locale.h"
 

=== modified file 'src/runtime/full_text/ft_util.cpp'
--- src/runtime/full_text/ft_util.cpp	2013-02-07 17:24:36 +0000
+++ src/runtime/full_text/ft_util.cpp	2013-05-08 15:44:31 +0000
@@ -20,6 +20,7 @@
 
 #include "diagnostics/xquery_diagnostics.h"
 #include "zorbamisc/ns_consts.h"
+#include "zorbatypes/integer.h"
 #include "zorbatypes/numconversions.h"
 #include "zorbautils/locale.h"
 

=== modified file 'src/runtime/full_text/ftcontains_visitor.cpp'
--- src/runtime/full_text/ftcontains_visitor.cpp	2013-02-07 17:24:36 +0000
+++ src/runtime/full_text/ftcontains_visitor.cpp	2013-05-08 15:44:31 +0000
@@ -24,12 +24,11 @@
 #include "compiler/parser/query_loc.h"
 #include "diagnostics/xquery_diagnostics.h"
 #include "store/api/store.h"
-
 #include "system/globalenv.h"
-
 #include "util/cxx_util.h"
 #include "util/indent.h"
 #include "util/stl_util.h"
+#include "zorbatypes/integer.h"
 
 #ifndef NDEBUG
 #include "system/properties.h"

=== modified file 'src/runtime/hof/dynamic_fncall_iterator.cpp'
--- src/runtime/hof/dynamic_fncall_iterator.cpp	2013-05-05 04:49:50 +0000
+++ src/runtime/hof/dynamic_fncall_iterator.cpp	2013-05-08 15:44:31 +0000
@@ -34,6 +34,7 @@
 #include "types/root_typemanager.h"
 #include "types/casting.h"
 #include "types/typeops.h"
+#include "zorbatypes/integer.h"
 
 #include "system/globalenv.h"
 

=== modified file 'src/runtime/hof/fn_hof_functions_impl.cpp'
--- src/runtime/hof/fn_hof_functions_impl.cpp	2013-04-24 01:35:58 +0000
+++ src/runtime/hof/fn_hof_functions_impl.cpp	2013-05-08 15:44:31 +0000
@@ -42,6 +42,7 @@
 #include "system/globalenv.h"
 
 #include "zorbamisc/ns_consts.h"
+#include "zorbatypes/integer.h"
 
 
 #include "compiler/expression/expr_manager.h"

=== modified file 'src/runtime/introspection/sctx_impl.cpp'
--- src/runtime/introspection/sctx_impl.cpp	2013-02-07 17:24:36 +0000
+++ src/runtime/introspection/sctx_impl.cpp	2013-05-08 15:44:31 +0000
@@ -19,6 +19,7 @@
 
 #include "diagnostics/assert.h"
 #include "diagnostics/xquery_diagnostics.h"
+#include "zorbatypes/integer.h"
 #include "zorbatypes/numconversions.h"
 
 #include "system/globalenv.h"

=== modified file 'src/runtime/item/item_impl.cpp'
--- src/runtime/item/item_impl.cpp	2012-07-17 18:47:54 +0000
+++ src/runtime/item/item_impl.cpp	2013-05-08 15:44:31 +0000
@@ -25,6 +25,7 @@
 #include "store/api/store.h"
 
 #include "util/mem_sizeof.h"
+#include "zorbatypes/integer.h"
 
 using namespace std;
 

=== modified file 'src/runtime/json/jsoniq_functions_impl.cpp'
--- src/runtime/json/jsoniq_functions_impl.cpp	2013-05-05 04:49:50 +0000
+++ src/runtime/json/jsoniq_functions_impl.cpp	2013-05-08 15:44:31 +0000
@@ -46,6 +46,7 @@
 #include "types/typeimpl.h"
 #include "types/typeops.h"
 #include "types/root_typemanager.h"
+#include "zorbatypes/integer.h"
 
 #include <runtime/util/doc_uri_heuristics.h>
 

=== modified file 'src/runtime/maths/pregenerated/maths.h'
--- src/runtime/maths/pregenerated/maths.h	2013-03-05 23:11:50 +0000
+++ src/runtime/maths/pregenerated/maths.h	2013-05-08 15:44:31 +0000
@@ -29,6 +29,7 @@
 #include "runtime/base/binarybase.h"
 #include "runtime/base/noarybase.h"
 
+#include "zorbatypes/integer.h"
 #include "zorbatypes/schema_types.h"
 
 

=== modified file 'src/runtime/numerics/format_integer.cpp'
--- src/runtime/numerics/format_integer.cpp	2013-05-04 20:27:31 +0000
+++ src/runtime/numerics/format_integer.cpp	2013-05-08 15:44:31 +0000
@@ -34,6 +34,7 @@
 #include "util/stream_util.h"
 #include "util/unicode_util.h"
 #include "util/utf8_string.h"
+#include "zorbatypes/integer.h"
 #include "zorbatypes/numconversions.h"
 
 using namespace std;

=== modified file 'src/runtime/random/pregenerated/random.h'
--- src/runtime/random/pregenerated/random.h	2013-03-05 23:11:50 +0000
+++ src/runtime/random/pregenerated/random.h	2013-05-08 15:44:31 +0000
@@ -29,6 +29,7 @@
 
 
 #include "runtime/base/narybase.h"
+#include "zorbatypes/integer.h"
 
 
 namespace zorba {

=== modified file 'src/runtime/sequences/pregenerated/sequences.h'
--- src/runtime/sequences/pregenerated/sequences.h	2013-04-15 20:57:28 +0000
+++ src/runtime/sequences/pregenerated/sequences.h	2013-05-08 15:44:31 +0000
@@ -31,6 +31,7 @@
 #include "runtime/base/narybase.h"
 #include "runtime/base/narybase.h"
 #include "runtime/core/path_iterators.h"
+#include "zorbatypes/integer.h"
 
 
 namespace zorba {

=== modified file 'src/runtime/spec/maths/maths.xml'
--- src/runtime/spec/maths/maths.xml	2013-02-07 17:24:36 +0000
+++ src/runtime/spec/maths/maths.xml	2013-05-08 15:44:31 +0000
@@ -6,6 +6,7 @@
   xsi:schemaLocation="http://www.zorba-xquery.com ../runtime.xsd">
 
 <zorba:header>
+    <zorba:include form="Quoted">zorbatypes/integer.h</zorba:include>
     <zorba:include form="Quoted">zorbatypes/schema_types.h</zorba:include>
 </zorba:header>
     

=== modified file 'src/runtime/spec/random/random.xml'
--- src/runtime/spec/random/random.xml	2013-02-07 17:24:36 +0000
+++ src/runtime/spec/random/random.xml	2013-05-08 15:44:31 +0000
@@ -12,6 +12,10 @@
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xsi:schemaLocation="http://www.zorba-xquery.com ../runtime.xsd">
 
+<zorba:header>
+  <zorba:include form="Quoted">zorbatypes/integer.h</zorba:include>
+</zorba:header>
+
 <!--
 /*******************************************************************************
 ********************************************************************************/

=== modified file 'src/runtime/spec/sequences/sequences.xml'
--- src/runtime/spec/sequences/sequences.xml	2013-04-15 20:57:28 +0000
+++ src/runtime/spec/sequences/sequences.xml	2013-05-08 15:44:31 +0000
@@ -15,6 +15,7 @@
 <zorba:header>
     <zorba:include form="Quoted">runtime/base/narybase.h</zorba:include>
     <zorba:include form="Quoted">runtime/core/path_iterators.h</zorba:include>
+    <zorba:include form="Quoted">zorbatypes/integer.h</zorba:include>
     <zorba:fwd-decl ns="zorba">NodeHandleHashSet</zorba:fwd-decl>
     <zorba:fwd-decl ns="zorba">AtomicItemHandleHashSet</zorba:fwd-decl>
 </zorba:header>

=== modified file 'src/runtime/store/maps_impl.cpp'
--- src/runtime/store/maps_impl.cpp	2013-03-05 12:34:19 +0000
+++ src/runtime/store/maps_impl.cpp	2013-05-08 15:44:31 +0000
@@ -19,6 +19,7 @@
 #include "diagnostics/util_macros.h"
 #include "diagnostics/xquery_diagnostics.h"
 
+#include "zorbatypes/integer.h"
 #include "zorbatypes/URI.h"
 
 #include "system/globalenv.h"

=== modified file 'src/store/naive/atomic_items.cpp'
--- src/store/naive/atomic_items.cpp	2013-04-16 21:12:12 +0000
+++ src/store/naive/atomic_items.cpp	2013-05-08 15:44:31 +0000
@@ -2691,7 +2691,7 @@
 
 bool DecimalItem::getEBV() const
 {
-  return ( theValue != xs_decimal::zero() );
+  return !!theValue.sign();
 }
 
 

=== modified file 'src/store/naive/atomic_items.h'
--- src/store/naive/atomic_items.h	2013-04-08 08:45:18 +0000
+++ src/store/naive/atomic_items.h	2013-05-08 15:44:31 +0000
@@ -38,8 +38,11 @@
 #include "naive_ft_token_iterator.h"
 #endif /* ZORBA_NO_FULL_TEXT */
 
+#include "zorbatypes/datetime.h"
+#include "zorbatypes/decimal.h"
+#include "zorbatypes/floatimpl.h"
+#include "zorbatypes/integer.h"
 #include "zorbatypes/schema_types.h"
-#include "zorbatypes/datetime.h"
 
 #include "diagnostics/xquery_diagnostics.h"
 #include "ordpath.h"

=== modified file 'src/store/naive/collection.h'
--- src/store/naive/collection.h	2013-02-26 04:12:43 +0000
+++ src/store/naive/collection.h	2013-05-08 15:44:31 +0000
@@ -17,6 +17,7 @@
 #define ZORBA_SIMPLESTORE_COLLECTION
 
 #include "store/api/collection.h"
+#include "zorbatypes/integer.h"
 
 #include "shared_types.h"
 #include "tree_id.h"

=== modified file 'src/store/naive/collection_tree_info.h'
--- src/store/naive/collection_tree_info.h	2013-02-06 18:52:32 +0000
+++ src/store/naive/collection_tree_info.h	2013-05-08 15:44:31 +0000
@@ -18,6 +18,7 @@
 #define ZORBA_STORE_COLLECTION_TREE_INFO_H
 
 #include <zorba/config.h>
+#include "zorbatypes/integer.h"
 
 namespace zorba
 {

=== modified file 'src/store/naive/simple_index_value.h'
--- src/store/naive/simple_index_value.h	2013-02-07 17:24:36 +0000
+++ src/store/naive/simple_index_value.h	2013-05-08 15:44:31 +0000
@@ -17,6 +17,7 @@
 #define ZORBA_SIMPLE_STORE_INDEX_HASH_VALUE
 
 #include "simple_index.h"
+#include "zorbatypes/integer.h"
 #include <map>
 
 namespace zorba

=== modified file 'src/store/naive/simple_lazy_temp_seq.cpp'
--- src/store/naive/simple_lazy_temp_seq.cpp	2013-04-16 21:12:12 +0000
+++ src/store/naive/simple_lazy_temp_seq.cpp	2013-05-08 15:44:31 +0000
@@ -21,9 +21,9 @@
 #include "diagnostics/dict.h"
 #include "diagnostics/util_macros.h"
 #include "diagnostics/xquery_exception.h"
-
+#include "simple_lazy_temp_seq.h"
 #include "store/api/item.h"
-#include "simple_lazy_temp_seq.h"
+#include "zorbatypes/integer.h"
 
 
 namespace zorba

=== modified file 'src/store/naive/simple_pul.cpp'
--- src/store/naive/simple_pul.cpp	2013-04-17 18:37:33 +0000
+++ src/store/naive/simple_pul.cpp	2013-05-08 15:44:31 +0000
@@ -1419,8 +1419,7 @@
 
   xs_integer pos = position->getIntegerValue();
 
-  if (pos <= xs_integer::zero() ||
-      arr->getArraySize() + 1 < pos)
+  if (pos.sign() <= 0 || arr->getArraySize() + 1 < pos)
   {
     RAISE_ERROR(jerr::JNUP0016, loc,
     ERROR_PARAMS(ZED(JNUP0016_Array), position->getStringValue()));
@@ -1557,8 +1556,7 @@
 
   xs_integer pos = position->getIntegerValue();
 
-  if (pos <= xs_integer::zero() ||
-      arr->getArraySize() < pos)
+  if (pos.sign() <= 0 || arr->getArraySize() < pos)
   {
     RAISE_ERROR(jerr::JNUP0016, loc,
     ERROR_PARAMS(ZED(JNUP0016_Array), position->getStringValue()));
@@ -1623,8 +1621,7 @@
 
   xs_integer pos = position->getIntegerValue();
 
-  if (pos <= xs_integer::zero() ||
-      arr->getArraySize() < pos)
+  if (pos.sign() <= 0 || arr->getArraySize() < pos)
   {
     RAISE_ERROR(jerr::JNUP0016, loc,
     ERROR_PARAMS(ZED(JNUP0016_Array), position->getStringValue()));

=== modified file 'src/store/naive/simple_temp_seq.cpp'
--- src/store/naive/simple_temp_seq.cpp	2013-04-17 18:37:33 +0000
+++ src/store/naive/simple_temp_seq.cpp	2013-05-08 15:44:31 +0000
@@ -24,6 +24,7 @@
 #include "store/api/item.h"
 #include "simple_temp_seq.h"
 #include "store/api/copymode.h"
+#include "zorbatypes/integer.h"
 
 namespace zorba { namespace simplestore {
 

=== modified file 'src/system/globalenv.cpp'
--- src/system/globalenv.cpp	2013-02-07 17:24:36 +0000
+++ src/system/globalenv.cpp	2013-05-08 15:44:31 +0000
@@ -42,6 +42,7 @@
 
 #include "types/schema/schema.h"
 
+#include "zorbatypes/m_apm.h"
 #include "zorbautils/condition.h"
 
 #include "store/api/collection.h"

=== modified file 'src/types/casting.cpp'
--- src/types/casting.cpp	2013-05-02 00:18:56 +0000
+++ src/types/casting.cpp	2013-05-08 15:44:31 +0000
@@ -17,10 +17,13 @@
 
 #include <vector>
 
-#include "zorbatypes/numconversions.h"
+#include "zorbatypes/chartype.h"
 #include "zorbatypes/datetime.h"
+#include "zorbatypes/decimal.h"
 #include "zorbatypes/duration.h"
-#include "zorbatypes/chartype.h"
+#include "zorbatypes/floatimpl.h"
+#include "zorbatypes/integer.h"
+#include "zorbatypes/numconversions.h"
 #include "zorbatypes/URI.h"
 
 #include "diagnostics/xquery_diagnostics.h"

=== modified file 'src/types/schema/XercesParseUtils.cpp'
--- src/types/schema/XercesParseUtils.cpp	2013-03-05 12:34:19 +0000
+++ src/types/schema/XercesParseUtils.cpp	2013-05-08 15:44:31 +0000
@@ -28,15 +28,18 @@
 #include "LoadSchemaErrorHandler.h"
 #include "PrintSchema.h"
 
+#include "diagnostics/xquery_diagnostics.h"
 #include "store/api/item.h"
 #include "store/api/item_factory.h"
+#include "system/globalenv.h"
 #include "types/typeimpl.h"
-#include "diagnostics/xquery_diagnostics.h"
-#include <zorbatypes/numconversions.h>
-#include "system/globalenv.h"
+#include "util/utf8_util.h"
 #include "zorbatypes/datetime.h"
+#include "zorbatypes/decimal.h"
 #include "zorbatypes/duration.h"
-#include "util/utf8_util.h"
+#include "zorbatypes/floatimpl.h"
+#include "zorbatypes/integer.h"
+#include "zorbatypes/numconversions.h"
 
 using namespace std;
 XERCES_CPP_NAMESPACE_USE;

=== modified file 'src/util/stl_util.h'
--- src/util/stl_util.h	2013-04-17 15:21:56 +0000
+++ src/util/stl_util.h	2013-05-08 15:44:31 +0000
@@ -421,6 +421,13 @@
   return true;
 }
 
+inline std::enable_if<!ZORBA_TR1_NS::is_signed<char>::value
+                   && !ZORBA_TR1_NS::is_unsigned<char>::value,
+                      bool>::type
+ge0( char c ) {
+  return c >= 0;
+}
+
 template<typename NumericType> inline
 typename std::enable_if<ZORBA_TR1_NS::is_signed<NumericType>::value,bool>::type
 lt0( NumericType n ) {
@@ -433,6 +440,13 @@
   return false;
 }
 
+inline std::enable_if<!ZORBA_TR1_NS::is_signed<char>::value
+                   && !ZORBA_TR1_NS::is_unsigned<char>::value,
+                      bool>::type
+lt0( char c ) {
+  return c < 0;
+}
+
 template<typename NumericType> inline
 typename std::enable_if<ZORBA_TR1_NS::is_signed<NumericType>::value,bool>::type
 le0( NumericType n ) {
@@ -445,6 +459,10 @@
   return n == 0;
 }
 
+inline bool le0( char c ) {
+  return c <= 0;
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 
 //

=== modified file 'src/zorbaserialization/serialize_basic_types.cpp'
--- src/zorbaserialization/serialize_basic_types.cpp	2013-04-08 00:12:00 +0000
+++ src/zorbaserialization/serialize_basic_types.cpp	2013-05-08 15:44:31 +0000
@@ -22,6 +22,7 @@
 #include "zorbaserialization/archiver.h"
 #include "zorbaserialization/base64impl.h"
 
+#include "zorbatypes/m_apm.h"
 #include "zorbatypes/floatimpl.h"
 
 #include "diagnostics/xquery_diagnostics.h"

=== modified file 'src/zorbatypes/datetime.h'
--- src/zorbatypes/datetime.h	2013-04-23 06:09:42 +0000
+++ src/zorbatypes/datetime.h	2013-05-08 15:44:31 +0000
@@ -20,11 +20,10 @@
 #include <iostream>
 
 #include <zorba/config.h>
-#include "zorbatypes/timezone.h"
-#include "zorbatypes/duration.h"
-
 #include "util/ascii_util.h"
 
+#include "timezone.h"
+#include "duration.h"
 
 namespace zorba
 {
@@ -301,7 +300,7 @@
       
   int getMinutes() const;
       
-  xs_decimal getSeconds() const;
+  Decimal getSeconds() const;
   
   int getIntSeconds() const;
   

=== modified file 'src/zorbatypes/datetime/datetimetype.cpp'
--- src/zorbatypes/datetime/datetimetype.cpp	2013-04-24 17:26:02 +0000
+++ src/zorbatypes/datetime/datetimetype.cpp	2013-05-08 15:44:31 +0000
@@ -29,14 +29,15 @@
 #include <time.h>
 #endif
 
+#include "zorbatypes/datetime.h"
+#include "zorbatypes/datetime/parse.h"
+#include "zorbatypes/decimal.h"
+#include "zorbatypes/duration.h"
+#include "zorbatypes/integer.h"
+#include "zorbatypes/timezone.h"
+#include "zorbatypes/zorbatypes_decl.h"
+#include "zorbatypes/zstring.h"
 #include "zorbautils/hashfun.h"
-#include <zorbatypes/datetime.h>
-#include <zorbatypes/duration.h>
-#include <zorbatypes/timezone.h>
-#include <zorbatypes/zorbatypes_decl.h>
-#include <zorbatypes/zstring.h>
-
-#include "zorbatypes/datetime/parse.h"
 
 #include "util/ascii_util.h"
 #include "util/time_util.h"
@@ -1325,7 +1326,7 @@
     // validate timezone value (-14 .. +14 H)
     if (d->getYears() != 0 || d->getMonths() != 0 ||
         d->getDays() != 0 ||
-        d->getSeconds() != Integer::zero() ||
+        d->getSeconds().sign() != 0 ||
         d->getHours()*3600 + d->getMinutes()*60 > 14*3600 ||
         d->getHours()*3600 + d->getMinutes()*60 < -14*3600)
       throw InvalidTimezoneException( d->getHours()*3600 + d->getMinutes()*60 );

=== modified file 'src/zorbatypes/datetime/timezone.cpp'
--- src/zorbatypes/datetime/timezone.cpp	2013-03-13 16:19:33 +0000
+++ src/zorbatypes/datetime/timezone.cpp	2013-05-08 15:44:31 +0000
@@ -22,6 +22,7 @@
 #include <zorbatypes/timezone.h>
 
 #include "zorbatypes/datetime/parse.h"
+#include "zorbatypes/decimal.h"
 
 #include "zorbautils/hashfun.h"
 

=== modified file 'src/zorbatypes/duration.h'
--- src/zorbatypes/duration.h	2013-02-07 17:24:36 +0000
+++ src/zorbatypes/duration.h	2013-05-08 15:44:31 +0000
@@ -18,10 +18,10 @@
 #define ZORBA_TYPES_DURATION_H
 
 #include <zorba/config.h>
-#include "zorbatypes/zorbatypes_decl.h"
-#include "zorbatypes/schema_types.h"
+#include "zorbatypes_decl.h"
 
 #include "util/ascii_util.h"
+#include "zorbatypes/zstring.h"
 
 namespace zorba
 {
@@ -175,9 +175,9 @@
 
   Duration* operator-(const Duration& d) const;
 
-  Duration* operator*(const xs_double& value) const;
+  Duration* operator*(const Double& value) const;
 
-  Duration* operator/(const xs_double& value) const;
+  Duration* operator/(const Double& value) const;
 
   Decimal operator/(const Duration& d) const;
 
@@ -195,13 +195,13 @@
 
   virtual long getMinutes() const;
 
-  virtual xs_decimal getSeconds() const;
+  virtual Decimal getSeconds() const;
 
   virtual long getFractionalSeconds() const;
 
   virtual long getIntSeconds() const;
 
-  xs_double getTotalSeconds() const;
+  Double getTotalSeconds() const;
 
   long getTotalMilliseconds() const;
 

=== modified file 'src/zorbatypes/numconversions.cpp'
--- src/zorbatypes/numconversions.cpp	2013-03-22 19:06:44 +0000
+++ src/zorbatypes/numconversions.cpp	2013-05-08 15:44:31 +0000
@@ -15,11 +15,18 @@
  */
 #include "stdafx.h"
 
+// standard
 #include <stdexcept>
 
+// Zorba
 #include "common/common.h"
 #include "util/string_util.h"
-#include "zorbatypes/numconversions.h"
+
+// local
+#include "decimal.h"
+#include "floatimpl.h"
+#include "integer.h"
+#include "numconversions.h"
 
 namespace zorba {
 

=== modified file 'src/zorbatypes/timezone.h'
--- src/zorbatypes/timezone.h	2013-02-07 17:24:36 +0000
+++ src/zorbatypes/timezone.h	2013-05-08 15:44:31 +0000
@@ -74,7 +74,7 @@
 
   long getMinutes() const;
 
-  xs_decimal getSeconds() const;
+  Decimal getSeconds() const;
 
   long getIntSeconds() const;
 

-- 
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