[MPlayer-dev-eng] [PATCH 6/7] Replace hardcoded str size with sizeof
Clément Bœsch
ubitux at gmail.com
Mon Oct 18 12:05:56 CEST 2010
str has 256 Bytes but could be changed.
---
stream/network.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/stream/network.c b/stream/network.c
index 1ec1220..a571e06 100644
--- a/stream/network.c
+++ b/stream/network.c
@@ -209,7 +209,7 @@ http_send_request( URL_t *url, off_t pos ) {
mp_msg(MSGT_NETWORK, MSGL_ERR, "Invalid URL '%s' to proxify\n", url->file+1);
goto err_out;
}
- snprintf(str, 256, "http://%s:%d%s",
+ snprintf(str, sizeof(str), "http://%s:%d%s",
server_url->hostname,
server_url->port ? server_url->port : 80,
server_url->file);
@@ -219,14 +219,14 @@ http_send_request( URL_t *url, off_t pos ) {
http_set_uri( http_hdr, server_url->file );
}
if (server_url->port && server_url->port != 80)
- snprintf(str, 256, "Host: %s:%d", server_url->hostname, server_url->port );
+ snprintf(str, sizeof(str), "Host: %s:%d", server_url->hostname, server_url->port );
else
- snprintf(str, 256, "Host: %s", server_url->hostname );
+ snprintf(str, sizeof(str), "Host: %s", server_url->hostname );
http_set_field( http_hdr, str);
if (network_useragent)
- snprintf(str, 256, "User-Agent: %s", network_useragent);
+ snprintf(str, sizeof(str), "User-Agent: %s", network_useragent);
else
- snprintf(str, 256, "User-Agent: %s", mplayer_version);
+ snprintf(str, sizeof(str), "User-Agent: %s", mplayer_version);
http_set_field(http_hdr, str);
if (network_referrer) {
@@ -251,7 +251,7 @@ http_send_request( URL_t *url, off_t pos ) {
if(pos>0) {
// Extend http_send_request with possibility to do partial content retrieval
- snprintf(str, 256, "Range: bytes=%"PRId64"-", (int64_t)pos);
+ snprintf(str, sizeof(str), "Range: bytes=%"PRId64"-", (int64_t)pos);
http_set_field(http_hdr, str);
}
--
1.7.3.1
More information about the MPlayer-dev-eng
mailing list