]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/ftp.c
avcodec/mpeg4_unpack_bframes_bsf: Use avpriv_find_start_code
[ffmpeg] / libavformat / ftp.c
index 9aa7a45629ff6e67e6d65672bc7a6394bf2034a9..e0720674808dda1bdf593e841ec15311a12607c1 100644 (file)
@@ -489,8 +489,6 @@ static int ftp_list_nlst(FTPContext *s)
     return 0;
 }
 
-static int ftp_has_feature(FTPContext *s, const char *feature_name);
-
 static int ftp_list(FTPContext *s)
 {
     int ret;
@@ -515,7 +513,7 @@ static int ftp_features(FTPContext *s)
     static const char *feat_command        = "FEAT\r\n";
     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, 0};
+    static const int opts_codes[] = {200, 202, 451, 0};
 
     av_freep(&s->features);
     if (ftp_send_command(s, feat_command, feat_codes, &s->features) != 211) {
@@ -523,7 +521,8 @@ static int ftp_features(FTPContext *s)
     }
 
     if (ftp_has_feature(s, "UTF8")) {
-        if (ftp_send_command(s, enable_utf8_command, opts_codes, NULL) == 200)
+        int ret = ftp_send_command(s, enable_utf8_command, opts_codes, NULL);
+        if (ret == 200 || ret == 202)
             s->utf8 = 1;
     }
 
@@ -783,13 +782,13 @@ static int ftp_read(URLContext *h, unsigned char *buf, int size)
     if (s->state == DISCONNECTED) {
         /* optimization */
         if (s->position >= s->filesize)
-            return 0;
+            return AVERROR_EOF;
         if ((err = ftp_connect_data_connection(h)) < 0)
             return err;
     }
     if (s->state == READY) {
         if (s->position >= s->filesize)
-            return 0;
+            return AVERROR_EOF;
         if ((err = ftp_retrieve(s)) < 0)
             return err;
     }