Use U32_MAX instead of UINT32_MAX We should switch to the stdint.h constants later, and let Charmonizer define them if stdint.h is not available.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/7e7bd8fd Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/7e7bd8fd Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/7e7bd8fd Branch: refs/heads/msvc6 Commit: 7e7bd8fdb31723629be2fbe5a0d22327073db278 Parents: 89fb1c4 Author: Nick Wellnhofer <[email protected]> Authored: Sun Nov 4 15:01:06 2012 +0100 Committer: Nick Wellnhofer <[email protected]> Committed: Sun Nov 4 15:01:06 2012 +0100 ---------------------------------------------------------------------- clownfish/runtime/core/Clownfish/Test/TestVArray.c | 2 +- clownfish/runtime/core/Clownfish/VArray.c | 2 +- core/Clownfish/VArray.c | 2 +- core/Lucy/Test/Object/TestVArray.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/7e7bd8fd/clownfish/runtime/core/Clownfish/Test/TestVArray.c ---------------------------------------------------------------------- diff --git a/clownfish/runtime/core/Clownfish/Test/TestVArray.c b/clownfish/runtime/core/Clownfish/Test/TestVArray.c index 5d6a69d..a595b6b 100644 --- a/clownfish/runtime/core/Clownfish/Test/TestVArray.c +++ b/clownfish/runtime/core/Clownfish/Test/TestVArray.c @@ -259,7 +259,7 @@ test_Slice(TestBatch *batch) { { VArray *wanted = VA_new(0); VA_Push(wanted, (Obj*)CB_newf("9")); - VArray *slice = VA_Slice(array, 9, UINT32_MAX - 1); + VArray *slice = VA_Slice(array, 9, U32_MAX - 1); TEST_TRUE(batch, VA_Get_Size(slice) == 1, "guard against overflow"); DECREF(slice); DECREF(wanted); http://git-wip-us.apache.org/repos/asf/lucy/blob/7e7bd8fd/clownfish/runtime/core/Clownfish/VArray.c ---------------------------------------------------------------------- diff --git a/clownfish/runtime/core/Clownfish/VArray.c b/clownfish/runtime/core/Clownfish/VArray.c index fd4b6f7..50b10ff 100644 --- a/clownfish/runtime/core/Clownfish/VArray.c +++ b/clownfish/runtime/core/Clownfish/VArray.c @@ -316,7 +316,7 @@ VA_slice(VArray *self, uint32_t offset, uint32_t length) { offset = 0; length = 0; } - else if (length > UINT32_MAX - offset + else if (length > U32_MAX - offset || offset + length > self->size ) { length = self->size - offset; http://git-wip-us.apache.org/repos/asf/lucy/blob/7e7bd8fd/core/Clownfish/VArray.c ---------------------------------------------------------------------- diff --git a/core/Clownfish/VArray.c b/core/Clownfish/VArray.c index cb13779..dea731f 100644 --- a/core/Clownfish/VArray.c +++ b/core/Clownfish/VArray.c @@ -350,7 +350,7 @@ VA_slice(VArray *self, uint32_t offset, uint32_t length) { offset = 0; length = 0; } - else if (length > UINT32_MAX - offset + else if (length > U32_MAX - offset || offset + length > self->size ) { length = self->size - offset; http://git-wip-us.apache.org/repos/asf/lucy/blob/7e7bd8fd/core/Lucy/Test/Object/TestVArray.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Test/Object/TestVArray.c b/core/Lucy/Test/Object/TestVArray.c index 5e2c8ef..d0a1b07 100644 --- a/core/Lucy/Test/Object/TestVArray.c +++ b/core/Lucy/Test/Object/TestVArray.c @@ -252,7 +252,7 @@ test_Slice(TestBatch *batch) { { VArray *wanted = VA_new(0); VA_Push(wanted, (Obj*)CB_newf("9")); - VArray *slice = VA_Slice(array, 9, UINT32_MAX - 1); + VArray *slice = VA_Slice(array, 9, U32_MAX - 1); TEST_TRUE(batch, VA_Get_Size(slice) == 1, "guard against overflow"); DECREF(slice); DECREF(wanted);
