Cast buf counts in SortExternal and PostingPool.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/1be7e72e Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/1be7e72e Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/1be7e72e Branch: refs/heads/master Commit: 1be7e72ed55cb939f42c6e71ccec7e2337d550d1 Parents: 4792d3e Author: Marvin Humphrey <mar...@rectangular.com> Authored: Thu May 26 19:09:15 2016 -0700 Committer: Marvin Humphrey <mar...@rectangular.com> Committed: Thu May 26 19:35:43 2016 -0700 ---------------------------------------------------------------------- core/Lucy/Index/PostingPool.c | 2 +- core/Lucy/Util/BlobSortEx.c | 5 ++--- core/Lucy/Util/SortExternal.c | 16 ++++++++-------- 3 files changed, 11 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/1be7e72e/core/Lucy/Index/PostingPool.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/PostingPool.c b/core/Lucy/Index/PostingPool.c index 0ca97ac..fefed8b 100644 --- a/core/Lucy/Index/PostingPool.c +++ b/core/Lucy/Index/PostingPool.c @@ -523,7 +523,7 @@ PostPool_Refill_IMP(PostingPool *self) { // Add to the run's buffer. if (num_elems >= ivars->buf_cap) { size_t new_cap = Memory_oversize(num_elems + 1, sizeof(Obj*)); - PostPool_Grow_Buffer(self, new_cap); + PostPool_Grow_Buffer(self, (uint32_t)new_cap); } ivars->buffer[num_elems] = (Obj*)rawpost; num_elems++; http://git-wip-us.apache.org/repos/asf/lucy/blob/1be7e72e/core/Lucy/Util/BlobSortEx.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Util/BlobSortEx.c b/core/Lucy/Util/BlobSortEx.c index e82c00e..23441a6 100644 --- a/core/Lucy/Util/BlobSortEx.c +++ b/core/Lucy/Util/BlobSortEx.c @@ -129,9 +129,8 @@ BlobSortEx_Refill_IMP(BlobSortEx *self) { } if (ivars->buf_max == ivars->buf_cap) { - BlobSortEx_Grow_Buffer(self, - Memory_oversize(ivars->buf_max + 1, - sizeof(Obj*))); + size_t amount = Memory_oversize(ivars->buf_max + 1, sizeof(Obj*)); + BlobSortEx_Grow_Buffer(self, (uint32_t)amount); } ivars->buffer[ivars->buf_max++] = INCREF(elem); } http://git-wip-us.apache.org/repos/asf/lucy/blob/1be7e72e/core/Lucy/Util/SortExternal.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Util/SortExternal.c b/core/Lucy/Util/SortExternal.c index 9e2a8ec..ea3ce7a 100644 --- a/core/Lucy/Util/SortExternal.c +++ b/core/Lucy/Util/SortExternal.c @@ -98,7 +98,7 @@ SortEx_Feed_IMP(SortExternal *self, Obj *item) { SortExternalIVARS *const ivars = SortEx_IVARS(self); if (ivars->buf_max == ivars->buf_cap) { size_t amount = Memory_oversize(ivars->buf_max + 1, sizeof(Obj*)); - SortEx_Grow_Buffer(self, amount); + SortEx_Grow_Buffer(self, (uint32_t)amount); } ivars->buffer[ivars->buf_max] = item; ivars->buf_max++; @@ -183,8 +183,8 @@ SortEx_Shrink_IMP(SortExternal *self) { } ivars->buffer = (Obj**)REALLOCATE(ivars->buffer, size); ivars->buf_tick = 0; - ivars->buf_max = buf_count; - ivars->buf_cap = buf_count; + ivars->buf_max = (uint32_t)buf_count; + ivars->buf_cap = (uint32_t)buf_count; } else { FREEMEM(ivars->buffer); @@ -293,7 +293,7 @@ S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars, if (ivars->buf_cap < total_size) { size_t cap = Memory_oversize(total_size, sizeof(Obj*)); - SortEx_Grow_Buffer(self, cap); + SortEx_Grow_Buffer(self, (uint32_t)cap); } ivars->buf_max = total_size; @@ -393,8 +393,8 @@ SortEx_Grow_Buffer_IMP(SortExternal *self, uint32_t cap) { static uint32_t S_find_slice_size(SortExternal *self, SortExternalIVARS *ivars, Obj **endpost) { - int32_t lo = ivars->buf_tick - 1; - int32_t hi = ivars->buf_max; + int32_t lo = (int32_t)ivars->buf_tick - 1; + int32_t hi = (int32_t)ivars->buf_max; Obj **buffer = ivars->buffer; SortEx_Compare_t compare = METHOD_PTR(SortEx_get_class(self), LUCY_SortEx_Compare); @@ -408,9 +408,9 @@ S_find_slice_size(SortExternal *self, SortExternalIVARS *ivars, } // If lo is still -1, we didn't find anything. - return lo == -1 + return lo < 0 ? 0 - : (lo - ivars->buf_tick) + 1; + : ((uint32_t)lo - ivars->buf_tick) + 1; } void