From a0941c8a2b3e55dc4482c874523afcb7ed6e93e6 Mon Sep 17 00:00:00 2001 From: Reimar Döffinger Date: Tue, 29 Jul 2014 21:10:39 +0200 Subject: Use new av_dict_set_int helper function. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Get rid of the many, slightly differing, implementations of basically the same thing. Signed-off-by: Reimar Döffinger --- libavformat/ftp.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'libavformat/ftp.c') 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); -- cgit v1.2.3