Change C32/C64 for freq, positions. `freq` (num occurrences per document for a term) is generally represented as a uint32_t. Positions may be signed or unsigned -- it's not consistent. Just match up to existing usage.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/656a773b Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/656a773b Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/656a773b Branch: refs/heads/master Commit: 656a773b89d3676dc9d62d48f5a2d145342bb32c Parents: 3089bfd Author: Marvin Humphrey <mar...@rectangular.com> Authored: Wed Apr 20 18:52:32 2016 -0700 Committer: Marvin Humphrey <mar...@rectangular.com> Committed: Wed Apr 20 19:26:48 2016 -0700 ---------------------------------------------------------------------- core/Lucy/Index/Posting/MatchPosting.c | 6 +++--- core/Lucy/Index/Posting/RawPosting.c | 2 +- core/Lucy/Index/Posting/RichPosting.c | 4 ++-- core/Lucy/Index/TermVector.c | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/656a773b/core/Lucy/Index/Posting/MatchPosting.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/Posting/MatchPosting.c b/core/Lucy/Index/Posting/MatchPosting.c index 2bda909..e44eee8 100644 --- a/core/Lucy/Index/Posting/MatchPosting.c +++ b/core/Lucy/Index/Posting/MatchPosting.c @@ -90,7 +90,7 @@ MatchPost_Read_Record_IMP(MatchPosting *self, InStream *instream) { ivars->freq = 1; } else { - ivars->freq = InStream_Read_C32(instream); + ivars->freq = InStream_Read_CU32(instream); } } @@ -217,7 +217,7 @@ MatchPostWriter_Write_Posting_IMP(MatchPostingWriter *self, RawPosting *posting) else { const uint32_t doc_code = delta_doc << 1; OutStream_Write_CU32(outstream, doc_code); - OutStream_Write_C32(outstream, posting_ivars->freq); + OutStream_Write_CU32(outstream, posting_ivars->freq); } OutStream_Write_Bytes(outstream, aux_content, posting_ivars->aux_len); ivars->last_doc_id = doc_id; @@ -296,7 +296,7 @@ MatchTInfoStepper_Write_Delta_IMP(MatchTermInfoStepper *self, - TInfo_IVARS(last_tinfo)->post_filepos; // Write doc_freq. - OutStream_Write_C32(outstream, doc_freq); + OutStream_Write_CU32(outstream, doc_freq); // Write postings file pointer delta. OutStream_Write_CI64(outstream, post_delta); http://git-wip-us.apache.org/repos/asf/lucy/blob/656a773b/core/Lucy/Index/Posting/RawPosting.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/Posting/RawPosting.c b/core/Lucy/Index/Posting/RawPosting.c index 052020a..0fc5b2e 100644 --- a/core/Lucy/Index/Posting/RawPosting.c +++ b/core/Lucy/Index/Posting/RawPosting.c @@ -138,7 +138,7 @@ RawPostWriter_Write_Posting_IMP(RawPostingWriter *self, RawPosting *posting) { else { const uint32_t doc_code = delta_doc << 1; OutStream_Write_CU32(outstream, doc_code); - OutStream_Write_C32(outstream, posting_ivars->freq); + OutStream_Write_CU32(outstream, posting_ivars->freq); } OutStream_Write_Bytes(outstream, aux_content, posting_ivars->aux_len); ivars->last_doc_id = doc_id; http://git-wip-us.apache.org/repos/asf/lucy/blob/656a773b/core/Lucy/Index/Posting/RichPosting.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/Posting/RichPosting.c b/core/Lucy/Index/Posting/RichPosting.c index db590d4..da9da77 100644 --- a/core/Lucy/Index/Posting/RichPosting.c +++ b/core/Lucy/Index/Posting/RichPosting.c @@ -81,7 +81,7 @@ RichPost_Read_Record_IMP(RichPosting *self, InStream *instream) { } // Otherwise, freq was stored as a C32. else { - ivars->freq = InStream_Read_C32(instream); + ivars->freq = InStream_Read_CU32(instream); } // Read positions, aggregate per-position boost byte into weight. @@ -96,7 +96,7 @@ RichPost_Read_Record_IMP(RichPosting *self, InStream *instream) { float *prox_boosts = ivars->prox_boosts; while (num_prox--) { - position += InStream_Read_C32(instream); + position += InStream_Read_CU32(instream); *positions++ = position; *prox_boosts = norm_decoder[InStream_Read_U8(instream)]; aggregate_weight += *prox_boosts; http://git-wip-us.apache.org/repos/asf/lucy/blob/656a773b/core/Lucy/Index/TermVector.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/TermVector.c b/core/Lucy/Index/TermVector.c index 9c3a6f9..8ad0bcf 100644 --- a/core/Lucy/Index/TermVector.c +++ b/core/Lucy/Index/TermVector.c @@ -93,9 +93,9 @@ TV_Serialize_IMP(TermVector *self, OutStream *target) { OutStream_Write_CU64(target, ivars->num_pos); for (size_t i = 0; i < ivars->num_pos; i++) { - OutStream_Write_C32(target, posits[i]); - OutStream_Write_C32(target, starts[i]); - OutStream_Write_C32(target, ends[i]); + OutStream_Write_CI32(target, posits[i]); + OutStream_Write_CI32(target, starts[i]); + OutStream_Write_CI32(target, ends[i]); } } @@ -110,9 +110,9 @@ TV_Deserialize_IMP(TermVector *self, InStream *instream) { int32_t *starts = (int32_t*)MALLOCATE(num_pos * sizeof(int32_t)); int32_t *ends = (int32_t*)MALLOCATE(num_pos * sizeof(int32_t)); for (size_t i = 0; i < num_pos; i++) { - posits[i] = InStream_Read_C32(instream); - starts[i] = InStream_Read_C32(instream); - ends[i] = InStream_Read_C32(instream); + posits[i] = InStream_Read_CI32(instream); + starts[i] = InStream_Read_CI32(instream); + ends[i] = InStream_Read_CI32(instream); } I32Array *positions = I32Arr_new_steal(posits, num_pos); I32Array *start_offsets = I32Arr_new_steal(starts, num_pos);