You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2012/11/18 19:46:19 UTC
[lucy-commits] [18/23] git commit: refs/heads/c99-types - Use integer min/max
defines from stdint.h
Use integer min/max defines from stdint.h
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/2c25c38a
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/2c25c38a
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/2c25c38a
Branch: refs/heads/c99-types
Commit: 2c25c38a8f663dbd44d243eff60e176330a44b35
Parents: bf3e3cf
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Nov 17 23:04:58 2012 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sun Nov 18 16:36:31 2012 +0100
----------------------------------------------------------------------
charmonizer/src/Charmonizer/Test/TestIntegers.c | 32 ++++------
clownfish/runtime/core/Clownfish/Hash.c | 2 +-
.../runtime/core/Clownfish/Test/TestCharBuf.c | 2 +-
clownfish/runtime/core/Clownfish/Test/TestNum.c | 28 +++++-----
clownfish/runtime/core/Clownfish/Test/TestUtils.c | 2 +-
clownfish/runtime/core/Clownfish/Test/TestVArray.c | 2 +-
.../core/Clownfish/Test/Util/TestNumberUtils.c | 22 ++++----
.../core/Clownfish/Test/Util/TestStringHelper.c | 4 +-
clownfish/runtime/core/Clownfish/Util/SortUtils.c | 8 +-
clownfish/runtime/core/Clownfish/VArray.c | 2 +-
clownfish/runtime/perl/xs/XSBind.c | 2 +-
core/Clownfish/Hash.c | 2 +-
core/Clownfish/Util/SortUtils.c | 8 +-
core/Clownfish/VArray.c | 2 +-
core/Lucy/Highlight/HeatMap.c | 2 +-
core/Lucy/Highlight/Highlighter.c | 2 +-
core/Lucy/Index/BackgroundMerger.c | 6 +-
core/Lucy/Index/DeletionsWriter.c | 2 +-
core/Lucy/Index/Indexer.c | 4 +-
core/Lucy/Index/PostingPool.c | 4 +-
core/Lucy/Search/Collector/SortCollector.c | 10 ++--
core/Lucy/Search/Matcher.c | 6 +-
core/Lucy/Search/RangeQuery.c | 2 +-
core/Lucy/Search/SeriesMatcher.c | 2 +-
core/Lucy/Store/FSFileHandle.c | 2 +-
core/Lucy/Store/RAMFileHandle.c | 4 +-
core/Lucy/Test/Object/TestCharBuf.c | 2 +-
core/Lucy/Test/Object/TestI32Array.c | 2 +-
core/Lucy/Test/Object/TestNum.c | 28 +++++-----
core/Lucy/Test/Object/TestVArray.c | 2 +-
core/Lucy/Test/Search/TestSortSpec.c | 4 +-
core/Lucy/Test/Store/TestIOPrimitives.c | 44 +++++++-------
core/Lucy/Test/TestUtils.c | 2 +-
core/Lucy/Test/Util/TestNumberUtils.c | 22 ++++----
core/Lucy/Test/Util/TestStringHelper.c | 4 +-
core/Lucy/Util/PriorityQueue.c | 2 +-
core/Lucy/Util/SortExternal.c | 2 +-
37 files changed, 136 insertions(+), 142 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/charmonizer/src/Charmonizer/Test/TestIntegers.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Test/TestIntegers.c b/charmonizer/src/Charmonizer/Test/TestIntegers.c
index cad16f2..14949c0 100644
--- a/charmonizer/src/Charmonizer/Test/TestIntegers.c
+++ b/charmonizer/src/Charmonizer/Test/TestIntegers.c
@@ -20,9 +20,6 @@
#include "charmony.h"
#include <stdio.h>
#include <string.h>
-#ifdef HAS_INTTYPES_H
- #include <inttypes.h>
-#endif
static void
S_run_tests(TestBatch *batch) {
@@ -53,12 +50,6 @@ S_run_tests(TestBatch *batch) {
SKIP("No 'long long' type");
#endif
-#ifdef HAS_INTTYPES_H
- LONG_EQ(sizeof(int8_t), 1, "HAS_INTTYPES_H");
-#else
- SKIP("No inttypes.h");
-#endif
-
{
bool_t the_truth = true;
OK(the_truth, "bool_t true");
@@ -72,9 +63,9 @@ S_run_tests(TestBatch *batch) {
LONG_EQ(bar, 200, "uint8_t is unsigned");
LONG_EQ(sizeof(int8_t), 1, "i8_t is 1 byte");
LONG_EQ(sizeof(uint8_t), 1, "u8_t is 1 byte");
- LONG_EQ(I8_MAX, 127, "I8_MAX");
- LONG_EQ(I8_MIN, -128, "I8_MIN");
- LONG_EQ(U8_MAX, 255, "U8_MAX");
+ LONG_EQ(INT8_MAX, 127, "INT8_MAX");
+ LONG_EQ(INT8_MIN, -128, "INT8_MIN");
+ LONG_EQ(UINT8_MAX, 255, "UINT8_MAX");
}
#endif
#ifdef HAS_I16_T
@@ -85,9 +76,9 @@ S_run_tests(TestBatch *batch) {
LONG_EQ(bar, 30000, "uint16_t is unsigned");
LONG_EQ(sizeof(int16_t), 2, "int16_t is 2 bytes");
LONG_EQ(sizeof(uint16_t), 2, "uint16_t is 2 bytes");
- LONG_EQ(I16_MAX, 32767, "I16_MAX");
- LONG_EQ(I16_MIN, -32768, "I16_MIN");
- LONG_EQ(U16_MAX, 65535, "U16_MAX");
+ LONG_EQ(INT16_MAX, 32767, "INT16_MAX");
+ LONG_EQ(INT16_MIN, -32768, "INT16_MIN");
+ LONG_EQ(UINT16_MAX, 65535, "UINT16_MAX");
}
#endif
#ifdef HAS_I32_T
@@ -98,10 +89,10 @@ S_run_tests(TestBatch *batch) {
OK((bar == 4000000000UL), "uint32_t is unsigned");
OK((sizeof(int32_t) == 4), "int32_t is 4 bytes");
OK((sizeof(uint32_t) == 4), "uint32_t is 4 bytes");
- OK((I32_MAX == I32_C(2147483647)), "I32_MAX");
+ OK((INT32_MAX == I32_C(2147483647)), "INT32_MAX");
/* The (-2147483647 - 1) avoids a compiler warning. */
- OK((I32_MIN == I32_C(-2147483647 - 1)), "I32_MIN");
- OK((U32_MAX == U32_C(4294967295)), "U32_MAX");
+ OK((INT32_MIN == I32_C(-2147483647 - 1)), "INT32_MIN");
+ OK((UINT32_MAX == U32_C(4294967295)), "UINT32_MAX");
}
#endif
#ifdef HAS_I64_T
@@ -113,6 +104,9 @@ S_run_tests(TestBatch *batch) {
OK((bar == U64_C(18000000000000000000)), "uint64_t is unsigned");
OK((sizeof(int64_t) == 8), "int64_t is 8 bytes");
OK((sizeof(uint64_t) == 8), "uint64_t is 8 bytes");
+ OK((INT64_MAX == I64_C(0x7FFFFFFFFFFFFFFF)), "INT64_MAX");
+ OK((INT64_MIN == -I64_C(0x7FFFFFFFFFFFFFFF) - 1), "INT64_MIN");
+ OK((UINT64_MAX == U64_C(0xFFFFFFFFFFFFFFFF)), "UINT64_MAX");
sprintf(buf, "%"I64P, foo);
STR_EQ(buf, "-100", "I64P");
sprintf(buf, "%"U64P, bar);
@@ -122,7 +116,7 @@ S_run_tests(TestBatch *batch) {
}
int main(int argc, char **argv) {
- TestBatch *batch = Test_start(37);
+ TestBatch *batch = Test_start(39);
S_run_tests(batch);
return !Test_finish();
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/clownfish/runtime/core/Clownfish/Hash.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Hash.c b/clownfish/runtime/core/Clownfish/Hash.c
index 3b73553..1a29783 100644
--- a/clownfish/runtime/core/Clownfish/Hash.c
+++ b/clownfish/runtime/core/Clownfish/Hash.c
@@ -67,7 +67,7 @@ Hash*
Hash_init(Hash *self, uint32_t capacity) {
// Allocate enough space to hold the requested number of elements without
// triggering a rebuild.
- uint32_t requested_capacity = capacity < I32_MAX ? capacity : I32_MAX;
+ uint32_t requested_capacity = capacity < INT32_MAX ? capacity : INT32_MAX;
uint32_t threshold;
capacity = 16;
while (1) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/clownfish/runtime/core/Clownfish/Test/TestCharBuf.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestCharBuf.c b/clownfish/runtime/core/Clownfish/Test/TestCharBuf.c
index f3c9942..f478772 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestCharBuf.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestCharBuf.c
@@ -372,7 +372,7 @@ static void
test_vcatf_x32(TestBatch *batch) {
CharBuf *wanted;
char buf[64];
- unsigned long num = I32_MAX;
+ unsigned long num = INT32_MAX;
CharBuf *got = S_get_cb("foo ");
#if (SIZEOF_LONG == 4)
sprintf(buf, "foo bar %.8lx baz", num);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/clownfish/runtime/core/Clownfish/Test/TestNum.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestNum.c b/clownfish/runtime/core/Clownfish/Test/TestNum.c
index f1aa870..3d85523 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestNum.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestNum.c
@@ -29,8 +29,8 @@ static void
test_To_String(TestBatch *batch) {
Float32 *f32 = Float32_new(1.33f);
Float64 *f64 = Float64_new(1.33);
- Integer32 *i32 = Int32_new(I32_MAX);
- Integer64 *i64 = Int64_new(I64_MAX);
+ Integer32 *i32 = Int32_new(INT32_MAX);
+ Integer64 *i64 = Int64_new(INT64_MAX);
CharBuf *f32_string = Float32_To_String(f32);
CharBuf *f64_string = Float64_To_String(f64);
CharBuf *i32_string = Int32_To_String(i32);
@@ -94,12 +94,12 @@ test_accessors(TestBatch *batch) {
TEST_TRUE(batch, *(int64_t*)&got64 == *(int64_t*)&wanted64,
"Float64_To_F64");
- Int32_Set_Value(i32, I32_MIN);
- TEST_INT_EQ(batch, Int32_Get_Value(i32), I32_MIN,
+ Int32_Set_Value(i32, INT32_MIN);
+ TEST_INT_EQ(batch, Int32_Get_Value(i32), INT32_MIN,
"I32 Set_Value Get_Value");
- Int64_Set_Value(i64, I64_MIN);
- TEST_TRUE(batch, Int64_Get_Value(i64) == I64_MIN,
+ Int64_Set_Value(i64, INT64_MIN);
+ TEST_TRUE(batch, Int64_Get_Value(i64) == INT64_MIN,
"I64 Set_Value Get_Value");
Int32_Set_Value(i32, -1);
@@ -130,8 +130,8 @@ static void
test_Equals_and_Compare_To(TestBatch *batch) {
Float32 *f32 = Float32_new(1.0);
Float64 *f64 = Float64_new(1.0);
- Integer32 *i32 = Int32_new(I32_MAX);
- Integer64 *i64 = Int64_new(I64_MAX);
+ Integer32 *i32 = Int32_new(INT32_MAX);
+ Integer64 *i64 = Int64_new(INT64_MAX);
TEST_TRUE(batch, Float32_Compare_To(f32, (Obj*)f64) == 0,
"F32_Compare_To equal");
@@ -169,13 +169,13 @@ test_Equals_and_Compare_To(TestBatch *batch) {
TEST_FALSE(batch, Float64_Equals(f64, (Obj*)f32),
"F64_Equals greater than");
- Float64_Set_Value(f64, I64_MAX * 2.0);
+ Float64_Set_Value(f64, INT64_MAX * 2.0);
TEST_TRUE(batch, Float64_Compare_To(f64, (Obj*)i64) > 0,
"Float64 comparison to Integer64");
TEST_TRUE(batch, Int64_Compare_To(i64, (Obj*)f64) < 0,
"Integer64 comparison to Float64");
- Float32_Set_Value(f32, I32_MAX * 2.0f);
+ Float32_Set_Value(f32, INT32_MAX * 2.0f);
TEST_TRUE(batch, Float32_Compare_To(f32, (Obj*)i32) > 0,
"Float32 comparison to Integer32");
TEST_TRUE(batch, Int32_Compare_To(i32, (Obj*)f32) < 0,
@@ -208,8 +208,8 @@ static void
test_Clone(TestBatch *batch) {
Float32 *f32 = Float32_new(1.33f);
Float64 *f64 = Float64_new(1.33);
- Integer32 *i32 = Int32_new(I32_MAX);
- Integer64 *i64 = Int64_new(I64_MAX);
+ Integer32 *i32 = Int32_new(INT32_MAX);
+ Integer64 *i64 = Int64_new(INT64_MAX);
Float32 *f32_dupe = Float32_Clone(f32);
Float64 *f64_dupe = Float64_Clone(f64);
Integer32 *i32_dupe = Int32_Clone(i32);
@@ -238,8 +238,8 @@ static void
test_Mimic(TestBatch *batch) {
Float32 *f32 = Float32_new(1.33f);
Float64 *f64 = Float64_new(1.33);
- Integer32 *i32 = Int32_new(I32_MAX);
- Integer64 *i64 = Int64_new(I64_MAX);
+ Integer32 *i32 = Int32_new(INT32_MAX);
+ Integer64 *i64 = Int64_new(INT64_MAX);
Float32 *f32_dupe = Float32_new(0.0f);
Float64 *f64_dupe = Float64_new(0.0);
Integer32 *i32_dupe = Int32_new(0);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/clownfish/runtime/core/Clownfish/Test/TestUtils.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestUtils.c b/clownfish/runtime/core/Clownfish/Test/TestUtils.c
index 9dbb5c6..4a39702 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestUtils.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestUtils.c
@@ -63,7 +63,7 @@ TestUtils_random_f64s(double *buf, size_t count) {
double *f64s = buf ? buf : (double*)CALLOCATE(count, sizeof(double));
for (size_t i = 0; i < count; i++) {
uint64_t num = TestUtils_random_u64();
- f64s[i] = (double)num / U64_MAX;
+ f64s[i] = (double)num / UINT64_MAX;
}
return f64s;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/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 a595b6b..5d6a69d 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, U32_MAX - 1);
+ VArray *slice = VA_Slice(array, 9, UINT32_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/2c25c38a/clownfish/runtime/core/Clownfish/Test/Util/TestNumberUtils.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/Util/TestNumberUtils.c b/clownfish/runtime/core/Clownfish/Test/Util/TestNumberUtils.c
index c0c928c..eba8fdc 100644
--- a/clownfish/runtime/core/Clownfish/Test/Util/TestNumberUtils.c
+++ b/clownfish/runtime/core/Clownfish/Test/Util/TestNumberUtils.c
@@ -89,8 +89,8 @@ test_u4(TestBatch *batch) {
static void
test_c32(TestBatch *batch) {
- uint64_t mins[] = { 0, 0x4000 - 100, (uint32_t)I32_MAX - 100, U32_MAX - 10 };
- uint64_t limits[] = { 500, 0x4000 + 100, (uint32_t)I32_MAX + 100, U32_MAX };
+ uint64_t mins[] = { 0, 0x4000 - 100, (uint32_t)INT32_MAX - 100, UINT32_MAX - 10 };
+ uint64_t limits[] = { 500, 0x4000 + 100, (uint32_t)INT32_MAX + 100, UINT32_MAX };
uint32_t set_num;
uint32_t num_sets = sizeof(mins) / sizeof(uint64_t);
size_t count = 64;
@@ -139,9 +139,9 @@ test_c32(TestBatch *batch) {
}
target = encoded;
- NumUtil_encode_c32(U32_MAX, &target);
+ NumUtil_encode_c32(UINT32_MAX, &target);
target = encoded;
- TEST_INT_EQ(batch, NumUtil_decode_c32(&target), U32_MAX, "c32 U32_MAX");
+ TEST_INT_EQ(batch, NumUtil_decode_c32(&target), UINT32_MAX, "c32 UINT32_MAX");
FREEMEM(encoded);
FREEMEM(ints);
@@ -149,8 +149,8 @@ test_c32(TestBatch *batch) {
static void
test_c64(TestBatch *batch) {
- uint64_t mins[] = { 0, 0x4000 - 100, (uint64_t)U32_MAX - 100, U64_MAX - 10 };
- uint64_t limits[] = { 500, 0x4000 + 100, (uint64_t)U32_MAX + 1000, U64_MAX };
+ uint64_t mins[] = { 0, 0x4000 - 100, (uint64_t)UINT32_MAX - 100, UINT64_MAX - 10 };
+ uint64_t limits[] = { 500, 0x4000 + 100, (uint64_t)UINT32_MAX + 1000, UINT64_MAX };
uint32_t set_num;
uint32_t num_sets = sizeof(mins) / sizeof(uint64_t);
size_t count = 64;
@@ -182,11 +182,11 @@ test_c64(TestBatch *batch) {
}
target = encoded;
- NumUtil_encode_c64(U64_MAX, &target);
+ NumUtil_encode_c64(UINT64_MAX, &target);
target = encoded;
uint64_t got = NumUtil_decode_c64(&target);
- TEST_TRUE(batch, got == U64_MAX, "c64 U64_MAX");
+ TEST_TRUE(batch, got == UINT64_MAX, "c64 UINT64_MAX");
FREEMEM(encoded);
FREEMEM(ints);
@@ -195,7 +195,7 @@ test_c64(TestBatch *batch) {
static void
test_bigend_u16(TestBatch *batch) {
size_t count = 32;
- uint64_t *ints = TestUtils_random_u64s(NULL, count, 0, U16_MAX + 1);
+ uint64_t *ints = TestUtils_random_u64s(NULL, count, 0, UINT16_MAX + 1);
size_t amount = (count + 1) * sizeof(uint16_t);
char *allocated = (char*)CALLOCATE(amount, sizeof(char));
char *encoded = allocated + 1; // Intentionally misaligned.
@@ -224,7 +224,7 @@ test_bigend_u16(TestBatch *batch) {
static void
test_bigend_u32(TestBatch *batch) {
size_t count = 32;
- uint64_t *ints = TestUtils_random_u64s(NULL, count, 0, U64_C(1) + U32_MAX);
+ uint64_t *ints = TestUtils_random_u64s(NULL, count, 0, U64_C(1) + UINT32_MAX);
size_t amount = (count + 1) * sizeof(uint32_t);
char *allocated = (char*)CALLOCATE(amount, sizeof(char));
char *encoded = allocated + 1; // Intentionally misaligned.
@@ -253,7 +253,7 @@ test_bigend_u32(TestBatch *batch) {
static void
test_bigend_u64(TestBatch *batch) {
size_t count = 32;
- uint64_t *ints = TestUtils_random_u64s(NULL, count, 0, U64_MAX);
+ uint64_t *ints = TestUtils_random_u64s(NULL, count, 0, UINT64_MAX);
size_t amount = (count + 1) * sizeof(uint64_t);
char *allocated = (char*)CALLOCATE(amount, sizeof(char));
char *encoded = allocated + 1; // Intentionally misaligned.
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c b/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c
index 5004712..68d58fa 100644
--- a/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c
+++ b/clownfish/runtime/core/Clownfish/Test/Util/TestStringHelper.c
@@ -136,8 +136,8 @@ test_overlap(TestBatch *batch) {
static void
test_to_base36(TestBatch *batch) {
char buffer[StrHelp_MAX_BASE36_BYTES];
- StrHelp_to_base36(U64_MAX, buffer);
- TEST_STR_EQ(batch, "3w5e11264sgsf", buffer, "base36 U64_MAX");
+ StrHelp_to_base36(UINT64_MAX, buffer);
+ TEST_STR_EQ(batch, "3w5e11264sgsf", buffer, "base36 UINT64_MAX");
StrHelp_to_base36(1, buffer);
TEST_STR_EQ(batch, "1", buffer, "base36 1");
TEST_INT_EQ(batch, buffer[1], 0, "base36 NULL termination");
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/clownfish/runtime/core/Clownfish/Util/SortUtils.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Util/SortUtils.c b/clownfish/runtime/core/Clownfish/Util/SortUtils.c
index 71539cb..3b17077 100644
--- a/clownfish/runtime/core/Clownfish/Util/SortUtils.c
+++ b/clownfish/runtime/core/Clownfish/Util/SortUtils.c
@@ -53,9 +53,9 @@ Sort_mergesort(void *elems, void *scratch, uint32_t num_elems, uint32_t width,
if (num_elems < 2) { return; }
// Validate.
- if (num_elems >= I32_MAX) {
+ if (num_elems >= INT32_MAX) {
THROW(ERR, "Provided %u64 elems, but can't handle more than %i32",
- (uint64_t)num_elems, I32_MAX);
+ (uint64_t)num_elems, INT32_MAX);
}
// Dispatch by element size.
@@ -233,9 +233,9 @@ Sort_quicksort(void *elems, size_t num_elems, size_t width,
if (num_elems < 2) { return; }
// Validate.
- if (num_elems >= I32_MAX) {
+ if (num_elems >= INT32_MAX) {
THROW(ERR, "Provided %u64 elems, but can't handle more than %i32",
- (uint64_t)num_elems, I32_MAX);
+ (uint64_t)num_elems, INT32_MAX);
}
if (width == 4) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/clownfish/runtime/core/Clownfish/VArray.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/VArray.c b/clownfish/runtime/core/Clownfish/VArray.c
index 50b10ff..fd4b6f7 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 > U32_MAX - offset
+ else if (length > UINT32_MAX - offset
|| offset + length > self->size
) {
length = self->size - offset;
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/clownfish/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.c b/clownfish/runtime/perl/xs/XSBind.c
index bfa24a5..b2e032b 100644
--- a/clownfish/runtime/perl/xs/XSBind.c
+++ b/clownfish/runtime/perl/xs/XSBind.c
@@ -645,7 +645,7 @@ lucy_Obj_inc_refcount(lucy_Obj *self) {
uint32_t
lucy_Obj_dec_refcount(lucy_Obj *self) {
- uint32_t modified_refcount = I32_MAX;
+ uint32_t modified_refcount = INT32_MAX;
switch (self->ref.count) {
case 0:
CFISH_THROW(LUCY_ERR, "Illegal refcount of 0");
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Clownfish/Hash.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Hash.c b/core/Clownfish/Hash.c
index 2f71e5f..2e56985 100644
--- a/core/Clownfish/Hash.c
+++ b/core/Clownfish/Hash.c
@@ -70,7 +70,7 @@ Hash*
Hash_init(Hash *self, uint32_t capacity) {
// Allocate enough space to hold the requested number of elements without
// triggering a rebuild.
- uint32_t requested_capacity = capacity < I32_MAX ? capacity : I32_MAX;
+ uint32_t requested_capacity = capacity < INT32_MAX ? capacity : INT32_MAX;
uint32_t threshold;
capacity = 16;
while (1) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Clownfish/Util/SortUtils.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/Util/SortUtils.c b/core/Clownfish/Util/SortUtils.c
index 71539cb..3b17077 100644
--- a/core/Clownfish/Util/SortUtils.c
+++ b/core/Clownfish/Util/SortUtils.c
@@ -53,9 +53,9 @@ Sort_mergesort(void *elems, void *scratch, uint32_t num_elems, uint32_t width,
if (num_elems < 2) { return; }
// Validate.
- if (num_elems >= I32_MAX) {
+ if (num_elems >= INT32_MAX) {
THROW(ERR, "Provided %u64 elems, but can't handle more than %i32",
- (uint64_t)num_elems, I32_MAX);
+ (uint64_t)num_elems, INT32_MAX);
}
// Dispatch by element size.
@@ -233,9 +233,9 @@ Sort_quicksort(void *elems, size_t num_elems, size_t width,
if (num_elems < 2) { return; }
// Validate.
- if (num_elems >= I32_MAX) {
+ if (num_elems >= INT32_MAX) {
THROW(ERR, "Provided %u64 elems, but can't handle more than %i32",
- (uint64_t)num_elems, I32_MAX);
+ (uint64_t)num_elems, INT32_MAX);
}
if (width == 4) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Clownfish/VArray.c
----------------------------------------------------------------------
diff --git a/core/Clownfish/VArray.c b/core/Clownfish/VArray.c
index dea731f..cb13779 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 > U32_MAX - offset
+ else if (length > UINT32_MAX - offset
|| offset + length > self->size
) {
length = self->size - offset;
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Highlight/HeatMap.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Highlight/HeatMap.c b/core/Lucy/Highlight/HeatMap.c
index 2e8ab20..164ca9f 100644
--- a/core/Lucy/Highlight/HeatMap.c
+++ b/core/Lucy/Highlight/HeatMap.c
@@ -76,7 +76,7 @@ S_flattened_but_empty_spans(VArray *spans) {
Sort_quicksort(bounds, num_spans * 2, sizeof(uint32_t),
S_compare_i32, NULL);
uint32_t num_bounds = 0;
- int32_t last = I32_MAX;
+ int32_t last = INT32_MAX;
for (uint32_t i = 0; i < num_spans * 2; i++) {
if (bounds[i] != last) {
bounds[num_bounds++] = bounds[i];
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Highlight/Highlighter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Highlight/Highlighter.c b/core/Lucy/Highlight/Highlighter.c
index 18912cd..89d5b7f 100644
--- a/core/Lucy/Highlight/Highlighter.c
+++ b/core/Lucy/Highlight/Highlighter.c
@@ -590,7 +590,7 @@ Highlighter_find_sentences(Highlighter *self, CharBuf *text, int32_t offset,
Span *sentence = NULL;
VArray *sentences = VA_new(10);
int32_t stop = length == 0
- ? I32_MAX
+ ? INT32_MAX
: offset + length;
ZombieCharBuf *fragment = ZCB_WRAP(text);
int32_t pos = ZCB_Trim_Top(fragment);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Index/BackgroundMerger.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/BackgroundMerger.c b/core/Lucy/Index/BackgroundMerger.c
index 5ea6e02..538099b 100644
--- a/core/Lucy/Index/BackgroundMerger.c
+++ b/core/Lucy/Index/BackgroundMerger.c
@@ -309,8 +309,8 @@ S_merge_updated_deletions(BackgroundMerger *self) {
new_segment, merge_polyreader);
DeletionsWriter *del_writer = SegWriter_Get_Del_Writer(seg_writer);
int64_t merge_seg_num = Seg_Get_Number(self->segment);
- uint32_t seg_tick = I32_MAX;
- int32_t offset = I32_MAX;
+ uint32_t seg_tick = INT32_MAX;
+ int32_t offset = INT32_MAX;
CharBuf *seg_name = NULL;
Matcher *deletions = NULL;
@@ -326,7 +326,7 @@ S_merge_updated_deletions(BackgroundMerger *self) {
DECREF(offsets);
}
}
- if (offset == I32_MAX) { THROW(ERR, "Failed sanity check"); }
+ if (offset == INT32_MAX) { THROW(ERR, "Failed sanity check"); }
Hash_Iterate(updated_deletions);
while (Hash_Next(updated_deletions,
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Index/DeletionsWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/DeletionsWriter.c b/core/Lucy/Index/DeletionsWriter.c
index a9647bf..cd661cc 100644
--- a/core/Lucy/Index/DeletionsWriter.c
+++ b/core/Lucy/Index/DeletionsWriter.c
@@ -50,7 +50,7 @@ I32Array*
DelWriter_generate_doc_map(DeletionsWriter *self, Matcher *deletions,
int32_t doc_max, int32_t offset) {
int32_t *doc_map = (int32_t*)CALLOCATE(doc_max + 1, sizeof(int32_t));
- int32_t next_deletion = deletions ? Matcher_Next(deletions) : I32_MAX;
+ int32_t next_deletion = deletions ? Matcher_Next(deletions) : INT32_MAX;
UNUSED_VAR(self);
// 0 for a deleted doc, a new number otherwise
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Index/Indexer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Indexer.c b/core/Lucy/Index/Indexer.c
index 7c59914..c13854e 100644
--- a/core/Lucy/Index/Indexer.c
+++ b/core/Lucy/Index/Indexer.c
@@ -405,12 +405,12 @@ S_maybe_merge(Indexer *self, VArray *seg_readers) {
cutoff = Obj_To_I64(cutoff_obj);
}
else {
- cutoff = I64_MAX;
+ cutoff = INT64_MAX;
}
DECREF(merge_data);
}
else {
- cutoff = I64_MAX;
+ cutoff = INT64_MAX;
}
DECREF(merge_lock);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Index/PostingPool.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PostingPool.c b/core/Lucy/Index/PostingPool.c
index 36eab78..140c51a 100644
--- a/core/Lucy/Index/PostingPool.c
+++ b/core/Lucy/Index/PostingPool.c
@@ -84,8 +84,8 @@ PostPool_init(PostingPool *self, Schema *schema, Snapshot *snapshot,
self->plist = NULL;
self->lex_temp_in = NULL;
self->post_temp_in = NULL;
- self->lex_start = I64_MAX;
- self->post_start = I64_MAX;
+ self->lex_start = INT64_MAX;
+ self->post_start = INT64_MAX;
self->lex_end = 0;
self->post_end = 0;
self->skip_stepper = SkipStepper_new();
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Search/Collector/SortCollector.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Collector/SortCollector.c b/core/Lucy/Search/Collector/SortCollector.c
index f1bd2d8..01bb21b 100644
--- a/core/Lucy/Search/Collector/SortCollector.c
+++ b/core/Lucy/Search/Collector/SortCollector.c
@@ -99,7 +99,7 @@ SortColl_init(SortCollector *self, Schema *schema, SortSpec *sort_spec,
// Init.
Coll_init((Collector*)self);
self->total_hits = 0;
- self->bubble_doc = I32_MAX;
+ self->bubble_doc = INT32_MAX;
self->bubble_score = F32_NEGINF;
self->seg_doc_max = 0;
@@ -155,7 +155,7 @@ SortColl_init(SortCollector *self, Schema *schema, SortSpec *sort_spec,
// Prepare a MatchDoc-in-waiting.
VArray *values = self->need_values ? VA_new(num_rules) : NULL;
float score = self->need_score ? F32_NEGINF : F32_NAN;
- self->bumped = MatchDoc_new(I32_MAX, score, values);
+ self->bumped = MatchDoc_new(INT32_MAX, score, values);
DECREF(values);
return self;
@@ -225,8 +225,8 @@ SortColl_set_reader(SortCollector *self, SegReader *reader) {
= (SortReader*)SegReader_Fetch(reader, VTable_Get_Name(SORTREADER));
// Reset threshold variables and trigger auto-action behavior.
- self->bumped->doc_id = I32_MAX;
- self->bubble_doc = I32_MAX;
+ self->bumped->doc_id = INT32_MAX;
+ self->bubble_doc = INT32_MAX;
self->bumped->score = self->need_score ? F32_NEGINF : F32_NAN;
self->bubble_score = self->need_score ? F32_NEGINF : F32_NAN;
self->actions = self->auto_actions;
@@ -320,7 +320,7 @@ SortColl_collect(SortCollector *self, int32_t doc_id) {
? VA_new(self->num_rules)
: NULL;
float fake_score = self->need_score ? F32_NEGINF : F32_NAN;
- self->bumped = MatchDoc_new(I32_MAX, fake_score, values);
+ self->bumped = MatchDoc_new(INT32_MAX, fake_score, values);
DECREF(values);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Search/Matcher.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Matcher.c b/core/Lucy/Search/Matcher.c
index e049ae0..79673a3 100644
--- a/core/Lucy/Search/Matcher.c
+++ b/core/Lucy/Search/Matcher.c
@@ -42,7 +42,7 @@ Matcher_advance(Matcher *self, int32_t target) {
void
Matcher_collect(Matcher *self, Collector *collector, Matcher *deletions) {
int32_t doc_id = 0;
- int32_t next_deletion = deletions ? 0 : I32_MAX;
+ int32_t next_deletion = deletions ? 0 : INT32_MAX;
Coll_Set_Matcher(collector, self);
@@ -50,7 +50,7 @@ Matcher_collect(Matcher *self, Collector *collector, Matcher *deletions) {
while (1) {
if (doc_id > next_deletion) {
next_deletion = Matcher_Advance(deletions, doc_id);
- if (next_deletion == 0) { next_deletion = I32_MAX; }
+ if (next_deletion == 0) { next_deletion = INT32_MAX; }
continue;
}
else if (doc_id == next_deletion) {
@@ -60,7 +60,7 @@ Matcher_collect(Matcher *self, Collector *collector, Matcher *deletions) {
while (doc_id == next_deletion) {
doc_id++;
next_deletion = Matcher_Advance(deletions, doc_id);
- if (next_deletion == 0) { next_deletion = I32_MAX; }
+ if (next_deletion == 0) { next_deletion = INT32_MAX; }
}
// Verify that the artificial advance actually worked.
doc_id = Matcher_Advance(self, doc_id);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Search/RangeQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/RangeQuery.c b/core/Lucy/Search/RangeQuery.c
index e9acd7f..c05ace2 100644
--- a/core/Lucy/Search/RangeQuery.c
+++ b/core/Lucy/Search/RangeQuery.c
@@ -245,7 +245,7 @@ static int32_t
S_find_upper_bound(RangeCompiler *self, SortCache *sort_cache) {
RangeQuery *parent = (RangeQuery*)self->parent;
Obj *upper_term = parent->upper_term;
- int32_t retval = I32_MAX;
+ int32_t retval = INT32_MAX;
if (upper_term) {
int32_t hi_ord = SortCache_Find(sort_cache, upper_term);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Search/SeriesMatcher.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/SeriesMatcher.c b/core/Lucy/Search/SeriesMatcher.c
index bd40a35..b1d7e52 100644
--- a/core/Lucy/Search/SeriesMatcher.c
+++ b/core/Lucy/Search/SeriesMatcher.c
@@ -66,7 +66,7 @@ SeriesMatcher_advance(SeriesMatcher *self, int32_t target) {
while (1) {
uint32_t next_offset
= self->tick + 1 == self->num_matchers
- ? I32_MAX
+ ? INT32_MAX
: I32Arr_Get(self->offsets, self->tick + 1);
self->current_matcher = (Matcher*)VA_Fetch(self->matchers,
self->tick);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Store/FSFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFileHandle.c b/core/Lucy/Store/FSFileHandle.c
index fec7b4a..64f4f4a 100644
--- a/core/Lucy/Store/FSFileHandle.c
+++ b/core/Lucy/Store/FSFileHandle.c
@@ -557,7 +557,7 @@ FSFH_read(FSFileHandle *self, char *dest, int64_t offset, size_t len) {
// ReadFile() takes a DWORD (unsigned 32-bit integer) as a length
// argument, so throw a sensible error rather than wrap around.
- if (len > U32_MAX) {
+ if (len > UINT32_MAX) {
Err_set_error(Err_new(CB_newf("Can't read more than 4 GB (%u64)",
(uint64_t)len)));
return false;
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Store/RAMFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/RAMFileHandle.c b/core/Lucy/Store/RAMFileHandle.c
index 7d48ba7..282d8b0 100644
--- a/core/Lucy/Store/RAMFileHandle.c
+++ b/core/Lucy/Store/RAMFileHandle.c
@@ -144,9 +144,9 @@ RAMFH_write(RAMFileHandle *self, const void *data, size_t len) {
bool_t
RAMFH_grow(RAMFileHandle *self, int64_t len) {
- if (len > I32_MAX) {
+ if (len > INT32_MAX) {
Err_set_error(Err_new(CB_newf("Can't support RAM files of size %i64 (> %i32)",
- len, (int32_t)I32_MAX)));
+ len, (int32_t)INT32_MAX)));
return false;
}
else if (self->ram_file->read_only) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Test/Object/TestCharBuf.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Object/TestCharBuf.c b/core/Lucy/Test/Object/TestCharBuf.c
index a9dba74..d4f6196 100644
--- a/core/Lucy/Test/Object/TestCharBuf.c
+++ b/core/Lucy/Test/Object/TestCharBuf.c
@@ -368,7 +368,7 @@ static void
test_vcatf_x32(TestBatch *batch) {
CharBuf *wanted;
char buf[64];
- unsigned long num = I32_MAX;
+ unsigned long num = INT32_MAX;
CharBuf *got = S_get_cb("foo ");
#if (SIZEOF_LONG == 4)
sprintf(buf, "foo bar %.8lx baz", num);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Test/Object/TestI32Array.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Object/TestI32Array.c b/core/Lucy/Test/Object/TestI32Array.c
index 367d2f3..5dadc29 100644
--- a/core/Lucy/Test/Object/TestI32Array.c
+++ b/core/Lucy/Test/Object/TestI32Array.c
@@ -20,7 +20,7 @@
#include "Lucy/Test.h"
#include "Lucy/Test/Object/TestI32Array.h"
-static int32_t source_ints[] = { -1, 0, I32_MIN, I32_MAX, 1 };
+static int32_t source_ints[] = { -1, 0, INT32_MIN, INT32_MAX, 1 };
static size_t num_ints = sizeof(source_ints) / sizeof(int32_t);
static void
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Test/Object/TestNum.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Object/TestNum.c b/core/Lucy/Test/Object/TestNum.c
index 2abfee5..66583c8 100644
--- a/core/Lucy/Test/Object/TestNum.c
+++ b/core/Lucy/Test/Object/TestNum.c
@@ -25,8 +25,8 @@ static void
test_To_String(TestBatch *batch) {
Float32 *f32 = Float32_new(1.33f);
Float64 *f64 = Float64_new(1.33);
- Integer32 *i32 = Int32_new(I32_MAX);
- Integer64 *i64 = Int64_new(I64_MAX);
+ Integer32 *i32 = Int32_new(INT32_MAX);
+ Integer64 *i64 = Int64_new(INT64_MAX);
CharBuf *f32_string = Float32_To_String(f32);
CharBuf *f64_string = Float64_To_String(f64);
CharBuf *i32_string = Int32_To_String(i32);
@@ -90,12 +90,12 @@ test_accessors(TestBatch *batch) {
TEST_TRUE(batch, *(int64_t*)&got64 == *(int64_t*)&wanted64,
"Float64_To_F64");
- Int32_Set_Value(i32, I32_MIN);
- TEST_INT_EQ(batch, Int32_Get_Value(i32), I32_MIN,
+ Int32_Set_Value(i32, INT32_MIN);
+ TEST_INT_EQ(batch, Int32_Get_Value(i32), INT32_MIN,
"I32 Set_Value Get_Value");
- Int64_Set_Value(i64, I64_MIN);
- TEST_TRUE(batch, Int64_Get_Value(i64) == I64_MIN,
+ Int64_Set_Value(i64, INT64_MIN);
+ TEST_TRUE(batch, Int64_Get_Value(i64) == INT64_MIN,
"I64 Set_Value Get_Value");
Int32_Set_Value(i32, -1);
@@ -126,8 +126,8 @@ static void
test_Equals_and_Compare_To(TestBatch *batch) {
Float32 *f32 = Float32_new(1.0);
Float64 *f64 = Float64_new(1.0);
- Integer32 *i32 = Int32_new(I32_MAX);
- Integer64 *i64 = Int64_new(I64_MAX);
+ Integer32 *i32 = Int32_new(INT32_MAX);
+ Integer64 *i64 = Int64_new(INT64_MAX);
TEST_TRUE(batch, Float32_Compare_To(f32, (Obj*)f64) == 0,
"F32_Compare_To equal");
@@ -165,13 +165,13 @@ test_Equals_and_Compare_To(TestBatch *batch) {
TEST_FALSE(batch, Float64_Equals(f64, (Obj*)f32),
"F64_Equals greater than");
- Float64_Set_Value(f64, I64_MAX * 2.0);
+ Float64_Set_Value(f64, INT64_MAX * 2.0);
TEST_TRUE(batch, Float64_Compare_To(f64, (Obj*)i64) > 0,
"Float64 comparison to Integer64");
TEST_TRUE(batch, Int64_Compare_To(i64, (Obj*)f64) < 0,
"Integer64 comparison to Float64");
- Float32_Set_Value(f32, I32_MAX * 2.0f);
+ Float32_Set_Value(f32, INT32_MAX * 2.0f);
TEST_TRUE(batch, Float32_Compare_To(f32, (Obj*)i32) > 0,
"Float32 comparison to Integer32");
TEST_TRUE(batch, Int32_Compare_To(i32, (Obj*)f32) < 0,
@@ -204,8 +204,8 @@ static void
test_Clone(TestBatch *batch) {
Float32 *f32 = Float32_new(1.33f);
Float64 *f64 = Float64_new(1.33);
- Integer32 *i32 = Int32_new(I32_MAX);
- Integer64 *i64 = Int64_new(I64_MAX);
+ Integer32 *i32 = Int32_new(INT32_MAX);
+ Integer64 *i64 = Int64_new(INT64_MAX);
Float32 *f32_dupe = Float32_Clone(f32);
Float64 *f64_dupe = Float64_Clone(f64);
Integer32 *i32_dupe = Int32_Clone(i32);
@@ -234,8 +234,8 @@ static void
test_Mimic(TestBatch *batch) {
Float32 *f32 = Float32_new(1.33f);
Float64 *f64 = Float64_new(1.33);
- Integer32 *i32 = Int32_new(I32_MAX);
- Integer64 *i64 = Int64_new(I64_MAX);
+ Integer32 *i32 = Int32_new(INT32_MAX);
+ Integer64 *i64 = Int64_new(INT64_MAX);
Float32 *f32_dupe = Float32_new(0.0f);
Float64 *f64_dupe = Float64_new(0.0);
Integer32 *i32_dupe = Int32_new(0);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Test/Object/TestVArray.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Object/TestVArray.c b/core/Lucy/Test/Object/TestVArray.c
index d0a1b07..5e2c8ef 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, U32_MAX - 1);
+ VArray *slice = VA_Slice(array, 9, UINT32_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/2c25c38a/core/Lucy/Test/Search/TestSortSpec.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestSortSpec.c b/core/Lucy/Test/Search/TestSortSpec.c
index 00148fe..b017570 100644
--- a/core/Lucy/Test/Search/TestSortSpec.c
+++ b/core/Lucy/Test/Search/TestSortSpec.c
@@ -288,13 +288,13 @@ S_random_int64() {
static Obj*
S_random_float32() {
uint64_t num = TestUtils_random_u64();
- return (Obj*)Float32_new(U64_TO_DOUBLE(num) * (10.0 / U64_MAX));
+ return (Obj*)Float32_new(U64_TO_DOUBLE(num) * (10.0 / UINT64_MAX));
}
static Obj*
S_random_float64() {
uint64_t num = TestUtils_random_u64();
- return (Obj*)Float64_new(U64_TO_DOUBLE(num) * (10.0 / U64_MAX));
+ return (Obj*)Float64_new(U64_TO_DOUBLE(num) * (10.0 / UINT64_MAX));
}
static VArray*
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Test/Store/TestIOPrimitives.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestIOPrimitives.c b/core/Lucy/Test/Store/TestIOPrimitives.c
index 398e3b5..48ab66c 100644
--- a/core/Lucy/Test/Store/TestIOPrimitives.c
+++ b/core/Lucy/Test/Store/TestIOPrimitives.c
@@ -80,17 +80,17 @@ test_u8(TestBatch *batch) {
static void
test_i32(TestBatch *batch) {
- int64_t *ints = TestUtils_random_i64s(NULL, 1000, I32_MIN, I32_MAX);
+ int64_t *ints = TestUtils_random_i64s(NULL, 1000, INT32_MIN, INT32_MAX);
RAMFile *file = RAMFile_new(NULL, false);
OutStream *outstream = OutStream_open((Obj*)file);
InStream *instream;
uint32_t i;
// Test boundaries.
- ints[0] = I32_MIN;
- ints[1] = I32_MIN + 1;
- ints[2] = I32_MAX;
- ints[3] = I32_MAX - 1;
+ ints[0] = INT32_MIN;
+ ints[1] = INT32_MIN + 1;
+ ints[2] = INT32_MAX;
+ ints[3] = INT32_MAX - 1;
for (i = 0; i < 1000; i++) {
OutStream_Write_I32(outstream, (int32_t)ints[i]);
@@ -118,7 +118,7 @@ test_i32(TestBatch *batch) {
static void
test_u32(TestBatch *batch) {
- uint64_t *ints = TestUtils_random_u64s(NULL, 1000, 0, U32_MAX);
+ uint64_t *ints = TestUtils_random_u64s(NULL, 1000, 0, UINT32_MAX);
RAMFile *file = RAMFile_new(NULL, false);
OutStream *outstream = OutStream_open((Obj*)file);
InStream *instream;
@@ -127,8 +127,8 @@ test_u32(TestBatch *batch) {
// Test boundaries.
ints[0] = 0;
ints[1] = 1;
- ints[2] = U32_MAX;
- ints[3] = U32_MAX - 1;
+ ints[2] = UINT32_MAX;
+ ints[3] = UINT32_MAX - 1;
for (i = 0; i < 1000; i++) {
OutStream_Write_U32(outstream, (uint32_t)ints[i]);
@@ -156,17 +156,17 @@ test_u32(TestBatch *batch) {
static void
test_i64(TestBatch *batch) {
- int64_t *ints = TestUtils_random_i64s(NULL, 1000, I64_MIN, I64_MAX);
+ int64_t *ints = TestUtils_random_i64s(NULL, 1000, INT64_MIN, INT64_MAX);
RAMFile *file = RAMFile_new(NULL, false);
OutStream *outstream = OutStream_open((Obj*)file);
InStream *instream;
uint32_t i;
// Test boundaries.
- ints[0] = I64_MIN;
- ints[1] = I64_MIN + 1;
- ints[2] = I64_MAX;
- ints[3] = I64_MAX - 1;
+ ints[0] = INT64_MIN;
+ ints[1] = INT64_MIN + 1;
+ ints[2] = INT64_MAX;
+ ints[3] = INT64_MAX - 1;
for (i = 0; i < 1000; i++) {
OutStream_Write_I64(outstream, ints[i]);
@@ -195,7 +195,7 @@ test_i64(TestBatch *batch) {
static void
test_u64(TestBatch *batch) {
- uint64_t *ints = TestUtils_random_u64s(NULL, 1000, 0, U64_MAX);
+ uint64_t *ints = TestUtils_random_u64s(NULL, 1000, 0, UINT64_MAX);
RAMFile *file = RAMFile_new(NULL, false);
OutStream *outstream = OutStream_open((Obj*)file);
InStream *instream;
@@ -204,8 +204,8 @@ test_u64(TestBatch *batch) {
// Test boundaries.
ints[0] = 0;
ints[1] = 1;
- ints[2] = U64_MAX;
- ints[3] = U64_MAX - 1;
+ ints[2] = UINT64_MAX;
+ ints[3] = UINT64_MAX - 1;
for (i = 0; i < 1000; i++) {
OutStream_Write_U64(outstream, ints[i]);
@@ -233,7 +233,7 @@ test_u64(TestBatch *batch) {
static void
test_c32(TestBatch *batch) {
- uint64_t *ints = TestUtils_random_u64s(NULL, 1000, 0, U32_MAX);
+ uint64_t *ints = TestUtils_random_u64s(NULL, 1000, 0, UINT32_MAX);
RAMFile *file = RAMFile_new(NULL, false);
OutStream *outstream = OutStream_open((Obj*)file);
InStream *instream;
@@ -242,8 +242,8 @@ test_c32(TestBatch *batch) {
// Test boundaries.
ints[0] = 0;
ints[1] = 1;
- ints[2] = U32_MAX;
- ints[3] = U32_MAX - 1;
+ ints[2] = UINT32_MAX;
+ ints[3] = UINT32_MAX - 1;
for (i = 0; i < 1000; i++) {
OutStream_Write_C32(outstream, (uint32_t)ints[i]);
@@ -271,7 +271,7 @@ test_c32(TestBatch *batch) {
static void
test_c64(TestBatch *batch) {
- uint64_t *ints = TestUtils_random_u64s(NULL, 1000, 0, U64_MAX);
+ uint64_t *ints = TestUtils_random_u64s(NULL, 1000, 0, UINT64_MAX);
RAMFile *file = RAMFile_new(NULL, false);
RAMFile *raw_file = RAMFile_new(NULL, false);
OutStream *outstream = OutStream_open((Obj*)file);
@@ -283,8 +283,8 @@ test_c64(TestBatch *batch) {
// Test boundaries.
ints[0] = 0;
ints[1] = 1;
- ints[2] = U64_MAX;
- ints[3] = U64_MAX - 1;
+ ints[2] = UINT64_MAX;
+ ints[3] = UINT64_MAX - 1;
for (i = 0; i < 1000; i++) {
OutStream_Write_C64(outstream, ints[i]);
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Test/TestUtils.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/TestUtils.c b/core/Lucy/Test/TestUtils.c
index 28a6e91..47850bb 100644
--- a/core/Lucy/Test/TestUtils.c
+++ b/core/Lucy/Test/TestUtils.c
@@ -72,7 +72,7 @@ TestUtils_random_f64s(double *buf, size_t count) {
double *f64s = buf ? buf : (double*)CALLOCATE(count, sizeof(double));
for (size_t i = 0; i < count; i++) {
uint64_t num = TestUtils_random_u64();
- f64s[i] = U64_TO_DOUBLE(num) / U64_MAX;
+ f64s[i] = U64_TO_DOUBLE(num) / UINT64_MAX;
}
return f64s;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Test/Util/TestNumberUtils.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestNumberUtils.c b/core/Lucy/Test/Util/TestNumberUtils.c
index 3802c0e..a0f7552 100644
--- a/core/Lucy/Test/Util/TestNumberUtils.c
+++ b/core/Lucy/Test/Util/TestNumberUtils.c
@@ -86,8 +86,8 @@ test_u4(TestBatch *batch) {
static void
test_c32(TestBatch *batch) {
- uint64_t mins[] = { 0, 0x4000 - 100, (uint32_t)I32_MAX - 100, U32_MAX - 10 };
- uint64_t limits[] = { 500, 0x4000 + 100, (uint32_t)I32_MAX + 100, U32_MAX };
+ uint64_t mins[] = { 0, 0x4000 - 100, (uint32_t)INT32_MAX - 100, UINT32_MAX - 10 };
+ uint64_t limits[] = { 500, 0x4000 + 100, (uint32_t)INT32_MAX + 100, UINT32_MAX };
uint32_t set_num;
uint32_t num_sets = sizeof(mins) / sizeof(uint64_t);
size_t count = 64;
@@ -136,9 +136,9 @@ test_c32(TestBatch *batch) {
}
target = encoded;
- NumUtil_encode_c32(U32_MAX, &target);
+ NumUtil_encode_c32(UINT32_MAX, &target);
target = encoded;
- TEST_INT_EQ(batch, NumUtil_decode_c32(&target), U32_MAX, "c32 U32_MAX");
+ TEST_INT_EQ(batch, NumUtil_decode_c32(&target), UINT32_MAX, "c32 UINT32_MAX");
FREEMEM(encoded);
FREEMEM(ints);
@@ -146,8 +146,8 @@ test_c32(TestBatch *batch) {
static void
test_c64(TestBatch *batch) {
- uint64_t mins[] = { 0, 0x4000 - 100, (uint64_t)U32_MAX - 100, U64_MAX - 10 };
- uint64_t limits[] = { 500, 0x4000 + 100, (uint64_t)U32_MAX + 1000, U64_MAX };
+ uint64_t mins[] = { 0, 0x4000 - 100, (uint64_t)UINT32_MAX - 100, UINT64_MAX - 10 };
+ uint64_t limits[] = { 500, 0x4000 + 100, (uint64_t)UINT32_MAX + 1000, UINT64_MAX };
uint32_t set_num;
uint32_t num_sets = sizeof(mins) / sizeof(uint64_t);
size_t count = 64;
@@ -179,11 +179,11 @@ test_c64(TestBatch *batch) {
}
target = encoded;
- NumUtil_encode_c64(U64_MAX, &target);
+ NumUtil_encode_c64(UINT64_MAX, &target);
target = encoded;
uint64_t got = NumUtil_decode_c64(&target);
- TEST_TRUE(batch, got == U64_MAX, "c64 U64_MAX");
+ TEST_TRUE(batch, got == UINT64_MAX, "c64 UINT64_MAX");
FREEMEM(encoded);
FREEMEM(ints);
@@ -192,7 +192,7 @@ test_c64(TestBatch *batch) {
static void
test_bigend_u16(TestBatch *batch) {
size_t count = 32;
- uint64_t *ints = TestUtils_random_u64s(NULL, count, 0, U16_MAX + 1);
+ uint64_t *ints = TestUtils_random_u64s(NULL, count, 0, UINT16_MAX + 1);
size_t amount = (count + 1) * sizeof(uint16_t);
char *allocated = (char*)CALLOCATE(amount, sizeof(char));
char *encoded = allocated + 1; // Intentionally misaligned.
@@ -221,7 +221,7 @@ test_bigend_u16(TestBatch *batch) {
static void
test_bigend_u32(TestBatch *batch) {
size_t count = 32;
- uint64_t *ints = TestUtils_random_u64s(NULL, count, 0, U64_C(1) + U32_MAX);
+ uint64_t *ints = TestUtils_random_u64s(NULL, count, 0, U64_C(1) + UINT32_MAX);
size_t amount = (count + 1) * sizeof(uint32_t);
char *allocated = (char*)CALLOCATE(amount, sizeof(char));
char *encoded = allocated + 1; // Intentionally misaligned.
@@ -250,7 +250,7 @@ test_bigend_u32(TestBatch *batch) {
static void
test_bigend_u64(TestBatch *batch) {
size_t count = 32;
- uint64_t *ints = TestUtils_random_u64s(NULL, count, 0, U64_MAX);
+ uint64_t *ints = TestUtils_random_u64s(NULL, count, 0, UINT64_MAX);
size_t amount = (count + 1) * sizeof(uint64_t);
char *allocated = (char*)CALLOCATE(amount, sizeof(char));
char *encoded = allocated + 1; // Intentionally misaligned.
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Test/Util/TestStringHelper.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Util/TestStringHelper.c b/core/Lucy/Test/Util/TestStringHelper.c
index 55a638b..d978d33 100644
--- a/core/Lucy/Test/Util/TestStringHelper.c
+++ b/core/Lucy/Test/Util/TestStringHelper.c
@@ -137,8 +137,8 @@ test_overlap(TestBatch *batch) {
static void
test_to_base36(TestBatch *batch) {
char buffer[StrHelp_MAX_BASE36_BYTES];
- StrHelp_to_base36(U64_MAX, buffer);
- TEST_STR_EQ(batch, "3w5e11264sgsf", buffer, "base36 U64_MAX");
+ StrHelp_to_base36(UINT64_MAX, buffer);
+ TEST_STR_EQ(batch, "3w5e11264sgsf", buffer, "base36 UINT64_MAX");
StrHelp_to_base36(1, buffer);
TEST_STR_EQ(batch, "1", buffer, "base36 1");
TEST_INT_EQ(batch, buffer[1], 0, "base36 NULL termination");
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Util/PriorityQueue.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/PriorityQueue.c b/core/Lucy/Util/PriorityQueue.c
index 9ee188f..21d9c01 100644
--- a/core/Lucy/Util/PriorityQueue.c
+++ b/core/Lucy/Util/PriorityQueue.c
@@ -40,7 +40,7 @@ S_down_heap(PriorityQueue *self);
PriorityQueue*
PriQ_init(PriorityQueue *self, uint32_t max_size) {
- if (max_size == U32_MAX) {
+ if (max_size == UINT32_MAX) {
THROW(ERR, "max_size too large: %u32", max_size);
}
uint32_t heap_size = max_size + 1;
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c25c38a/core/Lucy/Util/SortExternal.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/SortExternal.c b/core/Lucy/Util/SortExternal.c
index 3b700e5..4f530f7 100644
--- a/core/Lucy/Util/SortExternal.c
+++ b/core/Lucy/Util/SortExternal.c
@@ -44,7 +44,7 @@ SortEx_init(SortExternal *self, size_t width) {
self->width = width;
// Init.
- self->mem_thresh = U32_MAX;
+ self->mem_thresh = UINT32_MAX;
self->cache = NULL;
self->cache_cap = 0;
self->cache_max = 0;