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
1478/* parse http request and prepare header */1478/* parse http request and prepare header */
1479static int http_parse_request(HTTPContext *c)1479static int http_parse_request(HTTPContext *c)
1480{1480{
1481 char *p;1481 const char *p;
1482 char *p1;
1482 enum RedirType redir_type;1483 enum RedirType redir_type;
1483 char cmd[32];1484 char cmd[32];
1484 char info[1024], filename[1024];1485 char info[1024], filename[1024];
@@ -1489,10 +1490,10 @@ static int http_parse_request(HTTPContext *c) · 4 unmodified lines
1489 FFStream *stream;1490 FFStream *stream;
1490 int i;1491 int i;
1491 char ratebuf[32];1492 char ratebuf[32];
1492 char *useragent = 0;1493 const char *useragent = 0;
1493 1494
1494 p = c->buffer;1495 p = c->buffer;
1495 get_word(cmd, sizeof(cmd), (const char **)&p);1496 get_word(cmd, sizeof(cmd), &p);
1496 av_strlcpy(c->method, cmd, sizeof(c->method));1497 av_strlcpy(c->method, cmd, sizeof(c->method));
1497 1498
1498 if (!strcmp(cmd, "GET"))1499 if (!strcmp(cmd, "GET"))
@@ -1502,7 +1503,7 @@ static int http_parse_request(HTTPContext *c) · 3 unmodified lines
1502 else1503 else
1503 return -1;1504 return -1;
1504 1505
1505 get_word(url, sizeof(url), (const char **)&p);1506 get_word(url, sizeof(url), &p);
1506 av_strlcpy(c->url, url, sizeof(c->url));1507 av_strlcpy(c->url, url, sizeof(c->url));
1507 1508
1508 get_word(protocol, sizeof(protocol), (const char **)&p);1509 get_word(protocol, sizeof(protocol), (const char **)&p);
@@ -1515,10 +1516,10 @@ static int http_parse_request(HTTPContext *c) · 6 unmodified lines
1515 http_log("%s - - New connection: %s %s\n", inet_ntoa(c->from_addr.sin_addr), cmd, url);1516 http_log("%s - - New connection: %s %s\n", inet_ntoa(c->from_addr.sin_addr), cmd, url);
1516 1517
1517 /* find the filename and the optional info string in the request */1518 /* find the filename and the optional info string in the request */
1518 p = strchr(url, '?');1519 p1 = strchr(url, '?');
1519 if (p) {1520 if (p1) {
1520 av_strlcpy(info, p, sizeof(info));1521 av_strlcpy(info, p1, sizeof(info));
1521 *p = '\0';1522 *p1 = '\0';
1522 } else1523 } else
1523 info[0] = '\0';1524 info[0] = '\0';
1524 1525
@@ -1635,7 +1636,7 @@ static int http_parse_request(HTTPContext *c) · 110 unmodified lines
1635 }1636 }
1636 1637
1637 if (redir_type != REDIR_NONE) {1638 if (redir_type != REDIR_NONE) {
1638 char *hostinfo = 0;1639 const char *hostinfo = 0;
1639 1640
1640 for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {1641 for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
1641 if (av_strncasecmp(p, "Host:", 5) == 0) {1642 if (av_strncasecmp(p, "Host:", 5) == 0) {
@@ -1764,7 +1765,7 @@ static int http_parse_request(HTTPContext *c) · 122 unmodified lines
1764 if (!stream->is_feed) {1765 if (!stream->is_feed) {
1765 /* However it might be a status report from WMP! Let us log the1766 /* However it might be a status report from WMP! Let us log the
1766 * data as it might come in handy one day. */1767 * data as it might come in handy one day. */
1767 char *logline = 0;1768 const char *logline = 0;
1768 int client_id = 0;1769 int client_id = 0;
1769 1770
1770 for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {1771 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