X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2Fffmpeg%2Flibavformat%2Fftp.c;h=7faf4a5d66c44d8aa5dc218380a169a6a7496b24;hb=3545e9f2671f595d2a2f3ee75ca0393b01e35ef6;hp=66c066549e5b282cf73cc42ae71e45ee9b8336ab;hpb=7d210d4c7e9ba36e635eabc5b5780495f8a63292;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/ffmpeg/libavformat/ftp.c b/src/third_party/ffmpeg/libavformat/ftp.c index 66c0665..7faf4a5 100644 --- a/src/third_party/ffmpeg/libavformat/ftp.c +++ b/src/third_party/ffmpeg/libavformat/ftp.c @@ -183,6 +183,9 @@ static int ftp_send_command(FTPContext *s, const char *command, { int err; + if (response) + *response = NULL; + if ((err = ffurl_write(s->conn_control, command, strlen(command))) < 0) return err; if (!err) @@ -444,18 +447,20 @@ static int ftp_features(FTPContext *s) static const char *enable_utf8_command = "OPTS UTF8 ON\r\n"; static const int feat_codes[] = {211, 0}; static const int opts_codes[] = {200, 451}; - char *feat; + char *feat = NULL; if (ftp_send_command(s, feat_command, feat_codes, &feat) == 211) { if (av_stristr(feat, "UTF8")) ftp_send_command(s, enable_utf8_command, opts_codes, NULL); } + av_freep(&feat); + return 0; } 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 +470,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 +509,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 +523,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);