aboutsummaryrefslogtreecommitdiff
path: root/tests/server/rtspd.c
diff options
context:
space:
mode:
authorMarian Klymov <nekto1989@gmail.com>2018-06-02 23:52:56 +0300
committerDaniel Stenberg <daniel@haxx.se>2018-06-11 11:14:48 +0200
commitc45360d4633850839bb9c2d77dbf8a8285e9ad49 (patch)
tree20159c553a74ed98c2431fc8f2852067f79ac4e9 /tests/server/rtspd.c
parent38203f1585da53e07e54e37c7d5da4d72f509a2e (diff)
cppcheck: fix warnings
- Get rid of variable that was generating false positive warning (unitialized) - Fix issues in tests - Reduce scope of several variables all over etc Closes #2631
Diffstat (limited to 'tests/server/rtspd.c')
-rw-r--r--tests/server/rtspd.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/tests/server/rtspd.c b/tests/server/rtspd.c
index 955e9a233..4519eab60 100644
--- a/tests/server/rtspd.c
+++ b/tests/server/rtspd.c
@@ -340,11 +340,8 @@ static int ProcessRequest(struct httprequest *req)
static char request[REQUEST_KEYWORD_SIZE];
static char doc[MAXDOCNAMELEN];
static char prot_str[5];
- char logbuf[256];
int prot_major, prot_minor;
- char *end;
- int error;
- end = strstr(line, END_OF_HEADERS);
+ char *end = strstr(line, END_OF_HEADERS);
logmsg("ProcessRequest() called with testno %ld and line [%s]",
req->testno, line);
@@ -360,6 +357,7 @@ static int ProcessRequest(struct httprequest *req)
&prot_major,
&prot_minor) == 5) {
char *ptr;
+ char logbuf[256];
if(!strcmp(prot_str, "HTTP")) {
req->protocol = RPROT_HTTP;
@@ -426,7 +424,7 @@ static int ProcessRequest(struct httprequest *req)
stream = fopen(filename, "rb");
if(!stream) {
- error = errno;
+ int error = errno;
logmsg("fopen() failed with error: %d %s", error, strerror(error));
logmsg("Error opening file: %s", filename);
logmsg("Couldn't open test file %ld", req->testno);
@@ -441,11 +439,10 @@ static int ProcessRequest(struct httprequest *req)
int rtp_channel = 0;
int rtp_size = 0;
int rtp_partno = -1;
- int i = 0;
char *rtp_scratch = NULL;
/* get the custom server control "commands" */
- error = getpart(&cmd, &cmdsize, "reply", "servercmd", stream);
+ int error = getpart(&cmd, &cmdsize, "reply", "servercmd", stream);
fclose(stream);
if(error) {
logmsg("getpart() failed with error: %d", error);
@@ -486,6 +483,7 @@ static int ProcessRequest(struct httprequest *req)
&rtp_partno, &rtp_channel, &rtp_size)) {
if(rtp_partno == req->partno) {
+ int i = 0;
logmsg("RTP: part %d channel %d size %d",
rtp_partno, rtp_channel, rtp_size);
@@ -900,7 +898,6 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
size_t count;
const char *buffer;
char *ptr = NULL;
- FILE *stream;
char *cmd = NULL;
size_t cmdsize = 0;
FILE *dump;
@@ -912,8 +909,6 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
static char weare[256];
- char partbuf[80]="data";
-
logmsg("Send response number %ld part %ld", req->testno, req->partno);
switch(req->rcmd) {
@@ -987,7 +982,8 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
}
else {
char *filename = test2file(req->testno);
-
+ char partbuf[80]="data";
+ FILE *stream;
if(0 != req->partno)
snprintf(partbuf, sizeof(partbuf), "data%ld", req->partno);