Fixes
[SXSI/XMLTree.git] / libcds / src / static_sequence / wt_node_internal.cpp
index 50bb35f..16dc441 100644 (file)
@@ -134,8 +134,8 @@ wt_node_internal::wt_node_internal(uchar * symbols, uint n, uint l, wt_coder * c
        } else {
                right_child = NULL;
        }
-//     delete [] left; // already deleted
-//     delete [] right;
+       delete [] left; // already deleted if count_left > 0
+       delete [] right;
 }
 
 
@@ -183,7 +183,7 @@ uint wt_node_internal::rankLessThan(uint &symbol, uint pos, uint l, wt_coder * c
 
 //    cout << "recursion to leftchild at l = " << l << ", symbol = " << (uchar)symbol << ", rank0 = " << bitmap->rank0(pos) << ", rank1 = " << bitmap->rank1(pos) << endl;
     // check left child for symbols <= givenSymbol
-    if (result != -1 || left_child == NULL)
+    if (result != (uint)-1 || left_child == NULL)
         return result;
     return left_child->rankLessThan(symbol, bitmap->rank0(pos)-1);
 }
@@ -195,11 +195,11 @@ uint wt_node_internal::rankLessThan(uint &symbol, uint pos)
     using std::endl;
 //    cout << "pos = " << pos << ", symbol = " << (uchar)symbol << endl;
     
-    if (pos == -1)
-        return -1;
+    if (pos == (uint)-1)
+        return (uint)-1;
     if(right_child!=NULL)
         result = right_child->rankLessThan(symbol, bitmap->rank1(pos)-1);
-    if(result == -1 && left_child!=NULL)
+    if(result == (uint)-1 && left_child!=NULL)
         return left_child->rankLessThan(symbol, bitmap->rank0(pos)-1);
     return result;
 }