summaryrefslogtreecommitdiff
path: root/libavformat/ftp.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2014-07-29 21:10:39 +0200
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2014-08-16 14:31:41 +0200
commita0941c8a2b3e55dc4482c874523afcb7ed6e93e6 (patch)
tree9e472048b168454605936246a7aeab4c0bade8f6 /libavformat/ftp.c
parentc2829dc925ffcc2a5934f3e99360a89fb0a3cad5 (diff)
Use new av_dict_set_int helper function.
Get rid of the many, slightly differing, implementations of basically the same thing. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diffstat (limited to 'libavformat/ftp.c')
-rw-r--r--libavformat/ftp.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/libavformat/ftp.c b/libavformat/ftp.c
index 66c066549e..9ee9b1630f 100644
--- a/libavformat/ftp.c
+++ b/libavformat/ftp.c
@@ -455,7 +455,7 @@ static int ftp_features(FTPContext *s)
static int ftp_connect_control_connection(URLContext *h)
{
- char buf[CONTROL_BUFFER_SIZE], opts_format[20], *response = NULL;
+ char buf[CONTROL_BUFFER_SIZE], *response = NULL;
int err;
AVDictionary *opts = NULL;
FTPContext *s = h->priv_data;
@@ -465,8 +465,7 @@ static int ftp_connect_control_connection(URLContext *h)
ff_url_join(buf, sizeof(buf), "tcp", NULL,
s->hostname, s->server_control_port, NULL);
if (s->rw_timeout != -1) {
- snprintf(opts_format, sizeof(opts_format), "%d", s->rw_timeout);
- av_dict_set(&opts, "timeout", opts_format, 0);
+ av_dict_set_int(&opts, "timeout", s->rw_timeout, 0);
} /* if option is not given, don't pass it and let tcp use its own default */
err = ffurl_open(&s->conn_control, buf, AVIO_FLAG_READ_WRITE,
&h->interrupt_callback, &opts);
@@ -505,7 +504,7 @@ static int ftp_connect_control_connection(URLContext *h)
static int ftp_connect_data_connection(URLContext *h)
{
int err;
- char buf[CONTROL_BUFFER_SIZE], opts_format[20];
+ char buf[CONTROL_BUFFER_SIZE];
AVDictionary *opts = NULL;
FTPContext *s = h->priv_data;
@@ -519,8 +518,7 @@ static int ftp_connect_data_connection(URLContext *h)
/* Open data connection */
ff_url_join(buf, sizeof(buf), "tcp", NULL, s->hostname, s->server_data_port, NULL);
if (s->rw_timeout != -1) {
- snprintf(opts_format, sizeof(opts_format), "%d", s->rw_timeout);
- av_dict_set(&opts, "timeout", opts_format, 0);
+ av_dict_set_int(&opts, "timeout", s->rw_timeout, 0);
} /* if option is not given, don't pass it and let tcp use its own default */
err = ffurl_open(&s->conn_data, buf, h->flags,
&h->interrupt_callback, &opts);