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;
const char *env;
int arg = 1;
char *helper_user = (char *)"unknown";
char *helper_proto = (char *)"unknown";
char *helper_domain = (char *)"unknown";
const char *helper_user = "unknown";
const char *helper_proto = "unknown";
const char *helper_domain = "unknown";
bool use_cached_creds = FALSE;
char *msgbuf;

View File

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

View File

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

View File

@ -130,7 +130,7 @@ static curl_socket_t all_sockets[MAX_SOCKETS];
static size_t num_sockets = 0;
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
@ -843,7 +843,7 @@ static int ProcessRequest(struct httprequest *req)
}
/* 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 error = 0;
@ -1965,7 +1965,7 @@ int main(int argc, char *argv[])
const char *unix_socket = NULL;
bool unlink_socket = false;
#endif
char *pidname= (char *)".http.pid";
const char *pidname = ".http.pid";
struct httprequest req;
int rc = 0;
int error;
@ -2315,7 +2315,7 @@ int main(int argc, char *argv[])
if(req.connmon) {
const char *keepopen="[DISCONNECT]\n";
storerequest((char *)keepopen, strlen(keepopen));
storerequest(keepopen, strlen(keepopen));
}
if(!req.open)

View File

@ -208,7 +208,7 @@ static bool use_ipv6 = FALSE;
static const char *ipv_inuse = "IPv4";
const char *serverlogfile = DEFAULT_LOGFILE;
static char *pidname= (char *)".tftpd.pid";
static const char *pidname = ".tftpd.pid";
static int serverlogslocked = 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
DWORD recvtimeout, recvtimeoutbak;
#endif
char *option = (char *)"mode"; /* mode is implicit */
const char *option = "mode"; /* mode is implicit */
int toggle = 1;
/* Open request dump file. */