[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 98/254: tests: fix -Wcast-qual warnings
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 98/254: tests: fix -Wcast-qual warnings |
Date: |
Sat, 17 Jun 2017 16:52:10 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to annotated tag gnurl-7.54.1
in repository gnurl.
commit 6dc3422d48b002887ae3a78afdf626f792397c06
Author: Marcel Raad <address@hidden>
AuthorDate: Fri May 5 21:29:50 2017 +0200
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 +-
tests/unit/curlcheck.h | 7 ++++---
tests/unit/unit1395.c | 2 +-
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)) {
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 206/254: curl_endian: remove unused functions, (continued)
- [GNUnet-SVN] [gnurl] 206/254: curl_endian: remove unused functions, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 169/254: examples: fix Wimplicit-fallthrough warnings, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 158/254: cmake: remove CURL_CA_BUNDLE from cmake TODO, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 178/254: RELEASE-NOTES: synced with 3aaac8c2f, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 202/254: typecheck-gcc.h: check CURLINFO_CERTINFO, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 230/254: test1521: make the code < 80 columns wide, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 72/254: ssh: fix compiler warning from e40e9d7f0de, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 50/254: curl_setup: Ensure no more than one IDN lib is enabled, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 120/254: formboundary: convert assert into run-time check, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 114/254: tool_msgs: remove wrong cast, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 98/254: tests: fix -Wcast-qual warnings,
gnunet <=
- [GNUnet-SVN] [gnurl] 228/254: typecheck-gcc: allow CURLOPT_STDERR to be NULL too, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 212/254: tool_util: remove unused tvdiff_secs and remove tool_ prefix, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 143/254: RELEASE-NOTES: synced with eb16305e6, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 93/254: unit1305: fix compiler warning, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 226/254: test1538: added "verbose logs" keyword, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 239/254: examples/multi-uv.c: fix deprecated symbol, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 159/254: cmake: remove unused variables: GNUTLS_ENABLED, NSS_ENABLED, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 173/254: TODO: 6.4 is done, send telnet data in chunks, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 221/254: BINDINGS: add Ring binding, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 216/254: x509asn1: fix implicit-fallthrough warning with GCC 7, gnunet, 2017/06/17