History

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]

Janne Grunau committed 14 years ago

Commit 39c4afd1 parent bf5f46b1 file · +11 −10Browse files

Showing the changes to avserver.c (1 of 1 file). Show all

Unified · Split

avserver.c+11−10
@@ -1478,7 +1478,8 @@ enum RedirType { · 1477 unmodified lines
14781478 /* parse http request and prepare header */
14791479 static int http_parse_request(HTTPContext *c)
14801480 {
1481− char *p;
1481+ const char *p;
1482+ char *p1;
14821483 enum RedirType redir_type;
14831484 char cmd[32];
14841485 char info[1024], filename[1024];
@@ -1489,10 +1490,10 @@ static int http_parse_request(HTTPContext *c) · 4 unmodified lines
14891490 FFStream *stream;
14901491 int i;
14911492 char ratebuf[32];
1492− char *useragent = 0;
1493+ const char *useragent = 0;
14931494
14941495 p = c->buffer;
1495− get_word(cmd, sizeof(cmd), (const char **)&p);
1496+ get_word(cmd, sizeof(cmd), &p);
14961497 av_strlcpy(c->method, cmd, sizeof(c->method));
14971498
14981499 if (!strcmp(cmd, "GET"))
@@ -1502,7 +1503,7 @@ static int http_parse_request(HTTPContext *c) · 3 unmodified lines
15021503 else
15031504 return -1;
15041505
1505− get_word(url, sizeof(url), (const char **)&p);
1506+ get_word(url, sizeof(url), &p);
15061507 av_strlcpy(c->url, url, sizeof(c->url));
15071508
15081509 get_word(protocol, sizeof(protocol), (const char **)&p);
@@ -1515,10 +1516,10 @@ static int http_parse_request(HTTPContext *c) · 6 unmodified lines
15151516 http_log("%s - - New connection: %s %s\n", inet_ntoa(c->from_addr.sin_addr), cmd, url);
15161517
15171518 /* find the filename and the optional info string in the request */
1518− p = strchr(url, '?');
1519− if (p) {
1520− av_strlcpy(info, p, sizeof(info));
1521− *p = '\0';
1519+ p1 = strchr(url, '?');
1520+ if (p1) {
1521+ av_strlcpy(info, p1, sizeof(info));
1522+ *p1 = '\0';
15221523 } else
15231524 info[0] = '\0';
15241525
@@ -1635,7 +1636,7 @@ static int http_parse_request(HTTPContext *c) · 110 unmodified lines
16351636 }
16361637
16371638 if (redir_type != REDIR_NONE) {
1638− char *hostinfo = 0;
1639+ const char *hostinfo = 0;
16391640
16401641 for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
16411642 if (av_strncasecmp(p, "Host:", 5) == 0) {
@@ -1764,7 +1765,7 @@ static int http_parse_request(HTTPContext *c) · 122 unmodified lines
17641765 if (!stream->is_feed) {
17651766 /* However it might be a status report from WMP! Let us log the
17661767 * data as it might come in handy one day. */
1767− char *logline = 0;
1768+ const char *logline = 0;
17681769 int client_id = 0;
17691770
17701771 for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t