diff mbox

[FFmpeg-devel,1/3] avcodec/pnm_parser: Factor next initialization out

Message ID 20190406232114.12961-1-michael@niedermayer.cc
State Accepted
Commit 1d43d72b181afd59f9719c3bc38446f206fc3c6e
Headers show

Commit Message

Michael Niedermayer April 6, 2019, 11:21 p.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/pnm_parser.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Paul B Mahol April 7, 2019, 7:47 a.m. UTC | #1
On 4/7/19, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/pnm_parser.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c
> index e3bfa3c490..91a9edc016 100644
> --- a/libavcodec/pnm_parser.c
> +++ b/libavcodec/pnm_parser.c
> @@ -47,6 +47,7 @@ retry:
>          pnmctx.bytestream       = (uint8_t *) buf + skip; /* casts avoid
> warnings */
>          pnmctx.bytestream_end   = (uint8_t *) buf + buf_size - skip;
>      }
> +    next = END_NOT_FOUND;
>      if (ff_pnm_decode_header(avctx, &pnmctx) < 0) {
>          if (pnmctx.bytestream < pnmctx.bytestream_end) {
>              if (pc->index) {
> @@ -58,12 +59,10 @@ retry:
>              }
>              goto retry;
>          }
> -        next = END_NOT_FOUND;
>      } else if (pnmctx.type < 4) {
>                uint8_t *bs  = pnmctx.bytestream;
>          const uint8_t *end = pnmctx.bytestream_end;
>
> -        next = END_NOT_FOUND;
>          while (bs < end) {
>              int c = *bs++;
>              if (c == '#')  {
> --
> 2.21.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

lgtm
Michael Niedermayer April 10, 2019, 8:37 p.m. UTC | #2
On Sun, Apr 07, 2019 at 09:47:57AM +0200, Paul B Mahol wrote:
> On 4/7/19, Michael Niedermayer <michael@niedermayer.cc> wrote:
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/pnm_parser.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c
> > index e3bfa3c490..91a9edc016 100644
> > --- a/libavcodec/pnm_parser.c
> > +++ b/libavcodec/pnm_parser.c
> > @@ -47,6 +47,7 @@ retry:
> >          pnmctx.bytestream       = (uint8_t *) buf + skip; /* casts avoid
> > warnings */
> >          pnmctx.bytestream_end   = (uint8_t *) buf + buf_size - skip;
> >      }
> > +    next = END_NOT_FOUND;
> >      if (ff_pnm_decode_header(avctx, &pnmctx) < 0) {
> >          if (pnmctx.bytestream < pnmctx.bytestream_end) {
> >              if (pc->index) {
> > @@ -58,12 +59,10 @@ retry:
> >              }
> >              goto retry;
> >          }
> > -        next = END_NOT_FOUND;
> >      } else if (pnmctx.type < 4) {
> >                uint8_t *bs  = pnmctx.bytestream;
> >          const uint8_t *end = pnmctx.bytestream_end;
> >
> > -        next = END_NOT_FOUND;
> >          while (bs < end) {
> >              int c = *bs++;
> >              if (c == '#')  {
> > --
> > 2.21.0
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> 
> lgtm

will apply

thx

[...]
diff mbox

Patch

diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c
index e3bfa3c490..91a9edc016 100644
--- a/libavcodec/pnm_parser.c
+++ b/libavcodec/pnm_parser.c
@@ -47,6 +47,7 @@  retry:
         pnmctx.bytestream       = (uint8_t *) buf + skip; /* casts avoid warnings */
         pnmctx.bytestream_end   = (uint8_t *) buf + buf_size - skip;
     }
+    next = END_NOT_FOUND;
     if (ff_pnm_decode_header(avctx, &pnmctx) < 0) {
         if (pnmctx.bytestream < pnmctx.bytestream_end) {
             if (pc->index) {
@@ -58,12 +59,10 @@  retry:
             }
             goto retry;
         }
-        next = END_NOT_FOUND;
     } else if (pnmctx.type < 4) {
               uint8_t *bs  = pnmctx.bytestream;
         const uint8_t *end = pnmctx.bytestream_end;
 
-        next = END_NOT_FOUND;
         while (bs < end) {
             int c = *bs++;
             if (c == '#')  {