Widen arguments to BitVector functions.

BitVector API functions now take size_t indexes rather than uint32_t.


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/0a6ea88d
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/0a6ea88d
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/0a6ea88d

Branch: refs/heads/master
Commit: 0a6ea88df1e5064609561e874b74707c855097b2
Parents: efd6ac7
Author: Marvin Humphrey <[email protected]>
Authored: Wed Apr 6 17:51:01 2016 -0700
Committer: Marvin Humphrey <[email protected]>
Committed: Tue Apr 12 21:38:55 2016 -0700

----------------------------------------------------------------------
 core/Lucy/Index/DeletionsWriter.c         | 16 ++++++++--------
 core/Lucy/Search/BitVecMatcher.c          |  5 +++--
 core/Lucy/Search/Collector.c              |  2 +-
 core/Lucy/Search/PhraseQuery.c            |  4 ++--
 core/Lucy/Test/Search/TestSeriesMatcher.c |  4 ++--
 core/LucyX/Search/FilterMatcher.c         |  2 +-
 core/LucyX/Search/ProximityQuery.c        |  4 ++--
 7 files changed, 19 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/0a6ea88d/core/Lucy/Index/DeletionsWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/DeletionsWriter.c 
b/core/Lucy/Index/DeletionsWriter.c
index c646658..adf0d53 100644
--- a/core/Lucy/Index/DeletionsWriter.c
+++ b/core/Lucy/Index/DeletionsWriter.c
@@ -98,7 +98,7 @@ DefDelWriter_init(DefaultDeletionsWriter *self, Schema 
*schema,
     // Materialize a BitVector of deletions for each segment.
     for (size_t i = 0; i < num_seg_readers; i++) {
         SegReader *seg_reader = (SegReader*)Vec_Fetch(ivars->seg_readers, i);
-        BitVector *bit_vec    = BitVec_new(SegReader_Doc_Max(seg_reader));
+        BitVector *bit_vec    = 
BitVec_new((size_t)SegReader_Doc_Max(seg_reader));
         DeletionsReader *del_reader
             = (DeletionsReader*)SegReader_Fetch(
                   seg_reader, Class_Get_Name(DELETIONSREADER));
@@ -109,7 +109,7 @@ DefDelWriter_init(DefaultDeletionsWriter *self, Schema 
*schema,
         if (seg_dels) {
             int32_t del;
             while (0 != (del = Matcher_Next(seg_dels))) {
-                BitVec_Set(bit_vec, del);
+                BitVec_Set(bit_vec, (size_t)del);
             }
             DECREF(seg_dels);
         }
@@ -268,8 +268,8 @@ DefDelWriter_Delete_By_Term_IMP(DefaultDeletionsWriter 
*self,
         // Iterate through postings, marking each doc as deleted.
         if (plist) {
             while (0 != (doc_id = PList_Next(plist))) {
-                num_zapped += !BitVec_Get(bit_vec, doc_id);
-                BitVec_Set(bit_vec, doc_id);
+                num_zapped += !BitVec_Get(bit_vec, (size_t)doc_id);
+                BitVec_Set(bit_vec, (size_t)doc_id);
             }
             if (num_zapped) { ivars->updated[i] = true; }
             DECREF(plist);
@@ -294,8 +294,8 @@ DefDelWriter_Delete_By_Query_IMP(DefaultDeletionsWriter 
*self, Query *query) {
 
             // Iterate through matches, marking each doc as deleted.
             while (0 != (doc_id = Matcher_Next(matcher))) {
-                num_zapped += !BitVec_Get(bit_vec, doc_id);
-                BitVec_Set(bit_vec, doc_id);
+                num_zapped += !BitVec_Get(bit_vec, (size_t)doc_id);
+                BitVec_Set(bit_vec, (size_t)doc_id);
             }
             if (num_zapped) { ivars->updated[i] = true; }
 
@@ -314,9 +314,9 @@ DefDelWriter_Delete_By_Doc_ID_IMP(DefaultDeletionsWriter 
*self, int32_t doc_id)
     int32_t    offset     = I32Arr_Get(ivars->seg_starts, sub_tick);
     int32_t    seg_doc_id = doc_id - offset;
 
-    if (!BitVec_Get(bit_vec, seg_doc_id)) {
+    if (!BitVec_Get(bit_vec, (size_t)seg_doc_id)) {
         ivars->updated[sub_tick] = true;
-        BitVec_Set(bit_vec, seg_doc_id);
+        BitVec_Set(bit_vec, (size_t)seg_doc_id);
     }
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/0a6ea88d/core/Lucy/Search/BitVecMatcher.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/BitVecMatcher.c b/core/Lucy/Search/BitVecMatcher.c
index 7ca5c0a..502f0fd 100644
--- a/core/Lucy/Search/BitVecMatcher.c
+++ b/core/Lucy/Search/BitVecMatcher.c
@@ -44,14 +44,15 @@ BitVecMatcher_Destroy_IMP(BitVecMatcher *self) {
 int32_t
 BitVecMatcher_Next_IMP(BitVecMatcher *self) {
     BitVecMatcherIVARS *const ivars = BitVecMatcher_IVARS(self);
-    ivars->doc_id = BitVec_Next_Hit(ivars->bit_vec, ivars->doc_id + 1);
+    ivars->doc_id
+        = BitVec_Next_Hit(ivars->bit_vec, (size_t)(ivars->doc_id + 1));
     return ivars->doc_id == -1 ? 0 : ivars->doc_id;
 }
 
 int32_t
 BitVecMatcher_Advance_IMP(BitVecMatcher *self, int32_t target) {
     BitVecMatcherIVARS *const ivars = BitVecMatcher_IVARS(self);
-    ivars->doc_id = BitVec_Next_Hit(ivars->bit_vec, target);
+    ivars->doc_id = BitVec_Next_Hit(ivars->bit_vec, (size_t)target);
     return ivars->doc_id == -1 ? 0 : ivars->doc_id;
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/0a6ea88d/core/Lucy/Search/Collector.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Collector.c b/core/Lucy/Search/Collector.c
index 6564018..f9ef3ba 100644
--- a/core/Lucy/Search/Collector.c
+++ b/core/Lucy/Search/Collector.c
@@ -88,7 +88,7 @@ BitColl_Collect_IMP(BitCollector *self, int32_t doc_id) {
     BitCollectorIVARS *const ivars = BitColl_IVARS(self);
 
     // Add the doc_id to the BitVector.
-    BitVec_Set(ivars->bit_vec, (ivars->base + doc_id));
+    BitVec_Set(ivars->bit_vec, (size_t)(ivars->base + doc_id));
 }
 
 bool

http://git-wip-us.apache.org/repos/asf/lucy/blob/0a6ea88d/core/Lucy/Search/PhraseQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PhraseQuery.c b/core/Lucy/Search/PhraseQuery.c
index 48d7c13..9d2f277 100644
--- a/core/Lucy/Search/PhraseQuery.c
+++ b/core/Lucy/Search/PhraseQuery.c
@@ -376,7 +376,7 @@ PhraseCompiler_Highlight_Spans_IMP(PhraseCompiler *self, 
Searcher *searcher,
             // Set initial positions from first term.
             I32Array *positions = TV_Get_Positions(term_vector);
             for (size_t j = I32Arr_Get_Size(positions); j > 0; j--) {
-                BitVec_Set(posit_vec, (uint32_t)I32Arr_Get(positions, j - 1));
+                BitVec_Set(posit_vec, (size_t)I32Arr_Get(positions, j - 1));
             }
         }
         else {
@@ -387,7 +387,7 @@ PhraseCompiler_Highlight_Spans_IMP(PhraseCompiler *self, 
Searcher *searcher,
             for (size_t j = I32Arr_Get_Size(positions); j > 0; j--) {
                 int32_t pos = I32Arr_Get(positions, j - 1) - (int32_t)i;
                 if (pos >= 0) {
-                    BitVec_Set(other_posit_vec, pos);
+                    BitVec_Set(other_posit_vec, (size_t)pos);
                 }
             }
             BitVec_And(posit_vec, other_posit_vec);

http://git-wip-us.apache.org/repos/asf/lucy/blob/0a6ea88d/core/Lucy/Test/Search/TestSeriesMatcher.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestSeriesMatcher.c 
b/core/Lucy/Test/Search/TestSeriesMatcher.c
index d0ec08e..0fd0ae6 100644
--- a/core/Lucy/Test/Search/TestSeriesMatcher.c
+++ b/core/Lucy/Test/Search/TestSeriesMatcher.c
@@ -42,12 +42,12 @@ S_make_series_matcher(I32Array *doc_ids, I32Array *offsets, 
int32_t doc_max) {
         int32_t max    = i == num_matchers - 1
                          ? doc_max + 1
                          : I32Arr_Get(offsets, i + 1);
-        BitVector *bit_vec = BitVec_new(max - offset);
+        BitVector *bit_vec = BitVec_new((size_t)(max - offset));
         while (tick < num_doc_ids) {
             int32_t doc_id = I32Arr_Get(doc_ids, tick);
             if (doc_id > max) { break; }
             else               { tick++; }
-            BitVec_Set(bit_vec, doc_id - offset);
+            BitVec_Set(bit_vec, (size_t)(doc_id - offset));
         }
         Vec_Push(matchers, (Obj*)BitVecMatcher_new(bit_vec));
         DECREF(bit_vec);

http://git-wip-us.apache.org/repos/asf/lucy/blob/0a6ea88d/core/LucyX/Search/FilterMatcher.c
----------------------------------------------------------------------
diff --git a/core/LucyX/Search/FilterMatcher.c 
b/core/LucyX/Search/FilterMatcher.c
index c187ee0..86fdb66 100644
--- a/core/LucyX/Search/FilterMatcher.c
+++ b/core/LucyX/Search/FilterMatcher.c
@@ -55,7 +55,7 @@ FilterMatcher_Next_IMP(FilterMatcher* self) {
             ivars->doc_id--;
             return 0;
         }
-    } while (!BitVec_Get(ivars->bits, ivars->doc_id));
+    } while (!BitVec_Get(ivars->bits, (size_t)ivars->doc_id));
     return ivars->doc_id;
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/0a6ea88d/core/LucyX/Search/ProximityQuery.c
----------------------------------------------------------------------
diff --git a/core/LucyX/Search/ProximityQuery.c 
b/core/LucyX/Search/ProximityQuery.c
index 2f31933..6b01d5b 100644
--- a/core/LucyX/Search/ProximityQuery.c
+++ b/core/LucyX/Search/ProximityQuery.c
@@ -405,7 +405,7 @@ ProximityCompiler_Highlight_Spans_IMP(ProximityCompiler 
*self,
             // Set initial positions from first term.
             I32Array *positions = TV_Get_Positions(term_vector);
             for (size_t j = I32Arr_Get_Size(positions); j > 0; j--) {
-                BitVec_Set(posit_vec, (uint32_t)I32Arr_Get(positions, j - 1));
+                BitVec_Set(posit_vec, (size_t)I32Arr_Get(positions, j - 1));
             }
         }
         else {
@@ -416,7 +416,7 @@ ProximityCompiler_Highlight_Spans_IMP(ProximityCompiler 
*self,
             for (size_t j = I32Arr_Get_Size(positions); j > 0; j--) {
                 int32_t pos = I32Arr_Get(positions, j - 1) - (int32_t)i;
                 if (pos >= 0) {
-                    BitVec_Set(other_posit_vec, pos);
+                    BitVec_Set(other_posit_vec, (size_t)pos);
                 }
             }
             BitVec_And(posit_vec, other_posit_vec);

Reply via email to