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>
This commit is contained in:
Reimar Döffinger
2014-07-29 21:10:39 +02:00
parent c2829dc925
commit a0941c8a2b
14 changed files with 34 additions and 102 deletions

View File

@@ -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);