summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68>2019-03-22 23:40:42 +0000
committerylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68>2019-03-22 23:40:42 +0000
commitf5daac910a03a8d14e334a0a2c3d1c7bcc3ea4a3 (patch)
tree888862787759d46ed42dfd00c39aecad09363516
parent5526c1396ea1b9b12a1b63318b6b84b3ef54c3a2 (diff)
downloadlibapr-f5daac910a03a8d14e334a0a2c3d1c7bcc3ea4a3.tar.gz
testencode: fix compilation on VS.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1856096 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--test/testencode.c39
1 files changed, 11 insertions, 28 deletions
diff --git a/test/testencode.c b/test/testencode.c
index 46e694954..99bc92d79 100644
--- a/test/testencode.c
+++ b/test/testencode.c
@@ -78,7 +78,10 @@ static void test_encode_base64_binary(abts_case * tc, void *data)
{
apr_pool_t *pool;
const char *target;
- const unsigned char *usrc;
+ const unsigned char usrc_empty[] = { },
+ usrc_f[] = { 'f' },
+ usrc_fo[] = { 'f', 'o' },
+ usrc_foo[] = { 'f', 'o', 'o' };
const char *dest;
apr_size_t len;
@@ -87,52 +90,32 @@ static void test_encode_base64_binary(abts_case * tc, void *data)
/*
* Test vectors from https://tools.ietf.org/html/rfc4648#section-10
*/
- usrc = (unsigned char[]){
- };
target = "";
- dest = apr_pencode_base64_binary(pool, usrc, 0, APR_ENCODE_NONE, &len);
+ dest = apr_pencode_base64_binary(pool, usrc_empty, 0, APR_ENCODE_NONE, &len);
ABTS_STR_EQUAL(tc, target, dest);
- usrc = (unsigned char[]){
- 'f'
- };
target = "Zg==";
- dest = apr_pencode_base64_binary(pool, usrc, 1, APR_ENCODE_NONE, &len);
+ dest = apr_pencode_base64_binary(pool, usrc_f, 1, APR_ENCODE_NONE, &len);
ABTS_STR_EQUAL(tc, target, dest);
- usrc = (unsigned char[]){
- 'f'
- };
target = "Zg";
- dest = apr_pencode_base64_binary(pool, usrc, 1, APR_ENCODE_NOPADDING, &len);
+ dest = apr_pencode_base64_binary(pool, usrc_f, 1, APR_ENCODE_NOPADDING, &len);
ABTS_STR_EQUAL(tc, target, dest);
- usrc = (unsigned char[]){
- 'f', 'o'
- };
target = "Zm8=";
- dest = apr_pencode_base64_binary(pool, usrc, 2, APR_ENCODE_NONE, &len);
+ dest = apr_pencode_base64_binary(pool, usrc_fo, 2, APR_ENCODE_NONE, &len);
ABTS_STR_EQUAL(tc, target, dest);
- usrc = (unsigned char[]){
- 'f', 'o'
- };
target = "Zm8";
- dest = apr_pencode_base64_binary(pool, usrc, 2, APR_ENCODE_NOPADDING, &len);
+ dest = apr_pencode_base64_binary(pool, usrc_fo, 2, APR_ENCODE_NOPADDING, &len);
ABTS_STR_EQUAL(tc, target, dest);
- usrc = (unsigned char[]){
- 'f', 'o', 'o'
- };
target = "Zm9v";
- dest = apr_pencode_base64_binary(pool, usrc, 3, APR_ENCODE_NONE, &len);
+ dest = apr_pencode_base64_binary(pool, usrc_foo, 3, APR_ENCODE_NONE, &len);
ABTS_STR_EQUAL(tc, target, dest);
- usrc = (unsigned char[]){
- 'f', 'o', 'o'
- };
target = "Zm9v";
- dest = apr_pencode_base64_binary(pool, usrc, 3, APR_ENCODE_NOPADDING, &len);
+ dest = apr_pencode_base64_binary(pool, usrc_foo, 3, APR_ENCODE_NOPADDING, &len);
ABTS_STR_EQUAL(tc, target, dest);
apr_pool_destroy(pool);