diff options
author | Janne Grunau <janne-libav@jannau.net> | 2012-10-25 17:55:05 +0400 |
---|---|---|
committer | Janne Grunau <janne-libav@jannau.net> | 2012-11-15 21:04:53 +0400 |
commit | 39c4afd926944a716c3b11b321cea7f7c798e9e7 (patch) | |
tree | cf688b1c3b7716c0bab30503219ad7e9c481f44c | |
parent | bf5f46b4cc47b7a4568119f224057d4ff91b6cdd (diff) |
avserver: fix constness casting warnings
Use a different char* for extracting info string from the URL. The
other pointer can be made const then which elimates the need for a
cast and fixes the following warnings:
warning: to be safe all intermediate pointers in cast from ‘char **’ to
‘const char **’ must be ‘const’ qualified [-Wcast-qual]
-rw-r--r-- | avserver.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/avserver.c b/avserver.c index 9f6b9d9405..7b38c23dc3 100644 --- a/avserver.c +++ b/avserver.c @@ -1478,7 +1478,8 @@ enum RedirType { /* parse http request and prepare header */ static int http_parse_request(HTTPContext *c) { - char *p; + const char *p; + char *p1; enum RedirType redir_type; char cmd[32]; char info[1024], filename[1024]; @@ -1489,10 +1490,10 @@ static int http_parse_request(HTTPContext *c) FFStream *stream; int i; char ratebuf[32]; - char *useragent = 0; + const char *useragent = 0; p = c->buffer; - get_word(cmd, sizeof(cmd), (const char **)&p); + get_word(cmd, sizeof(cmd), &p); av_strlcpy(c->method, cmd, sizeof(c->method)); if (!strcmp(cmd, "GET")) @@ -1502,7 +1503,7 @@ static int http_parse_request(HTTPContext *c) else return -1; - get_word(url, sizeof(url), (const char **)&p); + get_word(url, sizeof(url), &p); av_strlcpy(c->url, url, sizeof(c->url)); get_word(protocol, sizeof(protocol), (const char **)&p); @@ -1515,10 +1516,10 @@ static int http_parse_request(HTTPContext *c) http_log("%s - - New connection: %s %s\n", inet_ntoa(c->from_addr.sin_addr), cmd, url); /* find the filename and the optional info string in the request */ - p = strchr(url, '?'); - if (p) { - av_strlcpy(info, p, sizeof(info)); - *p = '\0'; + p1 = strchr(url, '?'); + if (p1) { + av_strlcpy(info, p1, sizeof(info)); + *p1 = '\0'; } else info[0] = '\0'; @@ -1635,7 +1636,7 @@ static int http_parse_request(HTTPContext *c) } if (redir_type != REDIR_NONE) { - char *hostinfo = 0; + const char *hostinfo = 0; for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) { if (av_strncasecmp(p, "Host:", 5) == 0) { @@ -1764,7 +1765,7 @@ static int http_parse_request(HTTPContext *c) if (!stream->is_feed) { /* However it might be a status report from WMP! Let us log the * data as it might come in handy one day. */ - char *logline = 0; + const char *logline = 0; int client_id = 0; for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) { |