Address a few more simple Vec_Get_Size. Adapt a few more easy-to-review transitions from uint32_t to size_t.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/30663d76 Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/30663d76 Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/30663d76 Branch: refs/heads/master Commit: 30663d768a85f5cdf55b4c29026954280d68269c Parents: 90eebf0 Author: Marvin Humphrey <[email protected]> Authored: Mon Apr 25 11:57:53 2016 -0700 Committer: Marvin Humphrey <[email protected]> Committed: Mon Apr 25 12:13:50 2016 -0700 ---------------------------------------------------------------------- core/Lucy/Search/PolySearcher.c | 8 ++++---- core/Lucy/Store/CompoundFileReader.c | 2 +- core/Lucy/Test/Search/TestQueryParserLogic.c | 3 +-- core/Lucy/Test/Store/TestFolder.c | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/30663d76/core/Lucy/Search/PolySearcher.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Search/PolySearcher.c b/core/Lucy/Search/PolySearcher.c index 65f286d..efa9321 100644 --- a/core/Lucy/Search/PolySearcher.c +++ b/core/Lucy/Search/PolySearcher.c @@ -114,7 +114,7 @@ uint32_t PolySearcher_Doc_Freq_IMP(PolySearcher *self, String *field, Obj *term) { PolySearcherIVARS *const ivars = PolySearcher_IVARS(self); uint32_t doc_freq = 0; - for (uint32_t i = 0, max = Vec_Get_Size(ivars->searchers); i < max; i++) { + for (size_t i = 0, max = Vec_Get_Size(ivars->searchers); i < max; i++) { Searcher *searcher = (Searcher*)Vec_Fetch(ivars->searchers, i); doc_freq += Searcher_Doc_Freq(searcher, field, term); } @@ -123,7 +123,7 @@ PolySearcher_Doc_Freq_IMP(PolySearcher *self, String *field, Obj *term) { static void S_modify_doc_ids(Vector *match_docs, int32_t base) { - for (uint32_t i = 0, max = Vec_Get_Size(match_docs); i < max; i++) { + for (size_t i = 0, max = Vec_Get_Size(match_docs); i < max; i++) { MatchDoc *match_doc = (MatchDoc*)Vec_Fetch(match_docs, i); int32_t new_doc_id = MatchDoc_Get_Doc_ID(match_doc) + base; MatchDoc_Set_Doc_ID(match_doc, new_doc_id); @@ -147,7 +147,7 @@ PolySearcher_Top_Docs_IMP(PolySearcher *self, Query *query, Query_Get_Boost(query), false); - for (uint32_t i = 0, max = Vec_Get_Size(searchers); i < max; i++) { + for (size_t i = 0, max = Vec_Get_Size(searchers); i < max; i++) { Searcher *searcher = (Searcher*)Vec_Fetch(searchers, i); int32_t base = I32Arr_Get(starts, i); TopDocs *top_docs = Searcher_Top_Docs(searcher, (Query*)compiler, @@ -157,7 +157,7 @@ PolySearcher_Top_Docs_IMP(PolySearcher *self, Query *query, total_hits += TopDocs_Get_Total_Hits(top_docs); S_modify_doc_ids(sub_match_docs, base); - for (uint32_t j = 0, jmax = Vec_Get_Size(sub_match_docs); j < jmax; j++) { + for (size_t j = 0, jmax = Vec_Get_Size(sub_match_docs); j < jmax; j++) { MatchDoc *match_doc = (MatchDoc*)Vec_Fetch(sub_match_docs, j); if (!HitQ_Insert(hit_q, INCREF(match_doc))) { break; } } http://git-wip-us.apache.org/repos/asf/lucy/blob/30663d76/core/Lucy/Store/CompoundFileReader.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Store/CompoundFileReader.c b/core/Lucy/Store/CompoundFileReader.c index db24fa1..56ae159 100644 --- a/core/Lucy/Store/CompoundFileReader.c +++ b/core/Lucy/Store/CompoundFileReader.c @@ -92,7 +92,7 @@ CFReader_do_open(CompoundFileReader *self, Folder *folder) { String *folder_name = IxFileNames_local_part(Folder_Get_Path(folder)); size_t folder_name_len = Str_Length(folder_name); - for (uint32_t i = 0, max = Vec_Get_Size(files); i < max; i++) { + for (size_t i = 0, max = Vec_Get_Size(files); i < max; i++) { String *orig = (String*)Vec_Fetch(files, i); if (Str_Starts_With(orig, folder_name)) { Obj *record = Hash_Delete(ivars->records, orig); http://git-wip-us.apache.org/repos/asf/lucy/blob/30663d76/core/Lucy/Test/Search/TestQueryParserLogic.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Test/Search/TestQueryParserLogic.c b/core/Lucy/Test/Search/TestQueryParserLogic.c index 98af6e0..e3066e1 100644 --- a/core/Lucy/Test/Search/TestQueryParserLogic.c +++ b/core/Lucy/Test/Search/TestQueryParserLogic.c @@ -863,10 +863,9 @@ S_create_index() { RAMFolder *folder = RAMFolder_new(NULL); Vector *doc_set = TestUtils_doc_set(); Indexer *indexer = Indexer_new(schema, (Obj*)folder, NULL, 0); - uint32_t i, max; String *field = SSTR_WRAP_C("content"); - for (i = 0, max = Vec_Get_Size(doc_set); i < max; i++) { + for (size_t i = 0, max = Vec_Get_Size(doc_set); i < max; i++) { Doc *doc = Doc_new(NULL, 0); Doc_Store(doc, field, Vec_Fetch(doc_set, i)); Indexer_Add_Doc(indexer, doc, 1.0f); http://git-wip-us.apache.org/repos/asf/lucy/blob/30663d76/core/Lucy/Test/Store/TestFolder.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Test/Store/TestFolder.c b/core/Lucy/Test/Store/TestFolder.c index b2fa213..e94d474 100644 --- a/core/Lucy/Test/Store/TestFolder.c +++ b/core/Lucy/Test/Store/TestFolder.c @@ -244,7 +244,7 @@ test_List(TestBatchRunner *runner) { list = Folder_List(folder, NULL); Vec_Sort(list); - TEST_INT_EQ(runner, Vec_Get_Size(list), 3, "List"); + TEST_UINT_EQ(runner, Vec_Get_Size(list), 3, "List"); elem = (String*)DOWNCAST(Vec_Fetch(list, 0), STRING); TEST_TRUE(runner, elem && Str_Equals(elem, (Obj*)banana), "List first file"); @@ -256,7 +256,7 @@ test_List(TestBatchRunner *runner) { DECREF(list); list = Folder_List(folder, foo_bar); - TEST_INT_EQ(runner, Vec_Get_Size(list), 1, "List subdirectory contents"); + TEST_UINT_EQ(runner, Vec_Get_Size(list), 1, "List subdirectory contents"); elem = (String*)DOWNCAST(Vec_Fetch(list, 0), STRING); TEST_TRUE(runner, elem && Str_Equals(elem, (Obj*)baz), "Just the filename");
