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