You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2016/04/27 03:19:34 UTC
[01/11] lucy git commit: Cast to narrow type from Vec_Get_Size.
Repository: lucy
Updated Branches:
refs/heads/master 90eebf02f -> 2d6629e26
Cast to narrow type from Vec_Get_Size.
Cast from size_t to uint32_t to avoid -Wconversion warnings. In each of
these cases, the number of elements in the Vector should be small.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/74d7d40d
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/74d7d40d
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/74d7d40d
Branch: refs/heads/master
Commit: 74d7d40db233e1dbfb2c7961116607d00ddad3bf
Parents: 30663d7
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Mon Apr 25 12:04:35 2016 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Mon Apr 25 12:13:50 2016 -0700
----------------------------------------------------------------------
core/Lucy/Search/ORMatcher.c | 2 +-
core/Lucy/Search/PhraseMatcher.c | 2 +-
core/Lucy/Search/PolyMatcher.c | 2 +-
core/LucyX/Search/ProximityMatcher.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/74d7d40d/core/Lucy/Search/ORMatcher.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/ORMatcher.c b/core/Lucy/Search/ORMatcher.c
index 60a344e..c5cde4b 100644
--- a/core/Lucy/Search/ORMatcher.c
+++ b/core/Lucy/Search/ORMatcher.c
@@ -77,7 +77,7 @@ S_ormatcher_init2(ORMatcher *self, ORMatcherIVARS *ivars, Vector *children,
ivars->size = 0;
// Derive.
- ivars->max_size = Vec_Get_Size(children);
+ ivars->max_size = (uint32_t)Vec_Get_Size(children);
// Allocate.
ivars->heap = (HeapedMatcherDoc**)CALLOCATE(ivars->max_size + 1, sizeof(HeapedMatcherDoc*));
http://git-wip-us.apache.org/repos/asf/lucy/blob/74d7d40d/core/Lucy/Search/PhraseMatcher.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PhraseMatcher.c b/core/Lucy/Search/PhraseMatcher.c
index 7ca4781..f0ffa5c 100644
--- a/core/Lucy/Search/PhraseMatcher.c
+++ b/core/Lucy/Search/PhraseMatcher.c
@@ -46,7 +46,7 @@ PhraseMatcher_init(PhraseMatcher *self, Similarity *similarity, Vector *plists,
ivars->more = true;
// Extract PostingLists out of Vector into local C array for quick access.
- ivars->num_elements = Vec_Get_Size(plists);
+ ivars->num_elements = (uint32_t)Vec_Get_Size(plists);
ivars->plists = (PostingList**)MALLOCATE(
ivars->num_elements * sizeof(PostingList*));
for (size_t i = 0; i < ivars->num_elements; i++) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/74d7d40d/core/Lucy/Search/PolyMatcher.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PolyMatcher.c b/core/Lucy/Search/PolyMatcher.c
index 444d53c..08bfb07 100644
--- a/core/Lucy/Search/PolyMatcher.c
+++ b/core/Lucy/Search/PolyMatcher.c
@@ -30,7 +30,7 @@ PolyMatcher*
PolyMatcher_init(PolyMatcher *self, Vector *children, Similarity *similarity) {
Matcher_init((Matcher*)self);
PolyMatcherIVARS *const ivars = PolyMatcher_IVARS(self);
- ivars->num_kids = Vec_Get_Size(children);
+ ivars->num_kids = (uint32_t)Vec_Get_Size(children);
ivars->sim = (Similarity*)INCREF(similarity);
ivars->children = (Vector*)INCREF(children);
ivars->coord_factors = (float*)MALLOCATE((ivars->num_kids + 1) * sizeof(float));
http://git-wip-us.apache.org/repos/asf/lucy/blob/74d7d40d/core/LucyX/Search/ProximityMatcher.c
----------------------------------------------------------------------
diff --git a/core/LucyX/Search/ProximityMatcher.c b/core/LucyX/Search/ProximityMatcher.c
index 8967386..e72b61c 100644
--- a/core/LucyX/Search/ProximityMatcher.c
+++ b/core/LucyX/Search/ProximityMatcher.c
@@ -50,7 +50,7 @@ ProximityMatcher_init(ProximityMatcher *self, Similarity *similarity,
ivars->within = within;
// Extract PostingLists out of Vector into local C array for quick access.
- ivars->num_elements = Vec_Get_Size(plists);
+ ivars->num_elements = (uint32_t)Vec_Get_Size(plists);
ivars->plists = (PostingList**)MALLOCATE(
ivars->num_elements * sizeof(PostingList*));
for (size_t i = 0; i < ivars->num_elements; i++) {
[02/11] lucy git commit: Address a few more simple Vec_Get_Size.
Posted by ma...@apache.org.
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 <ma...@rectangular.com>
Authored: Mon Apr 25 11:57:53 2016 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
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");
[07/11] lucy git commit: Adapt for Blob size_t APIs.
Posted by ma...@apache.org.
Adapt for Blob size_t APIs.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/56cabf0c
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/56cabf0c
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/56cabf0c
Branch: refs/heads/master
Commit: 56cabf0ce0f827b15e666a3760cdd54ace6f5d0e
Parents: 90d4a7d
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Mon Apr 25 16:37:07 2016 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Mon Apr 25 16:37:07 2016 -0700
----------------------------------------------------------------------
core/Lucy/Index/SortFieldWriter.c | 2 +-
core/Lucy/Test/Util/TestSortExternal.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/56cabf0c/core/Lucy/Index/SortFieldWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.c b/core/Lucy/Index/SortFieldWriter.c
index 0f57fe7..88c9742 100644
--- a/core/Lucy/Index/SortFieldWriter.c
+++ b/core/Lucy/Index/SortFieldWriter.c
@@ -182,7 +182,7 @@ SortFieldWriter_Add_IMP(SortFieldWriter *self, int32_t doc_id, Obj *value) {
Counter_Add(counter, size);
}
else if (ivars->prim_id == FType_BLOB) {
- int64_t size = Blob_Get_Size((Blob*)value) + 1;
+ int64_t size = (int64_t)Blob_Get_Size((Blob*)value) + 1;
size = SI_increase_to_word_multiple(size);
Counter_Add(counter, size);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/56cabf0c/core/Lucy/Test/Util/TestSortExternal.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestSortExternal.c b/core/Lucy/Test/Util/TestSortExternal.c
index cb6564f..c648595 100644
--- a/core/Lucy/Test/Util/TestSortExternal.c
+++ b/core/Lucy/Test/Util/TestSortExternal.c
@@ -259,7 +259,7 @@ test_sort_random_strings(TestBatchRunner *runner) {
for (int i = 0; i < size; ++i) {
buf[i] = rand();
}
- Blob *blob = Blob_new(buf, size);
+ Blob *blob = Blob_new(buf, (size_t)size);
Vec_Push(blobs, (Obj*)blob);
}
[10/11] lucy git commit: Adapt for size_t StringIterator APIs.
Posted by ma...@apache.org.
Adapt for size_t StringIterator APIs.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/7ffa1e02
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/7ffa1e02
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/7ffa1e02
Branch: refs/heads/master
Commit: 7ffa1e0231508051d7f49eaa432703fa57b16fcd
Parents: beca7cb
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Mon Apr 25 18:17:08 2016 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Mon Apr 25 18:17:08 2016 -0700
----------------------------------------------------------------------
core/Lucy/Highlight/Highlighter.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/7ffa1e02/core/Lucy/Highlight/Highlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Highlight/Highlighter.c b/core/Lucy/Highlight/Highlighter.c
index 1ce1fd9..875d019 100644
--- a/core/Lucy/Highlight/Highlighter.c
+++ b/core/Lucy/Highlight/Highlighter.c
@@ -230,7 +230,7 @@ S_find_starting_boundary(StringIterator *top, uint32_t max_skip,
if (code_point == STR_OOB || code_point == '.') {
// Skip remaining whitespace.
- *num_skipped_ptr = StrIter_Skip_Whitespace(top);
+ *num_skipped_ptr = (uint32_t)StrIter_Skip_Whitespace(top);
DECREF(iter);
return true;
}
@@ -300,7 +300,7 @@ S_find_ending_boundary(StringIterator *tail, uint32_t max_skip,
if (code_point == STR_OOB) {
// Skip remaining whitespace.
- *num_skipped_ptr = StrIter_Skip_Whitespace_Back(tail);
+ *num_skipped_ptr = (uint32_t)StrIter_Skip_Whitespace_Back(tail);
DECREF(iter);
return true;
}
@@ -340,7 +340,7 @@ S_find_ending_boundary(StringIterator *tail, uint32_t max_skip,
if (word == NULL) {
// Make space for ellipsis.
- *num_skipped_ptr = StrIter_Recede(tail, 1);
+ *num_skipped_ptr = (uint32_t)StrIter_Recede(tail, 1);
}
else {
// Use word boundary if no sentence boundary was found.
@@ -394,7 +394,7 @@ Highlighter_Raw_Excerpt_IMP(Highlighter *self, String *field_val,
else {
start = best_location - ivars->slop;
max_skip = ivars->slop;
- StrIter_Advance(top, start);
+ StrIter_Advance(top, (size_t)start);
}
uint32_t num_skipped;
@@ -413,7 +413,7 @@ Highlighter_Raw_Excerpt_IMP(Highlighter *self, String *field_val,
}
bool found_ending_edge = true;
- uint32_t excerpt_len = StrIter_Advance(tail, max_len);
+ uint32_t excerpt_len = (uint32_t)StrIter_Advance(tail, max_len);
// Skip up to slop code points but keep at least max_len - slop.
if (excerpt_len > max_len - ivars->slop) {
@@ -500,7 +500,7 @@ Highlighter_Highlight_Excerpt_IMP(Highlighter *self, Vector *spans,
// Highlight previous section
int32_t highlighted_len = hl_end - hl_start;
StrIter_Assign(temp, iter);
- StrIter_Advance(iter, highlighted_len);
+ StrIter_Advance(iter, (size_t)highlighted_len);
String *to_cat = StrIter_crop(temp, iter);
String *encoded = S_do_encode(self, to_cat, &encode_buf);
String *hl_frag = Highlighter_Highlight(self, encoded);
@@ -512,7 +512,7 @@ Highlighter_Highlight_Excerpt_IMP(Highlighter *self, Vector *spans,
int32_t non_highlighted_len = relative_start - hl_end;
StrIter_Assign(temp, iter);
- StrIter_Advance(iter, non_highlighted_len);
+ StrIter_Advance(iter, (size_t)non_highlighted_len);
String *to_cat = StrIter_crop(temp, iter);
String *encoded = S_do_encode(self, to_cat, &encode_buf);
CB_Cat(buf, (String*)encoded);
@@ -529,7 +529,7 @@ Highlighter_Highlight_Excerpt_IMP(Highlighter *self, Vector *spans,
// Highlight final section
int32_t highlighted_len = hl_end - hl_start;
StrIter_Assign(temp, iter);
- StrIter_Advance(iter, highlighted_len);
+ StrIter_Advance(iter, (size_t)highlighted_len);
String *to_cat = StrIter_crop(temp, iter);
String *encoded = S_do_encode(self, to_cat, &encode_buf);
String *hl_frag = Highlighter_Highlight(self, encoded);
[04/11] lucy git commit: Adapt for Vec_Fetch size_t tick param.
Posted by ma...@apache.org.
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 <ma...@rectangular.com>
Authored: Mon Apr 25 13:04:50 2016 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
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);
}
[05/11] lucy git commit: Adapt for size_t tick param to Vec_Store.
Posted by ma...@apache.org.
Adapt for size_t tick param to Vec_Store.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/f57736f3
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/f57736f3
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/f57736f3
Branch: refs/heads/master
Commit: f57736f3d759eded77d52f3bcacda3e180a31b28
Parents: 76dc745
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Mon Apr 25 13:50:16 2016 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Mon Apr 25 13:50:16 2016 -0700
----------------------------------------------------------------------
c/src/Lucy/Index/Inverter.c | 2 +-
core/Lucy/Index/PostingListWriter.c | 2 +-
core/Lucy/Index/SortWriter.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/f57736f3/c/src/Lucy/Index/Inverter.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Index/Inverter.c b/c/src/Lucy/Index/Inverter.c
index 96c6c15..d233e67 100644
--- a/c/src/Lucy/Index/Inverter.c
+++ b/c/src/Lucy/Index/Inverter.c
@@ -54,7 +54,7 @@ S_fetch_entry(InverterIVARS *ivars, String *field) {
= (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);
+ Vec_Store(ivars->entry_pool, (size_t)field_num, (Obj*)entry);
}
return entry;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f57736f3/core/Lucy/Index/PostingListWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PostingListWriter.c b/core/Lucy/Index/PostingListWriter.c
index 42423db..ef65b9b 100644
--- a/core/Lucy/Index/PostingListWriter.c
+++ b/core/Lucy/Index/PostingListWriter.c
@@ -111,7 +111,7 @@ S_lazy_init_posting_pool(PostingListWriter *self, int32_t field_num) {
ivars->polyreader, field, ivars->lex_writer,
ivars->mem_pool, ivars->lex_temp_out,
ivars->post_temp_out, ivars->skip_out);
- Vec_Store(ivars->pools, field_num, (Obj*)pool);
+ Vec_Store(ivars->pools, (size_t)field_num, (Obj*)pool);
}
return pool;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/f57736f3/core/Lucy/Index/SortWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortWriter.c b/core/Lucy/Index/SortWriter.c
index 53995c5..f91b8b1 100644
--- a/core/Lucy/Index/SortWriter.c
+++ b/core/Lucy/Index/SortWriter.c
@@ -126,7 +126,7 @@ S_lazy_init_field_writer(SortWriter *self, int32_t field_num) {
ivars->polyreader, field, ivars->counter,
ivars->mem_thresh, ivars->temp_ord_out,
ivars->temp_ix_out, ivars->temp_dat_out);
- Vec_Store(ivars->field_writers, field_num, (Obj*)field_writer);
+ Vec_Store(ivars->field_writers, (size_t)field_num, (Obj*)field_writer);
}
return field_writer;
}
[06/11] lucy git commit: Adapt for String size_t APIs.
Posted by ma...@apache.org.
Adapt for String size_t APIs.
Adapt for String methods which either return size_t or accept size_t
parameters.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/90d4a7d6
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/90d4a7d6
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/90d4a7d6
Branch: refs/heads/master
Commit: 90d4a7d6d4e310d9d8c0568b76c4dba246dad01f
Parents: f57736f
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Mon Apr 25 15:44:05 2016 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Mon Apr 25 15:44:05 2016 -0700
----------------------------------------------------------------------
core/Lucy/Analysis/SnowballStemmer.c | 12 ++++++++++--
core/Lucy/Analysis/SnowballStopFilter.c | 12 ++++++++++--
core/Lucy/Highlight/Highlighter.c | 2 +-
core/Lucy/Index/SortFieldWriter.c | 2 +-
core/Lucy/Test/Analysis/TestNormalizer.c | 2 +-
5 files changed, 23 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/90d4a7d6/core/Lucy/Analysis/SnowballStemmer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/SnowballStemmer.c b/core/Lucy/Analysis/SnowballStemmer.c
index dc5fe91..982e4c1 100644
--- a/core/Lucy/Analysis/SnowballStemmer.c
+++ b/core/Lucy/Analysis/SnowballStemmer.c
@@ -39,8 +39,16 @@ SnowStemmer_init(SnowballStemmer *self, String *language) {
ivars->language = Str_Clone(language);
// Get a Snowball stemmer. Be case-insensitive.
- lang_buf[0] = tolower(Str_Code_Point_At(language, 0));
- lang_buf[1] = tolower(Str_Code_Point_At(language, 1));
+ int32_t first_letter = Str_Code_Point_At(language, 0);
+ int32_t second_letter = Str_Code_Point_At(language, 1);
+ if (first_letter > 127 || first_letter < 0
+ || second_letter > 127 || second_letter < 0
+ ) {
+ first_letter = 0;
+ second_letter = 0;
+ }
+ lang_buf[0] = (char)tolower((int)first_letter);
+ lang_buf[1] = (char)tolower((int)second_letter);
lang_buf[2] = '\0';
ivars->snowstemmer = sb_stemmer_new(lang_buf, "UTF_8");
if (!ivars->snowstemmer) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/90d4a7d6/core/Lucy/Analysis/SnowballStopFilter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/SnowballStopFilter.c b/core/Lucy/Analysis/SnowballStopFilter.c
index 80bff45..1767f06 100644
--- a/core/Lucy/Analysis/SnowballStopFilter.c
+++ b/core/Lucy/Analysis/SnowballStopFilter.c
@@ -121,8 +121,16 @@ SnowStop_Load_IMP(SnowballStopFilter *self, Obj *dump) {
Hash*
SnowStop_gen_stoplist(String *language) {
char lang[2];
- lang[0] = tolower(Str_Code_Point_At(language, 0));
- lang[1] = tolower(Str_Code_Point_At(language, 1));
+ int32_t first_letter = Str_Code_Point_At(language, 0);
+ int32_t second_letter = Str_Code_Point_At(language, 1);
+ if (first_letter > 127 || first_letter < 0
+ || second_letter > 127 || second_letter < 0
+ ) {
+ first_letter = 0;
+ second_letter = 0;
+ }
+ lang[0] = (char)tolower((int)first_letter);
+ lang[1] = (char)tolower((int)second_letter);
const uint8_t **words = NULL;
if (memcmp(lang, "da", 2) == 0) { words = SnowStop_snow_da; }
else if (memcmp(lang, "de", 2) == 0) { words = SnowStop_snow_de; }
http://git-wip-us.apache.org/repos/asf/lucy/blob/90d4a7d6/core/Lucy/Highlight/Highlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Highlight/Highlighter.c b/core/Lucy/Highlight/Highlighter.c
index edc0db5..1ce1fd9 100644
--- a/core/Lucy/Highlight/Highlighter.c
+++ b/core/Lucy/Highlight/Highlighter.c
@@ -475,7 +475,7 @@ Highlighter_Highlight_Excerpt_IMP(Highlighter *self, Vector *spans,
StringIterator *temp = Str_Top(raw_excerpt);
CharBuf *buf = CB_new(Str_Get_Size(raw_excerpt) + 32);
CharBuf *encode_buf = NULL;
- int32_t raw_excerpt_end = top + Str_Length(raw_excerpt);
+ int32_t raw_excerpt_end = top + (int32_t)Str_Length(raw_excerpt);
for (size_t i = 0, max = Vec_Get_Size(spans); i < max; i++) {
Span *span = (Span*)Vec_Fetch(spans, i);
http://git-wip-us.apache.org/repos/asf/lucy/blob/90d4a7d6/core/Lucy/Index/SortFieldWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.c b/core/Lucy/Index/SortFieldWriter.c
index 72cc599..0f57fe7 100644
--- a/core/Lucy/Index/SortFieldWriter.c
+++ b/core/Lucy/Index/SortFieldWriter.c
@@ -177,7 +177,7 @@ SortFieldWriter_Add_IMP(SortFieldWriter *self, int32_t doc_id, Obj *value) {
Counter *counter = ivars->counter;
Counter_Add(counter, ivars->mem_per_entry);
if (ivars->prim_id == FType_TEXT) {
- int64_t size = Str_Get_Size((String*)value) + 1;
+ int64_t size = (int64_t)Str_Get_Size((String*)value) + 1;
size = SI_increase_to_word_multiple(size);
Counter_Add(counter, size);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/90d4a7d6/core/Lucy/Test/Analysis/TestNormalizer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Analysis/TestNormalizer.c b/core/Lucy/Test/Analysis/TestNormalizer.c
index d6028dc..2323c2e 100644
--- a/core/Lucy/Test/Analysis/TestNormalizer.c
+++ b/core/Lucy/Test/Analysis/TestNormalizer.c
@@ -133,7 +133,7 @@ test_utf8proc_normalization(TestBatchRunner *runner) {
// Normalize once.
uint8_t *normalized;
int32_t check = utf8proc_map((const uint8_t*)Str_Get_Ptr8(source),
- Str_Get_Size(source),
+ (ssize_t)Str_Get_Size(source),
&normalized,
UTF8PROC_STABLE |
UTF8PROC_COMPOSE |
[08/11] lucy git commit: Adapt for size_t ByteBuf APIs.
Posted by ma...@apache.org.
Adapt for size_t ByteBuf APIs.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/a52a0a99
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/a52a0a99
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/a52a0a99
Branch: refs/heads/master
Commit: a52a0a998d6eaf97bb389d6a40c0834f3a4585a2
Parents: 56cabf0
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Mon Apr 25 16:45:10 2016 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Mon Apr 25 17:01:55 2016 -0700
----------------------------------------------------------------------
core/Lucy/Index/HighlightWriter.c | 6 +++++-
core/Lucy/Index/PostingPool.c | 2 +-
core/Lucy/Store/RAMFileHandle.c | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/a52a0a99/core/Lucy/Index/HighlightWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/HighlightWriter.c b/core/Lucy/Index/HighlightWriter.c
index 72153b2..b580dbc 100644
--- a/core/Lucy/Index/HighlightWriter.c
+++ b/core/Lucy/Index/HighlightWriter.c
@@ -199,7 +199,11 @@ HLWriter_TV_Buf_IMP(HighlightWriter *self, Inversion *inversion) {
} while (--freq && (token = *++tokens));
// Set new byte length.
- BB_Set_Size(tv_buf, ptr - orig);
+ ptrdiff_t diff = ptr - orig;
+ if (diff < 0) { // sanity check
+ diff = 0;
+ }
+ BB_Set_Size(tv_buf, (size_t)diff);
}
// Go back and start the term vector string with the posting count.
http://git-wip-us.apache.org/repos/asf/lucy/blob/a52a0a99/core/Lucy/Index/PostingPool.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PostingPool.c b/core/Lucy/Index/PostingPool.c
index 74b0e0c..9bb785a 100644
--- a/core/Lucy/Index/PostingPool.c
+++ b/core/Lucy/Index/PostingPool.c
@@ -356,7 +356,7 @@ S_write_terms_and_postings(PostingPool *self, PostingWriter *post_writer,
ByteBuf *last_term_text
= BB_new_bytes(post_ivars->blob, post_ivars->content_len);
char *last_text_buf = BB_Get_Buf(last_term_text);
- uint32_t last_text_size = BB_Get_Size(last_term_text);
+ uint32_t last_text_size = (uint32_t)BB_Get_Size(last_term_text);
SkipStepper_Set_ID_And_Filepos(skip_stepper, 0, 0);
// Initialize sentinel to be used on the last iter, using an empty string
http://git-wip-us.apache.org/repos/asf/lucy/blob/a52a0a99/core/Lucy/Store/RAMFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/RAMFileHandle.c b/core/Lucy/Store/RAMFileHandle.c
index 7895d25..4545d8d 100644
--- a/core/Lucy/Store/RAMFileHandle.c
+++ b/core/Lucy/Store/RAMFileHandle.c
@@ -64,7 +64,7 @@ RAMFH_do_open(RAMFileHandle *self, String *path, uint32_t flags,
}
ivars->contents = (ByteBuf*)INCREF(RAMFile_Get_Contents(ivars->ram_file));
- ivars->len = BB_Get_Size(ivars->contents);
+ ivars->len = (int64_t)BB_Get_Size(ivars->contents);
return self;
}
[03/11] lucy git commit: Adapt for changes to Hash_Get_Size.
Posted by ma...@apache.org.
Adapt for changes to Hash_Get_Size.
The return value has been widened to size_t, so cast where necessary.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/bb67e9f0
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/bb67e9f0
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/bb67e9f0
Branch: refs/heads/master
Commit: bb67e9f0b737eba783f053c0f7421d71d2affb5a
Parents: 74d7d40
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Mon Apr 25 12:32:59 2016 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Mon Apr 25 12:33:18 2016 -0700
----------------------------------------------------------------------
c/src/Lucy/Document/Doc.c | 2 +-
core/Lucy/Index/Snapshot.c | 2 +-
core/Lucy/Plan/Schema.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/bb67e9f0/c/src/Lucy/Document/Doc.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Document/Doc.c b/c/src/Lucy/Document/Doc.c
index 19b9d9d..113606b 100644
--- a/c/src/Lucy/Document/Doc.c
+++ b/c/src/Lucy/Document/Doc.c
@@ -55,7 +55,7 @@ Doc_Set_Fields_IMP(Doc *self, void *fields) {
uint32_t
Doc_Get_Size_IMP(Doc *self) {
Hash *hash = (Hash*)Doc_IVARS(self)->fields;
- return Hash_Get_Size(hash);
+ return (uint32_t)Hash_Get_Size(hash);
}
void
http://git-wip-us.apache.org/repos/asf/lucy/blob/bb67e9f0/core/Lucy/Index/Snapshot.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Snapshot.c b/core/Lucy/Index/Snapshot.c
index a67379b..c1005b2 100644
--- a/core/Lucy/Index/Snapshot.c
+++ b/core/Lucy/Index/Snapshot.c
@@ -88,7 +88,7 @@ Snapshot_List_IMP(Snapshot *self) {
uint32_t
Snapshot_Num_Entries_IMP(Snapshot *self) {
SnapshotIVARS *const ivars = Snapshot_IVARS(self);
- return Hash_Get_Size(ivars->entries);
+ return (uint32_t)Hash_Get_Size(ivars->entries);
}
void
http://git-wip-us.apache.org/repos/asf/lucy/blob/bb67e9f0/core/Lucy/Plan/Schema.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/Schema.c b/core/Lucy/Plan/Schema.c
index 2da6716..d39fc55 100644
--- a/core/Lucy/Plan/Schema.c
+++ b/core/Lucy/Plan/Schema.c
@@ -211,7 +211,7 @@ Schema_Fetch_Sim_IMP(Schema *self, String *field) {
uint32_t
Schema_Num_Fields_IMP(Schema *self) {
SchemaIVARS *const ivars = Schema_IVARS(self);
- return Hash_Get_Size(ivars->types);
+ return (uint32_t)Hash_Get_Size(ivars->types);
}
Architecture*
[11/11] lucy git commit: Merge branch 'LUCY-295-more-cf-size_t'
Posted by ma...@apache.org.
Merge branch 'LUCY-295-more-cf-size_t'
Adapt Lucy code for better conformance with Clownfish APIs -- in
particular, those that have changed to use size_t for element counts.
This closes #44.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/2d6629e2
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/2d6629e2
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/2d6629e2
Branch: refs/heads/master
Commit: 2d6629e26a1890d14e43bb6680561e079942d0af
Parents: 90eebf0 7ffa1e0
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Tue Apr 26 18:18:30 2016 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Tue Apr 26 18:18:30 2016 -0700
----------------------------------------------------------------------
c/src/Lucy/Document/Doc.c | 2 +-
c/src/Lucy/Index/Inverter.c | 4 ++--
core/Lucy/Analysis/SnowballStemmer.c | 12 ++++++++++--
core/Lucy/Analysis/SnowballStopFilter.c | 12 ++++++++++--
core/Lucy/Highlight/Highlighter.c | 18 +++++++++---------
core/Lucy/Index/DataReader.c | 2 +-
core/Lucy/Index/DeletionsWriter.c | 6 +++---
core/Lucy/Index/HighlightWriter.c | 6 +++++-
core/Lucy/Index/Inverter.c | 3 ++-
core/Lucy/Index/LexiconReader.c | 4 ++--
core/Lucy/Index/PostingListWriter.c | 4 ++--
core/Lucy/Index/PostingPool.c | 2 +-
core/Lucy/Index/Segment.c | 2 +-
core/Lucy/Index/Snapshot.c | 2 +-
core/Lucy/Index/SortFieldWriter.c | 4 ++--
core/Lucy/Index/SortWriter.c | 4 ++--
core/Lucy/Plan/Schema.c | 2 +-
core/Lucy/Search/ORMatcher.c | 2 +-
core/Lucy/Search/PhraseMatcher.c | 2 +-
core/Lucy/Search/PolyMatcher.c | 2 +-
core/Lucy/Search/PolySearcher.c | 8 ++++----
core/Lucy/Store/CompoundFileReader.c | 6 +++---
core/Lucy/Store/RAMDirHandle.c | 4 ++--
core/Lucy/Store/RAMFileHandle.c | 2 +-
core/Lucy/Test/Analysis/TestNormalizer.c | 2 +-
core/Lucy/Test/Search/TestQueryParserLogic.c | 3 +--
core/Lucy/Test/Search/TestSortSpec.c | 2 +-
core/Lucy/Test/Store/TestFolder.c | 4 ++--
core/Lucy/Test/Util/TestSortExternal.c | 10 +++++-----
core/Lucy/Util/MemoryPool.c | 4 ++--
core/LucyX/Search/ProximityMatcher.c | 2 +-
31 files changed, 81 insertions(+), 61 deletions(-)
----------------------------------------------------------------------
[09/11] lucy git commit: Cast arg to Int_new.
Posted by ma...@apache.org.
Cast arg to Int_new.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/beca7cbe
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/beca7cbe
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/beca7cbe
Branch: refs/heads/master
Commit: beca7cbe501707c1ef9308050b83466d6547e89a
Parents: a52a0a9
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Mon Apr 25 17:02:48 2016 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Mon Apr 25 17:02:48 2016 -0700
----------------------------------------------------------------------
core/Lucy/Index/DeletionsWriter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/beca7cbe/core/Lucy/Index/DeletionsWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/DeletionsWriter.c b/core/Lucy/Index/DeletionsWriter.c
index 2b5c449..3b82f84 100644
--- a/core/Lucy/Index/DeletionsWriter.c
+++ b/core/Lucy/Index/DeletionsWriter.c
@@ -116,7 +116,7 @@ DefDelWriter_init(DefaultDeletionsWriter *self, Schema *schema,
Vec_Store(ivars->bit_vecs, i, (Obj*)bit_vec);
Hash_Store(ivars->name_to_tick,
SegReader_Get_Seg_Name(seg_reader),
- (Obj*)Int_new(i));
+ (Obj*)Int_new((int64_t)i));
}
return self;