From ac60bf66a98b486bb6616698f978026f636b64bc Mon Sep 17 00:00:00 2001 From: frekky Date: Sat, 21 Nov 2015 19:38:06 +0800 Subject: [PATCH] Fixed unsigned assignment warnings in tests --- tests/base32.c | 8 ++++---- tests/base64.c | 8 ++++---- tests/dns.c | 4 ++-- tests/encoding.c | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/base32.c b/tests/base32.c index 4b460e2..9c9fdff 100644 --- a/tests/base32.c +++ b/tests/base32.c @@ -49,7 +49,7 @@ START_TEST(test_base32_encode) b32 = get_base32_encoder(); len = sizeof(buf); - val = b32->encode(buf, &len, testpairs[_i].a, strlen(testpairs[_i].a)); + val = b32->encode((uint8_t *)buf, &len, (uint8_t *)testpairs[_i].a, strlen(testpairs[_i].a)); fail_unless(val == strlen(testpairs[_i].b)); fail_unless(strcmp(buf, testpairs[_i].b) == 0, @@ -67,7 +67,7 @@ START_TEST(test_base32_decode) b32 = get_base32_encoder(); len = sizeof(buf); - val = b32->decode(buf, &len, testpairs[_i].b, strlen(testpairs[_i].b)); + val = b32->decode((uint8_t *)buf, &len, (uint8_t *)testpairs[_i].b, strlen(testpairs[_i].b)); fail_unless(val == strlen(testpairs[_i].a)); fail_unless(strcmp(buf, testpairs[_i].a) == 0, @@ -110,7 +110,7 @@ START_TEST(test_base32_blksize) } rawbuf[i] = 0; - val = b32->encode(encbuf, &enclen, rawbuf, rawlen); + val = b32->encode((uint8_t *)encbuf, &enclen, (uint8_t *)rawbuf, rawlen); fail_unless(rawlen == 5, "raw length was %d not 5", rawlen); fail_unless(enclen == 5, "encoded %d bytes, not 5", enclen); @@ -119,7 +119,7 @@ START_TEST(test_base32_blksize) memset(rawbuf, 0, rawlen + 16); enclen = val; - val = b32->decode(rawbuf, &rawlen, encbuf, enclen); + val = b32->decode((uint8_t *)rawbuf, &rawlen, (uint8_t *)encbuf, enclen); fail_unless(rawlen == 5, "raw length was %d not 5", rawlen); fail_unless(val == 5, "val was not 5 but %d", val); diff --git a/tests/base64.c b/tests/base64.c index bcefc4c..e0d828f 100644 --- a/tests/base64.c +++ b/tests/base64.c @@ -75,7 +75,7 @@ START_TEST(test_base64_encode) b64 = get_base64_encoder(); len = sizeof(buf); - val = b64->encode(buf, &len, testpairs[_i].a, strlen(testpairs[_i].a)); + val = b64->encode((uint8_t *)buf, &len, (uint8_t *)testpairs[_i].a, strlen(testpairs[_i].a)); fail_unless(val == strlen(testpairs[_i].b)); fail_unless(strcmp(buf, testpairs[_i].b) == 0, @@ -93,7 +93,7 @@ START_TEST(test_base64_decode) b64 = get_base64_encoder(); len = sizeof(buf); - val = b64->decode(buf, &len, testpairs[_i].b, strlen(testpairs[_i].b)); + val = b64->decode((uint8_t *)buf, &len, (uint8_t *)testpairs[_i].b, strlen(testpairs[_i].b)); fail_unless(val == strlen(testpairs[_i].a)); fail_unless(strcmp(buf, testpairs[_i].a) == 0, @@ -124,7 +124,7 @@ START_TEST(test_base64_blksize) } rawbuf[i] = 0; - val = b64->encode(encbuf, &enclen, rawbuf, rawlen); + val = b64->encode((uint8_t *)encbuf, &enclen, (uint8_t *)rawbuf, rawlen); fail_unless(rawlen == 3, "raw length was %d not 3", rawlen); fail_unless(enclen == 3, "encoded %d bytes, not 3", enclen); @@ -133,7 +133,7 @@ START_TEST(test_base64_blksize) memset(rawbuf, 0, rawlen + 16); enclen = val; - val = b64->decode(rawbuf, &rawlen, encbuf, enclen); + val = b64->decode((uint8_t *)rawbuf, &rawlen, (uint8_t *)encbuf, enclen); fail_unless(rawlen == 3, "raw length was %d not 3", rawlen); fail_unless(val == 3); diff --git a/tests/dns.c b/tests/dns.c index 1f484ab..206df1f 100644 --- a/tests/dns.c +++ b/tests/dns.c @@ -86,7 +86,7 @@ START_TEST(test_encode_query) enc = get_base32_encoder(); *d++ = 'A'; - enc->encode(d, &enclen, innerData, strlen(innerData)); + enc->encode((uint8_t *)d, &enclen, (uint8_t *)innerData, strlen(innerData)); d = resolv + strlen(resolv); if (*d != '.') { *d++ = '.'; @@ -123,7 +123,7 @@ START_TEST(test_decode_query) dns_decode(buf, sizeof(buf), &q, QR_QUERY, query_packet, len); domain = strstr(q.name, topdomain); len = sizeof(buf); - unpack_data(buf, len, &(q.name[1]), (int) (domain - q.name) - 1, enc); + unpack_data((uint8_t *)buf, len, (uint8_t *)(q.name + 1), (int) (domain - q.name) - 1, enc); fail_unless(strncmp(buf, innerData, strlen(innerData)) == 0, "Did not extract expected host: '%s'", buf); fail_unless(strlen(buf) == strlen(innerData), "Bad host length: %d, expected %d: '%s'", strlen(buf), strlen(innerData), buf); diff --git a/tests/encoding.c b/tests/encoding.c index a2d5438..e736406 100644 --- a/tests/encoding.c +++ b/tests/encoding.c @@ -50,7 +50,7 @@ START_TEST(test_inline_dotify) memset(temp, 0, sizeof(temp)); strcpy(temp, dottests[_i].a); b = temp; - inline_dotify(b, sizeof(temp)); + inline_dotify((uint8_t *)b, sizeof(temp)); fail_unless(strcmp(dottests[_i].b, temp) == 0, "'%s' != '%s'", temp, dottests[_i].b); @@ -65,7 +65,7 @@ START_TEST(test_inline_undotify) memset(temp, 0, sizeof(temp)); strcpy(temp, dottests[_i].b); b = temp; - inline_undotify(b, sizeof(temp)); + inline_undotify((uint8_t *)b, sizeof(temp)); fail_unless(strcmp(dottests[_i].a, temp) == 0, "'%s' != '%s'", temp, dottests[_i].a); @@ -89,7 +89,7 @@ START_TEST(test_build_hostname) for (int j = 0; j < 10; j++) /* dummy header length */ for (i = 1; i < sizeof(data); i++) { buf[j] = j + 'A'; - int len = build_hostname(buf, buflen, data, i, topdomain, get_base32_encoder(), buflen, j); + int len = build_hostname((uint8_t *)buf, buflen, (uint8_t *)data, i, topdomain, get_base32_encoder(), buflen, j); fail_if(len > i); fail_if((strstr(buf, ".") - buf) > 63, "First label in encoded hostname >63 bytes!");