[FFmpeg-cvslog] Merge commit '67351924fa91dea4339109100a4c0689f006581f'

Clément Bœsch git at videolan.org
Thu Mar 30 11:28:21 EEST 2017


ffmpeg | branch: master | Clément Bœsch <cboesch at gopro.com> | Thu Mar 30 10:26:29 2017 +0200| [03f5e80bdbbfa3229b6af3ad7bc94cc1468cc1b6] | committer: Clément Bœsch

Merge commit '67351924fa91dea4339109100a4c0689f006581f'

* commit '67351924fa91dea4339109100a4c0689f006581f':
  Drop unreachable break and return statements

Merged-by: Clément Bœsch <cboesch at gopro.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=03f5e80bdbbfa3229b6af3ad7bc94cc1468cc1b6
---

 libavcodec/bmvvideo.c  | 1 -
 libavcodec/hevc_sei.c  | 1 -
 libavcodec/sanm.c      | 3 ---
 libavformat/rtpproto.c | 1 -
 libavformat/rtspdec.c  | 1 -
 libavformat/smush.c    | 1 -
 libavutil/opt.c        | 2 --
 7 files changed, 10 deletions(-)

diff --git a/libavcodec/bmvvideo.c b/libavcodec/bmvvideo.c
index dbbc100..78a0945 100644
--- a/libavcodec/bmvvideo.c
+++ b/libavcodec/bmvvideo.c
@@ -193,7 +193,6 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame,
         if (dst == dst_end)
             return 0;
     }
-    return 0;
 }
 
 static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index a4b93c2..8fc026c 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -354,7 +354,6 @@ static int decode_nal_sei_message(HEVCContext *s)
     } else { /* nal_unit_type == NAL_SEI_SUFFIX */
         return decode_nal_sei_suffix(s, payload_type, payload_size);
     }
-    return 1;
 }
 
 static int more_rbsp_data(GetBitContext *gb)
diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index bac6fb4..dab9e41 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -978,13 +978,10 @@ static int process_frame_obj(SANMVideoContext *ctx)
     case 1:
     case 3:
         return old_codec1(ctx, top, left, w, h);
-        break;
     case 37:
         return old_codec37(ctx, top, left, w, h);
-        break;
     case 47:
         return old_codec47(ctx, top, left, w, h);
-        break;
     default:
         avpriv_request_sample(ctx->avctx, "Subcodec %d", codec);
         return AVERROR_PATCHWELCOME;
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index 840a36d..0706cae 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -512,7 +512,6 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size)
         if (h->flags & AVIO_FLAG_NONBLOCK)
             return AVERROR(EAGAIN);
     }
-    return len;
 }
 
 static int rtp_write(URLContext *h, const uint8_t *buf, int size)
diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index a722b98..0cb8f53 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -698,7 +698,6 @@ static int rtsp_listen(AVFormatContext *s)
             return AVERROR_INVALIDDATA;
         }
     }
-    return 0;
 }
 
 static int rtsp_probe(AVProbeData *p)
diff --git a/libavformat/smush.c b/libavformat/smush.c
index 5a9249a..fe544d8 100644
--- a/libavformat/smush.c
+++ b/libavformat/smush.c
@@ -129,7 +129,6 @@ static int smush_read_header(AVFormatContext *ctx)
                 break;
             default:
                 return AVERROR_INVALIDDATA;
-                break;
             }
         }
 
diff --git a/libavutil/opt.c b/libavutil/opt.c
index 6ae2af6..6f87078 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -311,8 +311,6 @@ static int set_string_number(void *obj, void *target_obj, const AVOption *o, con
         if (!i || !*val)
             return 0;
     }
-
-    return 0;
 }
 
 static int set_string_image_size(void *obj, const AVOption *o, const char *val, int *dst)


======================================================================

diff --cc libavutil/opt.c
index 6ae2af6,44d6299..6f87078
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@@ -308,149 -236,14 +308,147 @@@ static int set_string_number(void *obj
          if ((ret = write_number(obj, o, dst, d, 1, 1)) < 0)
              return ret;
          val += i;
 -        if (!*val)
 +        if (!i || !*val)
              return 0;
 -        notfirst = 1;
      }
- 
-     return 0;
  }
  
 +static int set_string_image_size(void *obj, const AVOption *o, const char *val, int *dst)
 +{
 +    int ret;
 +
 +    if (!val || !strcmp(val, "none")) {
 +        dst[0] =
 +        dst[1] = 0;
 +        return 0;
 +    }
 +    ret = av_parse_video_size(dst, dst + 1, val);
 +    if (ret < 0)
 +        av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as image size\n", val);
 +    return ret;
 +}
 +
 +static int set_string_video_rate(void *obj, const AVOption *o, const char *val, AVRational *dst)
 +{
 +    int ret;
 +    if (!val) {
 +        ret = AVERROR(EINVAL);
 +    } else {
 +        ret = av_parse_video_rate(dst, val);
 +    }
 +    if (ret < 0)
 +        av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as video rate\n", val);
 +    return ret;
 +}
 +
 +static int set_string_color(void *obj, const AVOption *o, const char *val, uint8_t *dst)
 +{
 +    int ret;
 +
 +    if (!val) {
 +        return 0;
 +    } else {
 +        ret = av_parse_color(dst, val, -1, obj);
 +        if (ret < 0)
 +            av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as color\n", val);
 +        return ret;
 +    }
 +    return 0;
 +}
 +
 +static const char *get_bool_name(int val)
 +{
 +    if (val < 0)
 +        return "auto";
 +    return val ? "true" : "false";
 +}
 +
 +static int set_string_bool(void *obj, const AVOption *o, const char *val, int *dst)
 +{
 +    int n;
 +
 +    if (!val)
 +        return 0;
 +
 +    if (!strcmp(val, "auto")) {
 +        n = -1;
 +    } else if (av_match_name(val, "true,y,yes,enable,enabled,on")) {
 +        n = 1;
 +    } else if (av_match_name(val, "false,n,no,disable,disabled,off")) {
 +        n = 0;
 +    } else {
 +        char *end = NULL;
 +        n = strtol(val, &end, 10);
 +        if (val + strlen(val) != end)
 +            goto fail;
 +    }
 +
 +    if (n < o->min || n > o->max)
 +        goto fail;
 +
 +    *dst = n;
 +    return 0;
 +
 +fail:
 +    av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as boolean\n", val);
 +    return AVERROR(EINVAL);
 +}
 +
 +static int set_string_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst,
 +                          int fmt_nb, int ((*get_fmt)(const char *)), const char *desc)
 +{
 +    int fmt, min, max;
 +
 +    if (!val || !strcmp(val, "none")) {
 +        fmt = -1;
 +    } else {
 +        fmt = get_fmt(val);
 +        if (fmt == -1) {
 +            char *tail;
 +            fmt = strtol(val, &tail, 0);
 +            if (*tail || (unsigned)fmt >= fmt_nb) {
 +                av_log(obj, AV_LOG_ERROR,
 +                       "Unable to parse option value \"%s\" as %s\n", val, desc);
 +                return AVERROR(EINVAL);
 +            }
 +        }
 +    }
 +
 +    min = FFMAX(o->min, -1);
 +    max = FFMIN(o->max, fmt_nb-1);
 +
 +    // hack for compatibility with old ffmpeg
 +    if(min == 0 && max == 0) {
 +        min = -1;
 +        max = fmt_nb-1;
 +    }
 +
 +    if (fmt < min || fmt > max) {
 +        av_log(obj, AV_LOG_ERROR,
 +               "Value %d for parameter '%s' out of %s format range [%d - %d]\n",
 +               fmt, o->name, desc, min, max);
 +        return AVERROR(ERANGE);
 +    }
 +
 +    *(int *)dst = fmt;
 +    return 0;
 +}
 +
 +static int set_string_pixel_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst)
 +{
 +    return set_string_fmt(obj, o, val, dst,
 +                          AV_PIX_FMT_NB, av_get_pix_fmt, "pixel format");
 +}
 +
 +static int set_string_sample_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst)
 +{
 +    return set_string_fmt(obj, o, val, dst,
 +                          AV_SAMPLE_FMT_NB, av_get_sample_fmt, "sample format");
 +}
 +
  int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
  {
 +    int ret = 0;
      void *dst, *target_obj;
      const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
      if (!o || !target_obj)



More information about the ffmpeg-cvslog mailing list