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]
This commit is contained in:
Janne Grunau 2012-10-25 15:55:05 +02:00
parent bf5f46b4cc
commit 39c4afd926

View File

@ -1478,7 +1478,8 @@ enum RedirType {
/* parse http request and prepare header */ /* parse http request and prepare header */
static int http_parse_request(HTTPContext *c) static int http_parse_request(HTTPContext *c)
{ {
char *p; const char *p;
char *p1;
enum RedirType redir_type; enum RedirType redir_type;
char cmd[32]; char cmd[32];
char info[1024], filename[1024]; char info[1024], filename[1024];
@ -1489,10 +1490,10 @@ static int http_parse_request(HTTPContext *c)
FFStream *stream; FFStream *stream;
int i; int i;
char ratebuf[32]; char ratebuf[32];
char *useragent = 0; const char *useragent = 0;
p = c->buffer; 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)); av_strlcpy(c->method, cmd, sizeof(c->method));
if (!strcmp(cmd, "GET")) if (!strcmp(cmd, "GET"))
@ -1502,7 +1503,7 @@ static int http_parse_request(HTTPContext *c)
else else
return -1; return -1;
get_word(url, sizeof(url), (const char **)&p); get_word(url, sizeof(url), &p);
av_strlcpy(c->url, url, sizeof(c->url)); av_strlcpy(c->url, url, sizeof(c->url));
get_word(protocol, sizeof(protocol), (const char **)&p); 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); 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 */ /* find the filename and the optional info string in the request */
p = strchr(url, '?'); p1 = strchr(url, '?');
if (p) { if (p1) {
av_strlcpy(info, p, sizeof(info)); av_strlcpy(info, p1, sizeof(info));
*p = '\0'; *p1 = '\0';
} else } else
info[0] = '\0'; info[0] = '\0';
@ -1635,7 +1636,7 @@ static int http_parse_request(HTTPContext *c)
} }
if (redir_type != REDIR_NONE) { if (redir_type != REDIR_NONE) {
char *hostinfo = 0; const char *hostinfo = 0;
for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) { for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
if (av_strncasecmp(p, "Host:", 5) == 0) { if (av_strncasecmp(p, "Host:", 5) == 0) {
@ -1764,7 +1765,7 @@ static int http_parse_request(HTTPContext *c)
if (!stream->is_feed) { if (!stream->is_feed) {
/* However it might be a status report from WMP! Let us log the /* However it might be a status report from WMP! Let us log the
* data as it might come in handy one day. */ * data as it might come in handy one day. */
char *logline = 0; const char *logline = 0;
int client_id = 0; int client_id = 0;
for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) { for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {