From 6dc3422d48b002887ae3a78afdf626f792397c06 Mon Sep 17 00:00:00 2001 From: Marcel Raad Date: Fri, 5 May 2017 21:29:50 +0200 Subject: tests: fix -Wcast-qual warnings Avoid casting string literals to non-const char *. --- tests/libtest/first.c | 2 +- tests/libtest/lib506.c | 4 ++-- tests/libtest/lib586.c | 4 ++-- tests/libtest/test.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'tests/libtest') diff --git a/tests/libtest/first.c b/tests/libtest/first.c index 231ae368c..72140e314 100644 --- a/tests/libtest/first.c +++ b/tests/libtest/first.c @@ -116,7 +116,7 @@ static void memory_tracking_init(void) #endif /* returns a hexdump in a static memory area */ -char *hexdump(unsigned char *buffer, size_t len) +char *hexdump(const unsigned char *buffer, size_t len) { static char dump[200*3+1]; char *p = dump; diff --git a/tests/libtest/lib506.c b/tests/libtest/lib506.c index b8db83cb6..d26252b6f 100644 --- a/tests/libtest/lib506.c +++ b/tests/libtest/lib506.c @@ -33,7 +33,7 @@ struct Tdata { }; struct userdata { - char *text; + const char *text; int counter; }; @@ -184,7 +184,7 @@ int test(char *URL) int i; struct userdata user; - user.text = (char *)"Pigs in space"; + user.text = "Pigs in space"; user.counter = 0; printf("GLOBAL_INIT\n"); diff --git a/tests/libtest/lib586.c b/tests/libtest/lib586.c index a4fc6feee..859ef3430 100644 --- a/tests/libtest/lib586.c +++ b/tests/libtest/lib586.c @@ -31,7 +31,7 @@ struct Tdata { }; struct userdata { - char *text; + const char *text; int counter; }; @@ -138,7 +138,7 @@ int test(char *URL) int i; struct userdata user; - user.text = (char *)"Pigs in space"; + user.text = "Pigs in space"; user.counter = 0; printf("GLOBAL_INIT\n"); diff --git a/tests/libtest/test.h b/tests/libtest/test.h index 3da03b838..bb1acca0e 100644 --- a/tests/libtest/test.h +++ b/tests/libtest/test.h @@ -67,7 +67,7 @@ extern void wait_ms(int ms); /* wait this many milliseconds */ extern int test(char *URL); /* the actual test function provided by each individual libXXX.c file */ -extern char *hexdump(unsigned char *buffer, size_t len); +extern char *hexdump(const unsigned char *buffer, size_t len); #ifdef UNITTESTS extern int unitfail; -- cgit v1.2.3