summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Raad <raad@teamviewer.com>2017-05-05 21:29:50 +0200
committerMarcel Raad <raad@teamviewer.com>2017-05-05 21:29:50 +0200
commit6dc3422d48b002887ae3a78afdf626f792397c06 (patch)
tree560021e5413048cdb12c085e0b46ec9bc2512b58
parent2b7bde4d3f08f1414fd73cb908d60e53949c33da (diff)
downloadcurl-6dc3422d48b002887ae3a78afdf626f792397c06.tar.gz
tests: fix -Wcast-qual warnings
Avoid casting string literals to non-const char *.
-rw-r--r--tests/libtest/first.c2
-rw-r--r--tests/libtest/lib506.c4
-rw-r--r--tests/libtest/lib586.c4
-rw-r--r--tests/libtest/test.h2
-rw-r--r--tests/unit/curlcheck.h7
-rw-r--r--tests/unit/unit1395.c2
6 files changed, 11 insertions, 10 deletions
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;
diff --git a/tests/unit/curlcheck.h b/tests/unit/curlcheck.h
index 0660e2bed..46cb84aaf 100644
--- a/tests/unit/curlcheck.h
+++ b/tests/unit/curlcheck.h
@@ -39,9 +39,10 @@
#define verify_memory(dynamic, check, len) \
if(dynamic && memcmp(dynamic, check, len)) { \
fprintf(stderr, "%s:%d Memory buffer mismatch size %d. '%s' is not\n", \
- __FILE__, __LINE__, len, hexdump((unsigned char *)check, len)); \
- fprintf(stderr, "%s:%d the same as '%s'\n", \
- __FILE__, __LINE__, hexdump((unsigned char *)dynamic, len)); \
+ __FILE__, __LINE__, len, \
+ hexdump((const unsigned char *)check, len)); \
+ fprintf(stderr, "%s:%d the same as '%s'\n", __FILE__, __LINE__, \
+ hexdump((const unsigned char *)dynamic, len)); \
unitfail++; \
}
diff --git a/tests/unit/unit1395.c b/tests/unit/unit1395.c
index 13f464134..ba8e14f45 100644
--- a/tests/unit/unit1395.c
+++ b/tests/unit/unit1395.c
@@ -68,7 +68,7 @@ UNITTEST_START
};
for(i=0; i < sizeof(pairs)/sizeof(pairs[0]); i++) {
- char *out = Curl_dedotdotify((char *)pairs[i].input);
+ char *out = Curl_dedotdotify(pairs[i].input);
abort_unless(out != NULL, "returned NULL!");
if(strcmp(out, pairs[i].output)) {