Change I32Array size to `size_t`. Only the core module -- all usage sites need to be changed next.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/7e31cc69 Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/7e31cc69 Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/7e31cc69 Branch: refs/heads/master Commit: 7e31cc6930fe9c78b9a21124765dc33a98d10759 Parents: abee805 Author: Marvin Humphrey <mar...@rectangular.com> Authored: Wed Mar 30 17:34:19 2016 -0700 Committer: Marvin Humphrey <mar...@rectangular.com> Committed: Wed Apr 6 13:03:09 2016 -0700 ---------------------------------------------------------------------- core/Lucy/Object/I32Array.c | 20 +++++++++++--------- core/Lucy/Object/I32Array.cfh | 16 ++++++++-------- 2 files changed, 19 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/7e31cc69/core/Lucy/Object/I32Array.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Object/I32Array.c b/core/Lucy/Object/I32Array.c index d82448f..4d11727 100644 --- a/core/Lucy/Object/I32Array.c +++ b/core/Lucy/Object/I32Array.c @@ -20,7 +20,7 @@ #include "Lucy/Object/I32Array.h" I32Array* -I32Arr_new(int32_t *ints, uint32_t size) { +I32Arr_new(int32_t *ints, size_t size) { I32Array *self = (I32Array*)Class_Make_Obj(I32ARRAY); int32_t *ints_copy = (int32_t*)MALLOCATE(size * sizeof(int32_t)); memcpy(ints_copy, ints, size * sizeof(int32_t)); @@ -28,20 +28,20 @@ I32Arr_new(int32_t *ints, uint32_t size) { } I32Array* -I32Arr_new_blank(uint32_t size) { +I32Arr_new_blank(size_t size) { I32Array *self = (I32Array*)Class_Make_Obj(I32ARRAY); int32_t *ints = (int32_t*)CALLOCATE(size, sizeof(int32_t)); return I32Arr_init(self, ints, size); } I32Array* -I32Arr_new_steal(int32_t *ints, uint32_t size) { +I32Arr_new_steal(int32_t *ints, size_t size) { I32Array *self = (I32Array*)Class_Make_Obj(I32ARRAY); return I32Arr_init(self, ints, size); } I32Array* -I32Arr_init(I32Array *self, int32_t *ints, uint32_t size) { +I32Arr_init(I32Array *self, int32_t *ints, size_t size) { I32ArrayIVARS *const ivars = I32Arr_IVARS(self); ivars->ints = ints; ivars->size = size; @@ -56,24 +56,26 @@ I32Arr_Destroy_IMP(I32Array *self) { } void -I32Arr_Set_IMP(I32Array *self, uint32_t tick, int32_t value) { +I32Arr_Set_IMP(I32Array *self, size_t tick, int32_t value) { I32ArrayIVARS *const ivars = I32Arr_IVARS(self); if (tick >= ivars->size) { - THROW(ERR, "Out of bounds: %u32 >= %u32", tick, ivars->size); + THROW(ERR, "Out of bounds: %u64 >= %u64", (uint64_t)tick, + (uint64_t)ivars->size); } ivars->ints[tick] = value; } int32_t -I32Arr_Get_IMP(I32Array *self, uint32_t tick) { +I32Arr_Get_IMP(I32Array *self, size_t tick) { I32ArrayIVARS *const ivars = I32Arr_IVARS(self); if (tick >= ivars->size) { - THROW(ERR, "Out of bounds: %u32 >= %u32", tick, ivars->size); + THROW(ERR, "Out of bounds: %u64 >= %u64", (uint64_t)tick, + (uint64_t)ivars->size); } return ivars->ints[tick]; } -uint32_t +size_t I32Arr_Get_Size_IMP(I32Array *self) { return I32Arr_IVARS(self)->size; } http://git-wip-us.apache.org/repos/asf/lucy/blob/7e31cc69/core/Lucy/Object/I32Array.cfh ---------------------------------------------------------------------- diff --git a/core/Lucy/Object/I32Array.cfh b/core/Lucy/Object/I32Array.cfh index 84f436d..9ba0918 100644 --- a/core/Lucy/Object/I32Array.cfh +++ b/core/Lucy/Object/I32Array.cfh @@ -18,35 +18,35 @@ parcel Lucy; public class Lucy::Object::I32Array nickname I32Arr inherits Clownfish::Obj { int32_t *ints; - uint32_t size; + size_t size; public inert incremented I32Array* - new(int32_t *ints, uint32_t size); + new(int32_t *ints, size_t size); inert incremented I32Array* - new_steal(int32_t *ints, uint32_t size); + new_steal(int32_t *ints, size_t size); public inert incremented I32Array* - new_blank(uint32_t size); + new_blank(size_t size); public inert I32Array* - init(I32Array *self, int32_t *ints, uint32_t size); + init(I32Array *self, int32_t *ints, size_t size); /** Set the value at `tick`, or throw an error if * `tick` is out of bounds. */ public void - Set(I32Array *self, uint32_t tick, int32_t value); + Set(I32Array *self, size_t tick, int32_t value); /** Return the value at `tick`, or throw an error if * `tick` is out of bounds. */ public int32_t - Get(I32Array *self, uint32_t tick); + Get(I32Array *self, size_t tick); /** Accessor for 'size' member. */ - public uint32_t + public size_t Get_Size(I32Array *self); public void