1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

tests/server: make string literals const

assign string literals to const char * instead of char * in order to
avoid a lot of these warnings:
cast from 'const char *' to 'char *' drops const qualifier
[-Wcast-qual]
This commit is contained in:
Marcel Raad 2017-05-04 20:19:10 +02:00
parent 07fd7871b3
commit 4032c5da84
No known key found for this signature in database
GPG Key ID: B4668817AE6D6CD4
5 changed files with 12 additions and 12 deletions

View File

@ -120,9 +120,9 @@ int main(int argc, char *argv[])
long testnum; long testnum;
const char *env; const char *env;
int arg = 1; int arg = 1;
char *helper_user = (char *)"unknown"; const char *helper_user = "unknown";
char *helper_proto = (char *)"unknown"; const char *helper_proto = "unknown";
char *helper_domain = (char *)"unknown"; const char *helper_domain = "unknown";
bool use_cached_creds = FALSE; bool use_cached_creds = FALSE;
char *msgbuf; char *msgbuf;

View File

@ -1190,7 +1190,7 @@ int main(int argc, char *argv[])
int wrotepidfile = 0; int wrotepidfile = 0;
int flag; int flag;
unsigned short port = DEFAULT_PORT; unsigned short port = DEFAULT_PORT;
char *pidname= (char *)".rtsp.pid"; const char *pidname = ".rtsp.pid";
struct httprequest req; struct httprequest req;
int rc; int rc;
int error; int error;

View File

@ -405,7 +405,7 @@ static ssize_t fullwrite(int filedes, const void *buffer, size_t nbytes)
ssize_t nwrite = 0; ssize_t nwrite = 0;
do { do {
wc = write(filedes, (unsigned char *)buffer + nwrite, nbytes - nwrite); wc = write(filedes, (const unsigned char *)buffer + nwrite, nbytes - nwrite);
if(got_exit_signal) { if(got_exit_signal) {
logmsg("signalled to die"); logmsg("signalled to die");
@ -1338,7 +1338,7 @@ int main(int argc, char *argv[])
curl_socket_t sock = CURL_SOCKET_BAD; curl_socket_t sock = CURL_SOCKET_BAD;
curl_socket_t msgsock = CURL_SOCKET_BAD; curl_socket_t msgsock = CURL_SOCKET_BAD;
int wrotepidfile = 0; int wrotepidfile = 0;
char *pidname= (char *)".sockfilt.pid"; const char *pidname = ".sockfilt.pid";
bool juggle_again; bool juggle_again;
int rc; int rc;
int error; int error;

View File

@ -130,7 +130,7 @@ static curl_socket_t all_sockets[MAX_SOCKETS];
static size_t num_sockets = 0; static size_t num_sockets = 0;
static int ProcessRequest(struct httprequest *req); static int ProcessRequest(struct httprequest *req);
static void storerequest(char *reqbuf, size_t totalsize); static void storerequest(const char *reqbuf, size_t totalsize);
#define DEFAULT_PORT 8999 #define DEFAULT_PORT 8999
@ -843,7 +843,7 @@ static int ProcessRequest(struct httprequest *req)
} }
/* store the entire request in a file */ /* store the entire request in a file */
static void storerequest(char *reqbuf, size_t totalsize) static void storerequest(const char *reqbuf, size_t totalsize)
{ {
int res; int res;
int error = 0; int error = 0;
@ -1965,7 +1965,7 @@ int main(int argc, char *argv[])
const char *unix_socket = NULL; const char *unix_socket = NULL;
bool unlink_socket = false; bool unlink_socket = false;
#endif #endif
char *pidname= (char *)".http.pid"; const char *pidname = ".http.pid";
struct httprequest req; struct httprequest req;
int rc = 0; int rc = 0;
int error; int error;
@ -2315,7 +2315,7 @@ int main(int argc, char *argv[])
if(req.connmon) { if(req.connmon) {
const char *keepopen="[DISCONNECT]\n"; const char *keepopen="[DISCONNECT]\n";
storerequest((char *)keepopen, strlen(keepopen)); storerequest(keepopen, strlen(keepopen));
} }
if(!req.open) if(!req.open)

View File

@ -208,7 +208,7 @@ static bool use_ipv6 = FALSE;
static const char *ipv_inuse = "IPv4"; static const char *ipv_inuse = "IPv4";
const char *serverlogfile = DEFAULT_LOGFILE; const char *serverlogfile = DEFAULT_LOGFILE;
static char *pidname= (char *)".tftpd.pid"; static const char *pidname = ".tftpd.pid";
static int serverlogslocked = 0; static int serverlogslocked = 0;
static int wrotepidfile = 0; static int wrotepidfile = 0;
@ -960,7 +960,7 @@ static int do_tftp(struct testcase *test, struct tftphdr *tp, ssize_t size)
#ifdef USE_WINSOCK #ifdef USE_WINSOCK
DWORD recvtimeout, recvtimeoutbak; DWORD recvtimeout, recvtimeoutbak;
#endif #endif
char *option = (char *)"mode"; /* mode is implicit */ const char *option = "mode"; /* mode is implicit */
int toggle = 1; int toggle = 1;
/* Open request dump file. */ /* Open request dump file. */