diff options
author | ylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68> | 2022-06-23 13:12:06 +0000 |
---|---|---|
committer | ylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68> | 2022-06-23 13:12:06 +0000 |
commit | 109aefc9086078cdc43d908005aea32d80cf7f9a (patch) | |
tree | 4587ca7323d32a4318b2802921cf8a333cb5c4dc | |
parent | d1742997eb5b568e95da87f36a1835e3b9d9b181 (diff) | |
download | libapr-109aefc9086078cdc43d908005aea32d80cf7f9a.tar.gz |
tests: Fix numeric types warnings.
By using the right numeric comparison assertions and some explicit casts.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902205 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | test/testbase64.c | 4 | ||||
-rw-r--r-- | test/testjson.c | 6 | ||||
-rw-r--r-- | test/testmd5.c | 2 | ||||
-rw-r--r-- | test/testmmap.c | 7 | ||||
-rw-r--r-- | test/testpass.c | 2 |
5 files changed, 12 insertions, 9 deletions
diff --git a/test/testbase64.c b/test/testbase64.c index 92cccb712..7e0d7d8ed 100644 --- a/test/testbase64.c +++ b/test/testbase64.c @@ -52,8 +52,8 @@ static void test_base64(abts_case *tc, void *data) apr_pool_clear(pool); - orig_len = strlen(base64_tbl[i].orig); - enc_len = strlen(base64_tbl[i].enc); + orig_len = (int)strlen(base64_tbl[i].orig); + enc_len = (int)strlen(base64_tbl[i].enc); /* includes + 1 for term null */ b64_enc_len = apr_base64_encode_len(orig_len); diff --git a/test/testjson.c b/test/testjson.c index 7f2fd9c8b..88b176508 100644 --- a/test/testjson.c +++ b/test/testjson.c @@ -61,14 +61,14 @@ static void test_json_identity(abts_case * tc, void *data) ABTS_STR_NEQUAL(tc, src, buf, len); - ABTS_INT_EQUAL(tc, len, offset); + ABTS_SIZE_EQUAL(tc, len, (apr_size_t)offset); ABTS_INT_EQUAL(tc, APR_JSON_OBJECT, json->type); image = apr_hash_get(json->value.object->hash, "Image", 5); ABTS_PTR_NOTNULL(tc, image); width = apr_hash_get(image->v->value.object->hash, "Width", 5); ABTS_PTR_NOTNULL(tc, width); ABTS_INT_EQUAL(tc, APR_JSON_LONG, width->v->type); - ABTS_INT_EQUAL(tc, 800, width->v->value.lnumber); + ABTS_LLONG_EQUAL(tc, 800, width->v->value.lnumber); ids = apr_hash_get(image->v->value.object->hash, "IDs", 3); ABTS_PTR_NOTNULL(tc, ids); ABTS_INT_EQUAL(tc, APR_JSON_ARRAY, ids->v->type); @@ -85,7 +85,7 @@ static void test_json_identity(abts_case * tc, void *data) height = apr_hash_get(image->v->value.object->hash, "Height", 6); ABTS_PTR_NOTNULL(tc, height); ABTS_INT_EQUAL(tc, APR_JSON_LONG, height->v->type); - ABTS_INT_EQUAL(tc, 600, height->v->value.lnumber); + ABTS_LLONG_EQUAL(tc, 600, height->v->value.lnumber); } diff --git a/test/testmd5.c b/test/testmd5.c index 4e13da237..a9355d20d 100644 --- a/test/testmd5.c +++ b/test/testmd5.c @@ -55,7 +55,7 @@ static void test_md5sum(abts_case *tc, void *data) unsigned char digest[APR_MD5_DIGESTSIZE]; const void *string = md5sums[count].string; const void *sum = md5sums[count].digest; - unsigned int len = strlen(string); + unsigned int len = (unsigned int)strlen(string); ABTS_ASSERT(tc, "apr_md5_init", (apr_md5_init(&context) == 0)); ABTS_ASSERT(tc, "apr_md5_update", diff --git a/test/testmmap.c b/test/testmmap.c index f37c0e3ad..a50569c41 100644 --- a/test/testmmap.c +++ b/test/testmmap.c @@ -98,8 +98,9 @@ static void test_get_filesize(abts_case *tc, void *data) rv = apr_file_info_get(&thisfinfo, APR_FINFO_NORM, thefile); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + ABTS_TRUE(tc, thisfinfo.size == (apr_off_t)(apr_size_t)thisfinfo.size); - thisfsize = thisfinfo.size; + thisfsize = (apr_size_t)thisfinfo.size; thisfdata = apr_palloc(ptest, thisfsize + 1); ABTS_PTR_NOTNULL(tc, thisfdata); } @@ -110,6 +111,8 @@ static void read_expected_contents(abts_case *tc, void *data) apr_size_t nbytes = 0; apr_status_t rv; + ABTS_TRUE(tc, *offset == (apr_off_t)(apr_size_t)*offset); + rv = apr_file_read_full(thefile, thisfdata, thisfsize, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_ASSERT(tc, "File size mismatch", nbytes == thisfsize); @@ -124,7 +127,7 @@ static void read_expected_contents(abts_case *tc, void *data) * all over the place in the next tests. */ thisfdata += *offset; - thisfsize -= *offset; + thisfsize -= (apr_size_t)*offset; } static void test_mmap_create(abts_case *tc, void *data) diff --git a/test/testpass.c b/test/testpass.c index 4ba5c6952..e11fe81cb 100644 --- a/test/testpass.c +++ b/test/testpass.c @@ -125,7 +125,7 @@ static void test_shapass(abts_case *tc, void *data) const char *pass2 = "hellojed2"; char hash[100]; - apr_sha1_base64(pass, strlen(pass), hash); + apr_sha1_base64(pass, (unsigned int)strlen(pass), hash); APR_ASSERT_SUCCESS(tc, "SHA1 password validated", apr_password_validate(pass, hash)); |