aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Dias Correa <rodrigo@correas.us>2020-11-10 02:28:50 -0300
committerRodrigo Dias Correa <rodrigo@correas.us>2020-11-28 14:04:49 -0300
commitd552630f33526b448d5555afd853ac80a4ddb7d5 (patch)
tree178844eb3ef0532330b776a4076db4bfa25ca136
parent1a0c7fb38355ace2edade9a124b73e989de08f32 (diff)
downloadmbedtls-d552630f33526b448d5555afd853ac80a4ddb7d5.zip
mbedtls-d552630f33526b448d5555afd853ac80a4ddb7d5.tar.gz
mbedtls-d552630f33526b448d5555afd853ac80a4ddb7d5.tar.bz2
Fix GCC warning about `test_snprintf`
GCC 11 generated the warnings because the parameter `ret_buf` was declared as `const char[10]`, but some of the arguments provided in `run_test_snprintf` are shorter literals, like "". Now the type of `ret_buf` is `const char *`. Both implementations of `test_snprintf` were fixed. Signed-off-by: Rodrigo Dias Correa <rodrigo@correas.us>
-rw-r--r--programs/test/selftest.c2
-rw-r--r--tests/suites/host_test.function2
2 files changed, 2 insertions, 2 deletions
diff --git a/programs/test/selftest.c b/programs/test/selftest.c
index 9bc9a9c..fe35bb1 100644
--- a/programs/test/selftest.c
+++ b/programs/test/selftest.c
@@ -185,7 +185,7 @@ static int calloc_self_test( int verbose )
}
#endif /* MBEDTLS_SELF_TEST */
-static int test_snprintf( size_t n, const char ref_buf[10], int ref_ret )
+static int test_snprintf( size_t n, const char *ref_buf, int ref_ret )
{
int ret;
char buf[10] = "xxxxxxxxx";
diff --git a/tests/suites/host_test.function b/tests/suites/host_test.function
index ca51e7b..1178135 100644
--- a/tests/suites/host_test.function
+++ b/tests/suites/host_test.function
@@ -330,7 +330,7 @@ static int convert_params( size_t cnt , char ** params , int * int_params_store
#if defined(__GNUC__)
__attribute__((__noinline__))
#endif
-static int test_snprintf( size_t n, const char ref_buf[10], int ref_ret )
+static int test_snprintf( size_t n, const char *ref_buf, int ref_ret )
{
int ret;
char buf[10] = "xxxxxxxxx";