← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~markos-za/zorba/markos-bugs into lp:zorba

 

Markos Zaharioudakis has proposed merging lp:~markos-za/zorba/markos-bugs into lp:zorba.

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~markos-za/zorba/markos-bugs/+merge/77510
-- 
https://code.launchpad.net/~markos-za/zorba/markos-bugs/+merge/77510
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp	2011-09-16 19:36:18 +0000
+++ src/compiler/translator/translator.cpp	2011-09-29 11:58:26 +0000
@@ -1294,7 +1294,7 @@
   const function* func = foExpr->get_func();
 
   if (func->getKind() == FunctionConsts::FN_ZORBA_XQDDF_PROBE_INDEX_RANGE_VALUE_N &&
-      (n == 0 || (n - 1) % 6 != 0))
+      (n < 7 || (n - 1) % 6 != 0))
   {
     const store::Item* qname = NULL;
 

=== modified file 'src/runtime/util/handle_hashset_item_value.h'
--- src/runtime/util/handle_hashset_item_value.h	2011-06-14 17:26:33 +0000
+++ src/runtime/util/handle_hashset_item_value.h	2011-09-29 11:58:26 +0000
@@ -66,7 +66,7 @@
   public:
     CompareFunction(ValueCompareParam* comp) : theCompareParam(comp) {}
 
-    bool equal(const store::Item_t& item1, const store::Item_t& item2)
+    bool equal(const store::Item_t& item1, const store::Item_t& item2) const
     {
       assert (item1 != NULL);
       assert (item2 != NULL);
@@ -80,7 +80,7 @@
                                          theCompareParam->theCollator);
     }
 
-    uint32_t hash(const store::Item_t& t)
+    uint32_t hash(const store::Item_t& t) const
     {
       assert (t != NULL);
       return t->hash(theCompareParam->theTimezone,  theCompareParam->theCollator);

=== modified file 'src/store/util/hashset_node_handle.h'
--- src/store/util/hashset_node_handle.h	2011-06-29 16:38:22 +0000
+++ src/store/util/hashset_node_handle.h	2011-09-29 11:58:26 +0000
@@ -33,12 +33,12 @@
   class CompareFunction
   {
   public:
-    bool equal(const Item_t& t1, const Item_t& t2)
+    bool equal(const Item_t& t1, const Item_t& t2) const
     {
       return t1->equals(t2, 0);
     }
 
-    uint32_t hash(const Item_t& t)
+    uint32_t hash(const Item_t& t) const
     {
       return t->hash(0);
     }

=== modified file 'src/zorbaserialization/archiver.h'
--- src/zorbaserialization/archiver.h	2011-06-14 17:26:33 +0000
+++ src/zorbaserialization/archiver.h	2011-09-29 11:58:26 +0000
@@ -147,14 +147,14 @@
   class SimpleHashoutFieldCompare
   {
   public: 
-    uint32_t hash(const SIMPLE_HASHOUT_FIELD& f)
+    uint32_t hash(const SIMPLE_HASHOUT_FIELD& f) const
     {
       uint32_t  h = 0;
       h = hashfun::h32(f.type);
       h = hashfun::h32((void*)&f.ptr, sizeof(void*), h);
       return h;
     }
-    bool equal(const SIMPLE_HASHOUT_FIELD& f1, const SIMPLE_HASHOUT_FIELD& f2)
+    bool equal(const SIMPLE_HASHOUT_FIELD& f1, const SIMPLE_HASHOUT_FIELD& f2) const
     {
       if((f1.ptr == f2.ptr) && (f1.type == f2.type))
         return true;

=== modified file 'src/zorbaserialization/class_serializer.cpp'
--- src/zorbaserialization/class_serializer.cpp	2011-06-30 05:16:55 +0000
+++ src/zorbaserialization/class_serializer.cpp	2011-09-29 11:58:26 +0000
@@ -31,13 +31,13 @@
 class ClassFactoriesCompare
 {
 public: 
-  uint32_t hash(const char * s1)
+  uint32_t hash(const char * s1) const
   {
     uint32_t  h = 0;
     h = hashfun::h32(s1, FNV_32_INIT);
     return h;
   }
-  bool equal(const char * s1, const char * s2)
+  bool equal(const char * s1, const char * s2) const
   {
     if((s1 == s2) || !strcmp(s1, s2))
       return true;

=== modified file 'src/zorbautils/hashmap.h'
--- src/zorbautils/hashmap.h	2011-09-12 08:32:41 +0000
+++ src/zorbautils/hashmap.h	2011-09-29 11:58:26 +0000
@@ -108,6 +108,11 @@
   {
     return (theNext == 0 ? NULL : this + theNext);
   }
+
+  const HASHENTRY* getNext() const
+  {
+    return (theNext == 0 ? NULL : this + theNext);
+  }
 };
 
 
@@ -256,7 +261,7 @@
 
   bool                              theUseTransfer;
 
-  SYNC_CODE(Mutex                   theMutex;)
+  SYNC_CODE(mutable Mutex           theMutex;)
   SYNC_CODE(Mutex                 * theMutexp;)
 
   int                               numCollisions;
@@ -511,7 +516,7 @@
 
   SYNC_CODE(AutoMutex lock(theMutexp);)
 
-  HASHENTRY<T, V>* entry = bucket(hval);
+  const HASHENTRY<T, V>* entry = bucket(hval);
 
   if (entry->isFree())
     return end();
@@ -532,13 +537,13 @@
   If the given item is already in the set, return true and a copy of the value
   associated with the item; otherwise return false.
 ********************************************************************************/
-bool get(const T& item, V& value)
+bool get(const T& item, V& value) const
 {
   ulong hval = hash(item);
 
   SYNC_CODE(AutoMutex lock(theMutexp);)
 
-  HASHENTRY<T, V>* entry = bucket(hval);
+  const HASHENTRY<T, V>* entry = bucket(hval);
 
   if (entry->isFree())
     return false;
@@ -721,7 +726,7 @@
 /*******************************************************************************
 
 ********************************************************************************/
-size_t computeTabSize(size_t size)
+size_t computeTabSize(size_t size) const
 {
   return size + 32 + size/5;
 }
@@ -730,13 +735,13 @@
 /*******************************************************************************
 
 ********************************************************************************/
-ulong hash(const T& item)
+ulong hash(const T& item) const
 {
   return theCompareFunction.hash(item);
 }
 
 
-bool equal(const T& item1, const T& item2)
+bool equal(const T& item1, const T& item2) const
 {
   return theCompareFunction.equal(item1, item2);
 }
@@ -754,6 +759,15 @@
 /*******************************************************************************
 
 ********************************************************************************/
+const HASHENTRY<T, V>* bucket(ulong hvalue) const
+{
+  return &theHashTab[hvalue % theHashTabSize];
+}
+
+
+/*******************************************************************************
+
+********************************************************************************/
 HASHENTRY<T, V>* freelist()
 {
   return &theHashTab[theHashTabSize];

=== modified file 'src/zorbautils/hashmap_itemp.h'
--- src/zorbautils/hashmap_itemp.h	2011-06-14 17:26:33 +0000
+++ src/zorbautils/hashmap_itemp.h	2011-09-29 11:58:26 +0000
@@ -71,19 +71,19 @@
   {
   }
 
-  bool equal(const store::Item* t1, const store::Item* t2)
+  bool equal(const store::Item* t1, const store::Item* t2) const
   {
     return t1->equals(t2, theTimeZone, theCollator);
   }
 
-  uint32_t hash(const store::Item* t)
+  uint32_t hash(const store::Item* t) const
   {
     return t->hash(theTimeZone, theCollator);
   }
 
-  long get_timezone() { return theTimeZone; }
+  long get_timezone() const { return theTimeZone; }
   
-  const XQPCollator* get_collator() { return theCollator; }
+  const XQPCollator* get_collator() const { return theCollator; }
 };
 
 
@@ -148,19 +148,19 @@
   {
   }
 
-  bool equal(const store::Item* t1, const store::Item* t2)
+  bool equal(const store::Item* t1, const store::Item* t2) const
   {
     return t1->equals(t2, theTimeZone, theCollator);
   }
 
-  uint32_t hash(const store::Item* t)
+  uint32_t hash(const store::Item* t) const
   {
     return t->hash(theTimeZone, theCollator);
   }
 
-  long get_timezone() { return theTimeZone; }
+  long get_timezone() const { return theTimeZone; }
   
-  const XQPCollator* get_collator() { return theCollator; }
+  const XQPCollator* get_collator() const { return theCollator; }
 };
 
 


Follow ups