Adapt for Vec_Fetch size_t tick param. Change variable types or cast as necessary to adapt to size_t `tick` param to Vec_Fetch.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/76dc745d Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/76dc745d Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/76dc745d Branch: refs/heads/master Commit: 76dc745df3707ab98fbff1e6ba7abd7dc252c6ef Parents: bb67e9f Author: Marvin Humphrey <[email protected]> Authored: Mon Apr 25 13:04:50 2016 -0700 Committer: Marvin Humphrey <[email protected]> Committed: Mon Apr 25 13:04:50 2016 -0700 ---------------------------------------------------------------------- c/src/Lucy/Index/Inverter.c | 2 +- core/Lucy/Index/DataReader.c | 2 +- core/Lucy/Index/DeletionsWriter.c | 4 ++-- core/Lucy/Index/Inverter.c | 3 ++- core/Lucy/Index/LexiconReader.c | 4 ++-- core/Lucy/Index/PostingListWriter.c | 2 +- core/Lucy/Index/Segment.c | 2 +- core/Lucy/Index/SortWriter.c | 2 +- core/Lucy/Store/CompoundFileReader.c | 4 ++-- core/Lucy/Store/RAMDirHandle.c | 4 ++-- core/Lucy/Test/Search/TestSortSpec.c | 2 +- core/Lucy/Test/Util/TestSortExternal.c | 8 ++++---- core/Lucy/Util/MemoryPool.c | 4 ++-- 13 files changed, 22 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/76dc745d/c/src/Lucy/Index/Inverter.c ---------------------------------------------------------------------- diff --git a/c/src/Lucy/Index/Inverter.c b/c/src/Lucy/Index/Inverter.c index dfebb94..96c6c15 100644 --- a/c/src/Lucy/Index/Inverter.c +++ b/c/src/Lucy/Index/Inverter.c @@ -51,7 +51,7 @@ S_fetch_entry(InverterIVARS *ivars, String *field) { } InverterEntry *entry - = (InverterEntry*)Vec_Fetch(ivars->entry_pool, field_num); + = (InverterEntry*)Vec_Fetch(ivars->entry_pool, (size_t)field_num); if (!entry) { entry = InvEntry_new(schema, (String*)field, field_num); Vec_Store(ivars->entry_pool, field_num, (Obj*)entry); http://git-wip-us.apache.org/repos/asf/lucy/blob/76dc745d/core/Lucy/Index/DataReader.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/DataReader.c b/core/Lucy/Index/DataReader.c index f2469c9..2eca951 100644 --- a/core/Lucy/Index/DataReader.c +++ b/core/Lucy/Index/DataReader.c @@ -38,7 +38,7 @@ DataReader_init(DataReader *self, Schema *schema, Folder *folder, seg_tick); } else { - Segment *segment = (Segment*)Vec_Fetch(segments, seg_tick); + Segment *segment = (Segment*)Vec_Fetch(segments, (size_t)seg_tick); if (!segment) { THROW(ERR, "No segment at seg_tick %i32", seg_tick); } http://git-wip-us.apache.org/repos/asf/lucy/blob/76dc745d/core/Lucy/Index/DeletionsWriter.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/DeletionsWriter.c b/core/Lucy/Index/DeletionsWriter.c index c9c8899..2b5c449 100644 --- a/core/Lucy/Index/DeletionsWriter.c +++ b/core/Lucy/Index/DeletionsWriter.c @@ -217,7 +217,7 @@ DefDelWriter_Seg_Deletions_IMP(DefaultDeletionsWriter *self, String *seg_name = Seg_Get_Name(segment); Integer *tick_obj = (Integer*)Hash_Fetch(ivars->name_to_tick, seg_name); - int32_t tick = tick_obj ? (int32_t)Int_Get_Value(tick_obj) : 0; + size_t tick = tick_obj ? (size_t)Int_Get_Value(tick_obj) : 0; SegReader *candidate = tick_obj ? (SegReader*)Vec_Fetch(ivars->seg_readers, tick) : NULL; @@ -244,7 +244,7 @@ DefDelWriter_Seg_Del_Count_IMP(DefaultDeletionsWriter *self, DefaultDeletionsWriterIVARS *const ivars = DefDelWriter_IVARS(self); Integer *tick = (Integer*)Hash_Fetch(ivars->name_to_tick, seg_name); BitVector *deldocs = tick - ? (BitVector*)Vec_Fetch(ivars->bit_vecs, Int_Get_Value(tick)) + ? (BitVector*)Vec_Fetch(ivars->bit_vecs, (size_t)Int_Get_Value(tick)) : NULL; return deldocs ? (int32_t)BitVec_Count(deldocs) : 0; } http://git-wip-us.apache.org/repos/asf/lucy/blob/76dc745d/core/Lucy/Index/Inverter.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/Inverter.c b/core/Lucy/Index/Inverter.c index d5a684a..32ce69d 100644 --- a/core/Lucy/Index/Inverter.c +++ b/core/Lucy/Index/Inverter.c @@ -87,7 +87,8 @@ Inverter_Iterate_IMP(Inverter *self) { int32_t Inverter_Next_IMP(Inverter *self) { InverterIVARS *const ivars = Inverter_IVARS(self); - ivars->current = (InverterEntry*)Vec_Fetch(ivars->entries, ++ivars->tick); + ivars->tick += 1; + ivars->current = (InverterEntry*)Vec_Fetch(ivars->entries, (size_t)ivars->tick); if (!ivars->current) { ivars->current = ivars->blank; } // Exhausted. return InvEntry_IVARS(ivars->current)->field_num; } http://git-wip-us.apache.org/repos/asf/lucy/blob/76dc745d/core/Lucy/Index/LexiconReader.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/LexiconReader.c b/core/Lucy/Index/LexiconReader.c index 865da34..db0140a 100644 --- a/core/Lucy/Index/LexiconReader.c +++ b/core/Lucy/Index/LexiconReader.c @@ -198,7 +198,7 @@ DefLexReader_Lexicon_IMP(DefaultLexiconReader *self, String *field, Obj *term) { DefaultLexiconReaderIVARS *const ivars = DefLexReader_IVARS(self); int32_t field_num = Seg_Field_Num(ivars->segment, field); - SegLexicon *orig = (SegLexicon*)Vec_Fetch(ivars->lexicons, field_num); + SegLexicon *orig = (SegLexicon*)Vec_Fetch(ivars->lexicons, (size_t)field_num); SegLexicon *lexicon = NULL; if (orig) { // i.e. has data @@ -216,7 +216,7 @@ S_find_tinfo(DefaultLexiconReader *self, String *field, Obj *target) { if (field != NULL && target != NULL) { int32_t field_num = Seg_Field_Num(ivars->segment, field); SegLexicon *lexicon - = (SegLexicon*)Vec_Fetch(ivars->lexicons, field_num); + = (SegLexicon*)Vec_Fetch(ivars->lexicons, (size_t)field_num); if (lexicon) { // Iterate until the result is ge the term. http://git-wip-us.apache.org/repos/asf/lucy/blob/76dc745d/core/Lucy/Index/PostingListWriter.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/PostingListWriter.c b/core/Lucy/Index/PostingListWriter.c index 68c10f5..42423db 100644 --- a/core/Lucy/Index/PostingListWriter.c +++ b/core/Lucy/Index/PostingListWriter.c @@ -104,7 +104,7 @@ S_lazy_init(PostingListWriter *self) { static PostingPool* S_lazy_init_posting_pool(PostingListWriter *self, int32_t field_num) { PostingListWriterIVARS *const ivars = PListWriter_IVARS(self); - PostingPool *pool = (PostingPool*)Vec_Fetch(ivars->pools, field_num); + PostingPool *pool = (PostingPool*)Vec_Fetch(ivars->pools, (size_t)field_num); if (!pool && field_num != 0) { String *field = Seg_Field_Name(ivars->segment, field_num); pool = PostPool_new(ivars->schema, ivars->snapshot, ivars->segment, http://git-wip-us.apache.org/repos/asf/lucy/blob/76dc745d/core/Lucy/Index/Segment.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/Segment.c b/core/Lucy/Index/Segment.c index 05e52f0..0a77eee 100644 --- a/core/Lucy/Index/Segment.c +++ b/core/Lucy/Index/Segment.c @@ -247,7 +247,7 @@ String* Seg_Field_Name_IMP(Segment *self, int32_t field_num) { SegmentIVARS *const ivars = Seg_IVARS(self); return field_num - ? (String*)Vec_Fetch(ivars->by_num, field_num) + ? (String*)Vec_Fetch(ivars->by_num, (size_t)field_num) : NULL; } http://git-wip-us.apache.org/repos/asf/lucy/blob/76dc745d/core/Lucy/Index/SortWriter.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/SortWriter.c b/core/Lucy/Index/SortWriter.c index 7554482..53995c5 100644 --- a/core/Lucy/Index/SortWriter.c +++ b/core/Lucy/Index/SortWriter.c @@ -93,7 +93,7 @@ S_lazy_init_field_writer(SortWriter *self, int32_t field_num) { SortWriterIVARS *const ivars = SortWriter_IVARS(self); SortFieldWriter *field_writer - = (SortFieldWriter*)Vec_Fetch(ivars->field_writers, field_num); + = (SortFieldWriter*)Vec_Fetch(ivars->field_writers, (size_t)field_num); if (!field_writer) { // Open temp files. http://git-wip-us.apache.org/repos/asf/lucy/blob/76dc745d/core/Lucy/Store/CompoundFileReader.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Store/CompoundFileReader.c b/core/Lucy/Store/CompoundFileReader.c index 56ae159..06b79a3 100644 --- a/core/Lucy/Store/CompoundFileReader.c +++ b/core/Lucy/Store/CompoundFileReader.c @@ -318,7 +318,7 @@ CFReaderDH_Next_IMP(CFReaderDirHandle *self) { ivars->tick++; if (ivars->tick < (int32_t)Vec_Get_Size(ivars->elems)) { String *path = (String*)CERTIFY( - Vec_Fetch(ivars->elems, ivars->tick), STRING); + Vec_Fetch(ivars->elems, (size_t)ivars->tick), STRING); DECREF(ivars->entry); ivars->entry = (String*)INCREF(path); return true; @@ -335,7 +335,7 @@ bool CFReaderDH_Entry_Is_Dir_IMP(CFReaderDirHandle *self) { CFReaderDirHandleIVARS *const ivars = CFReaderDH_IVARS(self); if (ivars->elems) { - String *name = (String*)Vec_Fetch(ivars->elems, ivars->tick); + String *name = (String*)Vec_Fetch(ivars->elems, (size_t)ivars->tick); if (name) { return CFReader_Local_Is_Directory(ivars->cf_reader, name); } http://git-wip-us.apache.org/repos/asf/lucy/blob/76dc745d/core/Lucy/Store/RAMDirHandle.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Store/RAMDirHandle.c b/core/Lucy/Store/RAMDirHandle.c index 973c0ff..0a0917c 100644 --- a/core/Lucy/Store/RAMDirHandle.c +++ b/core/Lucy/Store/RAMDirHandle.c @@ -59,7 +59,7 @@ RAMDH_Next_IMP(RAMDirHandle *self) { ivars->tick++; if (ivars->tick < (int32_t)Vec_Get_Size(ivars->elems)) { String *path = (String*)CERTIFY( - Vec_Fetch(ivars->elems, ivars->tick), STRING); + Vec_Fetch(ivars->elems, (size_t)ivars->tick), STRING); DECREF(ivars->entry); ivars->entry = (String*)INCREF(path); return true; @@ -76,7 +76,7 @@ bool RAMDH_Entry_Is_Dir_IMP(RAMDirHandle *self) { RAMDirHandleIVARS *const ivars = RAMDH_IVARS(self); if (ivars->elems) { - String *name = (String*)Vec_Fetch(ivars->elems, ivars->tick); + String *name = (String*)Vec_Fetch(ivars->elems, (size_t)ivars->tick); if (name) { return RAMFolder_Local_Is_Directory(ivars->folder, name); } http://git-wip-us.apache.org/repos/asf/lucy/blob/76dc745d/core/Lucy/Test/Search/TestSortSpec.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Test/Search/TestSortSpec.c b/core/Lucy/Test/Search/TestSortSpec.c index 0540889..be6d23f 100644 --- a/core/Lucy/Test/Search/TestSortSpec.c +++ b/core/Lucy/Test/Search/TestSortSpec.c @@ -324,7 +324,7 @@ S_add_random_objects(Indexer **indexer, Schema *schema, RAMFolder *folder, Vec_Sort(objects); - for (int i = 0; i < 100; ++i) { + for (size_t i = 0; i < 100; ++i) { Obj *obj = Vec_Fetch(objects, i); String *string = Obj_To_String(obj); Vec_Store(objects, i, (Obj*)string); http://git-wip-us.apache.org/repos/asf/lucy/blob/76dc745d/core/Lucy/Test/Util/TestSortExternal.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Test/Util/TestSortExternal.c b/core/Lucy/Test/Util/TestSortExternal.c index e9bbba9..cb6564f 100644 --- a/core/Lucy/Test/Util/TestSortExternal.c +++ b/core/Lucy/Test/Util/TestSortExternal.c @@ -157,20 +157,20 @@ test_clear_buffer(TestBatchRunner *runner) { static void S_test_sort(TestBatchRunner *runner, Vector *blobs, uint32_t mem_thresh, const char *test_name) { - int size = (int)Vec_Get_Size(blobs); + size_t size = Vec_Get_Size(blobs); BlobSortEx *sortex = BlobSortEx_new(mem_thresh, NULL); Blob **shuffled = (Blob**)MALLOCATE(size * sizeof(Blob*)); - for (int i = 0; i < size; ++i) { + for (size_t i = 0; i < size; ++i) { shuffled[i] = (Blob*)CERTIFY(Vec_Fetch(blobs, i), BLOB); } - for (int i = size - 1; i > 0; --i) { + for (int i = (int)size - 1; i > 0; --i) { int shuffle_pos = rand() % (i + 1); Blob *temp = shuffled[shuffle_pos]; shuffled[shuffle_pos] = shuffled[i]; shuffled[i] = temp; } - for (int i = 0; i < size; ++i) { + for (size_t i = 0; i < size; ++i) { BlobSortEx_Feed(sortex, INCREF(shuffled[i])); } http://git-wip-us.apache.org/repos/asf/lucy/blob/76dc745d/core/Lucy/Util/MemoryPool.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Util/MemoryPool.c b/core/Lucy/Util/MemoryPool.c index 455d137..d1d394b 100644 --- a/core/Lucy/Util/MemoryPool.c +++ b/core/Lucy/Util/MemoryPool.c @@ -70,7 +70,7 @@ S_init_arena(MemoryPool *self, MemoryPoolIVARS *ivars, size_t amount) { if (ivars->tick < (int32_t)Vec_Get_Size(ivars->arenas)) { // In recycle mode, use previously acquired memory. - bb = (ByteBuf*)Vec_Fetch(ivars->arenas, ivars->tick); + bb = (ByteBuf*)Vec_Fetch(ivars->arenas, (size_t)ivars->tick); if (amount >= BB_Get_Size(bb)) { BB_Grow(bb, amount); BB_Set_Size(bb, amount); @@ -89,7 +89,7 @@ S_init_arena(MemoryPool *self, MemoryPoolIVARS *ivars, size_t amount) { // Recalculate consumption to take into account blocked off space. ivars->consumed = 0; for (int32_t i = 0; i < ivars->tick; i++) { - ByteBuf *bb = (ByteBuf*)Vec_Fetch(ivars->arenas, i); + ByteBuf *bb = (ByteBuf*)Vec_Fetch(ivars->arenas, (size_t)i); ivars->consumed += BB_Get_Size(bb); }
