Repository: lucy-clownfish Updated Branches: refs/heads/master 92f2b6ab9 -> f7bc3e82e
Fix most 64/32-bit warnings - Change TEST_INT_EQ to take uint64_t types. - Use size_t hash sums in LockFreeRegistry. - Change StrHelp return types to size_t. - Switch a couple of local variables over to size_t. - Add some explicit casts. - Use DWORD in Err_win_error(). - Fix other warnings from MSVC in test code. Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/f7bc3e82 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/f7bc3e82 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/f7bc3e82 Branch: refs/heads/master Commit: f7bc3e82e59968f79e07765f7613314322fcc0a7 Parents: 92f2b6a Author: Nick Wellnhofer <[email protected]> Authored: Mon Jul 27 23:10:42 2015 +0200 Committer: Nick Wellnhofer <[email protected]> Committed: Wed Jul 29 12:42:46 2015 +0200 ---------------------------------------------------------------------- compiler/common/charmonizer.c | 1 + compiler/common/charmonizer.main | 1 + compiler/src/CFCBindClass.c | 4 ++-- compiler/src/CFCClass.c | 2 +- compiler/src/CFCTest.c | 5 +++-- compiler/src/CFCTest.h | 4 +++- compiler/src/CFCUtil.c | 2 +- runtime/c/src/clownfish.c | 8 ++++---- runtime/core/Clownfish/Class.c | 6 +++--- runtime/core/Clownfish/Err.c | 18 +++++++++--------- runtime/core/Clownfish/LockFreeRegistry.c | 10 +++++----- runtime/core/Clownfish/Test/TestBoolean.c | 6 ++---- runtime/core/Clownfish/Test/TestHash.c | 6 +++--- runtime/core/Clownfish/Test/TestHashIterator.c | 6 ++++-- runtime/core/Clownfish/Test/TestString.c | 2 +- runtime/core/Clownfish/Test/TestVector.c | 6 +++--- .../core/Clownfish/Test/Util/TestStringHelper.c | 2 +- .../core/Clownfish/TestHarness/TestBatchRunner.c | 12 +++++++----- .../Clownfish/TestHarness/TestBatchRunner.cfh | 4 ++-- runtime/core/Clownfish/TestHarness/TestSuite.c | 8 ++++---- runtime/core/Clownfish/Util/StringHelper.c | 6 +++--- runtime/core/Clownfish/Util/StringHelper.cfh | 4 ++-- 22 files changed, 65 insertions(+), 58 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/compiler/common/charmonizer.c ---------------------------------------------------------------------- diff --git a/compiler/common/charmonizer.c b/compiler/common/charmonizer.c index 902ab12..0a12ffb 100644 --- a/compiler/common/charmonizer.c +++ b/compiler/common/charmonizer.c @@ -7949,6 +7949,7 @@ int main(int argc, const char **argv) { /* Define stdint types in charmony.h. */ chaz_ConfWriter_append_conf("#define CHY_EMPLOY_INTEGERTYPES\n\n"); chaz_ConfWriter_append_conf("#define CHY_EMPLOY_INTEGERLITERALS\n\n"); + chaz_ConfWriter_append_conf("#define CHY_EMPLOY_INTEGERFORMATSTRINGS\n\n"); /* Run probe modules. */ chaz_BuildEnv_run(); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/compiler/common/charmonizer.main ---------------------------------------------------------------------- diff --git a/compiler/common/charmonizer.main b/compiler/common/charmonizer.main index 0d86a26..4a492c0 100644 --- a/compiler/common/charmonizer.main +++ b/compiler/common/charmonizer.main @@ -62,6 +62,7 @@ int main(int argc, const char **argv) { /* Define stdint types in charmony.h. */ chaz_ConfWriter_append_conf("#define CHY_EMPLOY_INTEGERTYPES\n\n"); chaz_ConfWriter_append_conf("#define CHY_EMPLOY_INTEGERLITERALS\n\n"); + chaz_ConfWriter_append_conf("#define CHY_EMPLOY_INTEGERFORMATSTRINGS\n\n"); /* Run probe modules. */ chaz_BuildEnv_run(); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/compiler/src/CFCBindClass.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCBindClass.c b/compiler/src/CFCBindClass.c index 69acd22..ac8b8fd 100644 --- a/compiler/src/CFCBindClass.c +++ b/compiler/src/CFCBindClass.c @@ -357,8 +357,8 @@ S_struct_definition(CFCBindClass *self) { // Add all member variables declared by classes in this package. CFCVariable **member_vars = CFCClass_member_vars(client); - int num_non_package_members = CFCClass_num_non_package_ivars(client); - for (int i = num_non_package_members; member_vars[i] != NULL; i++) { + size_t num_non_package_members = CFCClass_num_non_package_ivars(client); + for (size_t i = num_non_package_members; member_vars[i] != NULL; i++) { const char *member_dec = CFCVariable_local_declaration(member_vars[i]); member_decs = CFCUtil_cat(member_decs, "\n ", member_dec, NULL); } http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/compiler/src/CFCClass.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCClass.c b/compiler/src/CFCClass.c index 1d89de4..7ed3167 100644 --- a/compiler/src/CFCClass.c +++ b/compiler/src/CFCClass.c @@ -816,7 +816,7 @@ size_t CFCClass_num_non_package_ivars(CFCClass *self) { CFCParcel *parcel = CFCClass_get_parcel(self); CFCClass *ancestor = CFCClass_get_parent(self); - int num_non_package_members = 0; + size_t num_non_package_members = 0; while (ancestor && CFCClass_get_parcel(ancestor) == parcel) { ancestor = CFCClass_get_parent(ancestor); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/compiler/src/CFCTest.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCTest.c b/compiler/src/CFCTest.c index 5ddff02..c62f3b5 100644 --- a/compiler/src/CFCTest.c +++ b/compiler/src/CFCTest.c @@ -244,7 +244,7 @@ CFCTest_test_string_equals(CFCTest *self, const char *result, } void -CFCTest_test_int_equals(CFCTest *self, long result, long expected, +CFCTest_test_int_equals(CFCTest *self, uint64_t result, uint64_t expected, const char *fmt, ...) { int cond = (result == expected); @@ -254,7 +254,8 @@ CFCTest_test_int_equals(CFCTest *self, long result, long expected, va_end(args); if (!cond) { - self->formatter->test_comment("Expected '%ld', got '%ld'.\n", + self->formatter->test_comment("Expected '%"PRIu64"'," + " got '%"PRIu64"'.\n", expected, result); } } http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/compiler/src/CFCTest.h ---------------------------------------------------------------------- diff --git a/compiler/src/CFCTest.h b/compiler/src/CFCTest.h index dbb3a17..93d11eb 100644 --- a/compiler/src/CFCTest.h +++ b/compiler/src/CFCTest.h @@ -21,6 +21,8 @@ #ifndef H_CFCTEST #define H_CFCTEST +#include "charmony.h" + #include <time.h> #ifdef CFC_USE_TEST_MACROS @@ -102,7 +104,7 @@ CFCTest_test_string_equals(CFCTest *self, const char *result, * @param fmt printf-like format string describing the test. */ void -CFCTest_test_int_equals(CFCTest *self, long result, long expected, +CFCTest_test_int_equals(CFCTest *self, uint64_t result, uint64_t expected, const char *fmt, ...); /* Skip tests. http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/compiler/src/CFCUtil.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCUtil.c b/compiler/src/CFCUtil.c index 8686da3..6fe62fa 100644 --- a/compiler/src/CFCUtil.c +++ b/compiler/src/CFCUtil.c @@ -344,7 +344,7 @@ CFCUtil_slurp_text(const char *file_path, size_t *len_ptr) { FILE *const file = fopen(file_path, "r"); char *contents; size_t binary_len; - long text_len; + size_t text_len; /* Sanity check. */ if (file == NULL) { http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/runtime/c/src/clownfish.c ---------------------------------------------------------------------- diff --git a/runtime/c/src/clownfish.c b/runtime/c/src/clownfish.c index f141e0a..d40f571 100644 --- a/runtime/c/src/clownfish.c +++ b/runtime/c/src/clownfish.c @@ -65,7 +65,7 @@ SI_is_string_type(cfish_Class *klass) { uint32_t cfish_get_refcount(void *vself) { cfish_Obj *self = (cfish_Obj*)vself; - return self->refcount; + return (uint32_t)self->refcount; } Obj* @@ -99,11 +99,11 @@ cfish_dec_refcount(void *vself) { cfish_Class *klass = self->klass; if (klass->flags & CFISH_fREFCOUNTSPECIAL) { if (SI_immortal(klass)) { - return self->refcount; + return (uint32_t)self->refcount; } } - uint32_t modified_refcount = INT32_MAX; + size_t modified_refcount = 0; switch (self->refcount) { case 0: THROW(ERR, "Illegal refcount of 0"); @@ -116,7 +116,7 @@ cfish_dec_refcount(void *vself) { modified_refcount = --self->refcount; break; } - return modified_refcount; + return (uint32_t)modified_refcount; } void* http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/runtime/core/Clownfish/Class.c ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Class.c b/runtime/core/Clownfish/Class.c index d16c3b8..62d9841 100644 --- a/runtime/core/Clownfish/Class.c +++ b/runtime/core/Clownfish/Class.c @@ -301,7 +301,7 @@ Class_singleton(String *class_name, Class *parent) { Class *singleton = (Class*)LFReg_fetch(Class_registry, class_name); if (singleton == NULL) { Vector *fresh_host_methods; - uint32_t num_fresh; + size_t num_fresh; if (parent == NULL) { String *parent_class = Class_find_parent_class(class_name); @@ -322,7 +322,7 @@ Class_singleton(String *class_name, Class *parent) { num_fresh = Vec_Get_Size(fresh_host_methods); if (num_fresh) { Hash *meths = Hash_new(num_fresh); - for (uint32_t i = 0; i < num_fresh; i++) { + for (size_t i = 0; i < num_fresh; i++) { String *meth = (String*)Vec_Fetch(fresh_host_methods, i); Hash_Store(meths, meth, (Obj*)CFISH_TRUE); } @@ -462,6 +462,6 @@ S_claim_parcel_id(void) { old_value.ptr, new_value.ptr); } while (!succeeded); - return new_value.num; + return (int32_t)new_value.num; } http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/runtime/core/Clownfish/Err.c ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Err.c b/runtime/core/Clownfish/Err.c index dad6ae9..8463e0d 100644 --- a/runtime/core/Clownfish/Err.c +++ b/runtime/core/Clownfish/Err.c @@ -249,16 +249,16 @@ Err_invalid_callback(const char *method_name) { char* Err_win_error() { - size_t buf_size = 256; + DWORD buf_size = 256; char *buf = (char*)MALLOCATE(buf_size); - size_t message_len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, - NULL, // message source table - GetLastError(), - 0, // language id - buf, - buf_size, - NULL // empty va_list - ); + DWORD message_len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, + NULL, // message source table + GetLastError(), + 0, // language id + buf, + buf_size, + NULL // empty va_list + ); if (message_len == 0) { char unknown[] = "Unknown error"; size_t len = sizeof(unknown); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/runtime/core/Clownfish/LockFreeRegistry.c ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/LockFreeRegistry.c b/runtime/core/Clownfish/LockFreeRegistry.c index 307710b..b11c922 100644 --- a/runtime/core/Clownfish/LockFreeRegistry.c +++ b/runtime/core/Clownfish/LockFreeRegistry.c @@ -32,7 +32,7 @@ struct cfish_LockFreeRegistry { typedef struct cfish_LFRegEntry { String *key; Obj *value; - int32_t hash_sum; + size_t hash_sum; struct cfish_LFRegEntry *volatile next; } cfish_LFRegEntry; #define LFRegEntry cfish_LFRegEntry @@ -49,8 +49,8 @@ LFReg_new(size_t capacity) { bool LFReg_register(LockFreeRegistry *self, String *key, Obj *value) { LFRegEntry *new_entry = NULL; - int32_t hash_sum = Str_Hash_Sum(key); - size_t bucket = (uint32_t)hash_sum % self->capacity; + size_t hash_sum = Str_Hash_Sum(key); + size_t bucket = hash_sum % self->capacity; LFRegEntry *volatile *entries = (LFRegEntry*volatile*)self->entries; LFRegEntry *volatile *slot = &(entries[bucket]); @@ -107,8 +107,8 @@ FIND_END_OF_LINKED_LIST: Obj* LFReg_fetch(LockFreeRegistry *self, String *key) { - int32_t hash_sum = Str_Hash_Sum(key); - size_t bucket = (uint32_t)hash_sum % self->capacity; + size_t hash_sum = Str_Hash_Sum(key); + size_t bucket = hash_sum % self->capacity; LFRegEntry **entries = (LFRegEntry**)self->entries; LFRegEntry *entry = entries[bucket]; http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/runtime/core/Clownfish/Test/TestBoolean.c ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Test/TestBoolean.c b/runtime/core/Clownfish/Test/TestBoolean.c index e7db615..d455210 100644 --- a/runtime/core/Clownfish/Test/TestBoolean.c +++ b/runtime/core/Clownfish/Test/TestBoolean.c @@ -51,10 +51,8 @@ test_accessors(TestBatchRunner *runner) { "Bool_Get_Value [true]"); TEST_INT_EQ(runner, Bool_Get_Value(CFISH_FALSE), false, "Bool_Get_Value [false]"); - TEST_TRUE(runner, Bool_To_I64(CFISH_TRUE) == true, - "Bool_To_I64 [true]"); - TEST_TRUE(runner, Bool_To_I64(CFISH_FALSE) == false, - "Bool_To_I64 [false]"); + TEST_INT_EQ(runner, Bool_To_I64(CFISH_TRUE), 1, "Bool_To_I64 [true]"); + TEST_INT_EQ(runner, Bool_To_I64(CFISH_FALSE), 0, "Bool_To_I64 [false]"); TEST_TRUE(runner, Bool_To_F64(CFISH_TRUE) == 1.0, "Bool_To_F64 [true]"); TEST_TRUE(runner, Bool_To_F64(CFISH_FALSE) == 0.0, http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/runtime/core/Clownfish/Test/TestHash.c ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Test/TestHash.c b/runtime/core/Clownfish/Test/TestHash.c index e4075f1..2fe1be3 100644 --- a/runtime/core/Clownfish/Test/TestHash.c +++ b/runtime/core/Clownfish/Test/TestHash.c @@ -65,7 +65,7 @@ static void test_Store_and_Fetch(TestBatchRunner *runner) { Hash *hash = Hash_new(100); Hash *dupe = Hash_new(100); - const uint32_t starting_cap = Hash_Get_Capacity(hash); + const size_t starting_cap = Hash_Get_Capacity(hash); Vector *expected = Vec_new(100); Vector *got = Vec_new(100); String *twenty = SSTR_WRAP_UTF8("20", 2); @@ -209,10 +209,10 @@ test_stress(TestBatchRunner *runner) { static void test_store_skips_tombstone(TestBatchRunner *runner) { Hash *hash = Hash_new(0); - uint32_t mask = Hash_Get_Capacity(hash) - 1; + size_t mask = Hash_Get_Capacity(hash) - 1; String *one = Str_newf("one"); - uint32_t slot = Str_Hash_Sum(one) & mask; + size_t slot = Str_Hash_Sum(one) & mask; // Find a colliding key. String *two = NULL; http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/runtime/core/Clownfish/Test/TestHashIterator.c ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Test/TestHashIterator.c b/runtime/core/Clownfish/Test/TestHashIterator.c index fd929d3..3822b08 100644 --- a/runtime/core/Clownfish/Test/TestHashIterator.c +++ b/runtime/core/Clownfish/Test/TestHashIterator.c @@ -137,8 +137,10 @@ test_Get_Key_and_Get_Value(TestBatchRunner *runner) { DECREF(get_value_error); HashIter_Next(iter); - TEST_TRUE(runner, HashIter_Get_Key(iter), "Get_Key during iteration."); - TEST_TRUE(runner, HashIter_Get_Value(iter), "Get_Value during iteration."); + TEST_TRUE(runner, HashIter_Get_Key(iter) != NULL, + "Get_Key during iteration."); + TEST_TRUE(runner, HashIter_Get_Value(iter) != NULL, + "Get_Value during iteration."); HashIter_Next(iter); get_key_error = Err_trap(S_invoke_Get_Key, iter); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/runtime/core/Clownfish/Test/TestString.c ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Test/TestString.c b/runtime/core/Clownfish/Test/TestString.c index 125b576..d305a00 100644 --- a/runtime/core/Clownfish/Test/TestString.c +++ b/runtime/core/Clownfish/Test/TestString.c @@ -542,7 +542,7 @@ test_iterator(TestBatchRunner *runner) { { StringIterator *iter = Str_Tail(string); - for (int i = num_code_points - 1; i >= 0; --i) { + for (size_t i = num_code_points; i--;) { TEST_TRUE(runner, StrIter_Has_Prev(iter), "Has_Prev %d", i); int32_t code_point = StrIter_Prev(iter); TEST_INT_EQ(runner, code_point, code_points[i], "Prev %d", i); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/runtime/core/Clownfish/Test/TestVector.c ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Test/TestVector.c b/runtime/core/Clownfish/Test/TestVector.c index 7b51cb3..30621f0 100644 --- a/runtime/core/Clownfish/Test/TestVector.c +++ b/runtime/core/Clownfish/Test/TestVector.c @@ -503,8 +503,8 @@ test_Sort(TestBatchRunner *runner) { static void test_Grow(TestBatchRunner *runner) { - Vector *array = Vec_new(500); - uint32_t cap; + Vector *array = Vec_new(500); + size_t cap; cap = Vec_Get_Capacity(array); TEST_TRUE(runner, cap >= 500, "Array is created with minimum capacity"); @@ -513,7 +513,7 @@ test_Grow(TestBatchRunner *runner) { cap = Vec_Get_Capacity(array); TEST_TRUE(runner, cap >= 2000, "Grow to larger capacity"); - uint32_t old_cap = cap; + size_t old_cap = cap; Vec_Grow(array, old_cap); cap = Vec_Get_Capacity(array); TEST_TRUE(runner, cap >= old_cap, "Grow to same capacity"); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/runtime/core/Clownfish/Test/Util/TestStringHelper.c ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Test/Util/TestStringHelper.c b/runtime/core/Clownfish/Test/Util/TestStringHelper.c index bcf33a2..a9c2464 100644 --- a/runtime/core/Clownfish/Test/Util/TestStringHelper.c +++ b/runtime/core/Clownfish/Test/Util/TestStringHelper.c @@ -128,7 +128,7 @@ S_utf8_valid_alt(const char *maybe_utf8, size_t size) { static void test_overlap(TestBatchRunner *runner) { - int32_t result; + size_t result; result = StrHelp_overlap("", "", 0, 0); TEST_INT_EQ(runner, result, 0, "two empty strings"); result = StrHelp_overlap("", "foo", 0, 3); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/runtime/core/Clownfish/TestHarness/TestBatchRunner.c ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/TestHarness/TestBatchRunner.c b/runtime/core/Clownfish/TestHarness/TestBatchRunner.c index dbc0b99..f832d0e 100644 --- a/runtime/core/Clownfish/TestHarness/TestBatchRunner.c +++ b/runtime/core/Clownfish/TestHarness/TestBatchRunner.c @@ -14,6 +14,8 @@ * limitations under the License. */ +#include "charmony.h" + #include <math.h> #include <stdio.h> #include <string.h> @@ -148,8 +150,8 @@ TestBatchRunner_test_false(TestBatchRunner *self, bool condition, } bool -TestBatchRunner_test_int_equals(TestBatchRunner *self, long got, long expected, - const char *pattern, ...) { +TestBatchRunner_test_int_equals(TestBatchRunner *self, uint64_t got, + uint64_t expected, const char *pattern, ...) { va_list args; va_start(args, pattern); bool result = TestBatchRunner_VTest_Int_Equals(self, got, expected, @@ -221,14 +223,14 @@ TestBatchRunner_VTest_False_IMP(TestBatchRunner *self, bool condition, } bool -TestBatchRunner_VTest_Int_Equals_IMP(TestBatchRunner *self, long got, - long expected, const char *pattern, +TestBatchRunner_VTest_Int_Equals_IMP(TestBatchRunner *self, uint64_t got, + uint64_t expected, const char *pattern, va_list args) { bool pass = (got == expected); S_vtest_true(self, pass, pattern, args); if (!pass) { TestFormatter_test_comment(self->formatter, - "Expected '%ld', got '%ld'.\n", + "Expected '%"PRIu64"', got '%"PRIu64"'.\n", expected, got); } return pass; http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh b/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh index 20a4ab1..fc39d33 100644 --- a/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh +++ b/runtime/core/Clownfish/TestHarness/TestBatchRunner.cfh @@ -68,7 +68,7 @@ class Clownfish::TestHarness::TestBatchRunner inherits Clownfish::Obj { ...); inert bool - test_int_equals(TestBatchRunner *self, long got, long expected, + test_int_equals(TestBatchRunner *self, uint64_t got, uint64_t expected, const char *pattern, ...); inert bool @@ -97,7 +97,7 @@ class Clownfish::TestHarness::TestBatchRunner inherits Clownfish::Obj { va_list args); bool - VTest_Int_Equals(TestBatchRunner *self, long got, long expected, + VTest_Int_Equals(TestBatchRunner *self, uint64_t got, uint64_t expected, const char *pattern, va_list args); bool http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/runtime/core/Clownfish/TestHarness/TestSuite.c ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/TestHarness/TestSuite.c b/runtime/core/Clownfish/TestHarness/TestSuite.c index 078a317..c382a9b 100644 --- a/runtime/core/Clownfish/TestHarness/TestSuite.c +++ b/runtime/core/Clownfish/TestHarness/TestSuite.c @@ -62,9 +62,9 @@ TestSuite_Run_Batch_IMP(TestSuite *self, String *class_name, TestFormatter *formatter) { S_unbuffer_stdout(); - uint32_t size = Vec_Get_Size(self->batches); + size_t size = Vec_Get_Size(self->batches); - for (uint32_t i = 0; i < size; ++i) { + for (size_t i = 0; i < size; ++i) { TestBatch *batch = (TestBatch*)Vec_Fetch(self->batches, i); if (Str_Equals(TestBatch_get_class_name(batch), (Obj*)class_name)) { @@ -84,9 +84,9 @@ TestSuite_Run_All_Batches_IMP(TestSuite *self, TestFormatter *formatter) { S_unbuffer_stdout(); TestSuiteRunner *runner = TestSuiteRunner_new(formatter); - uint32_t size = Vec_Get_Size(self->batches); + size_t size = Vec_Get_Size(self->batches); - for (uint32_t i = 0; i < size; ++i) { + for (size_t i = 0; i < size; ++i) { TestBatch *batch = (TestBatch*)Vec_Fetch(self->batches, i); TestSuiteRunner_Run_Batch(runner, batch); } http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/runtime/core/Clownfish/Util/StringHelper.c ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Util/StringHelper.c b/runtime/core/Clownfish/Util/StringHelper.c index bd45be8..a2ccdc6 100644 --- a/runtime/core/Clownfish/Util/StringHelper.c +++ b/runtime/core/Clownfish/Util/StringHelper.c @@ -42,7 +42,7 @@ const uint8_t cfish_StrHelp_UTF8_COUNT[] = { 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, }; -int32_t +size_t StrHelp_overlap(const char *a, const char *b, size_t a_len, size_t b_len) { size_t i; const size_t len = a_len <= b_len ? a_len : b_len; @@ -55,7 +55,7 @@ StrHelp_overlap(const char *a, const char *b, size_t a_len, size_t b_len) { static const char base36_chars[] = "0123456789abcdefghijklmnopqrstuvwxyz"; -uint32_t +size_t StrHelp_to_base36(uint64_t num, void *buffer) { char my_buf[StrHelp_MAX_BASE36_BYTES]; char *buf = my_buf + StrHelp_MAX_BASE36_BYTES - 1; @@ -70,7 +70,7 @@ StrHelp_to_base36(uint64_t num, void *buffer) { num /= 36; } while (num > 0); - uint32_t size = end - buf; + size_t size = end - buf; memcpy(buffer, buf, size + 1); return size; } http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f7bc3e82/runtime/core/Clownfish/Util/StringHelper.cfh ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Util/StringHelper.cfh b/runtime/core/Clownfish/Util/StringHelper.cfh index 6595bcc..90fbbd5 100644 --- a/runtime/core/Clownfish/Util/StringHelper.cfh +++ b/runtime/core/Clownfish/Util/StringHelper.cfh @@ -25,7 +25,7 @@ inert class Clownfish::Util::StringHelper nickname StrHelp { /** Return the number of bytes that two strings have in common. */ - inert int32_t + inert size_t overlap(const char *a, const char *b, size_t a_len, size_t b_len); /** Encode a NULL-terminated string representation of a value in base 36 @@ -36,7 +36,7 @@ inert class Clownfish::Util::StringHelper nickname StrHelp { * @return the number of digits encoded (not including the terminating * NULL). */ - inert uint32_t + inert size_t to_base36(uint64_t value, void *buffer); /** Return true if the string is valid UTF-8, false otherwise.
