Permalink
Browse files

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.
  • Loading branch information...
1 parent 018f7b2 commit 846c7cc8ddc1b7a3c3812fab61d9a44f20ea010e @nwellnhof nwellnhof committed Nov 4, 2012
@@ -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);
@@ -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;
View
@@ -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;
@@ -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);

0 comments on commit 846c7cc

Please sign in to comment.